diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index b9f0a2071..6fb3351fa 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-nswitch: + 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/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 + - 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 @@ -190,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: @@ -208,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 diff --git a/README.md b/README.md index 6cc20f684..4437a7a05 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_jpn`. + +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 1964GEPD-style and Xbox-style bindings are implemented. 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