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;
|
return NULL;
|
||||||
|
|
||||||
if (!input_driver_is_libretro_input_blocked())
|
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);
|
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)
|
if (user > MAX_USERS || user < 1 || index > 1 || id > 1)
|
||||||
return NULL;
|
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);
|
return PyFloat_FromDouble((double)res / 0x7fff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,8 +104,8 @@ static command_t *input_driver_command = NULL;
|
||||||
#ifdef HAVE_NETWORKGAMEPAD
|
#ifdef HAVE_NETWORKGAMEPAD
|
||||||
static input_remote_t *input_driver_remote = NULL;
|
static input_remote_t *input_driver_remote = NULL;
|
||||||
#endif
|
#endif
|
||||||
static const input_driver_t *current_input = NULL;
|
const input_driver_t *current_input = NULL;
|
||||||
static void *current_input_data = NULL;
|
void *current_input_data = NULL;
|
||||||
static bool input_driver_block_hotkey = false;
|
static bool input_driver_block_hotkey = false;
|
||||||
static bool input_driver_block_libretro_input = false;
|
static bool input_driver_block_libretro_input = false;
|
||||||
static bool input_driver_osk_enabled = false;
|
static bool input_driver_osk_enabled = false;
|
||||||
|
@ -183,13 +183,6 @@ bool input_driver_set_rumble_state(unsigned port,
|
||||||
port, effect, strength);
|
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)
|
const input_device_driver_t *input_driver_get_joypad_driver(void)
|
||||||
{
|
{
|
||||||
if (!current_input || !current_input->get_joypad_driver)
|
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++)
|
for (i = 4; i < 16; i++)
|
||||||
{
|
{
|
||||||
*input1 |= (input_driver_state(
|
*input1 |= (current_input->input_state(current_input_data, binds,
|
||||||
binds, 0, RETRO_DEVICE_JOYPAD, 0, buttons[i - 4]) ? 1 : 0) << i;
|
0, RETRO_DEVICE_JOYPAD, 0, buttons[i - 4]) ? 1 : 0) << i;
|
||||||
*input2 |= (input_driver_state(
|
*input2 |= (current_input->input_state(current_input_data, binds,
|
||||||
binds, 1, RETRO_DEVICE_JOYPAD, 0, buttons[i - 4]) ? 1 : 0) << i;
|
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);
|
void (*keyboard_mapping_set_block)(void *data, bool value);
|
||||||
} input_driver_t;
|
} input_driver_t;
|
||||||
|
|
||||||
|
extern const input_driver_t *current_input;
|
||||||
|
extern void *current_input_data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* input_driver_find_handle:
|
* input_driver_find_handle:
|
||||||
* @index : index of driver to get handle to.
|
* @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,
|
bool input_driver_set_rumble_state(unsigned port,
|
||||||
enum retro_rumble_effect effect, uint16_t strength);
|
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);
|
uint64_t input_driver_get_capabilities(void);
|
||||||
|
|
||||||
const input_device_driver_t * input_driver_get_joypad_driver(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;
|
RARCH_DEVICE_POINTER_SCREEN : RETRO_DEVICE_POINTER;
|
||||||
|
|
||||||
for (i = 0;
|
for (i = 0;
|
||||||
input_driver_state(NULL, 0, device, i,
|
current_input->input_state(current_input_data, NULL,
|
||||||
RETRO_DEVICE_ID_POINTER_PRESSED);
|
0, device, i, RETRO_DEVICE_ID_POINTER_PRESSED);
|
||||||
i++)
|
i++)
|
||||||
{
|
{
|
||||||
input_overlay_state_t polled_data;
|
input_overlay_state_t polled_data;
|
||||||
int16_t x = input_driver_state(NULL, 0,
|
int16_t x = current_input->input_state(current_input_data, NULL,
|
||||||
device, i, RETRO_DEVICE_ID_POINTER_X);
|
0, device, i, RETRO_DEVICE_ID_POINTER_X);
|
||||||
int16_t y = input_driver_state(NULL, 0,
|
int16_t y = current_input->input_state(current_input_data, NULL,
|
||||||
device, i, RETRO_DEVICE_ID_POINTER_Y);
|
0, device, i, RETRO_DEVICE_ID_POINTER_Y);
|
||||||
|
|
||||||
input_overlay_poll(ol, &polled_data, x, 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) ?
|
menu_driver_ctl(RARCH_MENU_CTL_IS_SET_TEXTURE, NULL) ?
|
||||||
RETRO_DEVICE_POINTER : RARCH_DEVICE_POINTER_SCREEN;
|
RETRO_DEVICE_POINTER : RARCH_DEVICE_POINTER_SCREEN;
|
||||||
int pointer_x =
|
int pointer_x =
|
||||||
input_driver_state(binds, 0, pointer_device,
|
current_input->input_state(current_input_data, binds,
|
||||||
0, RETRO_DEVICE_ID_POINTER_X);
|
0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_X);
|
||||||
int pointer_y =
|
int pointer_y =
|
||||||
input_driver_state(binds, 0, pointer_device,
|
current_input->input_state(current_input_data, binds,
|
||||||
0, RETRO_DEVICE_ID_POINTER_Y);
|
0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_Y);
|
||||||
|
|
||||||
menu_input->pointer.pressed[0] = input_driver_state(binds,
|
menu_input->pointer.pressed[0] = current_input->input_state(current_input_data, binds,
|
||||||
0, pointer_device,
|
0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_PRESSED);
|
||||||
0, RETRO_DEVICE_ID_POINTER_PRESSED);
|
menu_input->pointer.pressed[1] = current_input->input_state(current_input_data, binds,
|
||||||
menu_input->pointer.pressed[1] = input_driver_state(binds,
|
0, pointer_device, 1, RETRO_DEVICE_ID_POINTER_PRESSED);
|
||||||
0, pointer_device,
|
menu_input->pointer.back = current_input->input_state(current_input_data, binds,
|
||||||
1, RETRO_DEVICE_ID_POINTER_PRESSED);
|
0, pointer_device, 0, RARCH_DEVICE_ID_POINTER_BACK);
|
||||||
menu_input->pointer.back = input_driver_state(binds, 0, pointer_device,
|
|
||||||
0, RARCH_DEVICE_ID_POINTER_BACK);
|
|
||||||
|
|
||||||
menu_input->pointer.x = ((pointer_x + 0x7fff) * (int)fb_width) / 0xFFFF;
|
menu_input->pointer.x = ((pointer_x + 0x7fff) * (int)fb_width) / 0xFFFF;
|
||||||
menu_input->pointer.y = ((pointer_y + 0x7fff) * (int)fb_height) / 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 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(
|
static int menu_input_pointer_post_iterate(
|
||||||
|
|
|
@ -216,8 +216,8 @@ static void menu_input_key_bind_poll_bind_state(
|
||||||
return;
|
return;
|
||||||
|
|
||||||
memset(state->state, 0, sizeof(state->state));
|
memset(state->state, 0, sizeof(state->state));
|
||||||
state->skip = timed_out || input_driver_state(NULL, 0,
|
state->skip = timed_out || current_input->input_state(current_input_data, NULL,
|
||||||
RETRO_DEVICE_KEYBOARD, 0, RETROK_RETURN);
|
0, RETRO_DEVICE_KEYBOARD, 0, RETROK_RETURN);
|
||||||
|
|
||||||
menu_input_key_bind_poll_bind_state_internal(
|
menu_input_key_bind_poll_bind_state_internal(
|
||||||
joypad, state, port, timed_out);
|
joypad, state, port, timed_out);
|
||||||
|
|
Loading…
Reference in New Issue