[MovieClock.lua] use cycle based time for Gambatte/SubGBHawk (#2708)
* use cycle based time for Gambatte/SubGBHawk * non-functional cleanup
This commit is contained in:
parent
b9123453aa
commit
1fe2a12b67
|
@ -1,12 +1,22 @@
|
||||||
while true do
|
while true do
|
||||||
if (movie.isloaded()) then
|
if (movie.isloaded()) then
|
||||||
fps = movie.getfps();
|
if movie.getheader()["Core"] == "Gambatte" then
|
||||||
frames = emu.framecount();
|
clockrate = 2 ^ 21;
|
||||||
tseconds = (frames / fps)
|
cycles = emu.totalexecutedcycles();
|
||||||
|
tseconds = (cycles / clockrate);
|
||||||
|
elseif movie.getheader()["Core"] == "SubGBHawk" then
|
||||||
|
clockrate = 2 ^ 22;
|
||||||
|
cycles = emu.totalexecutedcycles();
|
||||||
|
tseconds = (cycles / clockrate);
|
||||||
|
else
|
||||||
|
fps = movie.getfps();
|
||||||
|
frames = emu.framecount();
|
||||||
|
tseconds = (frames / fps);
|
||||||
|
end
|
||||||
secondsraw = tseconds % 60;
|
secondsraw = tseconds % 60;
|
||||||
shift = 10 ^ 2;
|
shift = 10 ^ 2;
|
||||||
seconds = math.floor((secondsraw * shift) + 0.5) / shift;
|
seconds = math.floor((secondsraw * shift) + 0.5) / shift;
|
||||||
secondsstr = string.format("%.2f", seconds)
|
secondsstr = string.format("%.2f", seconds);
|
||||||
if (seconds < 10) then
|
if (seconds < 10) then
|
||||||
secondsstr = "0" .. secondsstr;
|
secondsstr = "0" .. secondsstr;
|
||||||
end
|
end
|
||||||
|
@ -26,4 +36,4 @@ while true do
|
||||||
gui.text(0, 0, time, nil, 1);
|
gui.text(0, 0, time, nil, 1);
|
||||||
end
|
end
|
||||||
emu.frameadvance();
|
emu.frameadvance();
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue