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.
This commit is contained in:
Maddo 2026-10-06 21:07:35 +02:00
commit e00f9f3186
16 changed files with 954 additions and 398 deletions

View file

@ -1,236 +1,84 @@
# JELYHACK USECODE Analysis
# JELYHACK: What It Does and What We Know
## Scope
## Short answer
This note focuses on the currently exported pseudocode and byte-level decode for `JELYHACK` class `277` / class id `0x04D3`, especially its only non-zero event body: slot `0x01` (`use`).
In the Remorse USECODE archive, `JELYHACK` has one active event: `use`. If the player uses an object running this class, the handler sets process info `0x0207`, excludes the current process, and returns. It does not directly display text, play a sound, open a camera, change an item, or call a puzzle/event script.
Current generated pseudocode lives at:
Think of `JELYHACK` more as an **internal handle** than as the gadget that runs a puzzle. Its descriptor exposes one field, `referent`: an identity/reference the runtime can use to associate this record with other data. Newer VM analysis suggests referent-only records can own or connect a payload chain. Richer camera and trigger behavior exists in nearby classes such as `SURCAMNS` and `SURCAMEW`, but the evidence does not show that using `JELYHACK` directly launches those handlers.
- `USECODE/EUSECODE_extracted/pseudocode/JELYHACK/slot_01_use.txt`
- `USECODE/EUSECODE_extracted/pseudocode/JELYH2/slot_01_use.txt`
We also do not yet have a verified mission/map placement for a `JELYHACK` instance. The extracted scene files show map items and trigger eggs, but do not identify those items by USECODE class name. “Island” is therefore a useful label for this descriptor cluster, not a confirmed in-game location for this class.
## Plain-language answer
## What happens when it is used
If you want the short version first:
- `JELYHACK` does not look like the object that contains the real island gameplay script.
- It looks more like a small anchor object that gives the engine a `referent` identity and a tiny shared `use` stub.
- When the player uses it, the stub appears to register a generic interaction/info value (`0x0207`) and then immediately exits.
- The richer gameplay behavior is more likely carried by nearby event-bearing records such as `REE_BOOT`, `SURCAMEW`, or `SFXTRIG`.
So in easy words: `JELYHACK` currently looks less like "the script that does the JELYHACK puzzle" and more like "the map object or anchor that other real trigger objects point at or work beside."
That also answers "what uses it" in the safest current sense:
- the referent/owner side of the runtime uses it as an anchor-like record
- the player can still `use` it, but that `use` body is tiny and generic
- the surrounding event-bearing attachment records are the more likely carriers of the actual gameplay logic
## Direct decompilation result
Current readable decompilation for `JELYHACK::use`:
The Remorse event table gives `JELYHACK` (entry 277, class id `0x04D3`) a body only in slot `0x01` (`use`). The same is true of its sibling `JELYH2` (entry 280, class id `0x04D6`). The exported handler is:
```text
function jelyhack_use() /* entry=277 class_id=0x04D3 slot=0x01 */
{
entry:
set_info(0x0207, *(arg_06));
process_exclude();
return;
}
```
Byte-faithful decode of the same body:
```text
00D4: 5A init local_bytes=0x0
00D6: 5C symbol_info symbol=JELYHACK
00E2: 0B push_word_immediate value_u16=0x0207
00E5: 40 push_local_dword [BP+06h]
00E7: 4C push_indirect size=0x2
00E9: 77 set_info
00EA: 78 process_exclude
00EB: 5B line_number line_number=0x00DB
00EE: 50 ret
```
That readable pseudocode is currently hiding one important detail: there is a small trailer after `ret`.
Pentagram's older disassembly shows the body like this:
```text
Func_1 (Event 1) JELYHACK::use():
0001: 5A init 00
0003: 5C symbol info offset 001Ch = "JELYHACK"
000F: 0B push 0207h
0012: 40 push dword [BP+06h]
0014: 4C push indirect 02h bytes
0016: 77 set info
0017: 78 process exclude
0018: 5B line number 219 (00DBh)
001B: 50 ret
00: 01 type=69 (i) [BP+00h] (00) 00 referent
002A: 7A end
```
So the extra bytes are not currently best read as hidden live code. The strongest reading is:
- executable body ends at `ret`
- one post-return debug/local-symbol record follows
- that record names one slot/argument as `referent`
- then the body terminates with `0x7A end`
That matters because it argues against the dramatic interpretation that we found a chopped-off second script. Right now the evidence fits "metadata trailer" much better than "cut content."
## What the trailer most likely represents
Current best explanation of the bytes after `ret`:
- they are post-return symbol/debug metadata, not a second reachable instruction stream
- they preserve the name `referent`, which matches the descriptor-side picture where `JELYHACK` only exposes a `referent` field
- they reinforce the idea that this class is an anchor/owner record, not a rich event script
In practical terms, the trailer is telling us something like: "this body knows about one meaningful value here, and that value is called `referent`."
That is useful evidence, but it is not new gameplay logic.
## Suggested readable pseudocode form
For human reading, the most honest pseudocode form is probably this:
```text
function jelyhack_use() /* entry=277 class_id=0x04D3 slot=0x01 */
function jelyhack_use()
{
set_info(0x0207, *(arg_06));
process_exclude();
return;
/* post-return metadata (not executable):
debug_symbol referent [BP+00h] type=0x69
*/
}
```
That presentation keeps the important distinction visible:
The native VM confirms that these are process-control operations, not display commands. Opcode `0x77` stores two values on the running process: the used item's id as its source item, and `0x0207` as its process/event type. Opcode `0x78` then checks for another live process with the same item id and type. The final `0x50 ret` returns normally if execution continues. There is no branch, spawn, class/event call, text-file call, sound call, or item mutation in this handler.
- the function really returns where it looks like it returns
- there is still meaningful trailer data after that return
- the trailer is metadata, not currently credible as reachable lost code
**Likely player-visible result:** nothing obvious happens from this handler alone. Its practical job is bookkeeping and duplicate suppression: associate the running process with this item under type `0x0207`, then let the first matching process proceed while a duplicate takes the interpreter's early-completion path. The item is also marked in the engine's process-presence bitmap while it has a process; native termination refreshes that flag and clears it when no process remains for the item. The script itself does not show text, play audio, animate a screen, or change the world.
## What is directly supported
The number `0x0207` is not identified as a named gameplay action. In the native process entry, it occupies the process-type field; the duplicate check compares that field together with the item id. The exact English label or wider purpose of this tag remains unknown. It is common rather than JELYHACK-specific: the same `set_info(0x0207, item)` pattern appears in 117 exported Remorse event bodies. Do not interpret it as a message number, a camera command, or a special JELYHACK action. `process_exclude` does not hide or delete the object; it ends a competing process for the same item/type pair.
1. `JELYHACK` is not an active event hub in the same sense as `EVENT`, `NPCTRIG`, or `_BOOT` classes.
2. Its only non-zero slot is `0x01` (`use`), with `raw_event_entry_word = 0x002A`, `raw_code_offset = 0x00000001`, and body range `0x00D4..0x00FE` (`42` bytes).
3. The actual executable body is tiny: one `set_info(0x0207, *(arg_06))`, one `process_exclude()`, then return.
4. `JELYH2` is the same script body for practical purposes. The only pre-return differences are the symbol label string and line-number metadata; control flow and active ops are otherwise the same.
5. A post-return trailer still preserves `referent` metadata, which lines up with the descriptor-side fact that `JELYHACK` only exposes `referent`.
6. `JELYHACK` still exposes only the `referent` field on the descriptor side, which keeps it in the `referent-anchor` category rather than the event-bearing category.
This is backed by live Remorse Ghidra analysis: `Interpreter_NextUsecodeOp` opcode `0x77` calls `EntityDispatchEntry::SetEventTypeChecked` and `SetSourceType`; opcode `0x78` calls `Kernel_GetNumProcesses(itemno, proctype)` and exits when the count exceeds one. `SetSourceType` marks the item-process-presence bitmap. The type-specific item-process bits are only updated for `0xF0..0xF7`, so `0x0207` does not set one of those special flags.
## Comparison against the exported pseudocode corpus
The Remorse body window is `0x00D4..0x00FE` (42 bytes). The executable instructions return before the trailing symbol record naming `referent`, followed by the `0x7A end` marker. That trailer is metadata, not a second gameplay routine.
The `JELYHACK::use` body is not unique. Normalizing away only the function header, the exact same readable body currently appears in these seven exports:
## What the referent evidence means
- `AVATAR/slot_01_use.txt`
- `GRAVITON/slot_01_use.txt`
- `IONIC/slot_01_use.txt`
- `JELYHACK/slot_01_use.txt`
- `JELYH2/slot_01_use.txt`
- `PLASMA/slot_01_use.txt`
- `WEA_BOOT/slot_01_use.txt`
The Remorse descriptor for `JELYHACK` contains only `referent`; `JELYH2` has the same descriptor shape and the same active `use` behavior. Newer VM analysis identifies referent-only records as likely owners/identities in a runtime payload chain. This is a better explanation than treating the class as a complete puzzle script.
That matters because it argues against a special-purpose `JELYHACK` event implementation. The more defensible reading is that this is one small generic `use` stub reused across several classes.
The extracted descriptor neighborhood places `JELYHACK` near `SURCAMNS`, `REE_BOOT`, `SURCAMEW`, and `SFXTRIG`, alongside other records with `referent` fields. Some of those records also expose `event` or `eventTrigger` fields. This supports a model in which referent records and event-bearing records participate in a shared data-driven group.
There is also a second useful comparison: other classes often start with the same `set_info(...); process_exclude();` prologue and then continue into much richer logic. `DATALINK::use` is a good example: it begins with the same opening but then expands into a larger branch-heavy routine. So the `set_info/process_exclude` pair is best treated as a common preamble, not the whole semantic payload of a class family.
Important limit: these are descriptor-table relationships and runtime-family evidence. They do not prove the records are physically adjacent in a level, that each one points to this particular JELYHACK instance, or that a direct call runs from JELYHACK to any neighbor. A search of the exported pseudocode found no direct class/event call to class ids `0x04D3` or `0x04D6`.
## What `JELYHACK::use` most likely does
## Where the richer behavior lives
Current safest reading:
The closest concrete gameplay logic is in the camera callback classes, not in `JELYHACK::use`:
- It performs a small generic `use`-entry setup using info id `0x0207` and the dereferenced word at `arg_06`.
- It then marks the current process or handler for exclusion/suppression through `process_exclude()`.
- It does not itself implement the richer trigger logic one would expect from an active gameplay event script.
- `SURCAMNS::use` checks status bit `0x1000`; when set, it starts the class's high-slot handler `0x20`.
- `SURCAMNS::slot_20` follows link/quality values, checks nearby monitor/value-box objects, can request text-file handling, and starts trigger and camera-related handlers.
- `SURCAMNS::slot_21` creates a screen-related item and searches for matching camera eggs and mechanical actors, with waits and input checks.
- `SURCAMEW` contains a parallel callback family, with related screen and camera-object handling.
The unresolved part is the exact gameplay meaning of `set_info(0x0207, *(arg_06))`. The exported corpus shows this exact pattern in multiple unrelated classes, so `0x0207` currently looks more like a shared UI/message/interaction setup code than a JELYHACK-specific action.
These field names and operations make the surrounding cluster look like a security-monitor/camera interaction system. That is a useful gameplay interpretation of `SURCAMNS`/`SURCAMEW`; it is **not** proof that clicking a `JELYHACK` object opens that system. The missing link is an instance-level referent or map-data connection.
That leads to the simplest current gameplay explanation:
## Where it is used, and what remains unknown
- the object can be "used"
- the engine records a generic interaction fact about that use
- the object then gets out of the way
- anything interesting that happens next probably belongs to a neighboring event-bearing attachment, not to `JELYHACK` itself
What the current evidence establishes:
## What it probably does not do
- `JELYHACK` and `JELYH2` are present as separate classes in the Remorse USECODE archive.
- Both have only the small `use` handler in their common event slots, and their Remorse descriptors expose only `referent`.
- Their likely role is to provide a referent identity for the surrounding data-driven behavior group.
- The camera/trigger classes contain substantial behavior, but no direct call from JELYHACK to them has been recovered.
The current evidence argues against several stronger claims:
What it does **not** establish:
- It is probably not the main script that drives the JELYHACK gameplay behavior by itself.
- It is probably not the actual event-bearing payload that reaches the richer runtime opcode lanes recovered around `000d:208b`, `000d:21ed`, and `000d:22bc`.
- It is probably not a unique script template specialized only for the JELYHACK object.
- The bytes after `ret` are probably not a hidden reachable second branch or a simple "return was moved upward" cut-content remnant.
- the exact level, map coordinates, or visible object that uses class `JELYHACK`;
- the player-visible meaning of `set_info(0x0207, ...)`;
- which concrete event-bearing record shares a referent with a particular JELYHACK instance;
- that JELYHACK itself is a puzzle switch, camera terminal, key, or island controller.
If this were cut executable content, we would want to see stronger signs such as:
To answer those questions, the next useful evidence is an instance-level link: a map/object record bound to this class plus its referent value, cross-checked against the corresponding event-bearing records. Class-table proximity alone cannot supply that link.
- a branch target that lands in the trailer
- a sensible opcode stream after `ret`
- different trailers between `JELYHACK` and `JELYH2` that might hint at divergent behavior
## Variant note
At the moment we have the opposite pattern: a small named metadata record, a clean `end`, and strong similarity across the twin classes.
This conclusion about the `referent` descriptor is for the current Remorse extraction. Regret also contains classes named `JELYHACK` and `JELYH2`, and their readable `use` pseudocode has the same short operations, but their records are not interchangeable: the Regret `JELYHACK` event window is 13 bytes rather than Remorse's 42-byte window, and its descriptor decode does not expose the same `referent` field. Keep the class names and visible handler separate from the variant-specific descriptor evidence.
## Relationship to JELYH2 and the surrounding island
## Evidence files
`JELYHACK` and `JELYH2` remain the clearest referent-anchor twins in the extracted USECODE data:
- same lone live slot `0x01`
- same event-table row shape (`0x002A / 0x00000001`)
- same `42`-byte body length
- same readable `use` body before return
- same descriptor-side role: `referent-anchor`
This fits the broader neighborhood evidence already captured elsewhere:
- `JELYHACK` / `JELYH2` sit beside event-bearing neighbors such as `REE_BOOT`, `SURCAMEW`, and `SFXTRIG`
- those neighbors expose `event` or `eventTrigger` fields and carry materially richer behavior bodies
- the current best model is therefore still `referent anchor + neighboring event-bearing attachment`, not `JELYHACK as a standalone active event core`
## Comparison with nearby event-bearing neighbors
The generated pseudocode reinforces that split.
`REE_BOOT` slot `0x0A` and `SFXTRIG` slot `0x0A` diverge immediately from the JELYHACK body:
- they use `set_info(0x0211, *(arg_06))` instead of `0x0207`
- they perform status checks, helper calls, spawns, waits/suspends, and other active logic
- they therefore look like genuine event-bearing routines rather than passive anchor stubs
`DATALINK` slot `0x01` is also instructive in the other direction:
- it starts with the same `set_info/process_exclude` preamble
- but it then continues into a much larger routine
- so the shared opening is not enough to classify a body as anchor-only or event-bearing by itself
## Current best conclusion
The decompiled `JELYHACK::use` body is important mainly because it supports a negative result cleanly:
- `JELYHACK` is not hiding a large active event script in its only live slot
- its visible `use` handler is a minimal generic stub shared with several other classes
- the bytes after `ret` look like a metadata trailer naming `referent`, not like secret live code
- the interesting gameplay semantics around the JELYHACK island are still more likely to live in neighboring event-bearing descriptors attached to the same referent context
So the current best human-readable model remains:
```text
anchor JELYHACK(referent)
anchor JELYH2(referent)
use:
set_info(shared_use_code_0x0207, deref(arg_06))
process_exclude()
return
actual island behavior:
likely carried by neighboring event-bearing attachments such as REE_BOOT / SURCAMEW / SFXTRIG
```
That is a stronger and cleaner claim than the older vague label `referent anchor`: the exported pseudocode now shows that the anchor really does have code, but the code is a tiny shared interaction stub, not the island's main behavior engine.
- [Remorse JELYHACK use pseudocode](../USECODE/EUSECODE_extracted/pseudocode/JELYHACK/slot_01_use.txt)
- [Remorse JELYH2 use pseudocode](../USECODE/EUSECODE_extracted/pseudocode/JELYH2/slot_01_use.txt)
- [Remorse class/event index](../USECODE/EUSECODE_extracted/class_event_index.tsv)
- [Descriptor neighborhood graph](../USECODE/EUSECODE_extracted/jelyhack_island_graph.md)
- [Readable descriptor templates](../USECODE/EUSECODE_extracted/readable_descriptor_templates.md)
- [Runtime/readable script analysis](../USECODE/EUSECODE_extracted/readable_script_ir.md)
- [Descriptor-family runtime evidence](../USECODE/EUSECODE_extracted/runtime_descriptor_family_rankings.md)
- [USECODE opcode and runtime caveats](usecode-format-specification.md)