Resistance 2 Recomp
resistance2-recomp is a native PC port of Resistance 2 for macOS, built with static recompilation and featuring playable campaign and online play.
- Type: PC port
- Game: Resistance 2
- Runs on macOS
- By erikomis
- Latest release v0.2.2, 2026-11-14
- Source: https://github.com/erikomis/resistance2-recomp
README
Resistance 2 — static recompilation for PC (macOS)
🌐 English · Português (BR)
A native port of Resistance 2 (PS3, disc BCUS98120) to macOS/arm64,
built with static recompilation: the game's PowerPC and SPU code is
translated to C/C++ and compiled into a native executable, with graphics on
Metal. It is not an emulator.
The campaign is playable. It runs from the boot through the menus into the campaign: Iceland, then the Bay Area, at close to the game's own 30 fps on an Apple-silicon Mac (heavy fights still dip below it), with a controller or keyboard and mouse. Online play through the PS Rewired community servers works from the launcher with the game's 01.60 update (sign-in, lobby and a match were played on 2026-11-12). See Status.
Built on ps3recomp, with the toolkit, the layout and the tools of the author's Resistance: Fall of Man port. See CREDITS.md.
Warning
Work in progress. The campaign has been played into the Bay Area, not to the end, and some heavy scenes run below 30 fps. The launcher (releases) builds the game on your Mac from your own disc; nothing is downloaded from the game. Apple-silicon macOS only. What is missing is in ROADMAP.md.
This repository contains no game data, no firmware, no Sony keys and nothing translated from them. Everyone generates all of that locally from their own legitimate copy. A fan project, not affiliated with Sony Interactive Entertainment or Insomniac Games.
Project metadata
Project metadata for directories and tools lives in .recomp.json,
following the recomp.board specification. Keep it
updated when the project status, supported game version or target platforms change.
Status
As of 2026-10-30: boot → intro movies → menus → New Game → the first level
(iceland) played through by hand, with combat, dialogue and checkpoints,
into the second level (bay area). Normal gameplay runs at 28–30 fps
(was 14.5 on 2026-10-29); heavy combat can still drop lower (see known
issues). Sessions of 70+ minutes without a hang.
Since 2026-10-29:
- Neon surfaces and a world that stopped drawing: the Metal backend kept
at most 4096 pipeline states, and Resistance 2 keeps creating them as a
level goes on (4600+ in a 15-minute session). Once the table was full,
every new pipeline failed and its draws were dropped for the rest of the
session, which left flat neon colours and missing geometry minutes into a
level, worse when aiming. The pipeline tables are now 65536 entries
(
PS3RECOMP_METAL_MAX_PIPES,PS3RECOMP_ENG_MAX_PIPELINES). - Frame rate, 14.5 → ~28 fps: the RSX thread was CPU-bound (~68 ms a
frame; the GPU worked ~8 ms). Shadow maps and NV3089 depth downsamples
stay on the GPU instead of being read back every frame
(
PS3RECOMP_ENG_ZETA16_GPU); attribute-major vertex fetch (upstream #458,PS3RECOMP_ENG_FETCH_MANY); a vertex cache that no longer starts over and hashes resident geometry sparsely (PS3RECOMP_ENG_VCACHE_KEEP2,PS3RECOMP_ENG_VCACHE_SPARSE); faster swizzled texture decode (upstream #578). - Shader hitches: 99% of a pipeline build was HLSL→MSL translation, so
translations are cached on disk across sessions and builds
(
PS3_SHADER_CACHE), new pipelines build in the background, four at a time (PS3_SHADER_ASYNC,PS3_SHADER_ASYNC_JOBS), and one whose translation is already cached builds at once (PS3_SHADER_ASYNC_SYNC_HIT), which removes the brief flash when aiming. - Saves: the game saves every checkpoint through
cellSaveDataUserListAutoSave, and the menu throughUserListSave/UserListLoad; none was registered, so the unresolved-NID default returned OK without writing anything. They now run the game's callbacks, and saves go to the HDD folder the game lists them from. - HDD install:
cellGameDataCheckCreate2reported the game-data folder as already installed, so the game never copied its caches and streamed dialogue to the HDD and every dialogue line failed to open. It now reports a new install until the files exist; the game copies ~354 MB on first boot (PS3_GAMEDATA_ISNEW=0/1forces it). - Linear textures with mips keep the base pitch on every level
(
PS3RECOMP_TEX_LN_PITCH); a recursion guard that halted an SPU job now unwinds and resumes it. - Pause menu background and CPU-side copies: the Metal backend never
implemented writing guest bytes into a colour target, so an NV3089 copy
the CPU path performs into memory the GPU holds as a surface was lost. At
pause the game copies the scene into the depth buffer's memory and blurs
it back every frame; the menu showed depth read as colour (neon blobs) or
a flat cream background. Those writes now reach the GPU target
(
PS3RECOMP_ENG_GUEST_WRITE), and the GPU depth downsample is back on (PS3RECOMP_ENG_BLIT_GPU). - Heavy combat: SPU-built geometry lands at new addresses every frame
and each piece is drawn about twice; the second draw now reuses the
vertices decoded for the first (
PS3RECOMP_ENG_VCACHE_FRAMEREUSE), which cut frames over 100 ms from 9 to 5 a minute in a probe. - Shaders sampling a volume texture in texel coordinates were cut to
two components and failed to compile (2400 failures in one session's
Moonpool area, every such draw dropped); they are scaled as volumes under
PS3RECOMP_FP_UNNORM_VOL=1(on inplay.sh, being confirmed in play).
Since 2026-10-31:
- Continue Game and Load Level: saves were written but never read back.
cellSaveDataUserListAutoLoadwas not registered, and the fallback that answered it ran only the first callback, soGAME.SAVwas never loaded, the Campaign menu offered only New Game and Cinematics, and every session started over. It now runs the whole fixed-load path (RES_SAVEDATA_LOAD,=0restores the old fallback): the menu offers Continue Game, New Game, Load Level and Cinematics, and Continue lands at the last checkpoint. - Aiming: for a few frames after pressing aim, the sky and far
background turned white with magenta and green noise bands. The aim
transition copies the scene at half size through the CPU-path NV3089 into
memory that also holds a swizzled Z16 shadow map; no surface had that
pitch, so the texture bind took the shadow map as the newest content,
stored the depth over the copy and decoded it as colour. A CPU copy over a
target of another layout is now remembered and wins
(
PS3RECOMP_ENG_GUEST_OVER). In probes, 14 of 15 aims flashed before and 0 of 10 after. - 3-second stalls entering new areas ("GPU sit and spin timeout"):
pipelines whose MSL translation was on disk were built on the RSX thread,
and their Metal compiles cost 20-60 ms each, up to 127 in a row. Only
pipelines whose functions are already in memory build at once now
(
PS3_SHADER_ASYNC_SYNC_HIT=1). - Memory growth: the frame-clock thread never drained an autorelease
pool, so every render target it created kept a texture descriptor alive
(~0.2 MB/s, about 2 GB over 3 hours). Each iteration now runs in a pool
(
PS3_RSX_AUTORELEASE). - Shader function table: the Metal backend's 4096 compiled functions
filled after about 3 hours, the same failure as the pipeline table; it is
65536 now (
PS3RECOMP_METAL_MAX_FUNCS). - Audio clipping: the runtime offered 5.1, so the game mixed six
channels that were then folded to stereo at up to 2.4x full scale. It is
offered stereo now, as RPCS3 does, with a peak limiter for what still
peaks (
PS3_AUDIO_OUT_STEREO,PS3_AUDIO_LIMITER): 3568 clipped samples in a 365-second probe became 0. - Scene copies on the GPU: NV3089 colour copies are recorded on the GPU
instead of read back (
PS3RECOMP_ENG_BLIT_GPU_COLOR); readbacks dropped from 372 to 93 per 120 frames. - SPU interpreter: the dispatch loop no longer writes a shared global and
looks up the lifted-code registry on every step (
PS3_SPU_INTERP_FAST): its own overhead fell from 35-39% to 8-11% of the threads that run it. - Ported from ps3recomp v0.19, off by default while being tested: the
per-source precision modifiers in fragment programs (#670,
PS3RECOMP_FP_SRC_PREC), the depth clamp (#693,PS3RECOMP_ENG_DEPTH_CLAMP), DDX/DDY lowering (#635), the lock-line sleep (#666,SPU_LOCKLINE_SLEEP),SPURS_IDLE_MAX(#659). - Green or wrong-coloured surfaces at the start of a level: draws are
skipped while their pipeline builds in the background. Every cached shader
is now compiled once in the background as soon as the game opens
(
PS3_SHADER_PREWARM), so the system's shader cache has it, and pipelines whose translations are on disk build at once again, within a budget of compile time (PS3_SHADER_SYNC_BUDGET_MS, 8 ms per 100 ms) so a burst cannot stall the game. Loading the second level with a warm cache: draws skipped 117,000 → 2,000, same frame rate, no stall. - Relocatable SPU lifts (
tools/lift_r2_relocmods.py, on;PS3_RELOCMODS=0turns them off): the 142 position-independent SPU modules the jobs load anywhere in local store were interpreted. Lifted, the interpreted steps fall by 80-95%. On a cool machine frame rate and CPU are unchanged at the 30 fps cap; the interpreter's load grows four-fold when the host is hot, which is where the lifts save the most. - Second level (bay area): hitches, strange colours, water that seemed to
follow the camera. Post-process and water programs sample render
targets in texel coordinates, and the scale (1/width, 1/height) was baked
into the shader text; in the bay area those targets change size with the
view, so every size was a new shader and a new pipeline (37,000 pipelines
and 4,300 Metal functions in a 21-minute session, 254,000 draws skipped
while their pipelines built). The scale now travels in the constant buffer
(
PS3RECOMP_FP_UNNORM_UNIFORM). Walking the flooded corridor for four minutes: functions 594 → 205, draws skipped 11,000 → 0, passes of 100 ms or more 6 → 1, seconds under 25 fps 42 → 0.
What it took, with the cause of each:
- SPURS r4 layout: the Wws_Job policy module takes the canonical r4
layout (word 1 = the job list). Putting the list in word 0 made it read
the list as an audit buffer, write
FFFFFFFFover it and exit without running a job: the "render db spu timeout in WaitTillReady" freeze ~90 s in. The port no longer setsSPURS_PM_R4_WORD0. ESRCHfor exited threads: the save system waits for its "Check Thread" to go away by pollingsys_ppu_thread_get_priorityuntil it getsESRCH; the runtime answered OK for exited threads and "New Game" hung.- Raw-SPU programs lifted: the Bink decoder and the two programs the
levels run every frame are raw SPU bytes (a
DEADDEADheader, not ELFs) thatigInitRawSpustreams into LS0x200. The image scanner never saw them and they ran in the interpreter (movies at ~3 fps).tools/prepare_r2_rawspu.pylifts all three; they register as resident code regions by source address. The Wws_Job policy module (also raw bytes) is lifted bytools/prepare_r2_job_pm.py. - LFQueue lost wake-up: an intermittent hang loading the level, between
the PPU's push on a lock-free queue and the zlib task's
WAIT_SIGNAL. The task now registers as parked before it re-checks the queue, with fences on both sides. - Per-instance workload IDs: the game runs two SPURS instances; the
runtime numbered workloads with one global counter of 16, so the 17th
("triangulate") got no ID and the job API asserted.
cellSpurs.c's workload tables are now per instance. - 29 lifted job modules: the WWS job modules (
0xC0DEC0DEheaders in the EBOOT, loaded at LS0x4000) are lifted bytools/regen_r2_jobmods.shand registered by signature. - Stale overlay retirement: the job manager also loads bodies that are
not among those 29 at
0x4000; the runtime kept the previous module "resident" and ran its lifted code over the new bytes (garbage geometry in play). An overlay is now retired when its header in LS is overwritten (A/B switches:SPU_OVL_SIG_OFF=1,SPU_OVL_SIG_ONLY=<ids>). - lwcond events on by default: real
sys_lwcondnotifications (PS3_LWCOND_EVENTS=1, now the default inport/main.cpp) cut the pause after the Insomniac movie from ~5 s to ~1 s. - The RSX FIFO race (5 s stalls, exploded geometry, neon colours): the
game links a side buffer whose JUMP back sits at
put, and reuses that memory for vertex data right after movingputon. The emulated GPU woke every 1 ms and read the vertex data where the JUMP had been ("FIFO JUMP to unmapped IO", the game's 5-second "GPU sit and spin timeout", state lost in the resync). The frame clock now wakes every 50 µs (port/main.cpp;PS3_FRAMECLOCK_USstill sets it), and the FIFO reader re-readsputevery 8 words and after each JUMP/CALL/RET. A 440-second run: no bad jumps. - Split / duplicated left half: the scene renders into a 2560×704 (2×1 AA) target and the final pass reads 1280×704 of it with unnormalised coordinates, but the draw engine handed over the whole target. It now copies a sub-rectangle of the declared size on the GPU. With these fixes the light border around the play image is gone too.
- NV0039 memory-to-memory copies: the copy engine is implemented on subchannel 1, where libgcm binds it; its methods used to land in the 3D engine as state.
- SPU PUT order: SPU PUT, PUTLLC and PUTLLUC write their first 128 bytes last, so a reader polling a header never sees it before the payload (a port of upstream ps3recomp #632).
- Input at the first screen: the front end's input dispatcher read
port 0 as disabled before a local player existed, so X did nothing at the
auto-save notice. A narrowly scoped hook in the lifted dispatcher
(
tools/apply_r2_frontend_patch.py, applied at configure time; switch:RES_FRONTEND_PORT0=0) keeps port 0's events flowing. It injects nothing.
Known issues, being worked on:
- Heavy combat can still drop below 30 fps: SPU-built geometry at new addresses every frame misses the vertex cache (same-frame reuse above halves the decode; more to do).
- Thermal throttling: the game uses about 3.5 CPU cores at 30 fps; once macOS reports thermal pressure, frame rate can fall to 11-19 fps for tens of seconds. The relocatable SPU lifts above cut the interpreter's share of that load; their effect on a hot machine is not measured yet.
- Effects to confirm in play after the fixes above: black squares where a steam/water effect should be, odd electric sparks, a water-like distortion that follows the camera in some places (Moonpool area).
- The fog reads a little darker than on a PS3.
How it works
Same pipeline as the Resistance: Fall of Man port:
- Decrypt your disc's
EBOOT.BINwith RPCS3 intogame/BCUS98120/EBOOT.elf. - Analyse and lift it with the toolkit's
ppu_loader.pyandppu_lifter.py: about 41,500 PowerPC functions become C++ inrecompiled/BCUS98120/(24 translation units). - SPU code: the SPU ELFs embedded in the EBOOT are found and lifted by
the build (
PORT_SPU_INPUTS). Resistance 2 also keeps SPU code as raw bytes, which no scanner finds: the Wws_Job policy module (EBOOT VA0x00CF9680, LS0xA00), the three raw-SPU programs (the Bink decoder at0x00EB6580and two level programs at0x00E9B400and0x00EA2580, LS0x200), the raw-SPU loaderigInitRawSpu(0x00ED2330, LS0x10) and the 29 WWS job modules. Thetools/prepare_r2_*.pyscripts andtools/regen_r2_jobmods.shcut each one out of your EBOOT, check its fingerprint against the tested executable and lift it. - Build with CMake/Ninja against the patched toolkit: the runtime (LV2
syscalls, HLE firmware libraries, SPURS, the Metal RSX backend, FFmpeg for
video) plus the lifted code, into
build/BCUS98120/ResistanceRecomp, and the smallResistanceprogram that owns the window.
The toolkit is upstream ps3recomp v0.17.0 (a6d76c8) plus one patch,
patches/ps3recomp-a6d76c8-resistance2.patch: the whole
Resistance: Fall of Man toolkit patch plus the Resistance 2 changes (the
SPURS lost-wake fix, per-instance SPURS workload tables, stale SPU overlay
retirement, the NV0039 copy engine, put re-read in the RSX FIFO reader,
sub-rectangle sampling of a larger colour target, SPU PUTs with their head
written last, ESRCH for exited threads, real sys_lwcond notifications, a
timebase anchored at first read, and input logging with PS3_PAD_LOG=1).
Building from source
What you need
- An Apple-silicon Mac (macOS with Metal).
- Your own Resistance 2 disc,
BCUS98120, dumped to an image and mounted, or extracted togame/BCUS98120/(the folder that holdsPS3_GAME/). - RPCS3 to decrypt
EBOOT.BIN(if decryption fails, install the PS3 firmware in RPCS3 first). An ELF you decrypted some other way works too: put it atgame/BCUS98120/EBOOT.elf. - Xcode Command Line Tools and Homebrew:
brew install cmake ninja sdl2 glslang spirv-cross spirv-tools ffmpeg python@3.12
Building
git clone https://github.com/erikomis/resistance2-recomp.git
cd resistance2-recomp
tools/rebuild.sh # toolkit, decrypt, analyse, lift, spu, build
tools/rebuild.sh runs these steps (run any of them alone by name, e.g.
tools/rebuild.sh spu build):
| Step | What it does |
|---|---|
toolkit | tools/setup_toolkit.sh: clones ps3recomp to ./ps3recomp, checks out a6d76c8, applies the patch |
decrypt | copies EBOOT.BIN and PARAM.SFO from the disc to game/BCUS98120/ and decrypts the EBOOT with RPCS3 (RPCS3=<path> if it is not in /Applications) |
analyse | ppu_loader.py → analysis/BCUS98120/ |
lift | ppu_lifter.py → recompiled/BCUS98120/ (24 chunks; set JOBS to limit parallelism) |
spu | prepare_r2_job_pm.py, prepare_r2_rawspu.py, regen_r2_jobmods.sh → port/spu/; prepare_r2_rawspu_loader.py → game/BCUS98120/spu_images/ |
build | CMake + Ninja → build/BCUS98120/ResistanceRecomp and build/BCUS98120/Resistance |
The first build compiles a lot of generated code and takes a while. The
tools need Python 3.10 or newer (PY=<python> picks one). The disc is found
through PS3_VFS_ROOT, game/BCUS98120/PS3_GAME, or a volume under
/Volumes with BCUS98120 in its PARAM.SFO (see tools/env.sh).
Playing
The easiest way is the launcher in launcher/: it
installs and rebuilds the port from your disc, keeps the settings and saves,
and plays the game without a terminal. From a terminal:
Mount your disc image (or keep it extracted in game/BCUS98120/), connect a
controller (DualSense, DualShock or Xbox), then:
tools/play.sh
The game opens in a window owned by the Resistance launcher. Saves, the
HDD folders and the log (last.log) are kept in
~/Library/Application Support/resistance-recomp-2/ (RES_DATA changes
that); the last 10 session logs move to logs/, and every log line starts
with the seconds since launch. The window title shows the frame rate. Close
the window, or press Ctrl+C in the terminal, to quit. The first boot c