The technique in one box
Rebuild the decompressed scene script with the record resized, fix the five kinds of offset the resize disturbs in one pass, recompress, and require the result to fit the asset's original on-disc footprint. If it does not fit, the scene is left vanilla. The disc never grows.

At a glance

Target
A MAN record whose length changes - the 0x3F scene-transition's inline destination name, or an inserted block of instructions
Engine
legaia_asset::man_edit - rebuild, resize, fix every disturbed offset
Fix-ups
Partition tables · partition-2 record-offset table · the u24 length at +0x28 · intra-record jump deltas · the external descriptor size word
Bound
Recompressed stream must fit the asset footprint; otherwise the scene is skipped
Mods
--doors · --starting-items (variant: splice)
Confidence
Confirmed - oracles re-decode every relocated scene and walk its scripts
Oracles
door_patch_real.rs · starting_bag_real.rs

What a resize disturbs

A MAN is a partitioned bundle: a header with partition tables, then records reached through a per-partition offset table. A door's destination lives in a partition-2 record, name inline. Grow that record and every structure encoding a position past it is stale.

A record grows; offset tables and deltas are fixed in one rebuild before records door record later records after records door record, longer name later records, shifted +Δ fix-ups: partition tables · record-offset table · u24 length · jump deltas · descriptor size word
The door record grows by Δ; five classes of offset are corrected in one rebuild. If the recompressed result will not fit the footprint, the scene stays vanilla.
StructureWhy it breaks
partition tablesevery partition after the edit starts Δ bytes later
partition-2 record-offset tableindexes the very records that moved, including the door destinations
u24 length at +0x28records the bundle's decompressed size
intra-record jump deltasa relative branch that straddles the edit lands Δ bytes short or long
external descriptor size wordthe loader reads the decompressed size from the scene bundle's descriptor, outside the MAN

Miss one and the script desyncs or the door points into garbage. The relocation engine fixes all five in one rebuild - byte layout on the MAN relocation page.

Two shapes of edit

  • Re-point a record (--doors). The canonical relocation: the inline name resizes the record, the engine fixes the offsets, the MAN recompresses within footprint. Coupling is bidirectional (a door and its return both move) or one-way, by flag.
  • Insert a block (--starting-items, the splice variant). The high-capacity starting bag inserts a guarded grant block into the opening scene's script - a story-flag test, a run of give-item ops, and a flag set so it fires once. man_edit::apply_insertions relocates it like any other length change, lifting the seven-slot cap of the same-size new-game seed path.

Relocation composes with the same-size tiers because they leave descriptor offsets fixed: a relocation pass runs on the stable footprint the tier-C budget is read from.

How we know

ClaimEvidenceReference
MAN partition layout + the +0x28 lengthScene-bundle loader walk; parser legaia_asset::man_editman-relocation, scene-bundles
Door op 0x3F carries the name inlineField-VM dispatcher FUN_801DE840script-vm
Grant block ops 0x70 / 0x39 / 0x50Same dispatcher; the engine's field VM executes the inserted block in the runtime oraclestarting_bag_real.rs
Every fix-up is sufficientDoor oracle re-decodes each relocated scene and walks every record to its terminatordoor_patch_real.rs
Details: adding a tier-D mod
  1. Enumerate every offset, table and delta the resize disturbs from the container layout.
  2. Fix them in one rebuild through man_edit.
  3. Keep the recompressed stream within the asset footprint; skip on overflow.
  4. Add a disc-gated oracle that re-decodes the patched image and walks the scripts.

See also