fix deadlocks in RAIntegration for real this time (i hate this hack)

fixes f8a5adecb5
This commit is contained in:
CasualPokePlayer 2023-01-25 23:36:46 -08:00
parent 03077daf71
commit 713944724d
3 changed files with 9 additions and 2 deletions

View File

@ -2296,6 +2296,8 @@ namespace BizHawk.Client.EmuHawk
private void CheckMessages() private void CheckMessages()
{ {
using var raMemHack = (RA as RAIntegration)?.ThisIsTheRAMemHack();
Application.DoEvents(); Application.DoEvents();
if (ActiveForm != null) if (ActiveForm != null)
{ {

View File

@ -281,5 +281,9 @@ namespace BizHawk.Client.EmuHawk
RA.DoAchievementsFrame(); RA.DoAchievementsFrame();
} }
} }
// FIXME: THIS IS GARBAGE
public RAMemGuard.AccessWrapper? ThisIsTheRAMemHack()
=> _memGuard.GetAccess();
} }
} }

View File

@ -21,8 +21,8 @@ namespace BizHawk.Client.EmuHawk
{ {
lock (MemSync) lock (MemSync)
{ {
MemSema.Wait();
MemLock.Wait(); MemLock.Wait();
MemSema.Wait();
} }
} }
@ -37,7 +37,8 @@ namespace BizHawk.Client.EmuHawk
MemSema.Dispose(); MemSema.Dispose();
} }
public readonly ref struct AccessWrapper // can't be a ref struct due to ThisIsTheRAMemHack :(
public readonly struct AccessWrapper : IDisposable
{ {
private readonly RAMemGuard _guard; private readonly RAMemGuard _guard;