User File #39098377862509653

Upload All User Files

#39098377862509653 - SNES Push-Over - Script to skip transitions.

PushOver_AVskipTransitions.lua
749 downloads
Uploaded 5/18/2017 6:56 PM by FatRatKnight (see all 245)
I request an encoder takes a look at this script and tries stuff. For use with BizHawk while running (SNES) Push-Over and a TAS of it, and creating a video file of it.
The basic idea is to get rid of screen transitions, and the address I found seems to indicate the moments where the game screen is visible and G.I. Ant can be seen going through doors. I've ran the test function and I can't find any errors in the logic I used, and this address really does look like this magic screen transition detection value.
This script is intended for encoder use. I don't really touch encoding myself, so I'm hoping the script works fine fresh off this page. Might be jarring that it goes straight from G.I. Ant going in one door and immediately the screen's at the other door he's going out of.
Enough explanation. Here's hoping it works as advertised, and all you have to do is run BizHawk, this script, and activate whatever encoding function is necessary to produce some kind of media file.
--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()