Mac: fix a crash caused by a race condition when switching ROMs
This commit is contained in:
parent
89f480207d
commit
c12415f351
@ -102,8 +102,7 @@ int macFastForwardRate = 5,
|
||||
unsigned long spcFileCount = 0,
|
||||
pngFileCount = 0;
|
||||
|
||||
bool8 finished = false,
|
||||
cartOpen = false,
|
||||
bool8 cartOpen = false,
|
||||
autofire = false;
|
||||
|
||||
bool8 fullscreen = false,
|
||||
@ -2992,8 +2991,6 @@ void QuitWithFatalError ( NSString *message)
|
||||
|
||||
- (void)start
|
||||
{
|
||||
if (!finished)
|
||||
{
|
||||
#ifdef DEBUGGER
|
||||
CPU.Flags |= DEBUG_MODE_FLAG;
|
||||
S9xDoDebug();
|
||||
@ -3011,37 +3008,7 @@ void QuitWithFatalError ( NSString *message)
|
||||
[NSThread detachNewThreadWithBlock:^
|
||||
{
|
||||
MacSnes9xThread(NULL);
|
||||
|
||||
dispatch_sync(dispatch_get_main_queue(), ^
|
||||
{
|
||||
if (!Settings.NetPlay || Settings.NetPlayServer)
|
||||
{
|
||||
SNES9X_SaveSRAM();
|
||||
S9xResetSaveTimer(false);
|
||||
S9xSaveCheatFile(S9xGetFilename(".cht", CHEAT_DIR));
|
||||
}
|
||||
|
||||
S9xDeinitDisplay();
|
||||
|
||||
if (Settings.NetPlay)
|
||||
{
|
||||
if (!Settings.NetPlayServer)
|
||||
{
|
||||
// DeinitGameWindow();
|
||||
cartOpen = false;
|
||||
}
|
||||
|
||||
Settings.NetPlay = false;
|
||||
Settings.NetPlayServer = false;
|
||||
}
|
||||
|
||||
if (!finished)
|
||||
{
|
||||
[self start];
|
||||
}
|
||||
});
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)stop
|
||||
@ -3183,6 +3150,13 @@ void QuitWithFatalError ( NSString *message)
|
||||
|
||||
- (BOOL)loadROM:(NSURL *)fileURL
|
||||
{
|
||||
running = false;
|
||||
|
||||
while (!Settings.StopEmulation)
|
||||
{
|
||||
usleep(Settings.FrameTime);
|
||||
}
|
||||
|
||||
if ( SNES9X_OpenCart(fileURL) )
|
||||
{
|
||||
SNES9X_Go();
|
||||
|
@ -431,8 +431,6 @@ void SNES9X_Quit (void)
|
||||
S9xResetSaveTimer(false);
|
||||
S9xSaveCheatFile(S9xGetFilename(".cht", CHEAT_DIR));
|
||||
}
|
||||
|
||||
finished = true;
|
||||
}
|
||||
|
||||
void SNES9X_InitSound (void)
|
||||
|
Loading…
Reference in New Issue
Block a user