Crusader_Decomp/docs/jp-remorse-handoff-2026-10-12.md
2026-10-12 00:41:16 +02:00

4.5 KiB

JP Semantic-Gap Investigation Handoff

Date: 2026-10-12

Resume Context

  • Workspace: Crusader_Decomp
  • Live Ghidra target: /ja/CRUSADER.EXE, image base 00400000
  • Main ledger and active backlog: JP decompilation progress, under Semantic-Gap Analysis Checkpoint and Next Work
  • Coverage script: tools/jp_executable_documentation_report.py

The user asked to investigate five semantic-gap areas and add follow-up tasks to the JP ledger. That static pass is recorded in the progress document. The current investigation made no Ghidra database edits, saved no Ghidra state, and changed no executable bytes. Any pre-existing pending Ghidra changes were left untouched.

Verified Baseline

The latest read-only coverage report for the active JP program reports:

  • Function entries tracked: 1,493 / 1,493 (100%); untracked: 0; generated names: 0
  • Function-body coverage: 336,693 / 499,712 bytes (67.4%)
  • Defined-instruction coverage: 399,698 / 499,712 bytes (80.0%)
  • Executable bytes outside defined instructions: 100,014; these may be data, padding, or unanalyzed code
  • Five ledger table addresses are not function entries: 004811f3, 004811f9, 00481200, 00481208, 0048120d

Do not treat the remaining byte percentage or those five table addresses as proof of missing functions.

Findings So Far

  • Action dispatch: selectors 0, 4, 0x21, 0x39, and 0x3b all construct a type-0xf0 process through process_0x0f0_construct_for_item, then install distinct callback tables. The selector callbacks still need semantic names.
  • Attack process: type 0x259 is constructed by AttackProcess_0040af20. The process_choose_direction_to_coords 0xff path checks a nonzero +0x64 value, shape overlap, and a packed-position query before dispatching selector 0; the meanings of DAT_0047b1d6, +0x64, and process byte +0x7d remain open.
  • Cache and records: the keyed cache has ten rotating key slots and 256 entry pointers per slot. The 16-bit key is looked up at file offset key * 4; descriptor low byte +4 controls count and bit 0x40 at +7 selects 0x40/0x80 bytes per entry. The pair reader copies two dwords. The separate 16-byte item snapshot layout is mapped in the progress ledger; the main item table has stride 0x79.
  • Animation and spatial search: AnimationProcess uses type 0x230 and vtable 0047e7a8; its constructor clears +0x52, and a helper sets it to one. Its sole caller, 00411fcd, is code with no owning Ghidra function. The spatial grid uses 64 two-byte cells per 0x80-byte row; selector coordinates step by 0x200 and use >> 9 for grid indexing.
  • Input and presentation: joystick actions 4-8 emit u/g/s/m/e; action 9 maps directions to q/w/i/o; process byte +0x62 selects distinct handling. Startup dialog resource 0x71 opens only for positive direction flags; a zero dialog result aborts startup. The DirectDraw lock helper has no restore branch. The debug timeline helper's sole caller is unowned code at 00455bb6.
  • Boundaries/debug: 00411fcd and 00455bb6 are confirmed call sites but have no containing function. The timeline consumer/fields and writer for DAT_004955e8 remain unresolved.

No runtime test of the joystick dialog or presentation paths was performed, and no JP/Western semantic comparison was made.

First Steps Tomorrow

  1. Open or confirm the live /ja/CRUSADER.EXE target before using Ghidra MCP. Use MCP-only analysis; do not use the offline PyGhidra CLI.
  2. Read the Semantic-Gap Analysis Checkpoint and Next Work sections in the JP decompilation progress ledger.
  3. Start with boundary triage around 00411fcd and 00455bb6: inspect surrounding disassembly, control flow, and references to determine whether each belongs to a larger routine. Do not create or name a function until bounds are supported.
  4. Continue with the prioritized backlog in the ledger: action callback/type-0x259 contracts, cache and field semantics, animation/spatial details, then joystick/dialog/DirectDraw/debug-timeline paths.
  5. Re-run the read-only coverage script when useful to confirm the exact-entry baseline. Leave Ghidra project saving to the user and never patch bytes in the reference executable.

Worktree Note

docs/jp-remorse-decompilation-progress.md was already locally modified before this investigation. Those existing edits were preserved; this work updated the bottom checkpoint/backlog and corrected its heading structure. The current changes have not been committed.