Hi everyone!
I've been working on a personal project to port the PS2 version of Persona 3 FES to the original Nintendo Switch using AI-assisted development, primarily with OpenAI Codex.
My ultimate goal is to get the complete game running locally as a native ARM64 application on the Switch, without relying on a full PS2 emulator, PC streaming, or cloud gaming.
I'm working with a Chinese-translated version based on the Japanese release (SLPM_666.90), and I have the game's CHD disc image.
I'm looking for advice from people experienced in PS2 reverse engineering, static recompilation, decompilation, and console homebrew development.
What I've accomplished so far
The project has gone through ten development phases, mostly with Codex.
So far, I've managed to:
- Extract the game's main ELF and three CVM containers from the CHD.
- Analyze parts of the PS2 Emotion Engine's MIPS R5900 execution flow.
- Establish a partial MIPS static recompilation pipeline.
- Build Windows and Switch ARM64 runtime components.
- Implement several PS2 system services, including thread initialization, memory mapping, dynamic code copying, syscall dispatching, and cache-related behavior.
- Use PCSX2 debugging to capture real execution traces from the original game.
- Pass 231 existing assertions on both Windows and the Switch emulator Eden.
- Build a standalone Switch NRO that renders several samples of the game's Chinese text.
The current runtime reaches a dynamically installed code handler at 0x80076000, but cannot execute beyond it yet.
Using PCSX2, I've confirmed that the original game executes this handler, returns through the BIOS using ERET to 0x0050e730, and continues initialization through several additional syscall table installations.
So the reference behavior is partially understood, but the native runtime hasn't reproduced it.
The problem with Codex
When I asked Codex to recompile the dynamic MIPS handler into C++ and integrate it into the native runtime, it refused.
It stated that its collaboration rules prevented it from directly generating a reimplementation of an existing commercial game, including translating proprietary game handlers and integrating them into a native port.
However, Codex had already been able to inspect the CHD, analyze the executable, investigate the runtime behavior, and collect debugging evidence.
That made me wonder whether I should separate the reverse-engineering process from the actual implementation work.
My proposed approach
Instead of asking one AI to handle the entire port, I'm considering a multi-stage workflow.
Stage 1: Extract everything possible from the CHD
Use Codex and existing extraction tools to identify and extract the game's files and data, including:
- ELF executables
- CVM archives
- Models and textures
- Animations
- Audio
- Scripts and dialogue
- Other proprietary resource formats
The goal would be complete, verifiable extraction of the disc's contents, including documenting any unknown formats.
Stage 2: Automated disassembly and decompilation
Use IDA Pro, Ghidra, or other tools to analyze the game's MIPS executable and export:
- Identified functions and addresses
- MIPS assembly
- C-like pseudocode
- Control-flow graphs
- Function call relationships
- Global variables and inferred data structures
- Unresolved code regions
- Dynamically loaded or generated code
I understand that decompilation doesn't recover the original source code exactly.
What I'm hoping to create is a comprehensive, structured reverse-engineering dataset that another AI or developer could work with.
Stage 3: Hand off the results to another AI
If Codex can handle the analysis but cannot perform certain implementation tasks, could the resulting disassembly, pseudocode, function databases, and execution traces be handed over to another AI or development tool?
The next stage would involve understanding the recovered code, improving its structure, and developing compatible implementations where legally and technically permitted.
Stage 4: Native Nintendo Switch implementation
The eventual goal would be an ARM64-native NRO, built using C++, devkitA64, libnx, and an appropriate graphics backend.
Ideally, the architecture would combine static recompilation for suitable code with limited dynamic execution and high-level replacements for PS2 system services.
My main questions
1. How completely can a PS2 game be extracted and analyzed from its CHD image?
Is it realistic to recover essentially all executable machine code and produce assembly or C-like pseudocode for most functions? What parts typically resist automated analysis?
2. Can Codex, IDA, and Ghidra be combined into an automated reverse-engineering pipeline?
For example, could I automatically discover functions, export pseudocode, build a function database, and identify unresolved regions without manually analyzing thousands of functions?
3. Can the resulting analysis be transferred effectively between different AI tools?
What information should be preserved to avoid losing important context, such as original addresses, calling conventions, memory accesses, dynamic code behavior, and PS2-specific instruction semantics?
4. Is this a realistic starting point for a native Switch port?
I've seen existing Persona 3 FES decompilation and static recompilation projects, including ones that have made substantial progress on Windows.
Would adapting the architecture of such a project be significantly more practical than continuing a game-specific recompilation effort from scratch?
5. How should PS2-specific features be handled?
In particular:
- MIPS R5900-specific instructions
- Self-modifying or dynamically installed code
- BIOS exceptions and syscalls
- VU0/VU1
- GS rendering
- IOP services and audio
Would a hybrid approach using static recompilation, a small dynamic execution fallback, and hardware HLE be realistic?
6. What are the practical and legal limitations of this workflow?
If Codex can perform binary analysis but won't generate a commercial game's recompiled implementation, would separating analysis and implementation actually help from an engineering perspective?
I'm not looking to bypass AI safety restrictions or redistribute copyrighted game content. I'd like to understand what approaches are technically viable and what permissions might be necessary.
Final thoughts
This is primarily a personal learning and research project, and I'm not planning to distribute the game's original disc image, BIOS, or proprietary assets.
I know that extracting a game doesn't magically produce compilable source code, and that a complete native port is an enormous undertaking.
My main question is:
If you were trying to reverse-engineer a PS2 game with AI assistance and eventually port it natively to the Switch, how would you structure the process?
Would you prioritize building a comprehensive decompilation database, adapting an existing recompilation project, or developing a compatibility runtime?
I'd really appreciate advice from anyone with experience in PS2 reverse engineering, MIPS recompilation, IDA/Ghidra automation, or Nintendo Switch homebrew development.
Thanks in advance!