Skip to content

PC Comparison

The Steam PC release of Hitman: Blood Money is built from the same IOI source tree as the PS2 game. This page describes the function-level mapping between the PC executable and the decompiled PS2 build, the Ghidra export of the PC code it rests on, how precise the mapping is, and every PC/PS2 difference noticed while building it. The scripts are in tools/pccompare/; every output goes to build/pc-compare/ (untracked).

Numbers on this page are from the rerun of 24 November 2026, which adds the reviewed overrides, the script-interface table stage and the comparison fixes taken from the four hand reviews in PC Differences. The reviews themselves read the run before it; where this page quotes that run, it says so.

Summary

In-scope PS2 functions paired with a PC function 11,915 of 19,052 (62.5%); 2,450,144 of 3,427,676 bytes (71.5%)
PC first-party candidates matched 11,048 of 15,878 (69.6%)
PC functions in the Ghidra export 23,117 (19,749 code, 3,123 exception funclets, 245 thunks), 658 of them seeded at the script-interface table
PC functions standing for several PS2 functions 220 (identical-code folding, GCC constructor/destructor copies)
Precision, random stratified review 264 of 281 sampled pairs accepted (94%), 12 wrong (4.3%), on the mapping before the reviews
Comparison against the 391 review verdicts precision 78.9% (44.1% before the fixes), recall 94.7%; all 47 wrong pairs gone

The bulk of what stays unmatched is expected: 913 functions in PS2 platform files, 594 more in the PS2 renderer, 629 trivial functions of at most 8 bytes, and 274 compiler-generated static initialisers. The 716 script-interface entries, which the previous run missed almost entirely, are now paired through the PC table at 0x7f1d20 (The script-interface table); 19 *.si.cpp helpers that are not table entries stay unmatched. On the PC side, 261 unmatched functions sit in engine/drawing/_wintel/renderd3d, about 680 in PC-only RTTI classes (D3D, DirectSound, OpenAL, Windows file and input classes), and 2,153 in the statically linked Quazal networking SDK.

Reproducing

# everything, reusing the Ghidra export when it exists (about 2 minutes)
python3 -I tools/pccompare/run_all.py
# redo the Ghidra export as well
python3 -I tools/pccompare/run_all.py --ghidra
# one pair side by side: mapping row, Ghidra C (mapped callees renamed PS2_<name>), PS2 source
python3 -I tools/pccompare/show_pair.py 004f7050      # PC or PS2 address
python3 -I tools/pccompare/show_pair.py --sample callgraph low 10 [seed]

run_all.py runs, in order:

  1. ghidra_export.py records and ghidra_export.py decomp: Ghidra headless with tools/pccompare/ghidra/ExportPcFunctions.java, after seeding functions at the script-interface table and the PC addresses of tools/pccompare/overrides.tsv.
  2. ps2_records.py: the same kind of facts for every PS2 function, from extracted/HITMAN3.ELF.
  3. ps2_lines.py: PS2 source line ranges from the .mdebug $LM labels.
  4. build_mapping.py: the mapping and the reports.
  5. split_decomp.py: the greppable PC C tree.
  6. compare_pairs.py: what differs in each pair (see Comparing the pairs).
  7. score_verdicts.py: diffs.tsv and the mapping against the hand-reviewed verdicts (see Against the review verdicts).

Inputs that the scripts expect: the analysed Ghidra project build/pc-recon/ghidra-proj (the PECompact-unpacked HitmanBloodMoney.unpacked.exe), build/pc-recon/unpacked/vtables.tsv (RTTI vtables), the unpacked executable itself, and extracted/HITMAN3.ELF. The Python must have pyelftools and capstone installed. Set GHIDRA to the Ghidra 12.2 installation and JAVA_HOME to JDK 25. build_mapping.py is deterministic: two runs give the same mapping.tsv.

Outputs

File Contents
mapping.tsv pc_addr ps2_addr ps2_name src_file method confidence score relation evidence checks, one row per mapped PS2 function
unmatched_pc.tsv pc_addr size category file_guess file_evidence class_guess strings for unmatched PC code
unmatched_ps2.tsv ps2_addr size name src_file reason for unmatched in-scope PS2 functions
pc-classes.tsv final category of every PC function
pruned.tsv pairs dropped by the late callee check, with their evidence
stats.txt stage log, coverage, cross-checks, PC-only clusters
pc-raw/records.jsonl per-function PC facts (below)
pc-raw/decomp.jsonl {"addr", "c"}: Ghidra's C for every non-thunk function (22,872)
pc-raw/seeds.txt the entry points seeded before the export (table entries and override addresses)
pc-decomp/<bucket>.c, index.tsv the same C split by 64 KiB of address space, with headers
ps2-records.jsonl, ps2-vtables.jsonl, ps2-lines.json the PS2 side
ps2-linesets.json every $LM line of each PS2 function per source file, @entry the file of its first label
diffs.tsv, diffs-summary.txt the pair comparison (below)
review/ the review batches, keys and verdicts used for the precision figures, and the four <page>-verdicts.tsv files of the subsystem reviews
baseline/ the outputs of the run the subsystem reviews read (kept for score_verdicts.py --baseline)

relation is same (the same source function), platform (a PS2 adapter, or another class's override, against its Windows/D3D counterpart in the same slot), folded (one PC function stands for several identical PS2 functions) or variants (GCC's C1/C2 or D1/D2 copies of one PC function). checks lists the automatic cross-checks the pair passes (+) or fails (-).

PC record format

Each line of pc-raw/records.jsonl is one function:

  • addr, min, max, size (bytes in the body), insns, name (Ghidra's), thunk (target), cc and sig (Ghidra's; mostly unknown, see the pitfalls);
  • calls: every call and unconditional jump out of the function in address order, as <target>@<site>: a hex address, ext:<import>, ptr:<global function pointer>, ind:<operand> for calls through a register (ind:dword_ptr_[EAX_+_0x20] is vtable slot 8), or tail:<target> for a jump to another function;
  • callargs: for each entry of calls, the immediates and strings pushed since the previous call, first argument first (["?", "sengine\\zstdlib\\chunk.cpp", "i275"]);
  • strings, ints (scalar operands), floats (f<value>@<addr> or d<value>@<addr> for x87 and SSE loads from memory), globals (<addr>[:symbol][:w]), fnptrs (function addresses taken), datarefs (data words that point at the entry, such as vtable slots).

ps2-records.jsonl has the same fields for the PS2 side (strings and data addresses come from lui/addiu pairs; floats from lwc1 loads and lui[/ori] + mtc1 immediates), plus id, symbol, unit, debug_path, scope and signature from tools/config/source-tree.json.

Decompiled PC C

pc-decomp/00420000.c holds 0x00420000 to 0x0042ffff. Each function starts with

// ==== 0x004f7050 FUN_004f7050 (116 bytes) category=matched
// ps2: 0x001922b4 ZROOM::ClassInit | src/engine/geomsbase/zroom.cpp | string/high/same
// file: ... (anchor)                       (unmatched functions only)
// vtable classes: ...                      (unmatched functions only)
// callees: FUN_004326b0=ZBaseGeom::ParentGroup FUN_004393c0=striwcmp

