[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:
CasualPokePlayer 2021-04-18 08:05:53 -07:00 committed by GitHub
parent b9123453aa
commit 1fe2a12b67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 5 deletions

View File

@ -1,12 +1,22 @@
while true do
if (movie.isloaded()) then
fps = movie.getfps();
frames = emu.framecount();
tseconds = (frames / fps)
if movie.getheader()["Core"] == "Gambatte" then
clockrate = 2 ^ 21;
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;
shift = 10 ^ 2;
seconds = math.floor((secondsraw * shift) + 0.5) / shift;
secondsstr = string.format("%.2f", seconds)
secondsstr = string.format("%.2f", seconds);
if (seconds < 10) then
secondsstr = "0" .. secondsstr;
end
@ -26,4 +36,4 @@ while true do
gui.text(0, 0, time, nil, 1);
end
emu.frameadvance();
end
end