Files
siegeandClaude Opus 5.5 db02119ef1 Remocon takes over the victim (pad replaced, not ORed; 2 pieces); casting discards the falling pieces
Emulator-verified (re/runs/pw2_rem_*, pw2_disc_*):
- 82:B02E replaces the victim's pad with the caster's (only Start kept); the caster's pad still drives
  the caster's own piece, so one pad steers both. The victim's own buttons do nothing.
- State 13 discards the caster's falling piece at once and everyone else's when the cut-in ends
  (rel ~100, not locked); Mirror (no cut-in) leaves the opponent's piece. So timed powers cover the
  N-1 new pieces after the cast (Remocon: the victim's next 2, matching the wiki).
- Replays: 'faithful' gains a cast_discards flag; older replays keep the old behaviour.
- Match::step copies only player_count inputs into prev_raw_ (a longer span overflowed it).
- Mesen 2.1.1 Lua: port-2 input needs emu.setInput(t, 1, 1); fixed in the capture scripts,
  new re/lua/vs2_make.lua drives a real 2P battle from boot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 17:48:38 -05:00

32 lines
1.5 KiB
Lua

-- Boot the ROM and drive a real 2-player VS battle (both pads), saving a savestate in it.
-- Env: TBG_LIB TBG_OUT TBG_PLAN (battle_lib inputPlan: "f:btn[/hold]" port 1, "p2@f:btn" port 2)
-- TBG_SHOTS "f,f,..." TBG_SAVE_AT frame (writes OUT/state.mss) TBG_END last frame
local L = dofile(os.getenv("TBG_LIB"))
local out = os.getenv("TBG_OUT")
local W = emu.memType.snesWorkRam
local plan = L.inputPlan(os.getenv("TBG_PLAN"))
local shots = {}
for f in (os.getenv("TBG_SHOTS") or ""):gmatch("%d+") do shots[tonumber(f)] = true end
local saveAt = tonumber(os.getenv("TBG_SAVE_AT") or "-1")
local last = tonumber(os.getenv("TBG_END") or "3000")
local frame = 0
local log = io.open(out .. "/log.txt", "w")
emu.addEventCallback(function()
local t = {[0] = {}, [1] = {}}
for _, e in ipairs(plan) do
if frame >= e.f and frame < e.f + e.hold then for b in e.b:gmatch("[^+]+") do t[e.port][b] = true end end
end
emu.setInput(t[0], 0)
emu.setInput(t[1], 1, 1) -- Mesen 2.1.1: port 2 needs the third argument (with (t, 1) it goes to port 1)
end, emu.eventType.inputPolled)
emu.addEventCallback(function()
frame = frame + 1
if frame % 50 == 0 then
log:write(string.format("%d DE=%02X P1st=%02X P2st=%02X E0=%02X E1=%02X\n", frame, emu.read(0xDE, W), emu.read(0x20D, W),
emu.read(0x46D, W), emu.read(0xE0, W), emu.read(0xE1, W)))
end
if shots[frame] then L.shot(string.format("%s/f%05d.png", out, frame)) end
if frame == saveAt then L.save(out .. "/state.mss") end
if frame >= last then log:close(); emu.stop(0) end
end, emu.eventType.endFrame)