(Apple) Add some methods to open files on OSX

This commit is contained in:
meancoot 2013-07-07 13:37:23 -04:00
parent 3d9d672a38
commit e709784b70
3 changed files with 62 additions and 3868 deletions

View File

@ -4,6 +4,19 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>*</string>
</array>
<key>CFBundleTypeName</key>
<string>All Files</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>

File diff suppressed because it is too large Load Diff

View File

@ -85,6 +85,7 @@ static bool apple_is_paused;
static bool apple_is_running;
static RAModuleInfo* apple_core;
// HACK: This needs to be cleaned
void apple_run_core(RAModuleInfo* core, const char* file)
{
if (!apple_is_running)
@ -102,9 +103,14 @@ void apple_run_core(RAModuleInfo* core, const char* file)
load_data->state_path = strdup(RetroArch_iOS.get.systemDirectory.UTF8String);
#endif
#ifdef IOS
if (file && core)
{
load_data->libretro_path = strdup(apple_core.path.UTF8String);
#else
{
load_data->libretro_path = strdup("/Users/jason/Desktop/libretro.dylib");
#endif
load_data->rom_path = strdup(file);
#ifdef IOS
load_data->config_path = strdup(apple_core.configPath.UTF8String);
@ -489,6 +495,33 @@ int main(int argc, char *argv[])
[window.contentView addSubview:RAGameView.get];
}
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
{
return YES;
}
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
{
apple_run_core(nil, filename.UTF8String);
return YES;
}
-(void)application:(NSApplication *)sender openFiles:(NSArray *)filenames
{
if (filenames.count == 1)
apple_run_core(nil, [filenames[0] UTF8String]);
else
apple_display_alert(@"Cannot open multiple files", @"RetroArch");
}
-(void)openDocument:(id)sender
{
NSOpenPanel* panel = [NSOpenPanel openPanel];
if ([panel runModal] == NSOKButton && panel.URL)
apple_run_core(nil, panel.URL.path.UTF8String);
}
#pragma mark RetroArch_Platform
- (void)loadingCore:(RAModuleInfo*)core withFile:(const char*)file
{