acdream/docs/research/acclient_function_map.md
Erik 69d884a3d6 tools(pdb-extract): #8 PDB -> symbols.json + types.json sidecar
Pure-Python MSF 7.00 PDB extractor (no deps, stdlib only). Reads
refs/acclient.pdb directly:
  - DBI stream (3) -> symbol record stream index + section header
    stream index
  - Section headers stream (9) -> per-segment image VA bases
  - Symbol record stream (8) -> S_PUB32 records with image VAs
  - TPI stream (2) -> LF_CLASS / LF_STRUCTURE named records (not
    forward-declared), with size leaf + name

Includes a best-effort MSVC C++ demangler so symbols.json is
grep-friendly:
  ?EnchantAttribute@CEnchantmentRegistry@@QBEHKAAK@Z
  -> CEnchantmentRegistry::EnchantAttribute

Both demangled `name` + raw `mangled` emitted per entry so callers
can choose. Operator overloads, vtables, and other special forms
where a partial demangle would be misleading are kept mangled.

Outputs committed to docs/research/named-retail/:
  - symbols.json (2.9 MB) — 18,366 named public function symbols
  - types.json (506 KB) — 5,371 unique named class/struct records

Spot check (matches discovery agent's earlier finding):
  CEnchantmentRegistry::EnchantAttribute -> 0x00594570 ✓

Updated docs/research/acclient_function_map.md header preamble to
direct readers at the new symbols.json as the authoritative name
source; the hand-curated table stays as the cross-port (ACE/ACME)
index. Several addresses there are wrong vs the PDB and will be
swept in the issue #9 close (Phase E).

Closes #8 (filed in Phase D's commit). Foundation for the address
sweep + name-driven workflows from here on.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 17:31:52 +02:00

159 lines
8.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# acclient.exe Decompiled Function Map
Hand-curated cross-port index: maps select retail functions to our
C# implementations + ACE / ACME equivalents + struct-offset notes.
**This is the cross-port index, not the authoritative name list.**
For raw symbol→address lookup the authoritative source is
`docs/research/named-retail/symbols.json` (18,366 entries from
`refs/acclient.pdb`, the Sept 2013 EoR build PDB). Regenerate via
`py tools/pdb-extract/pdb_extract.py refs/acclient.pdb`. Several
addresses below were corrected against `symbols.json` in commit
that closed issue #9 — match by name when in doubt.
Mapped from 22,225 decompiled functions (688K lines of C, the
`docs/research/decompiled/` Ghidra chunks) against ACE's C# physics
port and ACME's ClientReference.cs. Now augmented by the named
retail decomp at `docs/research/named-retail/`.
## CPhysicsObj (chunk_00510000.c, chunk_00500000.c)
| Address | FUN name | ACE method | Description |
|---------|----------|-----------|-------------|
| 0x515020 | FUN_00515020 | PhysicsObj::update_object | Top-level per-frame update |
| 0x5111D0 | FUN_005111d0 | PhysicsObj::UpdatePhysicsInternal | Euler integration: `pos += vel*dt + 0.5*accel*dt²` |
| 0x511420 | FUN_00511420 | PhysicsObj::calc_acceleration | Sets gravity (-9.8 Z) when Gravity flag set |
| 0x511EC0 | FUN_00511ec0 | PhysicsObj::set_velocity | Stores velocity, clamps to MaxVelocity (50.0) |
| 0x511FA0 | FUN_00511fa0 | PhysicsObj::set_local_velocity | Body→world transform then set_velocity |
| 0x511DE0 | FUN_00511de0 | PhysicsObj::set_on_walkable | Sets/clears OnWalkable transient flag |
| 0x511560 | FUN_00511560 | PhysicsObj::report_collision_start | Fires environment collision callback |
| 0x513AC0 | FUN_00513ac0 | PhysicsObj::report_collision_end | Fires collision-end callback |
| 0x513B60 | FUN_00513b60 | PhysicsObj::handle_obj_collision | Object-to-object collision dispatch |
| 0x515280 | FUN_00515280 | PhysicsObj::handle_collision | Elasticity bounce response |
| 0x513730 | FUN_00513730 | PhysicsObj::UpdatePositionInternal | Position advance + interpenetration resolve |
| 0x50F940 | FUN_0050f940 | PhysicsObj::calc_friction | Friction from ground normal + slope |
| 0x510080 | FUN_00510080 | PhysicsObj::check_contact_velocity | Velocity vs contact normal check |
### PhysicsObj Struct Layout
| Offset | Field | Type |
|--------|-------|------|
| +0xA8 | State (PhysicsState flags) | uint |
| +0xAC | TransientState | uint |
| +0xB0 | Elasticity | float |
| +0xD8 | LastUpdateTime | double |
| +0xE0/E4/E8 | Velocity XYZ | float[3] |
| +0xEC/F0/F4 | Acceleration XYZ | float[3] |
| +0xF8/FC/100 | Omega XYZ | float[3] |
| +0x12C | WeenieObject ptr | ptr |
| +0x130/134/138 | Ground normal XYZ | float[3] |
## CMotionInterp (chunk_00520000.c)
| Address | FUN name | ACE method | Description |
|---------|----------|-----------|-------------|
| 0x5286B0 | FUN_005286b0 | MotionInterp::get_jump_v_z | Jump Z velocity (delegates to WeenieObj) |
| 0x528660 | FUN_00528660 | MotionInterp::jump_charge_is_allowed | Can charge jump? |
| 0x5285E0 | FUN_005285e0 | MotionInterp::motion_allows_jump | Current anim permits jump? |
| 0x528EC0 | FUN_00528ec0 | MotionInterp::jump_is_allowed | Top-level jump permission |
| 0x528CD0 | FUN_00528cd0 | MotionInterp::get_leave_ground_velocity | Full 3D launch vector |
| 0x529390 | FUN_00529390 | MotionInterp::jump | Initiate jump |
| 0x529710 | FUN_00529710 | MotionInterp::LeaveGround | Reset jump state on airborne |
| 0x5296D0 | FUN_005296d0 | MotionInterp::HitGround | Landing handler |
| 0x528960 | FUN_00528960 | MotionInterp::get_state_velocity | Compute velocity for current motion |
| 0x528A50 | FUN_00528a50 | MotionInterp::StopCompletely | Reset to Ready/idle |
| 0x5287F0 | FUN_005287f0 | MotionInterp::adjust_motion | Apply pending motion adjustments |
| 0x5293F0 | FUN_005293f0 | MotionInterp::apply_raw_movement | Raw→interpreted state conversion |
| 0x529210 | FUN_00529210 | MotionInterp::apply_current_movement | Set physics velocity from interpreted state |
| 0x528DD0 | FUN_00528dd0 | MotionInterp::contact_allows_move | Slope angle check |
| 0x528F70 | FUN_00528f70 | MotionInterp::DoInterpretedMotion | Core animation state machine |
| 0x529080 | FUN_00529080 | MotionInterp::StopInterpretedMotion | Stop specific interpreted motion |
| 0x529140 | FUN_00529140 | MotionInterp::StopMotion | Stop specific raw motion |
| 0x529930 | FUN_00529930 | MotionInterp::DoMotion | Process one raw motion command |
| 0x529A90 | FUN_00529a90 | MotionInterp::PerformMovement | Top-level dispatcher (switch 1-5) |
### MotionInterp Struct Layout
| Offset | Field | ACE name |
|--------|-------|----------|
| +0x04 | WeenieObject ptr | WeenieObj |
| +0x08 | PhysicsObject ptr | PhysicsObj |
| +0x14 | RawMotionState start | RawState |
| +0x20 | ForwardCommand | RawState.ForwardCommand |
| +0x28 | ForwardSpeed | RawState.ForwardSpeed |
| +0x2C | SideStepCommand | RawState.SideStepCommand |
| +0x38 | TurnCommand | RawState.TurnCommand |
| +0x44 | InterpretedMotionState start | InterpretedState |
| +0x4C | InterpretedState.ForwardCommand | |
| +0x50 | InterpretedState.ForwardSpeed | |
| +0x70 | StandingLongJump | bool |
| +0x74 | JumpExtent | float |
| +0x7C | MyRunRate | float |
## CLandBlockStruct (chunk_00530000.c)
| Address | FUN name | ACE method | Description |
|---------|----------|-----------|-------------|
| 0x531D10 | FUN_00531d10 | IsSWtoNECut | Split direction helper (inner) |
| 0x532A50 | FUN_00532a50 | ConstructPolygons | Outer 8×8 loop with 0xCCAC033 constants |
| 0x532EB0 | FUN_00532eb0 | GetCellRotation / ConstructUVs | PalCode computation |
| 0x532D10 | FUN_00532d10 | unpack | Deserialize from dat stream |
| 0x531F10 | FUN_00531f10 | get_packed_size | Returns 0xF4 (244 bytes) |
| 0x532440 | FUN_00532440 | AdjustPlanes | Normal accumulation + lighting |
| 0x532290 | FUN_00532290 | CalcCellWater | Water depth check |
## CLandBlock (chunk_00530000.c)
| Address | FUN name | ACE method | Description |
|---------|----------|-----------|-------------|
| 0x530690 | FUN_00530690 | Init / constructor | Initialize landblock fields |
| 0x5307E0 | FUN_005307e0 | release_all | Free all resources |
| 0x531780 | FUN_00531780 | init_static_objs | Load static objects from LandBlockInfo |
| 0x531000 | FUN_00531000 | release_visible_cells | Free cell data |
| 0x5301E0 | FUN_005301e0 | grab_visible_cells | BFS neighbor expansion |
| 0x530650 | FUN_00530650 | add_server_object | Add entity to landblock |
## LandDefs (chunk_005A0000.c)
| Address | FUN name | ACE method | Description |
|---------|----------|-----------|-------------|
| 0x5AAA30 | FUN_005aaa30 | get_vars | Set 8 coordinate constants |
| 0x5AABB0 | FUN_005aabb0 | get_outside_lcoord | Cell ID → world coord |
| 0x5AAC70 | FUN_005aac70 | AdjustToOutside | Normalize position to outdoor coords |
| 0x5AAB50 | FUN_005aab50 | get_block_dir | Quadrant → Direction enum |
## Collision / Transition (chunk_00530000.c)
| Address | FUN name | ACE method | Description |
|---------|----------|-----------|-------------|
| 0x5384E0 | FUN_005384e0 | Sphere::SphereIntersectsRay | Ray-sphere intersection |
| 0x539500 | FUN_00539500 | Polygon::sphere_intersects_poly | Sphere-polygon contact |
| 0x539750 | FUN_00539750 | Polygon::sphere_intersects_solid | Both-side penetration |
| 0x539BA0 | FUN_00539ba0 | Polygon::find_time_of_collision | Ray-plane-polygon t |
| 0x539DF0 | FUN_00539df0 | Polygon::find_time_of_collision | Cylinder variant |
| 0x53A040 | FUN_0053a040 | Polygon::find_walkable_collision | Edge normal return |
| 0x539110 | FUN_00539110 | Polygon::calc_normal | Face normal from vertices |
| 0x539060 | FUN_00539060 | Plane::ray_plane_intersect | Basic ray-plane t |
| 0x538EB0 | FUN_00538eb0 | Sphere::slide_sphere | Slide along surface |
| 0x538F50 | FUN_00538f50 | Sphere::land_on_sphere | Step down to surface |
| 0x538180 | FUN_00538180 | CTransition::collide_with_point | Point collision handler |
| 0x5387C0 | FUN_005387c0 | CTransition::find_collisions | Main collision loop |
| 0x53A230 | FUN_0053a230 | Polygon::hits_walkable | Walkable surface check |
## WeenieObject vtable (confirmed from call sites)
| vtable offset | ACE method | Called from |
|--------------|-----------|------------|
| +0x30 | InqJumpVelocity | get_jump_v_z |
| +0x34 | InqRunRate | get_state_velocity |
| +0x3C | CanJump | jump_is_allowed |
| +0x4C | HandleCollisionEnd | report_collision_end |
| +0x50 | HandleCollisionStart | handle_obj_collision |
| +0x54 | HandleMissileCollision | handle_obj_collision |
| +0x58 | HandleEnvironmentCollision | report_collision_start |
## PhysicsEngine (chunk_00450000.c)
| Address | FUN name | ACE method | Description |
|---------|----------|-----------|-------------|
| 0x452A10 | FUN_00452a10 | PhysicsEngine::update | Main simulation loop |