c# side for previous commit
This commit is contained in:
parent
44944e1d70
commit
d507246033
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue