Building for Wii - TheXTech/TheXTech GitHub Wiki

In December 2022, experimental support for Nintendo Wii was added to TheXTech.

Dependencies

Building the Nintendo Wii version of the game requires the homebrew toolchain devkitPro. devkitPro is supported on Linux, macOS and Windows. Wii builds have primarily been tested on Linux-based operating systems. Please follow your platform's appropriate steps to install the devkitPro, and ensure that the environment variables DEVKITPRO and DEVKITPPC is set as per the official instructions.

Once devkitPro is installed, you'll be using the CMake parameter -DCMAKE_TOOLCHAIN_FILE to tell CMake what parameters, compilers, and arguments it should use to cross-compile for Nintendo Wii.

For example:

# Simplest Nintendo Wii cross-compilation example
cmake -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/Wii.cmake

You are required to build and install the compatible SDL2 version as DevkitPro doesn't offer any compatible SDL2 for Wii at all.

# Cross-compiling SDL2 for Nintendo Wii
git clone https://github.com/Wohlstand/SDL.git -b wii-support --depth 1 SDL2
cd SDL2
cmake -B build-wii -G Ninja \
    -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/Wii.cmake \
    -DCMAKE_PREFIX_PATH=$DEVKITPRO/portlibs/wii-local \
    -DCMAKE_PREFIX_PATH=$DEVKITPRO/portlibs/wii-local ..
cmake --build build-wii --target all -j4
sudo cmake --build build-wii --target install

Note: To avoid possible conflict with installed libraries, we will make our own "wii-local" directory to store our custom library builds.

Preparing to build

Before to start the build, you should obtain the source code for TheXTech. You can use the stable version as well as the latest in-development to test out any new experimental features and receive any further bugfixes earlier.

Stable version

If you want to build the stable version, you can simply download the source code archive from the official site or from GitHub releases:

And then, unpack the archive and open the terminal at the just-now unpacked directory that contains the source code for TheXTech.

Important note: Please never use the "Source code" links at Github releases: they are broken. Instead, download the thextech-full-src-v*.*.*.tar.gz or thextech-full-src-v*.*.*.tar.bz2 or thextech-full-src-v*.*.*.zip archive.

This project uses submodules and GitHub is unable to create source code packages that includes submodules too.

Development version

If you want to build the latest in-development version, then, instead of downloading the archive, you can clone the repository itself by running this in a terminal (please open the terminal at the directory where you want to put the clonned repository, so, you will know where it is):

git clone https://github.com/TheXTech/TheXTech.git

Then, Make sure all submodules have been pulled, otherwise, it won't build:

cd TheXTech
git submodule init
git submodule update

Building

At the TheXTech's source code directory, run next commands in the terminal:

  1. Make the building directory:

    mkdir build-wii
    cd build-wii
    
  2. Run CMake configuration:

    For the optimized, fast build

    # when you want to use the regular GNU Make
    cmake -DCMAKE_BUILD_TYPE=MinSizeRel \
             -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/Wii.cmake \
             -DCMAKE_PREFIX_PATH=$DEVKITPRO/portlibs/wii-local \
             -DCMAKE_INSTALL_PREFIX=$DEVKITPRO/portlibs/wii ..
    
    # OR when you want to use Ninja which does better parallel processes management
    cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel \
             -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/Wii.cmake \
             -DCMAKE_PREFIX_PATH=$DEVKITPRO/portlibs/wii-local \
             -DCMAKE_INSTALL_PREFIX=$DEVKITPRO/portlibs/wii ..
    

    For a slower, debug build (useful for verbose logging)

    # when you want to use the regular GNU Make
    cmake -DCMAKE_BUILD_TYPE=Debug \
             -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/Wii.cmake \
             -DCMAKE_PREFIX_PATH=$DEVKITPRO/portlibs/wii-local \
             -DCMAKE_INSTALL_PREFIX=$DEVKITPRO/portlibs/wii ..
    
    # OR when you want to use Ninja which does better parallel processes management
    cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug \
             -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/Wii.cmake \
             -DCMAKE_PREFIX_PATH=$DEVKITPRO/portlibs/wii-local \
             -DCMAKE_INSTALL_PREFIX=$DEVKITPRO/portlibs/wii ..
    
  3. Run the build itself:

    # Run regular GNU Make build with 4 parallel tasks
    # (suggested on 4-core CPU, if you have more cores, use a different number than 4)
    make -j 4
    
    # Or run a Ninja build
    ninja
    

Running and debugging a build

The built game will not work until you will prepare the game root. The game root by default for Nintendo Wii is located at sdmc:/thextech/. Please create this directory and place your preferred game assets inside that directory before attempting to launch the Nintendo Wii version of the game. For debugging purposes you may simply copy a standard TheXTech asset pack to this directory, but see below for advice to significantly speed up the game.

Preparation of game assets

Asset conversion

The Wii has a relatively slow CPU. This is generally not a problem for gameplay because TheXTech's internal engine is highly optimized, but can cause problems when decompressing PNG textures during gameplay. A conversion script is provided at utils/convertkit/gfx-convert-wii.py, which converts an asset pack archive or a folder containing episodes to Wii-optimized formats. This conversion script is written in Python 3 and requires the ImageMagick convert and ffmpeg utilities to be present in your PATH.

Important note: To resolve an inability to convert some of large pictures (which will appear in the Analogue Funk), you should open the /etc/ImageMagick-6/policy.xml file in a text editor, find next lines:

  <policy domain="resource" name="width" value="16KP"/>
  <policy domain="resource" name="height" value="16KP"/>

And replace with:

  <policy domain="resource" name="width" value="33KP"/>
  <policy domain="resource" name="height" value="33KP"/>

Pre-converted asset packs

  1. Download one of two archives with compatible assets:
  2. Extract the assets archive to sdmc:/thextech/. The assets archive may contain a subdirectory; after extraction, directories such as sdmc:/thextech/graphics and sdmc:/thextech/music should be present.

Running game on hardware

Once the game is built and assets directory is ready, you can install the executable itself:

  • Create the directory sdmc:/apps/thextech-wii/
  • Find in the build directory files icon.png, meta.xml, and thextech.dol. Copy them into new-made sdmc:/apps/thextech-wii/ directory.
  • Rename thextech.dol into boot.dol.
  • Once you done that, you can load the Homebrew Channel, and find the TheXTech game in the list.

Running game on Dolphin emulator

You also can run the game on the Dolphin emulator: you can simply open the thextech.dol through the emulator directly.

Troubleshooting

  • Please ensure you have the latest devkitPro installed
  • Please ensure that the DEVKITPRO and DEVKITPPC environment variables are set OR exported in your .bashrc (or similar)
  • Please ensure that your assets are installed at sdmc:/thextech/