mirror of
https://github.com/libretro/RetroArch
synced 2025-04-07 13:23:32 +00:00
Cut down on code duplication
This commit is contained in:
parent
45cb6925cf
commit
dce21063dd
@ -2456,8 +2456,6 @@ static int action_ok_file_load_detect_core(const char *path,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int generic_action_ok_command(enum event_command cmd)
|
static int generic_action_ok_command(enum event_command cmd)
|
||||||
{
|
{
|
||||||
if (!command_event(cmd, NULL))
|
if (!command_event(cmd, NULL))
|
||||||
@ -3034,12 +3032,6 @@ static int action_ok_update_autoconfig_profiles(const char *path,
|
|||||||
MENU_ENUM_LABEL_CB_UPDATE_AUTOCONFIG_PROFILES);
|
MENU_ENUM_LABEL_CB_UPDATE_AUTOCONFIG_PROFILES);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int action_ok_disk_cycle_tray_status(const char *path,
|
|
||||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
|
||||||
{
|
|
||||||
return generic_action_ok_command(CMD_EVENT_DISK_EJECT_TOGGLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* creates folder and core options stub file for subsequent runs */
|
/* creates folder and core options stub file for subsequent runs */
|
||||||
static int action_ok_option_create(const char *path,
|
static int action_ok_option_create(const char *path,
|
||||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||||
@ -3078,42 +3070,20 @@ static int action_ok_option_create(const char *path,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define default_action_ok_cmd_func(func_name, cmd) \
|
||||||
static int action_ok_close_content(const char *path,
|
int (func_name)(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) \
|
||||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
{ \
|
||||||
{
|
return generic_action_ok_command(cmd); \
|
||||||
return generic_action_ok_command(CMD_EVENT_UNLOAD_CORE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int action_ok_quit(const char *path,
|
default_action_ok_cmd_func(action_ok_close_content, CMD_EVENT_UNLOAD_CORE)
|
||||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
default_action_ok_cmd_func(action_ok_quit, CMD_EVENT_QUIT)
|
||||||
{
|
default_action_ok_cmd_func(action_ok_save_new_config, CMD_EVENT_MENU_SAVE_CONFIG)
|
||||||
return generic_action_ok_command(CMD_EVENT_QUIT);
|
default_action_ok_cmd_func(action_ok_resume_content, CMD_EVENT_RESUME)
|
||||||
}
|
default_action_ok_cmd_func(action_ok_restart_content, CMD_EVENT_RESET)
|
||||||
|
default_action_ok_cmd_func(action_ok_screenshot, CMD_EVENT_TAKE_SCREENSHOT)
|
||||||
static int action_ok_save_new_config(const char *path,
|
default_action_ok_cmd_func(action_ok_disk_cycle_tray_status, CMD_EVENT_DISK_EJECT_TOGGLE )
|
||||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
default_action_ok_cmd_func(action_ok_shader_apply_changes, CMD_EVENT_SHADERS_APPLY_CHANGES )
|
||||||
{
|
|
||||||
return generic_action_ok_command(CMD_EVENT_MENU_SAVE_CONFIG);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int action_ok_resume_content(const char *path,
|
|
||||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
|
||||||
{
|
|
||||||
return generic_action_ok_command(CMD_EVENT_RESUME);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int action_ok_restart_content(const char *path,
|
|
||||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
|
||||||
{
|
|
||||||
return generic_action_ok_command(CMD_EVENT_RESET);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int action_ok_screenshot(const char *path,
|
|
||||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
|
||||||
{
|
|
||||||
return generic_action_ok_command(CMD_EVENT_TAKE_SCREENSHOT);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int action_ok_delete_entry(const char *path,
|
static int action_ok_delete_entry(const char *path,
|
||||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||||
@ -3154,12 +3124,6 @@ static int action_ok_delete_entry(const char *path,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int action_ok_shader_apply_changes(const char *path,
|
|
||||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
|
||||||
{
|
|
||||||
return generic_action_ok_command(CMD_EVENT_SHADERS_APPLY_CHANGES);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int action_ok_rdb_entry_submenu(const char *path,
|
static int action_ok_rdb_entry_submenu(const char *path,
|
||||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user