diff --git a/blackberry-qnx/cascades/src/ButtonMap.cpp b/blackberry-qnx/cascades/src/ButtonMap.cpp index dcb80035b1..d552c1af32 100644 --- a/blackberry-qnx/cascades/src/ButtonMap.cpp +++ b/blackberry-qnx/cascades/src/ButtonMap.cpp @@ -144,10 +144,9 @@ int ButtonMap::getButtonMapping(int player, int button) void ButtonMap::mapDevice(int index, int player) { - if (input_qnx.set_keybinds) - input_qnx.set_keybinds((void*)&devices[index], devices[index].device, player, 0, - (1ULL << KEYBINDS_ACTION_SET_DEFAULT_BINDS)); - + // stub - set keybinds + // stub_set_keybinds_call_here() + refreshButtonMap(player); } diff --git a/driver.h b/driver.h index 92bc5e15aa..e8dd1654ba 100644 --- a/driver.h +++ b/driver.h @@ -265,7 +265,6 @@ typedef struct input_driver unsigned port, unsigned device, unsigned index, unsigned id); bool (*key_pressed)(void *data, int key); void (*free)(void *data); - void (*set_keybinds)(void *data, unsigned device, unsigned port, unsigned id, unsigned keybind_action); bool (*set_sensor_state)(void *data, unsigned port, enum retro_sensor_action action, unsigned rate); float (*get_sensor_input)(void *data, unsigned port, unsigned id); uint64_t (*get_capabilities)(void *data); diff --git a/frontend/menu/backend/menu_common_backend.c b/frontend/menu/backend/menu_common_backend.c index 2321873d9a..e5e6a293e9 100644 --- a/frontend/menu/backend/menu_common_backend.c +++ b/frontend/menu/backend/menu_common_backend.c @@ -62,7 +62,7 @@ static inline struct gfx_shader *shader_manager_get_current_shader(menu_handle_t static void menu_common_entries_init(menu_handle_t *menu, unsigned menu_type) { - unsigned i, last; + unsigned i; char tmp[256]; switch (menu_type) @@ -387,8 +387,7 @@ static void menu_common_entries_init(menu_handle_t *menu, unsigned menu_type) #ifdef HAVE_OSK file_list_push(menu->selection_buf, "", "osk_enable", MENU_SETTINGS_ONSCREEN_KEYBOARD_ENABLE, 0); #endif - last = (driver.input && driver.input->set_keybinds && !driver.input->get_joypad_driver) ? (MENU_SETTINGS_BIND_BEGIN + RETRO_DEVICE_ID_JOYPAD_R3) : MENU_SETTINGS_BIND_ALL_LAST; - for (i = MENU_SETTINGS_BIND_BEGIN; i <= last; i++) + for (i = MENU_SETTINGS_BIND_BEGIN; i <= MENU_SETTINGS_BIND_ALL_LAST; i++) file_list_push(menu->selection_buf, input_config_bind_map[i - MENU_SETTINGS_BIND_BEGIN].desc, "", i, 0); break; case MENU_SETTINGS_AUDIO_OPTIONS: @@ -1267,20 +1266,10 @@ static int menu_start_screen_iterate(unsigned action) for (i = 0; i < ARRAY_SIZE(binds); i++) { - if (driver.input && driver.input->set_keybinds) - { - struct platform_bind key_label; - strlcpy(key_label.desc, "Unknown", sizeof(key_label.desc)); - key_label.joykey = g_settings.input.binds[0][binds[i]].joykey; - driver.input->set_keybinds(&key_label, 0, 0, 0, 1ULL << KEYBINDS_ACTION_GET_BIND_LABEL); - strlcpy(desc[i], key_label.desc, sizeof(desc[i])); - } - else - { - const struct retro_keybind *bind = &g_settings.input.binds[0][binds[i]]; - const struct retro_keybind *auto_bind = input_get_auto_bind(0, binds[i]); - input_get_bind_string(desc[i], bind, auto_bind, sizeof(desc[i])); - } + const struct retro_keybind *bind = (const struct retro_keybind*)&g_settings.input.binds[0][binds[i]]; + const struct retro_keybind *auto_bind = (const struct retro_keybind*)input_get_auto_bind(0, binds[i]); + + input_get_bind_string(desc[i], bind, auto_bind, sizeof(desc[i])); } snprintf(msg, sizeof(msg), @@ -3347,54 +3336,39 @@ static int menu_common_setting_set(unsigned id, unsigned action, rarch_setting_t } else if (id >= MENU_SETTINGS_BIND_BEGIN && id <= MENU_SETTINGS_BIND_ALL_LAST) { - if (driver.input->set_keybinds && !driver.input->get_joypad_driver) + struct retro_keybind *bind = (struct retro_keybind*)&g_settings.input.binds[port][id - MENU_SETTINGS_BIND_BEGIN]; + + if (action == MENU_ACTION_OK) { - unsigned keybind_action = KEYBINDS_ACTION_NONE; + driver.menu->binds.begin = id; + driver.menu->binds.last = id; + driver.menu->binds.target = bind; + driver.menu->binds.player = port; + file_list_push(driver.menu->menu_stack, "", "", + driver.menu->bind_mode_keyboard ? MENU_SETTINGS_CUSTOM_BIND_KEYBOARD : MENU_SETTINGS_CUSTOM_BIND, driver.menu->selection_ptr); - if (action == MENU_ACTION_START) - keybind_action = (1ULL << KEYBINDS_ACTION_SET_DEFAULT_BIND); - - // FIXME: The array indices here look totally wrong ... Fixed it so it looks kind of sane for now. - if (keybind_action != KEYBINDS_ACTION_NONE) - driver.input->set_keybinds(driver.input_data, g_settings.input.device[port], port, - id - MENU_SETTINGS_BIND_BEGIN, keybind_action); - } - else - { - struct retro_keybind *bind = (struct retro_keybind*)&g_settings.input.binds[port][id - MENU_SETTINGS_BIND_BEGIN]; - - if (action == MENU_ACTION_OK) + if (driver.menu->bind_mode_keyboard) { - driver.menu->binds.begin = id; - driver.menu->binds.last = id; - driver.menu->binds.target = bind; - driver.menu->binds.player = port; - file_list_push(driver.menu->menu_stack, "", "", - driver.menu->bind_mode_keyboard ? MENU_SETTINGS_CUSTOM_BIND_KEYBOARD : MENU_SETTINGS_CUSTOM_BIND, driver.menu->selection_ptr); - - if (driver.menu->bind_mode_keyboard) - { - driver.menu->binds.timeout_end = rarch_get_time_usec() + MENU_KEYBOARD_BIND_TIMEOUT_SECONDS * 1000000; - input_keyboard_wait_keys(driver.menu, menu_custom_bind_keyboard_cb); - } - else - { - menu_poll_bind_get_rested_axes(&driver.menu->binds); - menu_poll_bind_state(&driver.menu->binds); - } + driver.menu->binds.timeout_end = rarch_get_time_usec() + MENU_KEYBOARD_BIND_TIMEOUT_SECONDS * 1000000; + input_keyboard_wait_keys(driver.menu, menu_custom_bind_keyboard_cb); } - else if (action == MENU_ACTION_START) + else { - if (driver.menu->bind_mode_keyboard) - { - const struct retro_keybind *def_binds = port ? retro_keybinds_rest : retro_keybinds_1; - bind->key = def_binds[id - MENU_SETTINGS_BIND_BEGIN].key; - } - else - { - bind->joykey = NO_BTN; - bind->joyaxis = AXIS_NONE; - } + menu_poll_bind_get_rested_axes(&driver.menu->binds); + menu_poll_bind_state(&driver.menu->binds); + } + } + else if (action == MENU_ACTION_START) + { + if (driver.menu->bind_mode_keyboard) + { + const struct retro_keybind *def_binds = port ? retro_keybinds_rest : retro_keybinds_1; + bind->key = def_binds[id - MENU_SETTINGS_BIND_BEGIN].key; + } + else + { + bind->joykey = NO_BTN; + bind->joyaxis = AXIS_NONE; } } return 0; @@ -3564,35 +3538,7 @@ static int menu_common_setting_set(unsigned id, unsigned action, rarch_setting_t port = driver.menu->current_pad; break; case MENU_SETTINGS_BIND_DEVICE: - // If set_keybinds is supported, we do it more fancy, and scroll through - // a list of supported devices directly. - if (driver.input->set_keybinds && driver.input->devices_size) { - unsigned device_last = driver.input->devices_size(driver.input_data); - g_settings.input.device[port] += device_last; - if (action == MENU_ACTION_START) - g_settings.input.device[port] = 0; - else if (action == MENU_ACTION_LEFT) - g_settings.input.device[port]--; - else if (action == MENU_ACTION_RIGHT) - g_settings.input.device[port]++; - - // device_last can be 0, avoid modulo. - if (g_settings.input.device[port] >= device_last) - g_settings.input.device[port] -= device_last; - // needs to be checked twice, in case we go right past the end of the list - if (g_settings.input.device[port] >= device_last) - g_settings.input.device[port] -= device_last; - - unsigned keybind_action = (1ULL << KEYBINDS_ACTION_SET_DEFAULT_BINDS); - - driver.input->set_keybinds(driver.input_data, g_settings.input.device[port], port, 0, - keybind_action); - } - else - { - // When only straight g_settings.input.joypad_map[] style - // mapping is supported. int *p = &g_settings.input.joypad_map[port]; if (action == MENU_ACTION_START) *p = port; diff --git a/input/android_input.c b/input/android_input.c index 821f6b1c70..09e5a76955 100644 --- a/input/android_input.c +++ b/input/android_input.c @@ -805,7 +805,6 @@ const input_driver_t input_android = { android_input_state, android_input_key_pressed, android_input_free_input, - NULL, android_input_set_sensor_state, android_input_get_sensor_input, android_input_get_capabilities, diff --git a/input/apple_input.c b/input/apple_input.c index f4d0a4e10a..fd85be9870 100644 --- a/input/apple_input.c +++ b/input/apple_input.c @@ -597,108 +597,6 @@ static void apple_input_free_input(void *data) joypad->destroy(); } -#ifdef IOS -static void apple_input_set_keybinds(void *data, unsigned device, unsigned port, - unsigned id, unsigned keybind_action) -{ - (void)device; - - if (keybind_action & (1ULL << KEYBINDS_ACTION_SET_DEFAULT_BINDS)) - { - switch (device) - { - case DEVICE_NONE: - break; - case DEVICE_WIIMOTE: - strlcpy(g_settings.input.device_names[port], "Wiimote + Classic", - sizeof(g_settings.input.device_names[port])); - g_settings.input.device[port] = device; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_B].joykey = 22; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_Y].joykey = 21; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_SELECT].joykey = 28; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_START].joykey = 26; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_UP].joykey = 16; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_DOWN].joykey = 30; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_LEFT].joykey = 17; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_RIGHT].joykey = 31; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_A].joykey = 20; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_X].joykey = 19; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_L].joykey = 29; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R].joykey = 25; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_L2].joykey = 23; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R2].joykey = 18; - g_settings.input.binds[port][RARCH_MENU_TOGGLE].joykey = 27; - break; - case DEVICE_SIXAXIS: - strlcpy(g_settings.input.device_names[port], "SixAxis/DualShock3", - sizeof(g_settings.input.device_names[port])); - g_settings.input.device[port] = device; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_B].joykey = 0; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_Y].joykey = 1; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_SELECT].joykey = 2; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_START].joykey = 3; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_UP].joykey = 4; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_DOWN].joykey = 5; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_LEFT].joykey = 6; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_RIGHT].joykey = 7; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_A].joykey = 8; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_X].joykey = 9; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_L].joykey = 10; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R].joykey = 11; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_L2].joykey = 12; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R2].joykey = 13; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_L3].joykey = 14; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R3].joykey = 15; - g_settings.input.binds[port][RARCH_MENU_TOGGLE].joykey = 16; - break; - case DEVICE_MFI: - strlcpy(g_settings.input.device_names[port], "MFi Gamepad", sizeof(g_settings.input.device_names[port])); - g_settings.input.device[port] = device; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_B].joykey = RETRO_DEVICE_ID_JOYPAD_B; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_Y].joykey = RETRO_DEVICE_ID_JOYPAD_Y; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_SELECT].joykey = RETRO_DEVICE_ID_JOYPAD_SELECT; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_START].joykey = RETRO_DEVICE_ID_JOYPAD_START; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_UP].joykey = RETRO_DEVICE_ID_JOYPAD_UP; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_DOWN].joykey = RETRO_DEVICE_ID_JOYPAD_DOWN; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_LEFT].joykey = RETRO_DEVICE_ID_JOYPAD_LEFT; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_RIGHT].joykey = RETRO_DEVICE_ID_JOYPAD_RIGHT; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_A].joykey = RETRO_DEVICE_ID_JOYPAD_A; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_X].joykey = RETRO_DEVICE_ID_JOYPAD_X; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_L].joykey = RETRO_DEVICE_ID_JOYPAD_L; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R].joykey = RETRO_DEVICE_ID_JOYPAD_R; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_L2].joykey = RETRO_DEVICE_ID_JOYPAD_L2; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R2].joykey = RETRO_DEVICE_ID_JOYPAD_R2; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_L3].joykey = RETRO_DEVICE_ID_JOYPAD_L3; - g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R3].joykey = RETRO_DEVICE_ID_JOYPAD_R3; - g_settings.input.binds[port][RARCH_ANALOG_LEFT_X_PLUS].def_joyaxis = AXIS_POS(0); - g_settings.input.binds[port][RARCH_ANALOG_LEFT_X_MINUS].def_joyaxis = AXIS_NEG(0); - g_settings.input.binds[port][RARCH_ANALOG_LEFT_Y_PLUS].def_joyaxis = AXIS_NEG(1); - g_settings.input.binds[port][RARCH_ANALOG_LEFT_Y_MINUS].def_joyaxis = AXIS_POS(1); - g_settings.input.binds[port][RARCH_ANALOG_RIGHT_X_PLUS].def_joyaxis = AXIS_POS(2); - g_settings.input.binds[port][RARCH_ANALOG_RIGHT_X_MINUS].def_joyaxis = AXIS_NEG(2); - g_settings.input.binds[port][RARCH_ANALOG_RIGHT_Y_PLUS].def_joyaxis = AXIS_NEG(3); - g_settings.input.binds[port][RARCH_ANALOG_RIGHT_Y_MINUS].def_joyaxis = AXIS_POS(3); - - for (int i = 0; i < RARCH_CUSTOM_BIND_LIST_END; i++) { - g_settings.input.binds[port][i].joyaxis = g_settings.input.binds[port][i].def_joyaxis; - } - - break; - } - } - - if (keybind_action & (1ULL << KEYBINDS_ACTION_GET_BIND_LABEL)) - { - struct platform_bind *ret = (struct platform_bind*)data; - - if (ret && ret->joykey == NO_BTN) - strlcpy(ret->desc, "No button", sizeof(ret->desc)); - else - snprintf(ret->desc, sizeof(ret->desc), "Button %llu", ret->joykey); - } -} -#endif - static bool apple_input_set_rumble(void *data, unsigned port, enum retro_rumble_effect effect, uint16_t strength) { (void)data; @@ -738,11 +636,6 @@ const input_driver_t input_apple = { apple_input_state, apple_bind_button_pressed, apple_input_free_input, -#ifdef IOS - apple_input_set_keybinds, -#else - NULL, -#endif NULL, NULL, apple_input_get_capabilities, diff --git a/input/dinput.c b/input/dinput.c index cacc8bae4e..af2e8f9e2c 100644 --- a/input/dinput.c +++ b/input/dinput.c @@ -565,7 +565,6 @@ const input_driver_t input_dinput = { dinput_free, NULL, NULL, - NULL, dinput_get_capabilities, NULL, "dinput", diff --git a/input/gx_input.c b/input/gx_input.c index dcfc5700c2..b5f2ad9eb4 100644 --- a/input/gx_input.c +++ b/input/gx_input.c @@ -537,7 +537,6 @@ const input_driver_t input_gx = { gx_input_free_input, NULL, NULL, - NULL, gx_input_get_capabilities, NULL, "gx", diff --git a/input/input_common.c b/input/input_common.c index 92c096fdce..ad76b59838 100644 --- a/input/input_common.c +++ b/input/input_common.c @@ -1376,15 +1376,7 @@ const struct retro_keybind *input_get_auto_bind(unsigned port, unsigned id) static void input_get_bind_string_joykey(char *buf, const char *prefix, const struct retro_keybind *bind, size_t size) { - if (driver.input->set_keybinds) - { - struct platform_bind key_label; - strlcpy(key_label.desc, "Unknown", sizeof(key_label.desc)); - key_label.joykey = bind->joykey; - driver.input->set_keybinds(&key_label, 0, 0, 0, (1ULL << KEYBINDS_ACTION_GET_BIND_LABEL)); - snprintf(buf, size, "%s%s (btn) ", prefix, key_label.desc); - } - else if (GET_HAT_DIR(bind->joykey)) + if (GET_HAT_DIR(bind->joykey)) { const char *dir; switch (GET_HAT_DIR(bind->joykey)) diff --git a/input/linuxraw_input.c b/input/linuxraw_input.c index 0372422563..6d62f06107 100644 --- a/input/linuxraw_input.c +++ b/input/linuxraw_input.c @@ -245,7 +245,6 @@ const input_driver_t input_linuxraw = { linuxraw_input_free, NULL, NULL, - NULL, linuxraw_get_capabilities, NULL, "linuxraw", diff --git a/input/ps3_input.c b/input/ps3_input.c index 4e88a15f75..e60f9f2b2c 100644 --- a/input/ps3_input.c +++ b/input/ps3_input.c @@ -358,7 +358,6 @@ const input_driver_t input_ps3 = { ps3_input_state, ps3_input_key_pressed, ps3_input_free_input, - NULL, ps3_input_set_sensor_state, NULL, ps3_input_get_capabilities, diff --git a/input/psp_input.c b/input/psp_input.c index 9dc8f737a3..bc2a9d17b6 100644 --- a/input/psp_input.c +++ b/input/psp_input.c @@ -173,7 +173,6 @@ const input_driver_t input_psp = { psp_input_free_input, NULL, NULL, - NULL, psp_input_get_capabilities, NULL, "psp", diff --git a/input/qnx_input.c b/input/qnx_input.c index a6f8c0d35b..fca5e27330 100644 --- a/input/qnx_input.c +++ b/input/qnx_input.c @@ -833,7 +833,6 @@ const input_driver_t input_qnx = { qnx_input_free_input, NULL, NULL, - NULL, qnx_input_get_capabilities, NULL, "qnx_input", diff --git a/input/rwebinput_input.c b/input/rwebinput_input.c index 5cfaa5c781..caf8f4a292 100644 --- a/input/rwebinput_input.c +++ b/input/rwebinput_input.c @@ -188,7 +188,6 @@ const input_driver_t input_rwebinput = { rwebinput_input_free, NULL, NULL, - NULL, rwebinput_get_capabilities, NULL, "rwebinput", diff --git a/input/sdl_input.c b/input/sdl_input.c index 04c2791078..c807961151 100644 --- a/input/sdl_input.c +++ b/input/sdl_input.c @@ -335,7 +335,6 @@ const input_driver_t input_sdl = { sdl_input_free, NULL, NULL, - NULL, sdl_get_capabilities, NULL, #ifdef HAVE_SDL2 diff --git a/input/udev_input.c b/input/udev_input.c index 5f230c6a7e..d00a106039 100644 --- a/input/udev_input.c +++ b/input/udev_input.c @@ -827,7 +827,6 @@ const input_driver_t input_udev = { udev_input_free, NULL, NULL, - NULL, udev_input_get_capabilities, NULL, "udev", diff --git a/input/x11_input.c b/input/x11_input.c index de41a7476a..13bedf2abe 100644 --- a/input/x11_input.c +++ b/input/x11_input.c @@ -328,7 +328,6 @@ const input_driver_t input_x = { x_input_free, NULL, NULL, - NULL, x_input_get_capabilities, NULL, "x", diff --git a/input/xdk_xinput_input.c b/input/xdk_xinput_input.c index a1ba33274f..4c859f4f53 100644 --- a/input/xdk_xinput_input.c +++ b/input/xdk_xinput_input.c @@ -276,7 +276,6 @@ const input_driver_t input_xinput = xdk_input_free_input, NULL, NULL, - NULL, xdk_input_get_capabilities, NULL, "xinput",