Fill in more ident names for more callbacks

This commit is contained in:
twinaphex 2015-10-11 20:26:44 +02:00
parent d7b9702506
commit 04a0e4cd58
10 changed files with 180 additions and 75 deletions

View File

@ -16,6 +16,12 @@
#include "../menu.h" #include "../menu.h"
#include "../menu_cbs.h" #include "../menu_cbs.h"
#ifndef BIND_ACTION_CONTENT_LIST_SWITCH
#define BIND_ACTION_CONTENT_LIST_SWITCH(cbs, name) \
cbs->action_content_list_switch = name; \
cbs->action_content_list_switch_ident = #name;
#endif
int menu_cbs_init_bind_content_list_switch(menu_file_list_cbs_t *cbs, int menu_cbs_init_bind_content_list_switch(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx, const char *path, const char *label, unsigned type, size_t idx,
const char *elem0, const char *elem1, const char *elem0, const char *elem1,
@ -24,7 +30,7 @@ int menu_cbs_init_bind_content_list_switch(menu_file_list_cbs_t *cbs,
if (!cbs) if (!cbs)
return -1; return -1;
cbs->action_content_list_switch = deferred_push_content_list; BIND_ACTION_CONTENT_LIST_SWITCH(cbs, deferred_push_content_list);
return -1; return -1;
} }

View File

@ -17,6 +17,12 @@
#include "../menu_navigation.h" #include "../menu_navigation.h"
#include "../menu_cbs.h" #include "../menu_cbs.h"
#ifndef BIND_ACTION_DOWN
#define BIND_ACTION_DOWN(cbs, name) \
cbs->action_down = name; \
cbs->action_down_ident = #name;
#endif
static int action_bind_down_generic(unsigned type, const char *label) static int action_bind_down_generic(unsigned type, const char *label)
{ {
size_t scroll_accel = 0; size_t scroll_accel = 0;
@ -45,7 +51,7 @@ int menu_cbs_init_bind_down(menu_file_list_cbs_t *cbs,
if (!cbs) if (!cbs)
return -1; return -1;
cbs->action_down = action_bind_down_generic; BIND_ACTION_DOWN(cbs, action_bind_down_generic);
return -1; return -1;
} }

View File

@ -19,6 +19,12 @@
#include "../menu_cbs.h" #include "../menu_cbs.h"
#include "../menu_hash.h" #include "../menu_hash.h"
#ifndef BIND_ACTION_INFO
#define BIND_ACTION_INFO(cbs, name) \
cbs->action_info = name; \
cbs->action_info_ident = #name;
#endif
static int action_info_default(unsigned type, const char *label) static int action_info_default(unsigned type, const char *label)
{ {
size_t selection = 0; size_t selection = 0;
@ -47,7 +53,7 @@ int menu_cbs_init_bind_info(menu_file_list_cbs_t *cbs,
if (!cbs) if (!cbs)
return -1; return -1;
cbs->action_info = action_info_default; BIND_ACTION_INFO(cbs, action_info_default);
return -1; return -1;
} }

View File

@ -26,6 +26,12 @@
#include "../../general.h" #include "../../general.h"
#include "../../retroarch.h" #include "../../retroarch.h"
#ifndef BIND_ACTION_LEFT
#define BIND_ACTION_LEFT(cbs, name) \
cbs->action_left = name; \
cbs->action_left_ident = #name;
#endif
#ifdef HAVE_SHADER_MANAGER #ifdef HAVE_SHADER_MANAGER
static int generic_shader_action_parameter_left( static int generic_shader_action_parameter_left(
struct video_shader *shader, struct video_shader_parameter *param, struct video_shader *shader, struct video_shader_parameter *param,
@ -336,7 +342,7 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs,
if ((parent_group_hash == MENU_VALUE_MAIN_MENU) && (menu_setting_get_type(cbs->setting) == ST_GROUP)) if ((parent_group_hash == MENU_VALUE_MAIN_MENU) && (menu_setting_get_type(cbs->setting) == ST_GROUP))
{ {
cbs->action_left = action_left_scroll; BIND_ACTION_LEFT(cbs, action_left_scroll);
return 0; return 0;
} }
} }
@ -354,44 +360,46 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs,
if (label_hash != label_setting_hash) if (label_hash != label_setting_hash)
continue; continue;
cbs->action_left = bind_left_generic; BIND_ACTION_LEFT(cbs, bind_left_generic);
return 0; return 0;
} }
if (strstr(label, "rdb_entry")) if (strstr(label, "rdb_entry"))
cbs->action_left = action_left_scroll; {
BIND_ACTION_LEFT(cbs, action_left_scroll);
}
else else
{ {
switch (label_hash) switch (label_hash)
{ {
case MENU_LABEL_SAVESTATE: case MENU_LABEL_SAVESTATE:
case MENU_LABEL_LOADSTATE: case MENU_LABEL_LOADSTATE:
cbs->action_left = action_left_save_state; BIND_ACTION_LEFT(cbs, action_left_save_state);
break; break;
case MENU_LABEL_VIDEO_SHADER_SCALE_PASS: case MENU_LABEL_VIDEO_SHADER_SCALE_PASS:
cbs->action_left = action_left_shader_scale_pass; BIND_ACTION_LEFT(cbs, action_left_shader_scale_pass);
break; break;
case MENU_LABEL_VIDEO_SHADER_FILTER_PASS: case MENU_LABEL_VIDEO_SHADER_FILTER_PASS:
cbs->action_left = action_left_shader_filter_pass; BIND_ACTION_LEFT(cbs, action_left_shader_filter_pass);
break; break;
case MENU_LABEL_VIDEO_SHADER_DEFAULT_FILTER: case MENU_LABEL_VIDEO_SHADER_DEFAULT_FILTER:
cbs->action_left = action_left_shader_filter_default; BIND_ACTION_LEFT(cbs, action_left_shader_filter_default);
break; break;
case MENU_LABEL_VIDEO_SHADER_NUM_PASSES: case MENU_LABEL_VIDEO_SHADER_NUM_PASSES:
cbs->action_left = action_left_shader_num_passes; BIND_ACTION_LEFT(cbs, action_left_shader_num_passes);
break; break;
case MENU_LABEL_CHEAT_NUM_PASSES: case MENU_LABEL_CHEAT_NUM_PASSES:
cbs->action_left = action_left_cheat_num_passes; BIND_ACTION_LEFT(cbs, action_left_cheat_num_passes);
break; break;
case MENU_LABEL_SCREEN_RESOLUTION: case MENU_LABEL_SCREEN_RESOLUTION:
cbs->action_left = action_left_video_resolution; BIND_ACTION_LEFT(cbs, action_left_video_resolution);
break; break;
case MENU_LABEL_NO_PLAYLIST_ENTRIES_AVAILABLE: case MENU_LABEL_NO_PLAYLIST_ENTRIES_AVAILABLE:
switch (menu_label_hash) switch (menu_label_hash)
{ {
case MENU_VALUE_HORIZONTAL_MENU: case MENU_VALUE_HORIZONTAL_MENU:
case MENU_VALUE_MAIN_MENU: case MENU_VALUE_MAIN_MENU:
cbs->action_left = action_left_mainmenu; BIND_ACTION_LEFT(cbs, action_left_mainmenu);
break; break;
} }
default: default:
@ -407,26 +415,36 @@ static int menu_cbs_init_bind_left_compare_type(menu_file_list_cbs_t *cbs,
{ {
if (type >= MENU_SETTINGS_CHEAT_BEGIN if (type >= MENU_SETTINGS_CHEAT_BEGIN
&& type <= MENU_SETTINGS_CHEAT_END) && type <= MENU_SETTINGS_CHEAT_END)
cbs->action_left = action_left_cheat; {
BIND_ACTION_LEFT(cbs, action_left_cheat);
}
#ifdef HAVE_SHADER_MANAGER #ifdef HAVE_SHADER_MANAGER
else if (type >= MENU_SETTINGS_SHADER_PARAMETER_0 else if (type >= MENU_SETTINGS_SHADER_PARAMETER_0
&& type <= MENU_SETTINGS_SHADER_PARAMETER_LAST) && type <= MENU_SETTINGS_SHADER_PARAMETER_LAST)
cbs->action_left = shader_action_parameter_left; {
BIND_ACTION_LEFT(cbs, shader_action_parameter_left);
}
else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0 else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0
&& type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST) && type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST)
cbs->action_left = shader_action_parameter_preset_left; {
BIND_ACTION_LEFT(cbs, shader_action_parameter_preset_left);
}
#endif #endif
else if (type >= MENU_SETTINGS_INPUT_DESC_BEGIN else if (type >= MENU_SETTINGS_INPUT_DESC_BEGIN
&& type <= MENU_SETTINGS_INPUT_DESC_END) && type <= MENU_SETTINGS_INPUT_DESC_END)
cbs->action_left = action_left_input_desc; {
BIND_ACTION_LEFT(cbs, action_left_input_desc);
}
else if ((type >= MENU_SETTINGS_CORE_OPTION_START)) else if ((type >= MENU_SETTINGS_CORE_OPTION_START))
cbs->action_left = core_setting_left; {
BIND_ACTION_LEFT(cbs, core_setting_left);
}
else else
{ {
switch (type) switch (type)
{ {
case MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_INDEX: case MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_INDEX:
cbs->action_left = disk_options_disk_idx_left; BIND_ACTION_LEFT(cbs, disk_options_disk_idx_left);
break; break;
case MENU_FILE_PLAIN: case MENU_FILE_PLAIN:
case MENU_FILE_DIRECTORY: case MENU_FILE_DIRECTORY:
@ -460,16 +478,16 @@ static int menu_cbs_init_bind_left_compare_type(menu_file_list_cbs_t *cbs,
{ {
case MENU_VALUE_HORIZONTAL_MENU: case MENU_VALUE_HORIZONTAL_MENU:
case MENU_VALUE_MAIN_MENU: case MENU_VALUE_MAIN_MENU:
cbs->action_left = action_left_mainmenu; BIND_ACTION_LEFT(cbs, action_left_mainmenu);
break; break;
default: default:
cbs->action_left = action_left_scroll; BIND_ACTION_LEFT(cbs, action_left_scroll);
break; break;
} }
break; break;
case MENU_SETTING_ACTION: case MENU_SETTING_ACTION:
case MENU_FILE_CONTENTLIST_ENTRY: case MENU_FILE_CONTENTLIST_ENTRY:
cbs->action_left = action_left_mainmenu; BIND_ACTION_LEFT(cbs, action_left_mainmenu);
break; break;
default: default:
return -1; return -1;
@ -487,7 +505,7 @@ int menu_cbs_init_bind_left(menu_file_list_cbs_t *cbs,
if (!cbs) if (!cbs)
return -1; return -1;
cbs->action_left = bind_left_generic; BIND_ACTION_LEFT(cbs, bind_left_generic);
if (menu_cbs_init_bind_left_compare_label(cbs, label, label_hash, menu_label_hash, elem0) == 0) if (menu_cbs_init_bind_left_compare_label(cbs, label, label_hash, menu_label_hash, elem0) == 0)
return 0; return 0;

View File

@ -17,6 +17,12 @@
#include "../menu_cbs.h" #include "../menu_cbs.h"
#include "../menu_hash.h" #include "../menu_hash.h"
#ifndef BIND_ACTION_REFRESH
#define BIND_ACTION_REFRESH(cbs, name) \
cbs->action_refresh = name; \
cbs->action_refresh_ident = #name;
#endif
int action_refresh_default(file_list_t *list, file_list_t *menu_list) int action_refresh_default(file_list_t *list, file_list_t *menu_list)
{ {
if (!menu_list) if (!menu_list)
@ -35,10 +41,10 @@ int menu_cbs_init_bind_refresh(menu_file_list_cbs_t *cbs,
switch (label_hash) switch (label_hash)
{ {
case MENU_VALUE_MAIN_MENU: case MENU_VALUE_MAIN_MENU:
cbs->action_refresh = NULL; BIND_ACTION_REFRESH(cbs, NULL);
break; break;
default: default:
cbs->action_refresh = action_refresh_default; BIND_ACTION_REFRESH(cbs, action_refresh_default);
break; break;
} }

View File

@ -26,6 +26,11 @@
#include "../../general.h" #include "../../general.h"
#include "../../retroarch.h" #include "../../retroarch.h"
#ifndef BIND_ACTION_RIGHT
#define BIND_ACTION_RIGHT(cbs, name) \
cbs->action_right = name; \
cbs->action_right_ident = #name;
#endif
#ifdef HAVE_SHADER_MANAGER #ifdef HAVE_SHADER_MANAGER
static int generic_shader_action_parameter_right( static int generic_shader_action_parameter_right(
@ -360,26 +365,36 @@ static int menu_cbs_init_bind_right_compare_type(menu_file_list_cbs_t *cbs,
{ {
if (type >= MENU_SETTINGS_CHEAT_BEGIN if (type >= MENU_SETTINGS_CHEAT_BEGIN
&& type <= MENU_SETTINGS_CHEAT_END) && type <= MENU_SETTINGS_CHEAT_END)
cbs->action_right = action_right_cheat; {
BIND_ACTION_RIGHT(cbs, action_right_cheat);
}
#ifdef HAVE_SHADER_MANAGER #ifdef HAVE_SHADER_MANAGER
else if (type >= MENU_SETTINGS_SHADER_PARAMETER_0 else if (type >= MENU_SETTINGS_SHADER_PARAMETER_0
&& type <= MENU_SETTINGS_SHADER_PARAMETER_LAST) && type <= MENU_SETTINGS_SHADER_PARAMETER_LAST)
cbs->action_right = shader_action_parameter_right; {
BIND_ACTION_RIGHT(cbs, shader_action_parameter_right);
}
else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0 else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0
&& type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST) && type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST)
cbs->action_right = shader_action_parameter_preset_right; {
BIND_ACTION_RIGHT(cbs, shader_action_parameter_preset_right);
}
#endif #endif
else if (type >= MENU_SETTINGS_INPUT_DESC_BEGIN else if (type >= MENU_SETTINGS_INPUT_DESC_BEGIN
&& type <= MENU_SETTINGS_INPUT_DESC_END) && type <= MENU_SETTINGS_INPUT_DESC_END)
cbs->action_right = action_right_input_desc; {
BIND_ACTION_RIGHT(cbs, action_right_input_desc);
}
else if ((type >= MENU_SETTINGS_CORE_OPTION_START)) else if ((type >= MENU_SETTINGS_CORE_OPTION_START))
cbs->action_right = core_setting_right; {
BIND_ACTION_RIGHT(cbs, core_setting_right);
}
else else
{ {
switch (type) switch (type)
{ {
case MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_INDEX: case MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_INDEX:
cbs->action_right = disk_options_disk_idx_right; BIND_ACTION_RIGHT(cbs, disk_options_disk_idx_right);
break; break;
case MENU_FILE_PLAIN: case MENU_FILE_PLAIN:
case MENU_FILE_DIRECTORY: case MENU_FILE_DIRECTORY:
@ -413,15 +428,15 @@ static int menu_cbs_init_bind_right_compare_type(menu_file_list_cbs_t *cbs,
{ {
case MENU_VALUE_HORIZONTAL_MENU: case MENU_VALUE_HORIZONTAL_MENU:
case MENU_VALUE_MAIN_MENU: case MENU_VALUE_MAIN_MENU:
cbs->action_right = action_right_mainmenu; BIND_ACTION_RIGHT(cbs, action_right_mainmenu);
break; break;
default: default:
cbs->action_right = action_right_scroll; BIND_ACTION_RIGHT(cbs, action_right_scroll);
break; break;
} }
case MENU_SETTING_ACTION: case MENU_SETTING_ACTION:
case MENU_FILE_CONTENTLIST_ENTRY: case MENU_FILE_CONTENTLIST_ENTRY:
cbs->action_right = action_right_mainmenu; BIND_ACTION_RIGHT(cbs, action_right_mainmenu);
break; break;
default: default:
return -1; return -1;
@ -443,7 +458,7 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs,
if ((parent_group_hash == MENU_LABEL_SETTINGS) && (menu_setting_get_type(cbs->setting) == ST_GROUP)) if ((parent_group_hash == MENU_LABEL_SETTINGS) && (menu_setting_get_type(cbs->setting) == ST_GROUP))
{ {
cbs->action_right = action_right_scroll; BIND_ACTION_RIGHT(cbs, action_right_scroll);
return 0; return 0;
} }
} }
@ -461,44 +476,46 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs,
if (label_hash != label_setting_hash) if (label_hash != label_setting_hash)
continue; continue;
cbs->action_right = bind_right_generic; BIND_ACTION_RIGHT(cbs, bind_right_generic);
return 0; return 0;
} }
if (strstr(label, "rdb_entry")) if (strstr(label, "rdb_entry"))
cbs->action_right = action_right_scroll; {
BIND_ACTION_RIGHT(cbs, action_right_scroll);
}
else else
{ {
switch (label_hash) switch (label_hash)
{ {
case MENU_LABEL_SAVESTATE: case MENU_LABEL_SAVESTATE:
case MENU_LABEL_LOADSTATE: case MENU_LABEL_LOADSTATE:
cbs->action_right = action_right_save_state; BIND_ACTION_RIGHT(cbs, action_right_save_state);
break; break;
case MENU_LABEL_VIDEO_SHADER_SCALE_PASS: case MENU_LABEL_VIDEO_SHADER_SCALE_PASS:
cbs->action_right = action_right_shader_scale_pass; BIND_ACTION_RIGHT(cbs, action_right_shader_scale_pass);
break; break;
case MENU_LABEL_VIDEO_SHADER_FILTER_PASS: case MENU_LABEL_VIDEO_SHADER_FILTER_PASS:
cbs->action_right = action_right_shader_filter_pass; BIND_ACTION_RIGHT(cbs, action_right_shader_filter_pass);
break; break;
case MENU_LABEL_VIDEO_SHADER_DEFAULT_FILTER: case MENU_LABEL_VIDEO_SHADER_DEFAULT_FILTER:
cbs->action_right = action_right_shader_filter_default; BIND_ACTION_RIGHT(cbs, action_right_shader_filter_default);
break; break;
case MENU_LABEL_VIDEO_SHADER_NUM_PASSES: case MENU_LABEL_VIDEO_SHADER_NUM_PASSES:
cbs->action_right = action_right_shader_num_passes; BIND_ACTION_RIGHT(cbs, action_right_shader_num_passes);
break; break;
case MENU_LABEL_CHEAT_NUM_PASSES: case MENU_LABEL_CHEAT_NUM_PASSES:
cbs->action_right = action_right_cheat_num_passes; BIND_ACTION_RIGHT(cbs, action_right_cheat_num_passes);
break; break;
case MENU_LABEL_SCREEN_RESOLUTION: case MENU_LABEL_SCREEN_RESOLUTION:
cbs->action_right = action_right_video_resolution; BIND_ACTION_RIGHT(cbs, action_right_video_resolution);
break; break;
case MENU_LABEL_NO_PLAYLIST_ENTRIES_AVAILABLE: case MENU_LABEL_NO_PLAYLIST_ENTRIES_AVAILABLE:
switch (menu_label_hash) switch (menu_label_hash)
{ {
case MENU_VALUE_HORIZONTAL_MENU: case MENU_VALUE_HORIZONTAL_MENU:
case MENU_VALUE_MAIN_MENU: case MENU_VALUE_MAIN_MENU:
cbs->action_right = action_right_mainmenu; BIND_ACTION_RIGHT(cbs, action_right_mainmenu);
break; break;
} }
default: default:
@ -517,7 +534,7 @@ int menu_cbs_init_bind_right(menu_file_list_cbs_t *cbs,
if (!cbs) if (!cbs)
return -1; return -1;
cbs->action_right = bind_right_generic; BIND_ACTION_RIGHT(cbs, bind_right_generic);
if (menu_cbs_init_bind_right_compare_label(cbs, label, label_hash, menu_label_hash, elem0) == 0) if (menu_cbs_init_bind_right_compare_label(cbs, label, label_hash, menu_label_hash, elem0) == 0)
return 0; return 0;

View File

@ -23,6 +23,12 @@
#include "../../runloop_data.h" #include "../../runloop_data.h"
#ifndef BIND_ACTION_SCAN
#define BIND_ACTION_SCAN(cbs, name) \
cbs->action_scan = name; \
cbs->action_scan_ident = #name;
#endif
int action_scan_file(const char *path, int action_scan_file(const char *path,
const char *label, unsigned type, size_t idx) const char *label, unsigned type, size_t idx)
{ {
@ -70,11 +76,11 @@ static int menu_cbs_init_bind_scan_compare_type(menu_file_list_cbs_t *cbs,
switch (type) switch (type)
{ {
case MENU_FILE_DIRECTORY: case MENU_FILE_DIRECTORY:
cbs->action_scan = action_scan_directory; BIND_ACTION_SCAN(cbs, action_scan_directory);
break; break;
case MENU_FILE_CARCHIVE: case MENU_FILE_CARCHIVE:
case MENU_FILE_PLAIN: case MENU_FILE_PLAIN:
cbs->action_scan = action_scan_file; BIND_ACTION_SCAN(cbs, action_scan_file);
break; break;
default: default:
return -1; return -1;
@ -91,7 +97,7 @@ int menu_cbs_init_bind_scan(menu_file_list_cbs_t *cbs,
if (!cbs) if (!cbs)
return -1; return -1;
cbs->action_scan = NULL; BIND_ACTION_SCAN(cbs, NULL);
menu_cbs_init_bind_scan_compare_type(cbs, type); menu_cbs_init_bind_scan_compare_type(cbs, type);

View File

@ -20,6 +20,12 @@
#include "../../runloop_data.h" #include "../../runloop_data.h"
#ifndef BIND_ACTION_SELECT
#define BIND_ACTION_SELECT(cbs, name) \
cbs->action_select = name; \
cbs->action_select_ident = #name;
#endif
static int action_select_default(const char *path, const char *label, unsigned type, static int action_select_default(const char *path, const char *label, unsigned type,
size_t idx) size_t idx)
{ {
@ -126,27 +132,35 @@ static int menu_cbs_init_bind_select_compare_type(
{ {
if (type >= MENU_SETTINGS_CHEAT_BEGIN if (type >= MENU_SETTINGS_CHEAT_BEGIN
&& type <= MENU_SETTINGS_CHEAT_END) && type <= MENU_SETTINGS_CHEAT_END)
cbs->action_select = action_select_cheat; {
BIND_ACTION_SELECT(cbs, action_select_cheat);
}
#ifdef HAVE_SHADER_MANAGER #ifdef HAVE_SHADER_MANAGER
else if (type >= MENU_SETTINGS_SHADER_PARAMETER_0 else if (type >= MENU_SETTINGS_SHADER_PARAMETER_0
&& type <= MENU_SETTINGS_SHADER_PARAMETER_LAST) && type <= MENU_SETTINGS_SHADER_PARAMETER_LAST)
cbs->action_select = shader_action_parameter_select; {
BIND_ACTION_SELECT(cbs, shader_action_parameter_select);
}
else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0 else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0
&& type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST) && type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST)
cbs->action_select = shader_action_parameter_preset_select; {
BIND_ACTION_SELECT(cbs, shader_action_parameter_preset_select);
}
#endif #endif
else if (type >= MENU_SETTINGS_INPUT_DESC_BEGIN else if (type >= MENU_SETTINGS_INPUT_DESC_BEGIN
&& type <= MENU_SETTINGS_INPUT_DESC_END) && type <= MENU_SETTINGS_INPUT_DESC_END)
cbs->action_select = action_select_input_desc; {
BIND_ACTION_SELECT(cbs, action_select_input_desc);
}
else else
{ {
switch (type) switch (type)
{ {
case MENU_FILE_DIRECTORY: case MENU_FILE_DIRECTORY:
cbs->action_select = action_select_directory; BIND_ACTION_SELECT(cbs, action_select_directory);
break; break;
case MENU_FILE_USE_DIRECTORY: case MENU_FILE_USE_DIRECTORY:
cbs->action_select = action_select_path_use_directory; BIND_ACTION_SELECT(cbs, action_select_path_use_directory);
break; break;
default: default:
return -1; return -1;
@ -170,11 +184,11 @@ int menu_cbs_init_bind_select(menu_file_list_cbs_t *cbs,
if (!cbs) if (!cbs)
return -1; return -1;
cbs->action_select = action_select_default; BIND_ACTION_SELECT(cbs, action_select_default);
if ((type >= MENU_SETTINGS_CORE_OPTION_START)) if ((type >= MENU_SETTINGS_CORE_OPTION_START))
{ {
cbs->action_select = action_select_core_setting; BIND_ACTION_SELECT(cbs, action_select_core_setting);
return 0; return 0;
} }

View File

@ -27,6 +27,12 @@
#include "../../input/input_remapping.h" #include "../../input/input_remapping.h"
#ifndef BIND_ACTION_START
#define BIND_ACTION_START(cbs, name) \
cbs->action_start = name; \
cbs->action_start_ident = #name;
#endif
static int action_start_remap_file_load(unsigned type, const char *label) static int action_start_remap_file_load(unsigned type, const char *label)
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
@ -293,28 +299,28 @@ static int menu_cbs_init_bind_start_compare_label(menu_file_list_cbs_t *cbs,
switch (hash) switch (hash)
{ {
case MENU_LABEL_REMAP_FILE_LOAD: case MENU_LABEL_REMAP_FILE_LOAD:
cbs->action_start = action_start_remap_file_load; BIND_ACTION_START(cbs, action_start_remap_file_load);
break; break;
case MENU_LABEL_VIDEO_FILTER: case MENU_LABEL_VIDEO_FILTER:
cbs->action_start = action_start_video_filter_file_load; BIND_ACTION_START(cbs, action_start_video_filter_file_load);
break; break;
case MENU_LABEL_VIDEO_SHADER_PASS: case MENU_LABEL_VIDEO_SHADER_PASS:
cbs->action_start = action_start_shader_pass; BIND_ACTION_START(cbs, action_start_shader_pass);
break; break;
case MENU_LABEL_VIDEO_SHADER_SCALE_PASS: case MENU_LABEL_VIDEO_SHADER_SCALE_PASS:
cbs->action_start = action_start_shader_scale_pass; BIND_ACTION_START(cbs, action_start_shader_scale_pass);
break; break;
case MENU_LABEL_VIDEO_SHADER_FILTER_PASS: case MENU_LABEL_VIDEO_SHADER_FILTER_PASS:
cbs->action_start = action_start_shader_filter_pass; BIND_ACTION_START(cbs, action_start_shader_filter_pass);
break; break;
case MENU_LABEL_VIDEO_SHADER_NUM_PASSES: case MENU_LABEL_VIDEO_SHADER_NUM_PASSES:
cbs->action_start = action_start_shader_num_passes; BIND_ACTION_START(cbs, action_start_shader_num_passes);
break; break;
case MENU_LABEL_CHEAT_NUM_PASSES: case MENU_LABEL_CHEAT_NUM_PASSES:
cbs->action_start = action_start_cheat_num_passes; BIND_ACTION_START(cbs, action_start_cheat_num_passes);
break; break;
case MENU_LABEL_SCREEN_RESOLUTION: case MENU_LABEL_SCREEN_RESOLUTION:
cbs->action_start = action_start_video_resolution; BIND_ACTION_START(cbs, action_start_video_resolution);
default: default:
return -1; return -1;
} }
@ -327,23 +333,37 @@ static int menu_cbs_init_bind_start_compare_type(menu_file_list_cbs_t *cbs,
{ {
if (type >= MENU_SETTINGS_SHADER_PARAMETER_0 if (type >= MENU_SETTINGS_SHADER_PARAMETER_0
&& type <= MENU_SETTINGS_SHADER_PARAMETER_LAST) && type <= MENU_SETTINGS_SHADER_PARAMETER_LAST)
cbs->action_start = action_start_shader_action_parameter; {
BIND_ACTION_START(cbs, action_start_shader_action_parameter);
}
else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0 else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0
&& type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST) && type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST)
cbs->action_start = action_start_shader_action_preset_parameter; {
BIND_ACTION_START(cbs, action_start_shader_action_preset_parameter);
}
else if (type >= MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN && else if (type >= MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN &&
type <= MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_END) type <= MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_END)
cbs->action_start = action_start_performance_counters_core; {
BIND_ACTION_START(cbs, action_start_performance_counters_core);
}
else if (type >= MENU_SETTINGS_INPUT_DESC_BEGIN else if (type >= MENU_SETTINGS_INPUT_DESC_BEGIN
&& type <= MENU_SETTINGS_INPUT_DESC_END) && type <= MENU_SETTINGS_INPUT_DESC_END)
cbs->action_start = action_start_input_desc; {
BIND_ACTION_START(cbs, action_start_input_desc);
}
else if (type >= MENU_SETTINGS_PERF_COUNTERS_BEGIN && else if (type >= MENU_SETTINGS_PERF_COUNTERS_BEGIN &&
type <= MENU_SETTINGS_PERF_COUNTERS_END) type <= MENU_SETTINGS_PERF_COUNTERS_END)
cbs->action_start = action_start_performance_counters_frontend; {
BIND_ACTION_START(cbs, action_start_performance_counters_frontend);
}
else if ((type >= MENU_SETTINGS_CORE_OPTION_START)) else if ((type >= MENU_SETTINGS_CORE_OPTION_START))
cbs->action_start = action_start_core_setting; {
BIND_ACTION_START(cbs, action_start_core_setting);
}
else if (type == MENU_LABEL_SCREEN_RESOLUTION) else if (type == MENU_LABEL_SCREEN_RESOLUTION)
cbs->action_start = action_start_video_resolution; {
BIND_ACTION_START(cbs, action_start_video_resolution);
}
else else
return -1; return -1;
@ -358,7 +378,7 @@ int menu_cbs_init_bind_start(menu_file_list_cbs_t *cbs,
if (!cbs) if (!cbs)
return -1; return -1;
cbs->action_start = action_start_lookup_setting; BIND_ACTION_START(cbs, action_start_lookup_setting);
if (menu_cbs_init_bind_start_compare_label(cbs, label_hash) == 0) if (menu_cbs_init_bind_start_compare_label(cbs, label_hash) == 0)
return 0; return 0;

View File

@ -17,6 +17,12 @@
#include "../menu_cbs.h" #include "../menu_cbs.h"
#include "../menu_navigation.h" #include "../menu_navigation.h"
#ifndef BIND_ACTION_UP
#define BIND_ACTION_UP(cbs, name) \
cbs->action_up = name; \
cbs->action_up_ident = #name;
#endif
static int action_bind_up_generic(unsigned type, const char *label) static int action_bind_up_generic(unsigned type, const char *label)
{ {
size_t scroll_accel = 0; size_t scroll_accel = 0;
@ -45,7 +51,7 @@ int menu_cbs_init_bind_up(menu_file_list_cbs_t *cbs,
if (!cbs) if (!cbs)
return -1; return -1;
cbs->action_up = action_bind_up_generic; BIND_ACTION_UP(cbs, action_bind_up_generic);
return -1; return -1;
} }