Autolock hack is nothing without autounlock hack

This commit is contained in:
YoshiRulz 2021-02-24 11:12:27 +10:00
parent 2859d6c45b
commit ef0b380192
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
2 changed files with 16 additions and 12 deletions

View File

@ -158,7 +158,11 @@ namespace BizHawk.Client.Common
} }
} }
public void UnlockEmuSurfaceLua() => UnlockSurface(DisplaySurfaceID.EmuCore); public void ThisIsTheLuaAutounlockHack()
{
UnlockSurface(DisplaySurfaceID.EmuCore);
UnlockSurface(DisplaySurfaceID.Client);
}
public void DrawNew(string name, bool clear) public void DrawNew(string name, bool clear)
{ {

View File

@ -169,11 +169,11 @@ namespace BizHawk.Client.EmuHawk
{ {
lf.Call(name); lf.Call(name);
} }
GuiAPI.UnlockEmuSurfaceLua(); GuiAPI.ThisIsTheLuaAutounlockHack();
} }
catch (Exception e) catch (Exception e)
{ {
GuiAPI.UnlockEmuSurfaceLua(); GuiAPI.ThisIsTheLuaAutounlockHack();
LogToLuaConsole($"error running function attached by lua function event.onsavestate\nError message: {e.Message}"); LogToLuaConsole($"error running function attached by lua function event.onsavestate\nError message: {e.Message}");
} }
} }
@ -186,11 +186,11 @@ namespace BizHawk.Client.EmuHawk
{ {
lf.Call(name); lf.Call(name);
} }
GuiAPI.UnlockEmuSurfaceLua(); GuiAPI.ThisIsTheLuaAutounlockHack();
} }
catch (Exception e) catch (Exception e)
{ {
GuiAPI.UnlockEmuSurfaceLua(); GuiAPI.ThisIsTheLuaAutounlockHack();
LogToLuaConsole($"error running function attached by lua function event.onloadstate\nError message: {e.Message}"); LogToLuaConsole($"error running function attached by lua function event.onloadstate\nError message: {e.Message}");
} }
} }
@ -204,11 +204,11 @@ namespace BizHawk.Client.EmuHawk
{ {
lf.Call(); lf.Call();
} }
GuiAPI.UnlockEmuSurfaceLua(); GuiAPI.ThisIsTheLuaAutounlockHack();
} }
catch (Exception e) catch (Exception e)
{ {
GuiAPI.UnlockEmuSurfaceLua(); GuiAPI.ThisIsTheLuaAutounlockHack();
LogToLuaConsole($"error running function attached by lua function event.onframestart\nError message: {e.Message}"); LogToLuaConsole($"error running function attached by lua function event.onframestart\nError message: {e.Message}");
} }
} }
@ -222,11 +222,11 @@ namespace BizHawk.Client.EmuHawk
{ {
lf.Call(); lf.Call();
} }
GuiAPI.UnlockEmuSurfaceLua(); GuiAPI.ThisIsTheLuaAutounlockHack();
} }
catch (Exception e) catch (Exception e)
{ {
GuiAPI.UnlockEmuSurfaceLua(); GuiAPI.ThisIsTheLuaAutounlockHack();
LogToLuaConsole($"error running function attached by lua function event.onframeend\nError message: {e.Message}"); LogToLuaConsole($"error running function attached by lua function event.onframeend\nError message: {e.Message}");
} }
} }
@ -237,7 +237,7 @@ namespace BizHawk.Client.EmuHawk
{ {
exitCallback.Call(); exitCallback.Call();
} }
GuiAPI.UnlockEmuSurfaceLua(); GuiAPI.ThisIsTheLuaAutounlockHack();
} }
public void Close() public void Close()
@ -302,7 +302,7 @@ namespace BizHawk.Client.EmuHawk
LuaLibraryBase.SetCurrentThread(lf); LuaLibraryBase.SetCurrentThread(lf);
var execResult = _currThread.Resume(0); var execResult = _currThread.Resume(0);
GuiAPI.UnlockEmuSurfaceLua(); GuiAPI.ThisIsTheLuaAutounlockHack();
_lua.RunScheduledDisposes(); // TODO: I don't think this is needed anymore, we run this regularly anyway _lua.RunScheduledDisposes(); // TODO: I don't think this is needed anymore, we run this regularly anyway
@ -319,7 +319,7 @@ namespace BizHawk.Client.EmuHawk
} }
catch (Exception) catch (Exception)
{ {
GuiAPI.UnlockEmuSurfaceLua(); GuiAPI.ThisIsTheLuaAutounlockHack();
throw; throw;
} }
finally finally