RecompOne is a tool to statically recompile PlayStation 1 executables into C# code. it also provides a runtime layer that translates the PS1 hardware environment into something modern PCs can run natively
This project is inspired by N64Recomp and XenonRecomp, which are similar tools for N64 and Xbox 360 respectively
Static recompilation is similar to emulation in that it recreates the internal state of the hardware, the difference is that instead of fetching, decoding, and executing each instruction at runtime, the recompiler translates all MIPS operations into code ahead of time.
the generated code operates on a CpuContext and a memory interface. this CpuContext encapsulates the state the CPU would be in and the runtime simulates what the PS1 hardware would be doing and translates it into something modern hardware can understand
For example, an add instruction:
addiu t0, t0, 0x10becomes:
c.T0 = c.T0 + 0x10u;and a memory read:
lw t0, 0x10(sp)becomes:
c.T0 = mem.Read32(c.SP + 0x10u);the runtime, like an emulator, simulates the behaviour the game expects like the BIOS functions, MMIO registers, GPU drawing commands, CD-ROM, and so on, it also provides reimplementation of some libraries from psyq, since the ones that heavily rely on interrupts dont work properly under the recompiler
PS1 games use overlays since the ps1 ram is extremly limited, so the gane load and unload code and data into the same memory region as needed
each overlay is defined in the config file, during recompilation a separate class is generated for every overlay along with an overlay dispatch table the dispatcher tracks which overlays are currently loaded at runtime and updates the function mappings as needed. this is needed because different overlays can occupy the same VRAM address range at different times, the runtime loads and unload then as needed so that every virtual address always resolves to the correct recompiled function
You can provide Patches that will replace a function entirely
patches are registered in the recomp config
{ "address": "800553C4", "name": "MyPatch.MyClass.MyMethod" }The patch class itself lives in the recompiled project, you need to create an file and implement the patched functions, then redirect them
this is for providing "base mods" for the game, like fixing functions the recompiler cant deal with (like self modifying code) or simple qol features
Run the recompiler with a recomp config file:
recompone MyGame.json
The recompiler reads the disc image provided in the configuration file, gets the data and recompile it and any overlays using the elf as a base for finding functions, then it writes one C# file per segment to the output directory.
- Mod loader an proper runtime modding system that patch assemblies from a
mods/directory without recompiling - Documentation better documentation
- HLE GPU current implementation is LLE, an HLE GPU is planned so widescreen patches and increased resolution can be possible
- MultiDisc games current implementation doesnt deal with games that have multiple discs (should be an relatively easy implementation)
any contributions are welcome, This project started mainly as an hobby and i didnt expect to get something that works, but there is still a long way until this tool becomes something as mature as N64Recomp and similar tools, I woundnt say this tool is ready to make actual recomps but it can boot games
Currently im the only mantainer of the project and my free time is limited, my coding skills also arent perfect, so any help is more than welcome, be it as bug reports, feature suggestions or actual code
This project is not vibe-coded. AI was not involved in writing the code!
This project does not support vibe-coded ports. Ai can be a useful research tool, but it does not replace the human judgment needed to understand and correctly implement what you are building
You do you but I will not provide help for ports produced that way