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 // 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);
} }
} }

View File

@ -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;

View File

@ -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;
} }