r/vitahacks • u/NJK78 • 1h ago
Port Shadow Blade porting on PSVITA
Hi, a few days ago I made a post announcing the porting of Shadow Blade to the PS Vita. A moderator of this page deleted it because it didn't contain any useful information, so I’ll try to provide more detail this time. If this post gets deleted again, I won’t use this page for any further updates.
DETAILS:
Engine startup. The loader initializes Mono (JIT, garbage collector, and threads) as well as Unity, replicating the Android startup sequence. It supports OBB files—which contain the game levels—converting them into a readable format upon the first launch.
Emulated Java. I reimplemented the Java calls used by the game in C using "FalsoJNI," covering features such as save data (PlayerPrefs), device information, touch events, and reflection.
Graphics. I fixed a bug in the `softfp` calls within `vitaGL` that caused a black screen, as well as an issue during the translation of GLSL shaders to Cg (specifically regarding the reserved keyword `texture`). Compiled shaders are saved to a cache, ensuring faster subsequent load times.
Controls. Touch input is handled natively. Physical buttons and analog sticks are presented to the game by emulating a MOGA controller, which the game already supports.
Audio. I developed a bridge that replaces the Java component of FMOD (`FMODAudioDevice`), routing audio directly to the PS Vita’s output.
Stability and performance. I addressed thread-specific `errno` values, mutex handling, a memory leak related to reflection, and excessive per-frame logging that had previously caused the frame rate to drop to 5 fps. An automatic periodic save feature has also been added, which is useful when closing the game via the PS button.
Packaging. The icon and LiveArea assets utilize the game's original artwork. Two versions are provided: an optimized release build and a debug build that includes detailed logging.
For this project, I used AI to help me identify issues and speed up the work.