diff options
| author | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2011-12-12 03:32:21 +0000 |
|---|---|---|
| committer | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2011-12-12 03:32:21 +0000 |
| commit | 36f2f623051751cbfcb529d8ebb3a92c20747bab (patch) | |
| tree | cc3ba36b54ee1e25f0538532265a0c4cbb310d07 | |
| parent | 5174e012aae4d340b373c2d7c5d028d6e849d9f8 (diff) | |
| download | pcsxr-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
| -rw-r--r-- | macosx/Info.plist | 29 | ||||
| -rw-r--r-- | macosx/PcsxrController.m | 38 | ||||
| -rw-r--r-- | macosx/PcsxrDiscHandler.h | 14 | ||||
| -rw-r--r-- | macosx/PcsxrDiscHandler.m | 23 | ||||
| -rw-r--r-- | macosx/PcsxrFreezeStateHandler.h | 14 | ||||
| -rw-r--r-- | macosx/PcsxrFreezeStateHandler.m | 26 | ||||
| -rw-r--r-- | macosx/PcsxrMemCardHandler.m | 9 | ||||
| -rw-r--r-- | macosx/PcsxrPluginHandler.m | 9 |
8 files changed, 137 insertions, 25 deletions
diff --git a/macosx/Info.plist b/macosx/Info.plist index c7a63a03..faeab05d 100644 --- a/macosx/Info.plist +++ b/macosx/Info.plist @@ -110,8 +110,9 @@ <string>Viewer</string> <key>LSItemContentTypes</key> <array> - <string>com.codeplex.pcsxr.mdfdisc</string> + <string>com.alcohol-soft.mdfdisc</string> <string>com.apple.disk-image-ndif</string> + <string>com.codeplex.pcsxr.cuefile</string> <string>public.iso-image</string> </array> </dict> @@ -147,19 +148,36 @@ <string>PCSXR</string> <key>NSPrincipalClass</key> <string>NSApplication</string> - <key>UTExportedTypeDeclarations</key> + <key>UTImportedTypeDeclarations</key> <array> <dict> <key>UTTypeConformsTo</key> <array> + <string></string> + </array> + <key>UTTypeIdentifier</key> + <string>com.codeplex.pcsxr.cuefile</string> + <key>UTTypeDescription</key> + <string>bin/cue Disc Image</string> + <key>UTTypeTagSpecification</key> + <dict> + <key>public.filename-extension</key> + <array> + <string>cue</string> + </array> + </dict> + </dict> + <dict> + <key>UTTypeConformsTo</key> + <array> <string>public.disk-image</string> <string>public.content</string> <string>public.data</string> </array> <key>UTTypeDescription</key> - <string>PlayStation Disc</string> + <string>Alcohol Disc Image</string> <key>UTTypeIdentifier</key> - <string>com.codeplex.pcsxr.mdfdisc</string> + <string>com.alcohol-soft.mdfdisc</string> <key>UTTypeTagSpecification</key> <dict> <key>public.filename-extension</key> @@ -168,6 +186,9 @@ </array> </dict> </dict> + </array> + <key>UTExportedTypeDeclarations</key> + <array> <dict> <key>UTTypeConformsTo</key> <array> 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; } diff --git a/macosx/PcsxrDiscHandler.h b/macosx/PcsxrDiscHandler.h new file mode 100644 index 00000000..933d7799 --- /dev/null +++ b/macosx/PcsxrDiscHandler.h @@ -0,0 +1,14 @@ +// +// PcsxrDiscHandler.h +// Pcsxr +// +// Created by Charles Betts on 12/11/11. +// Copyright (c) 2011 __MyCompanyName__. All rights reserved. +// + +#import <Foundation/Foundation.h> +#import "PcsxrFileHandle.h" + +@interface PcsxrDiscHandler : NSObject <PcsxrFileHandle> + +@end diff --git a/macosx/PcsxrDiscHandler.m b/macosx/PcsxrDiscHandler.m new file mode 100644 index 00000000..16a9582f --- /dev/null +++ b/macosx/PcsxrDiscHandler.m @@ -0,0 +1,23 @@ +// +// PcsxrDiscHandler.m +// Pcsxr +// +// Created by Charles Betts on 12/11/11. +// Copyright (c) 2011 __MyCompanyName__. All rights reserved. +// + +#import "PcsxrDiscHandler.h" +#import "EmuThread.h" +#include "psxcommon.h" +#include "plugins.h" + +@implementation PcsxrDiscHandler + +- (BOOL)handleFile:(NSString *)theFile +{ + SetIsoFile([theFile fileSystemRepresentation]); + [EmuThread run]; + return YES; +} + +@end diff --git a/macosx/PcsxrFreezeStateHandler.h b/macosx/PcsxrFreezeStateHandler.h new file mode 100644 index 00000000..ca50f533 --- /dev/null +++ b/macosx/PcsxrFreezeStateHandler.h @@ -0,0 +1,14 @@ +// +// PcsxrFreezeStateHandler.h +// Pcsxr +// +// Created by Charles Betts on 12/11/11. +// Copyright (c) 2011 __MyCompanyName__. All rights reserved. +// + +#import <Foundation/Foundation.h> +#import "PcsxrFileHandle.h" + +@interface PcsxrFreezeStateHandler : NSObject <PcsxrFileHandle> + +@end diff --git a/macosx/PcsxrFreezeStateHandler.m b/macosx/PcsxrFreezeStateHandler.m new file mode 100644 index 00000000..9bb6659a --- /dev/null +++ b/macosx/PcsxrFreezeStateHandler.m @@ -0,0 +1,26 @@ +// +// PcsxrFreezeStateHandler.m +// Pcsxr +// +// Created by Charles Betts on 12/11/11. +// Copyright (c) 2011 __MyCompanyName__. All rights reserved. +// + +#import "PcsxrFreezeStateHandler.h" +#import "EmuThread.h" +#include "misc.h" + +@implementation PcsxrFreezeStateHandler + +- (BOOL)handleFile:(NSString *)theFile +{ + if (CheckState([theFile fileSystemRepresentation]) != 0) { + return NO; + } + if ([EmuThread active]) { + [EmuThread run]; + } + [EmuThread defrostAt:theFile]; +} + +@end diff --git a/macosx/PcsxrMemCardHandler.m b/macosx/PcsxrMemCardHandler.m index 4cfcb513..2d4e1080 100644 --- a/macosx/PcsxrMemCardHandler.m +++ b/macosx/PcsxrMemCardHandler.m @@ -15,17 +15,15 @@ { self = [super initWithWindow:window]; if (self) { - // Initialization code here. - } + memChosen = 0; + } return self; } - (id)init { - if (self = [super initWithWindowNibName:@"PcsxrMemCardDocument"]) { - memChosen = 0; - } + self = [super initWithWindowNibName:@"PcsxrMemCardDocument"]; return self; } @@ -53,7 +51,6 @@ [NSApp runModalForWindow:[self window]]; - [NSApp endSheet:[self window]]; [[self window] orderOut:self]; if (memChosen != 0) { diff --git a/macosx/PcsxrPluginHandler.m b/macosx/PcsxrPluginHandler.m index 84919c56..7ab00161 100644 --- a/macosx/PcsxrPluginHandler.m +++ b/macosx/PcsxrPluginHandler.m @@ -14,7 +14,7 @@ { self = [super initWithWindow:window]; if (self) { - // Initialization code here. + moveOK = NO; } return self; @@ -22,9 +22,7 @@ - (id)init { - if (self = [super initWithWindowNibName:@"AddPluginSheet"]) { - moveOK = NO; - } + self = [super initWithWindowNibName:@"AddPluginSheet"]; return self; } @@ -53,8 +51,7 @@ [pluginName setObjectValue:[[NSURL fileURLWithPath:theFile] lastPathComponent]]; [NSApp runModalForWindow:[self window]]; - // Sheet is up here. - [NSApp endSheet:[self window]]; + [[self window] orderOut:self]; if (moveOK == YES) { NSFileWrapper *wrapper = [[NSFileWrapper alloc] initWithPath:theFile]; |
