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
|
// get double
|
||||||
[BizImport(cc)]
|
[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
|
// get string
|
||||||
[BizImport(cc)]
|
[BizImport(cc)]
|
||||||
|
@ -108,6 +108,6 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
|
||||||
|
|
||||||
// free string
|
// free string
|
||||||
[BizImport(cc)]
|
[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()
|
private void UpdateAspect()
|
||||||
{
|
{
|
||||||
_core.mame_lua_get_double(MAMELuaCommand.GetBoundX, out var x);
|
var x = _core.mame_lua_get_double(MAMELuaCommand.GetBoundX);
|
||||||
_core.mame_lua_get_double(MAMELuaCommand.GetBoundY, out var y);
|
var y = _core.mame_lua_get_double(MAMELuaCommand.GetBoundY);
|
||||||
VirtualHeight = BufferWidth > BufferHeight * x / y
|
VirtualHeight = BufferWidth > BufferHeight * x / y
|
||||||
? (int)Math.Round(BufferWidth * y / x)
|
? (int)Math.Round(BufferWidth * y / x)
|
||||||
: BufferHeight;
|
: BufferHeight;
|
||||||
|
|
|
@ -188,12 +188,7 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
|
||||||
}
|
}
|
||||||
|
|
||||||
var ret = Marshal.PtrToStringAnsi(ptr, lengthInBytes);
|
var ret = Marshal.PtrToStringAnsi(ptr, lengthInBytes);
|
||||||
|
_core.mame_lua_free_string(ptr);
|
||||||
if (!_core.mame_lua_free_string(ptr))
|
|
||||||
{
|
|
||||||
Console.WriteLine("LibMAME ERROR: string buffer wasn't freed");
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue