mirror of
https://github.com/libretro/RetroArch
synced 2025-04-01 04:20:27 +00:00
Change input_key_pressed so we no longer need to pass joypad
to the poll function callback
This commit is contained in:
parent
acd3b1a327
commit
acc0f2143f
@ -1244,18 +1244,16 @@ static void android_input_poll_user(android_input_t *android)
|
|||||||
/* Handle all events. If our activity is in pause state,
|
/* Handle all events. If our activity is in pause state,
|
||||||
* block until we're unpaused.
|
* block until we're unpaused.
|
||||||
*/
|
*/
|
||||||
static void android_input_poll(void *data, const void *joypad_data)
|
static void android_input_poll(void *data)
|
||||||
{
|
{
|
||||||
int ident;
|
int ident;
|
||||||
struct android_app *android_app = (struct android_app*)g_android;
|
struct android_app *android_app = (struct android_app*)g_android;
|
||||||
android_input_t *android = (android_input_t*)data;
|
android_input_t *android = (android_input_t*)data;
|
||||||
const input_device_driver_t
|
|
||||||
*joypad = (const input_device_driver_t*)joypad_data;
|
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
while ((ident =
|
while ((ident =
|
||||||
ALooper_pollAll((input_config_binds[0][RARCH_PAUSE_TOGGLE].valid
|
ALooper_pollAll((input_config_binds[0][RARCH_PAUSE_TOGGLE].valid
|
||||||
&& input_key_pressed(joypad, RARCH_PAUSE_TOGGLE,
|
&& input_key_pressed(RARCH_PAUSE_TOGGLE,
|
||||||
ANDROID_KEYBOARD_PORT_INPUT_PRESSED(input_config_binds[0],
|
ANDROID_KEYBOARD_PORT_INPUT_PRESSED(input_config_binds[0],
|
||||||
RARCH_PAUSE_TOGGLE)))
|
RARCH_PAUSE_TOGGLE)))
|
||||||
? -1 : settings->uints.input_block_timeout,
|
? -1 : settings->uints.input_block_timeout,
|
||||||
|
@ -333,7 +333,7 @@ static void *cocoa_input_init(const char *joypad_driver)
|
|||||||
return apple;
|
return apple;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cocoa_input_poll(void *data, const void *joypad_data)
|
static void cocoa_input_poll(void *data)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
cocoa_input_data_t *apple = (cocoa_input_data_t*)data;
|
cocoa_input_data_t *apple = (cocoa_input_data_t*)data;
|
||||||
|
@ -190,7 +190,7 @@ static void *dinput_init(const char *joypad_driver)
|
|||||||
return di;
|
return di;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dinput_poll(void *data, const void *joypad_data)
|
static void dinput_poll(void *data)
|
||||||
{
|
{
|
||||||
struct dinput_input *di = (struct dinput_input*)data;
|
struct dinput_input *di = (struct dinput_input*)data;
|
||||||
uint8_t *kb_state = NULL;
|
uint8_t *kb_state = NULL;
|
||||||
|
@ -232,7 +232,7 @@ static INLINE int rvl_count_mouse(gx_input_t *gx)
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rvl_input_poll(void *data, const void *joypad_data)
|
static void rvl_input_poll(void *data)
|
||||||
{
|
{
|
||||||
gx_input_t *gx = (gx_input_t*)data;
|
gx_input_t *gx = (gx_input_t*)data;
|
||||||
if (gx && gx->mouse)
|
if (gx && gx->mouse)
|
||||||
|
@ -190,7 +190,7 @@ static bool linuxraw_set_rumble(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void linuxraw_input_poll(void *data, const void *joypad_data)
|
static void linuxraw_input_poll(void *data)
|
||||||
{
|
{
|
||||||
uint8_t c;
|
uint8_t c;
|
||||||
linuxraw_input_t *linuxraw = (linuxraw_input_t*)data;
|
linuxraw_input_t *linuxraw = (linuxraw_input_t*)data;
|
||||||
|
@ -54,7 +54,7 @@ typedef struct ps3_input
|
|||||||
} ps3_input_t;
|
} ps3_input_t;
|
||||||
|
|
||||||
#ifdef HAVE_MOUSE
|
#ifdef HAVE_MOUSE
|
||||||
static void ps3_input_poll(void *data, const void *joypad_data)
|
static void ps3_input_poll(void *data)
|
||||||
{
|
{
|
||||||
CellMouseInfo mouse_info;
|
CellMouseInfo mouse_info;
|
||||||
ps3_input_t *ps3 = (ps3_input_t*)data;
|
ps3_input_t *ps3 = (ps3_input_t*)data;
|
||||||
|
@ -82,7 +82,7 @@ static void ps3_disconnect_keyboard(ps3_input_t *ps3, int port)
|
|||||||
ps3->connected[port] = 0;
|
ps3->connected[port] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ps3_input_poll(void *data, const void *joypad_data)
|
static void ps3_input_poll(void *data)
|
||||||
{
|
{
|
||||||
unsigned i, j;
|
unsigned i, j;
|
||||||
ps3_input_t *ps3 = (ps3_input_t*)data;
|
ps3_input_t *ps3 = (ps3_input_t*)data;
|
||||||
|
@ -88,7 +88,7 @@ typedef struct psp_input
|
|||||||
bool sensors_enabled;
|
bool sensors_enabled;
|
||||||
} psp_input_t;
|
} psp_input_t;
|
||||||
|
|
||||||
static void vita_input_poll(void *data, const void *joypad_data)
|
static void vita_input_poll(void *data)
|
||||||
{
|
{
|
||||||
psp_input_t *psp = (psp_input_t*)data;
|
psp_input_t *psp = (psp_input_t*)data;
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
@ -705,7 +705,7 @@ static void *qnx_input_init(const char *joypad_driver)
|
|||||||
return qnx;
|
return qnx;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qnx_input_poll(void *data, const void *joypad_data)
|
static void qnx_input_poll(void *data)
|
||||||
{
|
{
|
||||||
qnx_input_t *qnx = (qnx_input_t*)data;
|
qnx_input_t *qnx = (qnx_input_t*)data;
|
||||||
|
|
||||||
|
@ -650,7 +650,7 @@ static void rwebinput_process_keyboard_events(
|
|||||||
rwebinput->keys[translated_keycode] = keydown;
|
rwebinput->keys[translated_keycode] = keydown;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rwebinput_input_poll(void *data, const void *joypad_data)
|
static void rwebinput_input_poll(void *data)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
rwebinput_input_t *rwebinput = (rwebinput_input_t*)data;
|
rwebinput_input_t *rwebinput = (rwebinput_input_t*)data;
|
||||||
|
@ -328,7 +328,7 @@ static void sdl_poll_mouse(sdl_input_t *sdl)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sdl_input_poll(void *data, const void *joypad_data)
|
static void sdl_input_poll(void *data)
|
||||||
{
|
{
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
sdl_input_t *sdl = (sdl_input_t*)data;
|
sdl_input_t *sdl = (sdl_input_t*)data;
|
||||||
|
@ -148,7 +148,7 @@ static void finish_simulated_mouse_clicks(switch_input_t *sw, uint64_t currentTi
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LIBNX
|
#ifdef HAVE_LIBNX
|
||||||
static void switch_input_poll(void *data, const void *joypad_data)
|
static void switch_input_poll(void *data)
|
||||||
{
|
{
|
||||||
MousePosition mouse_pos;
|
MousePosition mouse_pos;
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
@ -704,7 +704,7 @@ static bool udev_input_poll_hotplug_available(struct udev_monitor *dev)
|
|||||||
return (poll(&fds, 1, 0) == 1) && (fds.revents & POLLIN);
|
return (poll(&fds, 1, 0) == 1) && (fds.revents & POLLIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void udev_input_poll(void *data, const void *joypad_data)
|
static void udev_input_poll(void *data)
|
||||||
{
|
{
|
||||||
int i, ret;
|
int i, ret;
|
||||||
#if defined(HAVE_EPOLL)
|
#if defined(HAVE_EPOLL)
|
||||||
|
@ -34,7 +34,7 @@ typedef struct uwp_input
|
|||||||
void *empty;
|
void *empty;
|
||||||
} uwp_input_t;
|
} uwp_input_t;
|
||||||
|
|
||||||
static void uwp_input_poll(void *data, const void *joypad_data)
|
static void uwp_input_poll(void *data)
|
||||||
{
|
{
|
||||||
uwp_input_next_frame();
|
uwp_input_next_frame();
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ static bool wayland_context_gettouchpos(
|
|||||||
return wl->active_touch_positions[id].active;
|
return wl->active_touch_positions[id].active;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void input_wl_poll(void *data, const void *joypad_data)
|
static void input_wl_poll(void *data)
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
unsigned touch_x = 0;
|
unsigned touch_x = 0;
|
||||||
|
@ -505,7 +505,7 @@ error:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void winraw_poll(void *data, const void *joypad_data)
|
static void winraw_poll(void *data)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
winraw_input_t *wr = (winraw_input_t*)data;
|
winraw_input_t *wr = (winraw_input_t*)data;
|
||||||
|
@ -641,7 +641,7 @@ static void x_input_free(void *data)
|
|||||||
free(x11);
|
free(x11);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void x_input_poll(void *data, const void *joypad_data)
|
static void x_input_poll(void *data)
|
||||||
{
|
{
|
||||||
unsigned mask;
|
unsigned mask;
|
||||||
int root_x, root_y, win_x, win_y;
|
int root_x, root_y, win_x, win_y;
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
/* TODO/FIXME - static global variable */
|
/* TODO/FIXME - static global variable */
|
||||||
static uint64_t state[DEFAULT_MAX_PADS];
|
static uint64_t state[DEFAULT_MAX_PADS];
|
||||||
|
|
||||||
static void xenon360_input_poll(void *data, const void *joypad_data)
|
static void xenon360_input_poll(void *data)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ struct input_driver
|
|||||||
void *(*init)(const char *joypad_driver);
|
void *(*init)(const char *joypad_driver);
|
||||||
|
|
||||||
/* Polls input. Called once every frame. */
|
/* Polls input. Called once every frame. */
|
||||||
void (*poll)(void *data, const void *joypad_data);
|
void (*poll)(void *data);
|
||||||
|
|
||||||
/* Queries input state for a certain key on a certain player.
|
/* Queries input state for a certain key on a certain player.
|
||||||
* Players are 1 - MAX_USERS.
|
* Players are 1 - MAX_USERS.
|
||||||
|
12
retroarch.c
12
retroarch.c
@ -675,7 +675,7 @@ static const gfx_ctx_driver_t *gfx_ctx_gl_drivers[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void *input_null_init(const char *joypad_driver) { return (void*)-1; }
|
static void *input_null_init(const char *joypad_driver) { return (void*)-1; }
|
||||||
static void input_null_poll(void *data, const void *joypad_data) { }
|
static void input_null_poll(void *data) { }
|
||||||
static int16_t input_null_input_state(
|
static int16_t input_null_input_state(
|
||||||
void *data,
|
void *data,
|
||||||
const input_device_driver_t *joypad,
|
const input_device_driver_t *joypad,
|
||||||
@ -15456,8 +15456,7 @@ static void command_event_reinit(struct rarch_state *p_rarch,
|
|||||||
if (p_rarch->sec_joypad->poll)
|
if (p_rarch->sec_joypad->poll)
|
||||||
p_rarch->sec_joypad->poll();
|
p_rarch->sec_joypad->poll();
|
||||||
#endif
|
#endif
|
||||||
p_rarch->current_input->poll(p_rarch->current_input_data,
|
p_rarch->current_input->poll(p_rarch->current_input_data);
|
||||||
p_rarch->joypad);
|
|
||||||
}
|
}
|
||||||
command_event(CMD_EVENT_GAME_FOCUS_TOGGLE, (void*)(intptr_t)-1);
|
command_event(CMD_EVENT_GAME_FOCUS_TOGGLE, (void*)(intptr_t)-1);
|
||||||
|
|
||||||
@ -23700,8 +23699,7 @@ static void input_driver_poll(void)
|
|||||||
if (p_rarch->sec_joypad->poll)
|
if (p_rarch->sec_joypad->poll)
|
||||||
p_rarch->sec_joypad->poll();
|
p_rarch->sec_joypad->poll();
|
||||||
#endif
|
#endif
|
||||||
p_rarch->current_input->poll(p_rarch->current_input_data,
|
p_rarch->current_input->poll(p_rarch->current_input_data);
|
||||||
p_rarch->joypad);
|
|
||||||
|
|
||||||
p_rarch->input_driver_turbo_btns.count++;
|
p_rarch->input_driver_turbo_btns.count++;
|
||||||
|
|
||||||
@ -26652,13 +26650,13 @@ bool input_joypad_set_rumble(const input_device_driver_t *drv,
|
|||||||
return drv->set_rumble(joy_idx, effect, strength);
|
return drv->set_rumble(joy_idx, effect, strength);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool input_key_pressed(const void *data, int key, bool keyboard_pressed)
|
bool input_key_pressed(int key, bool keyboard_pressed)
|
||||||
{
|
{
|
||||||
rarch_joypad_info_t joypad_info;
|
rarch_joypad_info_t joypad_info;
|
||||||
struct rarch_state
|
struct rarch_state
|
||||||
*p_rarch = &rarch_st;
|
*p_rarch = &rarch_st;
|
||||||
const input_device_driver_t
|
const input_device_driver_t
|
||||||
*joypad = (const input_device_driver_t*)data;
|
*joypad = (const input_device_driver_t*)p_rarch->joypad;
|
||||||
joypad_info.joy_idx = 0;
|
joypad_info.joy_idx = 0;
|
||||||
joypad_info.auto_binds = input_autoconf_binds[0];
|
joypad_info.auto_binds = input_autoconf_binds[0];
|
||||||
joypad_info.axis_threshold = p_rarch->input_driver_axis_threshold;
|
joypad_info.axis_threshold = p_rarch->input_driver_axis_threshold;
|
||||||
|
@ -1980,8 +1980,7 @@ void retroarch_init_task_queue(void);
|
|||||||
|
|
||||||
bool is_input_keyboard_display_on(void);
|
bool is_input_keyboard_display_on(void);
|
||||||
|
|
||||||
bool input_key_pressed(const void *data,
|
bool input_key_pressed(int key, bool keyboard_pressed);
|
||||||
int key, bool keyboard_pressed);
|
|
||||||
|
|
||||||
const char *joypad_driver_name(unsigned i);
|
const char *joypad_driver_name(unsigned i);
|
||||||
void joypad_driver_reinit(void *data, const char *joypad_driver_name);
|
void joypad_driver_reinit(void *data, const char *joypad_driver_name);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user