diff --git a/gfx/drivers_tracker/video_state_python.c b/gfx/drivers_tracker/video_state_python.c index bbdbff6679..afd8e62583 100644 --- a/gfx/drivers_tracker/video_state_python.c +++ b/gfx/drivers_tracker/video_state_python.c @@ -122,7 +122,8 @@ static PyObject *py_read_input(PyObject *self, PyObject *args) return NULL; if (!input_driver_is_libretro_input_blocked()) - res = input_driver_state(py_binds, user - 1, RETRO_DEVICE_JOYPAD, 0, key); + res = current_input->input_state(current_input_data, py_binds, + user - 1, RETRO_DEVICE_JOYPAD, 0, key); return PyBool_FromLong(res); } @@ -144,7 +145,8 @@ static PyObject *py_read_analog(PyObject *self, PyObject *args) if (user > MAX_USERS || user < 1 || index > 1 || id > 1) return NULL; - res = input_driver_state(py_binds, user - 1, RETRO_DEVICE_ANALOG, index, id); + res = current_input->input_state(current_input_data, py_binds, + user - 1, RETRO_DEVICE_ANALOG, index, id) return PyFloat_FromDouble((double)res / 0x7fff); } diff --git a/input/input_driver.c b/input/input_driver.c index 416c62a4a8..338ed16711 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -104,8 +104,8 @@ static command_t *input_driver_command = NULL; #ifdef HAVE_NETWORKGAMEPAD static input_remote_t *input_driver_remote = NULL; #endif -static const input_driver_t *current_input = NULL; -static void *current_input_data = NULL; +const input_driver_t *current_input = NULL; +void *current_input_data = NULL; static bool input_driver_block_hotkey = false; static bool input_driver_block_libretro_input = false; static bool input_driver_osk_enabled = false; @@ -183,13 +183,6 @@ bool input_driver_set_rumble_state(unsigned port, port, effect, strength); } -int16_t input_driver_state(const struct retro_keybind **retro_keybinds, - unsigned port, unsigned device, unsigned index, unsigned id) -{ - return current_input->input_state(current_input_data, retro_keybinds, - port, device, index, id); -} - const input_device_driver_t *input_driver_get_joypad_driver(void) { if (!current_input || !current_input->get_joypad_driver) @@ -590,10 +583,10 @@ void state_tracker_update_input(uint16_t *input1, uint16_t *input2) { for (i = 4; i < 16; i++) { - *input1 |= (input_driver_state( - binds, 0, RETRO_DEVICE_JOYPAD, 0, buttons[i - 4]) ? 1 : 0) << i; - *input2 |= (input_driver_state( - binds, 1, RETRO_DEVICE_JOYPAD, 0, buttons[i - 4]) ? 1 : 0) << i; + *input1 |= (current_input->input_state(current_input_data, binds, + 0, RETRO_DEVICE_JOYPAD, 0, buttons[i - 4]) ? 1 : 0) << i; + *input2 |= (current_input->input_state(current_input_data, binds, + 1, RETRO_DEVICE_JOYPAD, 0, buttons[i - 4]) ? 1 : 0) << i; } } diff --git a/input/input_driver.h b/input/input_driver.h index e3e121a950..1601391472 100644 --- a/input/input_driver.h +++ b/input/input_driver.h @@ -93,6 +93,9 @@ typedef struct input_driver void (*keyboard_mapping_set_block)(void *data, bool value); } input_driver_t; +extern const input_driver_t *current_input; +extern void *current_input_data; + /** * input_driver_find_handle: * @index : index of driver to get handle to. @@ -132,9 +135,6 @@ const char* config_get_input_driver_options(void); bool input_driver_set_rumble_state(unsigned port, enum retro_rumble_effect effect, uint16_t strength); -int16_t input_driver_state(const struct retro_keybind **retro_keybinds, - unsigned port, unsigned device, unsigned index, unsigned id); - uint64_t input_driver_get_capabilities(void); const input_device_driver_t * input_driver_get_joypad_driver(void); diff --git a/input/input_overlay.c b/input/input_overlay.c index 3542c64382..e3f2166a72 100644 --- a/input/input_overlay.c +++ b/input/input_overlay.c @@ -639,15 +639,15 @@ void input_poll_overlay(input_overlay_t *ol, float opacity) RARCH_DEVICE_POINTER_SCREEN : RETRO_DEVICE_POINTER; for (i = 0; - input_driver_state(NULL, 0, device, i, - RETRO_DEVICE_ID_POINTER_PRESSED); + current_input->input_state(current_input_data, NULL, + 0, device, i, RETRO_DEVICE_ID_POINTER_PRESSED); i++) { input_overlay_state_t polled_data; - int16_t x = input_driver_state(NULL, 0, - device, i, RETRO_DEVICE_ID_POINTER_X); - int16_t y = input_driver_state(NULL, 0, - device, i, RETRO_DEVICE_ID_POINTER_Y); + int16_t x = current_input->input_state(current_input_data, NULL, + 0, device, i, RETRO_DEVICE_ID_POINTER_X); + int16_t y = current_input->input_state(current_input_data, NULL, + 0, device, i, RETRO_DEVICE_ID_POINTER_Y); input_overlay_poll(ol, &polled_data, x, y); diff --git a/menu/menu_event.c b/menu/menu_event.c index 5adfd8b48e..a47e5c6fb2 100644 --- a/menu/menu_event.c +++ b/menu/menu_event.c @@ -46,20 +46,18 @@ static int menu_event_pointer(unsigned *action) menu_driver_ctl(RARCH_MENU_CTL_IS_SET_TEXTURE, NULL) ? RETRO_DEVICE_POINTER : RARCH_DEVICE_POINTER_SCREEN; int pointer_x = - input_driver_state(binds, 0, pointer_device, - 0, RETRO_DEVICE_ID_POINTER_X); + current_input->input_state(current_input_data, binds, + 0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_X); int pointer_y = - input_driver_state(binds, 0, pointer_device, - 0, RETRO_DEVICE_ID_POINTER_Y); + current_input->input_state(current_input_data, binds, + 0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_Y); - menu_input->pointer.pressed[0] = input_driver_state(binds, - 0, pointer_device, - 0, RETRO_DEVICE_ID_POINTER_PRESSED); - menu_input->pointer.pressed[1] = input_driver_state(binds, - 0, pointer_device, - 1, RETRO_DEVICE_ID_POINTER_PRESSED); - menu_input->pointer.back = input_driver_state(binds, 0, pointer_device, - 0, RARCH_DEVICE_ID_POINTER_BACK); + menu_input->pointer.pressed[0] = current_input->input_state(current_input_data, binds, + 0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_PRESSED); + menu_input->pointer.pressed[1] = current_input->input_state(current_input_data, binds, + 0, pointer_device, 1, RETRO_DEVICE_ID_POINTER_PRESSED); + menu_input->pointer.back = current_input->input_state(current_input_data, binds, + 0, pointer_device, 0, RARCH_DEVICE_ID_POINTER_BACK); menu_input->pointer.x = ((pointer_x + 0x7fff) * (int)fb_width) / 0xFFFF; menu_input->pointer.y = ((pointer_y + 0x7fff) * (int)fb_height) / 0xFFFF; diff --git a/menu/menu_input.c b/menu/menu_input.c index 25660b67b9..42427d44cb 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -331,7 +331,8 @@ int16_t menu_input_mouse_state(enum menu_input_mouse_state state) return 0; } - return input_driver_state(NULL, 0, device, 0, type); + return current_input->input_state(current_input_data, NULL, + 0, device, 0, type); } static int menu_input_pointer_post_iterate( diff --git a/menu/widgets/menu_input_bind_dialog.c b/menu/widgets/menu_input_bind_dialog.c index cc534f87db..46b2e2643c 100644 --- a/menu/widgets/menu_input_bind_dialog.c +++ b/menu/widgets/menu_input_bind_dialog.c @@ -216,8 +216,8 @@ static void menu_input_key_bind_poll_bind_state( return; memset(state->state, 0, sizeof(state->state)); - state->skip = timed_out || input_driver_state(NULL, 0, - RETRO_DEVICE_KEYBOARD, 0, RETROK_RETURN); + state->skip = timed_out || current_input->input_state(current_input_data, NULL, + 0, RETRO_DEVICE_KEYBOARD, 0, RETROK_RETURN); menu_input_key_bind_poll_bind_state_internal( joypad, state, port, timed_out);