diff --git a/apple/common/setting_data.c b/apple/common/setting_data.c index e3b6b5ce10..204d67c518 100644 --- a/apple/common/setting_data.c +++ b/apple/common/setting_data.c @@ -198,6 +198,8 @@ void setting_data_set_with_string_representation(const rarch_setting_t* setting, { if (!setting || !value) return; + + // TODO: Clamp to min/max switch (setting->type) { @@ -314,7 +316,9 @@ static const uint32_t features = SD_FEATURE_VIDEO_MODE | SD_FEATURE_SHADERS | #define CONFIG_BIND(TARGET, PLAYER, NAME, SHORT, DEF) \ NEXT = setting_data_bind_setting (NAME, SHORT, &TARGET, PLAYER, DEF); -#define FLAGS(FLAGS) (list[index - 1]).flags = FLAGS; +#define WITH_FLAGS(FLAGS) (list[index - 1]).flags = FLAGS; +#define WITH_RANGE(MIN, MAX) (list[index - 1]).min = MIN; (list[index - 1]).max = MAX; +#define WITH_VALUES(VALUES) (list[index -1]).values = VALUES; // TODO: Add black_frame_insertion, swap_interval msg_color video.rotation audio.block_frames audio.in_rate fast_forward_ratio // rgui_show_start_screen @@ -512,8 +516,8 @@ const rarch_setting_t* setting_data_get_list() #ifdef HAVE_OVERLAY START_SUB_GROUP("Overlay") - CONFIG_PATH(g_settings.input.overlay, "input_overlay", "Input Overlay", DEFAULT_ME_YO) - CONFIG_FLOAT(g_settings.input.overlay_opacity, "input_overlay_opacity", "Overlay Opacity", 1.0f) + CONFIG_PATH(g_settings.input.overlay, "input_overlay", "Input Overlay", DEFAULT_ME_YO) WITH_FLAGS(SD_FLAG_PATH_FILE) WITH_VALUES("cfg") + CONFIG_FLOAT(g_settings.input.overlay_opacity, "input_overlay_opacity", "Overlay Opacity", 1.0f) WITH_RANGE(0, 1) CONFIG_FLOAT(g_settings.input.overlay_scale, "input_overlay_scale", "Overlay Scale", 1.0f) END_SUB_GROUP() #endif diff --git a/apple/common/setting_data.h b/apple/common/setting_data.h index 5a23eff685..4fbe3fe6b9 100644 --- a/apple/common/setting_data.h +++ b/apple/common/setting_data.h @@ -54,6 +54,7 @@ typedef struct double min; double max; + const char* values; uint64_t flags; union diff --git a/apple/iOS/browser.m b/apple/iOS/browser.m index eefc2e9933..b8fc806d79 100644 --- a/apple/iOS/browser.m +++ b/apple/iOS/browser.m @@ -91,14 +91,16 @@ static void file_action(enum file_action action, NSString* source, NSString* tar @implementation RADirectoryList { NSString* _path; + NSString* _extensions; } -- (id)initWithPath:(NSString*)path delegate:(id)delegate +- (id)initWithPath:(NSString*)path extensions:(const char*)extensions forDirectory:(bool)forDirectory delegate:(id)delegate { if ((self = [super initWithStyle:UITableViewStylePlain])) { _path = path ? path : NSHomeDirectory(); _directoryDelegate = delegate; + _extensions = @(extensions); self = [super initWithStyle:UITableViewStylePlain]; self.hidesHeaders = YES; @@ -157,7 +159,7 @@ static void file_action(enum file_action action, NSString* source, NSString* tar [self.sections addObject:[NSMutableArray arrayWithObject:i]]; // List contents - struct string_list* contents = dir_list_new(_path.UTF8String, 0, true); + struct string_list* contents = dir_list_new(_path.UTF8String, _extensions.UTF8String, true); if (contents) { diff --git a/apple/iOS/menu.m b/apple/iOS/menu.m index d43ff1f3a4..c6ccb15414 100644 --- a/apple/iOS/menu.m +++ b/apple/iOS/menu.m @@ -171,7 +171,12 @@ result.textLabel.text = @(self.setting->short_description); if (self.setting) + { result.detailTextLabel.text = @(setting_data_get_string_representation(self.setting, buffer, sizeof(buffer))); + + if (self.setting->type == ST_PATH) + result.detailTextLabel.text = [result.detailTextLabel.text lastPathComponent]; + } return result; } @@ -264,7 +269,8 @@ - (void)wasSelectedOnTableView:(UITableView*)tableView ofController:(UIViewController*)controller { - RADirectoryList* list = [[RADirectoryList alloc] initWithPath:nil delegate:self]; + NSString* path = [@(self.setting->value.string) stringByDeletingLastPathComponent]; + RADirectoryList* list = [[RADirectoryList alloc] initWithPath:path extensions:self.setting->values forDirectory:false delegate:self]; [controller.navigationController pushViewController:list animated:YES]; } @@ -411,7 +417,7 @@ NSString* ragPath = [rootPath stringByAppendingPathComponent:@"RetroArchGames"]; NSString* target = path_is_directory(ragPath.UTF8String) ? ragPath : rootPath; - [self.navigationController pushViewController:[[RADirectoryList alloc] initWithPath:target delegate:self] animated:YES]; + [self.navigationController pushViewController:[[RADirectoryList alloc] initWithPath:target extensions:NULL forDirectory:false delegate:self] animated:YES]; } - (void)loadHistory diff --git a/apple/iOS/views.h b/apple/iOS/views.h index 8a294804e8..2582ebc400 100644 --- a/apple/iOS/views.h +++ b/apple/iOS/views.h @@ -37,7 +37,7 @@ @interface RADirectoryList : RAMenuBase @property (nonatomic, weak) id directoryDelegate; @property (nonatomic, weak) RADirectoryItem* selectedItem; -- (id)initWithPath:(NSString*)path delegate:(id)delegate; +- (id)initWithPath:(NSString*)path extensions:(const char*)extensions forDirectory:(bool)forDirectory delegate:(id)delegate; - (void)browseTo:(NSString*)path; @end