bo3-recomp
bo3-recomp is a Linux and Android native static recompilation of Call of Duty: Black Ops III for Xbox 360.
- Type: PC port
- Game: Call of Duty: Black Ops III
- Runs on Linux and Android
- By arieco57
- Latest release v0.1.2, 2026-11-19
- Source: https://github.com/arieco57/bo3-recomp
- Website: https://discord.gg/zr2nxmc9E
README
Black Ops III (Xbox 360) — Linux native static recompilation
Proyecto personal, muy beta. Es más un experimento en marcha que un juego terminado: se rompe, cambia seguido y hay cosas sin terminar. Para novedades, dudas y avisos de versiones nuevas: Discord de BO3 Recomp.
Goal: run Call of Duty: Black Ops III (Xbox 360 version, title ID 4156091D) natively on
Linux, using static recompilation (PowerPC → C++ → x86-64), the approach used by
Unleashed Recompiled. This is not an emulator.
You must own the game. Nothing in
extracted/,private/,content/orppc/may be redistributed (see.gitignore).
Players: install and play (releases)
Download the release for your system (Linux .tar.gz or Android .apk) - it contains no game
files. On the first run the game installs itself from your own copy (runtime/src/setup.cpp):
- the disc image (
.iso: Redump XGD2 / XGD3 or XISO) ->extracted/game/ - the Title Update package (console
Content/0000000000000000/4156091D/000B0000/, STFS) and the free Compatibility Pack 1 + 2 (required) plus any other DLC (.../00000002/) ->content/ XexPatcherapplies the TU to both executables ->private/<mp|zm>/default_patched.xex
Everything is verified by SHA-1 (the recompiled code matches exactly that disc + Title Update 1).
Inputs are taken from the data folder, its instalar/ folder and, on Android, /sdcard/BO3Recomp
or Downloads ("all files access" is asked for). User instructions: docs/LEEME-*.txt.
BO3_SETUP_YES=1 skips the dialogs (tests).
Developers: building, releases, Discord
tools/fetch_deps.sh- third-party sources (pinned) and the static xma2-only FFmpeg.tools/prepare.sh- needs your copy of the game: extracts it and recompiles the executables intoppc/(generated from the game's code: never committed).cmake -S . -B build -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ && cmake --build build- Releases:
tools/make_release.sh v0.x.y->dist/v0.x.y/(Linux tarball with static FFmpeg and libstdc++ - needs glibc 2.38+ and an AVX2 CPU - and the Android APK). The online backend (Supabase URL + publishable key) is compiled in fromrelease.conf(not in git); source builds have none unlessbo3recomp.inisets it. - Publishing a GitHub release runs
.github/workflows/discord-release.yml: it posts the notes to Discord #announcements and the Linux / Android download links to their channels (repository secretsDISCORD_WEBHOOK_ANNOUNCEMENTS,DISCORD_WEBHOOK_LINUX,DISCORD_WEBHOOK_ANDROID).
Current status
| Stage | Status |
|---|---|
Unpack disc image (.zar = ZArchive) | ✅ 532 files, 4.2 GB, SHA-256 integrity verified |
Apply Title Update 1 (.xexp) to both executables | ✅ |
| Decrypt/decompress XEX, dump image | ✅ |
Register save/restore helpers, setjmp/longjmp | ✅ found and verified by disassembly |
| Jump tables (switches) | ✅ 156 per executable (custom detector, see below) |
| PPC → C++ recompilation | ✅ 0 warnings / 0 unrecognized instructions (MP and ZM) |
| Generated C++ compiles (Clang 21, -O2) | ✅ 0 errors / 0 warnings → libBO3RecompLib_MP.a, libBO3RecompLib_ZM.a (~57 MB each) |
Runtime (runtime/): memory, loader, threads, sync, files, XAM, offline net | ✅ both executables reach the engine main loop and run stable at 60 fps (headless) |
| GPU command processor | ✅ PM4 ring/IBs, waits, fences, scratch writeback, synchronous CP interrupts, constants (SET_CONSTANT/2, LOAD_ALU_CONSTANT), swaps |
| Renderer (Vulkan) | 🟡 title → menus → lobby → loading → in match / Freerun with the 3D world rendered (lighting, shadows, reflections, post-processing, HUD), ~60 fps in menus, Freerun and MP matches on a Radeon 680M — see "Renderer" below |
| Audio | ✅ XAudio frames (5.1) downmixed to stereo on SDL audio, paced by the device; XMA hardware decoder emulated (MMIO register traps + FFmpeg xma2) - music, UI and in-game sound |
| Input | ✅ SDL3 gamepad, keyboard + mouse look (PC-style layout) → XInput pad 0 |
| Window | ✅ SDL3 (Wayland/X11), resizable, HiDPI, F1 video options (resolution, fullscreen on/off, saved in bo3recomp.ini), F11 / Alt+Enter / --fullscreen / --windowed, letterboxed |
| Video (Bink) | ✅ the boot logo movie plays (~3 s, then the Activision logo); BO3_SKIP_INTRO=1 skips it. Menu background movies: still being checked |
Layout
BKU-Call of Duty - Black Ops III.zar original disc image (ZArchive)
content/ Xbox 360 storage dump (TU, DLC, saves) — see below
extracted/game/ unpacked disc: default.xex, default_zm.xex, *.xpak, snd/, video/ ...
private/{mp,zm}/ per-executable work dir
default.xex / default.xexp base XEX + TU1 delta patch
default_patched.xex patched XEX (input to XenonRecomp/XenonAnalyse)
image.bin, info.txt decrypted memory image (base 0x82000000) + section map
imports.txt 279 kernel/XAM imports the runtime must implement
recomp_addresses.toml auto-detected helper addresses
config/BO3_{MP,ZM}.toml XenonRecomp configs (generated)
config/BO3_*_switch_tables.toml jump tables (generated)
ppc/{mp,zm}/ generated C++ (~170 MB each, 144 files)
tools/
prepare.sh runs the whole pipeline end to end
zar_extract.py ZArchive extractor (+ --verify)
gen_config.py writes config/BO3_*.toml
find_callers.py find `bl` callers of an import (used to locate longjmp)
bo3prep/bo3prep.cpp patch XEX + dump image + find save/restore helpers
bo3prep/bo3switch.cpp scheduling-tolerant jump-table detector
bo3prep/ppcdis.cpp tiny disassembler for image.bin
patches/xenonrecomp-bo3.patch instructions added to XenonRecomp (applied by prepare.sh)
XenonRecomp/ hedge-dev/XenonRecomp @ ddd128b (+ patch)
What is in the files
- Two executables:
default.xex(Multiplayer + Freerun) anddefault_zm.xex(Zombies). The Xbox 360 version has no campaign. They are separate programs → two separate recompilations and, eventually, two Linux binaries. content/0000000000000000/4156091D/000B0000/tu00000001_00000000— BO3 Title Update 1 (default.xexp,default_zm.xexp+ patched fastfiles*.ff). Applied on top of the disc XEX.content/0000000000000000/4156091D/00000002/*— DLC: The Giant, Awakening, Compatibility Pack 1/2. Needed later by the runtime's content/DLC mounting.content/E0300000126D662A/4156091D/00000001/*— offline saves (stats, loadouts, settings).- Not BO3 (ignored):
4156081C= World at War TU7 + save,415608C3= Black Ops II TU. extracted/game/$SystemUpdate/— Xbox dashboard system update, not needed.
Running the pipeline
tools/prepare.sh
cmake -S . -B build -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
cmake --build build -j10 # ~27 GB RAM: keep -j moderate, each TU uses 1–2 GB
Requirements (Fedora): clang cmake ninja-build git python3 python3-zstandard.
How the addresses were found
- Save/restore helpers (
__savegprlr_14etc.): byte patterns from the XenonRecomp README, matched on two consecutive instructions to avoid hitting inlined prologues; exactly one hit each. - longjmp: the only
RtlUnwindcaller that restores f14–f31 from thejmp_bufin r7 (MP0x82A11500, ZM0x82A03720). - setjmp: the function storing f14–f31, r13–r31 and v64+ into r3 at the same
jmp_bufoffsets (MP0x82A60780, ZM0x82A52740). - Exception handler records: the 8 bytes before every
.pdatafunction with the exception flag (C++ frame handler,__C_specific_handler, 1 custom) are data; listed ininvalid_instructionsso the linear sweep doesn't decode them as code.
Changes needed versus Sonic Unleashed
BO3 was built with a newer XDK compiler, so stock XenonRecomp/XenonAnalyse were not enough:
-
Jump tables — XenonAnalyse found 0: it matches fixed opcode sequences, while BO3's compiler interleaves the table setup and inserts
nops.bo3switchinstead evaluates registers symbolically from the bounds check (cmplwi+bgt/bge) tomtctr/bctr, handles register copies (mr), a re-computed index, and mask-bounded indices with offset (Bink code), and accepts a table only if every target lies inside the owning function. 401 otherbctrsites are real indirect calls (vtables, function-pointer tables) and correctly stay indirect. -
Leaf functions with switches (no
.pdata): XenonRecomp's analyser stops at thebctr;bo3switchemits explicit bounds for the 24 affected functions. -
56 missing instructions added to XenonRecomp (
tools/patches/xenonrecomp-bo3.patch): update-form loads/stores (lfsu stfsu lhzu sthu lbzux lwzux ldux stdux …),addc addme subfze eqv lhbrx dcbst frsqrte bdzf bdnzt, VMX (vsrah vslh vsrh vsl vminsw vminuh vmaxuh vsubuwm vsububm vsubshs vsubuws vaddsws vavguh vavgsw vspltish vnor vsel128 vcmpgtsw vcmpgtuw vcmpgtsb vpkswss vpkshss vpkuwus128 vpkuhus128 vrfip vcfpuxws128 lvehx lvebx stvebx). Also:bdnzfused a hard-codedeqCR bit (correct for Unleashed only) — now uses the real bit;vpkd3d128float16_4 with pack mode 3 accepted (same layout as mode 2 for shift 0–2, per Xenia); record formsrldicl./rlwimi.now update cr0.⚠️ These instruction implementations were written from the PowerPC/VMX128 specs and checked against the existing code's conventions, but are not yet tested at runtime. Once a runtime exists, verify them with XenonTests-style unit tests.
Runtime (runtime/src)
Built per executable (build/bo3_mp, build/bo3_zm), run from the repository root:
build/bo3_mp # [--trace] logs every import call; [--game DIR] [--update DIR]
| File | What it does |
|---|---|
main.cpp | entry, function table (PPC_LOOKUP_FUNC), crash handler (prints guest address/lr) |
memory.* | 4 GiB guest reservation; virtual heap 0x40000000+, physical heap 0xA0000000+ |
loader.* | loads private/<m>/default_patched.xex, resolves kernel variables and IAT entries, guest copy of the XEX header + LDR_DATA_TABLE_ENTRY |
kernel_vars.cpp | XboxHardwareInfo, KeTimeStampBundle (updated every 1 ms), XexExecutableModuleHandle, … |
thread.* | guest threads on host threads; PCR (r13) / KTHREAD / TLS layout from Xenia; host-driven guest threads for callbacks |
kobject.* | events, semaphores, mutants, timers, handles, named objects, waits (one dispatcher lock) |
kernel_sync.cpp | ExCreateThread, Nt*Event/Semaphore/Mutant/Timer, Ke*, critical sections, spinlocks, TLS, time |
kernel_memory.cpp | NtAllocateVirtualMemory, MmAllocatePhysicalMemoryEx, … |
kernel_file.cpp + vfs.* | NtCreateFile/ReadFile/QueryDirectoryFile/…, case-insensitive paths, game:/d: → TU then disc, cache:/hdd: → ~/.local/share/bo3recomp, symbolic links |
kernel_misc.cpp | sprintf/_vsnprintf/DbgPrint (guest varargs), Rtl* strings, Xex*, ExGetXConfigSetting |
xam.cpp | video mode, launch data, one signed-in local profile, notifications, system UI stubs |
net.cpp | offline: static XNADDR, real UDP/TCP sockets forced to 127.0.0.1 |
gpu.cpp | null Xenos command processor: PM4 ring/IBs, WAIT_REG_MEM, MEM_WRITE, fences, scratch-register writeback, per-CPU INTERRUPT, swap, 60 Hz vsync callback, DPCs, Vd*. BO3_GPU_TRACE=1 logs every packet |
audio.cpp | XAudio render driver (null output), XMA context allocation, voice (no headset) |
input.* | XamInputGetState/GetCapabilities/SetState |
import_stubs.cpp | generated (tools/gen_import_stubs.py): weak fallback for every import — logs UNIMPLEMENTED name(...) once |
mp/hooks.cpp, zm/hooks.cpp | hooks on recompiled functions; currently the engine's error function, so GAME ERROR file:line: message is logged before it longjmps |
Fixes found while booting (all in tools/patches/xenonrecomp-bo3.patch): PowerPC integer divides never trap
but x86 does on /0 and INT_MIN/-1 → generated divides are now guarded (result 0, like Xenia).
Engine-specific behaviour found so far:
xenon_net.cpp:964asserts "Unable to find an XNADDR." ifXNetGetTitleXnAddrreports none → we report a static address.xenon_net.cpp:1009"Couldn't allocate IP port" without sockets → loopback sockets.stream.cpp:1563"No more free path items" without directory enumeration →NtQueryDirectoryFile.- Arguments past r10 are in 8-byte slots at
r1+0x50(verified at anNtCreateFilecall site). - D3D throttles frames with "write SCRATCH_REG1 = 1; WAIT_REG_MEM [scratch writeback + 4] == 1" — needs the
Xenos scratch-register memory writeback (
SCRATCH_ADDR/SCRATCH_UMSK). - GPU interrupts: the handler clears its bit in a CPU mask using
PCR.current_cpu, so CP interrupts are delivered once per CPU in thePM4_INTERRUPTmask with that field set. xenon_voice.cpp:90"Error ... on XHVCreateEngine()" until the audio render driver andXamUserReadProfileSettingswork.- Jump tables: some bounds checks are 84 instructions before the
bctr(zlib inflate), others live in a predecessor block —bo3switchhandles both (168 tables per executable).
Renderer (runtime/src/gpu)
| File | What it does |
|---|---|
vk.* | SDL3 window, Vulkan 1.3 device, swapchain (mailbox), guest physical memory is GPU memory: 512 MiB allocated by Vulkan, exported as a dma-buf and mapped by the CPU at all three physical views (0xA0000000 / 0xC0000000 / 0xE0000000+0x1000), zero-copy for the shaders. Fallback without dma-buf export: host-pointer import of an unaliased view |
shader_translator.* | Xenos microcode → GLSL 4.60: full control flow (exec/cond-exec/predicates/loops/calls/jumps via pc switch), vector+scalar ALU co-issue with Xenos "0 × x = 0" multiply, vertex fetch of every Xenos format with endian swap, texture fetch, exports, alpha test |
shader_compiler.cpp | GLSL → SPIR-V with glslang (static). Compiled shaders are kept in shadercache/ (reset automatically when the translator is rebuilt); new ones compile on 4 background threads and draws using them are skipped until ready (BO3_SYNC_SHADERS=1 compiles inline, BO3_NO_SHADER_CACHE=1 ignores the disk cache) |
renderer.* | EDRAM render targets as Vulkan images, dynamic rendering, pipeline cache (dynamic cull/depth/stencil), rect-list/quad-list via geometry shaders, viewport/VTE → host NDC in the shader, resolves (copy + colour/depth clears), present of the front-buffer resolve |
texture_cache.* | guest textures: tiling (Xenia's Tiled2D), endian swap, fetch-constant swizzle → image view, DXT1/3/5/DXN as BC1/2/3/5, 8/16/32-bit formats, render-to-texture through resolve targets, samplers |
runtime/xenia/ | Xenia's xenos.h, ucode.h, registers.h, register_table.inc, texture_address.h (BSD) + a tiny shim |
Frame analysis: BO3_FRAME_LOG=<frame> logs every draw (targets, formats, MSAA, depth state, VTE, textures with
their fetch constants) and resolve of that frame; with BO3_FRAME_DUMP=dir every resolve is written as PPM (HDR
clamped) with channel means, BO3_FRAME_DUMP_DRAWS=n,m also dumps the bound target after those draws.
BO3_TEX_DUMP=dir writes every texture upload (untiled blocks), BO3_MEMEXPORT_LOG=1 logs memexport streams.
Debug switches: BO3_SCREENSHOT=file.ppm BO3_SCREENSHOT_FRAME=n[,n...] (dump presented frames; several →
file_<n>.ppm), BO3_GPU_TIMING=1 (serialized GPU cost per operation type, every 60 frames),
BO3_GPU_TRACE=1, BO3_DUMP_SHADERS=dir (+ build/shader_test dir/*.bin to check the translator offline),
BO3_NO_WINDOW=1 (headless), BO3_GAMELOG=1, BO3_BINKLOG=1, BO3_TRACE_WAITS=1, BO3_TRACE_HANDLE=0x...,
BO3_TRACE_IMPORTS=<guest thread id|all> (every kernel/XAM call with args, caller and result),
BO3_AUTOPRESS="5:START,8:A", BO3_VK_VALIDATION=1. Crashes print all GPRs and a guest backtrace; engine
errors (GAME ERROR) print a guest backtrace too.
On-screen controller (Android): OPCIONES > "Mando virtual" (ini [input] virtual_pad=1) shows an Xbox-style
touch controller (android/src/com/bo3recomp/VirtualPad.java: sticks, ABXY, d-pad, LB/RB/LT/RT, View/Menu, L3/R3),
semi-transparent over the game; its state reaches host_input.cpp through JNI (VirtualPad.nativeUpdate) and is
merged with a physical pad. Touches that miss the controls go to the game (the OPCIONES button). Saving the
options keeps every ini section other than [video] / [input] as it was (it used to drop live=1).
Live remote control (driving a running instance from scripts): BO3_PRESS_FILE=<path> - writing "A,DOWN,A" to
that file presses those buttons 0.6 s apart (the file is then deleted; Android always uses press.txt);
BO3_SHOT_FILE=<path> - writing an output path (.ppm) to it saves the next frame there.
Quick test into Freerun (light, good for testing): BO3_AUTOPRESS="7:A,10:DOWN,11:A,15:A,19:A" build/bo3_mp.
Quick test that walks into a match (MP): BO3_AUTOPRESS="7:A,10:A,15:A,20:A,45:A" build/bo3_mp
(title → Multiplayer → Start Game → class select → spawn).
Controls (keyboard + mouse; the first click captures the mouse, F10 releases it):
| Action | Key | Action | Key | |
|---|---|---|---|---|
| Move | WASD | Look | mouse (BO3_MOUSE_SENS, default 1.0) | |
| Fire / Aim | left / right click | Jump | Space | |
| Crouch / slide | C or Ctrl | Sprint | Shift | |
| Melee | V or mouse side button | Reload / use | R or F | |
| Lethal / tactical | G / Q | Specialist | X | |
| Switch weapon | 1, 2 or wheel | Scorestreaks (D-pad) | 3-6, arrows | |
| Pause menu | Esc | Scoreboard | Tab | |
| Menu accept / back | Enter / Backspace | Fullscreen | F11 or Alt+Enter | |
| Options (video, FPS counter, mouse) | F1 | Release mouse | F10 | |
| FPS counter off / FPS / detailed | F2 |
Mouse look goes through the client's gamepad look function (MP sub_822E3E38, ZM sub_822DFD78): it stores
the frame's view turn rates at [client] + 12704 (pitch) / +12708 (yaw, negative = right), with the client pointer
at MP 0x84475F74 / ZM 0x84439358. The hook adds mouse degrees / frame time divided by the game's own turn factors
(measured: yaw ×111.6, pitch ×49.3), so the mouse uses the same path as the stick - client command + prediction:
instant and smooth - without the stick's response curve (dead zone 0.22, rate ∝ x^2.52) and its ~0.35 s turn ramp.
Horizontal = mouse_ratio × vertical (default 2). Earlier attempts and why they failed: writing the server-side view
angles (sub_821B2E88, kept as BO3_MOUSE_LEGACY=1) only showed on screen at server-snapshot rate (15 rendered
frames without any change while the angles moved); mouse-as-stick (BO3_MOUSE_STICK_CTL=1) has the turn ramp.
Tools: BO3_MOUSE_EVENTS=<s> (SDL motion events at 1 kHz), BO3_MOUSE_TRACE=<s>, BO3_STICK_SWEEP=<s>,
BO3_LOOK_LOG=1, BO3_SCREENSHOT_AT=<s>,<n> (consecutive frames), BO3_WATCH_RW=1 (read+write watchpoints).
Black textures after a few minutes: the persistent descriptor-set cache is cleared when it reaches 24576 sets, but the
"last set" shortcut kept pointing into the destroyed pools. Fixed (BO3_SETCACHE_MAX=<n> forces early clears).
FOV: the cg_fov dvar (hash 0x31DCBADD, 65) is found and can be written (BO3_FOV_EXPERIMENT=1, fov in the ini),
but it has no visible effect yet - not exposed in the menu.
FPS counter (F2 or F1 → Contador de FPS, fps_overlay in the ini, BO3_FPS=0/1/2): FPS, frame time (average /
worst), GPU busy time, command-