so grep -n "==== 0x004f7050" build/pc-compare/pc-decomp/*.c finds a function and index.tsv gives the file and line of each one.

Ghidra setup and export

The recon (build/pc-recon/) unpacked the PECompact 2 executable by emulation and imported it into a Ghidra 12.2 project with full auto-analysis. ghidra_export.py copies that project to build/pc-compare/ghidra-proj once and runs analyzeHeadless -process HitmanBloodMoney.unpacked.exe -noanalysis -readOnly with the export script. The records export takes about 15 seconds; the decompilation uses ParallelDecompiler across all cores, with a 120-second timeout per function, and resumes an interrupted decomp.jsonl. Logs: build/pc-compare/ghidra-export-{records,decomp}.log.

Before either export, the script seeds functions from pc-raw/seeds.txt (written by ghidra_export.py): the 716 targets of the script-interface table at 0x7f1d20 and the PC addresses of overrides.tsv. A seed that is not yet a function is disassembled (a defined data item in the way is cleared first) and made a function; a seed inside another function's body would be skipped and logged. The project is opened read-only, so the seeds are applied again on every run and the recon project stays as it was. This run made 658 functions, all of them table targets except ZScriptC::SetName at PC 0x549670; none was inside another function and none failed.

Pitfalls:

  • The unpacked image has one RWX .text section that holds code, constants, vtables and data. An address is code only if Ghidra disassembled an instruction there; testing the memory block's execute flag classifies every string and float as code.
  • Ghidra prints a typed memory operand as float ptr [..] or double ptr [..], not dword ptr; float extraction has to accept both.
  • Auto-analysis did not run parameter identification: cc is unknown and most signatures are undefined FUN_x(void) in the records. The decompiler infers __thiscall/__fastcall and parameters itself, so the C is better than the records' signatures.
  • PC string operands of push carry no scalar in ints (they are addresses); ints also holds frame sizes, ret N counts and struct sizes, so treat it as weak evidence.
  • Ghidra names exception funclets Unwind@<addr> and Catch@<addr> (3,123 functions between 0x720000 and 0x740000); they are compiler output, not source functions.
  • vtables.tsv lists only RTTI-labelled vtables; classes compiled without RTTI have unlabelled vtables that only the data-table walk finds.
  • Code that only a data table reaches is not a function. The script-interface table is the big case (659 of its 716 targets); the seeds above fix it. A second symptom of the same kind is a Ghidra range that ends early: a lone int3 that the code falls into, a call to printf (which Ghidra marks non-returning) or a switch table Ghidra could not recover all end the body, and records.jsonl then lacks the calls and strings after that point. compare_pairs.py extends such bodies itself (see Fixes from the reviews).

How the mapping is built

Every stage only adds pairs; a PS2 function maps to at most one PC function, and a PC function maps to several PS2 functions only when it is tiny and identical (MSVC /OPT:ICF folding) or for GCC's constructor and destructor copies. Candidate pairs are scored by similarity(): shared strings (+3 and more, -2.5 when both sides have disjoint strings), shared float constants, the size ratio (PC code is about 0.77 of the PS2 size), callees already matched on both sides (+1.5 each, -0.4 for each one called on one side only), a PC __LINE__ inside the PS2 function (+4), vtable-offset overlap, virtual on one side only (-1.5), and globals already known to correspond (learned from matched pairs, about 150 of them).

Stage What it uses Pairs
reviewed force rows of tools/pccompare/overrides.tsv (Reviewed overrides) 78
sitable entry n of the PC script-interface table is ScriptInterfaces[n] (The script-interface table) 715
string a literal referenced by exactly one PC and one PS2 function 618
line PC new/assert __FILE__/__LINE__ arguments inside one PS2 function's own line range 201
vtable RTTI vtables against the PS2 _ZTV vtables of the same class, slot by slot 5,810
vtref constructors and destructors by the vtable they store 603
strset strings shared by 2 to 8 functions per side, assigned by similarity 110
datatable walks out from matched pointers in data tables (unlabelled vtables, tables of handlers) 137
callgraph callee sequences of matched pairs aligned between matched callees; few unmatched callers 3,036
order per source file, the functions between two matched neighbours aligned in address order 474
variant GCC's C1/C2 and D1/D2 copies attached to the PC function their sibling matched 133

The stage order in stats.txt (first anchor pass, then up to ten rounds of call graph, file order, string sets, vtables and data tables) is: reviewed 78, sitable 715, string 618, line 206, vtable 5,760, vtref 470, strset 101, variants 78, then the rounds add 1,492, 983, 360, 136, 43, 20, ... from the call graph and 297, 105, 40, 23 from file order, until a round adds nothing.

Compared with the run the reviews read (10,788 pairs), 1,273 PS2 functions gained a partner (686 through the table, 348 through vtables, 166 through the call graph, 45 reviewed rows), 146 lost theirs and 69 changed partner (28 of them to a reviewed row). The vtable gain is identical-code folds (340 of the 348 are folded pairs): functions of three bytes or less (ret, xor eax, eax; ret, mov al, 1; ret) that the Quazal run had filed as library code now stand for the empty PS2 virtuals in their slots (PC function categories). Most losses are low call-graph and data-table pairs (99 of 146) whose context moved. The one subsystem that lost coverage is engine/collision: a run of eight ZCollisionBox helpers in zcollisionboxold.cpp (PushSphereOut, PushSphereOutOfMesh, CollideSphereAndTriangle, ...) was chained by the call graph from PushSphereOut against PC 0x4be880, a pair the earlier precision review had already marked as probably wrong; the chain no longer forms.

Details that matter:

  • Vtables. Class names are compared as token sets (?$ZArray@PAVHeader@Animation@@ and _ZTV6ZArrayIPN9Animation6HeaderEE both give Animation Header ZArray); 921 PS2 vtables find their PC class. GCC's D1/D0 destructor pair is collapsed to MSVC's single scalar-deleting slot, which is matched to D0. MSVC gathers each name's overloads at the first one's slot in reverse declaration order (checked on independent pairs: 34 moved slots confirmed, 2 contradicted), so the PS2 slots are reordered that way first. Overload sets of three or more (such as CSharedCom::SetVal, ZPackedOutput::ExchangeData) differ between the builds and are left out. Systematic slot moves learned from non-vtable pairs (see the differences) turn on a DP alignment for that class.
  • vtref. A PS2 C1/C2 or D1/D2 function stores its class vtable; the PC constructor and destructor store the RTTI vtable of the same class. The PC destructor is the one the class's scalar deleting destructor calls. A PS2 constructor or destructor is never paired with a PC function that stores a different class's vtable, whatever the stage.
  • line. PS2 line ranges are the cluster of $LM lines (gaps of at most 30) around a function's first label, so code GCC inlined from elsewhere in the same file does not widen the range. Header sites are not used: every function that inlined the header code spans that line. When several PS2 functions contain the line, the smallest range wins. A line anchor also needs a score of 2.5 or more (the +4 line bonus included) and compatible sizes.
  • Guards. Compiler-generated PS2 static initialisers never match (the PC has one initialiser per global in its own region). Outside the anchor stages, a pair is refused when the PC function sits in vtables of classes whose PS2 vtables do not hold the PS2 function, or when the vtable vote for the PC function points at another PS2 function. Every stage refuses the forbid rows of overrides.tsv, and a PC function with a reviewed pair (larger than three bytes) takes no other partner. The call-graph, order and data-table stages also refuse a PC function whose stored vtables all belong to PC-only RTTI classes (a constructor, destructor or inlined new of PC-only code), unless the PS2 function is a platform adapter. In this run that rule refuses nothing: the renderer pairs it was meant for are forbid rows, and a first version that applied it to every stage and to any PC-only vtable refused three correct anchored pairs (ZHM3MenuFactory::WindowFactory, ZVideoPlayer::BeginPlaying and ZHM3LevelControl::PostInit2, which inline new of PC-only classes).

Reviewed overrides

tools/pccompare/overrides.tsv is the tracked input that carries the hand reviews into the mapping. Each row has action pc_addr ps2_addr ps2_name source note; source names the review page and section, # lines are comments.

  • force pairs the two functions before every other stage (method reviewed, confidence high), so the stages build on them. Several force rows with one PC address make a folded PC function (ZHM3CameraBaseFunc::LoadObject and SaveObject at PC 0x5e0de0). A swap is two force rows.
  • forbid refuses the pair in every stage; * on one side forbids every partner of the other function: a PC-only function (* as the PS2 side, such as the cheat-menu forwarder PC 0x6605d0 or the WinMain-style startup PC 0x401100), or a PS2 function that the PC inlined everywhere (ZActionMenuBase::GetLineObject, ZPackedInput::CheckSignature).
  • A force row whose PC address Ghidra did not make a function is seeded by the export (ZScriptC::SetName at PC 0x549670).

The file holds 80 force rows and 38 forbid rows, from the "Wrong pairs found" sections of the four pages: the wrong pairs with their correct partners, the swapped siblings (CBodyContainer::Open/Close, ZLevelLinking::Initialize/Clear, ZMusicController::Fade/ControlMix, ZHM3LevelControlHideout::CheckCustomWeaponState/ ReplaceCustomPistolWithDualShit, the ZHitmanActionCloseCombatHit slots, the CConfiguration::WriteIniSettings and ZDllSound::CalcVolume overloads, ZSysFile slots 54 and 55), the wrong callee pairs (ZHitman3::GetCurrentZone, ZTrailControl::OnDecalRemoval, the scheduler family in scheduledevent.cpp, ZStringMemoryManager::GetStringObject, PC 0x431050 the in-place vsub against vlen) and the missing pairs the pages list (ZMoneySystem, the zsimplehtml.cpp helpers, ZWinInput::Update, ZEntityTracker::GetClosest, ScriptEngine::AttachSceneScripts, ZDllSound::CanPlayInRoom, ZSoundGraph, ZTokenStream, ...). Four more force rows keep reviewed-correct pairs that the corrected run lost: ZLevelLinking:: OverrideAction (the call graph had given its PC function to ZHM3SavePS2::SaveProfile), the two M05 garage functions and the callee ZBaseGeom::GetOwnerRoom. Not taken over: the twelve ZHitman3::StartActionCloseCombat* functions (the PC range 0x5ed480 to 0x5eda40 holds eleven functions, so the order is not certain), the seven 22-byte SHtmlState getters (nine on the PS2) and PC 0x4be1c0, which may stand for either ZCollisionBox::GetRootVect.

Twelve of the forbid rows (* as the PC side) are PS2 functions that a page found inlined on the PC or without a PC copy (ZScheduledScript::ZScheduledScript, ZIKHAND::ZIKHAND, CDamper::SetParamsHeavyCar, ZTrailControl::DeactivateElement, ZOldViewBase::GetVisibleGeomsRecur, AddSingleDecal, ...). Without them, the stages hand such a PS2 function the next plausible PC function once the reviewed rows free its old partner: GetVisibleGeomsRecur, for one, went to PC 0x47b3d0 inside the PC-only zviewspace.cpp range.

All 80 force rows are in the final mapping; the forbid rows refused 189 candidate pairs (18 distinct) during the run. stats.txt reports both under "reviewed overrides". Some PS2 functions whose PC partner a review could not find are paired by the stages in this run, unreviewed: ZHM3ActionControl::CanLookKeyhole (PC 0x615880, callgraph high), ZHitman3::CanDragBody (PC 0x5f5e20, callgraph medium), ZHitman3::IsBalconyJumpable (PC 0x5eb370, order medium) and ZOldDrawIdListMirrorGroup::GetMirrorBound (PC 0x46f100, callgraph low).

The script-interface table

PC 0x7f1d20 holds 716 code pointers in the order of the PS2 ScriptInterfaces[716] (src/engine/ScriptInterfaces/scriptinterfaces.h; the PS2 table is the 2,864-byte .data object ScriptInterfaces at 0x4a5118). ScriptEngine::AttachSceneScripts (PC 0x43bf40) copies it into each level DLL's ScriptImports (Script interfaces on PC). Nothing else references 659 of the targets, so the previous export had no functions there; the seeded export has all of them.

The sitable stage runs right after the reviewed rows and pairs entry n of one table with entry n of the other. 715 entries become pairs; the other one (Zlink__Canplayanimsegment) is also a force row with the same partner. The PC table has 705 distinct targets: MSVC folded the nine empty debug functions into the lone ret at 0x5e0ef0, and three pairs of identical interfaces into one body each, so 16 table pairs are folded. In diffs.tsv the table pairs are 442 same, 268 minor, 3 calls, 1 constants and 1 structure.

Coverage of the two script-interface subsystems went from 20 of 491 (4.1%) to 487 of 491 (99.2%) in hitman3/interfaces, and from 16 of 251 (6.4%) to 236 of 251 (94.0%) in engine/ScriptInterfaces; the call graph and file order then reached some of the remaining *.si.cpp helpers.

Pruning

Anchors are accepted while few callees are known. After the rounds, prune() re-scores every pair with the final call graph and drops a pair when no matched callee agrees, at least two matched callees disagree (called on one side, their partner not called on the other), and the score without the line bonus is below -0.5. Constructors and destructors are exempt, because MSVC inlines base and member constructors and destructors that GCC calls, and the scalar deleting destructor inlines the destructor; so are the reviewed and table pairs. The final run drops 87 pairs, re-runs propagation (+33) and prunes again (10): 97 in all, 38 from the call graph, 50 vtable, 5 line, 4 data table. (The first version of the rule, without the constructor exemption, dropped 157 vtable pairs, most of them correct deleting destructors.) All dropped pairs are in pruned.tsv with their evidence; most are genuinely contradicted, some (for example ZBaseGeom::SetRootTM against PC 0x433bb0, where MSVC appears to have inlined GetLocalMatPos) may be right, so treat that file as a candidate list.

Confidence

  • high: every reviewed and table pair; an anchor stage (string, line, vtable, vtref) with an independent agreeing signal or a score of 6 or more; a propagated pair with 1.5 independent signals or a score of 7 or more.
  • medium: an anchor without contradiction; a propagated pair with a score of 3 or more.
  • low: contradicting evidence (disjoint strings or floats, a far line, a score below -1), or a propagated pair with little evidence of its own.

Precision

Pairs were checked by hand in blinded batches: each pair showed the Ghidra C (callees already mapped renamed) and the PS2 source, without the method or confidence. Verdict codes in review/verdicts*.txt:

Code Meaning
c correct: clearly the same function
l likely: consistent but with too little distinctive content to be sure (tiny getters, deleting destructors whose PS2 body is compiler output)
t trivial: both empty or return a constant; the PC function may be folded
p platform: a PS2 adapter against its Windows/D3D counterpart in the same slot
w wrong
u unsure

Batches 0 to 3 (key.tsv, verdicts.txt): 281 pairs drawn at random from each method and confidence band of the mapping as it stood before the last fixes (snapshot review/mapping-reviewed.tsv). Precision counts c + l + t + p.

Method Band n c l t p w u precision
string high 12 11 1 100%
string medium 12 8 3 1 100%
string low 5 1 2 2 60%
line high 12 12 100%
line medium 12 11 1 92%
line low 6 2 1 3 50%
vtable high 12 11 1 100%
vtable medium 20 9 7 3 1 95%
vtable low 12 2 5 2 3 58%
strset high / medium 24 22 1 1 96%
datatable high 12 3 9 100%
datatable medium 11 7 1 3 100%
datatable low 12 3 2 4 3 75%
callgraph high / medium / low 48 42 6 100%
order high / medium / low 36 32 3 1 97%
variant all 35 13 22 100%
all 281 187 65 3 9 12 5 94%

Batch 4 (key2.tsv, verdicts2.txt): 48 of the 289 pairs that the first round of fixes added, the hardest population. 30 c, 3 t, 11 w, 4 u. Five of the wrong ones were slots of the big overload sets CSharedCom::SetVal and ZPackedOutput::ExchangeData and five were constructors of ZHitmanAction subclasses (ZHitmanSedateCIAAgent, ZHitmanPutDownSuitcase, ZHitmanActionChangeClothesFromBody, ...) that the call graph had aligned among near-identical siblings. Both were then fixed: big overload sets are left out of vtable, data-table and order matching, and constructors are matched by the vtable they store.

Batch 5 (key3.tsv, verdicts3.txt): 32 pairs of the final mapping, 20 from vtref, 4 data-table and 8 call-graph pairs that no earlier batch covered. vtref: 16 c, 3 l, 1 w (ZHM3WeaponScope::ZHM3WeaponScope against PC 0x64a760, which is the class's factory Create with the constructor inlined). Data table: 3 p, 1 w. Call graph: 6 c, 2 w (ZHM3ItemWeaponCustomTemplate::ClearUpgrades against a placement-new wrapper, and ZTARGET::IsEnabled against an out-of-line geom type test; the 35 PC type tests are now excluded, see below).

What the wrong and uncertain pairs had in common:

  • Low bands of the anchor methods. Errors concentrate where the score already contradicted the anchor; the low bands of string, line, vtable and data table carry almost all of them, which is what the bands are for.
  • Line drift in changed files. Where the PC source changed (PC-only menu code in hitman3/gui/ingamemenus.cpp), a PC new at line 1897 lands inside PS2 ZContainerMenu::Open; and PS2 functions that inlined static functions of the same file had ranges spanning thousands of lines. Fixed by line clusters, the smallest-range rule and the score requirement; ZContainerMenu::Open is now unmatched.
  • Overloads. Every wrong vtable pair was an overload (ZActor::ActivateAnimSegment, CSharedCom::SetVal, ZLNKOBJ::CheckLineCollision, ZPrimControlBase::ModifySpotLight).
  • Families of near-identical functions (action constructors, type tests) in the call graph.
  • Static initialisers paired through a string or a line (fixed: they no longer match).
  • Uncertain: PS2 functions stubbed out (return false, a debug break) against a full PC implementation, and thunks (non-virtual thunk to CMultiDoor::Init() against a thunk that calls CDoor::Init).

The pairs reviewed wrong in batches 0 to 4 were re-checked after the fixes: all but five were unmatched or paired differently. Still present in this run and probably wrong: ZWINDOWS::Notify (PC 0x552760, datatable low), ZToggleText::AddText (0x561240, order low), zstring::format (0x43b5f0, callgraph low) and ZPrimControlBase::ModifySpotLight (0x46d120, datatable low). ZCollisionBox::PushSphereOut (0x4be880) is no longer paired.

The four subsystem reviews (PC Differences) are a second, larger check of the flagged pairs: of 391 pairs, 47 were wrong, all of them now corrected or forbidden through overrides.tsv. Their wrong pairs were mostly low and medium call-graph, order and data-table pairs among families of similar functions, and vtable slots shifted by overloads.

Automatic cross-checks (stats.txt) agree: string-anchored pairs agree with the vtable vote in 427 of 427 cases and with the class of the vtable holding them in 427 of 428; line-anchored high pairs agree 74 of 74 with both. Reviewed pairs disagree with the vtable vote in 6 of 11 cases, which is expected: several of them correct exactly those slot votes (shifted ZHitmanActionCloseCombatHit slots, reversed overloads).

A reasonable reading: high and medium bands of every method are about 95 to 100% precise; low bands of anchor methods about 60 to 75%; propagated low bands 80 to 100% depending on how many similar functions surround them. The old recon list build/pc-recon/data/name_pairs.tsv (648 pairs from unique literals in src/, made by build/pc-recon/scripts/string_match.py) agrees with this mapping for 623 of its 636 PS2 functions that are mapped; most of its 13 disagreements point into the PC static-initialiser region, where it was wrong.

PC function categories

pc-classes.tsv gives each PC function one final category:

Category Count How it is decided
matched 11,048 paired with at least one PS2 function
eh-funclet 3,123 Ghidra name Unwind@, Catch@, Catch_All@ (MSVC C++ exception unwind funclets, 0x720000 to 0x740000)
lib:quazal 2,153 Quazal Net-Z/Rendez-Vous SDK: functions in RTTI classes of namespace Quazal, or with bare X.cpp file strings (JobConnectStation.cpp), or Quazal strings, and every function between two such marks (0x6d8000 to 0x727b00)
unattributed 2,010 first-party candidate with no file, class or line evidence
first-party:ps2-file 1,510 unmatched; its __FILE__, or the file of its matched address neighbours, has PS2 functions
static-init 1,397 at or above 0x740000: MSVC dynamic initialisers (one per global, ending in _atexit) and their destructors
first-party:pc-only-class 682 in vtables of RTTI classes without a PS2 vtable
first-party:pc-only-file 628 its file evidence names a file the PS2 build lacks
thunk 245 Ghidra thunks (import and jump thunks)
lib:jpeg 237 libjpeg: exported jpeg_*/jinit_* names and everything between them (0x40f000 to 0x421000)
lib:crt 38 the statically linked MSVC runtime helpers from 0x727b00 to 0x729000: _ftol2 (0x727d4c), __chkstk (0x727cc0), __allmul, __allshr, __alldiv, __aullrem, the eh vector constructor/destructor iterator, __SEH_prolog, the CRT entry
pc-helper:type-test 35 out-of-line (GetTypeID() & T::m_Mask) == T::m_Id helpers (one virtual call at +0x34, two globals); GCC inlines them
lib:zlib 11 zlib strings (invalid block type, incorrect header check, ...) and the run between them (0x40b000 to 0x40f000)

