mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
Get rid of slow wrapper function input_driver_state
This commit is contained in:
parent
c512ed8122
commit
8cc5b09428
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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(
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user