Skip to content

PC Differences: Platform and Audio

The counts and mapping states on this page are from the run of 24 November 2026, before the rerun with tools/pccompare/overrides.tsv and the comparison fixes; see PC Differences.

This page reviews the PC/PS2 pairs of PC Comparison in engine/drawing, engine/zstdlib, engine/system, engine/audio, audiolib/audiocontrollertypes, engine/serializerlib, engine/rendervideo and engine/ScriptInterfaces. It covers every pair of the run of 24 November 2026 whose category is constants, strings, calls, structure or stub-on-one-side (54 pairs), and the 15 largest minor pairs by PS2 size (69 in all). Each pair was read in full with show_pair.py against the src/ code, with callers and callees where needed. Of the 54 flagged pairs, 22 are real differences, 20 are noise and 12 are wrong pairs. Of the 15 minor pairs, 1 is a real difference and 14 are noise. No pair was left undecided. Seven of the real differences are only debug output or a PS2 stub. The verdicts are in build/pc-compare/review/platform-and-audio-verdicts.tsv (one row per pair, plus one wrong pair found through the script-interface table); the scratch work is in build/pc-compare/review/platform-and-audio-scratch/.

The last section settles where the PC keeps the script-interface functions: in the executable, behind a 716-entry table that Ghidra never followed.

Behaviour differences

engine/drawing: ZBoneModifyBase

  • ZBoneModifyBase::UpdateFirstPersonBones (PS2 0x13bbb8), PC 0x46e0b0, src/engine/drawing/zbonemodifybase.cpp. Both switch the player's spine bones between the first-person and the normal pose. The PS2 function ends with vmmul(disp, m) and never uses the result. The PC goes on: it takes the player's draw entry, locks the bone matrices through g_pRenderDll (vtable +0xb0 and +0xc4), rebuilds every bone matrix offset by the spine displacement and calls ZOldDrawBase::UpdateMovingMatrices. The PC also asserts that setFirstPerson is 0 or 1. The dead vmmul suggests that the PS2 build dropped the upload code.
    • Checked for the port on 25 November 2026: the upload is not needed there. The function's only caller is ZBoneModifyBase::AnimDone, which runs in the player's bone update when the camera is first person (e1stPersonCamera, the sniper scope or the binoculars), between the copy to Bones2() and the copy of the finished bones to the draw entry's Bones() (ZOldDrawPS2::UpdateBoneModifiersIKH2 0x29c430 and UpdateBoneModifiersIK 0x29ca98, both from UpdateBoneModifiers in ZOldDrawBase::Update; the port's ZOldDrawSDL::FinishBones). The deform matrices are built from Bones() later in the same frame (CreateDeformBones in UpdateDynamic, which runs after UpdateBoneModifiers). The spine change is therefore in the matrices of the frame it is made in, on the PS2 and in the port; the PC's renderer had already uploaded the bones by then and so uploads them again. Captured with OPENBLOOD_SCENEFX_TEST=firstperson (M01 from the disc, 47 holding the Enfield): every frame from four before to eight after each switch, at the switch one large change of the picture and then only the small frame-to-frame changes, with no frame in between. In this first-person view no part of 47 is drawn, so the artifact the PC guards against could not show anyway. No setting.

engine/drawing: ZOldDrawBase and static shadows

  • ZOldDrawBase::UpdateMovingMatrices (PS2 0x27678c), PC 0x474390, src/engine/drawing/old/zolddrawbase.cpp. For each geom attached to a bone (weapons, props) the PS2 only moves the draw entry's matrix. The PC also copies the owner's lighting into the attached draw entry, in four places: the static-shadow multiplier m_MulColor (read as 2.0 when it is 0xff and as m_MulColor / 254 otherwise, stored back as x * 254) and up to four projected static shadows (PC 0x473a40 copies the count at +0x14, the four projection pointers at +0x04 and their four fade values at +0x18, and asserts count <= 4; these are the projections ComputeStaticShadowMultiplier collects, not light references). Where the attached geom's class matches (the mask at 0x99ae88), it also points the attached entry's light block (+0xa0, PC 0x476e30) at the owner's (+0xa0, or +0x9c + 0x20, PC 0x476e40, which is the PS2's DirectLights(), m_pBoneData + 0x20). Evidence: fmul [0x761954] (1/254) and fmul [0x761958] (254) before each ftol that writes byte +0x2f.
    • The PS2 gets the same result another way: the view sets an attached geom's owner (ZGeomDrawEntry::SetOwner, zoldviewbase.cpp), and its draw takes the owner's DirectLights() (ZOldDrawPS2::AddPrimToDMAChain; the port's bone and owned-strip draws in zoldviewbonessdl.cpp), which already include the owner's multiplier. The PC copies the values because its renderer keeps them per entry. Only the projections have no PS2 counterpart. The PC draws them on an attached geom with its owner's entry anyway (PC 0x4b4110 adds the entry's attached geoms to each projection's draw); the port's pc_lighting does the same: an attached geom's rigid strips and PC-material meshes are drawn with the owner's projections (staticprojectionsdl.cpp; pc-data.md: Static shadows on characters).
  • ComputeStaticShadowMultiplier (PS2 0x13fb64), PC 0x473310, src/engine/drawing/renderstaticshadowsampling.cpp. Both sample the room's static shadow data at the character's root with GetStaticShadowSampleIntensity. On PS2, CalcBoneLightSources scales the environment light by this sample every frame. Read from the disassembly on 25 November 2026, the PC:
    • passes the draw entry to its sampler (PC 0x473100), which collects projected shadows into it. Its block reader (0x472b10) handles flags as the PS2's for flags 1, 2, 4 and 8 (flags 2 and 4 together give the alpha byte itself, which the alpha factor clamps to 1; the PS2 leaves that value unset), except that a block with 8 and 0x10 is a projected shadow: where its grid (or, with flag 4, its whole box) is in shadow and no earlier block gave any shadow, the reader returns the 0x54-byte projection record stored after the grid (matrix, texture word, light position, colour), and 0x473030 adds it to the entry (up to four, never removed, with a fade value that 0x472a10 moves towards 1 or 0 by twice the frame time). While the entry holds a projection the multiplier is 1; the count also raises lMaxProjections, the number of projection passes the caller (PC 0x4b42d0) then draws (PC 0x4b4110, the TextureProjection technique into the shadow buffer). Two slips: the reader's test whether to read the grid (0x472cf6) takes a word relative to the block's own entry instead of its data, and 0x472a10 moves a fade that equals its target, so a faded-out projection alternates between 0 and twice the frame time;
    • eases: new = old + (target - old) × 0.15 (0.15 at 0x76196c), unless the old byte is 0xff ("not computed yet"), in which case it stores the target; a result below 2.3e-29 becomes 0;
    • stores ftol(x × 254) (truncated), so 1.0 is 254 where the PS2 stores x × 255. The PC data has projected blocks (flags 0x19 and 0x1d, and 0x39 and 0x3d for the additive kind) in every mission but M02 and M08; the disc has none (pc-data.md: Static shadows on characters). The port's pc_lighting eases, runs the PC's sampler and draws the projections on the characters as the PC does (except that a faded-out projection stays at 0); the record, the passes and the measurements are in pc-data.md: Static shadows on characters and Enhancements: PC lighting.

engine/drawing: ZRender and ZRenderBaseDll

  • ZRender::AddCamera (PS2 0x135310), PC 0x469760, src/engine/drawing/renderbase.cpp. The PS2 ignores every camera whose geom is named mousecamera. The PC has no such test, and the string mousecamera does not occur in the PC executable. The rest is the same: set the list priority, add sorted, InitCamera, and AddCameraToView once the draw base is initialised.
  • ZRenderBaseDll::ParseOptions (PS2 0x13604c), PC 0x468e60, same file. Same option list, with three differences:
    • Anisotropy: the PS2 turns 1 and every value from 3 up into 2, so only 0 and 2 remain. The PC keeps 0 to 16 and resets values above 16 to 0.
    • EnableVSync: the PS2 sets m_bDisableVSync = true whenever the option is present. The PC sets it to atoi(value) == 0.
    • The PC adds BlurShadows and SelfShadows. Each sets a global disable flag (0x90c85c, 0x90c854) to atoi(value) == 0.
  • ZRender::LockDrawBaseGeomsBuffer (PS2 0x134d6c), PC 0x4684c0, same file. Debug output only: after the lock the PC calls printf("ZRenderPS2::LockDrawBaseGeomsBuffer size %dKb\n", size / 1024). The string says ZRenderPS2 on the PC too. The lock is the same (the largest free block minus 0x32000).
  • ZRenderBaseDll::CompactPrimBuffer (PS2 0x1365e4), PC 0x4699a0, same file (a minor row). Platform code. Both rebuild the handle table, free the queued prims and pack the buffer, with the same limit of 0xa000 handles (the PS2 clears a 163,840-byte table, the PC asserts lNumHandles < 0xa000). What is freed differs. The PS2 walks its strip, DOT3 and bone-strip prims and frees each data block. The PC handles prim type 7 (its D3D mesh), drops the texture reference counts (table at 0x8c29f0), releases each sub-mesh object, accepts type 12 and breaks on every other type.
  • ZPrimControlBase::AddPrimDataUnique (PS2 0x139c80), PC 0x46d740. Already listed: the PC prints the out-of-handles and buffer-too-small errors. Ghidra marks the printf import as non-returning, so the PC C stops at the message; the disassembly goes on.

engine/rendervideo: ZVideoPlayer

  • ZVideoPlayer::BeginPlaying (PS2 0x240168), PC 0x59b420, src/engine/rendervideo/video.cpp. The skip binding differs. PS2: Video={DropVideo=|hold(gc,cross) hold(gc,start);};. PC: Video={DropVideo=hold(kb,esc);DropVideo2=hold(kb,return);};. A video is skipped with Cross or Start on the PS2 and with Esc or Return on the PC. The player object is also platform code: the PS2 creates ZPS2Video, the PC a 0x1d0-byte ZBaseVideo subclass with vtable 0x7847ac (new at video.cpp line 544). The rest (disabling the active cameras, pausing the engine, the file name, the subtitle folder, the display modes) is the same.

engine/zstdlib: quaternion interpolation

  • qpul (PS2 0x1214a0), PC 0x436ac0, src/engine/zstdlib/zmath.cpp. Both use 0.9 as the threshold on the cosine between the two quaternions. Below it the PS2 does a true slerp with polynomial sine and arccosine (coefficients 1/6, 1/120, ...; the VU0 assembly and the portable #else branch agree). The PC computes no angle. It bisects the arc up to three times: the midpoint is (a + b) * sqrt(0.5) / sqrt(1 + cos), the half that holds t is kept and t is doubled (minus 0.5) at each step. Then it blends linearly and calls qnorm. The PC also traps when an input or the result has a length of 0.95 or less. PC constants: 0.95 at 0x7560e8, 0.9 at 0x7560e4, 0.5 (the double under sqrt) at 0x7560f0. The results agree to within the error of three bisection steps. Which version is the later one cannot be told from the code.

engine/zstdlib: zip file system

  • FsZip_t::findFile (PS2 0x114c70), PC 0x42c0b0, and FsZip_t::GetDirectory (PS2 0x115294), PC 0x42c3d0, src/engine/zstdlib/iozip.cpp. The PS2 allocates its file-name buffers with new char[0x10001] (findfilename, buffer and thrash in findFile, one buffer in GetDirectory) and deletes them before it returns. The PC keeps them on the stack as 65,540-byte arrays behind __chkstk. The lookup and the directory walk are the same. This is the -int 65537; +int 65540 of the comparison. No gameplay effect: the PS2 thread stacks cannot hold 64 KiB arrays.

engine/zstdlib: reference tables

  • REFTAB::NewBlock (PS2 0x11750c), PC 0x42fcf0, and REFTAB32::NewBlock (PS2 0x117e2c), PC 0x42fdc0, src/engine/zstdlib/reftab.cpp. Debug only. Before it allocates a block, the PC calls slot 0x34 of the global memory manager at 0x81f8c8 (when there is one) with the tag "REFTAB" and this. The same object brackets other allocations (slot 0x28 with 1 and 0 around a new in filesystem.cpp), so this is allocation tracking for the PC's memory statistics. The rest is the same, including the memset to 0x22 and the m_FirstTab shortcut in REFTAB32.

engine/audio: ZSoundObjectManager

  • ZSoundObjectManager::Initialize (PS2 0x163c34), PC 0x4cc2f0, and ZSoundObjectManager::Destroy (PS2 0x163d24), PC 0x4cbe70, src/engine/audio/soundengine/soundobjectmanager.cpp. The PS2 allocates the 511 SoundObject::ZControllers objects with the global new and frees them with ::operator delete. The PC takes them from a ZPoolAllocator (the pool at 0x910ca0: mov ecx, 0x910ca0; call ZPoolAllocator::Alloc with size 0x18) and returns them with ZPoolAllocator::Free. Both allocate the object array as 512 * 0x130 bytes (0x26000).

engine/system: ZSysInterface

  • ZSysInterface::LoadSave (PS2 0x12c0d4), PC 0x443d10, src/engine/system/sysinterface.cpp. The PC serialises three more fields before the PS2 list: the raw floats m_fRealTimeOffset (offset 0x18), m_fRealTime_ (0x10) and m_fActualTime_ (0x20). The rest (m_fRealTime, m_fRealTimeDelta, ..., m_lRandSeed, m_bSRandDone) follows in the same order. PC save games therefore carry a float time base that the PS2 build does not have, and the two save formats differ here.
  • LoadIniFile, called from ZSysInterface::ReadCmdLine (PS2 0x12d5f0, PC 0x443110): the PS2 version (0x2b8450, src/engine/startup/_ps2/nukeandrestart.cpp) reads into the fixed 4 KiB buffer g_IniFile and debug-breaks when the file is empty or 0x1000 bytes or larger. The PC version (0x4529e0, engine/system/_wintel/sysinterfacewintel.cpp) allocates size + 1 bytes with the debug new, adds the terminating NUL, and frees the buffer and returns 0 when the read comes up short. Both cache the file after the first load. The ReadCmdLine pair itself is noise.

engine/system: operator new

  • operator new(size_t, EAllocType) (PS2 0x12dc98), PC 0x446510, src/engine/system/allocators.cpp. When an allocation fails and the allocator may not return null, the PS2 loops forever and cycles the GS background colour (GS_BGCOLOR_ADDRESS), a visual crash signal. The PC prints "Out of memory (allocating %d bytes, free mem: %d)\n" with the free memory of the default allocator (virtual call at +0x18) and then traps. A zero size returns null on the PS2; the PC allocates one byte, as standard C++ requires.

PS2 stubs and PC-only code paths

  • ZRenderDrawBase::Alloc (PS2 0x137930, PC 0x46a4f0), AllocSprites (0x137948, PC 0x46a510) and Free (0x13793c, PC 0x46a530), src/engine/drawing/renderdrawbase.cpp. Already listed, confirmed: the PS2 bodies are ZDebugBreak(). The PC base class allocates with the debug new (renderdrawbase.cpp lines 37 and 45) and frees with operator delete. On the PS2 the derived draw class does this work.
  • ZRender::GetRenderName (PS2 0x43b644) returns a null pointer, and the PS2 has no override. The PC's ZRenderWintelD3D overrides it (PC 0x488220) and returns "Direct3D9".
  • FsZip_t::GetFileTime (PS2 0x115288), PC 0x42c390, src/engine/zstdlib/iozip.cpp. A debug break and return false on the PS2. The PC calls FsZip_t::findFile for the entry and converts its DOS modification date and time with the Win32 DosDateTimeToFileTime. It returns false when the file is not in the archive.
  • ZDllBase::GetAddress (PS2 0x110e94), PC 0x4282a0, src/engine/zstdlib/dllbase.cpp. Returns 0 on the PS2. The PC returns GetProcAddress(m_hModule, pProcName) when a module is loaded (already listed).
  • CConfiguration::WriteIniSettings(const char *) (PS2 0x12f68c), src/engine/system/cconfiguration.cpp. A return false stub on the PS2. Its PC partner is 0x447400 (930 bytes), not 0x4473e0 (see the wrong pairs). It returns at once when the flag at g_pSysInterface + 0x7a is set. Otherwise it reads the existing ini file, writes each line back with its current value ("%s=%s"), drops the options of the remove list (_memicmp against the list at +0xa4) and appends the options it did not find. The PS2 WriteIniSettings() (0x12f3b8, 724 bytes) prunes the removed options itself and then calls the stub. Its PC counterpart 0x4473e0 (32 bytes) only calls slot 12 with the stored file name, so on the PC the pruning sits in the writer.
  • ZSysFile::PrepareSaveGame (PS2 0x12a140) is a stub on both sides: its PC partner 0x442100 is return 0. The earlier mapping paired it with a different PC function.
  • PC-only renderer code that the mapping had paired with PS2 functions (see the wrong pairs): engine/drawing/zviewspace.cpp (room gathering, PC 0x47a190 to 0x47bf50), the ZRenderEntryBones class (engine/drawing/renderentrygeom.cpp, vtable 0x761cac) and the D3D decal mesh builder at PC 0x47cfa0.
  • PC-only surface renderers: engine/drawing/_wintel/renderd3d/renderobjectwaterpatchd3d.cpp (ZRenderObjectWaterPatchD3D, ZRenderObjectInstanceWaterPatchD3D and the WaterPatch material classes, PC 0x4a0fd0 to 0x4a1e90): the patch grid with tangent (1, 0, 0) and binormal (0, 0, 1), UVs from the object's UV rectangle (0x4a1360), the ZWaterManager patch (0x4a17d0, as ZOldDrawPS2::PrimInstanceCreateWaterPatch) and the ripples per vertex (0x4a1a10). The planar reflections of water, mirrors and glass surfaces are rendered into one mapReflection2D by FUN_004b8a50 (once per camera before the main scene, a stencil value per reflector; ZRenderEntryReflectorD3D at 0x4b7710 is a per-mirror variant without a caller, mat.md); renderobjectscatterd3d.cpp (ZRenderObjectScatterD3D, ZRenderMaterialClassScatterD3D) draws scatter fields with ScatterBillboard.fx. The material passes these use are named by FUN_004975d0 (0x4975d0; mat.md). Port status: in PC-data mode the port draws water with the PS2 engine's own mirror-group reflection and the WaterSurface.fx pixel terms, converts scatter fields to PS2 scatter records and bump-mapped Standard materials to dot3 strips (PC rendering), and with pc_shading draws the Standard and SkinCloth materials with the PC effects' formulas (PC rendering) and the Glow, Glass, GlassSurface, Mirror and Anisotropic classes too (PC rendering); the PS2 disc is drawn as before.

Wrong pairs found

PS2 PS2 name Mapped PC What the PC function is Correct partner
0x27044c ZOldDrawIdListMirrorGroup::GetMirrorBound 0x46e8a0 ZBoneModifyBase::CalcCenSize with the portable ZBoneModifyBase_CalcCenSize inlined (loops over m_lNumActiveBones bone matrices, writes m_vSize/m_vCenter); called at the end of PC UpdateBoneModifiersIK (0x4752b0) as on the PS2 PC 0x46e8a0 belongs to PS2 ZBoneModifyBase::CalcCenSize 0x13ce38 (unmatched); no partner found for GetMirrorBound
0x43b644 ZRender::GetRenderName 0x488220 ZRenderWintelD3D::GetRenderName (slot 74 of vtable 0x7628ec) PC 0x6f7400, the folded return 0 in slot 74 of ZRender (vtable 0x76052c); Ghidra names it jpeg_mem_init and the mapping files it as lib:jpeg
0x280314 ZOldViewBase::GetVisibleGeomsRecur 0x47ac40 a recursive room collector in PC-only engine/drawing/zviewspace.cpp (up to 1,024 entries at this+0xe8, recursing into child groups against clip planes; called from 0x47bb70) none found; the D3D renderer culls differently
0x274ca0 ZOldDrawBase::GeomCreate 0x4788b0 the constructor of PC-only ZRenderEntryBones (stores vtable 0x761cac; new at renderentrygeom.cpp line 700): allocates the bone block and calls Animation::Model::Init, the bone part of GeomCreate none; the PC splits draw-entry creation into per-type classes
0x282df4 AddSingleDecal 0x47cfa0 a larger D3D decal builder: walks the sub-meshes of the hit prim, holds AddSingleDecal's clipping and UV math inline, adds the 90-degree rotation offset and writes a vertex buffer through g_pRenderDll none one to one; the PS2 function is inlined into it
0x1106c4 CCom::Exists 0x4266a0 CCom::RemoveVal (PS2 0x1105d4, unmatched): the same loop, but a match calls ZOffsetAlloc::Free and RunDelRef (slot 0x48) 0x426770 (unmatched, the next function), the PS2 loop without the free; 0x4266a0 goes to CCom::RemoveVal
0x110370 CCom::Alloc 0x44bee0 ZOffsetAlloc::Alloc (PS2 0x134124): best-fit search over the free links, an exact size swapped with the last link none; MSVC appears to inline CCom::Alloc
0x134124 ZOffsetAlloc::Alloc (not flagged) 0x446cf0 an unrelated loop that packs an RGB888 value into 15-bit colour over a range of 16-bit cells 0x44bee0
0x126c24 ZRTStringObject::operator delete 0x456920 ZRTString::operator=(const char *), the zrtstring.h inline (Cleanup(), then Setup(ZStringMemoryManager::Instance().GetStringObject(string))), which MSVC keeps out of line and GCC always inlines none found; the PS2 function is probably inlined on the PC
0x1681c8 ZPackedInput::CheckSignature 0x4586e0 ZPackedInput::Init (PS2 0x16821c, unmatched) with CheckSignature inlined 0x4586e0 belongs to ZPackedInput::Init; CheckSignature has no PC function
0x15d6dc ZDllSound::CalcVolume(float) 0x4c73b0 PC ZDllSound slot 118: waits on slot 0x210 and writes a two-word synth command 0x4c5770 (slot 105: -10000, 0.01, 3000 and log10, which Ghidra shows as fyl2x/log2). MSVC gathered the overload next to CalcVolume(float, float, float) at slot 106; the PS2 has them at 118 and 106
0x12a140 ZSysFile::PrepareSaveGame 0x441e30 ZSysFile::ConvertFilename (PS2 0x129ec4, unmatched): builds a MYSTR from its argument and returns it through the hidden pointer. PC ZSysFile slots 53, 54 and 55 are the deleting destructor, ConvertFilename and PrepareSaveGame 0x442100 (return 0)
0x12f68c CConfiguration::WriteIniSettings(const char *) 0x4473e0 WriteIniSettings(), which calls slot 12 (+0x30) with the stored file name. The class has no virtual destructor; in declaration order () is slot 12 and (const char *) slot 13, and MSVC reverses them 0x447400; PS2 WriteIniSettings() (0x12f3b8, unmatched) belongs with 0x4473e0
0x26c658 Zlink__Canplayanimsegment (not flagged) 0x59f6e0 entry 20 of the PC script-interface table, Zlink__Canplayanim (see the last section) 0x59f780, entry 21

ZPackedInput::CheckSignature settles the open question in the comparison page ("the PC goes on after the signature loop"). After the "IOPacked v0.1" loop the PC function reads the endian byte, calls SetBigEndian on both streams, reads the type and content words, loads the dictionary (content bit 1) and the string table (bit 3), reads the object count, resizes the process table and clears m_Finishing. That is the PS2 ZPackedInput::Init line for line, so no behaviour differs.

Unmatched PS2 functions whose PC partner turned up while reading callers and callees:

PS2 Name PC Evidence
0x127580 ScriptEngine::AttachSceneScripts 0x43bf40 LoadLibraryA of the level DLL, the four ordinal imports and the copy of the 716-entry interface table (see the last section); the same lScriptLoadedCount early return
0x13ce38 ZBoneModifyBase::CalcCenSize 0x46e8a0 see the first table
0x1105d4 CCom::RemoveVal 0x4266a0 see the table
0x16821c ZPackedInput::Init 0x4586e0 see the table
0x129ec4 ZSysFile::ConvertFilename 0x441e30 see the table
0x12f3b8 CConfiguration::WriteIniSettings() 0x4473e0 see the table
0x15d7dc ZDllSound::CanPlayInRoom 0x4c57f0 the same two chains (m_lChainIdxCanPlayIn at +0x88, m_lChainIdxDontPlayIn at +0x8c), the 0x80000000 end marker and the RefToPtr test against the room; called from ZDllSound::GetAudiable
0x161f5c ZSoundGraph::GetGateVertices 0x4ca890 copies the plane position, the normal and the four vertices in forward or reverse order by lRoomId/bNeg, then vneg; called from ZSoundGraph::TestRooms
0x162c64 ZSoundGraph::TestGraph 0x4ca000 (likely) 1,068 against 1,216 bytes, the same file, vdist2 and the 1e38 start distance; called from ZSoundGraph::GetAudiable
0x131918 ZTokenStream::Swallow(EToken, char *) 0x449f00 the same test (eToken == Peek(), or eSYMBOL accepting eNUMBER: types 0x15 and 0x16), copies the name and calls ParseToken
0x1318cc ZTokenStream::Swallow(EToken) 0x449ec0 (probably) called beside 0x449f00 from ZActionManager::ParseExp; not read in full

Outside these subsystems: PC 0x446c90 was mapped to ZEventBuffer::FreeEventBuffer (PS2 0x1483a4, callgraph low). It is the "set current colour" call of a debug memory tracker: it saves the colour at [0x8aba70]+0x8014, stores a new 24-bit colour and its 15-bit form, and returns the old one. ZRender::AllocateDrawBuffers and ZRenderEntryBones call it with 0xff60a0 before they allocate and with the saved value after.

Noise patterns

Each item names the false positive, why it happens and a change to compare_pairs.py (or the mapping) that would remove it.

  • Stale PS2 register state after a jump. ZAudioControllerType<BindToRoom>::ZUpdater::Update (0x239b50) reports -const 0.01, but the function has no 0.01. Its first block ends in a tail j ZSoundObject::SetFadeOut with $t7 holding the constant-pool address 0x593d30. The next block starts at a branch target with lw $t5, 0x84($t7), where $t7 is now the sound object. disasm_ps2 still has ad[$t7] = 0x593d30 and reads the float at 0x593db4 through its read-only-initialiser rule. Fix: clear hi, ad, luimem and luihist after the delay slot of j, jr and b, and ideally at every branch target.
  • Runtime helpers and folded stubs filed as lib:quazal. The ~+lib lib:quazal item in audio, system and video pairs is _ftol2 (0x727d4c), __chkstk (0x727cc0), the eh vector constructor/destructor iterator (0x727c54, 0x727bf4), 0x6f1af0 (a 3-byte mov eax, [ecx]; ret that ICF folded, used as the MYSTR to char * conversion) or 0x5e0ef0 (a lone ret, into which MSVC folded the script interfaces Print, Error, Warning, Zscassert and five more). 0x727xxx is above the documented Quazal range (0x6d8000 to 0x722000). Fix: give the statically linked CRT helpers at 0x727b00 to 0x728000 a lib:crt category, drop _ftol2 and __chkstk like the other conversion and stack noise, and never file a function of three bytes or less under a library.
  • MSVC devirtualises calls on local objects. ZDllSound::RenderFrameMulti, ZSysFile::CheckOtherZipExt and ZSysFile::AddExclusiveAllFiles are flagged +call AddSort or +call RunNxtRefPtr. MSVC calls a virtual function directly when the object is a local of known type (LINKSORTREFTAB rtPrioritized[4], STRREFTAB rtFiles); GCC 3.2 still goes through the vtable. The devirtualisation rule only covers GCC's direction. Fix: when the PC calls a function directly that is a virtual slot on the PS2, and the PS2 has at least one more virtual call than expected, count it as devirtualised.
  • Strings behind a NAME pointer. ZPhysicsLinkage::NAME and VideoActionMap are const char * globals. Ghidra resolves PTR_s_PhysicsLinkage_007fd974 and the PC record lists the string; the PS2 record only has the global. Result: +str "PhysicsLinkage" in ZBoneModifyBase::UpdateConnectedPhysics and ConnectPhysicsLinkage. Fix: on the PS2 side, follow a global word that points at a string and add that string. For ZVideoPlayer::BeginPlaying this turns a one-sided string into a real substitution.
  • __FILE__ strings with a .si extension. The script-interface sources are *.si files ("z:/code/engine/scriptinterfaces/scene.si"), which DRIVE_PATH (.cpp|c|h|hpp|inl) does not take as __FILE__. Scene__Getdoorstatus is flagged strings only for that. On the PC, RegisterZMsg(name, 0, __FILE__, __LINE__) is the debug form of the PS2's RegisterZMsg(name, 0, 0, 0). Fix: add si to the extensions.
  • PS2 scratchpad addresses and PC frame sizes as literals. ZBaseGeom::UpdateLightListForLight and UpdateLightListForGeom build their geom lists in scratchpad RAM (SPR_LIGHT_GEOM_LIST = 0x70000000, so lui 0x7000 gives 1879048196 and 1879052288). The PC uses a stack array, and its __chkstk frame size (4696, 4700) becomes the PC literal. The same frame sizes give ?+int 9844 (ZSoundGraph::TestRooms) and ?+int 16016 (ZDllSound::InstallSounds), and the FsZip_t stack buffers give +int 65540 against the PS2's new char[0x10001]. Fix: drop PS2 values from 0x70000000 to 0x70003fff (the 16 KiB scratchpad) as addresses, and drop the mov eax, N before a call to __chkstk/_alloca_probe.
  • GCC offsets past 32 KiB. ?-int -20692 (ZDllSound::GetDeletedSounds) is lui 1; addiu -20692 reaching a field. Fix: a negative addiu after a lui into the same register is an offset.
  • Integer flags read as floats. ZBaseGeom::CopyData reports +const 2 for SetControl(0x40000000, 0), which is BASEGEOM_HasDynamicParent. Fix: a pushed immediate with a float bit pattern is not a float when the PS2 has the same 32-bit value as an integer (lui 0x4000), or when it is a single bit (0x40000000, 0x80000000). This is probably the most frequent +const 2 in diffs-summary.txt.
  • MSVC stores short literals as immediates. ZSysFile::AddBig reports -str ".ZIP": the PC writes memcpy(p, ".ZIP", 4) as mov dword [p], 0x50495a2e. Fix: a PS2 string of four bytes (or the first four bytes of one) that equals a PC mov immediate read little-endian matches.
  • Memory-tracker colour tag. +int 16736416 (0xff60a0) in ZRender::AllocateDrawBuffers and ZOldDrawBase::GeomCreate is the argument of PC 0x446c90 (see the wrong pairs). Fix: treat 0x446c90 as a debug allocation helper, drop the call and its argument, and drop its pairing with ZEventBuffer::FreeEventBuffer.
  • ICF-folded tiny callees classed as PC-only. ZDllSound::InstallSoundGraph reports +call FUN_004aba30 (PC-only code, pc-only-class). That function is the 17-byte setter ZSoundGraph::InstallLoadedGraph (two stores), folded with a ZBlurTextureWintelD3D method. Fix: a PC callee of at most 24 bytes with no calls never counts as PC-only code, and it cancels a PS2 callee of similar size that the PC was assumed to have inlined.
  • Folded constant functions in library ranges. MSVC folds every return 0 into one body that Ghidra names after a libjpeg export (jpeg_mem_init, PC 0x6f7400). Because it is filed as lib:jpeg, the data-table stage could not use it and paired ZRender::GetRenderName with the derived class's override. Fix: let constant functions of three bytes in lib:* ranges match as folded when they sit in first-party vtables, and prefer the slot of the class that declares the PS2 function.
  • A constant moved between caller and callee. The 90 of ZGeometryDecal::Add sits in the PC's decal builder, so Add reports -const 90 and the builder +const 90. The callee check only looks down the call graph. Fix: before reporting a one-sided round constant, look for it in the mapped callers too (one level).
  • Out-of-line code that GCC inlines, flagged structure. The ZAudioControllerManager constructor (0x237d70, 6,792 bytes, 73 PS2 branches against 0) calls the 31 ZAudioControllerType<T> constructors out of line on the PC; both create the same 31 types in the same order (PC __LINE__ 56 to 86). ZDllSound::InstallSounds (424 against 111 bytes) builds the Audio::ZPackedData temporary in a callee (0x4c9d60) and copies its checksum vector with std::copy (0x4c7050). ZAnimTemplatesNames::Init (528 against 141) and ZRunParamAnim::CreateAnim (704 against 166) call the CHUNKFILE accessors (FindChild, CountData, FirstChild, Next, Data) that GCC inlines. Fix: add the sizes and branches of unmatched PC callees from the same file guess to the PC side, or downgrade a structure flag to minor when the PS2's extra lines in ps2-linesets.json are all header lines (chunk.h).
  • An inlined setter without callees or floats. ZRunMatPosAnim::Create reports -call ZRunMatPosAnim::SetFrameEnd; the PC body holds the inlined frame-count read from the chunk header (the & 0xc0000000 size-format test). The inlining test found nothing to match because SetFrameEnd has no callees, strings or floats of its own; comparing its integer masks would.
  • PC-only renderer classes on low pairs. Four of the five wrong pairs in engine/drawing are low or medium callgraph, order or datatable pairs whose PC function belongs to PC-only code (zviewspace.cpp, ZRenderEntryBones, the D3D decal path). Fix: refuse a pair when the PC function stores the vtable of a PC-only RTTI class, or when both its PC address neighbours are attributed to a PC-only file.
  • Overload slot order in non-RTTI-checked classes. ZDllSound::CalcVolume(float) and CConfiguration::WriteIniSettings were both paired with the other overload's slot. MSVC's reverse grouping of overloads (described in the comparison page) applies to these classes too, but the mapping did not reorder them. Fix: apply the overload reordering to every vtable pair, and check the result against the slot that calls the other (WriteIniSettings() calls slot 12).
  • Ghidra and printf. Ghidra marks the MSVCR71 printf import as non-returning, so the PC C of LockDrawBaseGeomsBuffer and AddPrimDataUnique ends at the message. compare_pairs.py works from the disassembly and is not affected; a reviewer reading show_pair.py output has to read the disassembly after a printf.
  • x87 fcos against fast_cos in ZDllSound::GetAudiable: the PS2 calls its approximation, the PC uses the x87 instruction. A math-library difference, not behaviour.

Unresolved

  • ZOldDrawBase::UpdateMovingMatrices: the PC reads an owner byte of 0xff as 2.0, multiplies by 254 and stores the truncated 508 into a byte (0xfc). 0xff is the "not computed yet" value of ComputeStaticShadowMultiplier, which never stores it (its largest result is 254), so it reaches this path only for an owner whose multiplier has not been computed yet, whose attached geoms then get 252 (0.99) for that frame. Not checked at run time.
  • Projected static shadows: whether the PC keeps a character's draw entry (and so its four projection slots) while the character is out of view was not checked; the port forgets them after two frames without a call. The PC's skinned TextureProjectionMPS takes the light direction from the skinned position in model space; whether the PC's model space for a character is the world (so that it agrees with the world-space light position) was not checked; the port uses root space for both. The additive kind (texture word bit 29, M11 and M12) is drawn by PC 0x4b4110 called with 1 and layer 0x10 after the scene's lighting passes; the render states around that call were not read (the port takes the technique's own blend, DESTCOLOR, ONE, and the default ADD blend operation that command 0xe restores).
  • ZOldDrawIdListMirrorGroup::GetMirrorBound (PS2 0x27044c) has no PC partner once the wrong pair is removed; the PC mirror code was not searched.
  • ZRender::AddCamera: whether PC scenes hold mousecamera cameras (an editor camera) was not checked, so the practical effect of the missing test is unknown.
  • PC 0x4c73b0 (PC ZDllSound slot 118) has no known PS2 partner. It waits until slot 0x210 returns true, writes the two-word synth command {param, 8}, {8, 0x10000} and calls slot 0x1dc. The PS2 slots near 118 are SetEnvironment, StopBuffers and UpdateBufferVolumes, all empty stubs, so it may be a PC-only override of one of them.
  • ZDllSound::RenderFrame (0x160794, PC 0x4c9800) and ZActionMapTree::Digital (0x132dec, PC 0x44a680) were skimmed, not read line by line. Their callees, strings and literals agree; only the virtual-call counts differ.
  • qpul: which of the two interpolations is the later one cannot be told from the code.

Script interfaces on PC

The comparison page guessed that the PC keeps the script-interface functions (*.si.cpp, hitman3/interfaces at 4% and engine/ScriptInterfaces at 6% coverage) in the script DLLs. They are in the executable. Checked from the exports, imports and strings of the 14 DLLs in Scriptcs/_gamerelease/ (opened read-only) and a scan of the unpacked executable; the scripts are build/pc-compare/review/platform-and-audio-scratch/sitable.py, ptrruns.py, xref.py and dllstr.py, and sitable.tsv there lists every entry.

The DLLs hold no interface code:

  • Every DLL exports the same four data symbols, all in .data, by ordinal: 1 SF, 2 ISF, 3 Scripts, 4 ScriptImports. In every DLL ScriptImports is 716 zero words.
  • Each imports only eight MSVCR71.dll functions (malloc, free, the CRT start-up helpers) and KERNEL32.dll DisableThreadLibraryCalls. There is no import from the executable.
  • No DLL contains a .si or .cpp path, z:/code, or an interface name such as Zactor__ or Scene__.

The executable holds the table and the functions:

  • PC 0x7f1d20 is a run of exactly 716 code pointers, the longest in the image (the next is 449). It is the PS2 ScriptInterfaces[716] (src/engine/ScriptInterfaces/scriptinterfaces.h) in the same order. Entry 0 Zcar__Moveto is PC 0x6a31b0 and entry 715 Pathfinder__Iswallbetweenpoints PC 0x5a0ff0. 29 entries point at already mapped PC functions; 27 of them agree with the PS2 name at that index (Scene__Getdoorstatus, entry 672, is PC 0x59e9a0, which the mapping found by its strings, strset medium), one is folded (Zhm3Actor__Playsound and Zhm3Actor__Generateaudioevent share PC 0x6a7780) and one is a wrong pair (Zlink__Canplayanimsegment, listed above).
  • The functions are laid out by .si file in table order (649 of the 715 steps go up). The engine interfaces (Zactor, Item, Engine, Zlist, Scene, Audio, Zlink, Zgeom, Math, Istring, Pathfinder, Debugfunctions, Physics) sit at 0x59c110 to 0x5a1350, the hitman3/interfaces ones (Zcar, Zhm3Actor, Silevelcontrol, Hm3Gui, ..., Cigs) at 0x6a31b0 to 0x6aba60.
  • 705 of the 716 entries are distinct. MSVC's identical-code folding merged the rest: nine empty functions (Print, Error, Warning, Zscassert, Addlinedecay, Addvectordecay, Debugfunctions__Displayscriptlinefrompos, Silevelcontrol__Killhitman, Zhm3Actor__Dummy) are the lone ret at 0x5e0ef0, and Zhm3Boid__Enablefall/Enablefallbehavior and Math__Vset/Math__Vcpy share one body each. One debug entry points at the folded return 0 at 0x6f7400.
  • The executable has four __FILE__ strings of .si files: z:/code/engine/scriptinterfaces/scene.si (0x784aa4), physics.si (0x784af0), z:/code/hitman3/interfaces/hm3actor.si (0x7ab634) and hm3levelcontrol.si (0x7ab65c). All 12 references to them are inside the two ranges above or just past their last entry (0x5a140c). Scene__Getdoorstatus passes its own to RegisterZMsg with line 289.

The loader, PC 0x43bf40, is the PC ScriptEngine::AttachSceneScripts (PS2 0x127580, unmatched in that run). It keeps the PS2's lScriptLoadedCount early return, then calls LoadLibraryA on the level DLL, takes the four exports with GetProcAddress by ordinal (1, 2, 3, 4; no export name is in the executable, which is why "ScriptImports" never turned up), and copies 0x2cc = 716 words from 0x7f1d20 into the DLL's ScriptImports. It then walks the Scripts creator list. This is the PS2 scheme with a different binder: the PS2 resolves the module's ScriptImports relocation to the address of ScriptInterfaces itself (Symbols[0] in src/engine/zstdlib/zscriptc.cpp), the PC copies the table into the DLL. The ScriptDll and ScriptIfDll options of the PC option parser (PC 0x4531c0) and the PS2's unused g_pScriptIfDll (src/engine/globals/globals.cpp) point to an older design with the interfaces in a DLL of their own; the release links them into the executable.

Why the mapping missed them: 659 of the 716 targets are not Ghidra functions at all. Nothing calls them directly; the table is their only reference, and it sits in the single RWX .text section that also holds data, so auto-analysis never created functions from it. Only 57 targets are Ghidra functions (those that other code also calls), and the 29 mapped pairs come from those. Seeding a function at every table entry and pairing entry n with ScriptInterfaces[n] would give an anchor stage of about 700 exact pairs and lift both subsystems from single-digit coverage; the remaining *.si.cpp helpers (customformatter.cpp, item_si_helper.cpp) would follow through the call graph. The rerun does this; see The script-interface table.