Two corrections from the reviews: the CRT helpers used to fall inside the Quazal run (a function between two Quazal marks inherited the category), so _ftol2 and __chkstk calls showed as ~+lib lib:quazal: 474 pairs had that item before, 20 have it now; the helpers are lib:crt and the comparison ignores them. And a function of three bytes or less is never filed under a library: identical-code folding put lone rets and return 0s among the library code (0x5e0ef0 stands for nine empty script-interface debug functions, 0x6f7400, which Ghidra names jpeg_mem_init, for every folded return 0), so they are first-party candidates that can stand for PS2 functions.

The C runtime (MSVCR71.DLL), D3DX (d3dx9_27.dll), Bink (binkw32.dll), DirectSound, DirectInput and Direct3D are DLL imports, so none of their code is in the executable. File evidence comes from __FILE__ strings and __FILE__/__LINE__ arguments; MSVC keeps an object's functions together, so a function between two functions of the same file inherits it (the recon's attribute.py did the same; matched functions count as evidence for their PS2 unit).

Coverage by subsystem

In-scope PS2 functions per src/ directory (matched / total, and matched bytes):

Subsystem Matched Bytes
hitman3/characters 1,983 / 2,743 (72.3%) 88.2%
engine (timetype.cpp) 1 / 1 (100%) 100%
engine/drawing 373 / 1,646 (22.7%) 16.3%
engine/geomsextend 1,201 / 1,559 (77.0%) 83.6%
hitman3/background 955 / 1,538 (62.1%) 73.5%
engine/geomsbase 959 / 1,468 (65.3%) 73.7%
hitman3/gui 841 / 1,174 (71.6%) 82.4%
engine/zwindows 802 / 1,104 (72.6%) 83.5%
engine/eventsbase 591 / 1,010 (58.5%) 66.3%
engine/zstdlib 538 / 895 (60.1%) 68.8%
hitman3/levelcontrol 604 / 890 (67.9%) 80.2%
engine/system 305 / 568 (53.7%) 57.4%
hitman3/interfaces 487 / 491 (99.2%) 99.4%
engine/fysix 327 / 488 (67.0%) 83.4%
hitman3/hitman3 49 / 483 (10.1%) 18.8%
engine/enginedata 294 / 453 (64.9%) 80.1%
hitman3/camera 272 / 446 (61.0%) 82.6%
engine/shared 224 / 323 (69.3%) 77.7%
engine/audio 219 / 321 (68.2%) 82.8%
audiolib/audiocontrollertypes 128 / 272 (47.1%) 80.6%
engine/ScriptInterfaces 236 / 251 (94.0%) 96.4%
engine/serializerlib 122 / 229 (53.3%) 59.6%
engine/collision 96 / 163 (58.9%) 57.0%
common/basic 51 / 121 (42.1%) 43.6%
engine/pathfinder4 75 / 93 (80.6%) 91.6%
engine/rendervideo 27 / 83 (32.5%) 46.8%
engine/animation 58 / 81 (71.6%) 90.6%
engine/boids 39 / 50 (78.0%) 90.6%
engine/camera 24 / 30 (80.0%) 66.4%
audiolib/audiotypes 14 / 23 (60.9%) 87.1%
audiolib/common 5 / 17 (29.4%) 26.2%
common/zstl 6 / 13 (46.2%) 58.5%
engine/startup 1 / 10 (10.0%) 8.0%
common/containers 8 / 10 (80.0%) 75.9%
engine/globals 0 / 5 0%

