Skip to content

Instantly share code, notes, and snippets.

@Skarsnik
Created August 15, 2016 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Skarsnik/d7df0eb03f43881da3df4f6622850d56 to your computer and use it in GitHub Desktop.
Save Skarsnik/d7df0eb03f43881da3df4f6622850d56 to your computer and use it in GitHub Desktop.
local framestarted = 0
function savestateloaded()
framestarted = 0;
end
event.onloadstate(savestateloaded);
function to_rta(ftime)
local cpy = ftime
local minu = math.floor(ftime / 3600)
cpy = cpy - minu * 3600
local sec = math.floor(cpy / 60)
cpy = cpy - sec * 60
local msec = math.floor(cpy * 1/60 * 1000)
return string.format("%02d:%02d:%02d", minu, sec, msec)
end
local old_map_id = 0
local map_frame_count = 0
local map_frame_started = 0
memory.usememorydomain("System Bus")
while true do
gui.text(client.screenwidth() - 80, client.screenheight() - 60, framestarted)
gui.text(client.screenwidth() - 80, client.screenheight() - 30, to_rta(framestarted))
--gui.drawText(180, 180, to_rta(framestarted))
--gui.drawText(200, 200, framestarted)
gui.drawText(190, 0, "F: "..map_frame_count)
gui.drawText(180, 10, to_rta(map_frame_count))
map_id = mainmemory.readbyte(0x0ADB)
framestarted = framestarted + 1
--gui.drawText(200, 140, map_id)
if map_id ~= old_map_id then
--console.write("map changed")
map_frame_count = framestarted - map_frame_started
map_frame_started = framestarted
end
old_map_id = map_id
emu.frameadvance()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment