mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 15:40:44 +00:00
Refactor menu_entry_pathdir_set_value
This commit is contained in:
parent
4c2bf57775
commit
d25b248db0
@ -18,6 +18,7 @@
|
||||
#include "menu_display.h"
|
||||
#include "menu_entries_cbs.h"
|
||||
#include "menu_setting.h"
|
||||
#include "menu_entry.h"
|
||||
#include "menu_shader.h"
|
||||
#include "menu_navigation.h"
|
||||
|
||||
@ -786,29 +787,7 @@ static int action_ok_remap_file_save_game(const char *path,
|
||||
static int action_ok_path_use_directory(const char *path,
|
||||
const char *label, unsigned type, size_t idx)
|
||||
{
|
||||
const char *menu_label = NULL;
|
||||
const char *menu_path = NULL;
|
||||
rarch_setting_t *setting = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
if (!menu)
|
||||
return -1;
|
||||
|
||||
menu_list_get_last_stack(menu->menu_list,
|
||||
&menu_path, &menu_label, NULL);
|
||||
|
||||
setting = menu_setting_find(menu_label);
|
||||
|
||||
if (!setting)
|
||||
return -1;
|
||||
|
||||
if (setting->type != ST_DIR)
|
||||
return -1;
|
||||
|
||||
strlcpy(setting->value.string, menu_path, setting->size);
|
||||
menu_setting_generic(setting);
|
||||
menu_list_pop_stack_by_needle(menu->menu_list, setting->name);
|
||||
|
||||
return 0;
|
||||
return menu_entry_pathdir_set_value(0, NULL);
|
||||
}
|
||||
|
||||
static int action_ok_core_deferred_set(const char *path,
|
||||
|
@ -301,10 +301,32 @@ void menu_entry_pathdir_get_value(uint32_t i, char *s, size_t len)
|
||||
strlcpy(s, entry.value, len);
|
||||
}
|
||||
|
||||
void menu_entry_pathdir_set_value(uint32_t i, const char *s)
|
||||
int menu_entry_pathdir_set_value(uint32_t i, const char *s)
|
||||
{
|
||||
rarch_setting_t *setting = menu_entry_get_setting(i);
|
||||
setting_set_with_string_representation(setting, s);
|
||||
const char *menu_label = NULL;
|
||||
const char *menu_path = NULL;
|
||||
rarch_setting_t *setting = NULL;
|
||||
menu_list_t *menu_list = menu_list_get_ptr();
|
||||
|
||||
menu_list_get_last_stack(menu_list,
|
||||
&menu_path, &menu_label, NULL);
|
||||
|
||||
setting = menu_setting_find(menu_label);
|
||||
|
||||
if (!setting)
|
||||
return -1;
|
||||
|
||||
if (setting->type != ST_DIR)
|
||||
return -1;
|
||||
|
||||
(void)s;
|
||||
|
||||
strlcpy(setting->value.string, menu_path, setting->size);
|
||||
menu_setting_generic(setting);
|
||||
|
||||
menu_list_pop_stack_by_needle(menu_list, setting->name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void menu_entry_pathdir_extensions(uint32_t i, char *s, size_t len)
|
||||
|
@ -95,7 +95,7 @@ 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_set_value(uint32_t i, const char *s);
|
||||
int menu_entry_pathdir_set_value(uint32_t i, const char *s);
|
||||
|
||||
void menu_entry_pathdir_extensions(uint32_t i, char *s, size_t len);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user