Low subsystems and why: engine/drawing is mostly the PS2 renderer (drawing/old, _ps2); the PC has its own D3D material renderer. hitman3/interfaces and engine/ScriptInterfaces, the script interfaces, were the two lowest subsystems of the previous run (4.1% and 6.4%) and are now the two highest, through the table stage. engine/collision lost the call-graph chain described above. hitman3/hitman3 is mostly hm3properties.cpp: 404 property-template functions (RTP::ZDataProperty<T>::Load, GetEnumInfo<T>) without strings or distinctive calls.

Biggest unmatched PS2 functions without an obvious reason (from unmatched_ps2.tsv): MD5Engine_t::transform (3,936 bytes), ZPostFilterEvent::MixPalettes (3,712), ZOldDrawBase::CalcBoneLightSources (2,844), ZHapticsBase::Init (2,496), ZOldViewBase::Update (2,232), ZGeometryDecal::Create (2,140), ZOldDrawIdListMirror::UpdateCamera (2,052), ZOctreeCompiled::CheckLinesegment2 (1,672), ZOldDrawBase::GeomCreate (1,664), ZOldViewBase::Flush (1,656), ZOldViewBase::ExitVsExitChck (1,636), PrepareData (scriptc.cpp, 1,572), SampleStaticShadowData (1,316), AddSingleDecal (1,312), ZCheckVisible::NotifyObjectsNotInCheckedCells (1,204), ZCollisionBox::CalcImpactNormal (1,188), ZOSD::InitElementPositions (1,160), ZParticleController::CreateParticle (1,156). Most are the PS2 renderer, which the PC replaced (the reviews found the PC partners of GeomCreate and AddSingleDecal split into PC-only classes); ScriptEngine::AttachSceneScripts and ZSoundGraph::TestGraph from the previous list are now reviewed pairs.

