2011-12-12 04:32:21 +01:00
|
|
|
|
//
|
|
|
|
|
// 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"
|
2013-06-20 22:42:46 +02:00
|
|
|
|
#include "cdrom.h"
|
2013-01-09 02:50:38 +01:00
|
|
|
|
#import "RecentItemsMenu.h"
|
|
|
|
|
#import "PcsxrController.h"
|
2011-12-12 04:32:21 +01:00
|
|
|
|
|
2013-06-26 06:45:19 +02:00
|
|
|
|
@interface PcsxrDiscHandler ()
|
2013-09-10 20:18:15 +02:00
|
|
|
|
@property (nonatomic, strong) NSURL *discURL;
|
|
|
|
|
@property (weak) NSString *discPath;
|
2013-06-26 06:45:19 +02:00
|
|
|
|
@end
|
|
|
|
|
|
2011-12-12 04:32:21 +01:00
|
|
|
|
@implementation PcsxrDiscHandler
|
2013-07-09 01:35:59 +02:00
|
|
|
|
@synthesize discURL = _discURL;
|
|
|
|
|
- (NSURL*)discURL
|
2013-06-26 06:45:19 +02:00
|
|
|
|
{
|
2013-07-09 01:35:59 +02:00
|
|
|
|
if (!_discURL) {
|
2013-11-27 00:29:22 +01:00
|
|
|
|
self.discURL = [NSURL fileURLWithPath:discPath];
|
2013-06-26 06:45:19 +02:00
|
|
|
|
}
|
2013-07-09 01:35:59 +02:00
|
|
|
|
return _discURL;
|
2013-06-26 06:45:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-07-09 09:07:15 +02:00
|
|
|
|
@synthesize discPath;
|
|
|
|
|
|
2011-12-19 00:51:13 +01:00
|
|
|
|
+ (NSArray *)supportedUTIs
|
2011-12-17 20:08:51 +01:00
|
|
|
|
{
|
2012-05-24 01:20:57 +02:00
|
|
|
|
static NSArray *utisupport = nil;
|
|
|
|
|
if (utisupport == nil) {
|
2014-05-21 18:18:36 +02:00
|
|
|
|
utisupport = @[@"com.alcohol-soft.mdfdisc", @"com.goldenhawk.cdrwin-cuesheet",
|
|
|
|
|
@"com.apple.disk-image-ndif", @"public.iso-image", @"com.sony.psp.firmware",
|
2014-05-26 04:43:25 +02:00
|
|
|
|
@"com.codeplex.pcsxr.compressed-bin-image", @"com.coppertino.vox.cue",
|
|
|
|
|
@"com.apple.macbinary-archive"];
|
2012-05-24 01:20:57 +02:00
|
|
|
|
}
|
|
|
|
|
return utisupport;
|
2011-12-17 20:08:51 +01:00
|
|
|
|
}
|
|
|
|
|
|
2011-12-12 04:32:21 +01:00
|
|
|
|
- (BOOL)handleFile:(NSString *)theFile
|
|
|
|
|
{
|
2013-07-09 01:35:59 +02:00
|
|
|
|
self.discPath = theFile;
|
2014-09-08 17:01:26 +02:00
|
|
|
|
PcsxrController *appDelegate = [(NSApplication*)NSApp delegate];
|
2013-07-09 01:35:59 +02:00
|
|
|
|
if ([EmuThread active] == YES && !UsingIso()) {
|
|
|
|
|
return NO;
|
2012-10-31 02:25:35 +01:00
|
|
|
|
}
|
2013-07-09 01:35:59 +02:00
|
|
|
|
[appDelegate runURL:[self discURL]];
|
|
|
|
|
[[appDelegate recentItems] addRecentItem:[self discURL]];
|
2011-12-12 04:32:21 +01:00
|
|
|
|
return YES;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@end
|