{
  "schema": "shadowrun-japan-preservation-enhancement/1",
  "rom_sha256": "586551eadaff2693c0f21d9c47a697841989ae312d422fa4bf30823473a40fae",
  "scope": "User-authorized JavaScript enhancement using retained Japanese room data and verified debug grants; this is not an unchanged Japanese-release behavior.",
  "original_japanese_matchbox": {
    "entity_id": 2240,
    "entity_hex": "0x08C0",
    "script_id": 294,
    "script_rom_offset_hex": "0xF6862",
    "japanese_name_id": 713,
    "japanese_name": "マッチばこ",
    "initial_owner": "0x08A4 (Jake)",
    "initial_owner_evidence": "Original opening WRAM snapshot slot-4380: entity state 0x3056 bytes 00 00 00 A4 08, owner u16 at 0x3059 = 0x08A4.",
    "script_hex": "2c00008058150080aa441d0000f00081140008000400190011000258d0c258c156",
    "active_menu_native": "0x15, CPU 0x809CC7",
    "menu_helper_cpu": "0x809B58 through 0x809CC6",
    "japanese_trigger_status": "The active Japanese Matchbox script and its native menu helper have no Western location/examine-count/beep/Open-R debug trigger.",
    "icon_status": "No verified Japanese inventory icon; appearance 0x007E does not establish a tiny Matchbox sprite. Use the original Japanese item name."
  },
  "retained_original_rooms": {
    "debug": {
      "room_id": 210,
      "room_hex": "0x00D2",
      "room_table_rom_offset_hex": "0x69EE0",
      "room_data_rom_offset_hex": "0xD0936"
    },
    "street": {
      "room_id": 1,
      "room_data_rom_offset_hex": "0xC812A"
    },
    "hallway": {
      "outward_room_id": 31,
      "return_entry_room_id": 232,
      "room_data_rom_offset_hex": "0xD2086"
    },
    "morgue": {
      "room_id": 3,
      "return_entry_room_id": 18,
      "room_data_rom_offset_hex": "0xC8432"
    },
    "outward_route": [
      3,
      31,
      1
    ],
    "return_route": [
      1,
      232,
      18
    ],
    "native_room_change": "Function 0x5C, CPU 0x80CD1D / ROM 0x4D1D: writes new room u16 to WRAM 0x2FA2 and 0x7FFF to WRAM 0x1CDB.",
    "retained_debug_warp_helper": "Script 285 at ROM 0xF69E3 pushes 0x00D2 and invokes native 0x5C. No active Japanese script caller was found."
  },
  "added_behaviors": [
    "New guide NPC near the street lamp offers a Matchbox yes/no and unlocks a direct Use action. Original Japan starts with the item already owned; accepting adds it only if missing and sets a separate guide unlock.",
    "Optional restoration of the documented Western four examinations under the street lamp followed by one just inside the hallway. Beep counts 1,1,2,1,3. Invalid examinations reset progress. This route is explicitly an enhancement for the supplied Japanese release.",
    "Matchbox Use moves to the retained Debug Room using its reconstructed manifest spawn.",
    "The added debug exit returns to the verified clear street stair base421/610/64, so original street collision permits immediate movement. This enhancement is not a reproduction of all seven original Debug Room exits.",
    "Guide moved up and left of the streetlight at user request. Original Decker and Jake portraits and dialogue frame reused; offer and Yes/No responses are new English enhancement text."
  ],
  "western_route_primary_source": {
    "url": "https://gamefaqs.gamespot.com/snes/588651-shadowrun/cheats",
    "attribution": "First-hand discovery credited to GanonTEK and JLukas",
    "source_limit": "The published cheat describes the Western release. It is not evidence that the trigger is active in this Japanese ROM."
  },
  "debug_grants": {
    "runtime_grant_ids": "1 through 6 in original room spawn order",
    "entries": [
      {
        "grant_id": 1,
        "entity_hex": "0x1B9E",
        "script_id": 840,
        "money": 5000,
        "displayed_karma": 20
      },
      {
        "grant_id": 2,
        "entity_hex": "0x1B74",
        "script_id": 848,
        "money": 10000,
        "displayed_karma": 42
      },
      {
        "grant_id": 3,
        "entity_hex": "0x1B82",
        "script_id": 853,
        "money": 19000,
        "displayed_karma": 70
      },
      {
        "grant_id": 4,
        "entity_hex": "0x1B89",
        "script_id": 857,
        "money": 26000,
        "displayed_karma": 100
      },
      {
        "grant_id": 5,
        "entity_hex": "0x1B97",
        "script_id": 864,
        "money": 34000,
        "displayed_karma": 125
      },
      {
        "grant_id": 6,
        "entity_hex": "0x1B90",
        "script_id": 868,
        "money": 60000,
        "displayed_karma": 145
      }
    ],
    "shared_script": "654 at ROM 0xF68AF: calls money native 0xA1 once and karma native 0x82 eight times.",
    "money_native": "0xA1, CPU 0x80CD61 / ROM 0x4D61: adds to WRAM money u32 at 0x3DC3 and saturates to 0xFFFFFFFF.",
    "karma_native": "0x82, CPU 0x80CE3E / ROM 0x4E3E: adds to WRAM raw karma u16 at 0x3DC7, wrapping to 16 bits.",
    "karma_display": "Native ROM offsets 0x6B95 and 0x6F55 shift raw karma right three times. Eight calls with the quoted amount therefore grant that amount of displayed karma, subject to original 16-bit wrap.",
    "limitations": "The JavaScript helper implements the verified money/karma portion. Other original waiter stat, spell, keyword and flag side effects are not implemented by this helper. Active Japanese debug text IDs 28 through 34 are placeholder ０, so new UI messages are explicit enhancement text."
  },
  "invincibility": {
    "entity_hex": "0x1531",
    "script_id": 278,
    "script_rom_offset_hex": "0xF69BB",
    "original_operation": "Native 0x14 sets property 0x10 to 0xFFFF before the invincibility message and native 0xC1 despawn.",
    "javascript_scope": "Stores persistent boolean invincible only in the debug scene. This flag does not claim completion of the original combat/damage engine."
  },
  "implementation": {
    "module": "dist/engine/preservation.js",
    "test": "tests/preservation.test.mjs",
    "test_result": "49 tests passed across the full project, including 10 enhancement behavior tests and 8 real shipped scene/path/save integration tests.",
    "persistent_flags": [
      "matchboxGuide",
      "matchboxLegacyProgress",
      "matchboxLegacyUnlocked",
      "money",
      "karmaRaw",
      "karma",
      "invincible"
    ]
  }
}