PC-only clusters

From stats.txt (unmatched PC functions by file guess and by PC-only RTTI class):

  • D3D renderer: engine/drawing/_wintel/renderd3d (261 functions), classes ZRenderWintelD3D, ZRenderWintel, ZDirect3DDevice, ZTextureManagerD3D, ZPostFilterWintelD3D, the ZRenderMaterial*D3D/ZRenderMaterialBinderParserD3DFX material system, ZPrimAccess*MeshD3D, and the PC texture formats ZBitmap32, ZBitmapDXT1, ZBitmapDXT3, ZBitmapPal, ZBitmapPalOpac, ZBitmapI8, ZBitmapU8V8.
  • Audio back ends: engine/audio/synth/_wintel with DirectSound (ZSynthDS, _ZSoundBufferDS), OpenAL (ZSynthOpenAL, ZSoundBufferOpenAL) and DieselPower (ZSynthDP, ZSoundBufferDP), plus ZSynthWintel and ZDllSoundWintel.
  • Windows system layer: engine/system/_wintel, ZSysFileWintel, ZSysInterfaceWintel, ZPrimControlWintel (keyboard, mouse and window handling live here).
  • Online: libraries/znet (game_hitman3, lobby, core), ZLobbyRendezvous, ZNetPlatform_Win32_t, on top of the Quazal SDK; engine/zstdlib file-system and chunk code (chunk.cpp has no PS2 functions at all).
  • PC menus: hitman3/gui/menu/system (render options, key rebinding, quit menu).

Differences between the builds

Each entry names the PS2 function (address in the PS2 ELF), the PC address and what differs.

