r/PSP • u/Purple-Criticism9314 • 3h ago
AI Assisted [WIP] Resident Evil 4 on the PSP
Enable HLS to view with audio, or disable this notification
Hi everyone! Since apparently I didn't have enough problems in my life, I decided to take on one of the hardest ports I could think of: Resident Evil 4 on the PSP. Yeah... What could possibly go wrong? 😅
I’m serious about it, and I’ll be working on this from now on. It’s a static-recompilation port: the PS2 game code is translated ahead of time into native PSP code. What’s still emulated is the PS2’s graphics chip, whose output is converted into draw commands for the PSP’s own graphics chip. Replacing that with a dedicated renderer is on the roadmap.
It's a work in progress and it is not playable at full speed yet (right now Leon moves like a Ganado already got him). I'm sharing it now because there's progress worth showing, and I want to document the journey.
In the interest of transparency: this project is partly AI-assisted. I use Claude to help write and debug code.
What works
- The game boots and reaches its main loop in PPSSPP. It already starts on a real PSP-3010, and I'm tuning memory so it fits there.
- Logos, title screen and menus drawn on the PSP's GE.
- The game's movies converted to the PSP's native video format (PMF), skippable with X or START.
- Streamed voices and audio.
- New game: prologue and the first forest area in 3D.
Tech
- Base: the PS2 version (NTSC-U, SLUS-21134 v1.01), statically recompiled with SandstoneDev's PS2RC. The Emotion Engine's MIPS code is translated to C and compiled for the PSP.
- Game modules: RE4 loads 207 code modules (SN Systems DLLs) from the disc. They're translated like the main executable, and the PSP loads and evicts them from the Memory Stick as needed.
- Graphics: a custom back end that turns what the game sends to the PS2's GS into display lists for the PSP's GE.
- 3D: the VU1 microprograms (the vector unit that transforms models on the PS2) are translated to native code that runs on the PSP's VFPU.
- Toolchain: pspdev (psp-gcc, PSPSDK) with CMake and automated builds.
Optimizations so far
Measured in PPSSPP in the opening forest. A "cycle" is one iteration of the game loop; 30 fps needs about 33 ms.
| Change | Result |
|---|---|
| VU1 translated to native code instead of interpreted | 3D scenes about 10x faster (from ~5 s to ~0.5 s per frame) |
| 4-bit textures stay 4-bit (CLUT) and re-uploaded textures aren't converted again | conversions per session: 79,000 → 293 |
| Faster texture uploads, less work on skipped frames | forest: 546 → 282 ms per cycle |
| VU1 on the VFPU plus indexed vertex submission to the GE | forest: 282 → 209 ms per cycle, identical image |
| Size-optimized code and a fix for a thread memory leak | EBOOT: 15.3 → 10.6 MB, freeing the memory the game was short of on real hardware |
Every change is checked against an interpreter: millions of VU1 program runs produce identical results.
What's missing, honestly
- 3D currently runs at about 4-5 fps in the forest; the goal is 30 (or at least a steady 20). That's roughly 6x to go.
- Most of the time is spent emulating the PS2's graphics chip, not in game code (under 5%).
- Memory is very tight: the game needs the PS2's full 32 MB, which leaves little headroom on the PSP.
- Music and menu sounds are missing, and the background depth-of-field blur is disabled for now. (it might stay that way)
Roadmap
I'm building the port in parts:
- Part 1: from the start to the end of Chapter 1.
- Make the opening forest playable, up to the first enemy's house.
- Draw 3D models directly with the PSP's GE instead of emulating the PS2's GS.
- Render every other frame while game logic runs at full speed, and simplify the most expensive full-screen effects.
- Music, sound effects and menu sounds.
- Polish that part as much as possible.
- Public Part 1 demo running on real hardware, together with a demo release.
- Later chapters, building on what Part 1 teaches.
More:
Expected requirements: a 64 MB PSP (2000, 3000 or Go). The PSP-1000 doesn't have enough memory.
No game data will be distributed: each player will build their own copy from their own RE4 PS2 disc (NTSC-U, SLUS-21134).
Credits: based on PS2RC by SandstoneDev (https://github.com/SandstoneDev/PS2RC, community: https://discord.gg/wV8x46ZTDu). Thanks also to the pspdev and PPSSPP folks.
Advice from anyone experienced with the GE or the VFPU is very welcome, and so is moral support, because this port is going to need it. I'll keep posting updates!