mirror of
https://github.com/libretro/RetroArch
synced 2025-01-26 18:35:22 +00:00
(iOS) Remove duplicate function
This commit is contained in:
parent
1697be1908
commit
eb591d17d5
@ -84,20 +84,6 @@ static NSMutableArray* moduleList;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
static NSString* get_data_string(config_file_t* config, const char* name, NSString* defaultValue)
|
||||
{
|
||||
char* result = 0;
|
||||
if (config_get_string(config, name, &result))
|
||||
{
|
||||
NSString* output = [NSString stringWithUTF8String:result];
|
||||
free(result);
|
||||
return output;
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
@implementation RAModuleInfoList
|
||||
{
|
||||
RAModuleInfo* _data;
|
||||
@ -114,12 +100,12 @@ static NSString* get_data_string(config_file_t* config, const char* name, NSStri
|
||||
_sections = [NSMutableArray array];
|
||||
|
||||
[_sections addObject: [NSArray arrayWithObjects:@"Core",
|
||||
@"Core Name", get_data_string(_data.data, "corename", @"Unspecified"),
|
||||
@"Core Name", ios_get_value_from_config(_data.data, @"corename", @"Unspecified"),
|
||||
nil]];
|
||||
|
||||
[_sections addObject: [NSArray arrayWithObjects:@"Hardware/Software",
|
||||
@"Developer", get_data_string(_data.data, "manufacturer", @"Unspecified"),
|
||||
@"Name", get_data_string(_data.data, "systemname", @"Unspecified"),
|
||||
@"Developer", ios_get_value_from_config(_data.data, @"manufacturer", @"Unspecified"),
|
||||
@"Name", ios_get_value_from_config(_data.data, @"systemname", @"Unspecified"),
|
||||
nil]];
|
||||
|
||||
// Firmware
|
||||
@ -131,15 +117,10 @@ static NSString* get_data_string(config_file_t* config, const char* name, NSStri
|
||||
|
||||
for (int i = 0; i < firmwareCount; i ++)
|
||||
{
|
||||
char namebuf[512];
|
||||
|
||||
snprintf(namebuf, 512, "firmware%d_desc", i + 1);
|
||||
[firmwareSection addObject:get_data_string(_data.data, namebuf, @"Unspecified")];
|
||||
[firmwareSection addObject:ios_get_value_from_config(_data.data, [NSString stringWithFormat:@"firmware%d_desc", i + 1], @"Unspecified")];
|
||||
|
||||
snprintf(namebuf, 512, "firmware%d_path", i + 1);
|
||||
NSString* path = get_data_string(_data.data, namebuf, @"Unspecified");
|
||||
NSString* path = ios_get_value_from_config(_data.data, [NSString stringWithFormat:@"firmware%d_path", i + 1], @"Unspecified");
|
||||
path = [path stringByReplacingOccurrencesOfString:@"%sysdir%" withString:RetroArch_iOS.get.systemDirectory];
|
||||
|
||||
[firmwareSection addObject:path];
|
||||
}
|
||||
|
||||
|
@ -34,3 +34,5 @@
|
||||
@property (strong, nonatomic) NSString* systemConfigPath; // e.g. /var/mobile/Documents/.RetroArch/frontend.cfg
|
||||
|
||||
@end
|
||||
|
||||
extern NSString* ios_get_value_from_config(config_file_t* config, NSString* name, NSString* defaultValue);
|
||||
|
@ -560,3 +560,16 @@ char* ios_get_rarch_system_directory()
|
||||
{
|
||||
return strdup([RetroArch_iOS.get.systemDirectory UTF8String]);
|
||||
}
|
||||
|
||||
|
||||
NSString* ios_get_value_from_config(config_file_t* config, NSString* name, NSString* defaultValue)
|
||||
{
|
||||
char* data = 0;
|
||||
if (config)
|
||||
config_get_string(config, [name UTF8String], &data);
|
||||
|
||||
NSString* result = data ? [NSString stringWithUTF8String:data] : defaultValue;
|
||||
free(data);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -30,21 +30,10 @@
|
||||
}
|
||||
@end
|
||||
|
||||
static NSString* get_value_from_config(config_file_t* config, NSString* name, NSString* defaultValue)
|
||||
{
|
||||
char* data = 0;
|
||||
if (config)
|
||||
config_get_string(config, [name UTF8String], &data);
|
||||
|
||||
NSString* result = data ? [NSString stringWithUTF8String:data] : defaultValue;
|
||||
free(data);
|
||||
return result;
|
||||
}
|
||||
|
||||
static RASettingData* boolean_setting(config_file_t* config, NSString* name, NSString* label, NSString* defaultValue)
|
||||
{
|
||||
RASettingData* result = [[RASettingData alloc] initWithType:BooleanSetting label:label name:name];
|
||||
result.value = get_value_from_config(config, name, defaultValue);
|
||||
result.value = ios_get_value_from_config(config, name, defaultValue);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -52,9 +41,9 @@ static RASettingData* button_setting(config_file_t* config, NSString* name, NSSt
|
||||
{
|
||||
RASettingData* result = [[RASettingData alloc] initWithType:ButtonSetting label:label name:name];
|
||||
result.msubValues = [NSMutableArray arrayWithObjects:
|
||||
get_value_from_config(config, name, defaultValue),
|
||||
get_value_from_config(config, [name stringByAppendingString:@"_btn"], @""),
|
||||
get_value_from_config(config, [name stringByAppendingString:@"_axis"], @""),
|
||||
ios_get_value_from_config(config, name, defaultValue),
|
||||
ios_get_value_from_config(config, [name stringByAppendingString:@"_btn"], @""),
|
||||
ios_get_value_from_config(config, [name stringByAppendingString:@"_axis"], @""),
|
||||
nil];
|
||||
return result;
|
||||
}
|
||||
@ -69,14 +58,14 @@ static RASettingData* group_setting(NSString* label, NSArray* settings)
|
||||
static RASettingData* enumeration_setting(config_file_t* config, NSString* name, NSString* label, NSString* defaultValue, NSArray* values)
|
||||
{
|
||||
RASettingData* result = [[RASettingData alloc] initWithType:EnumerationSetting label:label name:name];
|
||||
result.value = get_value_from_config(config, name, defaultValue);
|
||||
result.value = ios_get_value_from_config(config, name, defaultValue);
|
||||
result.subValues = values;
|
||||
return result;
|
||||
}
|
||||
|
||||
static RASettingData* subpath_setting(config_file_t* config, NSString* name, NSString* label, NSString* defaultValue, NSString* path, NSString* extension)
|
||||
{
|
||||
NSString* value = get_value_from_config(config, name, defaultValue);
|
||||
NSString* value = ios_get_value_from_config(config, name, defaultValue);
|
||||
value = [value stringByReplacingOccurrencesOfString:path withString:@""];
|
||||
|
||||
NSArray* values = [[NSFileManager defaultManager] subpathsOfDirectoryAtPath:path error:nil];
|
||||
@ -93,7 +82,7 @@ static RASettingData* subpath_setting(config_file_t* config, NSString* name, NSS
|
||||
static RASettingData* range_setting(config_file_t* config, NSString* name, NSString* label, NSString* defaultValue, double minValue, double maxValue)
|
||||
{
|
||||
RASettingData* result = [[RASettingData alloc] initWithType:RangeSetting label:label name:name];
|
||||
result.value = get_value_from_config(config, name, defaultValue);
|
||||
result.value = ios_get_value_from_config(config, name, defaultValue);
|
||||
result.rangeMin = minValue;
|
||||
result.rangeMax = maxValue;
|
||||
return result;
|
||||
|
Loading…
x
Reference in New Issue
Block a user