--SNES Push-Over
--AV trim script to remove transition frames (v2)
--Run script, run movie, run AV recorder.
--The input ends just before the screen transition to the ending, as G.I. Ant
--goes through a few frames of walking. Just set MovieEndFrame at or before that
--point, and there should be no interruptions for the ending, such as it is.
--FatRatKnight
--Settings
local MovieEndFrame= 266400 --Pick some point before it ends, to record ending.
--##############################################################################
--Stuff to do.
local R1u= memory.read_u8
--******************************************************************************
local function LevelShown()
--******************************************************************************
--Reads a specific memory address to assess whether level is being shown.
--Theoretically, we can modify this function to add delays if desired.
--Will be rather tricky to pick some point before the transitions, though.
return R1u(0x7E01FC,"System Bus") == 0x56
end
--******************************************************************************
local function AV_Trim()
--******************************************************************************
while true do
--Assume we want to record initially.
client.unpause_av()
while LevelShown() do emu.frameadvance() end
--We'll fall right past the emu.frameadvance if level isn't shown.
--If level isn't shown, don't record to video file.
client.pause_av()
while not LevelShown() do
--If the movie is done, we'll want to escape.
if emu.framecount() > MovieEndFrame then client.unpause_av(); return end
--Aside from that, do nothing.
emu.frameadvance()
end
--After this, we wrap back to the start, the level is shown again.
end --forever loop
end --function
AV_Trim()
--******************************************************************************
local function TestFn()
--******************************************************************************
--I'm not an encoder. Since I'm not generating a video file, I need to see how
--my logic works, so this is the test function.
while true do
--All good
print(string.format("Rising edge: %d",emu.framecount()))
while LevelShown() do emu.frameadvance() end
--Not all good
print(string.format("Falling edge: %d",emu.framecount()))
while not LevelShown() do
if emu.framecount() > MovieEndFrame then return end
gui.drawLine( 0, 0,255,223,0xFFFF2000) --Giant red X.
gui.drawLine( 0,223,255, 0,0xFFFF2000) --We love giant red Xes.
emu.frameadvance()
end
end
end
--TestFn()