Skip to content

Commit

Permalink
Improve dev container (#4)
Browse files Browse the repository at this point in the history
* build against libdragon unstable

* remove libPng

* Fix build warnings

* Add remote deploy

* Switch to ubuntu latest image

* Improve readme
  • Loading branch information
networkfusion authored Jun 4, 2023
1 parent 8adc056 commit 029e1cf
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 37 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM debian:stable-slim
FROM ubuntu:latest

RUN apt-get update && \
apt-get upgrade -y && \
apt-get install build-essential git libpng-dev python3 wget -y && \
apt-get install build-essential git python3 wget -y && \
wget https://github.com/DragonMinded/libdragon/releases/download/toolchain-continuous-prerelease/gcc-toolchain-mips64-x86_64.deb && \
dpkg -i gcc-toolchain-mips64-x86_64.deb && \
rm gcc-toolchain-mips64-x86_64.deb && \
Expand Down
4 changes: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
* text=auto eol=crlf
* text=auto eol=crlf
# These are all bash scripts and should use lf
*.sh text eol=lf
21 changes: 1 addition & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ on:
jobs:
build:
runs-on: ubuntu-latest
# container:
# image: ../Dockerfile
# # credentials:
# # username: ${{ github.actor }}
# # password: ${{ secrets.github_token }}
# volumes:
# - my_docker_volume:/volume_mount

steps:

Expand All @@ -26,7 +19,7 @@ jobs:

- uses: actions/checkout@v3
with:
submodules: true
submodules: recursive
fetch-depth: 1 # we only require the last check-in, unless we want to create a changelog.

- name: Login to GitHub Container Registry
Expand All @@ -36,18 +29,6 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

# - name: Build libdragon
# run: |
# cd ./libdragon
# # FIXME: this currently also builds the examples which adds to the build time.
# # ./build.sh
# # WORKAROUND: for CI
# make -j libdragon
# make install
# make -j tools
# make tools-install
# make install-mk

- name: Build N64FlashcartMenu ROM
uses: devcontainers/ci@v0.3
with:
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "libdragon"]
path = libdragon
url = https://github.com/DragonMinded/libdragon
branch = trunk
branch = unstable
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,17 @@ all: sc64_minify
.PHONY: all

clean:
$(shell rm -rf ./$(BUILD_DIR))
$(shell rm -rf ./$(OUTPUT_DIR))
$(shell rm -rf ./$(BUILD_DIR) ./$(OUTPUT_DIR))
.PHONY: clean

# run:
# $(shell sc64deployer --boot direct-rom %~dp0$(OUTPUT_DIR))\$(PROJECT_NAME).z64)
# $(shell ./remotedeploy.sh -d)
# FIXME: improve ability to deploy.
# if devcontainer, use remotedeploy.sh, else
# $(shell sc64deployer --boot direct-rom %~dp0$(OUTPUT_DIR))\$(PROJECT_NAME).z64)
# .PHONY: run

# test:
# TODO: run tests

-include $(wildcard $(BUILD_DIR)/*.d)
36 changes: 29 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
Download the `sc64menu.n64` ROM from the latest action run assets.
Add it to the root folder on your SD card.

(Optional):
Create a file called `config.sc64.toml.txt`
Add the following content, replacing the comments.
```
Expand Down Expand Up @@ -58,18 +59,39 @@ The aim is to replace [Altra64](https://github.com/networkfusion/altra64) and [E

You can use a dev container in VSCode to ease development.

Note: the dev container currently downloads and installs the latest available libdragon from the stable branch, rather than use the repos submodule.

To deploy:
* Download the deployer [here](https://github.com/Polprzewodnikowy/SummerCart64/releases/download/v2.14.0/sc64-deployer-windows-v2.14.0.zip)
* Extract and place `sc64deployer.exe` in the `tools/sc64` directory
* For the moment, deployment cannot happen within the dev container and you must do it from a terminal on the host.
* Run `./deploy.bat` from the terminal (in windows)
* Toggle the N64 power switch to load the ROM.
## To deploy:

* Download the deployer [here](https://github.com/Polprzewodnikowy/SummerCart64/releases/download/v2.15.1/sc64-deployer-windows-v2.15.1.zip)
* Extract and place `sc64deployer.exe` in the `tools/sc64` directory.

Make sure that your firmware is compatible (currently v2.15.1+)
See: https://github.com/Polprzewodnikowy/SummerCart64/blob/v2.15.1/docs/00_quick_startup_guide.md#firmware-backupupdate



### From the devcontainer
It is not currently possible to directly communicate with USB devices.
BUT, as a work around you can use a proxy TCP/IP connection
Set up a proxy: open a terminal window, `cd ./tools/sc64` and then `./sc64deployer.exe server`

Then in the dev container, use `./remotedeploy.sh`


### From your host (Windows) OS

* Run `./localdeploy.bat` from the terminal


Toggle the N64 power switch to load the ROM.

`ms-vscode.makefile-tools` will help (installed automatically in dev container).
TODO: it does not yet work with `F5`: see https://devblogs.microsoft.com/cppblog/now-announcing-makefile-support-in-visual-studio-code/
WORKAROUND: in the dev container terminal, use make directly, i.e.: `make`
The ROM can be found in the `output` directory.

NOTE: a "release" version of the SC64 menu is called `sc64menu.n64` and can be created for when you want to add it directly to the SDCard. This is generated by running `make all` or running `make sc64_minify`.

# Update Libdragon
This repo currently uses the `unstable` branch as a submodule at a specific commit.
To update to the latest version, use `git submodule update --remote ` from the terminal.
2 changes: 1 addition & 1 deletion libdragon
Submodule libdragon updated 289 files
2 changes: 2 additions & 0 deletions deploy.bat → localdeploy.bat
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ echo !!! Now toggle power to the N64 !!!
echo:
echo:
::pause

::%~dp0tools\sc64\sc64deployer debug
31 changes: 31 additions & 0 deletions remotedeploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

set -e

REMOTE="--remote host.docker.internal:9064"

## FIXME: this does not work!
# Make sure we are connected
#echo Detecting SC64...
#sc64deployer $REMOTE list

# Get the information
echo SC64 info...:
sc64deployer $REMOTE info
echo
echo

# Load the ROM
echo Loading ROM...:
sc64deployer $REMOTE upload ./output/N64FlashcartMenu.z64

echo
echo
# Toggle the power of the N64 to boot the ROM.
echo !!! Now toggle power to the N64 !!!
echo
echo

if [ "$1" = "-d" ]; then
sc64deployer $REMOTE debug
fi
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static void init (void) {

static void deinit (void) {
flashcart_deinit();
rdp_close();
rdpq_close();
rspq_close();
audio_close();
display_close();
Expand Down
2 changes: 1 addition & 1 deletion src/menu/menu_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ static void draw_header(display_context_t disp) {

void menu_info(void) {
display_init(RESOLUTION_512x240, DEPTH_16_BPP, 3, GAMMA_NONE, ANTIALIAS_RESAMPLE);
display_context_t disp = display_lock();
display_context_t disp = display_get();
graphics_fill_screen(disp, 0);
draw_header(disp);

Expand Down

0 comments on commit 029e1cf

Please sign in to comment.