Skip to content

Data that exists only in the original ELF

The matching build never links: it resolves relocations by symbol name against extracted/HITMAN3.ELF, so C++ could reference globals, static members, tables and vtables that no source file defined. A decompilation should define its data, so this file lists every one of them, where the debug record puts each one, and its state. The list was made on the SDL3 port branch, which links natively and needed each definition; the definitions were brought to main on 14 November 2026.

How the list is made

python3 tools/elf_only_data.py reads the objects of the last python3 tools/build_sources.py, collects every undefined symbol that a game unit (src/engine, src/hitman3, src/common, src/audiolib) references outside its assembly fallbacks, removes every symbol any object defines, and keeps the ones the reference ELF defines in .data, .sdata, .rodata, .bss or .sbss. --drafts also compiles every unit with NON_MATCHING and adds what the drafts reference. The owning unit is the file whose .mdebug stabs define the symbol (name:G or name:S).

Summary

Group Symbols Bytes
Referenced from compiled C++ on the PS2 build (the 13 November survey) 978 323042
... defined 976 323042
... not applicable 2 0
Referenced only from NON_MATCHING drafts on 13 November, all defined 27 301

The matching build places named data at its reference address and compares its contents with the disc. For the current counts, read the data contents line from make match and the details in build/source-tree/data-mismatches.json.

What is left

_args and _fbss, which are crt0.cpp and linker-script symbols. python3 tools/elf_only_data.py prints nothing else.

The two entries that were open on the port branch are closed here:

  • ZScriptC_ZMessages (5,144 bytes, zscriptc.cpp), the generated trie of script message names: 643 nodes, each a key string of candidate characters (279 distinct strings, merged duplicates) and its own 6-byte-record index array into Uniques. It is defined after Uniques with index arrays named Index0 to Index642, the original's own local symbols, so every array and the table are placed by name and the key strings by the pointers in the table.
  • 8 vtables: ZMalloc, ZScheduledEvent, ZHM3HintDetail, ZHM3ObjectivesBrief and ZHFlow::ZStateWalk, ZStatePanic, ZStateParade, ZStateBeerStand. Each key function (the first non-inline virtual) was a NON_MATCHING draft on 13 November. They are matched now, so GCC emits the vtables.

The property graph

python3 tools/property_records.py --write reads every X::Info record (402; 330 have a property list), cProperties::NamespaceItem_N node (2,680 properties, 86 enum descriptors, 539 enum entries) and VirtualTable_* table (139) from extracted/HITMAN3.ELF and writes src/hitman3/hitman3/cproperties.h (the cProperties struct with one static member per node) and the definitions at the end of src/hitman3/hitman3/hm3properties.cpp, in the original data order. A data or enum node's offset is resolved to a field of its owner class with analysis/recovered-types.h, relative to the class's ZSerializableBase subobject (the cameras keep it at 0x10, behind ZHM3CameraBaseFunc). Getters and setters come from their symbols; the four virtual setters (ZTreeGroup, ZHFlow, ZHFlowLnkObj) from their vtable slots. Initializers name real members, static_cast<T ZSerializableBase::*>(&ZClass::m_field) or the method pointer equivalent. Enum entries name their enumerators in the scope the debug record's TypeCompiler<Scope::Enum> instantiations give, checked by a probe compile. Names are null, as in the release ELF; m_Filter is written with FILTER_LevelFile, FILTER_SavedGame and FILTER_SimpleRepack, the 1 << ISerializerStream::CONTENT_* bits LoadSerializable tests. --check compiles the unit and maps errors to nodes.

Besides the 328 records the survey found, this defines ZVideoPlayer::Info with its list (moved from video.cpp; the original placed it here) and CCutSequenceEvent::Info, which no compiled code referenced. Every node and table places at its original address with matching content, which verifies each resolved offset, method pointer and link.

Header work the nodes needed:

  • friend struct cProperties; in every class whose private fields or accessors a node names.
  • Field names and types from the debug record where the tree had invented ones (CCutSequenceShowHide, CCutsequenceShowSubtitle, ZCutPushSceneOnKeyStart, ZSelectNotify, ZSTDOBJPRIO, ZHM3ItemTemplateWeapon, ZHitman3), padding split in ZOSD, signedness fixed in ZParticleEmitter, ZHitman3::m_CurrentStatusExtended, ZCutSequencePlayer::m_rSoundIndex and SMonSeerInfo::flags, ZBitfield<ESecurityZone> fields in ZZoneControl, ZSecurityZone and ZHM3HmAs.
  • Anonymous unions removed from CRigidBody and ZHM3Actor: GCC 3.2 gives an anonymous union member a pointer-to-member of the union, so no node could name it.
  • Nested enums where TypeCompiler shows them nested (ZMatPosAnim/ZVertAnim/ZParamAnim::EPhase, ZCloth::ActorCollisionType/WindType, the gate lights' EType/EFilterType, the post filter events' EPriority, ZInterestPoint::eInterestLevel), with the enumerator names the ELF's enum strings record; ZBoneParticle::Particle nested; the cover finder's private types moved into hm3coverlist.cpp.
  • ZDataProperty is an aggregate, each property's table pointer has its tVirtualTable type, and ZSDOwner, ZAnimVariationHandle and TEnumID properties store the recorded types.

Notes on the definitions

  • m_OldClassInfo is ZGEOMCLASSINFO &, bound to the class's producer, as the original declares it; GetOldClassInfo returns its address and compiles to the same lui/jr/lw.
  • Values come from the ELF bytes, not from analysis/uncc, which truncates numbers above 16 bits (ZRatingSystem::s_aRatingMoney reads 18928 there for 150000).
  • const float statics follow their last use, because GCC 3.2 folds a constant whose initializer it has already seen; the original's .rodata order agrees.
  • A definition that GCC emits as public data goes after the global the unit's _GLOBAL__I_ function is named after, so that name does not change.
  • File statics are static again where the stabs say :S; their extern declarations in headers are gone.
  • Action-map strings and the .bss statics in zscriptc.cpp sit where the original emitted them, so the original layout and string addresses are reproduced.
  • The matcher in tools/matching/source_tree.py gained three placement rules that the new definitions needed: relocations against named symbols with one reference address no longer order data sections, an anonymous object too small to place by content goes next to an adjacent named object, and a section that points into itself falls back to named placement when every local pointer sits in a named object.