diff --git a/config.def.h b/config.def.h index c04d125fba..60d7b94f25 100644 --- a/config.def.h +++ b/config.def.h @@ -565,6 +565,7 @@ static bool show_advanced_settings = true; static const uint32_t menu_entry_normal_color = 0xffffffff; static const uint32_t menu_entry_hover_color = 0xff64ff64; static const uint32_t menu_title_color = 0xff64ff64; + #else static bool default_block_config_read = false; #endif @@ -597,6 +598,8 @@ static unsigned menu_toggle_gamepad_combo = INPUT_TOGGLE_NONE; static bool back_as_menu_toggle_enable = true; #endif +static bool all_users_control_menu = false; + /* Crop overscanned frames. */ static const bool crop_overscan = true; diff --git a/configuration.c b/configuration.c index 05c8945c15..da13e689fd 100644 --- a/configuration.c +++ b/configuration.c @@ -680,6 +680,7 @@ static int populate_settings_bool(settings_t *settings, struct config_bool_setti SETTING_BOOL("video_gpu_record", &settings->video.gpu_record, true, gpu_record, false); SETTING_BOOL("input_remap_binds_enable", &settings->input.remap_binds_enable, true, true, false); SETTING_BOOL("back_as_menu_toggle_enable", &settings->input.back_as_menu_toggle_enable, true, true, false); + SETTING_BOOL("all_users_control_menu", &settings->input.all_users_control_menu, true, all_users_control_menu, false); SETTING_BOOL("netplay_client_swap_input", &settings->input.netplay_client_swap_input, true, netplay_client_swap_input, false); SETTING_BOOL("input_descriptor_label_show", &settings->input.input_descriptor_label_show, true, input_descriptor_label_show, false); SETTING_BOOL("input_descriptor_hide_unbound", &settings->input.input_descriptor_hide_unbound, true, input_descriptor_hide_unbound, false); diff --git a/configuration.h b/configuration.h index ede199aa06..cdb2c4f979 100644 --- a/configuration.h +++ b/configuration.h @@ -288,6 +288,7 @@ typedef struct settings unsigned menu_toggle_gamepad_combo; bool back_as_menu_toggle_enable; + bool all_users_control_menu; #if TARGET_OS_IPHONE bool small_keyboard_enable; diff --git a/input/drivers/android_input.c b/input/drivers/android_input.c index 49b7d23b2a..29333e7bad 100644 --- a/input/drivers/android_input.c +++ b/input/drivers/android_input.c @@ -1153,13 +1153,22 @@ static bool android_input_key_pressed(void *data, int key) { android_input_t *android = (android_input_t*)data; settings_t *settings = config_get_ptr(); + int port = 0; if(android_keyboard_port_input_pressed(settings->input.binds[0],key)) return true; - if (input_joypad_pressed(android->joypad, - 0, settings->input.binds[0], key)) - return true; + if (settings->input.all_users_control_menu) + { + for (port = 0; port < MAX_USERS; port++) + if (input_joypad_pressed(android->joypad, + port, settings->input.binds[0], key)) + return true; + } + else + if (input_joypad_pressed(android->joypad, + 0, settings->input.binds[0], key)) + return true; return false; } diff --git a/input/drivers/cocoa_input.c b/input/drivers/cocoa_input.c index 24b495a134..b86d170bd9 100644 --- a/input/drivers/cocoa_input.c +++ b/input/drivers/cocoa_input.c @@ -302,14 +302,33 @@ static bool cocoa_input_key_pressed(void *data, int key) { cocoa_input_data_t *apple = (cocoa_input_data_t*)data; settings_t *settings = config_get_ptr(); + int port = 0; if (apple_input_is_pressed(0, settings->input.binds[0], key)) return true; - if (input_joypad_pressed(apple->joypad, 0, settings->input.binds[0], key)) - return true; + + if (settings->input.all_users_control_menu) + { + for (port = 0; port < MAX_USERS; port++) + { + if (input_joypad_pressed(apple->joypad, + port, settings->input.binds[0], key)) + return true; + #ifdef HAVE_MFI - if (input_joypad_pressed(apple->sec_joypad, 0, settings->input.binds[0], key)) - return true; + if (input_joypad_pressed(apple->sec_joypad, port, settings->input.binds[0], key)) + return true; +#endif + } + } + else + if (input_joypad_pressed(apple->joypad, + 0, settings->input.binds[0], key)) + return true; + +#ifdef HAVE_MFI + if (input_joypad_pressed(apple->sec_joypad, 0, settings->input.binds[0], key)) + return true; #endif return false; diff --git a/input/drivers/ctr_input.c b/input/drivers/ctr_input.c index cc37474e85..3885fb0351 100644 --- a/input/drivers/ctr_input.c +++ b/input/drivers/ctr_input.c @@ -88,9 +88,19 @@ static bool ctr_input_key_pressed(void *data, int key) { settings_t *settings = config_get_ptr(); ctr_input_t *ctr = (ctr_input_t*)data; + int port = 0; - if (input_joypad_pressed(ctr->joypad, 0, settings->input.binds[0], key)) - return true; + if (settings->input.all_users_control_menu) + { + for (port = 0; port < MAX_USERS; port++) + if (input_joypad_pressed(ctr->joypad, + port, settings->input.binds[0], key)) + return true; + } + else + if (input_joypad_pressed(ctr->joypad, + 0, settings->input.binds[0], key)) + return true; return false; } diff --git a/input/drivers/dinput.c b/input/drivers/dinput.c index 2ea6bdeb27..5f8ee7ed42 100644 --- a/input/drivers/dinput.c +++ b/input/drivers/dinput.c @@ -310,7 +310,21 @@ static int16_t dinput_pressed_analog(struct dinput_input *di, static bool dinput_key_pressed(void *data, int key) { settings_t *settings = config_get_ptr(); - return dinput_is_pressed((struct dinput_input*)data, settings->input.binds[0], 0, key); + int port = 0; + + if (settings->input.all_users_control_menu) + { + for (port = 0; port < MAX_USERS; port++) + if (dinput_is_pressed((struct dinput_input*)data, + settings->input.binds[0], port, key)) + return true; + } + else + if (dinput_is_pressed((struct dinput_input*)data, + settings->input.binds[0], 0, key)) + return true; + + return false; } static bool dinput_meta_key_pressed(void *data, int key) diff --git a/input/drivers/gx_input.c b/input/drivers/gx_input.c index 1c36ec9c9d..84e0e69f2d 100644 --- a/input/drivers/gx_input.c +++ b/input/drivers/gx_input.c @@ -95,9 +95,19 @@ static bool gx_input_key_pressed(void *data, int key) { settings_t *settings = config_get_ptr(); gx_input_t *gx = (gx_input_t*)data; + int port = 0; - if (input_joypad_pressed(gx->joypad, 0, settings->input.binds[0], key)) - return true; + if (settings->input.all_users_control_menu) + { + for (port = 0; port < MAX_USERS; port++) + if (input_joypad_pressed(gx->joypad, + port, settings->input.binds[0], key)) + return true; + } + else + if (input_joypad_pressed(gx->joypad, + 0, settings->input.binds[0], key)) + return true; return false; } diff --git a/input/drivers/linuxraw_input.c b/input/drivers/linuxraw_input.c index 172d789745..076cd52e41 100644 --- a/input/drivers/linuxraw_input.c +++ b/input/drivers/linuxraw_input.c @@ -111,12 +111,22 @@ static bool linuxraw_input_key_pressed(void *data, int key) { linuxraw_input_t *linuxraw = (linuxraw_input_t*)data; settings_t *settings = config_get_ptr(); + int port = 0; if (linuxraw_is_pressed(linuxraw, settings->input.binds[0], key)) return true; - if (input_joypad_pressed(linuxraw->joypad, 0, settings->input.binds[0], key)) - return true; + if (settings->input.all_users_control_menu) + { + for (port = 0; port < MAX_USERS; port++) + if (input_joypad_pressed(linuxraw->joypad, + port, settings->input.binds[0], key)) + return true; + } + else + if (input_joypad_pressed(linuxraw->joypad, + 0, settings->input.binds[0], key)) + return true; return false; } diff --git a/input/drivers/ps3_input.c b/input/drivers/ps3_input.c index 2cfba27289..ac8494ebf7 100644 --- a/input/drivers/ps3_input.c +++ b/input/drivers/ps3_input.c @@ -178,9 +178,19 @@ static bool ps3_input_key_pressed(void *data, int key) { ps3_input_t *ps3 = (ps3_input_t*)data; settings_t *settings = config_get_ptr(); + int port = 0; - if (input_joypad_pressed(ps3->joypad, 0, settings->input.binds[0], key)) - return true; + if (settings->input.all_users_control_menu) + { + for (port = 0; port < MAX_USERS; port++) + if (input_joypad_pressed(ps3->joypad, + port, settings->input.binds[0], key)) + return true; + } + else + if (input_joypad_pressed(ps3->joypad, + 0, settings->input.binds[0], key)) + return true; return false; } diff --git a/input/drivers/psp_input.c b/input/drivers/psp_input.c index 05bfc8b023..702ffc6044 100644 --- a/input/drivers/psp_input.c +++ b/input/drivers/psp_input.c @@ -104,9 +104,19 @@ static bool psp_input_key_pressed(void *data, int key) { settings_t *settings = config_get_ptr(); psp_input_t *psp = (psp_input_t*)data; + int port = 0; - if (input_joypad_pressed(psp->joypad, 0, settings->input.binds[0], key)) - return true; + if (settings->input.all_users_control_menu) + { + for (port = 0; port < MAX_USERS; port++) + if (input_joypad_pressed(psp->joypad, + port, settings->input.binds[0], key)) + return true; + } + else + if (input_joypad_pressed(psp->joypad, + 0, settings->input.binds[0], key)) + return true; return false; } diff --git a/input/drivers/qnx_input.c b/input/drivers/qnx_input.c index f670fc8a99..8a175bbb3e 100644 --- a/input/drivers/qnx_input.c +++ b/input/drivers/qnx_input.c @@ -792,9 +792,19 @@ static bool qnx_input_key_pressed(void *data, int key) { qnx_input_t *qnx = (qnx_input_t*)data; settings_t *settings = config_get_ptr(); + int port = 0; - if (input_joypad_pressed(qnx->joypad, 0, settings->input.binds[0], key)) - return true; + if (settings->input.all_users_control_menu) + { + for (port = 0; port < MAX_USERS; port++) + if (input_joypad_pressed(qnx->joypad, + port, settings->input.binds[0], key)) + return true; + } + else + if (input_joypad_pressed(qnx->joypad, + 0, settings->input.binds[0], key)) + return true; return false; } diff --git a/input/drivers/sdl_input.c b/input/drivers/sdl_input.c index 219d6e2c13..eea0ced5bd 100644 --- a/input/drivers/sdl_input.c +++ b/input/drivers/sdl_input.c @@ -112,12 +112,23 @@ static bool sdl_input_key_pressed(void *data, int key) { sdl_input_t *sdl = (sdl_input_t*)data; settings_t *settings = config_get_ptr(); + int port = 0; const struct retro_keybind *binds = settings->input.binds[0]; if (sdl_is_pressed(sdl, 0, binds, key)) return true; - if (input_joypad_pressed(sdl->joypad, 0, binds, key)) - return true; + + if (settings->input.all_users_control_menu) + { + for (port = 0; port < MAX_USERS; port++) + if (input_joypad_pressed(sdl->joypad, + port, settings->input.binds[0], key)) + return true; + } + else + if (input_joypad_pressed(sdl->joypad, + 0, settings->input.binds[0], key)) + return true; } return false; diff --git a/input/drivers/udev_input.c b/input/drivers/udev_input.c index 178b0c35c0..5af48ac88e 100644 --- a/input/drivers/udev_input.c +++ b/input/drivers/udev_input.c @@ -547,11 +547,22 @@ static bool udev_input_key_pressed(void *data, int key) { udev_input_t *udev = (udev_input_t*)data; settings_t *settings = config_get_ptr(); + int port = 0; if (udev_input_is_pressed(settings->input.binds[0], key)) return true; - if (input_joypad_pressed(udev->joypad, 0, settings->input.binds[0], key)) - return true; + + if (settings->input.all_users_control_menu) + { + for (port = 0; port < MAX_USERS; port++) + if (input_joypad_pressed(udev->joypad, + port, settings->input.binds[0], key)) + return true; + } + else + if (input_joypad_pressed(udev->joypad, + 0, settings->input.binds[0], key)) + return true; return false; } diff --git a/input/drivers/x11_input.c b/input/drivers/x11_input.c index 4951304ced..ffde2e4b7e 100644 --- a/input/drivers/x11_input.c +++ b/input/drivers/x11_input.c @@ -123,11 +123,22 @@ static bool x_input_key_pressed(void *data, int key) { x11_input_t *x11 = (x11_input_t*)data; settings_t *settings = config_get_ptr(); + int port = 0; if (x_is_pressed(x11, settings->input.binds[0], key)) return true; - if (input_joypad_pressed(x11->joypad, 0, settings->input.binds[0], key)) - return true; + + if (settings->input.all_users_control_menu) + { + for (port = 0; port < MAX_USERS; port++) + if (input_joypad_pressed(x11->joypad, + port, settings->input.binds[0], key)) + return true; + } + else + if (input_joypad_pressed(x11->joypad, + 0, settings->input.binds[0], key)) + return true; return false; } diff --git a/input/drivers/xdk_xinput_input.c b/input/drivers/xdk_xinput_input.c index aa7f7d1ae4..f50a9d18a3 100644 --- a/input/drivers/xdk_xinput_input.c +++ b/input/drivers/xdk_xinput_input.c @@ -92,9 +92,19 @@ static bool xdk_input_key_pressed(void *data, int key) { xdk_input_t *xdk = (xdk_input_t*)data; settings_t *settings = config_get_ptr(); + int port = 0; - if (input_joypad_pressed(xdk->joypad, 0, settings->input.binds[0], key)) - return true; + if (settings->input.all_users_control_menu) + { + for (port = 0; port < MAX_USERS; port++) + if (input_joypad_pressed(xdk->joypad, + port, settings->input.binds[0], key)) + return true; + } + else + if (input_joypad_pressed(xdk->joypad, + 0, settings->input.binds[0], key)) + return true; return false; } diff --git a/intl/msg_hash_us.c b/intl/msg_hash_us.c index cc3c847dca..27be847065 100644 --- a/intl/msg_hash_us.c +++ b/intl/msg_hash_us.c @@ -1674,6 +1674,9 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len) "2 - Press L3 + R3 simultaneously. \n" "3 - Press Start + Select simultaneously."); break; + case MENU_ENUM_LABEL_INPUT_ALL_USERS_CONTROL_MENU: + snprintf(s, len, "Allow any RetroPad to control the menu."); + break; case MENU_ENUM_LABEL_INPUT_AUTODETECT_ENABLE: snprintf(s, len, "Enable input auto-detection.\n" @@ -2257,6 +2260,8 @@ static const char *menu_hash_to_str_us_label_enum(enum msg_hash_enums msg) return "back_as_menu_toggle_enable"; case MENU_ENUM_LABEL_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO: return "input_menu_toggle_gamepad_combo"; + case MENU_ENUM_LABEL_INPUT_ALL_USERS_CONTROL_MENU: + return "all_users_control_menu"; case MENU_ENUM_LABEL_INPUT_OVERLAY_HIDE_IN_MENU: return "overlay_hide_in_menu"; case MENU_ENUM_LABEL_NO_PLAYLIST_ENTRIES_AVAILABLE: @@ -3522,6 +3527,8 @@ const char *msg_hash_to_str_us(enum msg_hash_enums msg) return "Back As Menu Toggle Enable"; case MENU_ENUM_LABEL_VALUE_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO: return "Menu Toggle Gamepad Combo"; + case MENU_ENUM_LABEL_VALUE_INPUT_ALL_USERS_CONTROL_MENU: + return "All Users Control Menu"; case MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU: return "Hide Overlay In Menu"; case MENU_ENUM_LABEL_VALUE_LANG_POLISH: diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 2dad0e7e82..021cf2fa21 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -5013,6 +5013,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) #endif ret = menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO, PARSE_ONLY_UINT, false); + ret = menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_INPUT_ALL_USERS_CONTROL_MENU, PARSE_ONLY_BOOL, false); ret = menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_INPUT_REMAP_BINDS_ENABLE, PARSE_ONLY_BOOL, false); ret = menu_displaylist_parse_settings_enum(menu, info, diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 7cf9ed40e2..122f01822a 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -4218,6 +4218,23 @@ static bool setting_append_list( menu_settings_list_current_add_range(list, list_info, 0, 3, 1, true, true); menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO); + CONFIG_BOOL( + list, list_info, + &settings->input.all_users_control_menu, + msg_hash_to_str(MENU_ENUM_LABEL_INPUT_ALL_USERS_CONTROL_MENU), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_ALL_USERS_CONTROL_MENU), + all_users_control_menu, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON), + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE + ); + menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_INPUT_ALL_USERS_CONTROL_MENU); + CONFIG_BOOL( list, list_info, &settings->input.remap_binds_enable, diff --git a/msg_hash.h b/msg_hash.h index 89baea038c..2a480e035e 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -403,6 +403,7 @@ enum msg_hash_enums MENU_ENUM_LABEL_INPUT_OVERLAY_HIDE_IN_MENU, MENU_ENUM_LABEL_INPUT_BACK_AS_MENU_ENUM_TOGGLE_ENABLE, MENU_ENUM_LABEL_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO, + MENU_ENUM_LABEL_INPUT_ALL_USERS_CONTROL_MENU, MENU_ENUM_LABEL_INPUT_HOTKEY_BINDS, MENU_ENUM_LABEL_INPUT_OSK_OVERLAY_ENABLE, MENU_ENUM_LABEL_INPUT_OVERLAY_ENABLE, @@ -464,6 +465,7 @@ enum msg_hash_enums MENU_ENUM_LABEL_VALUE_INPUT_HOTKEY_BINDS, MENU_ENUM_LABEL_VALUE_INPUT_BACK_AS_MENU_ENUM_TOGGLE_ENABLE, MENU_ENUM_LABEL_VALUE_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO, + MENU_ENUM_LABEL_VALUE_INPUT_ALL_USERS_CONTROL_MENU, MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU, MENU_ENUM_LABEL_VALUE_INPUT_KEYBOARD_GAMEPAD_MAPPING_TYPE, MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR, diff --git a/retroarch.cfg b/retroarch.cfg index 6098dcc78a..8b57dc2b9c 100644 --- a/retroarch.cfg +++ b/retroarch.cfg @@ -640,6 +640,9 @@ # 0 = none, 1 = L + R + Y + D-Pad Down, 2 = L3 + R3, 3 = Start + Select # input_menu_toggle_gamepad_combo = 0 +# allow any RetroPad to control the menu +# all_users_control_menu = false + # Toggles mouse grab. When mouse is grabbed, RetroArch hides the mouse, # and keeps the mouse pointer inside the window to allow relative mouse input # to work better.