diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b08d94b..74bcaf8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -117,13 +117,48 @@ jobs: oceanpop/LICENSE.txt oceanpop/README.md + Wii: + runs-on: ubuntu-latest + container: devkitpro/devkitppc:latest + steps: + - name: Checkout json-cpp + uses: actions/checkout@v3 + with: + repository: open-source-parsers/jsoncpp + path: jsoncpp + ref: 1.9.5 + - name: Build json-cpp + run: | + cd jsoncpp + /opt/devkitpro/portlibs/wii/bin/powerpc-eabi-cmake -S. -Bbuild \ + -DJSONCPP_WITH_TESTS=OFF + cd build + make + sudo make install + - name: Checkout + uses: actions/checkout@v3 + - name: Build + run: | + mkdir oceanpop && cd oceanpop + /opt/devkitpro/portlibs/wii/bin/powerpc-eabi-cmake -DCMAKE_BUILD_TYPE=Release .. + make + - name: Prepare package + run: | + ./platform/wii/make_release.sh oceanpop ${{ github.ref_name }} + - name: Publish artifacts + uses: actions/upload-artifact@v3 + with: + name: oceanpop-wii + path: | + oceanpop/oceanpop*.zip + Release: - needs: [Linux, Windows, PSP, Vita] + needs: [Linux, Windows, PSP, Vita, Wii] if: ${{ github.ref_type == 'tag' }} runs-on: ubuntu-latest strategy: matrix: - build: [linux, windows, psp, vita] + build: [linux, windows, psp, vita, wii] steps: - uses: actions/download-artifact@v3 - name: Zip artifacts diff --git a/BUILDING.md b/BUILDING.md index 016174a..ee5e0f8 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -85,3 +85,36 @@ make ``` The resulting ``EBOOT.PBP`` and ``assets`` directory can be copied into the ``PSP/GAME/oceanpop`` directory on the PSP memory card. If this directory does not exist yet, create it. + + +## Nintendo Wii + +To build for the Nintendo Wii you need to install the needed SDL2 dependencies via [devkitPro](https://devkitpro.org/): + +``` +sudo dkp-pacman -S wii-sdl2 wii-sdl2_image wii-sdl2_mixer wii-sdl2_ttf +``` + +You will also need to build `json-cpp` by yourself, since it's not part of devkitPro. This can be done with the following commands: + +``` +# This assumes that you are located in a clean checkout of the json-cpp repo: +source /etc/profile.d/devkit-env.sh +cmake -S. -Bbuild \ + -DCMAKE_TOOLCHAIN_FILE="$DEVKITPRO/cmake/Wii.cmake" \ + -DJSONCPP_WITH_TESTS=OFF +cd build +make +sudo make install +``` + +Once this is done, change the current directory to the oceanpop source tree and type +``` +./platform/add-new-platform.sh wii 640x480 +source /etc/profile.d/devkit-env.sh +cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE="$DEVKITPRO/cmake/Wii.cmake" +cd build +make +``` + +The resulting ``oceanpop.dol`` and ``assets`` directory can be copied into the ``apps/oceanpop`` directory on the Wii SD card. If this directory does not exist yet, create it. diff --git a/CMakeLists.txt b/CMakeLists.txt index 13b979c..4867649 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,6 +74,8 @@ if(PSP) set(ASSETS_BACKGROUNDS "${CMAKE_CURRENT_SOURCE_DIR}/platform/psp/assets/backgrounds") elseif(VITA) set(ASSETS_BACKGROUNDS "${CMAKE_SOURCE_DIR}/platform/vita/assets/backgrounds") +elseif(CMAKE_SYSTEM_NAME MATCHES "NintendoWii") + set(ASSETS_BACKGROUNDS "${CMAKE_SOURCE_DIR}/platform/wii/assets/backgrounds") endif() # Copy assets @@ -125,6 +127,8 @@ elseif(PLATFORM_PSP) PREVIEW_PATH NULL TITLE OceanPop ) +elseif(CMAKE_SYSTEM_NAME MATCHES "NintendoWii") + ogc_create_dol(oceanpop) elseif(win32) # Nothing here yet else() diff --git a/platform/update-platforms.sh b/platform/update-platforms.sh index 12484d7..83d96b8 100755 --- a/platform/update-platforms.sh +++ b/platform/update-platforms.sh @@ -1,3 +1,4 @@ #!/bin/bash ./add-new-platform.sh psp 480x272 ogg ./add-new-platform.sh vita 960x544 +./add-new-platform.sh wii 640x480 diff --git a/platform/wii/assets/backgrounds/background1.jpg b/platform/wii/assets/backgrounds/background1.jpg new file mode 100644 index 0000000..5422e5d Binary files /dev/null and b/platform/wii/assets/backgrounds/background1.jpg differ diff --git a/platform/wii/assets/backgrounds/background2.jpg b/platform/wii/assets/backgrounds/background2.jpg new file mode 100644 index 0000000..539cde7 Binary files /dev/null and b/platform/wii/assets/backgrounds/background2.jpg differ diff --git a/platform/wii/assets/backgrounds/background3.jpg b/platform/wii/assets/backgrounds/background3.jpg new file mode 100644 index 0000000..8b809c6 Binary files /dev/null and b/platform/wii/assets/backgrounds/background3.jpg differ diff --git a/platform/wii/assets/backgrounds/background4.jpg b/platform/wii/assets/backgrounds/background4.jpg new file mode 100644 index 0000000..4611c47 Binary files /dev/null and b/platform/wii/assets/backgrounds/background4.jpg differ diff --git a/platform/wii/assets/backgrounds/menu.jpg b/platform/wii/assets/backgrounds/menu.jpg new file mode 100644 index 0000000..6e18ef7 Binary files /dev/null and b/platform/wii/assets/backgrounds/menu.jpg differ diff --git a/platform/wii/icon.png b/platform/wii/icon.png new file mode 100644 index 0000000..99f7d9b Binary files /dev/null and b/platform/wii/icon.png differ diff --git a/platform/wii/make_release.sh b/platform/wii/make_release.sh new file mode 100755 index 0000000..ecda8e2 --- /dev/null +++ b/platform/wii/make_release.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +set -e + +usage() { + echo "Usage: ${0} builddir version" + echo "" + echo "builddir: path to the build directory" + echo "version: package version" + exit 1 +} + +if [ -z "${1}" ]||[ -z "${2}" ]; then + echo "Please fill in all required fields" + usage +fi + +BUILDDIR="$1" +VERSION="$2" + +PLATFORMDIR="$(dirname "$0")" +RELEASEDIR="$BUILDDIR/oceanpop" + +rm -rf "$RELEASEDIR" +mkdir -p "$RELEASEDIR" + +cp "$BUILDDIR/oceanpop.dol" "$RELEASEDIR/boot.dol" +cp "$PLATFORMDIR/icon.png" "$RELEASEDIR" +sed "s/VERSION/$VERSION/" "$PLATFORMDIR/meta.xml" > "$RELEASEDIR/meta.xml" +cp -a "$BUILDDIR/assets" "$RELEASEDIR" + +cd "$BUILDDIR" +rm -f "oceanpop_$VERSION.zip" +zip -r "oceanpop_$VERSION.zip" "oceanpop" + +echo "The release is ready at" +echo +echo " $BUILDDIR/oceanpop_$VERSION.zip" +echo +echo "You can now upload this file to the releases page:" +echo " https://github.com/sharkwouter/oceanpop/releases" + diff --git a/platform/wii/meta.xml b/platform/wii/meta.xml new file mode 100644 index 0000000..ce7c89e --- /dev/null +++ b/platform/wii/meta.xml @@ -0,0 +1,10 @@ + + + OceanPop + Wouter Wijsman + VERSION + 20240322152132 + A relaxing match 3 puzzle game + Dive into the relaxing world of OceanPop and experience waves of match-3 gameplay with the three modes available! + + diff --git a/src/utils.cpp b/src/utils.cpp index 96adbbc..dce0d97 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -12,7 +12,11 @@ void panic(const std::string &reason) { std::string getResourcePath(std::string file) { std::string path = ""; +#if defined(__wii__) + char * base_path = SDL_GetPrefPath(NULL,"oceanpop"); +#else char * base_path = SDL_GetBasePath(); +#endif if (base_path) { path += base_path; SDL_free(base_path);