Skip to content

Instantly share code, notes, and snippets.

@kism
Created October 15, 2022 23:13
Show Gist options
  • Save kism/ded7773c5a254da4bcae865c2cdfa459 to your computer and use it in GitHub Desktop.
Save kism/ded7773c5a254da4bcae865c2cdfa459 to your computer and use it in GitHub Desktop.
function main()
-- Settings
local saveinterval = 7200
local path = "C:\\Temp\\" -- Use double backslash \\ instead of backslash \
-- Dont touch
local frame = 0
local filename = ""
local gamename = gameinfo.getromname()
console.log("Starting auto savestate script")
console.log("Saving to: " .. path)
console.log("Saving every: " .. saveinterval .. " frames")
console.log("This should be every: " .. tostring(saveinterval / 3600) .. " minutes")
while true do
frame = frame + 1
if frame > saveinterval then
-- console.log(joypad.get(1)['Start'])
filename = path .. gamename .. os.date(" %Y-%m-%d %H-%M-%S") .. ".state"
console.log(filename)
savestate.save(filename)
frame = 0
end
emu.frameadvance()
end
end
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment