diff --git a/macosx/Snes9x/AppDelegate.m b/macosx/Snes9x/AppDelegate.m index 1b462171..46575a5a 100644 --- a/macosx/Snes9x/AppDelegate.m +++ b/macosx/Snes9x/AppDelegate.m @@ -68,12 +68,12 @@ static NSWindowFrameAutosaveName const kMainWindowIdentifier = @"s9xMainWindow"; [NSNotificationCenter.defaultCenter addObserverForName:NSWindowWillCloseNotification object:window queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification *notification) { - [self.s9xEngine pause]; + [self.s9xEngine quit]; }]; } - (void)applicationWillTerminate:(NSNotification *)aNotification { - // Insert code here to tear down your application + [self.s9xEngine quit]; } - (void)setupDefaults diff --git a/macosx/mac-os.h b/macosx/mac-os.h index 76687519..e0eebf10 100644 --- a/macosx/mac-os.h +++ b/macosx/mac-os.h @@ -167,6 +167,7 @@ extern id inputDelegate; - (BOOL)isRunning; - (BOOL)isPaused; - (void)pause; +- (void)quit; - (void)resume; - (BOOL)setButton:(S9xButtonCode)button forKey:(int16)key player:(int8)player oldButton:(S9xButtonCode *)oldButton oldPlayer:(int8 *)oldPlayer oldKey:(int16 *)oldKey; diff --git a/macosx/mac-os.mm b/macosx/mac-os.mm index 8361bffa..09f98c40 100644 --- a/macosx/mac-os.mm +++ b/macosx/mac-os.mm @@ -3015,6 +3015,7 @@ void QuitWithFatalError ( NSString *message) - (void)stop { + SNES9X_Quit(); S9xExit(); } @@ -3034,6 +3035,12 @@ void QuitWithFatalError ( NSString *message) [s9xView setNeedsDisplay:YES]; } +- (void)quit +{ + SNES9X_Quit(); + [self pause]; +} + - (void)resume { pauseEmulation = false;