diff options
| author | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2013-09-22 04:16:10 +0000 |
|---|---|---|
| committer | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2013-09-22 04:16:10 +0000 |
| commit | 4915c5c9f9a86607f3ccdd6eb7c40cc21657fd5c (patch) | |
| tree | b7e6c5c2639d10733abf434c2c55623e846371d5 | |
| parent | da6c47c68c4b154274bddaf141a31832531fb4ab (diff) | |
| download | pcsxr-4915c5c9f9a86607f3ccdd6eb7c40cc21657fd5c.tar.gz | |
Take into account if a user closed the emulator window before a new CD became available on OS X.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@87257 e17a0e51-4ae3-4d35-97c3-1a29b211df97
| -rwxr-xr-x | macosx/EmuThread.m | 20 | ||||
| -rwxr-xr-x | macosx/PcsxrController.m | 19 |
2 files changed, 28 insertions, 11 deletions
diff --git a/macosx/EmuThread.m b/macosx/EmuThread.m index 29f13da8..dc26f9df 100755 --- a/macosx/EmuThread.m +++ b/macosx/EmuThread.m @@ -36,18 +36,18 @@ static pthread_mutex_t eventMutex; NSAssert(![[NSThread currentThread] isEqual:[NSThread mainThread]], @"This function should not be run on the main thread!"); [[NSThread currentThread] setName:@"PSX Emu Background thread"]; + NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; + [center addObserver:self + selector:@selector(emuWindowDidClose:) + name:@"emuWindowDidClose" object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(emuWindowDidClose:) - name:@"emuWindowDidClose" object:nil]; + [center addObserver:self + selector:@selector(emuWindowWantPause:) + name:@"emuWindowWantPause" object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(emuWindowWantPause:) - name:@"emuWindowWantPause" object:nil]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(emuWindowWantResume:) - name:@"emuWindowWantResume" object:nil]; + [center addObserver:self + selector:@selector(emuWindowWantResume:) + name:@"emuWindowWantResume" object:nil]; // we shouldn't change the priority, since we might depend on subthreads //[NSThread setThreadPriority:1.0-((1.0-[NSThread threadPriority])/4.0)]; diff --git a/macosx/PcsxrController.m b/macosx/PcsxrController.m index c7d1e18b..6ddce420 100755 --- a/macosx/PcsxrController.m +++ b/macosx/PcsxrController.m @@ -112,7 +112,7 @@ static BOOL wasPaused; static void PSXDiscAppearedCallback(DADiskRef disk, void *context) { PcsxrController *theSelf = (__bridge PcsxrController*)context; - + //sleep(3); //Is this needed? SetCdOpenCaseTime(time(NULL) + 2); LidInterrupt(); @@ -186,6 +186,14 @@ static void PSXDiscAppearedCallback(DADiskRef disk, void *context) } } +- (void)emuWindowDidClose:(NSNotification*)theNot +{ + if (self.diskSession) { + DASessionUnscheduleFromRunLoop(self.diskSession, CFRunLoopGetMain(), kCFRunLoopCommonModes); + self.diskSession = NULL; + } +} + - (IBAction)pause:(id)sender { if ([EmuThread isPaused]) { @@ -420,8 +428,17 @@ otherblock();\ #define kPCSXRArgumentFreeze @"--freeze" #define kPCSXRArgumentExitAtClose @"--exitAtClose" +- (void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + - (void)awakeFromNib { + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(emuWindowDidClose:) + name:@"emuWindowDidClose" object:nil]; + pluginList = [[PluginList alloc] init]; if (![pluginList configured] /*!Config.Gpu[0] || !Config.Spu[0] || !Config.Pad1[0] || !Config.Cdr[0]*/) { // configure plugins |
