Improve dev container (#4)

* build against libdragon unstable

* remove libPng

* Fix build warnings

* Add remote deploy

* Switch to ubuntu latest image

* Improve readme
This commit is contained in:
Robin Jones 2023-06-04 16:57:31 +01:00 committed by GitHub
parent 8adc0568c1
commit 029e1cf638
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 79 additions and 37 deletions

View File

@ -1,8 +1,8 @@
FROM debian:stable-slim FROM ubuntu:latest
RUN apt-get update && \ RUN apt-get update && \
apt-get upgrade -y && \ 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 && \ 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 && \ dpkg -i gcc-toolchain-mips64-x86_64.deb && \
rm gcc-toolchain-mips64-x86_64.deb && \ rm gcc-toolchain-mips64-x86_64.deb && \

4
.gitattributes vendored
View File

@ -1 +1,3 @@
* text=auto eol=crlf * text=auto eol=crlf
# These are all bash scripts and should use lf
*.sh text eol=lf

View File

@ -11,13 +11,6 @@ on:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
# container:
# image: ../Dockerfile
# # credentials:
# # username: ${{ github.actor }}
# # password: ${{ secrets.github_token }}
# volumes:
# - my_docker_volume:/volume_mount
steps: steps:
@ -26,7 +19,7 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
submodules: true submodules: recursive
fetch-depth: 1 # we only require the last check-in, unless we want to create a changelog. fetch-depth: 1 # we only require the last check-in, unless we want to create a changelog.
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
@ -36,18 +29,6 @@ jobs:
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }} 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 - name: Build N64FlashcartMenu ROM
uses: devcontainers/ci@v0.3 uses: devcontainers/ci@v0.3
with: with:

2
.gitmodules vendored
View File

@ -1,4 +1,4 @@
[submodule "libdragon"] [submodule "libdragon"]
path = libdragon path = libdragon
url = https://github.com/DragonMinded/libdragon url = https://github.com/DragonMinded/libdragon
branch = trunk branch = unstable

View File

@ -44,13 +44,17 @@ all: sc64_minify
.PHONY: all .PHONY: all
clean: clean:
$(shell rm -rf ./$(BUILD_DIR)) $(shell rm -rf ./$(BUILD_DIR) ./$(OUTPUT_DIR))
$(shell rm -rf ./$(OUTPUT_DIR))
.PHONY: clean .PHONY: clean
# run: # 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: # test:
# TODO: run tests
-include $(wildcard $(BUILD_DIR)/*.d) -include $(wildcard $(BUILD_DIR)/*.d)

View File

@ -15,6 +15,7 @@
Download the `sc64menu.n64` ROM from the latest action run assets. Download the `sc64menu.n64` ROM from the latest action run assets.
Add it to the root folder on your SD card. Add it to the root folder on your SD card.
(Optional):
Create a file called `config.sc64.toml.txt` Create a file called `config.sc64.toml.txt`
Add the following content, replacing the comments. 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. 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: ## 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 * Download the deployer [here](https://github.com/Polprzewodnikowy/SummerCart64/releases/download/v2.15.1/sc64-deployer-windows-v2.15.1.zip)
* For the moment, deployment cannot happen within the dev container and you must do it from a terminal on the host. * Extract and place `sc64deployer.exe` in the `tools/sc64` directory.
* Run `./deploy.bat` from the terminal (in windows)
* Toggle the N64 power switch to load the ROM. 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). `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/ 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. 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`. 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.

@ -1 +1 @@
Subproject commit 2413aacd5c3119fe9c3ef9b8fa5e4e965a15cc01 Subproject commit 560a40f3ef89a2e7188e418e86f53d4a0bcf732a

View File

@ -21,3 +21,5 @@ echo !!! Now toggle power to the N64 !!!
echo: echo:
echo: echo:
::pause ::pause
::%~dp0tools\sc64\sc64deployer debug

31
remotedeploy.sh Normal file
View File

@ -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

View File

@ -21,7 +21,7 @@ static void init (void) {
static void deinit (void) { static void deinit (void) {
flashcart_deinit(); flashcart_deinit();
rdp_close(); rdpq_close();
rspq_close(); rspq_close();
audio_close(); audio_close();
display_close(); display_close();

View File

@ -7,7 +7,7 @@ static void draw_header(display_context_t disp) {
void menu_info(void) { void menu_info(void) {
display_init(RESOLUTION_512x240, DEPTH_16_BPP, 3, GAMMA_NONE, ANTIALIAS_RESAMPLE); 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); graphics_fill_screen(disp, 0);
draw_header(disp); draw_header(disp);