Skip to content

Commit ef0b380

Browse files
committed
Autolock hack is nothing without autounlock hack
1 parent 2859d6c commit ef0b380

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

src/BizHawk.Client.Common/Api/Classes/GuiApi.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,11 @@ public void WithSurface(DisplaySurfaceID surfaceID, Action drawingCallsFunc)
158158
}
159159
}
160160

161-
public void UnlockEmuSurfaceLua() => UnlockSurface(DisplaySurfaceID.EmuCore);
161+
public void ThisIsTheLuaAutounlockHack()
162+
{
163+
UnlockSurface(DisplaySurfaceID.EmuCore);
164+
UnlockSurface(DisplaySurfaceID.Client);
165+
}
162166

163167
public void DrawNew(string name, bool clear)
164168
{

src/BizHawk.Client.EmuHawk/tools/Lua/Win32LuaLibraries.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,11 @@ public void CallSaveStateEvent(string name)
169169
{
170170
lf.Call(name);
171171
}
172-
GuiAPI.UnlockEmuSurfaceLua();
172+
GuiAPI.ThisIsTheLuaAutounlockHack();
173173
}
174174
catch (Exception e)
175175
{
176-
GuiAPI.UnlockEmuSurfaceLua();
176+
GuiAPI.ThisIsTheLuaAutounlockHack();
177177
LogToLuaConsole($"error running function attached by lua function event.onsavestate\nError message: {e.Message}");
178178
}
179179
}
@@ -186,11 +186,11 @@ public void CallLoadStateEvent(string name)
186186
{
187187
lf.Call(name);
188188
}
189-
GuiAPI.UnlockEmuSurfaceLua();
189+
GuiAPI.ThisIsTheLuaAutounlockHack();
190190
}
191191
catch (Exception e)
192192
{
193-
GuiAPI.UnlockEmuSurfaceLua();
193+
GuiAPI.ThisIsTheLuaAutounlockHack();
194194
LogToLuaConsole($"error running function attached by lua function event.onloadstate\nError message: {e.Message}");
195195
}
196196
}
@@ -204,11 +204,11 @@ public void CallFrameBeforeEvent()
204204
{
205205
lf.Call();
206206
}
207-
GuiAPI.UnlockEmuSurfaceLua();
207+
GuiAPI.ThisIsTheLuaAutounlockHack();
208208
}
209209
catch (Exception e)
210210
{
211-
GuiAPI.UnlockEmuSurfaceLua();
211+
GuiAPI.ThisIsTheLuaAutounlockHack();
212212
LogToLuaConsole($"error running function attached by lua function event.onframestart\nError message: {e.Message}");
213213
}
214214
}
@@ -222,11 +222,11 @@ public void CallFrameAfterEvent()
222222
{
223223
lf.Call();
224224
}
225-
GuiAPI.UnlockEmuSurfaceLua();
225+
GuiAPI.ThisIsTheLuaAutounlockHack();
226226
}
227227
catch (Exception e)
228228
{
229-
GuiAPI.UnlockEmuSurfaceLua();
229+
GuiAPI.ThisIsTheLuaAutounlockHack();
230230
LogToLuaConsole($"error running function attached by lua function event.onframeend\nError message: {e.Message}");
231231
}
232232
}
@@ -237,7 +237,7 @@ public void CallExitEvent(LuaFile lf)
237237
{
238238
exitCallback.Call();
239239
}
240-
GuiAPI.UnlockEmuSurfaceLua();
240+
GuiAPI.ThisIsTheLuaAutounlockHack();
241241
}
242242

243243
public void Close()
@@ -302,7 +302,7 @@ public void ExecuteString(string command)
302302
LuaLibraryBase.SetCurrentThread(lf);
303303

304304
var execResult = _currThread.Resume(0);
305-
GuiAPI.UnlockEmuSurfaceLua();
305+
GuiAPI.ThisIsTheLuaAutounlockHack();
306306

307307
_lua.RunScheduledDisposes(); // TODO: I don't think this is needed anymore, we run this regularly anyway
308308

@@ -319,7 +319,7 @@ public void ExecuteString(string command)
319319
}
320320
catch (Exception)
321321
{
322-
GuiAPI.UnlockEmuSurfaceLua();
322+
GuiAPI.ThisIsTheLuaAutounlockHack();
323323
throw;
324324
}
325325
finally

0 commit comments

Comments
 (0)