Implement openCore for OSX 10.5

This commit is contained in:
neville 2016-01-17 18:34:18 +01:00
parent 7f505afda7
commit f6c6f64a20

View File

@ -282,9 +282,9 @@ extern void action_ok_push_quick_menu(void);
- (IBAction)openCore:(id)sender {
NSOpenPanel* panel = (NSOpenPanel*)[NSOpenPanel openPanel];
#if defined(MAC_OS_X_VERSION_10_6)
settings_t *settings = config_get_ptr();
NSString *startdir = BOXSTRING(settings->libretro_directory);
#if defined(MAC_OS_X_VERSION_10_6)
[panel setMessage:BOXSTRING("Load Core")];
[panel setDirectoryURL:[NSURL fileURLWithPath:startdir]];
[panel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result)
@ -320,10 +320,47 @@ extern void action_ok_push_quick_menu(void);
break;
}
}];
#else
[panel beginSheetForDirectory:nil file:nil modalForWindopw:[self window] modalDelegate:self didEndSelector:@selector(didEndSaveSheet:returnCode:contextInfo:) contextInfo:NULL];
#endif
[[NSApplication sharedApplication] runModalForWindow:panel];
#else
[panel setTitle:NSLocalizedString(@"Load Core", @"open panel")];
[panel setDirectory:startdir];
[panel setCanChooseDirectories:NO];
[panel setCanChooseFiles:YES];
[panel setAllowsMultipleSelection:NO];
[panel setTreatsFilePackagesAsDirectories:NO];
int result = [panel runModalForTypes:[NSArray arrayWithObject:@"dylib"]];
if (result == 1)
{
switch (result)
{
case NSOKButton:
if (panel.URL)
{
settings_t *settings = config_get_ptr();
NSURL *url = (NSURL*)panel.URL;
NSString *__core = url.path;
if (!__core)
return;
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, (void*)__core.UTF8String);
ui_companion_event_command(EVENT_CMD_LOAD_CORE);
if (menu_driver_ctl(RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL) && settings->core.set_supports_no_game_enable)
{
int ret = 0;
runloop_ctl(RUNLOOP_CTL_CLEAR_CONTENT_PATH, NULL);
ret = menu_common_load_content(NULL, NULL, false, CORE_TYPE_PLAIN);
if (ret == -1)
action_ok_push_quick_menu();
}
}
break;
case NSCancelButton:
break;
}
}
#endif
[g_context makeCurrentContext];
}