Skip to content

Commit

Permalink
Merge pull request #73 from mardy/wii-port
Browse files Browse the repository at this point in the history
Add Wii port
  • Loading branch information
sharkwouter authored May 18, 2024
2 parents 6750f40 + b3cf587 commit 2c6238b
Show file tree
Hide file tree
Showing 13 changed files with 131 additions and 2 deletions.
39 changes: 37 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 33 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions platform/update-platforms.sh
Original file line number Diff line number Diff line change
@@ -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
Binary file added platform/wii/assets/backgrounds/background1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added platform/wii/assets/backgrounds/background2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added platform/wii/assets/backgrounds/background3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added platform/wii/assets/backgrounds/background4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added platform/wii/assets/backgrounds/menu.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added platform/wii/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions platform/wii/make_release.sh
Original file line number Diff line number Diff line change
@@ -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"

10 changes: 10 additions & 0 deletions platform/wii/meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<app version="1">
<name>OceanPop</name>
<coder>Wouter Wijsman</coder>
<version>VERSION</version>
<release_date>20240322152132</release_date>
<short_description>A relaxing match 3 puzzle game</short_description>
<long_description>Dive into the relaxing world of OceanPop and experience waves of match-3 gameplay with the three modes available!
</long_description>
</app>
4 changes: 4 additions & 0 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2c6238b

Please sign in to comment.