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
This commit is contained in:
parent
5174e012aa
commit
36f2f62305
|
@ -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,8 +148,25 @@
|
|||
<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>
|
||||
|
@ -157,9 +175,9 @@
|
|||
<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>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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) {
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Reference in New Issue