Crusader_Decomp/docs/usecode-unreferenced-candidates.md
Maddo e00f9f3186 Enhance teleporter and map rendering tests
- Added initialization of startup processes in flex_archive_tests to ensure proper setup before teleporter operations.
- Updated assertions to verify the correct allocation and state of processes during teleporter execution.
- Introduced new tests in map_renderer_tests to validate shape rendering, including isolated shape rendering and player sprite integration.
- Enhanced map_sorter_tests with additional checks for occlusion handling and boundary conditions in render order resolution.
2026-10-06 21:07:35 +02:00

6.6 KiB

Crusader USECODE Unreferenced-Body Candidates

Status: Static reference scan with a separately identified debug-only class
Scope: Main local Remorse and Regret EUSECODE.FLX corpora
Scanned: 2026-10-06

Result

The current bytecode scan found 20 Remorse and 24 Regret non-empty high-slot event bodies with no incoming explicit class/event call or spawn reference from any decoded body in the same corpus. The FLICTEST slot-0x21 bodies are identified below as debug movie-player code, confirmed unused as ordinary retail gameplay; the other 19 Remorse and 23 Regret entries remain unclassified candidates.

Variant Bodies scanned Decoded call/spawn references No-incoming bodies Confirmed debug-only Unclassified candidates
Remorse 977 2,878 20 1 19
Regret 1,152 3,415 24 1 23

Candidate Lists

A candidate is identified by its class id and event slot. Body size is in bytes. The names are the extracted class-name hints.

Remorse

Class ID Class Slot Body bytes
0x0A1E ITEM 0x20 86
0x0A1E ITEM 0x21 159
0x0A20 FLICTEST 0x21 9,901
0x0A17 TEXTFILE 0x22 229
0x0A1E ITEM 0x22 101
0x0A09 ELEVAT 0x25 524
0x0A11 NPC 0x25 203
0x0A1E ITEM 0x25 1,093
0x0A11 NPC 0x26 494
0x0A1E ITEM 0x26 968
0x0A0C FREE 0x27 223
0x0A11 NPC 0x27 329
0x0A0C FREE 0x2A 224
0x0A1E ITEM 0x2C 139
0x0A0C FREE 0x34 136
0x0A0C FREE 0x35 97
0x0A0C FREE 0x36 91
0x0A0C FREE 0x37 89
0x0A0C FREE 0x38 78
0x0A0C FREE 0x39 106

Regret

Class ID Class Slot Body bytes
0x05D8 TRAMFLOR 0x20 645
0x0A0A FLICTEST 0x21 11
0x0A0C ITEM 0x22 68
0x0A16 TEXTFILE 0x22 142
0x0A0C ITEM 0x23 43
0x0A08 ELEVAT 0x25 324
0x0A0F NPC 0x25 105
0x0A0F NPC 0x26 267
0x0A0C ITEM 0x27 655
0x0A0F NPC 0x27 193
0x0A0C ITEM 0x28 579
0x0A1D FREE 0x28 170
0x0A0F NPC 0x2B 169
0x0A0C ITEM 0x2E 80
0x0A1D FREE 0x2F 197
0x0A1D FREE 0x30 127
0x0A1D FREE 0x33 98
0x0A1D FREE 0x3D 93
0x0A1D FREE 0x3E 36
0x0A1D FREE 0x3F 36
0x0A1D FREE 0x40 33
0x0A1D FREE 0x41 35
0x0A1D FREE 0x42 47
0x0A1D FREE 0x43 35

Confirmed Debug-Only Code

The FLICTEST class is a debug movie-player/helper, not normal retail gameplay content. Its unreferenced slot-0x21 body appears in each candidate table above:

  • Remorse: class 0x0A20, FLICTEST::0x21, 9,901 bytes.
  • Regret: class 0x0A0A, FLICTEST::0x21, 11 bytes.

This classification is about the feature's retail gameplay status, not whether the code or class exists in the shipped archive. In both variants, FLICTEST::0x20 has explicit script references and is therefore not in the no-incoming list. The longer class-specific investigation documents the debug movie-browser behavior and the remaining routes/evidence: FLICTEST usecode investigation.

Cross-Reference: Removed Shapes

The removed-item note describes shapes, while this scan lists non-empty USECODE class/event bodies. A removed shape with no corresponding class is absent from this list by construction; it is not an unreferenced body.

  • 0x034E concussion grenade: not in the candidate list. The Remorse and Regret class/event indexes contain no class with class id 0x034E; the removed-item investigation also found no separate Remorse USECODE class. The surviving name/map data does not establish a script body.
  • 0x034F nerve gas grenade and 0x0350 EMP grenade: likewise, no class/event bodies with those class ids were found in either index. In Regret, 0x0350 is still a resolved bomb display-name entry, but that does not make it a USECODE class.
  • 0x0343 old grenade: not an unreferenced candidate. It is the separate GRENADE class (id 0x0343), with non-empty hit and gotHit handlers; the removed-item note also records Pepsi dispenser scripts attempting to create this shape.
  • 0x0548, 0x0110, and 0x0112: these are suspicious/unmapped shapes in the removed-item note, not class/event ids identified by this body scan. Their absence here says nothing by itself about native item behavior.

See removed item shapes for the source evidence and qualifications.

Method

  • Scanned every non-empty body in the Remorse class_event_index.tsv and Regret class_event_index.tsv.
  • Parsed bodies with the existing poc_crusader_usecode_parser.py, collecting explicit targets from bytecodes 0x11 (class/event call), 0x57 (spawn), and 0x58 (inline spawn).
  • Counted incoming references by (class id, event slot). Candidates are non-empty bodies at slots 0x20 and above with no incoming reference in that graph. The scan completed with zero parser errors, unknown-opcode bodies, or targets lacking a non-empty indexed body.
  • Limited the candidate list to high slots because the common low event slots have engine/native dispatch paths; a body at one of those slots may be an entry point without any bytecode caller.

Limits and Interpretation

"No incoming bytecode reference" is not equivalent to "unused in the final game." The scan cannot rule out native code dispatching a high slot dynamically, references encoded in game data or outside these two archives, behavior reached through unmodeled runtime paths, or content/version differences. It also does not measure whether an explicit call site is actually reachable or executed. The FLICTEST classification is based on the separate debug-player investigation and should not be generalized to its explicitly referenced slot-0x20 body.

The common event catalog documents native entry points and explains why an empty slot, an unreferenced body, and a confirmed dead body are different claims: usecode-event-slots-catalog.md. This list should be upgraded only after checking candidate callers in the executable and references in the corresponding final-game data.