mirror of
https://github.com/libretro/RetroArch
synced 2025-04-07 13:23:32 +00:00
(iOS) Temporarily remove custom config support
This commit is contained in:
parent
e1706de84c
commit
7f8cb059e2
@ -31,13 +31,6 @@
|
|||||||
+ (NSArray*)getModules;
|
+ (NSArray*)getModules;
|
||||||
- (bool)supportsFileAtPath:(NSString*)path;
|
- (bool)supportsFileAtPath:(NSString*)path;
|
||||||
|
|
||||||
- (void)createCustomConfig;
|
|
||||||
- (void)deleteCustomConfig;
|
|
||||||
- (bool)hasCustomConfig;
|
|
||||||
|
|
||||||
+ (NSString*)globalConfigPath;
|
|
||||||
@property (strong) NSString* customConfigPath;
|
|
||||||
- (NSString*)configPath;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,13 +25,9 @@ static core_info_list_t* coreList;
|
|||||||
@implementation RAModuleInfo
|
@implementation RAModuleInfo
|
||||||
+ (NSArray*)getModules
|
+ (NSArray*)getModules
|
||||||
{
|
{
|
||||||
#ifdef IOS
|
|
||||||
if (!moduleList)
|
if (!moduleList)
|
||||||
{
|
{
|
||||||
char pattern[PATH_MAX];
|
coreList = get_core_info_list(apple_platform.corePath.UTF8String);
|
||||||
snprintf(pattern, PATH_MAX, "%s/modules", [[NSBundle mainBundle].bundlePath UTF8String]);
|
|
||||||
|
|
||||||
coreList = get_core_info_list(pattern);
|
|
||||||
moduleList = [NSMutableArray arrayWithCapacity:coreList->count];
|
moduleList = [NSMutableArray arrayWithCapacity:coreList->count];
|
||||||
|
|
||||||
for (int i = 0; coreList && i < coreList->count; i ++)
|
for (int i = 0; coreList && i < coreList->count; i ++)
|
||||||
@ -44,9 +40,6 @@ static core_info_list_t* coreList;
|
|||||||
newInfo.data = core->data;
|
newInfo.data = core->data;
|
||||||
newInfo.displayName = [NSString stringWithUTF8String:core->display_name];
|
newInfo.displayName = [NSString stringWithUTF8String:core->display_name];
|
||||||
|
|
||||||
NSString* baseName = newInfo.path.lastPathComponent.stringByDeletingPathExtension;
|
|
||||||
newInfo.customConfigPath = [NSString stringWithFormat:@"%@/%@.cfg", RetroArch_iOS.get.systemDirectory, baseName];
|
|
||||||
|
|
||||||
[moduleList addObject:newInfo];
|
[moduleList addObject:newInfo];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,7 +48,6 @@ static core_info_list_t* coreList;
|
|||||||
return [left.displayName caseInsensitiveCompare:right.displayName];
|
return [left.displayName caseInsensitiveCompare:right.displayName];
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return moduleList;
|
return moduleList;
|
||||||
}
|
}
|
||||||
@ -69,39 +61,6 @@ static core_info_list_t* coreList;
|
|||||||
return does_core_support_file(self.info, path.UTF8String);
|
return does_core_support_file(self.info, path.UTF8String);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef IOS
|
|
||||||
- (void)createCustomConfig
|
|
||||||
{
|
|
||||||
if (!self.hasCustomConfig)
|
|
||||||
[NSFileManager.defaultManager copyItemAtPath:RAModuleInfo.globalConfigPath toPath:self.customConfigPath error:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)deleteCustomConfig
|
|
||||||
{
|
|
||||||
if (self.hasCustomConfig)
|
|
||||||
[NSFileManager.defaultManager removeItemAtPath:self.customConfigPath error:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (NSString*)globalConfigPath
|
|
||||||
{
|
|
||||||
static NSString* path;
|
|
||||||
if (!path)
|
|
||||||
path = [NSString stringWithFormat:@"%@/retroarch.cfg", RetroArch_iOS.get.systemDirectory];
|
|
||||||
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (bool)hasCustomConfig
|
|
||||||
{
|
|
||||||
return path_file_exists(self.customConfigPath.UTF8String);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString*)configPath
|
|
||||||
{
|
|
||||||
return self.hasCustomConfig ? self.customConfigPath : RAModuleInfo.globalConfigPath;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#ifdef IOS
|
#ifdef IOS
|
||||||
|
@ -25,8 +25,12 @@ void apple_run_core(RAModuleInfo* core, const char* file);
|
|||||||
@protocol RetroArch_Platform
|
@protocol RetroArch_Platform
|
||||||
- (void)loadingCore:(RAModuleInfo*)core withFile:(const char*)file;
|
- (void)loadingCore:(RAModuleInfo*)core withFile:(const char*)file;
|
||||||
- (void)unloadingCore:(RAModuleInfo*)core;
|
- (void)unloadingCore:(RAModuleInfo*)core;
|
||||||
|
- (NSString*)retroarchConfigPath;
|
||||||
|
- (NSString*)corePath;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
extern id<RetroArch_Platform> apple_platform;
|
||||||
|
|
||||||
#ifdef IOS
|
#ifdef IOS
|
||||||
|
|
||||||
// RAGameView.m
|
// RAGameView.m
|
||||||
@ -45,6 +49,7 @@ void apple_run_core(RAModuleInfo* core, const char* file);
|
|||||||
|
|
||||||
- (void)loadingCore:(RAModuleInfo*)core withFile:(const char*)file;
|
- (void)loadingCore:(RAModuleInfo*)core withFile:(const char*)file;
|
||||||
- (void)unloadingCore:(RAModuleInfo*)core;
|
- (void)unloadingCore:(RAModuleInfo*)core;
|
||||||
|
- (NSString*)retroarchConfigPath;
|
||||||
|
|
||||||
- (void)refreshConfig;
|
- (void)refreshConfig;
|
||||||
- (void)refreshSystemConfig;
|
- (void)refreshSystemConfig;
|
||||||
|
@ -36,12 +36,7 @@
|
|||||||
//#define HAVE_DEBUG_FILELOG
|
//#define HAVE_DEBUG_FILELOG
|
||||||
static bool use_tv_mode;
|
static bool use_tv_mode;
|
||||||
|
|
||||||
#ifdef IOS
|
id<RetroArch_Platform> apple_platform;
|
||||||
static RetroArch_iOS* apple_platform;
|
|
||||||
#else
|
|
||||||
static RetroArch_OSX* apple_platform;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// From frontend/frontend_ios.c
|
// From frontend/frontend_ios.c
|
||||||
extern void* rarch_main_apple(void* args);
|
extern void* rarch_main_apple(void* args);
|
||||||
@ -101,6 +96,8 @@ void apple_run_core(RAModuleInfo* core, const char* file)
|
|||||||
struct rarch_main_wrap* load_data = malloc(sizeof(struct rarch_main_wrap));
|
struct rarch_main_wrap* load_data = malloc(sizeof(struct rarch_main_wrap));
|
||||||
memset(load_data, 0, sizeof(struct rarch_main_wrap));
|
memset(load_data, 0, sizeof(struct rarch_main_wrap));
|
||||||
|
|
||||||
|
load_data->config_path = strdup(apple_platform.retroarchConfigPath.UTF8String);
|
||||||
|
|
||||||
#ifdef IOS
|
#ifdef IOS
|
||||||
load_data->sram_path = strdup(RetroArch_iOS.get.systemDirectory.UTF8String);
|
load_data->sram_path = strdup(RetroArch_iOS.get.systemDirectory.UTF8String);
|
||||||
load_data->state_path = strdup(RetroArch_iOS.get.systemDirectory.UTF8String);
|
load_data->state_path = strdup(RetroArch_iOS.get.systemDirectory.UTF8String);
|
||||||
@ -115,14 +112,7 @@ void apple_run_core(RAModuleInfo* core, const char* file)
|
|||||||
load_data->libretro_path = strdup("/Users/jason/Desktop/libretro.dylib");
|
load_data->libretro_path = strdup("/Users/jason/Desktop/libretro.dylib");
|
||||||
#endif
|
#endif
|
||||||
load_data->rom_path = strdup(file);
|
load_data->rom_path = strdup(file);
|
||||||
#ifdef IOS
|
|
||||||
load_data->config_path = strdup(apple_core.configPath.UTF8String);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#ifdef IOS
|
|
||||||
else
|
|
||||||
load_data->config_path = strdup(RAModuleInfo.globalConfigPath.UTF8String);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (pthread_create(&apple_retro_thread, 0, rarch_main_apple, load_data))
|
if (pthread_create(&apple_retro_thread, 0, rarch_main_apple, load_data))
|
||||||
{
|
{
|
||||||
@ -352,6 +342,16 @@ int main(int argc, char *argv[])
|
|||||||
btpad_set_inquiry_state(true);
|
btpad_set_inquiry_state(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString*)retroarchConfigPath
|
||||||
|
{
|
||||||
|
return [NSString stringWithFormat:@"%@/retroarch.cfg", self.systemDirectory];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString*)corePath
|
||||||
|
{
|
||||||
|
return [NSBundle.mainBundle.bundlePath stringByAppendingPathComponent:@"modules"];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)refreshConfig
|
- (void)refreshConfig
|
||||||
{
|
{
|
||||||
if (apple_is_running)
|
if (apple_is_running)
|
||||||
@ -553,6 +553,17 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString*)retroarchConfigPath
|
||||||
|
{
|
||||||
|
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
|
||||||
|
return [paths[0] stringByAppendingPathComponent:@"RetroArch/retroarch.cfg"];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString*)corePath
|
||||||
|
{
|
||||||
|
return [NSBundle.mainBundle.bundlePath stringByAppendingPathComponent:@"modules"];
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark Menus
|
#pragma mark Menus
|
||||||
- (IBAction)basicEvent:(id)sender
|
- (IBAction)basicEvent:(id)sender
|
||||||
{
|
{
|
||||||
|
@ -219,7 +219,7 @@ static NSArray* build_input_port_group(config_file_t* config, uint32_t player)
|
|||||||
- (id)initWithModule:(RAModuleInfo*)module
|
- (id)initWithModule:(RAModuleInfo*)module
|
||||||
{
|
{
|
||||||
_module = module;
|
_module = module;
|
||||||
_configPath = _module ? _module.configPath : RAModuleInfo.globalConfigPath;
|
_configPath = RetroArch_iOS.get.retroarchConfigPath;
|
||||||
|
|
||||||
config_file_t* config = config_file_new([_configPath UTF8String]);
|
config_file_t* config = config_file_new([_configPath UTF8String]);
|
||||||
|
|
||||||
@ -229,7 +229,6 @@ static NSArray* build_input_port_group(config_file_t* config, uint32_t player)
|
|||||||
NSArray* settings = [NSArray arrayWithObjects:
|
NSArray* settings = [NSArray arrayWithObjects:
|
||||||
[NSArray arrayWithObjects:@"Core",
|
[NSArray arrayWithObjects:@"Core",
|
||||||
custom_action(@"Core Info", nil, nil),
|
custom_action(@"Core Info", nil, nil),
|
||||||
_module.hasCustomConfig ? custom_action(@"Delete Custom Config", nil, nil) : nil,
|
|
||||||
nil],
|
nil],
|
||||||
|
|
||||||
[NSArray arrayWithObjects:@"Video",
|
[NSArray arrayWithObjects:@"Video",
|
||||||
@ -319,12 +318,6 @@ static NSArray* build_input_port_group(config_file_t* config, uint32_t player)
|
|||||||
{
|
{
|
||||||
if ([@"Core Info" isEqualToString:setting.label])
|
if ([@"Core Info" isEqualToString:setting.label])
|
||||||
[[RetroArch_iOS get] pushViewController:[[RAModuleInfoList alloc] initWithModuleInfo:_module] animated:YES];
|
[[RetroArch_iOS get] pushViewController:[[RAModuleInfoList alloc] initWithModuleInfo:_module] animated:YES];
|
||||||
else if([@"Delete Custom Config" isEqualToString:setting.label])
|
|
||||||
{
|
|
||||||
[_module deleteCustomConfig];
|
|
||||||
_cancelSave = true;
|
|
||||||
[self.navigationController popViewControllerAnimated:YES];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@ -334,16 +327,6 @@ static NSArray* build_input_port_group(config_file_t* config, uint32_t player)
|
|||||||
{
|
{
|
||||||
config_file_t* config = config_file_new([[RetroArch_iOS get].systemConfigPath UTF8String]);
|
config_file_t* config = config_file_new([[RetroArch_iOS get].systemConfigPath UTF8String]);
|
||||||
|
|
||||||
NSMutableArray* modules = [NSMutableArray array];
|
|
||||||
[modules addObject:@"Cores"];
|
|
||||||
[modules addObject:custom_action(@"Global Core Config", nil, nil)];
|
|
||||||
|
|
||||||
NSArray* moduleList = [RAModuleInfo getModules];
|
|
||||||
for (RAModuleInfo* i in moduleList)
|
|
||||||
{
|
|
||||||
[modules addObject:custom_action(i.displayName, i.hasCustomConfig ? @"[Custom]" : @"[Global]", i)];
|
|
||||||
}
|
|
||||||
|
|
||||||
NSArray* settings = [NSArray arrayWithObjects:
|
NSArray* settings = [NSArray arrayWithObjects:
|
||||||
[NSArray arrayWithObjects:@"Frontend",
|
[NSArray arrayWithObjects:@"Frontend",
|
||||||
custom_action(@"Diagnostic Log", nil, nil),
|
custom_action(@"Diagnostic Log", nil, nil),
|
||||||
@ -360,7 +343,9 @@ static NSArray* build_input_port_group(config_file_t* config, uint32_t player)
|
|||||||
boolean_setting(config, @"ios_allow_landscape_left", @"Landscape Left", @"true"),
|
boolean_setting(config, @"ios_allow_landscape_left", @"Landscape Left", @"true"),
|
||||||
boolean_setting(config, @"ios_allow_landscape_right", @"Landscape Right", @"true"),
|
boolean_setting(config, @"ios_allow_landscape_right", @"Landscape Right", @"true"),
|
||||||
nil],
|
nil],
|
||||||
modules,
|
[NSArray arrayWithObjects:@"Cores",
|
||||||
|
custom_action(@"Core Configuration", nil, nil),
|
||||||
|
nil],
|
||||||
nil
|
nil
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -394,41 +379,8 @@ static NSArray* build_input_port_group(config_file_t* config, uint32_t player)
|
|||||||
[[RetroArch_iOS get] pushViewController:[RALogView new] animated:YES];
|
[[RetroArch_iOS get] pushViewController:[RALogView new] animated:YES];
|
||||||
else if ([@"Enable BTstack" isEqualToString:setting.label])
|
else if ([@"Enable BTstack" isEqualToString:setting.label])
|
||||||
btstack_set_poweron([setting.value isEqualToString:@"true"]);
|
btstack_set_poweron([setting.value isEqualToString:@"true"]);
|
||||||
else if([@"Global Core Config" isEqualToString:setting.label])
|
else if([@"Core Configuration" isEqualToString:setting.label])
|
||||||
[RetroArch_iOS.get pushViewController:[[RASettingsList alloc] initWithModule:nil] animated:YES];
|
[RetroArch_iOS.get pushViewController:[[RASettingsList alloc] initWithModule:nil] animated:YES];
|
||||||
else
|
|
||||||
{
|
|
||||||
RAModuleInfo* data = (RAModuleInfo*)objc_getAssociatedObject(setting, "USERDATA");
|
|
||||||
if (data)
|
|
||||||
{
|
|
||||||
if (!data.hasCustomConfig)
|
|
||||||
{
|
|
||||||
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"RetroArch"
|
|
||||||
message:@"No custom configuration for this core exists, "
|
|
||||||
"would you like to create one?"
|
|
||||||
delegate:self
|
|
||||||
cancelButtonTitle:@"No"
|
|
||||||
otherButtonTitles:@"Yes", nil];
|
|
||||||
objc_setAssociatedObject(alert, "MODULE", data, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
|
||||||
[alert show];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
[RetroArch_iOS.get pushViewController:[[RASettingsList alloc] initWithModule:data] animated:YES];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)alertView:(UIAlertView*)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex
|
|
||||||
{
|
|
||||||
RAModuleInfo* data = (RAModuleInfo*)objc_getAssociatedObject(alertView, "MODULE");
|
|
||||||
|
|
||||||
if (data)
|
|
||||||
{
|
|
||||||
if (buttonIndex == alertView.firstOtherButtonIndex)
|
|
||||||
[data createCustomConfig];
|
|
||||||
|
|
||||||
[RetroArch_iOS.get pushViewController:[[RASettingsList alloc] initWithModule:data] animated:YES];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user