--SNES Push-Over
--AV trim script to remove transition frames
--Run script, run movie, run AV recorder.
--MovieEndFrame should be some point before the actual end of input, if you want
--to record the ending uninterrupted. Several hundred frames is a good guess.
--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.currentframe() > 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()