This commit is contained in:
feos 2023-12-03 15:50:49 +03:00
parent 79baa45ca6
commit 688fb249f9
3 changed files with 17 additions and 12 deletions

View File

@ -22,6 +22,7 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
public const int BIOS_INDEX = 24;
public const int BIOS_FIRST = 1;
public const string BIOS_LUA_CODE = "bios";
public const string VIEW_LUA_CODE = "manager.machine.video.snapshot_target.view_names[]";
// main launcher
[BizImport(cc, Compatibility = true)]

View File

@ -120,11 +120,6 @@ 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 }");
}
}
}
@ -203,9 +198,9 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
{
Name = "View",
GameName = _gameShortName,
LuaCode = "manager.machine.video.snapshot_target.view_index",
LuaCode = LibMAME.VIEW_LUA_CODE,
Type = SettingType.VIEW,
DefaultValue = "1"
DefaultValue = MameGetString(MAMELuaCommand.GetViewName("1"))
};
foreach (var View in Views)
@ -213,7 +208,7 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
if (View != string.Empty)
{
var substrings = View.Split(',');
setting.Options.Add(substrings[0], substrings[1]);
setting.Options.Add(substrings[1], substrings[1]);
}
}

View File

@ -224,17 +224,24 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
if (_syncSettings.DriverSettings.TryGetValue(
MAMELuaCommand.MakeLookupKey(gameName, LibMAME.BIOS_LUA_CODE),
out var value))
out var biosValue))
{
args.AddRange(new[] { "-bios", value });
args.AddRange(new[] { "-bios", biosValue });
}
if (_syncSettings.DriverSettings.TryGetValue(
MAMELuaCommand.MakeLookupKey(gameName, LibMAME.VIEW_LUA_CODE),
out var viewValue))
{
args.AddRange(new[] { "-snapview", viewValue });
}
if (_core.mame_launch(args.Count, args.ToArray()) == 0)
{
CheckVersions();
UpdateGameName();
UpdateVideo();
UpdateAspect();
UpdateVideo();
UpdateFramerate();
InitMemoryDomains();
GetNVRAMFilenames();
@ -364,7 +371,7 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
"return v.refresh_attoseconds " +
"end";
public const string GetBoundX =
"return tostring(manager.machine.video.snapshot_target.current_view.bounds.width)";
"return manager.machine.video.snapshot_target.current_view.bounds.width";
public const string GetBoundY =
"return manager.machine.video.snapshot_target.current_view.bounds.height";
public const string GetROMsInfo =
@ -444,6 +451,8 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
"end " +
"table.sort(final) " +
"return table.concat(final)";
public static string GetViewName(string index) =>
$"return manager.machine.video.snapshot_target.view_names[{ index }]";
}
}
}