lua: better typecasting for LuaInt and LuaUInt that doesnt throw overflow exceptions; and, render to a null image when the lua script manager Resume process hasnt begun (setting up a render target) but lua scripts run (due to loadstate, for example)
This commit is contained in:
parent
213e02ffef
commit
436881beaf
|
@ -27,12 +27,12 @@ namespace BizHawk.Client.Common
|
|||
|
||||
protected static int LuaInt(object luaArg)
|
||||
{
|
||||
return Convert.ToInt32((double)luaArg);
|
||||
return (int)(double)luaArg;
|
||||
}
|
||||
|
||||
protected static uint LuaUInt(object luaArg)
|
||||
{
|
||||
return Convert.ToUInt32((double)luaArg);
|
||||
return (uint)(double)luaArg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -132,9 +132,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
return p;
|
||||
}
|
||||
|
||||
Bitmap nullGraphicsBitmap = new Bitmap(1, 1);
|
||||
private Graphics GetGraphics()
|
||||
{
|
||||
var g = luaSurface.GetGraphics();
|
||||
Graphics g;
|
||||
if (luaSurface == null)
|
||||
g = Graphics.FromImage(nullGraphicsBitmap);
|
||||
else g = luaSurface.GetGraphics();
|
||||
int tx = Global.Emulator.CoreComm.ScreenLogicalOffsetX;
|
||||
int ty = Global.Emulator.CoreComm.ScreenLogicalOffsetY;
|
||||
if (tx != 0 || ty != 0)
|
||||
|
|
Loading…
Reference in New Issue