mhs2-recomp

mhs2-recomp is a native Android port of Monster Hunter Stories 2 Wings of Ruin for the Retroid Pocket 5 and Flip 2.

README

Monster Hunter Stories 2 port for Retroid Pocket 5 & Flip 2

Made for the Adreno 650. A native Android port of the console version of Monster Hunter Stories 2: Wings of Ruin, built exclusively for the Retroid Pocket 5 and the Retroid Pocket Flip 2 (Snapdragon 865), from your own copy of the game. The game's own ARM64 code runs directly on the device's CPU, while this project reimplements the parts of the console it talks to.

Free, unofficial fan project. Not affiliated with, endorsed or sponsored by the console maker or Capcom. All trademarks belong to their owners. This repository contains no game code and no game assets. To use it you need a copy of the game that you bought, with its files extracted on your own console.

Status

Version 0.1 — early. Tested on the Flip 2 with version 1.5.2 and its DLC: the title screen and a new game from the opening into Mahana Village, at a locked 30 fps. It has not been played much further: later areas may still show problems.

  • A locked 30 fps. The game asks for 60, but on the Flip 2 it reaches about 44–48 fps in the first village, so the port holds it at a steady 30. An empty file 60fps in the game folder lifts the lock.
  • TV mode (settings panel): the game runs as it does on a TV. Not measured on the Flip 2 yet. Takes effect the next time the app is opened.
  • The ExeFS folder must be complete: besides main the game brings its own video library in subsdk0, and the app loads it.
  • The first time a new effect or model appears it can show up a moment late: its shaders are built in the background instead of freezing the game. They are cached, so it happens once.
  • Some effects have not been compared with the original console yet.
  • Prepared with version 1.5.2. Other versions are accepted with a notice.

Why only the Retroid Pocket 5 and Flip 2

This port was written for one chip, the Snapdragon 865 with its Adreno 650 GPU, and tuned to its limits instead of trying to run everywhere:

  • Run the game, not a whole console. Translating the full console system costs CPU, GPU and memory this chip does not have to spare. Here the game's own ARM64 code runs natively and only what it actually calls (files, threads, input, audio, graphics) is reimplemented, so almost the whole device is left for the game.
  • Built around the Adreno 650 and its stock Qualcomm Vulkan driver (Vulkan 1.1). The graphics layer uses exactly the features this driver offers and works around its quirks; for example, GPU shader code that relies on features the Adreno 650 only has in compute shaders is rewritten so it renders correctly.
  • A 33 ms budget per frame. The GPU usually runs at ~587 MHz, so the target is a locked 30 fps: the game renders at its handheld resolution (around 720p) and AMD FSR 1 upscales it to the 1080p screen. Where a game can get heavier than that budget, the internal resolution drops for a moment instead of the frame rate.
  • About 2.7 GB of free memory out of 8 GB while a game runs. GPU caches have fixed limits so a big area never pushes the game out of memory, and translated shaders are stored on the device so each one is only built once.
  • Eight cores, used deliberately. The game's threads run on the four big Cortex-A77 cores; background work (shader building, pipeline compiling) goes to the small Cortex-A55 cores so it does not steal time from the game.

Developed and tested on the Retroid Pocket Flip 2 (Android 13). The Retroid Pocket 5 has the same chip, memory and driver, so it should behave the same. Other Snapdragon 865 / Adreno 650 devices might work but are untested; devices with other GPUs (other Adreno generations, Mali, PowerVR…) are not supported.

What you need

  • The game files (tested with version 1.5.2; other versions are accepted with a notice), already extracted on your own console, as plain folders:
    • ExeFS — the folder with main, main.npdm, sdk, … of the game with the latest update you have applied (any version of the game is accepted; one it was not tested with shows a notice).
    • RomFS — the game's RomFS with the same update applied.
  • DLC (optional): the RomFS of each DLC you own, each in its own folder. Keep the DLC title ID in the folder name as your extraction tool named it (for example ... (0100E21011447001) ...): that is how the app tells the DLC apart. Folders named aoc/<index> (aoc/1, aoc/2…) also work.
  • Enough free space for the game plus about 1 GB for the shader cache and saves (internal storage or SD card).