Build-wide:

  • Debug checks on PC. The PC release keeps null-pointer traps (int 3, Ghidra's swi(3)) and asserts that the PS2 build compiled out; nearly every PC function has extra branches.
  • Allocation with file and line. PC new is FUN_00446620(size, __FILE__, __LINE__) (also 0x6ea3a0, 0x45a0d0, 0x51a840 and a virtual at vtable+0x78); the PS2 build passes no file or line. These arguments are what the line stage uses.
  • Inlining. MSVC inlines base and member constructors and destructors that GCC calls, and the scalar deleting destructor inlines the destructor; GCC inlines the geom type tests (IsGeomType<T>) that MSVC keeps out of line as 35 per-class helpers.
  • Folding. MSVC folds identical functions (/OPT:ICF): 220 PC functions stand for several PS2 functions (empty virtuals, return 0, identical destructors). Byte-identical PS2 functions with different names fold too (ZLNKWHANDS::GetListOfLWHObjectsWithinBox and ZHM3Actor::GetListOfActorsWithinBox, the two StandActorStill).
  • Constructor and destructor copies. GCC emits C1/C2 and D1/D2 (and D0 deleting) copies; MSVC has one constructor, one destructor and a scalar deleting destructor in the vtable.
  • Static initialisation. GCC has one __static_initialization_and_destruction_0 per unit; MSVC has one initialiser per global (1,397 functions above 0x740000, each registering an _atexit destructor).
  • Exceptions. PC functions with locals that have destructors set up SEH frames (ExceptionList) and have Unwind@ funclets; the PS2 build uses -fno-exceptions.
  • x87. PC float code is x87 with fld1/fldz for 1.0 and 0.0, so those constants never appear as data on PC; the PS2 build materialises floats with lui/mtc1.

Vtable layout:

  • Overload order. MSVC gathers each name's virtual overloads at the first one's slot, in reverse declaration order (6 adjacent groups and 34 moved slots confirmed, 2 contradicted: in ZSysFile UseBig and ZHumanBoid LoadSave, probably overloads introduced by different classes).
  • Overload sets that differ. CSharedCom::SetVal (PS2 0x10f86c, 0x10f898, 0x10f8c4, 0x10f944) and ZPackedOutput::ExchangeData/ZPackedInput::ExchangeData (PS2 0x16971c, 0x1697bc, 0x167734): the PC slots hold array variants (count * 4 with formats 4 and 8) and different integer widths where the PS2 slots at the same position are scalar versions, so the PC set has a different membership or order.
  • The eight learned slot moves (PS2 slot index and method, PC slot = PS2 slot + delta): Init at slot 6 (+5, seen in 5 classes), and in the ZGEOM hierarchy RegisterInstance (80), ClassInit (81), ClassInit2 (82), PostClassInit (83), ClassFrameUpdate (86), ClassCommand (88) (+1 each), and CreateMultiLineText (156, +1). In the ZGEOM vtable the PC has one extra slot before slot 80 (ZROOM::ClassInit, PS2 0x1922b4, is PC slot 82 of ZROOM's vtable, PC 0x4f7050) and lacks one later, so the vtables have the same length but are shifted in between.
  • Vtable sizes: 751 of the 798 classes compared have the same slot count after collapsing GCC's destructor pair; the others differ by 1 to 9 slots (ZSysInterface 67 on PC against 58, ZEngineDataBase 81 against 77, ZLinkBase 197 against 201, ZDllSound 136 against 138, ZRenderDrawBase 42 against 44). 115 PS2 vtables have no RTTI class on PC (ZMalloc, ZBinTree, ZRBTree, ZMemStream, PS2-only AsyncFd_PS2, ZCollisionPS2, ZMCOutputStream); some of those classes exist on PC without RTTI.

For individual functions, see the index of PC differences. Each subsystem page gives the original addresses, evidence for the behavior and the relevant port settings.

Notes for the comparison stage

  • Read relation first: platform pairs are counterparts, not the same code; folded and variants pairs share one PC function.
  • Expect the PC side to have more branches (traps, asserts), SEH prologues, x87 code, and calls that GCC inlined (type tests) or the reverse (constructors, destructors, small accessors that MSVC inlined into callers). Callee lists will not line up one to one.
  • Ghidra's this is param_1 of a __thiscall or __fastcall; virtual calls appear as (**(code **)(*p + 0x34))(). A slot offset is 4 times the PC slot index, which can differ from the PS2 index (destructor pair, overload order, the slot moves above).
  • PC function addresses inside 0x740000 and above, and Unwind@/Catch@ names, are compiler output.
  • The low bands, pruned.tsv and the four probably wrong pairs above are the places to check before trusting a reported difference. A pair that a review settled is in overrides.tsv.

Comparing the pairs

tools/pccompare/compare_pairs.py compares the two sides of every mapped pair and sorts the pairs by how far the PC code departs from the PS2 code, so that a reviewer working on one subsystem can go straight to the real differences. It reads the mapping, the records of both sides, pc-classes.tsv and ps2-linesets.json, and disassembles each mapped function again (capstone for the PC, the ELF words for the PS2) to get branch counts, traps and integer immediates with their instruction context. It takes about six seconds.

# the comparison alone (run_all.py runs it as its last step)
python3 -I tools/pccompare/compare_pairs.py
# every feature of one or more pairs (PC or PS2 address) and the rule that kept or dropped it
python3 -I tools/pccompare/compare_pairs.py --explain 0030c978 005e56b0
# then read the code side by side
python3 -I tools/pccompare/show_pair.py 0030c978

ps2_lines.py writes ps2-linesets.json beside ps2-lines.json; rerun it (or run_all.py) before the comparison if that file is missing.

Outputs

diffs.tsv has one row per mapped pair: pc_addr ps2_addr ps2_name src_file subsystem relation confidence category flags pc_size ps2_size pc_branches ps2_branches evidence minor noise. Read it with csv.QUOTE_NONE; evidence quotes strings, and control characters in literals are written as \n, \r, \xNN.

  • category is the first of the categories below that applies; flags lists all that apply.
  • evidence holds the differences that set a category other than minor. Signs go from the PS2 to the PC: +call ZFoo::Bar is a call only the PC makes, -const 0.5 a constant only the PS2 has, +str "..." a string only the PC references, -int 1999 an integer literal only the PS2 has. Callees are named by their PS2 names; an unmatched PC callee is FUN_<address>.
  • minor holds differences that are probably noise or cannot be resolved: ?+call FUN_x (unmatched PC callee), ?-call Name (unmapped PS2 callee), ~-call Name (a callee one side probably inlined), ~+lib/~-lib (C library calls), ?+int/?-int (an integer literal on one side only), ?+const/?-const (a one-sided float that is not round), ?vcalls n->m (number of virtual calls), ?+glob/?-glob (a known global touched on one side only).
  • noise counts what the normalisation removed in this pair (pc-trap, seh, inlined, moved, alloc, devirtualised, const-folded, const-global, str-merged, ...).
  • pc_branches and ps2_branches are the normalised branch counts described below.

diffs-summary.txt gives the counts by category and by top-level src/ directory, the most frequent evidence items (a high count means a build-wide pattern the rules do not yet remove) and what was learned from the whole mapping.

Categories

Category Meaning
platform relation is platform: a PS2 adapter against its Windows counterpart. The evidence is still computed and listed
stub-on-one-side one side is a stub (no memory access, no call, at most three instructions, or a debug break) and the other is not (it calls something, has two branches or is 40 bytes long). Thunks and constructor/destructor copies are left out
structure the PC size is more than 2.5 times off the expected size and more than 200 bytes away from it (6 times and 400 bytes for constructors and destructors), or the normalised branch counts differ by 12 or more and by a factor of 3
strings a string literal on one side only, after the rules below
calls a real call added or removed: a mapped callee the other side neither calls nor inlined, a call into PC-only code, or (rarely) a large change in virtual calls
constants float literals changed: a literal on each side that the other lacks (a substitution), or a round one-sided literal; integer literals only as substitutions
minor only the weak items listed in minor
same nothing left after normalisation

Normalisation rules

Build noise (the doc's "Differences between the builds"):

  • Traps and asserts. int3 and every conditional jump that lands on or falls into one are not counted as branches. The immediate of a cmp/test directly before such a jump is an assert bound and is not a literal, and so is a float the FPU reads in the compare block of such a jump (fcomp [1e6]; fnstsw ax; test ah, 0x41; jp ok; int3). Calls to _isnan and _finite are PC assert code, and so is any call whose result is only tested (test al, al, cmp eax, n, sub eax, 2) before a trap jump (IsDeadActorInsideBounds, GetItemType in DualWeaponsUnEquip*). On the PS2, break 7 and break 6 after a division and the branch guarding them are not counted.
  • new with file and line. FUN_00446620 (new(size, __FILE__, __LINE__)), 0x446600, every unmatched PC function of at most 48 bytes that only calls one known function (so the debug free wrappers) and the PS2 operator new/operator delete (global and per class), ZEventBuffer::AllocEventRam, FreeEventRam and FreeEventBuffer all compare as one allocation callee. Pushes before a call that also pushes a __FILE__ (absolute z:\code\... paths included) are file, line and size arguments; the size pushed before a call to an allocator is a size. MSVC tests the result of every new before the constructor runs, so one PC branch per allocation call is not counted.
  • Compiled-out debug output. Calls to empty PC functions (ret only: EditPrint, __break) and to empty PS2 functions are dropped, and so are the strings passed to them or passed together with a __FILE__. __FILE__ strings never count as strings.
  • SEH frames. fs:[0] (ExceptionList) is not a global; SEH frames are counted in noise, and the try-level stores mov [ebp - 4], n are not literals.
  • Runtime helpers. Calls into lib:crt (_ftol2, __chkstk, __allshr, the eh vector iterators) are compiler support and are dropped. The frame size moved into eax before __chkstk is not a literal; on the PS2 neither is an offset in a frame larger than 32 KiB (ori $t5, $zero, 0xa0b4; addu $t5, $t5, $fp), an addiu reached through lui 1; addu, nor an address in the 16 KiB scratchpad (0x70000000 to 0x70003fff, the SPR_* buffers). The colour tag of the PC memory tracker (PC 0x446c90, 0xff60a0) is dropped with its call.
  • x87 1.0 and 0.0. 0.0, 1.0, -0.0 and -1.0 are dropped from both sides, as are 2^31, 2^32 and 2^63 (integer/float conversion), and 2.0 is allowed as a folding factor (GCC computes x * 2 as x + x, so 2.0 is often missing on the PS2).
  • Inlining. A PS2 callee missing on the PC is explained when it is a constructor or destructor (MSVC inlines them), when its own callees, strings or floats appear in the PC body, when it is at most 64 bytes long, when it is a PS2 VU0 math helper (_ps2/ files), when a PC callee calls it, or when the PC body is large enough to hold it (0.6 of its PC-scaled size, out of what the PC body exceeds the expected size). A PC callee missing on the PS2 is explained when GCC inlined its PS2 partner: some of the partner's own lines (its home file, within its line cluster) are in the PS2 function's line table (ps2-linesets.json); also when the partner's callees, strings or floats are in the PS2 body, when it is at most 24 bytes long, or when a PS2 callee calls it. A PS2 callee under 160 bytes that is still missing on the PC is reported as ~-call (MSVC inlines that much without leaving a trace). In constructors, destructors and thunks every remaining call difference is weak.
  • Systematic inlining, learned from the whole mapping: a callee that is called on only one side in at least three pairs and in at least half of the pairs that call it there. 175 PC callees are inlined by GCC almost everywhere (vlen, vmmul, the REFTAB iterators) and 288 PS2 callees by MSVC (REFTAB::Add, ISerializerStream::Exchange<T>, CHUNKFILE::FindChild).
  • Type tests. The 35 out-of-line PC type tests and other unmatched helpers that only call GetTypeID at +0x34 are dropped.
  • Devirtualisation. GCC calls a member object's virtual functions directly; when the PC has at least as many virtual calls as expected, a missing direct call to a virtual function is taken to be one of them. In the other direction MSVC calls the virtuals of a local object of known type directly (LINKSORTREFTAB rtPrioritized[4]); a PC call to a function that is virtual on either side counts against a surplus of PS2 virtual calls.
  • PC-only classes. A PC function (not a constructor or destructor) that stores the vtable of an RTTI class without a PS2 vtable gets +vtable <class> (PC-only class) in calls: an inlined new of PC-only code (NetStatusMonitor_Menu_t in ZHM3LevelControl::PostInit2). Template classes are left out, because their mangled arguments do not always tokenise alike. A call to an unmatched PC-only callee of at most 24 bytes without calls is weak: such a callee is usually an identical-code fold that happens to sit in a PC-only class's vtable.
  • Folded and variants. One PC function stands for all its PS2 partners, so a call to any of them compares as the same callee; the counts are in noise. Byte-identical PS2 functions of 12 bytes or more are one callee too: an unmapped twin takes the key of a mapped one.
  • Platform. platform pairs get their own category whatever their evidence says.

Strings:

  • Only strings of three characters or more are compared (ps2_records.py reads no shorter ones). Words that look like strings but are the low bytes of a pointer (Tu0, |'E), the bytes of a float (fff? is 0.9f; those floats are added to the float set instead) or an RTTI name are not strings.
  • The PC side adds literals Ghidra left undefined (push offset "tex"), the PS2 side literals copied out of read-only initialisers (const char *szGroups[] = {...}) and literals loaded through a high half set before a branch (lui in a branch-likely delay slot).
  • A string that is the tail of a string on the other side, or of any string in the PC image (MSVC tail merging, &s[1]), matches; so does one found in a callee (two levels) on the other side, and a PS2 literal that the PC copies inline from the same text (strcpy(p, ".wav")).
  • A string that is a tail of another string of the same function on the same side is dropped. A one-sided string that the other side can reach through the first 64 words of a global, a read-only initialiser or a callee's global is dropped too: tables indexed at run time (szActionNames, g_aHM3ItemTypeNameList, s_asLevelname) and static const char * globals (CRigidBody::NAME), which Ghidra follows on the PC. The PS2 sweep also reads a literal through an lw of a writable global that points at it. A PS2 string of up to four bytes matches a PC immediate with the same bytes (mov dword [p], 0x50495a2e is ".ZIP").
  • PC string candidates inside a function body (push 0x772e64 read as "hd.w") and candidates that start with a float constant and a control byte ("!\rR<rCrowd" is 1/78) are rejected. The .si sources of the script interfaces are __FILE__ strings.

Float constants:

  • Values are rounded to float32 and match within 2e-6 relative, by absolute value and by reciprocal (x / 25 against x * 0.04).
  • Integer immediates that are float bit patterns (mov [ecx+8], 0x42c80000, push 0x3f3504f3, lui; ori; sw, and on the PC also register loads that are not masks) are floats, except a single-bit value such as 0x40000000, which is as often a flag (BASEGEOM_HasDynamicParent) as 2.0. A float on one side matches the same bits used as an integer on the other: a PC cmp [x], 0x4479c000 (999.0), a PS2 lui 0xc3fa compared as an integer (-500.0), and the reverse for integer literals.
  • The PS2 extraction tracks lui high halves and completed addresses with a small data-flow pass over the function's basic blocks: a block starts with the state its predecessors agree on, the delay slot of a branch-likely reaches only the taken path, a call clobbers the caller-saved registers, nothing survives a jr except into the switch-table targets that .rodata points at, and a high half that only some predecessors hold is a candidate for a branch-likely lui until anything else writes the register. It follows lui; addiu into a later lwc1 0(reg), reads constant-pool addresses that both arms of a branch load, and reads float words of read-only initialisers copied with lw, ld or lq (V3 Max = {-1e38f, ...}).
  • A constant explained by a callee on the other side, by a caller one level up (a constant that moved between caller and callee), by the data of a global or static table the other side reads (s_CrouchOffset), or by folding (a product or quotient of a missing literal and another literal or one of the factors 2, 0.5, pi, 2 pi, pi/180 and 180/pi: 0.04 * 1024 = 40.96) is dropped. So is a PS2 float N where the PC adds or compares the fixed-point N * 1024 (TIMETYPE seconds), and a rand() scale: newlib's RAND_MAX is 2^31 - 1 and MSVC's 0x7fff, so a multiple of 1/2^31 on the PS2 and of 1/32767 on the PC are the same range.
  • What remains is constants when both sides have unmatched floats; one-sided floats count only when round (three significant digits or fewer, as programmers write them). One-sided values that are not round are almost always folded or library constants (2 / (b - a), 1/ln 2 for log2, which MSVC computes with fyl2x, numeric_limits<float>::max()) and go to minor.

Integer literals (the heuristic):

  • Every immediate gets a context: on the PC value (stored or pushed), regval (loaded into a register), cmp, mask (test, and, or, xor), arith (add, sub), size (mov ecx, N within four instructions of rep movs/stos, allocation sizes) and assert; ret N, shifts, imul element sizes and stack adjustments are ignored. On the PS2 value (li, ori from $zero, lui+ori/addiu constants that are no address, lui values that are stored), cmp (slti/sltiu), mask (andi, xori, ori, and a 32-bit constant used by and/or/xor/nor), arith (addiu on a register) and offset (a constant added to a pointer, which is how GCC reaches fields past 32 KiB, or multiplied with an index).
  • Only value, cmp and regval literals are compared, and only distinctive ones: outside -64..64, not a power of two, a mask 2^n-1 or their complements, not a multiple of 4 below 0x1000 unless it is also a multiple of 10 (field offsets and struct sizes, which differ between the builds, against round decimal numbers), and not a multiplier for division by a constant (0x66666667, 0xcccccccd; all of them for divisors up to 4096).
  • A literal matches any immediate of the other side, of any context, its negation, the value one higher or lower (GCC tests x <= 1000 as slti 1001), the span between two immediates of the other side ((unsigned)(x - 4001) < 1999 against x > 4000 && x < 6000), 2, 4, 8, 12 or 16 times an immediate of the other side (a bound in bytes against one in elements), or an immediate of a callee. What remains is constants only when both sides have unmatched literals; a one-sided literal goes to minor.

Globals: 148 PC/PS2 global pairs are learned from co-occurrence (at least three pairs and 60% of the pairs touching either). PS2 addresses that only hold float constants are not globals. A known global touched on one side only is a weak item; globals never set a category.

Virtual calls: slot numbers differ between the builds (the D1/D0 destructor pair, MSVC's overload order, the slot moves), so only their number is compared, against a band widened by the virtual calls of inlined callees and of direct calls to virtual functions; a difference is a weak item.

Size and branches: the expected PC size is 0.77 of the PS2 size, with the sizes of the callees each side inlined added or subtracted (once per call site, so a helper inlined 13 times counts 13 times), and a third variant that adds the unmatched callees of each side; the ratio nearer to 1 is used, so a wrong inlining guess cannot flag a pair. The PC size is that of the extended body when Ghidra cut it short. Branches are PC conditional jumps without trap jumps, the new checks (one per call to any allocator, ZPoolAllocator::Alloc included) and the jp of an x87 compare that another conditional jump follows, against PS2 conditional branches (not b) plus movz/movn and min.s/max.s (GCC's branchless forms) minus division checks. A PS2 body with no code at all against a short PC body that only destroys its by-value argument (MSVC destroys by-value class arguments in the callee, ZListDataInterface::SetWindow) is not a stub difference.

PC bodies: the disassembly runs from the entry to the end of Ghidra's range but never past the next function entry (a function's own Catch@ funclets, which MSVC places inside its span, do not end it). A body that Ghidra cut short is extended to the next entry, up to its alignment padding or a switch table: it ends in a call (a printf that Ghidra took for non-returning), in a lone int3 that the code falls into, or the Ghidra C says "Could not recover jumptable". Every direct call the disassembly finds that Ghidra's call list lacks is added to the callees.

Precision checks

The rules were tuned in five rounds of hand checks, each a random sample of diffs.tsv read with show_pair.py against the src/ code (build/pc-compare/scratch/sample.py SEED cat:N ...; verdicts in build/pc-compare/review/compare-verdicts.tsv). The first two rounds (about 50 pairs) found the noise sources the rules above now remove: floats the PS2 sweep missed (loads through addiu, constant pools shared by branches, initialiser copies), test/cmp masks read as floats (0x40000000 is 2.0), the rep movs count taken for a literal, strings of pointer and float bytes, short PC literals Ghidra left undefined, tail-merged strings, floats read from static tables, constant folding, ±1 bounds, allocation sizes, the new null checks, GCC's branchless code, isnan asserts, and the many mid-sized callees MSVC inlines. The last three rounds were drawn after those fixes. Verdicts: R a real gameplay or engine difference, D a real difference that is debug output, menu layout or platform behaviour, M the pair is wrong (the code differs because it is another function), N noise the rules did not remove, U unsure.

Category (final rules) Checked R D M N U Genuine (R+D) Code really differs (R+D+M)
calls 15 7 1 4 2 1 53% 80%
strings 8 1 3 1 2 1 50% 62%
constants 12 1 5 0 2 4 50% (75% of those decided) 50%
structure 3 2 0 0 0 1 67% 67%
stub-on-one-side 12 (all) 12 100% 100%

same and minor: 12 same and 15 minor pairs were read in full; none hides a real difference. The weak items are where a hidden difference would sit: a removed call to a PS2 callee under 160 bytes, an unmatched callee, a one-sided integer or a one-sided non-round float.

Reading these numbers:

  • Most noise left in calls is MSVC inlining a callee into an assert (DualWeaponsUnEquipLeft calls GetItemType only to trap), and an overload the mapping does not know. Wrong pairs are a quarter of the flagged pairs, almost all in the low and medium bands; a call difference on a low pair is as likely to point at a wrong pair as at a changed function, which is worth knowing too (pruned.tsv lists the pairs the mapping already doubted).
  • Many constants differences are layout: the PC menus have their own pixel positions. The unsure cases are one-sided round literals where the PC computes the value some other way.
  • Real differences found by the rounds are in the "Single functions" list above.

Against the review verdicts

The four subsystem reviews (PC Differences) read every flagged pair of their subsystems and the 15 largest minor pairs of each, 391 pairs in all, and gave each a verdict: 150 real, 194 noise, 47 wrong pairs. tools/pccompare/score_verdicts.py uses them as a labelled test set: a real pair should stay flagged, a noise pair should leave the flagged categories (constants, strings, calls, structure, stub-on-one-side), and a wrong pair should be gone from the mapping. --baseline build/pc-compare/baseline scores the run the reviews read as well, and --list prints every pair whose outcome is wrong.

Run the reviews read This run
Real pairs still flagged 145 of 150 142 of 150
Noise pairs out of the flagged categories 55 of 194 156 of 194
Wrong pairs gone from the mapping 0 of 47 47 of 47
Reviewed pairs flagged 329 180
Precision (real among flagged) 44.1% 78.9%
Recall (real still flagged) 96.7% 94.7%

By review page, precision went from 73.3% to 90.4% (GUI, Camera and Input), 28.7% to 58.5% (Game and Characters), 32.7% to 74.4% (Engine Core) and 40.7% to 87.0% (Platform and Audio). The scores are measured on the pairs the rules were written from, so they overstate how well the rules do on pairs nobody read; the eight real pairs that are no longer flagged and the 38 noise pairs that still are are discussed in PC Differences.

Fixes from the reviews

Each review page ends with the noise patterns it found and a proposed fix. Implemented, with the pages that name the pattern:

Fix Pages
PS2 register state by data flow: stale luihist high halves, state kept across branch targets, j and jr, branch-likely delay slots, calls all four
lib:crt for the MSVC runtime helpers and no library category for three-byte functions; CRT calls dropped Engine Core, Platform and Audio
PC bodies capped at the next entry, cut bodies extended, missing direct calls added (disasm_pc running past the function, lone int3, printf, unrecovered switch tables) all four
x87 assert bounds; calls that only decide a trap Game and Characters, Engine Core
__chkstk frame sizes, PS2 frames past 32 KiB, lui 1; addu offsets, PS2 scratchpad addresses GUI, Game and Characters, Engine Core, Platform and Audio
Float bit patterns compared or stored as integers; single-bit pushes are not floats all four
Strings through pointer tables and static const char * globals GUI, Game and Characters, Engine Core, Platform and Audio
Byte-identical PS2 functions as one callee (identical-code folding) Game and Characters, Engine Core
fcomp; fnstsw; jp; jne counted as one branch Game and Characters
TIMETYPE fixed point; SEH try-level stores; RAND_MAX scaling Game and Characters, Engine Core
.si __FILE__ strings; four-byte literals stored as immediates; the memory-tracker colour tag Platform and Audio
PC strings inside code; a float that runs into a string; tails of a string on the same side GUI, Game and Characters, Engine Core
Bounds in bytes against bounds in elements; folding factors 0.5, pi, 2 pi and degrees GUI, Engine Core
A constant that moved into a caller Platform and Audio
Devirtualisation in both directions and with equal counts Engine Core, Platform and Audio
new checks for every allocator; inlined callees counted once per call site; unmatched callees in the size and branch bands Engine Core, Platform and Audio
Tiny PC-only callees are weak; a body that only destroys its by-value argument is not a stub GUI, Platform and Audio
PC-only RTTI vtables stored by a shared function (new, found while checking PostInit2) Game and Characters

Tried and taken out again: making a calls item weak when its callee pair is a low call-graph pair (Engine Core, "A calls flag that rests on one shifted family pair"). It hid 16 real removed or added calls, among them the missing ZGameData::InsertIconsInText of four GUI SetText functions, to clear 5 noise pairs; the scheduler family it was aimed at is now fixed in overrides.tsv instead.

Not implemented, and why:

  • Dead PS2 locals and dead debug-draw stores (V3 s0 = {10, 10, 10}, vset(s, 100, 0, 100), the -5 of SetMousePos): telling a stack slot that is never loaded needs a def-use pass over the PS2 stack frame. They are about a dozen of the 38 noise pairs still flagged.
  • Constants of inlined callees whose PC partner is unmatched (GetAnimTime in CMapIconDraw::CalcAnimValues, SetDistanceFromVolume, CalcStatForRating): there are no callee features to fold against. "Accept a fold only when the factor is used next to the constant" needs data flow through the x87 stack.
  • Small helpers that MSVC keeps out of line (v2len, minTransformQuat, a 2x2 multiply), STL and zstring inlining, and the CHUNKFILE accessors of ZAnimTemplatesNames::Init: these need a list of inline helpers from the PS2 line tables, or are mapping problems.
  • PC constant initialisers stored as immediates against a PS2 v3copy of a global (ZStatisticsTest::ZoomPanClamp), an inlined setter whose only content is an integer mask (ZRunMatPosAnim::SetFrameEnd), __LINE__ pushes in long factories, memset sizes turned into rep stos, and the PS2 "" that points at the NUL of another literal: each was one pair, and the rule would need a new kind of feature.
  • Applying MSVC's overload reordering to every vtable pair, and refusing pairs whose PC address neighbours belong to a PC-only file: mapping changes with a wide reach; the cases the reviews found are force or forbid rows.

Summary

From the rerun of 24 November 2026 (11,915 pairs; the run the reviews read had 10,788):

Category Pairs Flag set on Before the fixes
same 8,363 7,262
minor 3,156 3,421 3,029
constants 104 126 111
calls 47 72 73
strings 65 79 110
structure 15 17 23
stub-on-one-side 8 16 12
platform 157 157 168

By mapping confidence, high pairs give 43 constants, 21 calls and 43 strings pairs; medium 36, 11 and 15; low 25, 15 and 7. The 715 script-interface table pairs are 442 same, 268 minor and 5 flagged.

By top-level src/ directory:

Subsystem same minor constants calls strings structure stub-on-one-side platform total
hitman3/characters 1,396 553 22 6 3 3 1,983
engine/geomsextend 926 267 5 2 1 1,201
engine/geomsbase 803 147 6 1 2 959
hitman3/background 654 291 7 1 2 955
hitman3/gui 529 255 23 6 19 1 1 7 841
engine/zwindows 603 179 4 5 9 2 802
hitman3/levelcontrol 414 176 2 3 9 604
engine/eventsbase 395 187 4 3 2 591
engine/zstdlib 334 167 5 2 1 2 27 538
hitman3/interfaces 318 165 1 2 1 487
engine/drawing 231 75 5 1 4 1 3 53 373
engine/fysix 251 66 7 1 2 327
engine/system 189 75 2 1 1 37 305
engine/enginedata 212 67 8 1 5 1 294
hitman3/camera 208 53 3 5 3 272
engine/ScriptInterfaces 128 107 1 236
engine/shared 180 43 1 224
engine/audio 137 70 1 2 9 219
audiolib/audiocontrollertypes 79 48 1 128
engine/serializerlib 70 48 4 122
engine/collision 61 22 1 12 96
engine/pathfinder4 48 24 2 1 75
engine/animation 39 19 58
common/basic 43 8 51
hitman3/hitman3 30 15 1 3 49
engine/boids 32 6 1 39
engine/rendervideo 12 10 1 4 27
engine/camera 19 2 2 1 24
audiolib/audiotypes 11 3 14
common/containers 7 1 8
common/zstl 5 1 6
audiolib/common 4 1 5
engine 1 1
engine/startup 1 1
all 8,363 3,156 104 47 65 15 8 157 11,915

hitman3/gui has the most string and constant differences (PC menus, key names, layout); engine/drawing, engine/system and engine/zstdlib carry most platform pairs.

The most frequent evidence items, in diffs-summary.txt, are spread thin (none more than 9 times); the top ones are round tuning values (-const 0.5, -const 10, -const 50, many of them rumble thresholds and dead PS2 debug stores) and real build-wide differences such as -call ZGameData::InsertIconsInText in the GUI SetText functions. +const 2, the top item of the previous run (8 pairs), is down to 3.

Not covered

  • Data layout differences were not measured: there is no PC type information, so only the reviewers' qualitative notes are recorded. The comparison tool reads exports and strings from the PC script modules. Scene scripts with PC data describes the separate comparison of their code.
  • The mapping precision figures come from 361 hand-checked pairs; small bands (string low, line low) have five or six samples each. The 391 review verdicts check flagged pairs, not the mapping as a whole.
  • The address ranges for Quazal, libjpeg and zlib come from the markers listed above, not from a linker map.
  • The pair comparison sees calls, literals, globals and counts, not data flow: a changed condition, field or formula with the same literals and callees comes out same (ZHitman3::CanUnpackSniper's water test is one). Its precision figures rest on the 391 review verdicts, which the rules were tuned on, and on 50 earlier checked pairs; the minor weak items were not reviewed one by one.

The historical review sample, verdict sheets and intermediate files under build/pc-recon/ were local research inputs. The tracked tools reproduce the export and mapping from the game files. The published manual precision figures refer to that original sample.