Refactor USECODE tooling documentation and enhance map-viewer decompiler

- Updated the USECODE Tool Improvement Plan to focus on the map-viewer decompiler/editor, emphasizing its role as the primary development target for USECODE editing and recompilation.
- Revised the tooling comparison document to include the newer map-viewer decompiler, clarifying its purpose and distinguishing it from the Python parser.
- Introduced a new ClearAvatarInStasisProcessEntry structure in the entity dispatch entry header, along with related process creation and execution logic in the ProcessKernel.
- Implemented the setItemShape method in LiveFixedMapItems to allow dynamic shape updates for items.
- Enhanced the teleporter process to handle avatar stasis and integrated it into the game main loop, ensuring proper process management and state handling.
- Added tests for the new functionality, including shape setting and teleporter process behavior, to ensure correctness and stability.
This commit is contained in:
Maddo 2026-10-06 00:01:20 +02:00
commit 6d4972933f
17 changed files with 1868 additions and 114 deletions

View file

@ -2,11 +2,12 @@
## Purpose
This note compares three different USECODE-facing tool lines now in use around the Crusader work:
This note compares four different USECODE-facing tool lines now in use around the Crusader work:
1. Pentagram's built-in Crusader usecode converter/disassembler
2. the local `crusader-disasm` corpus and helper scripts
3. the current workspace parser/decompiler in `tools/poc_crusader_usecode_parser.py`
3. the workspace research parser/decompiler in `tools/poc_crusader_usecode_parser.py`
4. the newer map-viewer decompiler in `crusader_map_viewer/map_renderer`
The goal is not to rank them abstractly. The goal is to state what each one is actually good at, what assumptions it bakes in, and why the current local parser had to diverge.
@ -16,7 +17,9 @@ Pentagram is a game-engine-side disassembler/converter with generic Crusader hoo
`crusader-disasm` is mostly a generated disassembly corpus plus small maintenance scripts that mine or preserve information from that corpus.
Our current parser is the first tool in this workspace that is explicitly built around the validated owner-loaded `EUSECODE.FLX` structure recovered from the retail binary and then pushed further into readable pseudocode export.
The Python parser is the research/reference pipeline built around the validated owner-loaded `EUSECODE.FLX` structure recovered from the retail binary.
The map-viewer decompiler is the primary product-development path. Continue improving it into the actual USECODE editor, decompiler, and recompiler; do not build a parallel user-facing editor/compiler around the Python proof of concept.
## Pentagram: what it does
@ -155,7 +158,7 @@ So this is again a maintenance aid around a text corpus, not a first-principles
In practice, `crusader-disasm` has been most useful as a vocabulary/evidence source, not as the final tool we run to generate the readable corpus.
## Our current parser/decompiler: what it does differently
## Workspace research parser/decompiler: what it does differently
The current local tool line is centered on:
@ -260,7 +263,21 @@ So the best current workflow is still hybrid:
- use Pentagram for structural/reference behavior
- use `crusader-disasm` for opcode vocabulary and corpus evidence
- use the local parser for validated owner-loaded extraction, IR, pseudocode, and batch readability export
- use the local parser/extractor for validated owner-loaded data, research IR, fixtures, and independent pseudocode comparisons
- use the map-viewer decompiler as the primary implementation and future user-facing USECODE editor/compiler
## Map-viewer decompiler: primary development target
The newer implementation lives in `crusader_map_viewer/map_renderer`, principally in `src/lib/usecode-decompiler.js`, with renderer regressions in `scripts/test-usecode-structuring.mjs`. Its later control-flow, loop, list, selector, and switch rendering work makes it the right foundation for the user-facing editor/decompiler.
It is not yet a recompiler. Development should continue there to:
- improve decompilation against the extracted corpus and binary evidence
- add a stable, lossless editable source/IR representation and editor workflow
- implement a bounded assembler and deterministic class/FLEX archive rebuild
- prove unchanged byte-identical round trips and validate edited output in both games
The Python parser and extracted artifacts remain valuable as independent evidence, fixtures, and comparison outputs. They should inform and test the map-viewer decompiler, not become a competing product path.
## Best current summary
@ -268,9 +285,11 @@ Pentagram is a converter/disassembler.
`crusader-disasm` is a disassembly corpus with helper scripts.
Our script is the first repo-local tool that is explicitly trying to be a readable decompiler over the validated extracted `EUSECODE` corpus.
The Python parser is the research tool that established readable decompilation over the validated extracted `EUSECODE` corpus.
That is why the current parser looks less like a classic disassembler and more like a layered RE workbench:
The map-viewer decompiler is where the actual editor/decompiler/recompiler should be built.
The research parser remains a layered RE workbench:
- extractor-backed local format understanding
- structured IR
@ -279,4 +298,4 @@ That is why the current parser looks less like a classic disassembler and more l
- batch corpus export
- runtime-annotation hints tied to the current Crusader notes
The tradeoff is that our current script is newer and more heuristic. It is better at producing something a human can read across the whole corpus, but it is not yet as mature or as battle-tested at raw opcode coverage as the older reference tools.
The tradeoff is that the research parser is newer and more heuristic. It helps produce human-readable corpus output and acts as a cross-check, while the map-viewer implementation still needs the editing, compilation, and archive-writing stages required for a working in-game round trip.