mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 22:13:51 +00:00
Rewrite menu_entry_get_path
This commit is contained in:
parent
7adf4ca854
commit
decea56c03
@ -600,7 +600,7 @@ static void xui_render(void *data, bool is_idle)
|
||||
menu_entry_get(&entry, 0, i, NULL, true);
|
||||
|
||||
menu_entry_get_value(&entry, entry_value, sizeof(entry_value));
|
||||
menu_entry_get_path(i, entry_path, sizeof(entry_path));
|
||||
menu_entry_get_path(&entry, entry_path, sizeof(entry_path));
|
||||
|
||||
mbstowcs(msg_left, entry_path, sizeof(msg_left) / sizeof(wchar_t));
|
||||
mbstowcs(msg_right, entry_value, sizeof(msg_right) / sizeof(wchar_t));
|
||||
|
@ -93,14 +93,11 @@ void menu_entry_init(menu_entry_t *entry)
|
||||
entry->spacing = 0;
|
||||
}
|
||||
|
||||
void menu_entry_get_path(uint32_t i, char *s, size_t len)
|
||||
void menu_entry_get_path(menu_entry_t *entry, char *s, size_t len)
|
||||
{
|
||||
menu_entry_t entry;
|
||||
|
||||
menu_entry_init(&entry);
|
||||
menu_entry_get(&entry, 0, i, NULL, true);
|
||||
|
||||
strlcpy(s, entry.path, len);
|
||||
if (!entry)
|
||||
return;
|
||||
strlcpy(s, entry->path, len);
|
||||
}
|
||||
|
||||
void menu_entry_get_rich_label(menu_entry_t *entry, char *s, size_t len)
|
||||
@ -233,15 +230,6 @@ uint32_t menu_entry_pathdir_for_directory(uint32_t i)
|
||||
return flags & SD_FLAG_PATH_DIR;
|
||||
}
|
||||
|
||||
void menu_entry_pathdir_get_value(uint32_t i, char *s, size_t len)
|
||||
{
|
||||
menu_entry_t entry;
|
||||
|
||||
menu_entry_init(&entry);
|
||||
menu_entry_get(&entry, 0, i, NULL, true);
|
||||
strlcpy(s, entry.value, len);
|
||||
}
|
||||
|
||||
void menu_entry_pathdir_extensions(uint32_t i, char *s, size_t len)
|
||||
{
|
||||
rarch_setting_t *setting = menu_entries_get_setting(i);
|
||||
|
@ -59,7 +59,7 @@ typedef struct menu_entry
|
||||
|
||||
enum menu_entry_type menu_entry_get_type(uint32_t i);
|
||||
|
||||
void menu_entry_get_path(uint32_t i, char *s, size_t len);
|
||||
void menu_entry_get_path(menu_entry_t *entry, char *s, size_t len);
|
||||
|
||||
void menu_entry_get_label(menu_entry_t *entry, char *s, size_t len);
|
||||
|
||||
@ -87,8 +87,6 @@ bool menu_entry_pathdir_allow_empty(uint32_t i);
|
||||
|
||||
uint32_t menu_entry_pathdir_for_directory(uint32_t i);
|
||||
|
||||
void menu_entry_pathdir_get_value(uint32_t i, char *s, size_t len);
|
||||
|
||||
void menu_entry_pathdir_extensions(uint32_t i, char *s, size_t len);
|
||||
|
||||
void menu_entry_reset(uint32_t i);
|
||||
|
@ -125,7 +125,7 @@ static void RunActionSheet(const char* title, const struct string_list* items,
|
||||
|
||||
menu_entry_init(&entry);
|
||||
menu_entry_get(&entry, 0, (unsigned)self.i, NULL, true);
|
||||
menu_entry_get_path(self.i, label, sizeof(label));
|
||||
menu_entry_get_path(&entry, label, sizeof(label));
|
||||
menu_entry_get_value(&entry, buffer, sizeof(buffer));
|
||||
|
||||
result.textLabel.text = BOXSTRING(label);
|
||||
@ -152,6 +152,7 @@ static void RunActionSheet(const char* title, const struct string_list* items,
|
||||
|
||||
- (UITableViewCell*)cellForTableView:(UITableView*)tableView
|
||||
{
|
||||
menu_entry_t entry;
|
||||
char label[PATH_MAX_LENGTH];
|
||||
static NSString* const cell_id = @"boolean_setting";
|
||||
|
||||
@ -166,7 +167,9 @@ static void RunActionSheet(const char* title, const struct string_list* items,
|
||||
result.accessoryView = [UISwitch new];
|
||||
}
|
||||
|
||||
menu_entry_get_path(self.i, label, sizeof(label));
|
||||
menu_entry_init(&entry);
|
||||
menu_entry_get(&entry, 0, (unsigned)self.i, NULL, true);
|
||||
menu_entry_get_path(&entry, label, sizeof(label));
|
||||
|
||||
result.textLabel.text = BOXSTRING(label);
|
||||
[(id)result.accessoryView removeTarget:nil
|
||||
@ -176,6 +179,7 @@ static void RunActionSheet(const char* title, const struct string_list* items,
|
||||
action:@selector(handleBooleanSwitch:)
|
||||
forControlEvents:UIControlEventValueChanged];
|
||||
[(id)result.accessoryView setOn:(menu_entry_get_bool_value(self.i))];
|
||||
menu_entry_free(&entry);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -210,11 +214,14 @@ static void RunActionSheet(const char* title, const struct string_list* items,
|
||||
- (void)wasSelectedOnTableView:(UITableView*)tableView
|
||||
ofController:(UIViewController*)controller
|
||||
{
|
||||
menu_entry_t entry;
|
||||
struct string_list* items;
|
||||
char label[PATH_MAX_LENGTH];
|
||||
RAMenuItemEnum __weak* weakSelf = self;
|
||||
|
||||
menu_entry_get_path(self.i, label, sizeof(label));
|
||||
menu_entry_init(&entry);
|
||||
menu_entry_get(&entry, 0, (unsigned)self.i, NULL, true);
|
||||
menu_entry_get_path(&entry, label, sizeof(label));
|
||||
items = menu_entry_enum_values(self.i);
|
||||
|
||||
RunActionSheet(label, items, self.parentTable,
|
||||
@ -228,6 +235,7 @@ static void RunActionSheet(const char* title, const struct string_list* items,
|
||||
[weakSelf.parentTable reloadData];
|
||||
});
|
||||
string_list_free(items);
|
||||
menu_entry_free(&entry);
|
||||
}
|
||||
@end
|
||||
|
||||
@ -241,9 +249,12 @@ static void RunActionSheet(const char* title, const struct string_list* items,
|
||||
- (void)wasSelectedOnTableView:(UITableView *)tableView
|
||||
ofController:(UIViewController *)controller
|
||||
{
|
||||
menu_entry_t entry;
|
||||
char label[PATH_MAX_LENGTH];
|
||||
|
||||
menu_entry_get_path(self.i, label, sizeof(label));
|
||||
menu_entry_init(&entry);
|
||||
menu_entry_get(&entry, 0, (unsigned)self.i, NULL, true);
|
||||
menu_entry_get_path(&entry, label, sizeof(label));
|
||||
|
||||
self.alert = [[UIAlertView alloc]
|
||||
initWithTitle:BOXSTRING("RetroArch")
|
||||
@ -263,6 +274,7 @@ static void RunActionSheet(const char* title, const struct string_list* items,
|
||||
selector:@selector(checkBind:)
|
||||
userInfo:nil
|
||||
repeats:YES];
|
||||
menu_entry_free(&entry);
|
||||
}
|
||||
|
||||
- (void)finishWithClickedButton:(bool)clicked
|
||||
@ -421,7 +433,7 @@ replacementString:(NSString *)string
|
||||
|
||||
menu_entry_init(&entry);
|
||||
menu_entry_get(&entry, 0, (unsigned)self.i, NULL, true);
|
||||
menu_entry_get_path(self.i, label, sizeof(label));
|
||||
menu_entry_get_path(&entry, label, sizeof(label));
|
||||
|
||||
desc = BOXSTRING(label);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user