mame_lua_get_bool() doesn't work with gcc for whatever reason...

This commit is contained in:
feos 2019-12-29 00:13:31 +03:00
parent 4ef8c8e34c
commit 3a464eed60
1 changed files with 6 additions and 18 deletions

View File

@ -16,7 +16,7 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
name: "MAME", name: "MAME",
author: "MAMEDev", author: "MAMEDev",
isPorted: true, isPorted: true,
portedVersion: "0.216", portedVersion: "0.217",
portedUrl: "https://github.com/mamedev/mame.git", portedUrl: "https://github.com/mamedev/mame.git",
singleInstance: false)] singleInstance: false)]
public partial class MAME : IEmulator, IVideoProvider, ISoundProvider, ISettable<object, MAME.SyncSettings> public partial class MAME : IEmulator, IVideoProvider, ISoundProvider, ISettable<object, MAME.SyncSettings>
@ -298,30 +298,18 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
endian = MemoryDomain.Endian.Big; endian = MemoryDomain.Endian.Big;
} }
if (LibMAME.mame_lua_get_bool("return true"))
{
int i = 0;
}
if (LibMAME.mame_lua_get_bool("return false"))
{
int i = 1;
}
var mapCount = LibMAME.mame_lua_get_int(MAMELuaCommand.GetSpaceMapCount); var mapCount = LibMAME.mame_lua_get_int(MAMELuaCommand.GetSpaceMapCount);
for (int i = 1; i <= mapCount; i++) for (int i = 1; i <= mapCount; i++)
{ {
var read = MameGetString($"{ MAMELuaCommand.SpaceMap }[{ i }].readtype"); var read = MameGetString($"return { MAMELuaCommand.SpaceMap }[{ i }].readtype");
var write = MameGetString($"{ MAMELuaCommand.SpaceMap }[{ i }].writetype"); var write = MameGetString($"return { MAMELuaCommand.SpaceMap }[{ i }].writetype");
if (read == "ram" && write == "ram" /* || read == "rom" */)
if (LibMAME.mame_lua_get_bool(
$"local entry = { MAMELuaCommand.SpaceMap }[{ i }] " +
"return (entry.readtype == \"ram\" and entry.writetype == \"ram\")"))
{ {
var firstOffset = LibMAME.mame_lua_get_int($"return { MAMELuaCommand.SpaceMap }[{ i }].offset"); var firstOffset = LibMAME.mame_lua_get_int($"return { MAMELuaCommand.SpaceMap }[{ i }].offset");
var lastOffset = LibMAME.mame_lua_get_int($"return { MAMELuaCommand.SpaceMap }[{ i }].endoff"); var lastOffset = LibMAME.mame_lua_get_int($"return { MAMELuaCommand.SpaceMap }[{ i }].endoff");
var name = $"RAM { firstOffset:X}-{ lastOffset:X}"; var name = $"{ read.ToUpper() } { firstOffset:X}-{ lastOffset:X}";
domains.Add(new MemoryDomainDelegate(name, lastOffset - firstOffset + 1, endian, domains.Add(new MemoryDomainDelegate(name, lastOffset - firstOffset + 1, endian,
delegate (long addr) delegate (long addr)
@ -339,7 +327,7 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
_memAccess = false; _memAccess = false;
return val; return val;
}, },
delegate (long addr, byte val) read == "rom" ? (Action<long, byte>)null : delegate (long addr, byte val)
{ {
if (addr < 0 || addr >= size) if (addr < 0 || addr >= size)
{ {