mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(iOS) Improve handling of path settings some:
The file browser will start in the directory of the currently seleected file. The setting menu will display only the filename instead of the full path. Path settings can specify a list of extensions to search for.
This commit is contained in:
parent
6943127aef
commit
806cca44ca
@ -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
|
||||
|
@ -54,6 +54,7 @@ typedef struct
|
||||
double min;
|
||||
double max;
|
||||
|
||||
const char* values;
|
||||
uint64_t flags;
|
||||
|
||||
union
|
||||
|
@ -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<RADirectoryListDelegate>)delegate
|
||||
- (id)initWithPath:(NSString*)path extensions:(const char*)extensions forDirectory:(bool)forDirectory delegate:(id<RADirectoryListDelegate>)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)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -37,7 +37,7 @@
|
||||
@interface RADirectoryList : RAMenuBase<UIActionSheetDelegate>
|
||||
@property (nonatomic, weak) id<RADirectoryListDelegate> directoryDelegate;
|
||||
@property (nonatomic, weak) RADirectoryItem* selectedItem;
|
||||
- (id)initWithPath:(NSString*)path delegate:(id<RADirectoryListDelegate>)delegate;
|
||||
- (id)initWithPath:(NSString*)path extensions:(const char*)extensions forDirectory:(bool)forDirectory delegate:(id<RADirectoryListDelegate>)delegate;
|
||||
- (void)browseTo:(NSString*)path;
|
||||
@end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user