summaryrefslogtreecommitdiff
path: root/macosx/PcsxrController.m
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2011-12-12 03:32:21 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2011-12-12 03:32:21 +0000
commit36f2f623051751cbfcb529d8ebb3a92c20747bab (patch)
treecc3ba36b54ee1e25f0538532265a0c4cbb310d07 /macosx/PcsxrController.m
parent5174e012aae4d340b373c2d7c5d028d6e849d9f8 (diff)
downloadpcsxr-36f2f623051751cbfcb529d8ebb3a92c20747bab.tar.gz
Renaming com.codeplex.pcsxr.mdfdisc to com.alcohol-soft.mdfdisc, since the format appears to have originated from the Alcohol 120% software.
Added support for bin/cue by opening the cue file, then getting the .bin file name from the .cue. Added handling of freeze states and disc images. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@73179 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/PcsxrController.m')
-rw-r--r--macosx/PcsxrController.m38
1 files changed, 29 insertions, 9 deletions
diff --git a/macosx/PcsxrController.m b/macosx/PcsxrController.m
index d284354d..5a635f2f 100644
--- a/macosx/PcsxrController.m
+++ b/macosx/PcsxrController.m
@@ -4,6 +4,8 @@
#import "EmuThread.h"
#import "PcsxrMemCardHandler.h"
#import "PcsxrPluginHandler.h"
+#import "PcsxrDiscHandler.h"
+#import "PcsxrFreezeStateHandler.h"
#include "psxcommon.h"
#include "plugins.h"
#include "misc.h"
@@ -14,6 +16,20 @@ NSDictionary *prefByteKeys;
NSMutableArray *biosList;
NSString *saveStatePath;
+static NSString *HandleBinCue(NSString *toHandle)
+{
+ NSURL *tempURL = [[NSURL alloc] initWithString:toHandle];
+ NSString *extension = [tempURL pathExtension];
+ NSString *newName = toHandle;
+ if ([extension caseInsensitiveCompare:@"cue"] == NSOrderedSame) {
+ NSURL *temp1 = [tempURL URLByDeletingPathExtension];
+ //TODO: handle case-sensitive filesystems
+ NSURL *temp2 = [tempURL URLByAppendingPathExtension:@"bin"];
+ newName = [temp2 path];
+ }
+ return newName;
+}
+
@implementation PcsxrController
- (IBAction)ejectCD:(id)sender
@@ -35,12 +51,12 @@ NSString *saveStatePath;
[openDlg setCanChooseFiles:YES];
[openDlg setCanChooseDirectories:NO];
- [openDlg setAllowedFileTypes:[NSArray arrayWithObjects:@"com.codeplex.pcsxr.mdfdisc", @"bin", @"com.apple.disk-image-ndif", @"public.iso-image", nil]];
+ [openDlg setAllowedFileTypes:[NSArray arrayWithObjects:@"com.alcohol-soft.mdfdisc", @"com.codeplex.pcsxr.cuefile", @"com.apple.disk-image-ndif", @"public.iso-image", nil]];
if ([openDlg runModal] == NSFileHandlingPanelOKButton) {
NSArray* files = [openDlg URLs];
SetCdOpenCaseTime(time(NULL) + 2);
- SetIsoFile((const char *)[[[files objectAtIndex:0] path] fileSystemRepresentation]);
+ SetIsoFile((const char *)[HandleBinCue([[files objectAtIndex:0] path]) fileSystemRepresentation]);
}
[openDlg release];
} else {
@@ -115,11 +131,11 @@ NSString *saveStatePath;
[openDlg setCanChooseFiles:YES];
[openDlg setCanChooseDirectories:NO];
- [openDlg setAllowedFileTypes:[NSArray arrayWithObjects:@"com.codeplex.pcsxr.mdfdisc", @"bin", @"com.apple.disk-image-ndif", @"public.iso-image", nil]];
+ [openDlg setAllowedFileTypes:[NSArray arrayWithObjects:@"com.alcohol-soft.mdfdisc", @"com.codeplex.pcsxr.cuefile", @"com.apple.disk-image-ndif", @"public.iso-image", nil]];
if ([openDlg runModal] == NSFileHandlingPanelOKButton) {
NSArray* urls = [openDlg URLs];
- SetIsoFile((const char *)[[[urls objectAtIndex:0] path] fileSystemRepresentation]);
+ SetIsoFile((const char *)[HandleBinCue([[urls objectAtIndex:0] path]) fileSystemRepresentation]);
[EmuThread run];
}
[openDlg release];
@@ -463,11 +479,15 @@ NSString *saveStatePath;
[hand release];
return isHandled;
} else if(UTTypeEqual((CFStringRef)@"com.codeplex.pcsxr.freeze", (CFStringRef)utiFile)) {
- //TODO: handle freeze states
- return NO;
- } else if(UTTypeEqual((CFStringRef)@"com.codeplex.pcsxr.mdfdisc", (CFStringRef)utiFile) || UTTypeEqual((CFStringRef)@"com.apple.disk-image-ndif", (CFStringRef)utiFile) || UTTypeEqual((CFStringRef)@"public.iso-image", (CFStringRef)utiFile)) {
- //TODO: handle ISOs and family
- return NO;
+ PcsxrFreezeStateHandler *hand = [[PcsxrFreezeStateHandler alloc] init];
+ BOOL isHandled = [hand handleFile:filename];
+ [hand release];
+ return isHandled;
+ } else if(UTTypeEqual(CFSTR("com.alcohol-soft.mdfdisc"), (CFStringRef)utiFile) || UTTypeEqual(CFSTR("com.apple.disk-image-ndif"), (CFStringRef)utiFile) || UTTypeEqual(CFSTR("public.iso-image"), (CFStringRef)utiFile) || UTTypeEqual(CFSTR("com.codeplex.pcsxr.cuefile"), (CFStringRef)utiFile)) {
+ PcsxrDiscHandler *hand = [[PcsxrDiscHandler alloc] init];
+ BOOL isHandled = [hand handleFile:HandleBinCue(filename)];
+ [hand release];
+ return isHandled;
} else {
return NO;
}