# eppc - Eternal Poison PC A native Windows port of **Eternal Poison** (PlayStation 2, Flight-Plan / Atlus USA, 2008), made by **static recompilation**: the game's own MIPS code is translated into C and compiled for x86-64, and a runtime stands in for the PS2's kernel and hardware. Over time, recompiled functions can be replaced with hand-written (decompiled) code. > This project contains no game code or data. You need your own disc image of > the North American release (**SLUS-21779**). Everything derived from it is > produced on your machine and never committed (`build/`, `generated/`, > `dist/` are git-ignored). ## Features What the port does beyond running the game: - **Runs natively at 60 fps**: game logic and rendering, with no emulator in between. - **GPU renderer**: the PS2's graphics chip (GS) is emulated in Direct3D 11 compute shaders, working on a copy of its 4 MB video memory exactly like the hardware, so effects that draw into memory and read it back just work. Verified pixel-identical with the software renderer on thousands of frames. ([how it works](docs/GPU_RENDERER.md)) - **Recompiled vector unit**: the PS2's VU1 microcode (3D transforms) is turned into native code too, about 3x faster than interpreting it. ([how it works](docs/VU1_RECOMPILER.md)) - **Movies with sound**: the PS2's MPEG decoder (IPU) is emulated. ([how it works](docs/IPU.md)) - **Quick start**: the company logos are skipped (fast-forwarded behind a black screen); the title appears about a second after launch. - **No disc image needed after the build**: the game files are extracted once into a `data` folder. - **Settings file** (`game.ini`): edited with the game closed; delete it to get the defaults back. Renderer, logo skipping, volume, frame skipping, picture size (1x/2x/4x/8x pixel-exact, or stretched to the window in 4:3), vsync (no tearing, without ever slowing the game), smoothing, paths. - **Saves as plain folders** (`saves\mc0`, one folder per save, as on a PS2 memory card); existing PCSX2 memory card saves can be imported. - **Fast forward** (Tab): the whole game runs 2x (adjustable) while music and voices keep their normal speed. - **Keyboard and XInput controller** support. - **Seamless music loops**, sound effects and voices from the game's own sound banks. Planned (see `goals.txt` and `docs/ROADMAP.md`): higher rendering resolution (upscaling), CRT shaders, 16:9 widescreen, button remapping and button prompt styles, more readable subtitles, and in the long run frame rates above 60. ## Status The game boots, plays its movies and is playable from the title screen through the story scenes and battles (moving, attacking, enemy turns, saving and loading), including the optional 3D attack animations (with their shadows; a short slowdown at the end of some attacks remains). Details: `docs/STATUS.md`. | Part | State | | --- | --- | | Recompiler (decoder, function discovery, C generator) | done for this game (14,576 functions) | | EE kernel: threads, semaphores, interrupts, alarms, timers | working | | IOP (high level): file loading, memory card, controller, sound driver | working | | Graphics: VIF1, VU1 (recompiled), GS on the GPU (software GS as reference) | working, 60 frames drawn per second | | Movies (IPU) | working | | Sound: music, sound effects, voices, movie sound | working | | Memory card | host folders, load and save work | ## Running After building (below), run `eternal-poison.exe`. It reads the game files from the `data` folder next to it (or, without one, the disc image in `place_game_iso_here/`). Settings are in `game.ini`, created on the first start. The first start after an update takes a few seconds longer while the GPU shaders are prepared. Keyboard: arrows, Enter = Start, Backspace = Select, Z/X/A/S = Cross/Circle/Square/Triangle, Q/W = L1/R1, 1/2 = L2/R2. Tab = fast forward on/off. F11 or Alt+Enter = borderless fullscreen on/off. F12 saves a screenshot and a memory snapshot for bug reports. ## Building Requirements: Windows 10/11 x64, Python 3.12+, CMake 3.25+, Ninja, and [llvm-mingw](https://github.com/mstorsjo/llvm-mingw) 20260922 (ucrt, x86_64) unpacked into `tools/toolchain/`. ```sh tools/build_from_iso.sh "path/to/Eternal Poison (USA).iso" # -> build/Release/ ``` That one command takes the executable out of your ISO, recompiles it, builds the program, and extracts the game files into `build/Release/data` (2.6 GB); from then on the ISO is no longer needed. The executable must be the retail one (PCSX2 CRC `2BE55519`). The steps separately: `tools/extract_disc.py build/disc --elf-only`, `recomp/codegen.py build/disc/SLUS_217.79 generated`, `tools/build.sh`, `tools/extract_iso.py build/Release/data`. ## How it works - `recomp/`: the recompiler. `r5900.py` decodes instructions, `program.py` finds functions without symbols (call targets, pointers, tail calls, switch tables), `codegen.py` writes one C function per game function. - `runtime/include/ps2cpu.h`: the EE register file and the primitives the generated code uses (memory, FPU with PS2 float rules, MMI, VU0 macro ops). - `runtime/src/`: memory and hardware registers, the EE kernel, SIF, the IOP modules in high level (`iop_*.c`), audio, the IPU, settings, Direct3D 11. - `runtime/src/gs/`: GIF, VIF1, VU1 (interpreter and recompiler), the GS in software and on the GPU. - `tools/`: build and extraction scripts, `gsreplay` (replays PCSX2 GS dumps), VU1 recompiler, disassemblers, profilers. - `docs/`: status, roadmap, the technical write-ups, test scripts; `PS2_PORT_PLAYBOOK.md`: everything learned, for porting other PS2 games the same way. The design follows the same split as [ico-pc](https://github.com/nathanialf/ico-pc) (game code compiled natively, hardware and Sony libraries replaced underneath), except that the game code is recompiled instead of decompiled. ## Legal Eternal Poison is © Flight-Plan / Atlus. This project is not affiliated with them or with Sony Interactive Entertainment. MPEG code tables in `runtime/src/ipu_tables.h` partly come from pl_mpeg (MIT licence).