From e2c27f9c883dd17a51b08316e4cc2df67b113993 Mon Sep 17 00:00:00 2001 From: zeromus Date: Sun, 19 Dec 2010 04:45:05 +0000 Subject: [PATCH] win32: try to make loadstates crash less frequently by fixing spu/mainthread race condition --- desmume/src/windows/hotkey.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/desmume/src/windows/hotkey.cpp b/desmume/src/windows/hotkey.cpp index 3cced7f0a..06baa7458 100644 --- a/desmume/src/windows/hotkey.cpp +++ b/desmume/src/windows/hotkey.cpp @@ -40,6 +40,7 @@ #include "path.h" #include "video.h" #include "winutil.h" +#include "windriver.h" extern LRESULT OpenFile(); //adelikat: Made this an extern here instead of main.h Seemed icky not to limit the scope of this function @@ -196,6 +197,9 @@ void HK_StateLoadSlot(int num, bool justPressed) { if (romloaded && justPressed) { + //keep the spu from running while we do the loadstate (or else it may trample on spu structures in the midst of getting twiddled) + Lock lock; + BOOL wasPaused = paused; Pause(); loadstate_slot(num); //Loadstate