From 029e1cf638adbfe7d478416adedcdba5c256915d Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Sun, 4 Jun 2023 16:57:31 +0100 Subject: [PATCH] Improve dev container (#4) * build against libdragon unstable * remove libPng * Fix build warnings * Add remote deploy * Switch to ubuntu latest image * Improve readme --- .devcontainer/Dockerfile | 4 ++-- .gitattributes | 4 +++- .github/workflows/build.yml | 21 +------------------- .gitmodules | 2 +- Makefile | 10 +++++++--- README.md | 36 ++++++++++++++++++++++++++++------- libdragon | 2 +- deploy.bat => localdeploy.bat | 2 ++ remotedeploy.sh | 31 ++++++++++++++++++++++++++++++ src/main.c | 2 +- src/menu/menu_info.c | 2 +- 11 files changed, 79 insertions(+), 37 deletions(-) rename deploy.bat => localdeploy.bat (91%) create mode 100644 remotedeploy.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index e1ce623e..835b8758 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -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 && \ diff --git a/.gitattributes b/.gitattributes index b3fc4706..12a6444e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,3 @@ -* text=auto eol=crlf \ No newline at end of file +* text=auto eol=crlf +# These are all bash scripts and should use lf +*.sh text eol=lf diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4c87f60e..43285528 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: @@ -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 @@ -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: diff --git a/.gitmodules b/.gitmodules index be699630..26f9db99 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "libdragon"] path = libdragon url = https://github.com/DragonMinded/libdragon - branch = trunk + branch = unstable diff --git a/Makefile b/Makefile index 875ed913..516a91ef 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/README.md b/README.md index 4d5782f0..99ee916b 100644 --- a/README.md +++ b/README.md @@ -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. ``` @@ -58,14 +59,31 @@ 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/ @@ -73,3 +91,7 @@ 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. diff --git a/libdragon b/libdragon index 2413aacd..560a40f3 160000 --- a/libdragon +++ b/libdragon @@ -1 +1 @@ -Subproject commit 2413aacd5c3119fe9c3ef9b8fa5e4e965a15cc01 +Subproject commit 560a40f3ef89a2e7188e418e86f53d4a0bcf732a diff --git a/deploy.bat b/localdeploy.bat similarity index 91% rename from deploy.bat rename to localdeploy.bat index 63e6dbc4..19c6c1fc 100644 --- a/deploy.bat +++ b/localdeploy.bat @@ -21,3 +21,5 @@ echo !!! Now toggle power to the N64 !!! echo: echo: ::pause + +::%~dp0tools\sc64\sc64deployer debug diff --git a/remotedeploy.sh b/remotedeploy.sh new file mode 100644 index 00000000..a233154c --- /dev/null +++ b/remotedeploy.sh @@ -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 diff --git a/src/main.c b/src/main.c index 2b6d4ddc..c4e5e96b 100644 --- a/src/main.c +++ b/src/main.c @@ -21,7 +21,7 @@ static void init (void) { static void deinit (void) { flashcart_deinit(); - rdp_close(); + rdpq_close(); rspq_close(); audio_close(); display_close(); diff --git a/src/menu/menu_info.c b/src/menu/menu_info.c index dc17b782..012018ae 100644 --- a/src/menu/menu_info.c +++ b/src/menu/menu_info.c @@ -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);