Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local inputlabels = {"A", "B", "Select", "Start", "Right", "Left", "Up", "Down"}
- function get_lcd_status()
- memory.usememorydomain("System Bus")
- return memory.readbyte(0xFF40)
- end
- function determine_lcd_status()
- val = get_lcd_status
- amt = 0x80
- return bit.band(val, amt)
- end
- function getinputbyte()
- if not movie.isloaded() then
- return 0
- end
- local t = movie.getinput(emu.framecount())
- local b = 0
- for i = 0, 7 do
- if t[inputlabels[i + 1]] then
- b = b + bit.lshift(1, i)
- end
- end
- return b
- end
- function tryinput(file)
- local input = getinputbyte()
- while determine_lcd_status ~= 0
- do file:write(string.format(input))
- lastinput = input
- end
- end
- local demo = io.open("bgb.dem", "w")
- local lastinput = -1
- tryinput(demo)
- while emu.framecount() <= movie.length() do
- tryinput(demo)
- emu.frameadvance()
- end
- tryinput(demo)
- demo:close()
- client.pause()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement