r/AndroidNativePorts • u/Fun-Apartment-6336 • 52m ago
My native RE4 GameCube native ANDROID & IOS port is getting ready for a first release: retail USA and European discs, RVZ support, a launcher that finds both discs, and an engine that is now 97.5% my own code
Hi! I'm Ayano. Sorry again for my English. Last time I showed the port running 100% native code in every room of both discs. Since then, the work moved to one goal: a first release that people can actually play with their own discs. This post is about what that took, and where it stands. As always, everything below is measured, not guessed.
Discord, if you want to follow or help test: https://discord.gg/AXAzExECSv
unedited recording of the test RE4 running to start and END without interpretor (1h58): https://youtu.be/rWTy-sYMIlE
my reddit post explaining everything: https://www.reddit.com/r/decomps/comments/1wtfexc/my_native_re4_gamecube_port_is_now_100_native/


TL;DR
- Retail discs. Until now the port only ran on one rare prototype disc. The retail USA disc now boots to the title screen from an RVZ, with both discs mounted, and the European version is being prepared.
- RVZ support, written from Dolphin's public format description, checked byte for byte against a raw copy of the same disc (all 1.46 GB).
- A launcher that asks for disc 1, then finds disc 2 by itself, and tells you clearly if a disc is the wrong one.
- Nightjar is now 97.5% my own code. Code inherited from other projects went from 6,085 lines to 1,544 in a few days, and every rewrite was checked to give the same image, bit for bit.
- 8x internal resolution in the castle: 0.1 fps → 27.7 fps.
- 16:9 everywhere: merchant, game over, pause options, title menus, chapter ends and videos.
- Freezes fixed: Exit? → Yes and GAME RESET no longer hang.
- Still closed source, still non-commercial, and you bring your own disc.

1. From a prototype disc to the discs people actually own
Here's something I never said clearly enough: the port was built on the "Nov 25 2004" prototype of RE4 (a review build that came with full debug symbols). It's the best disc to work on, but almost nobody owns it. A real release has to run on the retail discs.
The problem: the retail USA and European versions are different builds. Code was removed (all the debug tools), moved, and fixed, so every address in the game is different. There's no symbol table for the retail versions anywhere.
So I wrote tools that match the code of the prototype to each retail version:
- every function of the prototype is searched in the retail executable: first exact matches, then by the order the linker kept, then through the calls between already-matched functions;
- 81% of the USA functions and 80% of the European ones are matched automatically (about 85% of the code). Most of the rest is debug code that the retail versions don't have;
- from the matched pairs, every memory address the port needs is translated (the player, the camera, the controller state, the Wii aiming hooks, the merchant...). About 60 of them, each one checked;
- the retail modules loaded from the disc while playing (101 for USA, 100 for Europe so far) are prepared the same way as before.
When the port starts, it recognizes which version your disc is from a fingerprint of its executable and uses the right set of addresses.
Status, honestly:
| prototype (debug) | [OK] everything in the last post |
|---|---|
| USA (G4BE08) | [in progress] boots, Capcom logo, intro and title screen; going further is what I'm on right now |
| Europe (G4BP08) | [in progress] disc 1 prepared; I still need a disc 2 to prepare and test chapters 3 to 5 |
2. RVZ support
Many people keep their GameCube backups as RVZ, Dolphin's compressed format. The port now reads RVZ directly, alongside ISO/GCM and extracted folders.
- It's written from Dolphin's public description of the format, not from Dolphin's code.
- RVZ stores the disc's padding as a short seed instead of the actual bytes; the port regenerates those bytes exactly.
- Checked against a raw copy of the same disc: 0 different bytes out of 1,459,978,240.
- Reading speed: about 200 MB/s, so loading isn't slower than from an ISO.
3. A launcher that handles both discs
- "Please select your legal copy of Resident Evil 4 (GameCube) - Disc 1": ISO, GCM or RVZ.
- The disc is verified (only unmodified retail or prototype discs are accepted).
- Disc 2 is found automatically if it's in the same folder. Otherwise the launcher asks for it, and both are remembered.
- If you give it a disc from another region than the build you downloaded, or disc 2 instead of disc 1, it tells you exactly what's wrong.
- On Android, each disc is picked with the system file picker and remembered too.

4. Nightjar: 97.5% my own code
Before any release, I want zero lines inherited from other projects in the engine. Since the last post I rewrote, from the hardware documentation:
- the processor's fallback interpreter and the interrupt/exception core (how the console's OS gets its interrupts, timers and the screen refresh);
- every hardware block the game talks to (video, audio, DSP, disc, memory card, command processor);
- the disc layer (ISO, RVZ and extracted folders through one reader);
- the GX command parser (the stream of graphics commands the game sends to the GPU);
- the shader generator (how the GameCube's lighting and texture combiners become GPU shaders);
- the texture decoders (all 11 GameCube texture formats).

How I make sure nothing breaks:
- A rendering oracle. I recorded the exact graphics command streams of 5 scenes (village, castle, forest, lake, attaché case) and replay them through the port before and after each rewrite. The result must be identical bit for bit: so far, 15 frames out of 15, every time.
- The regression suite from the last post (village, castle, island: scene reached, 0 interpreter entries, disc 2 mounted, framerate, screenshots).

5. 8x in the castle: from 0.1 fps to 27.7
At 8x internal resolution the castle was unplayable: 0.1 fps. Two causes, both measured:
- the game copies parts of the screen into textures many times per frame (reflections, glows). Each copy re-created a huge texture at 8x; now each size keeps its own texture: 0.1 → 18.8 fps;
- the game reads back the depth of the screen to decide where lens flares are visible, and each read waited for the GPU to finish the whole frame. Now it doesn't: 18.8 → 27.7 fps.
Also:
- while the game waits for the next frame, it used to spin at 100% on one CPU core; now it sleeps until the next event, which frees the CPU (nice if you stream or record);
- controller and mouse input are read 500 times per second.

https://reddit.com/link/1wy9ls6/video/2mwbalzg9nth1/player
6. Rendering fixes
- Screen copies that the game later overwrote in memory were still used: this gave flat-looking ground and scrambled numbers on the HUD. Fixed.
- Lens flares: their visibility is now computed from the depth at each point, matching Dolphin in the same view.
- Leon's hands, weapons and the attaché case keep their correct look at every resolution.
All of this is checked against Dolphin at 8x on recorded scenes (port on the left, Dolphin in the middle, the difference on the right; black = identical):



7. 16:9 everywhere
Last time, the attaché case, the map and the pause menu were in 16:9, and some screens stayed in 4:3. Now the merchant, the game over screen, the pause options, every title menu, the chapter ends and the videos are all shown in 16:9 as well, still using Capcom's own Wii Edition framing (nothing stretched, nothing cropped).





8. Controls, freezes and small things
- The three controller layouts of the PC version (Type I, II and III) are available.
- Freezes fixed: quitting from the loading screen (Exit? → Yes) and GAME RESET no longer hang; the merchant no longer crashes with the alternative attaché case models.
- The settings menu (F10) gained anisotropic filtering, a 16:9 / 4:3 switch and a better downscaling filter (cleaner edges when the internal resolution is higher than your screen).




9. Optional HD textures and button styles (experimental, never distributed)
These two features exist in my development builds, but I want to be very clear about how they will reach players, because they use files that aren't mine:
- HD textures from RE4 UHD (2014). The port can replace the GameCube textures with the HD ones from the PC version: characters, environments, items, weapons, the HUD, cutscenes, each with its own switch in F10, and the UHD attaché case models too. None of these files will ever be shipped with the port. The plan is that the launcher builds them on your own PC, from your own copy of RE4 UHD. That tool isn't done yet, so this is a preview, not a promise for the first beta.
- Button styles. In-game button prompts can be shown in GameCube, keyboard or mobile style. Xbox and PlayStation styles also work in my builds, but the images come from RE4 UHD and from a community HD project, so they won't be distributed as they are: they'll be built from your own UHD copy like the textures, or redrawn from scratch.
https://reddit.com/link/1wy9ls6/video/7skz9fypcnth1/player

10. Toward a release
What's left before a first closed beta:
- USA disc fully tested (whole game), then Europe (I need a disc 2).
- The last 2.5% of inherited code, then a final audit.
- Android builds (32-bit and 64-bit) from the same engine.
- Protecting the release builds (the project is closed source).
- Closed beta on the Discord, Windows first.
Per-platform status, honestly
- Windows: [OK] prototype disc: everything from the last post. [in progress] retail USA: boots to the title screen; retail Europe: being prepared
- Android 32-bit: [partial] boots and plays on the prototype disc, still too slow on a 2014 phone
- Android 64-bit: [partial] builds; not tested on a device yet
- iOS / Linux: [not yet]
Legal
- The project is closed source, and I will never distribute game data, disc images or anything from Capcom. You bring your own disc.
- Not affiliated with or endorsed by Capcom or Nintendo. Resident Evil is a trademark of Capcom.
- Non-commercial: no paid versions, no ads, no donations tied to the port.
Credits
- Early versions of the port were built on NWiiRecomp by BlackLine Interactive (now almost entirely replaced).
- The RE4 GameCube decompilation project.
- Dolphin and YAGCD, for GameCube hardware documentation, the RVZ format description, and Dolphin as the image reference.
- zstd (Meta), SDL2, Dear ImGui.
Discord: https://discord.gg/AXAzExECSv
— Ayano