From 2b8ba2c882c831e71956dcaef175cde2670ee6b5 Mon Sep 17 00:00:00 2001 From: "SND\\MaddTheSane_cp" Date: Mon, 8 Jul 2013 23:35:59 +0000 Subject: Rework the disc handler on OS X a bit. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@85917 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- macosx/PcsxrDiscHandler.h | 4 +++- macosx/PcsxrDiscHandler.m | 30 +++++++++++++----------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/macosx/PcsxrDiscHandler.h b/macosx/PcsxrDiscHandler.h index 150a580c..8ff673fb 100755 --- a/macosx/PcsxrDiscHandler.h +++ b/macosx/PcsxrDiscHandler.h @@ -8,10 +8,12 @@ #import #import "PcsxrFileHandle.h" +#import "ARCBridge.h" @interface PcsxrDiscHandler : NSObject { - NSURL *discURL; + NSURL *_discURL; + __arcweak NSString *discPath; } @end diff --git a/macosx/PcsxrDiscHandler.m b/macosx/PcsxrDiscHandler.m index 6a424ef3..77a35569 100755 --- a/macosx/PcsxrDiscHandler.m +++ b/macosx/PcsxrDiscHandler.m @@ -16,19 +16,21 @@ #import "ARCBridge.h" @interface PcsxrDiscHandler () -@property (arcstrong) NSURL *discURL; +@property (nonatomic, arcstrong) NSURL *discURL; +@property (arcweak) NSString *discPath; @end @implementation PcsxrDiscHandler -@synthesize discURL; +@synthesize discURL = _discURL; +@synthesize discPath; -- (NSURL*)discURLFromFilePath:(NSString *)filePath +- (NSURL*)discURL { - if (!discURL) { - self.discURL = [NSURL fileURLWithPath:filePath isDirectory:NO]; + if (!_discURL) { + self.discURL = [NSURL fileURLWithPath:discPath isDirectory:NO]; } - return self.discURL; + return _discURL; } + (NSArray *)supportedUTIs @@ -42,19 +44,13 @@ - (BOOL)handleFile:(NSString *)theFile { + self.discPath = theFile; PcsxrController *appDelegate = [NSApp delegate]; - if ([EmuThread active] == YES) { - if (UsingIso()) { - SetIsoFile([theFile fileSystemRepresentation]); - SetCdOpenCaseTime(time(NULL) + 2); - LidInterrupt(); - } else { - return NO; - } - } else { - [appDelegate runURL:[self discURLFromFilePath:theFile]]; + if ([EmuThread active] == YES && !UsingIso()) { + return NO; } - [[appDelegate recentItems] addRecentItem:[self discURLFromFilePath:theFile]]; + [appDelegate runURL:[self discURL]]; + [[appDelegate recentItems] addRecentItem:[self discURL]]; return YES; } -- cgit v1.2.3