diff --git a/apple/OSX/en.lproj/MainMenu.xib b/apple/OSX/en.lproj/MainMenu.xib index 078d9b3e79..27a23ed0c7 100644 --- a/apple/OSX/en.lproj/MainMenu.xib +++ b/apple/OSX/en.lproj/MainMenu.xib @@ -11,9 +11,16 @@ 3084 + IBNSLayoutConstraint + NSButton + NSButtonCell + NSComboBox + NSComboBoxCell NSCustomObject NSMenu NSMenuItem + NSTextField + NSTextFieldCell NSView NSWindowTemplate @@ -386,7 +393,6 @@ {480, 360} - {{0, 0}, {2560, 1418}} {10000000000000, 10000000000000} @@ -395,6 +401,204 @@ RetroArch_OSX + + 31 + 2 + {{272, 172}, {276, 89}} + -1535638528 + Window + NSPanel + + + + + 256 + + + + 268 + {{17, 72}, {242, 17}} + + + + _NS:1535 + YES + + 68157504 + 138413056 + Select Core + + LucidaGrande + 13 + 1044 + + _NS:1535 + + YES + + 6 + System + controlColor + + 3 + MC42NjY2NjY2NjY3AA + + + + 6 + System + controlTextColor + + 3 + MAA + + + + NO + + + + 268 + {{20, 45}, {239, 26}} + + + + _NS:9 + 1 + YES + + 342884416 + 272630784 + + + _NS:9 + + YES + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 5 + YES + + + + 274 + {13, 0} + + + _NS:24 + YES + NO + YES + + + 10 + 10 + 1000 + + 75497472 + 0 + + + LucidaGrande + 12 + 16 + + + 3 + MC4zMzMzMzI5ODU2AA + + + + + 338690112 + 1024 + + + YES + + 6 + System + controlBackgroundColor + + + + + 3 + YES + + + + 3 + 2 + + + 6 + System + gridColor + + 3 + MC41AA + + + 19 + tableViewAction: + -765427712 + + + + 1 + 15 + 0 + YES + 0 + 1 + + + NO + + + + 268 + {{180, 13}, {82, 32}} + + + _NS:9 + YES + + 67108864 + 134217728 + OK + + _NS:9 + + -2038284288 + 129 + + DQ + 200 + 25 + + NO + + + {276, 89} + + + + _NS:21 + + {{0, 0}, {2560, 1418}} + {10000000000000, 10000000000000} + NO + @@ -542,6 +746,22 @@ 556 + + + _coreSelectSheet + + + + 569 + + + + coreWasChosen: + + + + 580 + @@ -842,6 +1062,252 @@ + + 557 + + + + + + + + 558 + + + + + + + 4 + 0 + + 4 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 5 + 0 + + 5 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 3 + 0 + + 3 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 5 + 0 + + 5 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 3 + 0 + + 3 + 1 + + 0.0 + + 1000 + + 8 + 29 + 3 + + + + + + + 559 + + + + + + + + 560 + + + + + + + + 561 + + + + + 562 + + + + + 563 + + + + + 564 + + + + + 565 + + + + + 566 + + + + + 567 + + + + + 568 + + + + + 570 + + + + + + 7 + 0 + + 0 + 1 + + 70 + + 1000 + + 3 + 9 + 1 + + + + + + 571 + + + + + 572 + + + + + 578 + + + + + 579 + + + @@ -882,8 +1348,42 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + + + + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -896,10 +1396,18 @@ - 556 + 580 + + NSLayoutConstraint + NSObject + + IBProjectSource + ./Classes/NSLayoutConstraint.h + + RetroArch_OSX NSObject diff --git a/apple/RetroArch/RAModuleInfo.h b/apple/RetroArch/RAModuleInfo.h index 739099d78a..5370b97f6a 100644 --- a/apple/RetroArch/RAModuleInfo.h +++ b/apple/RetroArch/RAModuleInfo.h @@ -26,7 +26,7 @@ @property (strong) NSString* path; @property core_info_t* info; @property config_file_t* data; -@property (strong) NSString* displayName; +@property (strong) NSString* description; + (NSArray*)getModules; - (bool)supportsFileAtPath:(NSString*)path; diff --git a/apple/RetroArch/RAModuleInfo.m b/apple/RetroArch/RAModuleInfo.m index 43889a4ed6..1af5a7d622 100644 --- a/apple/RetroArch/RAModuleInfo.m +++ b/apple/RetroArch/RAModuleInfo.m @@ -26,8 +26,12 @@ static core_info_list_t* coreList; + (NSArray*)getModules { if (!moduleList) - { + { coreList = get_core_info_list(apple_platform.corePath.UTF8String); + + if (!coreList) + return nil; + moduleList = [NSMutableArray arrayWithCapacity:coreList->count]; for (int i = 0; coreList && i < coreList->count; i ++) @@ -38,14 +42,14 @@ static core_info_list_t* coreList; newInfo.path = [NSString stringWithUTF8String:core->path]; newInfo.info = core; newInfo.data = core->data; - newInfo.displayName = [NSString stringWithUTF8String:core->display_name]; + newInfo.description = [NSString stringWithUTF8String:core->display_name]; [moduleList addObject:newInfo]; } [moduleList sortUsingComparator:^(RAModuleInfo* left, RAModuleInfo* right) { - return [left.displayName caseInsensitiveCompare:right.displayName]; + return [left.description caseInsensitiveCompare:right.description]; }]; } @@ -56,6 +60,12 @@ static core_info_list_t* coreList; { } +- (id)copyWithZone:(NSZone *)zone +{ + return self; +} + + - (bool)supportsFileAtPath:(NSString*)path { return does_core_support_file(self.info, path.UTF8String); diff --git a/apple/RetroArch/main.m b/apple/RetroArch/main.m index 04be8b1260..21a73a4607 100644 --- a/apple/RetroArch/main.m +++ b/apple/RetroArch/main.m @@ -103,14 +103,9 @@ 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); } @@ -489,6 +484,11 @@ int main(int argc, char *argv[]) @end @implementation RetroArch_OSX +{ + NSWindow IBOutlet* _coreSelectSheet; + NSString* _file; +} + + (RetroArch_OSX*)get { return (RetroArch_OSX*)[[NSApplication sharedApplication] delegate]; @@ -510,6 +510,13 @@ int main(int argc, char *argv[]) [window.contentView addSubview:RAGameView.get]; [window makeFirstResponder:RAGameView.get]; + + NSComboBox* cb = (NSComboBox*)[_coreSelectSheet.contentView viewWithTag:1]; + + for (RAModuleInfo* i in RAModuleInfo.getModules) + { + [cb addItemWithObjectValue:i]; + } } - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication @@ -520,14 +527,20 @@ int main(int argc, char *argv[]) - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename { if (filename) - apple_run_core(nil, filename.UTF8String); + { + _file = filename; + [self chooseCore]; + } return YES; } - (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames { if (filenames.count == 1 && filenames[0]) - apple_run_core(nil, [filenames[0] UTF8String]); + { + _file = filenames[0]; + [self chooseCore]; + } else apple_display_alert(@"Cannot open multiple files", @"RetroArch"); } @@ -538,10 +551,28 @@ int main(int argc, char *argv[]) [panel beginSheetModalForWindow:window completionHandler:^(NSInteger result) { if (result == NSOKButton && panel.URL) - apple_run_core(nil, panel.URL.path.UTF8String); + { + _file = panel.URL.path; + [self chooseCore]; + } }]; } +- (void)chooseCore +{ + [NSApplication.sharedApplication beginSheet:_coreSelectSheet modalForWindow:window modalDelegate:nil didEndSelector:nil contextInfo:nil]; +} + +- (IBAction)coreWasChosen:(id)sender +{ + NSComboBox* cb = (NSComboBox*)[_coreSelectSheet.contentView viewWithTag:1]; + RAModuleInfo* module = (RAModuleInfo*)cb.objectValueOfSelectedItem; + apple_run_core(module, _file.UTF8String); + + [NSApplication.sharedApplication endSheet:_coreSelectSheet returnCode:0]; + [_coreSelectSheet orderOut:self]; +} + #pragma mark RetroArch_Platform - (void)loadingCore:(RAModuleInfo*)core withFile:(const char*)file { @@ -561,7 +592,7 @@ int main(int argc, char *argv[]) - (NSString*)corePath { - return [NSBundle.mainBundle.bundlePath stringByAppendingPathComponent:@"modules"]; + return [NSBundle.mainBundle.bundlePath stringByAppendingPathComponent:@"Contents/Resources/modules"]; } #pragma mark Menus diff --git a/apple/RetroArch_OSX.xcodeproj/project.pbxproj b/apple/RetroArch_OSX.xcodeproj/project.pbxproj index 1192536901..33e4990b3f 100644 --- a/apple/RetroArch_OSX.xcodeproj/project.pbxproj +++ b/apple/RetroArch_OSX.xcodeproj/project.pbxproj @@ -19,6 +19,7 @@ 967894A51788F0C200D6CA69 /* CoreAudioKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 967894A31788F0C200D6CA69 /* CoreAudioKit.framework */; }; 967894A71788F0D900D6CA69 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 967894A61788F0D900D6CA69 /* OpenGL.framework */; }; 967894A91788F0E500D6CA69 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 967894A81788F0E500D6CA69 /* AudioUnit.framework */; }; + 967894E9178A2EB400D6CA69 /* modules in Resources */ = {isa = PBXBuildFile; fileRef = 967894E8178A2EB400D6CA69 /* modules */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -42,6 +43,7 @@ 967894A31788F0C200D6CA69 /* CoreAudioKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudioKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/CoreAudioKit.framework; sourceTree = DEVELOPER_DIR; }; 967894A61788F0D900D6CA69 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/OpenGL.framework; sourceTree = DEVELOPER_DIR; }; 967894A81788F0E500D6CA69 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/AudioUnit.framework; sourceTree = DEVELOPER_DIR; }; + 967894E8178A2EB400D6CA69 /* modules */ = {isa = PBXFileReference; lastKnownFileType = folder; path = modules; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -64,6 +66,7 @@ isa = PBXGroup; children = ( 96355CE81788E72A0010DBFA /* RetroArch */, + 967894E7178A2E9B00D6CA69 /* Assets */, 96355CE11788E72A0010DBFA /* Frameworks */, 96355CE01788E72A0010DBFA /* Products */, 96355CE91788E72A0010DBFA /* Supporting Files */, @@ -112,13 +115,21 @@ isa = PBXGroup; children = ( 9678948F1788ECDB00D6CA69 /* InfoPlist.strings */, - 967894911788ECDB00D6CA69 /* MainMenu.xib */, 9678948D1788ECCA00D6CA69 /* RetroArch-Info.plist */, ); name = "Supporting Files"; path = RetroArch; sourceTree = ""; }; + 967894E7178A2E9B00D6CA69 /* Assets */ = { + isa = PBXGroup; + children = ( + 967894E8178A2EB400D6CA69 /* modules */, + 967894911788ECDB00D6CA69 /* MainMenu.xib */, + ); + name = Assets; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -171,6 +182,7 @@ files = ( 967894931788ECDB00D6CA69 /* InfoPlist.strings in Resources */, 967894941788ECDB00D6CA69 /* MainMenu.xib in Resources */, + 967894E9178A2EB400D6CA69 /* modules in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -206,6 +218,7 @@ 967894921788ECDB00D6CA69 /* en */, ); name = MainMenu.xib; + path = RetroArch; sourceTree = ""; }; /* End PBXVariantGroup section */ diff --git a/apple/iOS/browser.m b/apple/iOS/browser.m index dccee30040..38ee180681 100644 --- a/apple/iOS/browser.m +++ b/apple/iOS/browser.m @@ -216,7 +216,7 @@ } RAModuleInfo* info = (RAModuleInfo*)[self itemForIndexPath:indexPath]; - cell.textLabel.text = info.displayName; + cell.textLabel.text = info.description; objc_setAssociatedObject(cell.accessoryView, "MODULE", info, OBJC_ASSOCIATION_RETAIN_NONATOMIC); return cell; diff --git a/apple/iOS/settings.m b/apple/iOS/settings.m index d42132b75a..e452d636bb 100644 --- a/apple/iOS/settings.m +++ b/apple/iOS/settings.m @@ -289,7 +289,7 @@ static NSArray* build_input_port_group(config_file_t* config, uint32_t player) if (config) config_file_free(config); - self = [super initWithSettings:settings title:_module ? _module.displayName : @"Global Core Config"]; + self = [super initWithSettings:settings title:_module ? _module.description : @"Global Core Config"]; return self; }