Where do the files come from? From your own copy of the game: if your console runs custom firmware, its homebrew tools can extract the ExeFS and RomFS for you. The app only reads those plain folders (it doesn't open packaged or protected files), which keeps it simple, and it will tell you exactly what is missing if a folder isn't usable. Questions about the app itself are always welcome in the issues; just please don't share or ask for game files there.

Install and first run

  1. Download mhs2port-vX.Y.Z.apk from the latest release (or build it yourself, below) and install it on the device.
  2. Copy your extracted game folders to the device, anywhere you like (for example one folder MHStories2 with the ExeFS and RomFS folders inside).
  3. Open the app, grant All files access, browse to that folder with the touch screen or the d-pad and choose Use this folder. The app checks that the files are this game, a version it can run (ExeFS and RomFS from the same copy) and not encrypted.
  4. Press Start game. From then on the app starts the game directly; to choose another folder, switch on Change folder in the settings panel (see below) or open the app twice in a row (within ten seconds).

Saves, the shader cache and log.txt are written into that same folder. The first time you visit each place the game may stutter while its shaders are translated and compiled; they are cached for the next time.

Controls and the settings panel

  • The face buttons follow the device's controller mode. In both of the Retroid's modes (Xbox and Retro) every button does what the button in that same place does on the game's original console: B at the bottom, A on the right, X on top, Y on the left. You can change the mode from the quick settings while the game is running. Any other controller, over USB or Bluetooth (a DualSense, for example), is read by position too: its bottom button is B.
  • Settings panel. Swipe in from the right edge of the screen (the system's back gesture, the one that shows an arrow) and a panel slides out over the game. It has a switch for the FPS counter (your choice is remembered), TV mode and Change folder, which brings the folder screen back the next time you open the app. The same swipe, a tap outside the panel or a few seconds without touching it hide it again.
  • Save report (settings panel): writes a folder reports/<date>/ into the game folder with the log, a screenshot of the moment you opened the panel, the frame times of the last seconds and basic device information (model, Android version, memory). Nothing is sent anywhere. To report a problem, open an issue and attach those files (look at them first: the log contains the names of your folders).
  • Update notices (settings panel, on by default): about eight seconds after the game starts, the app asks GitHub's public API which release is the latest (a single request, without an account; nothing about you or your game is sent). If there is a newer one, a banner says so and Get vX.Y.Z opens its page; install that APK over this one. Switch it off and the app makes no network request at all.

Options

Creating an empty file (or folder) with one of these names in the game folder changes how the port runs. Most are read at start-up.

NameEffect
modo_tvTV mode (the same switch as in the settings panel): the game runs as it does on a TV. Read at start-up.
60fpsLifts the 30 fps lock (the game then runs as fast as the GPU allows, about 44–48 fps in the first village).
sin_fpsHides the FPS counter (the same switch as in the settings panel).
sin_avisos_versionTurns the update notices off: no request to GitHub (the same switch as in the settings panel).
con_barras_sistemaKeeps Android's navigation and status bars on screen. By default the app hides them while the game runs (swipe in from an edge to bring them up for a moment). Read when the game window gets focus.
botones_xbox, botones_retroForce the face buttons to be read by position (botones_xbox) or by name (botones_retro) if a controller comes out swapped.
registroVerbose log (line by line) plus a watchdog that prints the game's stack if it hangs. Slower: for debugging.

How it works

APK
├── SetupActivity (Java)   finds and checks the user's game files, then starts the native activity
└── NativeActivity
    ├── loader             maps main + subsdk* from the ExeFS, applies relocations, links imports,
    │                      patches the few instructions that cannot run on Android (svc, tpidrro_el0, counters)
    └── libnnsdk.so        reimplementation of the console SDK the game imports: nn::os (threads, sync, memory),
        │                  nn::fs (RomFS, saves), nn::hid (controller), audio (AAudio), codecs, …
        └── nvn/           the NVN graphics API on top of Vulkan; the game's Maxwell shaders are translated to
                           SPIR-V with Eden's shader recompiler, then cached

The SDK and NVN layers were written from scratch by observing what the game calls and with which values (there are no official SDK headers or code in this repository); comments next to each deduced value give the evidence. Code comments are mostly in Spanish.

Building

Requirements (macOS or Linux): Android SDK with NDK 28.2.13676358, build-tools 35.0.0 and platform android-33; a JDK (17 or newer); CMake ≥ 3.22; Python 3; git, curl and zip.

tools/setup.sh       # once: fetches the pinned third-party sources (Eden's shader recompiler, sirit, fmt, Boost…)
tools/build_apk.sh   # builds build/mhs2port.apk
adb install -r build/mhs2port.apk

ANDROID_HOME selects the SDK (default ~/Library/Android/sdk). The APK is signed with the Android debug key unless you pass KEYSTORE=… KS_PASS=…. For development, tools/apk.sh builds, installs, starts the game on the device connected by adb and prints its log. The Python scripts in tools/ are analysis helpers that work on your own extracted files in work/ (ignored by git).

Support

Everything here is free and stays free: every build is public and the same for everyone, and donations do not unlock anything. If this port saved you a weekend and you want to say thanks, you can buy me a coffee at ko-fi.com/iamwilmar. It helps me keep working on these ports. Thank you!

License

GPL-3.0-or-later (see LICENSE), because it builds on Eden's shader recompiler (GPL-3.0-or-later). Third-party components and their licenses are listed in THIRD_PARTY_NOTICES.md.


En español

Port nativo para Android de la versión de consola de Monster Hunter Stories 2: Wings of Ruin. El código ARM64 del juego corre directo en la CPU y este proyecto reimplementa el SDK de la consola y la API gráfica NVN sobre Vulkan.

  • Necesitas tu propia copia del juego, probado con la 1.5.2 (otras versiones se aceptan con un aviso), con el ExeFS y la RomFS ya extraídos en tu consola, como carpetas normales. Salen de tu propia copia: si tu consola tiene firmware modificado, sus herramientas homebrew los extraen. La app solo lee esas carpetas y te dice qué falta si algo no está. Este repositorio no tiene código ni archivos del juego.
  • Descarga la APK de Releases e instálala. Copia esas carpetas al dispositivo, abre la app, dale el permiso de archivos, elige la carpeta y pulsa Iniciar juego. Las partidas y la caché de shaders se guardan en esa misma carpeta.
  • Hecho exclusivamente para la Retroid Pocket 5 y la Retroid Pocket Flip 2 (Snapdragon 865, Adreno 650): todo está ajustado a ese chip y a sus límites (30 fps fijos con presupuesto de 33 ms por frame, ~2,7 GB de memoria libre, núcleos grandes para el juego). Probado en la Flip 2.
  • Los botones quedan donde están en la consola original del juego en los dos modos del mando de la Retroid (Xbox y Retro), y cualquier otro mando, por USB o Bluetooth, se lee por posición. Deslizando un dedo desde el borde derecho de la pantalla sale un panel de ajustes, con el interruptor del contador de FPS, el del modo TV y el de volver a elegir la carpeta. Con la carpeta ya elegida, la app abre el juego directamente.
  • En ese panel también está Guardar reporte: el log, una captura del momento en que abriste el panel e información del aparato van a reports/ dentro de la carpeta del juego, sin enviarse a ningún sitio; para avisar de un fallo, abre un issue y adjúntalos. Y los avisos de versión (encendidos de serie): al abrir el juego, la app pregunta a la API pública de GitHub cuál es la última release (una sola petición, sin cuenta ni datos tuyos) y, si hay una más nueva, lo avisa y Descargar abre su página. Apagados, la app no usa la red.
  • Proyecto de fans, gratis (las donaciones son opcionales y no desbloquean nada), sin relación con el fabricante de la consola ni con Capcom.
  • Los DLC son opcionales: la RomFS de cada uno en su carpeta, con su id de título en el nombre (como lo dejó la herramienta con la que los extrajiste) o como aoc/1, aoc/2…
  • Si quieres apoyar el trabajo: ko-fi.com/iamwilmar. Es opcional y no desbloquea nada: todas las versiones son gratis e iguales para todos.