THPS 2X Recompiled: Linux handheld and Android ports

THPS 2X Recompiled is a port of Tony Hawk's Pro Skater 2 for Android and Linux handhelds with an OpenGL ES renderer.

README

THPS 2X Recompiled: Linux handheld and Android ports

Patches and glue that run THPS 2X Recompiled on two handhelds with an OpenGL ES renderer instead of Vulkan:

  • Anbernic RG DS (RK3568, Mali-G52 on Mesa/Panfrost, GLES 3.1, no Vulkan), running BananaOS: a PortMaster-style launcher.
  • Anbernic RG Rotate (Unisoc T618, Mali-G52 with ARM's driver, GLES 3.2), running Android 14: an APK.

Both run the game at about 60 fps on the Rotate and 42-49 fps in levels on the RG DS.

Prebuilt packages are in the releases. No game data is included anywhere (no ISO, ROM or game files): you need your own copy of the game, with its files extracted from your own disc into the gamedata folder.

The recompiled game code itself is generated from your own copy by the upstream project's tooling and is not in this repository.

What is in here

PathWhat
patches/xrv-gles-android.patchagainst xboxrecomp-vulkan (MIT) at d3f9e8c: the OpenGL ES renderer src/nv2a_gles (its own queue and GL thread, staged vertex data, UBO rings), Linux/Bionic fixes in win32_compat.c, the 1:1 aspect in kernel_xbox.c
patches/port-linux-android.patchagainst THPS2X-Recompiled (GPL-3.0) at 9ca1efb: host_linux.c, the 1:1 aspect, the FXAA-refusal loop in the options screen
linux/, arm64/CMake for the glibc/aarch64 build (the RG DS)
android/CMake for libmain.so, the manifest and a small SDLActivity subclass for the APK
scripts/portmaster-THPS2X.shlauncher for PortMaster-style systems
scripts/build-android.shNDK + APK build without Gradle

Build

git clone https://github.com/almost-drowned-rat/THPS2X-Recompiled repo && git -C repo checkout 9ca1efb && git -C repo apply ../patches/port-linux-android.patch
git clone https://github.com/almost-drowned-rat/xboxrecomp-vulkan xrv    && git -C xrv  checkout d3f9e8c && git -C xrv  apply ../patches/xrv-gles-android.patch
# generate the recompiled C from your own game into private/gen with the upstream tooling
# put SDL 3.2.10 source in sdl3src/SDL3-3.2.10 (Android build only)
ANDROID_NDK=/path/to/ndk-r27c ANDROID_SDK=/path/to/sdk scripts/build-android.sh
adb install -r thps2x-android.apk

Copy your own extracted game files to /sdcard/Android/data/org.thps2x.port/files/gamedata/. Extra settings go in files/thps2x.env (NAME=value, one per line); saves and logs are in files/save and files/data.

Notes on the OpenGL ES renderer

  • ARM's driver rejects what Mesa tolerates: GL_BGRA as a client format for RGBA8 textures and GL_BGRA as a vertex attribute size. Textures are uploaded as RGBA with a red/blue sampler swizzle and vertex colours are swapped when copied into the ring.
  • glBufferSubData into a uniform buffer the GPU still reads made ARM's driver copy the whole buffer (about 1 ms per draw): writes use an unsynchronized glMapBufferRange instead (RECOMP_GL_UBO_MAP=0 to compare).
  • On Panfrost the GL thread is the bottleneck, so draws are staged ahead of it and frames are skipped when it falls two frames behind, so the game's logic keeps its speed (RECOMP_GL_FRAMESKIP=0 turns that off).
  • Aspect ratio 1:1 for a square screen (THPS_WIDESCREEN=1:1, or ASPECT RATIO in RECOMP OPTIONS): the game draws its gameplay for that aspect, menus and movies stay 4:3. RECOMP_GL_FILL=0..1 stretches the picture instead.
  • Debug aids: RECOMP_GL_PROFILE=1|2, RECOMP_GL_ERR, RECOMP_GL_TRACE, RECOMP_GL_EXT, RECOMP_SHOT_DIR plus a file thps-shot-req there for a framebuffer dump.

Licence

GPL-3.0 for the glue (it links the GPL-3.0 port); the toolkit patch stays under the toolkit's MIT licence. See LICENSE. Not affiliated with the upstream projects or the game's publisher.