address #3715 (need to fix hawk side aspect ratio)

This commit is contained in:
feos 2023-12-03 03:12:58 +03:00
parent 73bb9b4bd9
commit 0efdd02085
2 changed files with 45 additions and 3 deletions

View File

@ -120,6 +120,11 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
{
_core.mame_lua_execute($"{ s.LuaCode }.user_value = { setting.Value }");
}
if (s != null && s.Type == SettingType.VIEW)
{
_core.mame_lua_execute($"{ s.LuaCode } = { setting.Value }");
}
}
}
@ -189,6 +194,35 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
}
}
private void GetViewsInfo()
{
var ViewsInfo = MameGetString(MAMELuaCommand.GetViewsInfo);
var Views = ViewsInfo.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
var setting = new DriverSetting
{
Name = "View",
GameName = _gameShortName,
LuaCode = "manager.machine.video.snapshot_target.view_index",
Type = SettingType.VIEW,
DefaultValue = "1"
};
foreach (var View in Views)
{
if (View != string.Empty)
{
var substrings = View.Split(',');
setting.Options.Add(substrings[0], substrings[1]);
}
}
if (setting.Options.Count > 0)
{
CurrentDriverSettings.Add(setting);
}
}
public class DriverSetting
{
public string Name { get; set; }
@ -210,7 +244,7 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
public enum SettingType
{
DIPSWITCH, BIOS
DIPSWITCH, BIOS, VIEW
}
}
}

View File

@ -240,6 +240,7 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
GetNVRAMFilenames();
GetInputFields();
GetROMsInfo();
GetViewsInfo();
FetchDefaultGameSettings();
OverrideGameSettings();
@ -363,10 +364,10 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
"return v.refresh_attoseconds " +
"end";
public const string GetBoundX =
"local b = manager.machine.render.ui_target.current_view.bounds " +
"local b = manager.machine.video.snapshot_target.current_view.bounds " +
"return b.x1-b.x0";
public const string GetBoundY =
"local b = manager.machine.render.ui_target.current_view.bounds " +
"local b = manager.machine.video.snapshot_target.current_view.bounds " +
"return b.y1-b.y0";
public const string GetROMsInfo =
"local final = {} " +
@ -413,6 +414,13 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
"end " +
"table.sort(final) " +
"return table.concat(final)";
public const string GetViewsInfo =
"local final = {} " +
"for index, name in pairs(manager.machine.video.snapshot_target.view_names) do " +
"table.insert(final, string.format(\"%s,%s;\", index, name)) " +
"end " +
"table.sort(final) " +
"return table.concat(final)";
public static string GetFramerateDenominator(int frequency) =>
"for k,v in pairs(manager.machine.screens) do " +