# God of War — PS2 Static Recompilation
**English** · [Español](README.es.md) · [Português (Brasil)](README.pt-BR.md)
**A native PC port of *God of War* (PS2, NTSC-U `SCUS-97399`) built by statically recompiling MIPS R5900 code to C++.**





[](https://github.com/KIexster/god-of-war-recomp/actions/workflows/pruebas.yml)
---
> [!IMPORTANT]
> This repository **does not contain any game files** (ISO, executable, IRX modules or `.PAK` data),
> nor the C++ code generated from them. You need **your own legal copy** of God of War for the PS2.
## Contents
- [What is this?](#what-is-this)
- [Current status](#current-status)
- [Repository layout](#repository-layout)
- [Requirements](#requirements)
- [Building and running](#building-and-running)
- [How it works](#how-it-works)
- [Documentation](#documentation)
- [Credits and license](#credits-and-license)
## What is this?
Instead of emulating the PlayStation 2 one instruction at a time, this project **translates the game's
original executable (`SCUS_973.99`) into C++** with [PS2Recomp](https://github.com/ran-j/PS2Recomp) and
compiles it as a native Windows program, linked against a runtime that reimplements the PS2 hardware and
operating system (EE kernel, GS, DMA, CD/DVD…). The I/O processor (IOP) runs the game's **original IRX
modules** (sound driver, data streamer…) on PS2Recomp's R3000A interpreter.
This repository holds everything that is specific to God of War:
| Component | Description |
|---|---|
| **Function map** | 6,414 functions identified in the ELF (`config/funcmap.csv`) |
| **Recompiler configuration** | Stubs, entry points (including vtable-only virtual methods) and instruction patches (`config/recomp.template.toml`) |
| **Game overrides** | Hand-written replacements and diagnostics for game functions (`src/gow_overrides.cpp`) |
| **Runtime patch** | Fixes to PS2Recomp's IOP emulator and EE runtime needed by this game (`patches/`) |
| **Build scripts** | A complete, reproducible Windows pipeline (`scripts/`) |
| **Tools** | DVD-9 layer 1 extractor (`tools/`) |
## Current status
Per-library and per-component breakdown: [`docs/estado/detalle.en.md`](docs/estado/detalle.en.md). Regenerated from `docs/estado/datos.toml` by `tools/estado/generar.py` (and automatically on push to `main`).
Native Windows build (OpenGL renderer) on a Ryzen 7 5800XT with an RX 5700 XT:
| Milestone | Status |
|---|:---:|
| Extracting both layers of the DVD-9 | ✅ |
| Recompiling `SCUS_973.99` to C++ (6,418 files) | ✅ |
| Building the native executable (MSVC, x64) | ✅ |
| Boot: raylib/OpenGL, heap and thread initialization | ✅ |
| The game's original IRX modules on the IOP emulator (`989snd`, `smpd`, `libsd`…) | ✅ |
| Streaming data from the original ISO (`smpd` → `R_PERM.WAD`, game configuration) | ✅ |
| Main game loop (`sys::GameLoop`) | ✅ |
| Video output: legal screen and title logo | ✅ |
| Ship, Kratos, enemies and HUD have correct shapes; further rendering checks remain | 🔧 in progress |
| Controller/keyboard through libpad2 HLE; menu and difficulty selection | ✅ |
| Gameplay reached; Athens docks at ~12 fps by default and ~25 fps with the optional VU1/GS threads (goal: 30) | 🔧 in progress |
| FMV video: intro decoded and displayed without skipping; other videos unverified | 🔧 in progress |
| Audio: banks and continuous emulated sound verified; playback stutters at the current speed | 🔧 in progress |
| Memory card: listing, loading, saving and reloading verified on a PCSX2 copy; formatting unverified | 🔧 in progress |
The game boots, loads its data from the ISO and reaches the menu and gameplay with keyboard or controller
input. After fixing scratchpad DMA chains, captures show the ship, Kratos, enemies and HUD with correct
shapes. The FMV intro also decodes without `GOW_SKIP_FMV`. Loading, saving and reloading a game have been
verified on a copied 8 MB PCSX2 card with ECC; formatting and reopening it in PCSX2 remain unverified.
The port is still experimental. In the Athens docks it runs at ~12 fps with the default settings and at
~25 fps with the optional VU1 and GS front-end threads and asynchronous GS FINISH (`PS2X_VU1_HILO=1`,
`PS2X_GS_FRENTE=1`, `GOW_GS_FINISH_ASINCRONO=1`), which can still hang occasionally; the compiled VU1
microcode is the main bottleneck. Audio playback stutters, and CPU/OpenGL differences and graphics coverage
need further checks. See [performance](docs/RENDIMIENTO.md), [rendering](docs/COMPARACION_PCSX2.md),
[FMV and audio](docs/FMV_Y_AUDIO.md), [memory card](docs/MEMORY_CARD.md) and
[`docs/ESTADO.md`](docs/ESTADO.md) for the checks and their limits.
## Repository layout
```
.
├── .github/workflows/ # CI: tests (pruebas.yml) and status map (estado.yml)
├── AGENTS.md # Project conventions for contributors and agents
├── config/
│ ├── funcmap.csv # Function map (name, start, end, size)
│ └── recomp.template.toml # PS2Recomp configuration (@ELF@, @MAP@, @OUT@)
├── docs/ # Technical documentation (Spanish)
│ └── estado/ # Status map data and generated SVG/tables
├── game/ # YOUR SCUS_973.99 goes here (ignored by git)
├── patches/
│ └── ps2recomp-*.patch # Changes on top of PS2Recomp @ c5a9d02, applied in order
├── scripts/
│ ├── 1_instalar_herramientas.cmd # Install the tools
│ ├── 2_compilar.cmd # Full build pipeline
│ ├── 2_recompilar_rapido.cmd # Rebuild only src/gow_overrides.cpp (~1 min)
│ ├── 3_ejecutar.cmd # Run for 60 s and keep the logs
│ ├── 3_ejecutar_manual.cmd # Run with no time limit
│ ├── probar_menu.ps1 # Menu smoke test with GS frame captures
│ ├── probar_pad2.cmd # Builds and runs the libpad2 packet test
│ ├── monitor.cmd # Monitor CPU/RAM while building
│ └── *.ps1 # Script logic
├── src/
│ ├── gow_overrides.cpp # Game-specific overrides
│ └── gow_pad2_packet.h # libpad2 packet format (tested)
├── tests/ # Game-independent tests and known runtime-suite failures
└── tools/
├── ci/ # CI helpers (patch order, config/test checks)
├── extraer_capa2.ps1 # Extracts layer 1 of a PS2 DVD-9 ISO
└── estado/generar.py # Status map generator
```
> Script and folder names are in Spanish, the project's original language.
## Requirements
- Windows 10/11 x64
- [Visual Studio 2022 Build Tools](https://visualstudio.microsoft.com/downloads/) with the **C++** workload (includes CMake and Ninja)
- [Git](https://git-scm.com/)
- ~10 GB of free space; 16 GB of RAM recommended (the build uses every core)
- Your own copy of **God of War (NTSC-U, SCUS-97399)**
`scripts\1_instalar_herramientas.cmd` installs Git and the Build Tools with `winget`.
## Building and running
**1. Get the game files.** Copy the executable from your disc/ISO to `game\SCUS_973.99`
(or point the `GOW_ELF` environment variable at it).
Place the disc's **`.IRX` modules** (`SMPD_IOP.IRX`, `989NOMID.IRX`, `LIBSD.IRX`…) next to the ELF: the IOP
emulator runs the originals, and `scripts\ejecutar.ps1` copies them into `IOP_MOD\` on first run.
Reading the game data requires the **original ISO**: name it `God of War.iso` and put it in the folder
above the ELF's folder, or set the `GOW_ISO` environment variable to its path.
To also extract the data on the second layer of the DVD:
```powershell
powershell -ExecutionPolicy Bypass -File tools\extraer_capa2.ps1 -Iso "D:\God of War.iso" -Salida "D:\GOW ISO extraida"
```
**2. Install the tools** (first time only):
```bat
scripts\1_instalar_herramientas.cmd
```
**3. Build** (20–40 min the first time):
```bat
scripts\2_compilar.cmd
```
The script clones PS2Recomp into `:\gowport` (a short path to avoid the 260-character limit;
configurable with `GOW_WORK`), pins commit `c5a9d02`, applies the patches in `patches/`, generates the C++ code and builds
`ps2EntryRunner.exe`. The log is written to `logs\2_compilar.log`.
Release builds disable function and IOP RPC traces by default. For diagnostics, use
`scripts\2_compilar.cmd -Trazas`. To measure game `vid::Flip` calls separately from window refreshes,
run `powershell -File scripts\probar_rendimiento.ps1`; see [the profiling notes](docs/ESTADO.md#medicion-de-rendimiento-2026-10-05).
**4. Run:**
```bat
scripts\3_ejecutar.cmd :: 60 seconds, output in logs\
scripts\3_ejecutar_manual.cmd :: no time limit
```
## How it works
```mermaid
flowchart LR
A[SCUS_973.99
MIPS R5900 ELF] --> B[ps2_recomp]
M[funcmap.csv] --> B
C[recomp.template.toml] --> B
B --> D[~6,400 C++ files]
D --> E[MSVC + Ninja]
O[gow_overrides.cpp] --> E
P["PS2Recomp runtime
+ patches/*.patch"] --> E
E --> F[ps2EntryRunner.exe]
I[Original IRX modules] --> G[IOP emulator
R3000A]
ISO[God of War.iso] --> G
F <--> G
```
More details in [`docs/ARQUITECTURA.md`](docs/ARQUITECTURA.md).
## Documentation
The technical documentation is currently written in Spanish:
- [`docs/ARQUITECTURA.md`](docs/ARQUITECTURA.md) — pipeline, overrides, runtime patches and CI
- [`docs/CONTROLES.md`](docs/CONTROLES.md) — controls and menu/input tests
- [`docs/RENDERIZADO.md`](docs/RENDERIZADO.md) — optional CPU/threaded CPU/OpenGL renderers and comparisons
- [`docs/RENDIMIENTO.md`](docs/RENDIMIENTO.md) — performance measurements, optional threads and VU1 optimizations
- [`AGENTS.md`](AGENTS.md) — project conventions for contributors and coding agents
- [`docs/ESTADO.md`](docs/ESTADO.md) — current status, investigation log, known issues and next steps
## Credits and license
- [**PS2Recomp**](https://github.com/ran-j/PS2Recomp) by ran-j and contributors — recompiler and runtime (GPL-3.0).
- [**SotC runtime fork**](https://github.com/LightVelox/PS2Recomp/tree/ac9efa070638ad3b3accd284de6f898d5ab271d1) by Taylor N. Albarnaz / LightVelox — OpenGL GS backend and command queue, and EE fixes (FPU, 64-bit branches, LQ/SQ, tail jumps, VU0 macro mode and long DMA chains) (GPL-3.0, `ac9efa0`).
- *God of War* © Sony Interactive Entertainment / Santa Monica Studio. This project is not affiliated with
or endorsed by Sony. No game content is distributed.
The code in this repository is released under the **GPL-3.0** license, consistent with PS2Recomp.
See [`LICENSE`](LICENSE).