win32: try to make loadstates crash less frequently by fixing spu/mainthread race condition

This commit is contained in:
zeromus 2010-12-19 04:45:05 +00:00
parent f13fabcc73
commit e2c27f9c88
1 changed files with 4 additions and 0 deletions

View File

@ -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