Development¶
Open Blood Money has two halves that share one source tree. The matching decompilation is readable C and C++ in src/ that the pinned EE GCC 3.2 compilers turn back into the original PlayStation 2 executable byte for byte: 19,051 of 19,052 game functions are recovered, and the 14 levels' scene scripts (27,894 functions) rebuild byte-identical modules. The SDL3 port compiles the same src/ natively and replaces the PS2 platform classes with its own.
- For the method of recovering a function, see Decompiling.
- For what accepted source must look like, see the Readability Standard.
- For the port's architecture and rules, see The SDL3 Port.
AGENTS.mdholds the facts about the original build that every change relies on.
Verify¶
make setup # the pinned EE GCC compilers and their Docker runtime
make helpers # the Python venv with the disassembler the diff tools use, and MkDocs
make extract # both executables into extracted/ and the INCLUDE_ASM fallbacks into asm/, from the ISO
make match # compile every source unit and compare C/C++ and assembly bytes
make match-scripts # compile src/scripts and compare the 14 mission modules
make iso # rebuild both executables, write build/openbloodmoney.iso, compare every disc byte
make verify-iso # compare an existing output ISO again
make digests # verify against the disc and record tools/config/compiled-digests.json for CI
make check-digests # compile everything without the disc and compare with those digests
make test # the pipeline's regression tests and the host behaviour tests
make format # format every C/C++ file with the pinned clang-format (make format-check checks)
make docs # build this site into build/site (make docs-serve serves it while you edit)
make progress # the last verified recovery figures
The compiler runs locally in Docker with networking disabled, so the Docker engine must be running. The original ISO goes in the repository root. CI checks formatting, runs the host tests and verifies the compiled digests on every push to main. A separate workflow publishes the documentation. Pushing a v* tag builds the release packages (CI and Releases). After changing src/, commit the digests make digests records.
Working on a function¶
- Find it:
python3 tools/find_function.py ZActor::GetPathFinder4. - Iterate with
python3 tools/diff_function.py <id>(a manifest id such asob_001a0e7c, or a mangled symbol). It compiles only that unit and prints an aligned diff against the original.tools/lines.pyshows the original instructions with their source lines,tools/debug_context.pythe original scopes and locals, andtools/check_unit.pyevery function of a unit. - Run
make match, thenmake test.make isowithmake verify-isoconfirms the whole disc once per batch of changes.
A function that is not recovered is one INCLUDE_ASM line in its source file. A readable body that does not match yet stays under #ifdef NON_MATCHING with that line in its #else branch, and make drafts scores those. After adding or deleting an INCLUDE_ASM line, run make extract again.
Scope¶
The target is the game's own code and IO Interactive's engine, including IOI's shared and audio libraries and its PS2 platform adapters. No PS2 BIOS image is an input or a recovery target.
The executable also contains linked Sony SDK routines, GCC and newlib runtime code, STLport and zlib. Recovering their C/C++ is outside the goal. The SDK, runtime and zlib objects have no files in src/: tools/config/source-tree.json lists their functions, and the gaps between sized functions, as reference_ranges, each with the original object it came from, and the build copies those bytes from extracted/HITMAN3.ELF. They stay part of the executable and ISO verification. STLport templates are instantiated in game units and compile with them; the four instances that do not match yet keep an INCLUDE_ASM line.
tools/config/decomp-scope.json records the attribution rules. They use recovered source paths and the original object path of each reference range, including the definition paths of library functions instantiated inside game source files. Unknown ownership is reported separately. Source provenance takes precedence over names: IOI's custom std::vectorS containers are game code.
Progress figures¶
make progress # the last verified recovery percentages
make match progress # rebuild and refresh the figures
python3 tools/progress.py --files # also by source file
python3 tools/progress.py --json # machine-readable
Progress counts byte-matching first-party C/C++ functions and their code bytes. Linked SDK, runtime and third-party functions and unclassified functions are outside the default denominator. Assembly fallbacks and non-matching bodies do not count. python3 tools/find_function.py NAME --all and python3 tools/progress.py --all show the dependencies too, for inspection only.
make progress works without Docker. It compares the current sources, headers, assembly and toolchain configuration with the last build's fingerprints and says when its figures belong to an earlier build.
Repository layout¶
| Directory | Contents |
|---|---|
src/ |
The decompiled game. Translation units are mapped from debug source records (repeated records get __tuNN suffixes) and each header sits beside its unit at the original include path. src/scripts/ holds the scene scripts and src/openblood/ holds the project's own build helpers. The 13 original IOI assembly units use file-scope assembly inside .cpp files on the PS2; the port builds the native C++ branch in 12 of them and uses host startup for crt0. |
port/ |
The SDL3 port. It compiles the game units from src/ natively and replaces the PS2 platform classes and functions with its own (port/engine, port/hitman3), plus its CMake project, shaders, launcher, mod runtime, example mods and the script SDK. |
docs/ |
This site: guide/, modding/, internals/ and development/, built by mkdocs.yml. |
tools/ |
Scripts and the matching pipeline. tools/matching/ is the build-and-compare library, tools/config/ its configuration (source-tree.json records address, size, original symbol, source unit or original object, signature and reference hash for every .text range), tools/tests/ the regression tests, and tools/port/ the port's and the scripts' tools. Downloaded third-party code goes into tools/third_party/, which is not tracked. |
Generated and local inputs stay out of Git: the original ISO in the root, extracted/ (the two executables from the disc), asm/ (the original opcode words of each INCLUDE_ASM line in src/, written by make extract: ProgressHandler and four STLport instances), analysis/ (the raw per-file CCC recovery, whose empty function bodies are debug-export placeholders, not implementations) and build/.
make scaffold recreates missing source files from the debug records and preserves existing edits. It needs the macOS CCC v2.1 tools under tools/third_party/ccc-v2.1/ccc_v2.1_mac/ and writes the recovered records under analysis/.
The matching build¶
This is a fixed-address hybrid build, not a full source relink. All 3,638,588 bytes of the main .text section come from compiled functions or assembled source-tree blocks, placed at their original addresses, and both the boot executable and the debug executable on the disc receive the rebuilt .text. Relocations resolve by symbol name against the original executable, and the data each unit defines is placed and compared with the original bytes. VU code, ELF metadata, disc assets and the disc layout are retained from the original.
The build caches objects by source and dependency hashes, compiler identity, runtime image and object hashes. make match-fresh bypasses the cache.
The pages¶
| Page | Contents |
|---|---|
| Decompiling | The per-function loop, reading the diff, generated functions, destructors, vtables, STL instantiations and the source shapes that change code generation |
| Readability Standard | The acceptance standard: readable source that compiles to the original machine code byte for byte |
| Matching Techniques | One entry per technique found while matching |
| Generated Functions | Recipes for compiler-generated functions: static initializers, __tcf_N and the D0/D1/D2 destructors |
| Data Defined in Source | Every data symbol the game code references and where its definition lives |
| CI and Releases | The disc-free digest check, formatting, and the release builds |
| Reprisal Differences | How Feral's Reprisal (Android) differs from the PC game, and how its new features work |
| ProgressHandler | The last function in assembly and what is known about its difference |
| Worked Fixes | Nine of the harder matching problems, worked through (docs/development/fixes/) |
| The SDL3 Port | The port's architecture, overrides, native scene scripts, renderer, sound and stability work |