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.tsvand 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 withvmmul(disp, m)and never uses the result. The PC goes on: it takes the player's draw entry, locks the bone matrices throughg_pRenderDll(vtable +0xb0 and +0xc4), rebuilds every bone matrix offset by the spine displacement and callsZOldDrawBase::UpdateMovingMatrices. The PC also asserts thatsetFirstPersonis 0 or 1. The deadvmmulsuggests 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 toBones2()and the copy of the finished bones to the draw entry'sBones()(ZOldDrawPS2::UpdateBoneModifiersIKH20x29c430 andUpdateBoneModifiersIK0x29ca98, both fromUpdateBoneModifiersinZOldDrawBase::Update; the port'sZOldDrawSDL::FinishBones). The deform matrices are built fromBones()later in the same frame (CreateDeformBonesinUpdateDynamic, which runs afterUpdateBoneModifiers). 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 withOPENBLOOD_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.
- Checked for the port on 25 November 2026: the upload is not needed there. The function's
only caller is
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 multiplierm_MulColor(read as 2.0 when it is 0xff and asm_MulColor / 254otherwise, stored back asx * 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 assertscount <= 4; these are the projectionsComputeStaticShadowMultipliercollects, 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'sDirectLights(),m_pBoneData + 0x20). Evidence:fmul [0x761954](1/254) andfmul [0x761958](254) before eachftolthat 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'sDirectLights()(ZOldDrawPS2::AddPrimToDMAChain; the port's bone and owned-strip draws inzoldviewbonessdl.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'spc_lightingdoes 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).
- The PS2 gets the same result another way: the view sets an attached geom's owner
(
ComputeStaticShadowMultiplier(PS2 0x13fb64), PC 0x473310,src/engine/drawing/renderstaticshadowsampling.cpp. Both sample the room's static shadow data at the character's root withGetStaticShadowSampleIntensity. On PS2,CalcBoneLightSourcesscales 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, theTextureProjectiontechnique 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 storesx × 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'spc_lightingeases, 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.
- 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
engine/drawing: ZRender and ZRenderBaseDll¶
ZRender::AddCamera(PS2 0x135310), PC 0x469760,src/engine/drawing/renderbase.cpp. The PS2 ignores every camera whose geom is namedmousecamera. The PC has no such test, and the stringmousecameradoes not occur in the PC executable. The rest is the same: set the list priority, add sorted,InitCamera, andAddCameraToViewonce 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 setsm_bDisableVSync = truewhenever the option is present. The PC sets it toatoi(value) == 0.- The PC adds
BlurShadowsandSelfShadows. Each sets a global disable flag (0x90c85c, 0x90c854) toatoi(value) == 0.
ZRender::LockDrawBaseGeomsBuffer(PS2 0x134d6c), PC 0x4684c0, same file. Debug output only: after the lock the PC callsprintf("ZRenderPS2::LockDrawBaseGeomsBuffer size %dKb\n", size / 1024). The string saysZRenderPS2on the PC too. The lock is the same (the largest free block minus 0x32000).ZRenderBaseDll::CompactPrimBuffer(PS2 0x1365e4), PC 0x4699a0, same file (aminorrow). 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 assertslNumHandles < 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 theprintfimport 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 createsZPS2Video, the PC a 0x1d0-byteZBaseVideosubclass with vtable 0x7847ac (newatvideo.cppline 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#elsebranch 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 holdstis kept andtis doubled (minus 0.5) at each step. Then it blends linearly and callsqnorm. 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 undersqrt) 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, andFsZip_t::GetDirectory(PS2 0x115294), PC 0x42c3d0,src/engine/zstdlib/iozip.cpp. The PS2 allocates its file-name buffers withnew char[0x10001](findfilename,bufferandthrashinfindFile, one buffer inGetDirectory) 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 65540of the comparison. No gameplay effect: the PS2 thread stacks cannot hold 64 KiB arrays.
engine/zstdlib: reference tables¶
REFTAB::NewBlock(PS2 0x11750c), PC 0x42fcf0, andREFTAB32::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"andthis. The same object brackets other allocations (slot 0x28 with 1 and 0 around anewinfilesystem.cpp), so this is allocation tracking for the PC's memory statistics. The rest is the same, including thememsetto 0x22 and them_FirstTabshortcut inREFTAB32.
engine/audio: ZSoundObjectManager¶
ZSoundObjectManager::Initialize(PS2 0x163c34), PC 0x4cc2f0, andZSoundObjectManager::Destroy(PS2 0x163d24), PC 0x4cbe70,src/engine/audio/soundengine/soundobjectmanager.cpp. The PS2 allocates the 511SoundObject::ZControllersobjects with the globalnewand frees them with::operator delete. The PC takes them from aZPoolAllocator(the pool at 0x910ca0:mov ecx, 0x910ca0; call ZPoolAllocator::Allocwith size 0x18) and returns them withZPoolAllocator::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 floatsm_fRealTimeOffset(offset 0x18),m_fRealTime_(0x10) andm_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 fromZSysInterface::ReadCmdLine(PS2 0x12d5f0, PC 0x443110): the PS2 version (0x2b8450,src/engine/startup/_ps2/nukeandrestart.cpp) reads into the fixed 4 KiB bufferg_IniFileand debug-breaks when the file is empty or 0x1000 bytes or larger. The PC version (0x4529e0,engine/system/_wintel/sysinterfacewintel.cpp) allocatessize + 1bytes with the debugnew, 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. TheReadCmdLinepair 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) andFree(0x13793c, PC 0x46a530),src/engine/drawing/renderdrawbase.cpp. Already listed, confirmed: the PS2 bodies areZDebugBreak(). The PC base class allocates with the debugnew(renderdrawbase.cpplines 37 and 45) and frees withoperator 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'sZRenderWintelD3Doverrides it (PC 0x488220) and returns"Direct3D9".FsZip_t::GetFileTime(PS2 0x115288), PC 0x42c390,src/engine/zstdlib/iozip.cpp. A debug break andreturn falseon the PS2. The PC callsFsZip_t::findFilefor the entry and converts its DOS modification date and time with the Win32DosDateTimeToFileTime. 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 returnsGetProcAddress(m_hModule, pProcName)when a module is loaded (already listed).CConfiguration::WriteIniSettings(const char *)(PS2 0x12f68c),src/engine/system/cconfiguration.cpp. Areturn falsestub on the PS2. Its PC partner is 0x447400 (930 bytes), not 0x4473e0 (see the wrong pairs). It returns at once when the flag atg_pSysInterface + 0x7ais 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 (_memicmpagainst the list at +0xa4) and appends the options it did not find. The PS2WriteIniSettings()(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 isreturn 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), theZRenderEntryBonesclass (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,ZRenderObjectInstanceWaterPatchD3Dand 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), theZWaterManagerpatch (0x4a17d0, asZOldDrawPS2::PrimInstanceCreateWaterPatch) and the ripples per vertex (0x4a1a10). The planar reflections of water, mirrors and glass surfaces are rendered into onemapReflection2DbyFUN_004b8a50(once per camera before the main scene, a stencil value per reflector;ZRenderEntryReflectorD3Dat 0x4b7710 is a per-mirror variant without a caller, mat.md);renderobjectscatterd3d.cpp(ZRenderObjectScatterD3D,ZRenderMaterialClassScatterD3D) draws scatter fields withScatterBillboard.fx. The material passes these use are named byFUN_004975d0(0x4975d0; mat.md). Port status: in PC-data mode the port draws water with the PS2 engine's own mirror-group reflection and theWaterSurface.fxpixel terms, converts scatter fields to PS2 scatter records and bump-mapped Standard materials to dot3 strips (PC rendering), and withpc_shadingdraws 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 tailj ZSoundObject::SetFadeOutwith$t7holding the constant-pool address 0x593d30. The next block starts at a branch target withlw $t5, 0x84($t7), where$t7is now the sound object.disasm_ps2still hasad[$t7] = 0x593d30and reads the float at 0x593db4 through its read-only-initialiser rule. Fix: clearhi,ad,luimemandluihistafter the delay slot ofj,jrandb, and ideally at every branch target. - Runtime helpers and folded stubs filed as
lib:quazal. The~+lib lib:quazalitem in audio, system and video pairs is_ftol2(0x727d4c),__chkstk(0x727cc0), theeh vector constructor/destructor iterator(0x727c54, 0x727bf4), 0x6f1af0 (a 3-bytemov eax, [ecx]; retthat ICF folded, used as theMYSTRtochar *conversion) or 0x5e0ef0 (a loneret, into which MSVC folded the script interfacesPrint,Error,Warning,Zscassertand five more). 0x727xxx is above the documented Quazal range (0x6d8000 to 0x722000). Fix: give the statically linked CRT helpers at 0x727b00 to 0x728000 alib:crtcategory, drop_ftol2and__chkstklike 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::CheckOtherZipExtandZSysFile::AddExclusiveAllFilesare flagged+call AddSortor+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
NAMEpointer.ZPhysicsLinkage::NAMEandVideoActionMapareconst char *globals. Ghidra resolvesPTR_s_PhysicsLinkage_007fd974and the PC record lists the string; the PS2 record only has the global. Result:+str "PhysicsLinkage"inZBoneModifyBase::UpdateConnectedPhysicsandConnectPhysicsLinkage. Fix: on the PS2 side, follow a global word that points at a string and add that string. ForZVideoPlayer::BeginPlayingthis turns a one-sided string into a real substitution. __FILE__strings with a.siextension. The script-interface sources are*.sifiles ("z:/code/engine/scriptinterfaces/scene.si"), whichDRIVE_PATH(.cpp|c|h|hpp|inl) does not take as__FILE__.Scene__Getdoorstatusis flaggedstringsonly for that. On the PC,RegisterZMsg(name, 0, __FILE__, __LINE__)is the debug form of the PS2'sRegisterZMsg(name, 0, 0, 0). Fix: addsito the extensions.- PS2 scratchpad addresses and PC frame sizes as literals.
ZBaseGeom::UpdateLightListForLightandUpdateLightListForGeombuild their geom lists in scratchpad RAM (SPR_LIGHT_GEOM_LIST = 0x70000000, solui 0x7000gives 1879048196 and 1879052288). The PC uses a stack array, and its__chkstkframe size (4696, 4700) becomes the PC literal. The same frame sizes give?+int 9844(ZSoundGraph::TestRooms) and?+int 16016(ZDllSound::InstallSounds), and theFsZip_tstack buffers give+int 65540against the PS2'snew char[0x10001]. Fix: drop PS2 values from 0x70000000 to 0x70003fff (the 16 KiB scratchpad) as addresses, and drop themov eax, Nbefore a call to__chkstk/_alloca_probe. - GCC offsets past 32 KiB.
?-int -20692(ZDllSound::GetDeletedSounds) islui 1; addiu -20692reaching a field. Fix: a negativeaddiuafter aluiinto the same register is an offset. - Integer flags read as floats.
ZBaseGeom::CopyDatareports+const 2forSetControl(0x40000000, 0), which isBASEGEOM_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 2indiffs-summary.txt. - MSVC stores short literals as immediates.
ZSysFile::AddBigreports-str ".ZIP": the PC writesmemcpy(p, ".ZIP", 4)asmov dword [p], 0x50495a2e. Fix: a PS2 string of four bytes (or the first four bytes of one) that equals a PCmovimmediate read little-endian matches. - Memory-tracker colour tag.
+int 16736416(0xff60a0) inZRender::AllocateDrawBuffersandZOldDrawBase::GeomCreateis 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 withZEventBuffer::FreeEventBuffer. - ICF-folded tiny callees classed as PC-only.
ZDllSound::InstallSoundGraphreports+call FUN_004aba30 (PC-only code, pc-only-class). That function is the 17-byte setterZSoundGraph::InstallLoadedGraph(two stores), folded with aZBlurTextureWintelD3Dmethod. 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 0into one body that Ghidra names after a libjpeg export (jpeg_mem_init, PC 0x6f7400). Because it is filed aslib:jpeg, the data-table stage could not use it and pairedZRender::GetRenderNamewith the derived class's override. Fix: let constant functions of three bytes inlib:*ranges match asfoldedwhen 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::Addsits in the PC's decal builder, soAddreports-const 90and 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. TheZAudioControllerManagerconstructor (0x237d70, 6,792 bytes, 73 PS2 branches against 0) calls the 31ZAudioControllerType<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 theAudio::ZPackedDatatemporary in a callee (0x4c9d60) and copies its checksum vector withstd::copy(0x4c7050).ZAnimTemplatesNames::Init(528 against 141) andZRunParamAnim::CreateAnim(704 against 166) call theCHUNKFILEaccessors (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 astructureflag tominorwhen the PS2's extra lines inps2-linesets.jsonare all header lines (chunk.h). - An inlined setter without callees or floats.
ZRunMatPosAnim::Createreports-call ZRunMatPosAnim::SetFrameEnd; the PC body holds the inlined frame-count read from the chunk header (the& 0xc0000000size-format test). The inlining test found nothing to match becauseSetFrameEndhas 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/drawingare low or mediumcallgraph,orderordatatablepairs 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)andCConfiguration::WriteIniSettingswere 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 MSVCR71printfimport as non-returning, so the PC C ofLockDrawBaseGeomsBufferandAddPrimDataUniqueends at the message.compare_pairs.pyworks from the disassembly and is not affected; a reviewer readingshow_pair.pyoutput has to read the disassembly after aprintf. x87 fcosagainstfast_cosinZDllSound::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 ofComputeStaticShadowMultiplier, 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
TextureProjectionMPStakes 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 defaultADDblend 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 holdmousecameracameras (an editor camera) was not checked, so the practical effect of the missing test is unknown.- PC 0x4c73b0 (PC
ZDllSoundslot 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 areSetEnvironment,StopBuffersandUpdateBufferVolumes, all empty stubs, so it may be a PC-only override of one of them. ZDllSound::RenderFrame(0x160794, PC 0x4c9800) andZActionMapTree::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: 1SF, 2ISF, 3Scripts, 4ScriptImports. In every DLLScriptImportsis 716 zero words. - Each imports only eight
MSVCR71.dllfunctions (malloc,free, the CRT start-up helpers) andKERNEL32.dllDisableThreadLibraryCalls. There is no import from the executable. - No DLL contains a
.sior.cpppath,z:/code, or an interface name such asZactor__orScene__.
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 0Zcar__Movetois PC 0x6a31b0 and entry 715Pathfinder__IswallbetweenpointsPC 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,strsetmedium), one is folded (Zhm3Actor__PlaysoundandZhm3Actor__Generateaudioeventshare PC 0x6a7780) and one is a wrong pair (Zlink__Canplayanimsegment, listed above). - The functions are laid out by
.sifile 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, thehitman3/interfacesones (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 loneretat 0x5e0ef0, andZhm3Boid__Enablefall/EnablefallbehaviorandMath__Vset/Math__Vcpyshare one body each. One debug entry points at the foldedreturn 0at 0x6f7400. - The executable has four
__FILE__strings of.sifiles:z:/code/engine/scriptinterfaces/scene.si(0x784aa4),physics.si(0x784af0),z:/code/hitman3/interfaces/hm3actor.si(0x7ab634) andhm3levelcontrol.si(0x7ab65c). All 12 references to them are inside the two ranges above or just past their last entry (0x5a140c).Scene__Getdoorstatuspasses its own toRegisterZMsgwith 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.