mirror of
https://github.com/libretro/RetroArch
synced 2025-02-19 12:41:00 +00:00
Make menu actions configurable
This commit is contained in:
parent
d876ba8130
commit
dcd203b44d
@ -494,6 +494,14 @@ static bool default_core_specific_config = false;
|
||||
static bool default_auto_overrides_enable = false;
|
||||
static bool default_auto_remaps_enable = false;
|
||||
|
||||
static unsigned default_menu_btn_ok = RETRO_DEVICE_ID_JOYPAD_A;
|
||||
static unsigned default_menu_btn_cancel = RETRO_DEVICE_ID_JOYPAD_B;
|
||||
static unsigned default_menu_btn_search = RETRO_DEVICE_ID_JOYPAD_X;
|
||||
static unsigned default_menu_btn_default = RETRO_DEVICE_ID_JOYPAD_START;
|
||||
static unsigned default_menu_btn_info = RETRO_DEVICE_ID_JOYPAD_SELECT;
|
||||
static unsigned default_menu_btn_scroll_down = RETRO_DEVICE_ID_JOYPAD_R;
|
||||
static unsigned default_menu_btn_scroll_up = RETRO_DEVICE_ID_JOYPAD_L;
|
||||
|
||||
/* Crop overscanned frames. */
|
||||
static const bool crop_overscan = true;
|
||||
|
||||
|
@ -688,6 +688,15 @@ static void config_set_defaults(void)
|
||||
settings->core_specific_config = default_core_specific_config;
|
||||
settings->auto_overrides_enable = default_auto_overrides_enable;
|
||||
settings->auto_remaps_enable = default_auto_remaps_enable;
|
||||
|
||||
settings->menu_ok_btn = default_menu_btn_ok;
|
||||
settings->menu_cancel_btn = default_menu_btn_cancel;
|
||||
settings->menu_search_btn = default_menu_btn_search;
|
||||
settings->menu_default_btn = default_menu_btn_default;
|
||||
settings->menu_info_btn = default_menu_btn_info;
|
||||
settings->menu_scroll_down_btn = default_menu_btn_scroll_down;
|
||||
settings->menu_scroll_up_btn = default_menu_btn_scroll_up;
|
||||
|
||||
settings->user_language = 0;
|
||||
|
||||
global->console.sound.system_bgm_enable = false;
|
||||
@ -1611,6 +1620,15 @@ static bool config_load_file(const char *path, bool set_defaults)
|
||||
CONFIG_GET_BOOL_BASE(conf, settings, auto_overrides_enable, "auto_overrides_enable");
|
||||
CONFIG_GET_BOOL_BASE(conf, settings, auto_remaps_enable, "auto_remaps_enable");
|
||||
|
||||
CONFIG_GET_INT_BASE(conf, settings, menu_ok_btn, "menu_ok_btn");
|
||||
CONFIG_GET_INT_BASE(conf, settings, menu_cancel_btn, "menu_cancel_btn");
|
||||
CONFIG_GET_INT_BASE(conf, settings, menu_search_btn, "menu_search_btn");
|
||||
CONFIG_GET_INT_BASE(conf, settings, menu_info_btn, "menu_info_btn");
|
||||
CONFIG_GET_INT_BASE(conf, settings, menu_default_btn, "menu_default_btn");
|
||||
CONFIG_GET_INT_BASE(conf, settings, menu_cancel_btn, "menu_cancel_btn");
|
||||
CONFIG_GET_INT_BASE(conf, settings, menu_scroll_down_btn, "menu_scroll_down_btn");
|
||||
CONFIG_GET_INT_BASE(conf, settings, menu_scroll_up_btn, "menu_scroll_up_btn");
|
||||
|
||||
config_file_free(conf);
|
||||
return true;
|
||||
}
|
||||
@ -2497,6 +2515,14 @@ bool config_save_file(const char *path)
|
||||
|
||||
config_set_int(conf, "archive_mode", settings->archive.mode);
|
||||
|
||||
config_set_int(conf, "menu_ok_btn", settings->menu_ok_btn);
|
||||
config_set_int(conf, "menu_cancel_btn", settings->menu_cancel_btn);
|
||||
config_set_int(conf, "menu_search_btn", settings->menu_search_btn);
|
||||
config_set_int(conf, "menu_info_btn", settings->menu_info_btn);
|
||||
config_set_int(conf, "menu_default_btn", settings->menu_default_btn);
|
||||
config_set_int(conf, "menu_scroll_down_btn", settings->menu_scroll_down_btn);
|
||||
config_set_int(conf, "menu_scroll_up_btn", settings->menu_scroll_up_btn);
|
||||
|
||||
ret = config_file_write(conf, path);
|
||||
config_file_free(conf);
|
||||
return ret;
|
||||
|
@ -323,6 +323,14 @@ typedef struct settings
|
||||
bool auto_overrides_enable;
|
||||
bool auto_remaps_enable;
|
||||
|
||||
unsigned menu_ok_btn;
|
||||
unsigned menu_cancel_btn;
|
||||
unsigned menu_search_btn;
|
||||
unsigned menu_default_btn;
|
||||
unsigned menu_info_btn;
|
||||
unsigned menu_scroll_down_btn;
|
||||
unsigned menu_scroll_up_btn;
|
||||
|
||||
char username[32];
|
||||
unsigned int user_language;
|
||||
|
||||
|
@ -965,21 +965,21 @@ unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input)
|
||||
ret = MENU_ACTION_LEFT;
|
||||
else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_RIGHT))
|
||||
ret = MENU_ACTION_RIGHT;
|
||||
else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_L))
|
||||
else if (trigger_input & (1ULL << settings->menu_scroll_up_btn))
|
||||
ret = MENU_ACTION_SCROLL_UP;
|
||||
else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_R))
|
||||
else if (trigger_input & (1ULL << settings->menu_scroll_down_btn))
|
||||
ret = MENU_ACTION_SCROLL_DOWN;
|
||||
else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_B))
|
||||
else if (trigger_input & (1ULL << settings->menu_cancel_btn))
|
||||
ret = MENU_ACTION_CANCEL;
|
||||
else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_A))
|
||||
else if (trigger_input & (1ULL << settings->menu_ok_btn))
|
||||
ret = MENU_ACTION_OK;
|
||||
else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_X))
|
||||
else if (trigger_input & (1ULL << settings->menu_search_btn))
|
||||
ret = MENU_ACTION_SEARCH;
|
||||
else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_Y))
|
||||
ret = MENU_ACTION_TEST;
|
||||
else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_START))
|
||||
else if (trigger_input & (1ULL << settings->menu_default_btn))
|
||||
ret = MENU_ACTION_START;
|
||||
else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_SELECT))
|
||||
else if (trigger_input & (1ULL << settings->menu_info_btn))
|
||||
ret = MENU_ACTION_SELECT;
|
||||
else if (trigger_input & (1ULL << RARCH_MENU_TOGGLE))
|
||||
ret = MENU_ACTION_TOGGLE;
|
||||
|
@ -468,6 +468,15 @@
|
||||
# input_player1_l3_btn =
|
||||
# input_player1_r3_btn =
|
||||
|
||||
# Menu buttons.
|
||||
# menu_ok_btn =
|
||||
# menu_cancel_btn =
|
||||
# menu_search =
|
||||
# menu_info =
|
||||
# menu_default =
|
||||
# menu_scroll_down =
|
||||
# menu_scroll_up =
|
||||
|
||||
# Axis for RetroArch D-Pad.
|
||||
# Needs to be either '+' or '-' in the first character signaling either positive or negative direction of the axis, then the axis number.
|
||||
# Do note that every other input option has the corresponding _btn and _axis binds as well; they are omitted here for clarity.
|
||||
|
Loading…
x
Reference in New Issue
Block a user