What is in a chest, what a shop sells, which monsters a zone throws at you, which house door leads where: none of it is stored as data. Each is an operand inside the scene's script - the bytecode the game's field VM runs when you walk into a town. Editing it means treating the script as code: decode it, rewrite one instruction's argument, recompress into the original footprint.
legaia_scene_formats::field_disasm)data_offset to the next descriptor's - read from the boundary, never from a rewritten stream--chests · --shops · --encounters · --house-doorschest_patch_real.rs · shop_patch_real.rs · encounter_patch_real.rs · house_door_patch_real.rsField-VM bytecode is variable-width and interleaved with dialogue: runs of glyph segments introduced by 0x1F that are not opcodes. A chest's give almost always sits after the dialogue that announces it. The finder therefore:
0x1F as a dialogue segment - skips to its terminating 0x00 and resumes;A chest carries two bytes that must move together: the GIVE_ITEM operand that grants the item, and a separate 0xC2 id dialogue token that renders the item's name in the announcement. Patch only the give and the text still names the old item.
| Opcode | Meaning | What the mod rewrites |
|---|---|---|
0x39 id | give item | the id, plus the paired 0xC2 id display token |
0x49 sub-op 0 | shop stock list | the inline item ids (the unsellable template tail is not stock) |
| encounter record | formation monster ids | the id bytes; count and reserved bytes preserved |
0xA3 0xF8 | intra-town warp | player-warp operands, class-preserving across IN/OUT records |
After the edit the MAN is recompressed, and the new stream must still fit where the old one lived. The budget is read from the descriptor boundary, not from the just-written stream. Several passes (encounter, chest, shop) re-pack the same MAN; the project's packer is sometimes a touch tighter than the previous pass, so a budget read back from a shorter stream would shrink each time and a later pass would overflow a scene it should have edited.
Tier-C edits are same-size at the operand level, but several target the same scene. They compose under one rule: every pass reads the footprint budget from the descriptor boundary. The variable-length cousin - an edit that must change a byte count - is tier D.
| Claim | Evidence | Reference |
|---|---|---|
| Operand encodings | Field-VM dispatcher FUN_801DE840 (43 opcodes), overlay-resident | script-vm |
| Shop stock is a script operand, not a table | Op 0x49 sub-op 0 carries the ids; prices come from the SCUS item record | shop |
| Encounter record shape | Reader at FUN_801DA51C: [3 reserved][count][ids] | encounter |
| Chest give follows the dialogue | Disassembly of every chest site; the display token and the give are distinct bytes | chest_patch_real.rs |
A finder that halts at the first 0x1F misses the give at most chest sites, silently and without error - the give sits after the announcement. Resuming after each dialogue segment keeps the inter-segment control bytes in sync and reaches the real give. A byte scan for 0x39 fails the other way: it matches glyphs and operands.