mirror of
https://github.com/libretro/RetroArch
synced 2025-04-07 13:23:32 +00:00
Implement openCore for OSX 10.5
This commit is contained in:
parent
7f505afda7
commit
f6c6f64a20
@ -282,9 +282,9 @@ extern void action_ok_push_quick_menu(void);
|
|||||||
|
|
||||||
- (IBAction)openCore:(id)sender {
|
- (IBAction)openCore:(id)sender {
|
||||||
NSOpenPanel* panel = (NSOpenPanel*)[NSOpenPanel openPanel];
|
NSOpenPanel* panel = (NSOpenPanel*)[NSOpenPanel openPanel];
|
||||||
#if defined(MAC_OS_X_VERSION_10_6)
|
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
NSString *startdir = BOXSTRING(settings->libretro_directory);
|
NSString *startdir = BOXSTRING(settings->libretro_directory);
|
||||||
|
#if defined(MAC_OS_X_VERSION_10_6)
|
||||||
[panel setMessage:BOXSTRING("Load Core")];
|
[panel setMessage:BOXSTRING("Load Core")];
|
||||||
[panel setDirectoryURL:[NSURL fileURLWithPath:startdir]];
|
[panel setDirectoryURL:[NSURL fileURLWithPath:startdir]];
|
||||||
[panel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result)
|
[panel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result)
|
||||||
@ -320,10 +320,47 @@ extern void action_ok_push_quick_menu(void);
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
#else
|
|
||||||
[panel beginSheetForDirectory:nil file:nil modalForWindopw:[self window] modalDelegate:self didEndSelector:@selector(didEndSaveSheet:returnCode:contextInfo:) contextInfo:NULL];
|
|
||||||
#endif
|
|
||||||
[[NSApplication sharedApplication] runModalForWindow:panel];
|
[[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];
|
[g_context makeCurrentContext];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user