Skip to content

Instantly share code, notes, and snippets.

@primaryobjects
Created February 24, 2026 03:58
Show Gist options
  • Select an option

  • Save primaryobjects/0164befa67425ac9c29fb644385d0c7f to your computer and use it in GitHub Desktop.

Select an option

Save primaryobjects/0164befa67425ac9c29fb644385d0c7f to your computer and use it in GitHub Desktop.
FCEUX script to automatically capture screenshots from Nintendo (nes) roms
-- Download https://fceux.com/web/download.html
-- FCEUX 2.6.6 Qt/SDL win64 Binary
-- Usage:
-- .\qfceux.exe 1942.nes --loadlua ../luascripts/capture.lua
local frame = 0
local count = 0
while count <= 3 do
frame = frame + 1
-- Tap Start repeatedly for the first ~5 seconds
if frame < 300 and frame % 20 == 0 then
joypad.set(1, { start = true })
else
joypad.set(1, { start = false })
end
-- Screenshot logic
if frame % 240 == 0 then
local filename = string.format("C:/Users/<YOUR_USER>/fceux/snaps/screenshot_%05d.png", frame)
gui.savescreenshotas(filename)
emu.print("Saved: ", filename)
count = count + 1
end
emu.frameadvance()
end
os.exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment