From 7969d84257a78dc9ca09e40acf36d1201d8322a4 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Sat, 16 Nov 2024 15:01:36 +0100 Subject: [PATCH 1/6] ci: nswitch: add autobuilds --- .github/workflows/c-cpp.yml | 35 ++++++++++++++++++++++++++++ tools/buildscripts/nswitch_docker.sh | 32 +++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 tools/buildscripts/nswitch_docker.sh diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index c4a7aa1a1..fc0be5336 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -151,6 +151,41 @@ jobs: path: bin/ retention-days: 0 + build-arm64-switch: + runs-on: ubuntu-latest + steps: + - name: Install host dependencies + run: | + sudo apt-get update + sudo apt-get install git make cmake curl + - name: Install devkitA64 docker image + run: sudo docker pull devkitpro/devkita64:latest + - name: Checkout repository + uses: actions/checkout@v4 + - name: Build pd.arm64.nro + run: sudo docker run --name pd --rm -v `pwd`:`pwd` -w `pwd` devkitpro/devkita64:latest bash ./tools/buildscripts/nswitch_docker.sh build + - name: Build pd.pal.arm64.nro + run: sudo docker run --name pd --rm -v `pwd`:`pwd` -w `pwd` devkitpro/devkita64:latest bash ./tools/buildscripts/nswitch_docker.sh build_pal -DROMID=pal-final + - name: Build pd.jpn.arm64.nro + run: sudo docker run --name pd --rm -v `pwd`:`pwd` -w `pwd` devkitpro/devkita64:latest bash ./tools/buildscripts/nswitch_docker.sh build_jpn -DROMID=jpn-final + - name: Prepare artifact for packaging + run: | + mkdir -p bin/perfectdark/data + mkdir -p bin/perfectdark_pal/data + mkdir -p bin/perfectdark_jpn/data + cp build/pd.arm64.nro bin/ + cp build_pal/pd.pal.arm64.nro bin/ + cp build_jpn/pd.jpn.arm64.nro bin/ + touch bin/perfectdark/data/put_your_rom_here.txt + touch bin/perfectdark_pal/data/put_your_rom_here.txt + touch bin/perfectdark_jpn/data/put_your_rom_here.txt + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: pd-arm64-nswitch + path: bin/ + retention-days: 0 + build-flatpak-bundle: name: "Build flatpak bundle" runs-on: ubuntu-latest diff --git a/tools/buildscripts/nswitch_docker.sh b/tools/buildscripts/nswitch_docker.sh new file mode 100644 index 000000000..ebaeca518 --- /dev/null +++ b/tools/buildscripts/nswitch_docker.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +git config --global --add safe.directory '*' + +echo "Setting up environment..." + +# we can't actually download dkp-toolchain-vars even from here, so +export PORTLIBS_ROOT=${DEVKITPRO}/portlibs +export PATH=${DEVKITPRO}/tools/bin:${DEVKITPRO}/devkitA64/bin:$PATH +export TOOL_PREFIX=aarch64-none-elf- +export CC=${TOOL_PREFIX}gcc +export CXX=${TOOL_PREFIX}g++ +export AR=${TOOL_PREFIX}gcc-ar +export RANLIB=${TOOL_PREFIX}gcc-ranlib +export PORTLIBS_PREFIX=${DEVKITPRO}/portlibs/switch +export PATH=$PORTLIBS_PREFIX/bin:$PATH +export ARCH="-march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIC -ftls-model=local-exec" +export CFLAGS="${ARCH} -O2 -ffunction-sections -fdata-sections" +export CXXFLAGS="${CFLAGS}" +export CPPFLAGS="-D__SWITCH__ -I${PORTLIBS_PREFIX}/include -isystem ${DEVKITPRO}/libnx/include" +export LDFLAGS="${ARCH} -L${PORTLIBS_PREFIX}/lib -L${DEVKITPRO}/libnx/lib" +export LIBS="-lnx" + +echo "Configuring..." + +aarch64-none-elf-cmake -G"Unix Makefiles" -B$1 $2 $3 $4 $5 . || exit 1 + +echo "Building..." + +pushd $1 || exit 1 +make -j4 || exit 1 +popd || exit 1 From ef8413ae58bc62bdaae45cc371e3c5d17b9022e5 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Sat, 16 Nov 2024 15:05:54 +0100 Subject: [PATCH 2/6] ci: nswitch: put NROs into their subfolders --- .github/workflows/c-cpp.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index fc0be5336..38e890e45 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -173,9 +173,9 @@ jobs: mkdir -p bin/perfectdark/data mkdir -p bin/perfectdark_pal/data mkdir -p bin/perfectdark_jpn/data - cp build/pd.arm64.nro bin/ - cp build_pal/pd.pal.arm64.nro bin/ - cp build_jpn/pd.jpn.arm64.nro bin/ + cp build/pd.arm64.nro bin/perfectdark/ + cp build_pal/pd.pal.arm64.nro bin/perfectdark_pal/ + cp build_jpn/pd.jpn.arm64.nro bin/perfectdark_jpn/ touch bin/perfectdark/data/put_your_rom_here.txt touch bin/perfectdark_pal/data/put_your_rom_here.txt touch bin/perfectdark_jpn/data/put_your_rom_here.txt From 2542b21bfcc7d94debbd195af44a71bf24a7554b Mon Sep 17 00:00:00 2001 From: fgsfds Date: Sat, 16 Nov 2024 15:07:31 +0100 Subject: [PATCH 3/6] ci: nswitch: add nswitch builds to releases --- .github/workflows/c-cpp.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 38e890e45..9ce7ccd2f 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -225,7 +225,7 @@ jobs: publish-latest-build: runs-on: ubuntu-latest if: github.ref == 'refs/heads/port' - needs: [build-i686-windows, build-i686-linux, build-x86_64-windows, build-x86_64-linux, build-flatpak-bundle] + needs: [build-i686-windows, build-i686-linux, build-x86_64-windows, build-x86_64-linux, build-arm64-nswitch, build-flatpak-bundle] permissions: contents: write steps: @@ -243,6 +243,7 @@ jobs: tar czf ../ci-release/pd-x86_64-linux.tar.gz pd-x86_64-linux zip -r ../ci-release/pd-i686-windows.zip pd-i686-windows zip -r ../ci-release/pd-x86_64-windows.zip pd-x86_64-windows + zip -r ../ci-release/pd-arm64-nswitch.zip pd-arm64-nswitch mv io.github.fgsfdsfgs.perfect_dark.flatpak/io.github.fgsfdsfgs.perfect_dark.flatpak ../ci-release/ popd git tag --force ci-dev-build port From c332738f7a16d52373600a42e86faddc17827e80 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Sat, 16 Nov 2024 15:08:51 +0100 Subject: [PATCH 4/6] ci: fix typo --- .github/workflows/c-cpp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 9ce7ccd2f..4b336d605 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -151,7 +151,7 @@ jobs: path: bin/ retention-days: 0 - build-arm64-switch: + build-arm64-nswitch: runs-on: ubuntu-latest steps: - name: Install host dependencies From 7658a96c1c086369fa26c421e6093a75ea6f4dc5 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Sat, 16 Nov 2024 15:20:36 +0100 Subject: [PATCH 5/6] readme: clarify nswitch installation --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 6cc20f684..f594f0cc5 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ Latest [automatic builds](https://github.com/fgsfdsfgs/perfect_dark/releases/tag * [i686-windows](https://github.com/fgsfdsfgs/perfect_dark/releases/download/ci-dev-build/pd-i686-windows.zip) * [x86_64-linux](https://github.com/fgsfdsfgs/perfect_dark/releases/download/ci-dev-build/pd-x86_64-linux.tar.gz) * [i686-linux](https://github.com/fgsfdsfgs/perfect_dark/releases/download/ci-dev-build/pd-i686-linux.tar.gz) +* [arm64-nswitch](https://github.com/fgsfdsfgs/perfect_dark/releases/download/ci-dev-build/pd-arm64-nswitch.zip) If you are looking for netplay builds (the `port-net` branch), see [this link](https://github.com/fgsfdsfgs/perfect_dark/blob/port-net/README.md#download). @@ -69,6 +70,12 @@ Additional information can be found in the [wiki](https://github.com/fgsfdsfgs/p A GPU supporting OpenGL 3.0 or above is required to run the port. +### Installing the Nintendo Switch version + +The Nintendo Switch build ZIP comes with all 3 regions in different folders: `perfectdark`, `perfectdark_pal` and `perfectdark_jon`. + +Take the folder for the region you want and put it into the `/switch` folder on your SD card, then put in your ROM as described above. + ## Controls 1964GEPD-style and Xbox-style bindings are implemented. From 363158a93d3a1cb9e7171bb4ac417f69d88734f6 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Sat, 16 Nov 2024 15:21:49 +0100 Subject: [PATCH 6/6] port: fix typo --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f594f0cc5..4437a7a05 100644 --- a/README.md +++ b/README.md @@ -72,9 +72,9 @@ A GPU supporting OpenGL 3.0 or above is required to run the port. ### Installing the Nintendo Switch version -The Nintendo Switch build ZIP comes with all 3 regions in different folders: `perfectdark`, `perfectdark_pal` and `perfectdark_jon`. +The Nintendo Switch build ZIP comes with all 3 regions in different folders: `perfectdark`, `perfectdark_pal` and `perfectdark_jpn`. -Take the folder for the region you want and put it into the `/switch` folder on your SD card, then put in your ROM as described above. +Take the folder for the region you want and put it into the `/switch` folder on your SD card, then put your ROM into the `data` folder inside of the folder you extracted as described above. ## Controls