# Need for Speed: Hot Pursuit 2 (PS2) — native port A native port of the PlayStation 2 version of *Need for Speed: Hot Pursuit 2* (NTSC-U, `SLUS-20362`) to macOS, built on your machine from your own copy of the game. The game's code is translated to C by a static recompiler written for it, one C function for each of the game's, named by the [decompilation](https://github.com/nfshp2/nfshp2) (a submodule at `decomp/`), and runs natively beside stand-ins for the PS2's hardware: the graphics drawn through SDL3's GPU API (Metal on a Mac) from the game's own GS packets, the sound mixed by a model of the PS2's sound chip, pads, memory cards and the disc. Races can run at 60 fps, the keyboard is a pad beside any gamepad, and a menu over the game (Tab, or both sticks clicked) holds the port's settings, cheats and mods, among them new cars. **No file from the game's disc is in this repository** (no executable, assets, assembly listing or decompiler output), **and no program built from one may be shared:** the port you build is the game's code, translated from your disc. You need your own copy of the game. This project is not affiliated with or endorsed by Electronic Arts. ## Playing On a Mac (Apple Silicon; Intel should work and is untested), with Xcode's command line tools (`xcode-select --install`: a C compiler and Python 3): ``` git clone --recursive https://github.com/nfshp2/nfshp2-port hp2-port && cd hp2-port tools/setup.sh --play # the Python env and SDL3, once python3 tools/extract_elf.py DISC.iso # your disc's executable, once tools/play --iso DISC.iso # builds what is missing and starts the game ``` The first start names the executable from the decompilation's files (about 15 seconds), translates it and compiles the port (a few minutes); later starts take seconds. Your memory card, key map, settings and mods live in `~/Library/Application Support/hp2-port/` (`docs/port/first-play.md`). No emulator, no Docker and no compiler of the PS2's are involved (`docs/port/retail.md`). | Platform | | |---|---| | macOS, Apple Silicon | played, and checked on every change | | macOS, Intel | untested; the SDL3 framework and the shaders are universal, the runtime is plain C | | Linux x86-64 | builds and runs headless in every check (drawing through Mesa's software Vulkan); never yet played on a desktop's GPU | | Windows x86-64 | the programs link (cross-compiled); never yet run | ## Mods A mod is a folder in `mods/` of the data folder with a `mod.toml`: rows for the menu, words of the game set by symbol name and by the headers' field names, files that stand in for the disc's, native hooks, and new cars by `CarTypeInfo`'s field names over a stock base, with their own names, colours and pictures. `port/mods/` has samples, `tools/modcheck.py FOLDER` checks one without starting the game, and `tools/car/build.py` makes a car you bring (a glTF model and its pictures) into a mod (`docs/mods/`). ## For developers `port/build.py` builds the port's programs (`--retail` from your disc's executable; without it from the decompilation's own build, which needs the decomp's toolchain: its README), `tools/portcheck.py` boots them headless and checks each milestone by name, and `tools/portmerge.py` is the whole check: the decompilation's four builds linked in `decomp/` and every port check run on them (`docs/port/build.md`, `docs/port/retail.md`). The recompiler is `tools/recomp/` (`docs/port/recompiler.md`), the runtime `port/src/`, the stand-ins `port/hle/`. ## How this was made The port, like the decompilation, was written by AI agents (Anthropic's Claude models, through Claude Code) under a plan and checks of its own, each stand-in held to the game's behaviour on the PS2 as PCSX2 shows it (its frames within a few levels, its sound sample for sample once PCSX2's own output stage is taken out), and played by a person. The decompilation's `docs/method.md` says how the work was run; this repository's `docs/port/` and `docs/mods/` are the record of each piece. The history before the first public commit was developed privately from 2026-10-04 and squashed. ## License [MIT](LICENSE) for the recompiler, the runtime, the stand-ins, the tools and the notes; the decompilation it reads is CC0. One file is neither: `port/hle/spu_gauss.h`, the sound chip's interpolation table as the public PlayStation documentation (psx-spx) gives it, cited in its header. SDL3 (zlib) is fetched by `tools/setup.sh`, not copied here. The game itself is EA's, and *Need for Speed* and *Hot Pursuit* are trademarks of Electronic Arts Inc.