mirror of
https://github.com/libretro/RetroArch
synced 2025-04-07 13:23:32 +00:00
Code de-duplication
This commit is contained in:
parent
5f91c3ade6
commit
c0feef5b2f
@ -559,7 +559,8 @@ enum
|
||||
ACTION_OK_LOAD_CHEAT_FILE,
|
||||
ACTION_OK_APPEND_DISK_IMAGE,
|
||||
ACTION_OK_LOAD_CONFIG_FILE,
|
||||
ACTION_OK_LOAD_CORE
|
||||
ACTION_OK_LOAD_CORE,
|
||||
ACTION_OK_LOAD_WALLPAPER
|
||||
};
|
||||
|
||||
|
||||
@ -589,6 +590,17 @@ static int generic_action_ok(const char *path,
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case ACTION_OK_LOAD_WALLPAPER:
|
||||
flush_char = NULL;
|
||||
flush_type = 49;
|
||||
if (path_file_exists(action_path))
|
||||
{
|
||||
strlcpy(settings->menu.wallpaper, action_path, sizeof(settings->menu.wallpaper));
|
||||
|
||||
rarch_main_data_msg_queue_push(DATA_TYPE_IMAGE, action_path, "cb_menu_wallpaper", 0, 1,
|
||||
true);
|
||||
}
|
||||
break;
|
||||
case ACTION_OK_LOAD_CORE:
|
||||
flush_char = NULL;
|
||||
flush_type = MENU_SETTINGS;
|
||||
@ -671,6 +683,14 @@ error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int action_ok_menu_wallpaper_load(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
|
||||
return generic_action_ok(path, label, type, idx, entry_idx,
|
||||
ACTION_OK_LOAD_WALLPAPER, MENU_SETTINGS);
|
||||
}
|
||||
|
||||
static int action_ok_core_load(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
@ -728,44 +748,6 @@ static int action_ok_shader_pass_load(const char *path,
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int action_ok_menu_wallpaper_load(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
char wallpaper_path[PATH_MAX_LENGTH];
|
||||
const char *menu_label = NULL;
|
||||
const char *menu_path = NULL;
|
||||
menu_file_list_cbs_t *cbs = NULL;
|
||||
menu_list_t *menu_list = menu_list_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!menu_list)
|
||||
return -1;
|
||||
|
||||
menu_list_get_last_stack(menu_list, &menu_path, &menu_label,
|
||||
NULL, NULL);
|
||||
cbs = menu_list_get_last_stack_actiondata(menu_list);
|
||||
|
||||
if (!cbs)
|
||||
return -1;
|
||||
|
||||
fill_pathname_join(wallpaper_path, menu_path, path, sizeof(wallpaper_path));
|
||||
|
||||
if (path_file_exists(wallpaper_path))
|
||||
{
|
||||
strlcpy(settings->menu.wallpaper, wallpaper_path, sizeof(settings->menu.wallpaper));
|
||||
|
||||
rarch_main_data_msg_queue_push(DATA_TYPE_IMAGE, wallpaper_path, "cb_menu_wallpaper", 0, 1,
|
||||
true);
|
||||
}
|
||||
|
||||
menu_list_pop_stack_by_needle(menu_list, cbs->setting->name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int action_ok_cheat(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
@ -876,7 +858,7 @@ static int action_ok_path_scan_directory(const char *path,
|
||||
static int action_ok_core_deferred_set(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
char core_display_name[PATH_MAX_LENGTH] = {0};
|
||||
char core_display_name[PATH_MAX_LENGTH];
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_list_t *menu_list = menu_list_get_ptr();
|
||||
if (!menu || !menu_list)
|
||||
@ -925,9 +907,6 @@ static int action_ok_deferred_list_stub(const char *path,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
ACTION_OK_FFMPEG = 0,
|
||||
@ -1056,8 +1035,6 @@ static int action_ok_set_path(const char *path,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int generic_action_ok_command(enum event_command cmd)
|
||||
{
|
||||
if (!event_command(cmd))
|
||||
@ -1656,7 +1633,8 @@ static int action_ok_load_archive_detect_core(const char *path,
|
||||
{
|
||||
case -1:
|
||||
event_command(EVENT_CMD_LOAD_CORE);
|
||||
return menu_common_load_content(false, CORE_TYPE_PLAIN);
|
||||
ret = menu_common_load_content(false, CORE_TYPE_PLAIN);
|
||||
break;
|
||||
case 0:
|
||||
ret = generic_action_ok_displaylist_push(path, label, type,
|
||||
selected, entry_idx, ACTION_OK_DL_DEFERRED_CORE_LIST);
|
||||
|
Loading…
x
Reference in New Issue
Block a user