c# side for previous commit

This commit is contained in:
CasualPokePlayer 2022-11-16 21:33:55 -08:00
parent 44944e1d70
commit d507246033
3 changed files with 5 additions and 10 deletions

View File

@ -100,7 +100,7 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
// get double
[BizImport(cc)]
public abstract void mame_lua_get_double(string code, out double ret);
public abstract double mame_lua_get_double(string code);
// get string
[BizImport(cc)]
@ -108,6 +108,6 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
// free string
[BizImport(cc)]
public abstract bool mame_lua_free_string(IntPtr pointer);
public abstract void mame_lua_free_string(IntPtr pointer);
}
}

View File

@ -34,8 +34,8 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
private void UpdateAspect()
{
_core.mame_lua_get_double(MAMELuaCommand.GetBoundX, out var x);
_core.mame_lua_get_double(MAMELuaCommand.GetBoundY, out var y);
var x = _core.mame_lua_get_double(MAMELuaCommand.GetBoundX);
var y = _core.mame_lua_get_double(MAMELuaCommand.GetBoundY);
VirtualHeight = BufferWidth > BufferHeight * x / y
? (int)Math.Round(BufferWidth * y / x)
: BufferHeight;

View File

@ -188,12 +188,7 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
}
var ret = Marshal.PtrToStringAnsi(ptr, lengthInBytes);
if (!_core.mame_lua_free_string(ptr))
{
Console.WriteLine("LibMAME ERROR: string buffer wasn't freed");
}
_core.mame_lua_free_string(ptr);
return ret;
}