diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index d2b7b669c2..4272a8953a 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -2296,6 +2296,8 @@ namespace BizHawk.Client.EmuHawk private void CheckMessages() { + using var raMemHack = (RA as RAIntegration)?.ThisIsTheRAMemHack(); + Application.DoEvents(); if (ActiveForm != null) { diff --git a/src/BizHawk.Client.EmuHawk/RetroAchievements/RAIntegration.cs b/src/BizHawk.Client.EmuHawk/RetroAchievements/RAIntegration.cs index 7e1abcfc76..87a227b339 100644 --- a/src/BizHawk.Client.EmuHawk/RetroAchievements/RAIntegration.cs +++ b/src/BizHawk.Client.EmuHawk/RetroAchievements/RAIntegration.cs @@ -281,5 +281,9 @@ namespace BizHawk.Client.EmuHawk RA.DoAchievementsFrame(); } } + + // FIXME: THIS IS GARBAGE + public RAMemGuard.AccessWrapper? ThisIsTheRAMemHack() + => _memGuard.GetAccess(); } } diff --git a/src/BizHawk.Client.EmuHawk/RetroAchievements/RetroAchievements.Memory.cs b/src/BizHawk.Client.EmuHawk/RetroAchievements/RetroAchievements.Memory.cs index 77f80b5214..b95298cff6 100644 --- a/src/BizHawk.Client.EmuHawk/RetroAchievements/RetroAchievements.Memory.cs +++ b/src/BizHawk.Client.EmuHawk/RetroAchievements/RetroAchievements.Memory.cs @@ -21,8 +21,8 @@ namespace BizHawk.Client.EmuHawk { lock (MemSync) { - MemSema.Wait(); MemLock.Wait(); + MemSema.Wait(); } } @@ -37,7 +37,8 @@ namespace BizHawk.Client.EmuHawk 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;