Building for PS Vita - TheXTech/TheXTech GitHub Wiki

In August of 2021, support for PS Vita builds was added to TheXTech. The best part is that all related CMake files were updated to allow easy and convenient setup of Makefiles.

Dependencies

Building the PS Vita version of the game requires the homebrew VitaSDK. VitaSDK is supported on Linux, macOS, and Windows. Vita builds have primarily been tested on Linux-based operating systems and macOS Catalina and Big Sur. Please follow your platform's appropriate steps to install the VitaSDK, and ensure that the environment variable VITASDK is set as per the official instructions.

Once VitaSDK 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 PS Vita.

For example:

# Simplest PS Vita cross-compilation example
cmake -DCMAKE_TOOLCHAIN_FILE=$VITASDK/share/vita.toolchain.cmake

The only externally required dependency for the PS Vita build is CGLM. It can very easily be tweaked to make & install for the PS Vita with the following steps:

# Cross-compiling cglm for PS Vita

git clone https://github.com/recp/cglm.git
cd cglm
sed -i "s|-Werror||g" CMakeLists.txt
cmake -B build-vita \
    -DCMAKE_INSTALL_PREFIX=$VITASDK/arm-vita-eabi \
    -DCGLM_STATIC=ON -DCGLM_SHARED=OFF -DCMAKE_BUILD_TYPE=MinSizeRel \
    -DCMAKE_TOOLCHAIN_FILE=$VITASDK/share/vita.toolchain.cmake .
cmake --build build-vita --target all
cmake --build build-vita --target install

It is also recommended that you clone, build, and install the latest vitaGL from Rinnegatamante's GitHub repository.

# Cross-compiling the latest vitaGL for PS Vita

git clone https://github.com/Rinnegatamante/vitaGL.git
cd vitaGL
NO_DEBUG=1 NO_TEX_COMBINER=1 make
make install

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_vita
    cd build_vita
    
  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=$VITASDK/share/vita.toolchain.cmake ..
    
    # OR when you want to use Ninja which does better parallel processes management
    cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel \
                   -DCMAKE_TOOLCHAIN_FILE=$VITASDK/share/vita.toolchain.cmake ..
    

    For a slower, debug build (useful for symbols)

    # when you want to use the regular GNU Make
    cmake -DCMAKE_BUILD_TYPE=Debug \
          -DCMAKE_TOOLCHAIN_FILE=$VITASDK/share/vita.toolchain.cmake \
       ..
    
    # OR when you want to use Ninja which does better parallel processes management
    cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug \
                   -DCMAKE_TOOLCHAIN_FILE=$VITASDK/share/vita.toolchain.cmake ..
    
  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. Please prepare the game root until you will be able to run a game. The game root by default for PS Vita is located at ux0:data/TheXTech/. Please create this directory and place your preferred game assets inside that directory before attempting to launch the PS Vita version of the game.

  1. Download one of two archives with compatible assets:
  2. Unpack the content of the archive into your ux0:data/TheXTech/ directory
  3. Make in the ux0:data/TheXTech/ directory the "worlds" folder and put any compatible episodes you have (all episodes made for an original SMBX 1.3 and earlier will work here). Optionally you can make the "battle" folder and put a bunch of level files which will be used for battle arena purposes.
  4. Once your game root directory is ready, you can move the built thextech.vpk file to your PS Vita and install it with VitaShell
  5. TheXTech for PS Vita should now be in your PS Vita's livearea! Run the game and have a blast!

Troubleshooting:

  • Please ensure you have the latest vitasdk installed
  • Please ensure that the VITASDK environment variable is set OR exported in your .bashrc (or similar)
  • Please ensure that the latest vitaGL and cglm libraries are built and installed in your VITASDK directory