{
  "schema": 1,
  "game": "X2",
  "actor": "SeaCanthller",
  "eventId": 41,
  "romSha1": "637079014421563283CDED6AEAA0604597B2E33C",
  "sourcePacket": "x2/29-sea-canthller",
  "placement": { "stage": 3, "index": 14, "subtype": 0, "x": 384, "y": 1216 },
  "spans": [
    { "address": "07D762", "length": 20, "sha256": "DE634C5A0695950C266DA4882E77CA1DE542FA5BAA2BB22C7E24BF436649833F", "purpose": "main and startup dispatch" },
    { "address": "07D776", "length": 152, "sha256": "181D93F46120561894C4A33D9C267D995944F86806FAF105F2AD1AB87E56EE0A", "purpose": "body initialization and eight linked type 2A actor allocations" },
    { "address": "07D84A", "length": 14, "sha256": "A47934F0BB4C03A922159592586601F0AA810CB57D5DAF72D0133EBCD0D8E4D9", "purpose": "seven active-state dispatch entries" },
    { "address": "06CB36", "length": 48, "sha256": "73998CCFBE92E94E18E4564EABA734F8C50669648E7F253A9DECD7D826AFC029", "purpose": "three RNG selection tables indexed by horizontal player distance" },
    { "address": "06CB7D", "length": 220, "sha256": "8273D7858A9536A29AE8607C11F063DF72E9CD081848AF2914B80C8A1DACEACA", "purpose": "route stream through the terminal 0A instruction" },
    { "address": "07D858", "length": 192, "sha256": "44A896D5E157500798FF8798E4BE6264A8F19AFCAF3A2A5A7C34B045F9735938", "purpose": "waypoint motion and periodic 70 queue gate" },
    { "address": "07D918", "length": 209, "sha256": "BA0A9817AD96B572A29CB177D79083C2775DE250F6609CF8AEFF1B6C9A0B5B19", "purpose": "timed route action, native helper and 5D queue gate" },
    { "address": "07DA00", "length": 64, "sha256": "BA22498430E3761010E84962926E5C157804F22599BE321879287F575A341478", "purpose": "random and unconditional jumps in the route stream" },
    { "address": "07DA54", "length": 191, "sha256": "4F1AA64A7B9E6E4ACCCA521F048028BFDEDE8DFBF43A99B76298012BFF34D612", "purpose": "exit controller and secondary 5D gate" },
    { "address": "07DC0B", "length": 79, "sha256": "1E907D058729D62690BED5382C40D6B9C7A188B1E2F7332EF1FFF46704ED1383", "purpose": "four group 5 health drop attempts" },
    { "address": "08E10B", "length": 92, "sha256": "D313A7442156639B365417AC5FED732F0166AD286DA50204BEA6FB5D17D63F7A", "purpose": "separate randomized exit effect sound and visual cadence" },
    { "address": "08DFF5", "length": 40, "sha256": "3B63EE67437EC946EB4D5DD2DD851651A7934D53DC388CEB237C510E75FB9C1E", "purpose": "weighted pickup selection and dispatch table" },
    { "address": "06B094", "length": 31, "sha256": "D4229F61915A66344E25AB0F87AA3EB2E2AC3199A1CB58E63093C88AA94470A8", "purpose": "two exit cues and pickup weights through group 5" },
    { "address": "07DB57", "length": 48, "sha256": "C1283EA8321BDFE159B4482394E984B0DB07680A38CF2B2B705C66196BB27103", "purpose": "angle and magnitude to velocity through the WRAM Cx4 helper" },
    { "address": "06CC5A", "length": 64, "sha256": "5555EB15E91522DA010ED4BFC8C2FFA0EF62D79BC2EEE31CB7BC80A6BA4F126E", "purpose": "linked type 2A initial HP, animation and dispatch selectors" },
    { "address": "0396F4", "length": 58, "sha256": "6186DC24F2363542153135FBC9E27030B12867020337BD6A07FC2C224E386786", "purpose": "part loss, parent counter decrement and effect" },
    { "address": "04DE84", "length": 12, "sha256": "5E7210D23548A00CDBE4779F5EEEC9952599B20ECD520D281489D688617D615E", "purpose": "six stage 03 map recipe offsets" },
    { "address": "04E290", "length": 54, "sha256": "9F13C188FB4EA40F5E98ADDD893838E5DEEEFB76A357B5957281D4434F77BC98", "purpose": "stage 03 gate open and restore map recipes" },
    { "address": "028400", "length": 512, "sha256": "70ABE518D67F10DA108A5A0E714255C1FE843F40D055EE8A1D172DB4752CECC4", "purpose": "Cx4 PB 02, velocity conversion at PC 10 and heading at PC 1F" },
    { "address": "029200", "length": 512, "sha256": "D8034BC583D0DD0ADF067D98346E1C4AC45C971BEA6689FB42D400B3926F19CF", "purpose": "Cx4 PB 09 trigonometric helpers" },
    { "address": "039384", "length": 116, "sha256": "A71F84B3152F43F6449599F291D72A1CB69A665522497C6E3EE2BD4F36DEA9DF", "purpose": "type 2A subtype 2, allocation and command 13 per successful projectile" },
    { "address": "0393F8", "length": 115, "sha256": "A5048FF3D70AE7178EAB745B8BCBD6898B130CB9D18CCA61D49235BFBE9960B0", "purpose": "type 2A subtype 6, animation event and projectile 12 allocation" },
    { "address": "01D070", "length": 235, "sha256": "DD9D56FC2EEE824ECC4EEAFBE173F5180E4A125E36B06EFBED36A98381D70F85", "purpose": "projectile 12 drag, terrain test, burst and expanded hitbox" },
    { "address": "03DDB8", "length": 393, "sha256": "FAE6C3639FAFA0912589EF669A186B517F77BEE0C88465BE84937E6EF302573C", "purpose": "projectile 13 turn, homing, Cx4 displacement, timeout and removal" },
    { "address": "06E008", "length": 65, "sha256": "A63022D9B176340D91C911BDC83CEB128826ABEE595984EF5498E924032DC7E7", "purpose": "projectile boxes, signed turning rates, pose and flip selectors" },
    { "address": "06CCEA", "length": 38, "sha256": "4E4650E11FC30B793F3061F1BCF93B219C69D26D0BAFEC3B0AE37CBFB56F46A0", "purpose": "volley origins and the eight part explosion offsets" },
    { "address": "0391B2", "length": 466, "sha256": "EBBD480456DB752CE9731A052B85BB25FC4F89F47D19F8783BF53C9EF3698B24", "purpose": "searchlight sweep, initial capture, damage and release states" },
    { "address": "039498", "length": 254, "sha256": "B8327853D8493DF67BC6059CD7A25146F405C4280BF6BC2FEFD8CBCE63AC7D86", "purpose": "searchlight rotation, bounds and two aim gates" },
    { "address": "039596", "length": 350, "sha256": "1345F1A612F1D5C97E56B5F91D48B71D50D6C85DD2AA578FA7C1130A7B45537F", "purpose": "aim geometry, Cx4 window generation, PPU reset and parity-selected DMA buffers" },
    { "address": "06CD10", "length": 90, "sha256": "F8376943B376C3396DB9D44D637EF4B828603723B337E5E4EA13293142263741", "purpose": "window DMA descriptors, captured color triples and three searchlight exclusion regions" }
  ],
  "observed": [
    "The type 29 parent is placed by stage 03 at (384, 1216), then initializes its own origin to (128, 1200) and its remaining-part counter at offset 3F to 6. It allocates eight actor-pool children with ID 2A and subtypes 7 through 0. Each receives the parent's direct-page slot address in its word 33.",
    "The actor follows a script. Opcode 00 reads a five-byte waypoint command. The target becomes eligible for advancing after both integer-coordinate differences are strictly below 16. Steering uses the angle calculation at 7E2683 and increments or decrements the current angle by four toward its target.",
    "Opcode 02 reads a timed action. Opcode 04 advances past its three-byte record. Opcode 06 selects one of two 16-bit route offsets depending on whether the native RNG low nibble is below six. Opcode 08 jumps directly to a 16-bit route offset. Route offsets and targets observed at runtime identify data bank 06.",
    "The route movement call at 07D890 queues 70 only when 09CC & 7 is zero. Call 07D986 queues 5D after 2AA811 in the timed action. Code 07DAEA queues another 5D after the same helper during teardown. Both are located in the native parent controller and separate from the linked actor behavior."
  ],
  "runtimeObservation": {
    "emulator": "BizHawk 2.11 / BSNESv115+",
    "emulatorSha256": "B2D4BE5E2A766A5161CC26F3AF2A90753C39D64C91C54A9884171AED09E21DF3",
    "captureScript": "tools/bizhawk/MMX2_SeaCanthller_Capture.lua",
    "captureScriptRevision": "b56f65d",
    "captureScriptSha256": "6E46AEB1F45251FBE85E232F13939D4E37E90DF2A907E5543BFAC8EB241A5B5D",
    "method": "Boot from power-on, request stage 03/checkpoint 1 through the native reload, and move only X toward the placement during the first 48 frames. There are no actor or ROM writes and sound output is muted.",
    "checkpointFrame": 2134,
    "captureFrames": 1800,
    "firstParentSlot": "0D18",
    "linkedChildrenPerSample": 8,
    "actorRows": 16200,
    "dispatchRows": 4989,
    "actorsCsvSha256": "7C9A129FF70F8750C2AD8C21E835CD569497D24EC8A67FAD74480C6221E82D46",
    "dispatchCsvSha256": "50FEA73A5DAA34DFD6F3175862183D127A8ED3191E26232FC503B0D265B290F1",
    "bodyStartup": [
      { "frame": 2135, "xRaw": 32768, "yRaw": 307200, "hp": 6, "routeOffset": 0 },
      { "frame": 2136, "xRaw": 33279, "yRaw": 307200, "hp": 6, "routeOffset": 5 },
      { "frame": 2137, "xRaw": 33662, "yRaw": 307200, "hp": 6, "routeOffset": 5 }
    ],
    "firstTargets": [
      { "routeOffset": 0, "x": 192, "y": 1200 },
      { "routeOffset": 8, "x": 576, "y": 1152 },
      { "routeOffset": 51, "x": 752, "y": 1216 }
    ],
    "soundCalls": [
      { "address": "07D890", "command": "70", "count": 190, "allOnEighthLogicTick": true },
      { "address": "07D986", "command": "5D", "count": 8, "logicTicks": [74, 78, 82, 86, 90, 94, 98, 102] },
      { "address": "07DAEA", "command": "5D", "count": 0 }
    ],
    "lastSampleFrame": 3934,
    "lastParentRouteOffset": 56
  },
  "bodyReplay": {
    "captureScriptRevision": "3cc3f3f",
    "captureScriptSha256": "9227F07D1D54989EE6D4FE2B1BCEE771A63EF240F07D186E120684288BFC2148",
    "checkpointFrame": 2134,
    "lastFrame": 4534,
    "hostFrames": 2400,
    "bodyUpdates": 2348,
    "captureFiles": {
      "actors.csv": "8BF488079FF376EB2CDB430B3A6C43B725D65324B677FBCC10997C1708A6BAE5",
      "body-input.csv": "D9659CEE1A3F2E4416A0973EF59502FE48185125FAAB9692D2D07A7C186FD974",
      "dispatch.csv": "26FC2694BCDD16E2108BF6EC41D4B8CE4D565315A24F0D9058CB6EF8BEDD39B2",
      "maps.csv": "772F4F9D26AB03439E2FB2AB7E79DE5319AF96F429BECF2CA33F7CD706BB6FE8"
    },
    "fixture": "XSharp.Tests/Fixtures/Enemies/sea-canthller-body.csv",
    "fixtureSha256Lf": "8C5245C5398C57740B17413E4D6D42458C4F769E545538B61ECB4C5DF410B2F8",
    "fixtureTool": "tools/parity/package_sea_canthller_capture.py",
    "fields": "24.8 positions, signed velocities, 9-bit heading, next magnitude, route cursor, sound requests and gate writes",
    "inputs": "Captured logic counter, player X, part attack flags, cooldown and the results of the body's RNG calls",
    "soundCalls": { "70": 265, "5D": 8, "context": "Song-15" },
    "firstGate": { "selector": 0, "map": 4, "x": 296, "startY": 1272, "endY": 1160, "stepY": -16 },
    "childSoundSites": [
      { "address": "0392F2", "command": "2D", "count": 24 },
      { "address": "0393E5", "command": "13", "count": 15 },
      { "address": "03925D", "command": "73", "count": 2 }
    ]
  },
  "cx4Geometry": {
    "method": "The controlled probe writes test vectors to the WRAM mailbox immediately before the game's Cx4 call and reads the inputs and output words at the 65816 port access sites.",
    "headingSamples": 1024,
    "velocitySamples": 768,
    "angleCsvSha256": "A86EBA6502C475AF9083C1B6F813C66B7C033E2C7383775878E840E267CF5F16",
    "polarCsvSha256": "0AAA4B5D24FA0D2155A49646AB97A97D5E9C6E7C2162461CFECEB81CB2AF579B",
    "arithmetic": "Integer length, strict restoring division, arcsine, quadrant folding, signed Q16 coefficients and separately truncated projected velocity. The engine reverses native Y velocity to match its coordinate convention.",
    "instructionReference": "https://github.com/mstan/snesrecomp/blob/93fc677/runner/src/snes/cx4.c"
  },
  "projectileReplay": {
    "controlledFrame": 2402,
    "captureScript": "tools/bizhawk/MMX2_SeaCanthller_Capture.lua",
    "shortCaptureScriptSha256": "74556D46BF8676AA45DEEE21AF608E96B0DBE88334BE75ABA8DE6FD2070F4A8E",
    "longFlightCaptureScriptSha256": "EFE91D315DDEDF555AF9F4BE852D40FAA16EF4FC7FE477BAAF0E8B8AFCC8C0CD",
    "captures": [
      { "mode": "volley", "frames": 1500, "projectileCsvSha256": "0064DAB2E84E903F148548ABE927C9E7E3883F424C5DC51046C3B303559DBCC9" },
      { "mode": "bubble", "frames": 1500, "projectileCsvSha256": "1EF52204A43A9C6F3D2B44931A7D977532B33C2252ED6596E40ACF606436B2D5" },
      { "mode": "volley-flight", "frames": 920, "projectileCsvSha256": "196BDE29DEE52D6147DAE2653070616B3D8EFC57B7F578DE348EC5E57BCD16EC" }
    ],
    "method": "Each run writes one parent attack command after the first gate. The long-flight probe also bypasses the projectile 13 camera and terrain rejections to sample homing. Motion and target selection still run in the original controller.",
    "fixture": "XSharp.Tests/Fixtures/Enemies/sea-canthller-projectiles.csv",
    "fixtureSha256Lf": "DC25D1AAB12610668D0CC692CB265539846B40FBC1C8107CBDAFE16CE550D0F1",
    "initializations": 41,
    "updates": 1678,
    "homingUpdates": 314,
    "comparison": "Position, signed speed, animation frame, script and remaining duration, plus heading, flight lifetime and initialized homing timer for projectile 13.",
    "volleyLaunch": "Subtype 2 fires up to three projectiles at X offsets -10, -4, 3 and Y offset -15. It queues 13 after each allocation at 0393E5. Song-15/13 and Common/13 share the named clip and PCM hash 2F40C0F799254507C6EA7E281ACD1765D672C1AB602934C77ECC83C475DBDB06.",
    "bubbleLaunch": "Subtype 6 starts script 0B on parent command 04. Its one-update event allocates projectile 12 at X+60 and the current Y. Launch inherits the parent velocity and has no local queue call.",
    "runtimeSmoke": "An injected parent command 02 inside the imported DX9 stage exercises allocation, the dedicated projectile pose, the cached Song-15/13 voice and the moving volley after a save-state round trip."
  },
  "integration": {
    "body": "The controller uses the native route, a separate serialized encounter with eight independently animated targets and native first-gate writes on the revision-matched imported stage. Waypoint and gate requests use the precached Song-15 bank.",
    "gateExtractor": "MegaEDXCore/MegaEDX/Mmx2SeaCanthllerGateMaps.cs",
    "runtimeSmoke": "tests/XSharp.LevelSmoke/SeaCanthllerSmoke.cs checks eight poses, the first gate, the cached native sound, and advancing 24 frames from a restored save.",
    "oldSaves": "The body keeps its serialized fields unchanged. Earlier saves without a linked encounter retain their previously serialized body and resume its fallback controller."
  },
  "searchlightObservation": {
    "mode": "beam",
    "captureFrames": 2400,
    "observedScriptSha256": "615229481BC49F6D94043F0F6D54E4F127A947E83B7D94B93F16BD3039A37F36",
    "traceRows": 4933,
    "traceRowsSha256LfWithoutHeader": "9A53800DA75B6AB2AE90718FFB66B2B26E98C1CC3DB482311CA7A3AFCF62CD0C",
    "unchangedBaselineStreams": ["actors.csv", "body-input.csv", "dispatch.csv", "maps.csv"],
    "sweep": "Subtype 1 rotates with a signed step and reverses at the 20 and E0 thresholds. A living part can sweep with parent command 00. The aim is relative to (bodyX + 23, bodyY + 21), with a wide capture gate and a narrow damage gate. The screen window uses (bodyX + 23, bodyY + 24).",
    "blockedPlayerRegions": [[768, 1152, 1216, 1344], [2112, 2240, 1152, 1664], [2688, 2944, 1152, 1280]],
    "regionBounds": "[minimum X, exclusive maximum X, minimum Y, exclusive maximum Y]",
    "capture": { "pc": "039267", "frame": 2390, "tick": 28, "xHealth": 16 },
    "damageCalls": [
      { "pc": "03933B", "frame": 2409, "tick": 47, "xHealthBefore": 16 },
      { "pc": "03933B", "frame": 2588, "tick": 218, "xHealthBefore": 15 }
    ],
    "release": { "pc": "03934B", "frame": 2594, "tick": 221, "xHealth": 14, "activeUpdates": 193 },
    "audio": [
      { "context": "Song-15", "command": "73", "pc": "03925D", "requests": 2, "logicTickModulo": 128 },
      { "context": "Song-15", "command": "2D", "pc": "0392F2", "requests": 24, "logicTickModulo": 8 }
    ],
    "rendering": "The original fills two Cx4 scanline windows and rotates their HDMA buffers on odd/even logic ticks. The capture records window flags and blend control. Per-scanline output and interrupted release still need live validation.",
    "ppuReference": "https://github.com/bsnes-emu/bsnes/blob/master/bsnes/sfc/ppu/window.cpp"
  },
  "searchlightReplay": {
    "fixture": "XSharp.Tests/Fixtures/Enemies/sea-canthller-searchlight.csv",
    "fixtureSha256Lf": "E3AD900AE807BC5EE671C4AFBCD5BF8753E36A230B3DF3B3C15802FCC8440588",
    "captureFramesPerMode": 540,
    "modes": [
      { "mode": "beam-visual", "updates": 491, "inputSha256": "E9BE045C578F52DF29EDA67143C5426FA4B7F25DBB05186A0BBFF74147D102C1" },
      { "mode": "beam-motion", "updates": 485, "inputSha256": "B961B31BBC07FF1604C4E36142B47C7BB503A5F1ACAA7351455D17D39DE7A4E7" }
    ],
    "method": "The motion probe holds Left for 64 host frames after acquisition. X responds while the beam is active. The replay supplies native player position, hurt state, camera and encounter phase at each executed update.",
    "comparison": "Controller phase, sweep angle, angular step, Song-15 sound requests, damage-call decisions, parent command changes and number of RNG draws.",
    "rendering": "XSharp draws a scanline-based mask behind the HUD with the wide sweep and narrow damage beam. This uses an alpha overlay. The original color math, alternating effects and exact scanline edges remain open."
  },
  "movieAndExit": {
    "movie": "Sea Canthller.bk2",
    "movieSha256": "936DC62DA8E1347C2027E780DF267169F19B6C1EEE2DC83CDF547EB203AC1795",
    "method": "BizHawk 2.11/BSNESv115+ starts from the movie's embedded stage 03 save at X 432, Y 775. The audit follows all 6086 recorded inputs and reads WRAM, CPU call sites, CGRAM and VRAM. No input replacement, WRAM writes or save reloads occur. Source movie hash was checked after playback.",
    "captureScript": "tools/bizhawk/MMX2_SeaCanthller_MovieAudit.lua",
    "captureScriptSha256Lf": "A8A88F1E6AC16265DC6788E2096050B8B0F8497307C82914D9417AA9E72D6E92",
    "captureFiles": {
      "scene.csv": "1D54BACD9FC537F0137414C8F80D44CB57A4DAFFECE51EEF80967EAE37A18223",
      "calls.csv": "99F195932606A4E6248B25431DF758AD51868AAF0EFDF340B7798395EDAB65E9",
      "snapshots.csv": "3EBA23F30CBB73B6B8EC99A791B64489E92AA8A00B65C6447E124829272907F7"
    },
    "visualEvidence": "Frames 0, 122 and 229 show the descent and palette changes. At frame 431 the camera is (272,1135), the right-facing actor and foreground are coherent and the searchlight acquires X. The forced checkpoint bootstrap of previous probes produced visible corruption even when player movement after loading came from the controller. Use this movie for native scene/color references.",
    "spawnFacing": "Body initialization at $07:D776 sets bit 6 in $11 without reading the subtype or player position. All eight children start with the horizontal flip in the actor trace. The renderer mirrors the imported part frames around their shared pivot. The stage 03 DX9 capture and the eight-part draw-box regression cover this correction.",
    "firstBodyFrame": 202,
    "firstGate": { "map": 4, "firstFrame": 242, "lastFrame": 274, "sound": "Song-15/5D", "writes": 8 },
    "secondGate": { "map": 6, "firstFrame": 1913, "lastFrame": 1965, "sound": "Song-15/5D", "writes": 14 },
    "destruction": {
      "healthZeroFrame": 5205,
      "stateChangeFrame": 5206,
      "firstExitFrame": 5207,
      "lastExitFrame": 5448,
      "routeCursor": 169,
      "trailSoundRequests": { "Common/23": 5, "Common/26": 9 },
      "trailEffectAttempts": 29,
      "dropAttempts": 4,
      "dropsSelected": 0,
      "finalGate": { "frame": 5448, "x": 1112, "y": 1352, "map": 6, "sound": null }
    },
    "controlledEarlyExit": {
      "method": "Force only the body health to zero at the first branch (cursor 0D). The earlier forced checkpoint bootstrap is valid here for logic and queue/map commands.",
      "destroyFrame": 2400,
      "sinkHelperUpdates": 239,
      "trailSoundRequests": 15,
      "trailEffectAttempts": 30,
      "dropAttempts": 4,
      "firstRestorationFrame": 2701,
      "lastSoundedRestorationFrame": 2753,
      "finalGateFrame": 2754,
      "lifecycleSha256": "2768C5359A8231DD78D2B0F7BDA10ED8EDA759723E431DBE1CAAA579381378B9",
      "mapsSha256": "840D5D095FD0B0CD75FBD1177C003A92E01E271B20F53D8614B7D206B5288484"
    },
    "fixture": "XSharp.Tests/Fixtures/Enemies/sea-canthller-exit.csv",
    "fixtureSha256Lf": "2487D9397502320686854A669D81376B5804E61B6D651A9736C6793A37E721D9",
    "fixtureTool": "tools/parity/package_sea_canthller_capture.py --exit",
    "comparison": "All 242 natural exit updates match body position, velocity, cue ID, explosion-attempt positions, selected drops, gate and removal. Seed the body at the transition and use the observed start-of-update RNG because other stage actors contribute draws.",
    "dx9Smoke": "Prematurely destroy six linked pieces on imported stage 03, observe cached Common/26, and save at the first of 14 sounded gate writes. The remaining 13 requests and final gate maps agree after loading the save; the final state retires the body and all remaining pieces."
  },
  "pending": [
    "The complete stage route, linked-part combat and the accuracy of the shared native drop slot pool still need engine-side comparison.",
    "The searchlight controller and sound bindings are integrated. Exact PPU color math, interrupted release and X's physical response to beam damage still need end-to-end parity coverage.",
    "The projectile comparisons cover flight and animation. Exact weapon and player contact results, recycled projectile velocity words before the first movement tick, child destruction timing and SPC arbitration still need coverage.",
    "SPC channel arbitration and mixed output need verification separately from the recorded logic-frame requests."
  ]
}
