mame: use biggest int multiple of 60 as a framerate numerator

denominator is determined by taking refresh attoseconts `as_ticks(numerator)` which reduces the initial 64bit value to what can be used for video

mame needs flat 60fps for screenless machines, so we use a numerator that is a multiple, while also being a tiny bit more accurate than with 1,000,000,000
This commit is contained in:
vadosnaprimer 2023-04-02 16:53:00 +03:00
parent df71de64c8
commit d95cd4becb
2 changed files with 6 additions and 2 deletions

View File

@ -27,9 +27,9 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
private void UpdateFramerate()
{
VsyncNumerator = 1000000000;
VsyncAttoseconds = _core.mame_lua_get_long(MAMELuaCommand.GetRefresh);
VsyncDenominator = (int)(VsyncAttoseconds / 1000000000);
VsyncNumerator = 0x7ffffff8;
VsyncDenominator = _core.mame_lua_get_int(MAMELuaCommand.GetFramerateDenominator(VsyncNumerator));
}
private void UpdateAspect()

View File

@ -331,6 +331,10 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
"table.sort(final) " +
"return table.concat(final)";
public static string GetFramerateDenominator(int frequency) =>
"for k,v in pairs(manager.machine.screens) do " +
$"return emu.attotime(0, v.refresh_attoseconds):as_ticks({ frequency }) " +
"end";
public static string MakeLookupKey(string gameName, string luaCode) =>
$"[{ gameName }] { luaCode }";
public static string InputField(string tag, string fieldName) =>