PC Differences: Engine Core¶
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 records the PC/PS2 differences found in the engine core subsystems: engine/fysix,
engine/geomsextend, engine/geomsbase, engine/eventsbase, engine/enginedata,
engine/collision, engine/boids, engine/animation, engine/camera, engine/pathfinder4 and
engine/shared. The input was build/pc-compare/diffs.tsv from the run of 24 November 2026 (see
PC Comparison). Every pair whose category is constants, strings,
calls, structure or stub-on-one-side was reviewed: 98 pairs. The 15 largest minor pairs
with a non-empty minor column were reviewed as well. Each pair was read side by side with
show_pair.py, with callers and callees from build/pc-compare/pc-decomp/ where needed, and with
the PS2 instruction words from extracted/HITMAN3.ELF where the PS2 records looked wrong.
Of the 113 pairs, 34 are real differences, 64 are noise and 15 are wrong pairs. None was left
undecided. The 98 flagged pairs split into 32 real, 51 noise and 15 wrong. Two of the 15 minor
pairs hide a real difference. The verdicts are in build/pc-compare/review/engine-core-verdicts.tsv
(columns pc_addr ps2_addr ps2_name verdict note).
| Subsystem | Reviewed | Real | Noise | Wrong pair |
|---|---|---|---|---|
| engine/enginedata | 23 | 15 | 2 | 6 |
| engine/eventsbase | 20 | 2 | 16 | 2 |
| engine/fysix | 19 | 7 | 11 | 1 |
| engine/geomsextend | 19 | 0 | 15 | 4 |
| engine/geomsbase | 12 | 7 | 4 | 1 |
| engine/pathfinder4 | 6 | 0 | 6 | 0 |
| engine/collision | 4 | 1 | 3 | 0 |
| engine/animation | 3 | 0 | 3 | 0 |
| engine/shared | 3 | 0 | 2 | 1 |
| engine/boids | 2 | 0 | 2 | 0 |
| engine/camera | 2 | 2 | 0 | 0 |
By category: constants 17 real out of 40, strings 8 out of 27, calls 3 out of 21 (7 of the
21 are wrong pairs), structure 3 out of 9, and the single stub-on-one-side pair is real.
Patterns¶
- The PC simulation is made frame-rate independent or finer. Ragdolls take 4 sub-steps
instead of 2 and are capped at about 40 Hz. Rigid bodies take 4 relaxation passes instead of 3.
Cloth steps at 50 Hz instead of 40 Hz. The blood-mark decay is
pow(0.99, dt * 60)instead of a fixed 0.99 per frame. The PS2 numbers look tuned for a fixed frame rate and for cost. The PC ones look like the later version. - PS2 platform adaptations in shared code. The PS2 halves particle colours and sizes for the
GS colour range, compacts textures, moves particles in a frame-buffer flip callback, places
buffers in the scratchpad (
SPR_*) and uses hand-written traversal for the octree. The PC does none of this in the same functions. - The loading sequence was reworked on the PC. The progress table, the load order of the
cache files, the saved-game load and the scene change all differ (see
ZEngineDataBase). - Debug key bindings moved. The free-camera toggle is in the
DebugAlwaysset on the PS2 and inDebugKeyson the PC, which also binds two more debug keys. - Wrong pairs cluster in families of small, similar functions: the scheduler in
scheduledevent.cpp(six shifted pairs), and small inline helpers that MSVC kept out of line and that the call graph paired with the nearest PS2 function.
What the port adopts¶
The SDL3 port takes these differences over through its replaced functions
(docs/development/port/overrides.md):
- Always, above 30 frames a second: the ragdoll frame guard of
CRagdoll2::Move(with the counter zeroed inActivate) and the blood-mark decay ofZBloodSplatters::ClassFrameUpdate, the latter per 1/30 s rather than the PC's 1/60 s (Frame rate). At 30 frames a second the port runs the PS2 code. - With the launcher's PC physics (
pc_physics): the 4 ragdoll sub-steps ofMoveRagdoll, the 4 relaxation passes ofCRigidBody::Move, the 500-vertex limit and real mesh vertices ofGetVerticesandSetup2, and the cloth's 1/50 s step and radius-30 obstacles ofZCloth::DrawIt(PC physics). The port also uses the PC ragdoll activation and coin water-hit flag underpc_physics. The cached Water ID remains specific to the PC executable.
The PS2's own per-frame code that the PC kept as well (rigid bodies' rest counters in
CRigidBody::FrameUpdate, actors' tension decay in ZHM3Actor::ClassFrameUpdate, the M13
revival) is made frame-rate independent by the port; see Frame rate.
Behaviour differences¶
engine/fysix¶
ConstrainedParticleSystem (ragdoll particles)¶
ConstrainedParticleSystem::MoveRagdoll, PS2 0x243df0, PC 0x56f120,src/engine/fysix/particle.cpp.- The PS2 has
int iSubSteps = 2;. The PC computesiSubSteps = 4 - (bDragged != 0), so it takes 4 sub-steps, or 3 while the body is dragged. - The gravity, damping (
powf) and velocity factors divide by the same variable. So only the number of collision and constraint passes per frame changes. - The flagged
-const 4is GCC's foldediSubSteps * iSubSteps. - The water branch is the same on both: 0.9 damping, the 25-unit grace band, and the
sinwave with 7 and 3.
- The PS2 has
CRagdoll2¶
CRagdoll2::Activate, PS2 0x244be8, PC 0x571c50,src/engine/fysix/ragdoll.cpp. This pair is already listed inpc-comparison.md; these are the details.- The PS2 does the particle setup only when
bFromAnimis set:ComputeParticlePositionsSub,InitOkX,FindFaces,ZeroOut(5)andGetLocalPelvis. - The PC calls
ComputeParticlePositionsSubonly forbFromAnim. It runsZeroOut(5),FindFaces,InitOkX(vtable +8) andGetLocalPelvison every activation. - When the ragdoll is not activated from an animation, the PC also calls
ConstrainedParticleSystem::HandleCollision(m_ColiInfo)and then 0x56bd30. That function copies each particle's position to its old position and zeroes its velocity. A ragdoll started without an animation is pushed out of the collision faces once and starts at rest. - Evidence:
if (!bFromAnim) { HandleCollision(this + 0x14c); FUN_0056bd30(); }. - The PC also zeroes the new frame counter at +0x218 (see
Move).
- The PS2 does the particle setup only when
CRagdoll2::Move, PS2 0x245048, PC 0x571d30,src/engine/fysix/ragdoll.cpp.- The PC adds a frame-rate guard. It uses a new
uint16at +0x218, soCRagdoll2is 4 bytes larger on the PC (m_pLnkObjmoves from 0x234 to 0x238). - While dt < 0.025, each frame adds
100 * (0.025 / dt - 1)to the counter. When the counter reaches 100, the PC subtracts 100, calls onlyCalcGroundOffsetand returnstrue. It skips the simulation for that frame. - The minimum time step is 0.025 on the PC. It is 0.01 (with the counter reset) when particles
are fixed (
m_nFixedPars != 0) orZSysInterface::Get_TimeMultiplier() < 1. The maximum is 0.1. - The PS2 only clamps dt to [0.01, 0.1].
- In short, above 40 fps the PC simulates ragdolls at about 40 Hz.
- Evidence:
cmp di, 0x64/add edi, -0x64, andfld [0x780cec] (0.025); fdiv dt; fsub 1.0; fmul -100.0; call _ftol.
- The PC adds a frame-rate guard. It uses a new
CRigidBody¶
CRigidBody::GetVertices, PS2 0x249548, PC 0x5740b0,src/engine/fysix/rigidbody.cpp. The vertex limit is 80 on the PS2 and 500 on the PC. It applies both in the earlynNumVertices <= 80test and in the finalreturn n <= 80 ? n : 0. The PC forms arelocal_1c < 0x1f5and~-(uint)(500 < n) & n.CRigidBody::Setup2, PS2 0x248fa4, PC 0x574f00,src/engine/fysix/rigidbody.cpp. This pair is already listed inpc-comparison.md; these are the details.- The PS2 clears the initialised bit and calls
GetVertices(vertices, true)intoV3 vertices[80]. It then sets up the centroid, the particles and the vertex reps. - The PC calls
CRigidBody::UpdateElevatorState(0x573ba0) first. - The PC computes
bUseBBoxinstead of passingtrue. It is true when the elevator reference at +0xec is set, or when a child of the group passes a geom type test (masks 0x9afbe0/0x9afbe4). Other PC bodies use their real mesh vertices, up to 500, in a stack buffer of 0x1770 bytes. PS2 rigid bodies always use bounding-box corners. - The PC sets status bit 0x20 when the geom name contains
Item_Coin(stristr(name, "Item_Coin")).CheckCollision4auses that bit to ignore water hits, andMoveuses it to choose strip mask 2. - The PC caches
ZMaterialDescriptionDB::GetMaterialDescriptionId("Water")in a global at 0x9a1f50. - The PS2 has the same bit (
RIGIDBODY_StatusBit5) andWaterMaterialDescID.Setup2never sets that bit.
- The PS2 clears the initialised bit and calls
CRigidBody::Move, PS2 0x24ad50, PC 0x575250,src/engine/fysix/rigidbody.cpp.- This pair was only
minor. - The relaxation loop is
ProjectConstraints2,CheckCollision4a,ProjectConstraints2. It runs 3 times on the PS2 (for (ii = 0; ii < 3; ii++)) and 4 times on the PC (iVar8 = 4; do { ... } while (--iVar8)). - The rest is the same: the 1e10 bounds, 0.5, 0.6, the 64 KiB collision box and the strip masks 2 and 0x20.
- This pair was only
ZCloth¶
ZCloth::DrawIt, PS2 0x25a254, PC 0x580930,src/engine/fysix/cloth.cpp. On the PS2 the inner loops are VU0 inline assembly, but the differences are in the C parts.- Fixed step. The PS2 runs
while (m_fSyncTimeStep >= 1.0f / 40.0f)and caps the accumulator at 0.12499999. It passes 0.025 toApplyGravityandApplyWind. The PC steps at 0.02, or 50 Hz (_DAT_00762c14), and caps the accumulator at 0.1 (0x3dcccccc). It passes 0.02 (0x3ca3d70a) toApplyGravityandApplyWind. - Obstacles. When
m_iActorCollision == ALL, the PS2 uses radius 30 for the hero and 35 for each dynamicZSTDOBJ. When wind is on, it handles them inside every constraint iteration. The PC uses 30 (0x41f00000) in both cases. It handles obstacles once per step, after the iterations. - The PS2 tail is not in the PC function:
Cloth_UpdatePrims,SetPrimExtraDatafor the vertices and normals, andGetSubPrim. The PC renderer uploads the cloth elsewhere. This part is a platform difference.
- Fixed step. The PS2 runs
engine/geomsbase¶
ZBloodSplatters¶
ZBloodSplatters::ClassFrameUpdate, PS2 0x18f3a8, PC 0x4f6090,src/engine/geomsbase/zprojectmarks.cpp.- The PS2 sets
m_fRunMarkMultiplier = 0.99fevery frame. - The PC sets it to
pow(0.99, g_pSysInterface->DeltaFrameTime * 60). The code isfld qword 0.99,fld [eax+0x50],fmul 60.0,call _CIpow. - The decay of the running blood marks is the same at 60 fps. On the PC it does not depend on the frame rate. The PC is the later version.
- The PS2 sets
Particles (ZParticleTemplate, ZParticleBox)¶
ZParticleTemplate::ClassInit, PS2 0x1883cc, PC 0x4eed30,src/engine/geomsbase/zparticle.cpp.- The PS2 scales all eight colour keys before
CreateColorTable:vscalar(*color, 0.5f); (*color)[3] *= 0.25f;. - The PC has no such loop. Its floats are only 0.0174533 (four times), 0, 1 and the 0.01 friction floor.
- This is the GS colour range, where 0x80 is full intensity. PS2 particle colours are stored at half intensity and quarter alpha. Platform.
- The PS2 scales all eight colour keys before
ZParticleBox::ClassInit, PS2 0x18a538, PC 0x4f1750,src/engine/geomsbase/zparticlebox.cpp.- The PS2 halves
m_fParticleSize(m_fParticleSize *= 0.5f) before it becomes every sprite'sfScale. The PC has no 0.5 and uses the full size. - Settled (round 9): the PC renderer draws the value as a half size, so PC box particles are
twice the PS2's
fScale, and its snow flake is a billboard of that half size in clip units, not in world units (Sprite.fxAmbient_SpritesSnow_VS11). Together with the colours the PS2'sZOldViewPS2::DrawSpritesBoxhalves (and whose alpha it quarters) at draw time and the PC does not, this made the port's snow and rain from the PC installation nearly invisible (PC data: Snow and rain). - The rest is the same: the spawn speed, the
fNrParticlesUVclip table (0.4, 0.7, 0.9, 1.0), the box corners and the 100 warm-up updates. - The flagged
+const 0.7and+const 0.9come from that table, which the PS2 sweep missed.
- The PS2 halves
ZParticleBox::DrawUpdate, PS2 0x18acec, PC 0x4f1290, same file.- Both run once per frame (the
m_lFrameCounttest ofUpdate()). - The PS2 registers
FlipCallBackwithZRenderPS2::AddFlipCallBack, so the particles move when the frame buffer flips. - The PC inlines
Update(). It callsUpdateParticlePositions(DeltaFrameTime * 60)(0x4f0900, with both update loops inlined) directly from the draw update. - The step size is the same; only the moment of the update differs. Platform.
- Both run once per frame (the
ZENVIRONMENT¶
ZENVIRONMENT::ClassInit, PS2 0x17a000, PC 0x4e4bf0,src/engine/geomsbase/zenvironment.cpp. This is PC-only code.- It runs when the search for
*_env_character*finds the character shadow environment (m_lLightConbit 15). - The PC compares the scene name with
striwcmpagainst*M00_MAIN.zip,*M01_MAIN.zip,*M04_MAIN.zipand*M05_MAIN.zip. It gets the name from vtable slot 0x44 ofg_pSysInterface + 0xb8. - In those four scenes it reads both environments' prim light records
(
g_pRenderDll->m_pPrimControl, slot 0x14). If the word at +0x1c of this environment's record is not zero, it copies it into the shadow environment's record. - It looks like a lighting fix for four levels that the PS2 build lacks.
- The word (established on 25 November 2026): the PC's light records are the PS2's base
records (prm.md "Lights"), so +0x1c is
SPrimLight::lStaticShadowColor(zprimcontrolbase.h), an RGB colour with a zero top byte. Dumped at load withOPENBLOOD_SCENEFX_TEST=lights(port/engine/debug/_sdl/scenefxtestsdl.cpp), M00 on either data set:_env_Sun_Light_BelowPier0xd7dce4 (0xd7dce5 on the disc), its character shadow environment_env_character_BelowPier0x3b517d;_Crack_env_background_BRIGHT0x797b7b and_Crack_env_character0x7c7f7f;Sun_Light#010x636e6e; the office environments 0. In M01 the PC's character environments carry 0x83969f and 0xacacac. So in those four scenes the PC gives the character shadow environment the static shadow colour of the environment it belongs to, replacing its own. - What the PC uses it for: the PC effects'
vStaticShadowColor(engine parameter 0x38; the table at PC 0x760fd8 holds 12-byte entries of kind, id and name, and this one's name pointer is at 0x761274), whichStaticShadowTextureShadow.fxsubtracts astex × (1 − vStaticShadowColor), so the colour is the light left in a static shadow. The binder (ZRenderBinderContextD3DFX, PC 0x491150, case 0x38) loads it from the word at +0x78 of a prim record of type 8, as RGB / 255 with w = 1; which prim that is (the light, or the shadow mesh) was not followed. (25 November 2026: type 8 isPRIMTYPE_OBJECT, and word 0x78 of a static shadow object is its shadow colour (prm.md "PC version"), so it is the shadow mesh's own colour; M01's are 0x83969f like its character environments, M05's 0x53575e. The port now draws those meshes with it, pc-data.md: Scenery shadows.) (Corrected 25 November 2026: this page had the id as 0x39, which ism44StaticShadowProjectionMatrix.) The projected static shadows on characters have their own colour in each record (v4TextureProjectionColor, pc-data.md: Static shadows on characters); in M01 it is 0x83969f, the colour the PC's character environments there carry. - The PS2 code never reads
lStaticShadowColor: the prim control only copies it between records (zprimcontrolbase.cpp), the static shadow meshes take their colours from their own prims (ChooseShadowColors), and the character drop shadows from the shadow receivers' constant colour. - The PC's drop shadows do read it (corrected 26 November 2026): the shadow-buffer pass
(PC 0x4b42d0, at 0x4b5672) packs the pair's light record word +0x1c as the RGB of
g_vDropShadowColor(engine parameter 0x3a), andShadowDrop_VS20(Standard20.fx) writes1 − colourinto the shadow buffer: the colour is the light left in a character's drop shadow. So the fix sets how dark the characters' shadows are in those four scenes; in M04's yard the character shadow environment's 0xb1b1a9 becomes the sun environment's 0xa1a197. Withpc_lightingthe port now does the copy (ZENVIRONMENT::ClassInitreplaced inport/engine/geomsbase/_sdl/environmentoverridesdl.cpp) and colours its drop shadows the PC's way (pc-data.md: Character drop shadows).
- It runs when the search for
ZTriangleList¶
ZTriangleList::ClassInit, PS2 0x19afc8, PC 0x4fe7a0,src/engine/geomsbase/ztrianglelist.cpp.- Both set every material's rain texture id to -1.
- The PC also prints
"TriangleList %s Rain Texture id -1 on material %s\n"for every material, with the name fromZGEOM::CalcTotalName. - At the end both read
RainLevelfrom the scene COM. The PS2 passes it toZOldDrawBase::SetRainLevel. The PC reads it into a local and drops it, because it has no PS2-renderer rain.
ZSoundObject¶
ZSoundObject::GetCurrentRoom, PS2 0x1952b4, PC 0x4f9410,src/engine/geomsbase/zsndobj.cpp.- Both query
ZCollisionBase::GetInnerRoomsLstwith a 1×1×1 box atm_vPosition, and both skip a backdrop room. - The PS2 fills the box rotation by copying nine raw floats starting at
m_vOrientation(mcpy). - The PC builds an orthonormal frame with
createmat(mRot, &m_vOrientation, NULL)(lea edx, [esi+0x5c]; push 0; call 0x4375a0). - The PC looks like the fix: the PS2 treats a direction as a matrix. With a unit box, the effect on the room that is found is small.
- The pair is
low, but the rest of the body matches call for call.
- Both query
engine/enginedata¶
ZEngineDataBase: the loading bar¶
-
ZEngineDataBase::SetAllocSequencePercent, PS2 0x146648, PC 0x45aed0,src/engine/enginedata/enginedatabase.cpp.- The table of phase start points changed. The PS2 has 7 entries,
{0, 0.1, 0.2, 0.45, 0.99, 0.995, 1.0}. The PC has 8,{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.8, 1.0}. - The status numbers are the same.
AS_INCLUDESCENE(6) returns early on both. The 0.002 redraw threshold is the same.
Status PS2 range PC range 0 AS_ZIPLOAD0.0 to 0.1 0.0 to 0.1 1 AS_DLCLOAD0.1 to 0.2 0.1 to 0.2 2 AS_TEXTURE(the cache files)0.2 to 0.45 0.2 to 0.3 3 AS_GEOMS(geoms, properties, saved game)0.45 to 0.99 0.3 to 0.4 4 AS_DATABLOCKS0.99 to 0.995 0.4 to 0.5 5 AS_INIT0.995 to 1.0 0.5 to 0.8 6 (returns 0) 0.8 to 1.0, but status 6 still returns early On the PS2,
AllocSequencefills the bar almost to the end: its last call isAS_GEOMSat 0.99999994. On the PC the same calls stop at 0.4. What moves the PC bar further is not established (see Unresolved). - The table of phase start points changed. The PS2 has 7 entries,
-
ZEngineDataBase::Get*Data, PS2 0x141474 to 0x1420dc, PC 0x45ba40 to 0x45c650, same file. Seven pairs:GetStaticData,GetPrimsData,GetGeomsData,GetTextureData,GetSoundData,GetAnimsDataandGetGeomFilesData.- Each cache-file loader reports a fraction of the
AS_TEXTUREphase after it loads. The fractions follow the load order. - The PC changed the order. It loads textures first, then materials, which the PS2 never loads here.
- The PC passes the fractions as immediates: 0x3eae147b, 0x3ed70a3d, 0x3f5c28f6, 0x3e19999a, 0x3e800000, 0x3f11eb85, 0x3f35c28f and 0x3f800000.
Loader (cache file) PS2 fraction PC fraction GetTextureData(tex)0.84 before, 1.0 after (last) 0.0 before, 0.15 after (first) GetMaterialsData(mat)0.25 (never called) 0.25 GetStaticData(buf)0.0 0.34 GetPrimsData(prm)0.14 0.42 GetSoundData(snd)0.28 0.57 GetAnimsData(anm)0.42 0.71 GetGeomsData(gms)0.56 0.86 GetGeomFilesData(zgf)0.7 1.0 (last) - Each cache-file loader reports a fraction of the
ZEngineDataBase: loading and scene change¶
ZEngineDataBase::AllocSequence, PS2 0x143d44, PC 0x45fbc0, same file.- The pair is right. The
structureflag is noise: Ghidra's record of the PC function stops at 0x460040, but the function runs to 0x460bc0 (see Noise patterns). - Load order. The PC calls
InstallTextureBuffer(vtable +0xb4) right after the size checks. Then, ifGetMaterialsSize(+0xe0) is positive, it allocates that size + 0x20000, callsGetMaterialsData(+0xe4) and hands the buffer tog_pRenderDllslot +0x8c. Only then does it load static data, prims, sounds and the rest. The PS2 installs the texture buffer after the prim buffer and never loads materials. - Prim buffer padding. The PS2 installs
CompactPrimBuffer(...) + 0x10000(lPrimBufferPadding). The PC uses+ 0x60000and also reports the block to the debug memory tracker (PC 0x446cf0 under the flag at 0x8aba70; the run had mapped it toZOffsetAlloc::Alloc, which Platform and Audio shows is wrong). - Saved games. The PS2 reads the control and data streams up front, into buffers of
0x6400 and 0xa8400 bytes, through
ZEngineDataCRCInputStream. If either read fails, it setsbLoadGameFailedand loads the level fresh. Later it parses the buffers throughZMemoryInputStream. The PC only notes that a saved game is present. AtExchange("EngineDataBase")it wraps the file streams directly inZEngineDataCRCInputStreamandZCompressedInputStream. It has nobLoadGameFailedand no fallback. - End of the load. When the scene name contains
M00_main,M01_main,M06_mainorM11_mainand no saved game was loaded, the PS2 callsSysInput::instance->IsDialogAllowed(false). This suppresses the controller-disconnected dialog. The PC has none of these strings. - The PC sets
AS_GEOMSto exactly 1.0 at the end. The PS2 uses 0.99999994. The saved-game value 0.95 is the same on both.
- The pair is right. The
ZEngineDataBase::InstallTextureBuffer, PS2 0x14133c, PC 0x45a720, same file.- The PS2 compacts the loaded texture buffer (
g_pRenderDll->CompactTextureBuffer), shrinks the allocation (ZSysMem::Shrink) and installs it. - The PC installs the full buffer (
g_pRenderDllslot +0x7c) and does neither. - Platform: the PS2 packs GS texture data.
- The PS2 compacts the loaded texture buffer (
ZEngineDataBase::DoLoadScene, PS2 0x146d14, mapped to PC 0x45e320, same file.- PC 0x45e320 is
ControlSceneChangewithDoLoadSceneandDoUnloadSceneinlined. Its body starts before the entry, at 0x45cdd0. The PC has no separateControlSceneChange. - No restart. On unload, the PS2
ControlSceneChangecallsNukeAndRestart(sceneName)(src/engine/startup/_ps2/nukeandrestart.cpp). That function resets the stack pointer, re-creates the string manager, re-initialises the system and input, and re-entersRunMainwith the next scene. So every PS2 level starts on a clean heap. The PC unloads in place. It updates the windows twice, unloads, callsZPoolAllocator::ReportHighWaterMarksandZPoolAllocator::ResetAll, and resets the two default statuses. "*premission*". The PC compares the scene name with"*premission*"(striwcmp). On a match it setsg_pSysInterface+0xb0 to 0. Otherwise it copies +0xb4 into +0xb0. The PS2 has no such test.- Demo timeouts. After the load, the PS2 clears
g_lDemoTimeOutMS,g_lDemoGameplayTimeOutMSandg_lDemoFinalTimeOutMS, the demo-disc kiosk timeouts. The PC does not. It calls vtable +0x24 on every window instead.
- PC 0x45e320 is
ZEngineDataBase::MainLoop, PS2 0x1476cc, PC 0x45d530, same file.- Input. The PS2 calls
SysInput::instance->Update()three times per frame: at the start (only whenm_lDontDrawFrame == 0), after the views and afterControlSceneChange. The PCMainLoopnever polls input; the Windows layer does that. - Auto exit. When
m_fAutoExitTimepasses, the PS2 jumps to_exit. The PC prints"\nAutoExit OK!\n"and then exits. - Memory report. When the frame count reaches
DEBUG_WhenToPrintMemory(PC 0x8b906c, whichAllocSequencesets to the frame count + 10) and the debug tracker is on, the PC calls 0x446d90, which looks like a memory dump. The PS2 compiled this out. ScheduledUpdateandFrameUpdateare inlined on the PC. The flagged+call ZScheduledUpdate::AttachEventis reallyScheduleEvents, a mis-mapped callee.
- Input. The PS2 calls
ZGameData and CListUser¶
ZGameData::GetIcon, PS2 0x14adb0, PC 0x4635d0,src/engine/enginedata/gamedata.cpp.- This pair is already listed in
pc-comparison.md. When no pad is in use (g_pSysInterface+0x7b clear), the PC returns the key name and mapsFireWeapon2to"Thumb Button or X". - One more difference: the PC honours
bUpperCase. It upper-cases the name through azstringand copies it into a 32-byte static buffer at 0x8b90dc. The PS2 body ignores the parameter.
- This pair is already listed in
CListUser::CListUser, PS2 0x14c180, PC 0x464250,src/engine/enginedata/listuser.cpp.- The PS2 places the collided-with, unfold and output buffers (3 × 0x200 words) in the
scratchpad (
SPR_LIST_USER). - It also copies the 32 characters of
"I love u Stine Tams, RenderKing"into the start of that buffer. The first list operations overwrite them. - The PC allocates the 0x1800 bytes with
new(line 0x43a) and writes no string. - Platform, with a programmer's message on the PS2 side.
- The PS2 places the collided-with, unfold and output buffers (3 × 0x200 words) in the
scratchpad (
engine/eventsbase¶
ZPostFilterAnimEvent::FrameUpdate, PS2 0x1e3138, PC 0x537dc0,src/engine/eventsbase/postfilter.cpp.- This pair was only
minor. - The PC runs the body only when post filtering is on:
g_pRenderDll->vfunc(+0x44)() != 0 || *(float *)(g_pGameData + 0x84) != 0.0f. When the test fails, the event does nothing. There is noMoveForward, no blend, nog_msgUpdatePostFiltercommand and noDeactivateFrameUpdate. - The PS2 always animates.
- The same gate is in four more PC functions:
ZPostFilterAnimEvent::Init(PC 0x537890, PS2 0x1e27b0) skips its final call.ZPostFilterBoxEvent::FrameUpdate(PC 0x538a60, PS2 0x1e2270) skips its body.ZPostFilterEvent::SetiPrim(PC 0x535180, PS2 0x1dfcdc) calls the same query.ZRenderViewBase::EnablePostfilter(PC 0x469fb0, PS2 0x137384) setsm_bPostfilterEnabled = falseand does not create the post filter. The PS2 version sets it to true unconditionally.- The unmatched PC 0x536400 in
postfilter.cppcalls the same query. - This is probably a PC graphics option that turns post filters off.
- This pair was only
ZScriptC::CreateScript, PS2 0x2003e4, PC 0x548ed0,src/engine/eventsbase/scriptc.cpp.- When a script-memory allocation fails, the PC prints
"Out of script memory creating script %s (script data size:%d, state data size:%d, ref:%x)\n"and then returns 0. The PS2 frees what it took and returns 0 without a message. - The allocation sizes (8, 0x40, 0x14) and the cleanup order are the same.
- This is debug output only. Ghidra marks
printfas noreturn, which is wrong.
- When a script-memory allocation fails, the PC prints
engine/camera¶
ZBaseCamera::Init, PS2 0x228118, PC 0x591ff0,src/engine/camera/basecamera.cpp.- The camera settings read from the scene COM are the same, including the default FOV 67.4 and the fog defaults 0.65 and 0.95.
- The key bindings passed to
Action::instance->AddBindingsdiffer. The PS2BaseCameraControlis"DebugAlways={ToggleFreeCam=tap(kb,k);};". The PC string is"DebugKeys={ToggleFreeCam=tap(kb,k);};DebugKeys={ToggleGates=tap(kb,y);ToggleAlignment=tap(kb,v);};". - On the PS2 the free-camera toggle is in the always-active debug set. On the PC it needs the
debug-key set, and two more debug keys are bound: Y toggles the gates and V toggles the
alignment. The PS2 defines
a_BaseCameraToggleGatesanda_BaseCameraToggleAlignmentbut binds no key to them here.
KeyControlGeom, PS2 0x227460, PC 0x5913a0, same file. This is the debug free camera, mode 0 (g_iFreeCamMode == 0).- The PS2 adds the
TurnCameraandTiltCamerasticks to the turn vector (a0[0] += vTurn[1] * fTime * 204.0f; a0[1] -= vTurn[0] * fTime * 204.0f;). The tilt honoursg_iInvertFreeCam. - The PC calls
Analog()on both actions and drops the values. It has no 204 and no invert flag. - Instead the PC rolls the camera. It rotates the up vector
(0, 1, 0)bya0[2] * 0.01(vrot) beforecreatemat.a0[2]isMoveX * Mode1. The PS2 computesa0[2]but uses it only in thevIsZerotest and keeps the up vector fixed. - Decoded from the disassembly (handles named from their static initialisers: 0x9ab88c
TiltCamera, 0x9ab898TurnCamera, 0x9ab8a4MoveX, 0x9ab8b0MoveY, 0x9ab8bc to 0x9ab8e0Mode1toMode4, 0x9ab94cTurbo): the PC addsMoveY * Mode1toa0[0]andMoveX * Mode1toa0[2]where the PS2 subtracts them; the other terms, the 200 and 6 factors and theMouseConVect1step agree. The rotated up vector is also turned by the camera matrix (vmmul) beforecreatemat, so the roll accumulates. - The PC binds these actions to the keyboard (
ccc={TiltCamera=rel(ms,y);...},DebugAlways={Mode1=|hold(kb,rshift) hold(kb,lshift);...;MoveX=-hold(kb,right) hold(kb,left);...}at PC 0x782470): Shift with the arrow keys rolls and pitches. The PS2 binds the pad and setsMode1=0, so with the disc's bindings the PC code would only drop the right-stick look. - Port: not adopted, and neither is the move of
ToggleFreeCamtoDebugKeys: the port has no switch for the debug keys, so K would stop working; Enhancements: PC version tuning. - The other free-camera modes were not compared line by line.
- The PS2 adds the
engine/collision¶
ZOctreeCompiled::CheckCube, PS2 0x1571ac, PC 0x4c18e0,src/engine/collision/octreecompiled.cpp. This is a platform implementation, not a gameplay change.- The PS2 quantises the box to 16-bit grid coordinates around 32768. It returns early when
the box lies outside the tree, clamps to 0..0xffff, and calls the hand-written assembly
OctreeCompiled_CheckCubewith packeduint16bounds. - The PC quantises through 0x4c0df0 (three
_ftol2calls) and calls 0x4c1860. That function assertsmin <= maxon each axis and starts a C recursion (0x4c1660) at the centre (0x8000, 0x8000, 0x8000). The PC does not clamp and does not return early. - The
-str "DDTExit"in the evidence is a PS2 sweep artefact: the function has no strings. - The
structureflag comes from the PC splitting the work into helpers.
- The PS2 quantises the box to 16-bit grid coordinates around 32768. It returns early when
the box lies outside the tree, clamps to 0..0xffff, and calls the hand-written assembly
PS2 stubs and PC-only code paths¶
ZGameData::InitExcludedAnimNames, PS2 0x43cef4, PC 0x69d6a0,src/engine/enginedata/gamedata.cpp(the onestub-on-one-sidepair here).- The PS2 body is
ZDebugBreak(). - The PC forwards to 0x43b660 (unattributed). That function reads a count, then
length-prefixed names into a 1,024-byte buffer, and builds
zstrings from them. It is a real parser for the animation exclusion list. - Already listed in
pc-comparison.md.
- The PS2 body is
ZScriptC::SetName, PS2 0x1fb3c0. Its true PC partner is 0x549670, which Ghidra never made into a function (it follows 0x549620). It was read with capstone.- The PC builds the same path:
ScriptCModule,OverrideScriptPath,ProjectPath() + "scriptcs/_gamerelease/" + module, andDisableScriptsthroughatof. - It then attaches
module + ".dll"where the PS2 attachesmodule + ".ps2". Scene scripts are DLLs on the PC. - If attaching fails, the PS2 hits
ZDebugBreak()and returns. The PC leavesm_pScriptCreatorunchanged and returns. - The string literals are at PC 0x77b1d4 (
".dll"), 0x77b1dc, 0x77b1ec, 0x77b204 and 0x77b218, referenced from 0x549881, 0x549795, 0x5496d5 and 0x5496a5.
- The PC builds the same path:
ZEngineDataBase::GetMaterialsSizeandGetMaterialsData, PS2 0x141a2c and 0x141aac. Both builds have them, but only the PC calls them, fromAllocSequence. On the PS2 they are dead code.- PC-only paths inside shared functions, listed above:
- the
Item_CoinandWaterlookups inCRigidBody::Setup2; - the ragdoll frame guard in
CRagdoll2::Move; - the four-level shadow fix in
ZENVIRONMENT::ClassInit; - the rain warning in
ZTriangleList::ClassInit; - the post-filter gate in
postfilter.cpp; - the
"*premission*"test and the memory report inZEngineDataBase.
- the
Wrong pairs found¶
| PC | Mapped PS2 | What the PC function is | Correct partner |
|---|---|---|---|
| 0x45b100 | 0x1475e8 ZEngineDataBase::FrameUpdate |
ZEngineDataBase::GetEventScheduler: lazy new of a 0x6c-byte ZScheduledUpdate at line 4818 |
PS2 0x14756c (unmatched). PS2 FrameUpdate is inlined into PC MainLoop 0x45d530 |
| 0x465fb0 | 0x14d714 ZScheduledScript::ZScheduledScript |
ZScheduledUpdate::AddEvent: compares EventName() with "ScriptC", pool-allocates a ZScheduledScript or a ZScheduledEvent and inserts it into running list 0 |
PS2 0x14e070. The constructor is inlined on the PC |
| 0x4e0930 | 0x14e070 ZScheduledUpdate::AddEvent |
ZEventBase::ChangeEventActivity: routcase bits 0x18 and 0x1000, Activate/DeactivateFrameUpdate, scheduler AddEvent/RemoveEvent |
PS2 0x174894 (unmatched) |
| 0x466610 | 0x14dfb4 ZScheduledUpdate::AttachEvent |
ZScheduledUpdate::ScheduleEvents: time budget through TimeStampCounter, 16 priorities |
PS2 0x14dd20, which that run paired with PC 0x4664f0, wrong too (below) |
| 0x465bb0 | 0x14d7cc ZScheduledScript::Sleep |
ZScheduledEvent::SetPriority: asserts priority ≤ 15, sets s_bSleeperChanged and s_bPriorityChange[old] |
PS2 0x14d620 (unmatched) |
| 0x465c50 | 0x14df44 ZScheduledEventList::First |
ZScheduledEventList::InsertSorted: adds the time and walks the ring |
PS2 0x14d8ac (unmatched) |
| 0x52b410 | 0x1d21b0 ZActionController::Add |
ZActionController::Remove: finds the reference and calls ZDistCheck::Remove(idx) for the main list and each evaluator |
PS2 0x1d22cc (unmatched). The real Add is PC 0x52a9a0, which calls 0x52a7f0 (the unmatched ZDistCheck::Add) |
| 0x401100 | 0x1fb3c0 ZScriptC::SetName |
the WinMain-style startup: CreateMutexA("Hitboy"), ERROR_ALREADY_EXISTS, four signal handlers, main.ini beside the executable, "Hitman.cfg", "Hitman Blood Money" |
the real SetName is PC 0x549670 (not a Ghidra function) |
| 0x56f9d0 | 0x245f14 CRagdoll2::ComputeParticlePositionsSub |
the local helper ZHelper::SetStuff(psys, index, v, bInMotion), which GCC inlined 16 times |
the real function is PC 0x5706f0 (1,295 bytes). It calls 0x56f930 (GetLinkMatPos_global) and then 0x56f9d0 for each index, and CRagdoll2::Activate calls it as (bones, true) |
| 0x501510 | 0x1a7bec ZActor::PathChanged |
ZHumanBoid::IsMovementPausing (m_fPauseMovementAtDistance >= 0), inline in boids/clients/human.h on the PS2. PC 0x501530 is IsMovementPaused |
none found for PathChanged; it is probably inlined into its caller (zactor.cpp line 1759) |
| 0x501730 | 0x19ec0c v2GlobalToLocalSpace |
GetV2DirRelativeToActorDir: virtual GetActorRootTM (+0x550), vneg, two v2dot, v2norm |
PS2 0x19ede4. v2GlobalToLocalSpace is inlined on the PC |
| 0x51ce80 | 0x1bded8 ZIKHAND::ZIKHAND |
ZLNKWHANDS::ZLNKWHANDS: base ZCTRLIKLNKOBJ, both ZIKHANDs inlined (bone ids 0x14 and 0x19, MSG_INVERTORYSETACTIVELEFT/RIGHT), m_LHand offset (0, -4, 0), CutSequence_End, the ContactSound and SoundMaterial ids |
PS2 0x1be3a8. ZIKHAND::ZIKHAND is inlined on the PC |
| 0x654c50 | 0x443244 ISerializerStream::Exchange<char> |
a per-element exchange of rUser and iChannel for one ZActorCommunication radio user, which GCC inlined into ZActorCommunication::PostLoad/PostSave (PS2 0x395aa4/0x395b60) |
none found for the template instance |
| 0x4f88b0 | 0x1933fc ZSHAPE::GetSegmentTimeFromPos |
ZSHAPE::GetTimeFromPos: closest segment by vdist2 from 1e38, a debug break, then GetSegmentTimeFromPos inlined (DefineBezier(..., 0.1), GetClosestPoint(..., 10)) |
PS2 0x193504. GetSegmentTimeFromPos is inlined on the PC |
| 0x5932a0 | 0x25f90c CDamper::SetParamsHeavyCar |
CSpring1D::SetParamsHeavyCar with SetParams and SetRestLen inlined: K 25000, D 2000, length 0 → 80, rest length 0 → 0.1 |
PS2 0x2600e4 (unmatched). CDamper::SetParamsHeavyCar is inlined into the PC CDamper constructor 0x592810 (gravity -1000, half length) |
Other mapping problems found on the way:
- PC 0x431050 was mapped to PS2
vlen(0x2beb54, callgraph low, platform), but it is the in-placevsub(a, b)(a[i] -= b[i]). Every pair that calls it gets a false+call vlen(ZGROUP::ResetGroupPosition,ZMovementBaseMove::CalcNewSpeed). - PC 0x43b050 was mapped to the
ZStringMemoryManagerconstructor (0x126c88, callgraph low). It hashes a string and searches buckets, so it isZStringMemoryManager::GetStringObject(0x127204). That function was paired with PC 0x456860, an 81-byte ref-count helper. The wrong pair causes the false-call GetStringObjectinZEngineDataBase::FreeMsgValuesand probably inZAction::End. - PC 0x4664f0 was mapped to
ZScheduledUpdate::ScheduleEvents(0x14dd20). It empties all 16 running lists and the sleeping list and deletes their events. It is more likely the body of~ZScheduledUpdateor a clear helper. -
Unmatched PC functions with a clear PS2 partner:
PC PS2 partner 0x4e0190 ZEntityTracker::GetClosest(0x17420c)0x502830 ZActor::UpdateFootDust(0x1a347c): the dust-disable flag atg_pGameData+0xa14,m_Action[0] == 4, clamp 50, wrap at 1500x52d060 probably ZCheckVisible::ExcludeCellsByDistance(157 bytes on the PC, 152 on the PS2)0x52d100 probably ZCheckVisible::ExcludeCellsByAngleToAxis(154 bytes on the PC, 152 on the PS2)0x5706f0 CRagdoll2::ComputeParticlePositionsSub -
PC 0x4be1c0 is paired with
ZHM3HitmanMovementGuide::GuideToWorldVect(PS2 0x2db304,hitman3/background, out of scope). It is a 15-byte jump tovmmulamong theZCollisionBoxmethods. It is an ICF-folded body that also stands forZCollisionBox::GetRootVect, so the pair can only be right through folding.
Noise patterns¶
These are the false positives that recur. Each has the reason and a possible fix for
compare_pairs.py.
- x87 assert bounds. The PC asserts on floats with
fld/fcomp/fnstswand then a jump toint3. The trap rule only drops integercmp/testimmediates. Seen inZCollisionBase::GetRoomsLst,ZCollisionBox::SetBoxandCreateAAColiBox(1e6),CQuadtree::SetScale(0.0001) andCCutSequenceList::FrameUpdate(2000000). Fix: drop a float loaded in the compare block of a trap jump. -
The PS2
luihistrule invents strings and integers. The rule combines anaddiuwhose base register has no live high half with every high half that register ever held. Examples:ZActor::UpdatePosition, "HitTorsoBack":addiu $t7, $t7, -0x1ed8at 0x1a22c8 belongs tolui $t7, 0x4e(Locomotion::ZStates::m_States) but was paired with an earlierlui $t7, 0x59.ZScriptC::SchedUpdate, "PreviewCamera":addiu -0x1000on a register that once heldlui 0x59.ZActor::LoadSave: the literal 0x2ffb7e0.- Probably also "ZSNDOBJ" (
DeterminePathLookAt), "SoundMoveAround" (CheckPointInsideThetra) and "DDTExit" (ZOctreeCompiled::CheckCube). The PS2 records of these functions have no strings.
Fix: never combine with a
luithat anaddiu/orihas already consumed. Skip the rule when the register was written by anything butluisince then, when the offset is a round negative value (-0x1000, -0x800), or when another candidate lands in.data/.bss. -
Strings reached through a
static const char *global. Both builds load the pointer from.data. The PC record follows the pointer to the literal (PTR_s_..) and the PS2 record does not. Examples:CRigidBody::NAMEandZPhysicsBasedAnimated::NAMEin five fysix pairs (ZShatter::Setup,ZPhysicsLinkage::Init2andReleaseLinkage,ZPhysicsEffect::InitandInit2);- action maps in
CCutSequenceList::LoadInit,ZCutPushSceneOnKeyStart::PostLoadandZWeaponTest::PostLoad.
The texts are identical.
ZBaseCamera::Initis the one case in this group where the string really differs. Fix: on the PS2 side, whenlui/lwloads a.dataword that points at a C string in.rodata, add that string. -
Strings in local
constinitialiser tables.ReadActivateButtonbuilds aSButtonName[10]table of pointers on the stack. The PS2 sweep reads float initialisers but not pointer tables. Fix: followlwwords from a.rodatainitialiser that point at strings. - PS2 float sweep misreads after branch-likely. In
CParticle1D::GetMasstheluifor 1e38 sits in abc1fldelay slot. The sweep misses 1e38 and reports-const 1.424702e13, which is the data word 0x554f5249.ConstrainedParticleSystem::HandleCollision(-const 8) andZeroOut(?-const 0.1774) show values that are not in the source either. Worth a look at thelwc1follow indisasm_ps2. RAND_MAX. newlib'sRAND_MAXis 2^31 - 1 and MSVC's is 0x7fff. Sorand() * 20 / 2^31(9.31e-9) on the PS2 isrand() * (1 / 32767) * 20(3.05e-5) on the PC, with the same range. Seen inZHumanBoid::ZHumanBoidandZHumanBoid::AvoidBoids. Fix: divide a PS2 float by 65536 and match it against a PC float × another PC float, or drop 3.051851e-5 and 1/2^31 multiples when the function callsrand.- Dead debug-draw stores GCC keeps. GCC materialises literals into locals that are never
read, left over from compiled-out debug drawing, and MSVC removes them. Seen in
PF4RunTime::ZData::CloseExit(V3 s = {30, 30, 30}),FindPath({10, 200, 10}, +190),ZCastLnkObj::ClassFrameUpdate(vset(s0, 2, 2, 10)) andZPATHGROUP::CreatePath(vset(s, 100, 0, 100)). Fix: ignore a one-sided PS2 float that is only stored to a stack slot that is never loaded. - Pointer-difference and strength-reduced loop bounds.
aStackPtr - aStack < 100on anintarray is< 400bytes on the PC (FindComponents,FindWalls). IngenerateLookupTables,i < 0x102became the byte bound 0x181c. Fix: let acmpliteral match 2×, 4×, 8× or 12× a literal of the other side. -
Float bit patterns used as integers.
ZCloth::CollidePlanescompares -500.0f as an integer (IsShorterThan): the PC0xc3fa0000is read as a float, the PS2lui 0xc3fais not.Animation::Model::AnimateStateandStateFittestm_AimDir[0] != -2.0fascmp 0xc0000000.ZGROUP::ResetGroupPositionpushes the flag 0x40000000 (2.0).CCutSequenceList::GetObjectReftests the mask 0x40040000 (2.0625).
Fix: match a PC float literal against PS2 integer immediates of the same bits. Do not read single-bit pushes or
test/andoperands as floats. -
PS2 scratchpad addresses. 0x70000000 and up (
SPR_ANIM_STATE,SPR_LIST_USER) are addresses, not literals. They appear as-int 1879048192and nearby values inAnimateStateandDePackVector. Fix: treat 0x70000000 to 0x70003fff as an address. -
ICF folding of an unmapped or different callee.
- The in-place
qneg(q)andvneg(v)have the same body, so the PC calls one function (0x4362c0, mappedvneg).AnimateStateandStateFitshow a false+call vneg. ZSoundLimiterFade::CheckInsideandZMusicLocations::IsInsidefolded into 0x547460, which flags bothCanPlayInRoompairs.CParticle1D::SetParamsHeavyCarfolded into the emptyEditPrint.
Fix: when a PC callee's PS2 partner has a byte-identical twin that the PS2 function calls, count it as the same callee.
- The in-place
-
The statically linked MSVC CRT helpers are filed as
lib:quazal. Ghidra itself names some of them. They are:- 0x727d4c,
_ftol2, the float-to-int helper (117 bytes); - 0x727cc0,
__chkstk; - 0x727ee0,
__allshr.
They give
~+lib lib:quazalinDePackVector,ZCheckVisible::FrameUpdate,ZGeomParticle::FrameUpdate,ZProjectileBase::ShotImpact,CRigidBody::MoveandZParticleEmitter::ClassFrameUpdate. Across the whole ofdiffs.tsv, 474 rows havelib:quazalinminor. Fix: give the CRT run around 0x727000 its ownlib:crtcategory inpc-classes.tsv(the Quazal range is said to end at 0x722000) and ignore these helpers likefloor. - 0x727d4c,
-
Small helpers kept out of line on the PC. The call graph pairs these with the nearest PS2 function, which gives false
callsand wrong pairs:ZVector2f::Lengthasv2leninFindComponentPathAStarandFindWallIntersection;ZHumanBoid::IsMovementPausing;minTransformQuat(0x588f10);- an asserting float setter (0x501420);
- a 2×2 matrix multiply (0x435ce0);
- an 11-field record constructor (0x510120);
- a sin/cos helper (0x435a30).
Fix: add PC callees of at most 32 bytes that only jump to a math helper to the "GCC inlined" set when the PS2 line table shows an inline from
zmath.horzvector*.h. -
Inlined callees with a branch each.
ZMovementBaseMove::GetAnimsinlinesSetAnimHandle13 times, each withif (handle < 0), so PS2 0 branches against PC 13 tripsstructure. Fix: when the PC inlines a callee N times, add N times its branch count to the expected PC branches. ZPoolAllocator::Allocis missing from the allocators.ZLNKWHANDS::CreateLnkActionhas 13newnull checks after inlined classoperator news that callZPoolAllocator::Alloc. Fix: add it to the allocation callees.zstringassignment and STL inlining.- GCC inlines
zstring::operator=with its refcount. MSVC inlines one assignment, calls one out of line, and keeps assert traps in the refcount code. This causes thestructureflag inZAction::SetNames(96 against 472 bytes) and-call GetStringObjectinZAction::End. - The PS2 inlines STLport
map::operator[]andrb_treehelpers, and the PC calls its own (FixupSaveTable,ZScriptC::PostLoad).
- GCC inlines
- Devirtualisation when the virtual-call counts are equal. In
ZParamAnim::FrameUpdatethe PC callsZRunParamAnim::Keythrough the member's vtable and GCC calls it directly. The rule only fires when the PC has more virtual calls. Fix: also apply it when the counts are equal and the missing PS2 callee is virtual. -
Constant folding.
ZMovementBaseMove::CalcNewSpeed: MSVC merges the equal armsDegToRad(a * 5)anda * DegToRad(5)into one multiply by 0.0872665.ZLNKOBJ::CalcCenSize:vlenof three equal components becomessqrt(m * m * 3).ZActor::DeterminePathLookAt:x / 150 * 1.5against the PS2's folded 0.009999999.
The small integers 3 and 5 and the factor 1.5 are folding factors.
-
Truncated Ghidra bodies.
AllocSequence's PC record ends at 0x460040 (1,153 bytes), but the function runs to 0x460bc0. Thestructureflag and every-str/-callitem came from the missing part. PC 0x45e320 starts its body before the entry (min0x45cdd0). Fix: use the distance to the next function start inindex.tsvwhen it exceedsmax - min, and mark the items unknown when the body looks cut short. - Large frame offsets read as literals. In
CreateGeoms, 41140 to 41204 (0xa0b4 to 0xa0f4) are stack offsets past 32 KiB. Fix: anaddiuto$sp, or to a pointer that is then dereferenced, is anoffset. - Pointer bytes read as a PC string.
CheckBloodSplattergets+str "!\rR<rCrowd", which is pointer words followed by "Crowd". Fix: reject a string that starts with control bytes or is not the start of a defined string. - A
callsflag that rests on one shifted family pair. All four scheduler call differences andFreeMsgValuescome from wrong callee pairs. Fix: make acallsitem weak when its only support is a callee from alowcall-graph pair.
Unresolved¶
- The PC loading bar after 0.4. The PC table reserves 0.4 to 1.0 for statuses 4 and 5 and a
seventh range. No PC call passing 4 or 5 to
SetAllocSequencePercent(vtable +0x38) was found. A call with the status in a register would not show in the search.ZLoader_Sequence_Player::Set_Progressmay also rescale on the PC. This was not checked. "*premission*". Theg_pSysInterfacefields +0xb0 and +0xb4 that it sets in PCControlSceneChangeare not named. The per-window call (+0x24) after the load and the doubled window loop (+0x30) before the unload were not identified either.- The post-filter gate. The name of render-DLL slot +0x44 and of the float at
g_pGameData+0x84 is unknown. The PCZRenderDllvtable does not line up with the PS2 one, and the PC menu code that writes +0x84 was not traced. ZENVIRONMENT::ClassInit. The word at +0x1c of the prim light record islStaticShadowColor(see ZENVIRONMENT); the binder loadsvStaticShadowColorfrom +0x78 of a type-8 prim record (PC 0x491150, case 0x38), and whether that record's +0x78 is the light record's +0x1c was not checked.- Particle scaling. Whether the PC applies the 0.5 size and the 0.5/0.25 colour scale
elsewhere was not checked.
ZParticleTemplate::CreateColorTable(PC 0x4ee500) has 1/255 and 1/127 but no 0.5 or 0.25. - The coin bit on the PS2. Whether the PS2 sets
RIGIDBODY_StatusBit5anywhere other thanSetup2was not searched. If it does not, PS2 coins collide with water and use strip mask 0x20. - The
bUseBBoxgeom type. The class behind the masks 0x9afbe0/0x9afbe4 in PCCRigidBody::Setup2was not resolved. ZScriptC::SetNameon the PC was read from raw disassembly (0x549670 to 0x54997e), so its callees are named only from the call order (0x43bf40 asScriptEngine::AttachSceneScripts, 0x548e20 asFindScript).- No PC partner was found for
ZActor::PathChanged(PS2 0x1a7bec) orISerializerStream::Exchange<char>(PS2 0x443244). Both may be inlined everywhere on the PC. KeyControlGeom: only free-camera mode 0 was compared in detail. It is not known which side is the later version.