mirror of
https://github.com/libretro/RetroArch
synced 2025-03-30 07:20:36 +00:00
current_input_data and current_input are no longer globals
This commit is contained in:
parent
ad7dd75458
commit
a6afddae04
21
command.c
21
command.c
@ -1962,15 +1962,22 @@ bool command_event(enum event_command cmd, void *data)
|
||||
case CMD_EVENT_REINIT_FROM_TOGGLE:
|
||||
retroarch_unset_forced_fullscreen();
|
||||
case CMD_EVENT_REINIT:
|
||||
video_driver_reinit();
|
||||
/* Poll input to avoid possibly stale data to corrupt things. */
|
||||
input_driver_poll();
|
||||
command_event(CMD_EVENT_GAME_FOCUS_TOGGLE, (void*)(intptr_t)-1);
|
||||
{
|
||||
video_driver_reinit();
|
||||
{
|
||||
const input_driver_t *input_drv = input_get_ptr();
|
||||
void *input_data = input_get_data();
|
||||
/* Poll input to avoid possibly stale data to corrupt things. */
|
||||
if (input_drv && input_drv->poll)
|
||||
input_drv->poll(input_data);
|
||||
}
|
||||
command_event(CMD_EVENT_GAME_FOCUS_TOGGLE, (void*)(intptr_t)-1);
|
||||
#ifdef HAVE_MENU
|
||||
menu_display_set_framebuffer_dirty_flag();
|
||||
if (menu_driver_is_alive())
|
||||
command_event(CMD_EVENT_VIDEO_SET_BLOCKING_STATE, NULL);
|
||||
menu_display_set_framebuffer_dirty_flag();
|
||||
if (menu_driver_is_alive())
|
||||
command_event(CMD_EVENT_VIDEO_SET_BLOCKING_STATE, NULL);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case CMD_EVENT_CHEATS_DEINIT:
|
||||
cheat_manager_state_free();
|
||||
|
@ -372,8 +372,8 @@ static input_remote_t *input_driver_remote = NULL;
|
||||
#ifdef HAVE_KEYMAPPER
|
||||
static input_mapper_t *input_driver_mapper = NULL;
|
||||
#endif
|
||||
const input_driver_t *current_input = NULL;
|
||||
void *current_input_data = NULL;
|
||||
static const input_driver_t *current_input = NULL;
|
||||
static void *current_input_data = NULL;
|
||||
static bool input_driver_block_hotkey = false;
|
||||
static bool input_driver_block_libretro_input = false;
|
||||
static bool input_driver_nonblock_state = false;
|
||||
@ -450,6 +450,11 @@ const char* config_get_input_driver_options(void)
|
||||
return char_list_new_special(STRING_LIST_INPUT_DRIVERS, NULL);
|
||||
}
|
||||
|
||||
void *input_get_data(void)
|
||||
{
|
||||
return current_input_data;
|
||||
}
|
||||
|
||||
const input_driver_t *input_get_ptr(void)
|
||||
{
|
||||
return current_input;
|
||||
@ -1117,11 +1122,6 @@ bool input_driver_has_capabilities(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
void input_driver_poll(void)
|
||||
{
|
||||
current_input->poll(current_input_data);
|
||||
}
|
||||
|
||||
bool input_driver_init(void)
|
||||
{
|
||||
if (current_input)
|
||||
|
@ -196,9 +196,6 @@ struct hid_driver
|
||||
const char *ident;
|
||||
};
|
||||
|
||||
extern const input_driver_t *current_input;
|
||||
extern void *current_input_data;
|
||||
|
||||
/**
|
||||
* input_driver_find_handle:
|
||||
* @index : index of driver to get handle to.
|
||||
@ -344,14 +341,14 @@ void *input_driver_get_data(void);
|
||||
|
||||
const input_driver_t *input_get_ptr(void);
|
||||
|
||||
void *input_get_data(void);
|
||||
|
||||
const input_driver_t **input_get_double_ptr(void);
|
||||
|
||||
void **input_driver_get_data_ptr(void);
|
||||
|
||||
bool input_driver_has_capabilities(void);
|
||||
|
||||
void input_driver_poll(void);
|
||||
|
||||
bool input_driver_init(void);
|
||||
|
||||
void input_driver_deinit(void);
|
||||
|
@ -577,7 +577,9 @@ void input_poll_overlay(input_overlay_t *ol, float opacity, unsigned analog_dpad
|
||||
uint16_t key_mod = 0;
|
||||
bool polled = false;
|
||||
bool button_pressed = false;
|
||||
void *input_data = input_get_data();
|
||||
input_overlay_state_t *ol_state = &ol->overlay_state;
|
||||
const input_driver_t *input_ptr = input_get_ptr();
|
||||
|
||||
if (!ol_state)
|
||||
return;
|
||||
@ -594,16 +596,16 @@ void input_poll_overlay(input_overlay_t *ol, float opacity, unsigned analog_dpad
|
||||
RARCH_DEVICE_POINTER_SCREEN : RETRO_DEVICE_POINTER;
|
||||
|
||||
for (i = 0;
|
||||
current_input->input_state(current_input_data, joypad_info,
|
||||
input_ptr->input_state(input_data, joypad_info,
|
||||
NULL,
|
||||
0, device, i, RETRO_DEVICE_ID_POINTER_PRESSED);
|
||||
i++)
|
||||
{
|
||||
input_overlay_state_t polled_data;
|
||||
int16_t x = current_input->input_state(current_input_data, joypad_info,
|
||||
int16_t x = input_ptr->input_state(input_data, joypad_info,
|
||||
NULL,
|
||||
0, device, i, RETRO_DEVICE_ID_POINTER_X);
|
||||
int16_t y = current_input->input_state(current_input_data, joypad_info,
|
||||
int16_t y = input_ptr->input_state(input_data, joypad_info,
|
||||
NULL,
|
||||
0, device, i, RETRO_DEVICE_ID_POINTER_Y);
|
||||
|
||||
|
@ -49,6 +49,8 @@ static int menu_event_pointer(unsigned *action)
|
||||
size_t fb_pitch;
|
||||
unsigned fb_width, fb_height;
|
||||
const struct retro_keybind *binds[MAX_USERS] = {NULL};
|
||||
const input_driver_t *input_ptr = input_get_ptr();
|
||||
void *input_data = input_get_data();
|
||||
menu_input_t *menu_input = menu_input_get_ptr();
|
||||
int pointer_device = menu_driver_is_texture_set()
|
||||
?
|
||||
@ -62,21 +64,21 @@ static int menu_event_pointer(unsigned *action)
|
||||
joypad_info.axis_threshold = 0.0f;
|
||||
|
||||
pointer_x =
|
||||
current_input->input_state(current_input_data, joypad_info, binds,
|
||||
input_ptr->input_state(input_data, joypad_info, binds,
|
||||
0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_X);
|
||||
pointer_y =
|
||||
current_input->input_state(current_input_data, joypad_info, binds,
|
||||
input_ptr->input_state(input_data, joypad_info, binds,
|
||||
0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_Y);
|
||||
|
||||
menu_input->pointer.pressed[0] = current_input->input_state(current_input_data,
|
||||
menu_input->pointer.pressed[0] = input_ptr->input_state(input_data,
|
||||
joypad_info,
|
||||
binds,
|
||||
0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_PRESSED);
|
||||
menu_input->pointer.pressed[1] = current_input->input_state(current_input_data,
|
||||
menu_input->pointer.pressed[1] = input_ptr->input_state(input_data,
|
||||
joypad_info,
|
||||
binds,
|
||||
0, pointer_device, 1, RETRO_DEVICE_ID_POINTER_PRESSED);
|
||||
menu_input->pointer.back = current_input->input_state(current_input_data,
|
||||
menu_input->pointer.back = input_ptr->input_state(input_data,
|
||||
joypad_info,
|
||||
binds,
|
||||
0, pointer_device, 0, RARCH_DEVICE_ID_POINTER_BACK);
|
||||
|
@ -365,12 +365,14 @@ int16_t menu_input_pointer_state(enum menu_input_pointer_state state)
|
||||
int16_t menu_input_mouse_state(enum menu_input_mouse_state state)
|
||||
{
|
||||
rarch_joypad_info_t joypad_info;
|
||||
unsigned type = 0;
|
||||
unsigned device = RETRO_DEVICE_MOUSE;
|
||||
const input_driver_t *input_ptr = input_get_ptr();
|
||||
void *input_data = input_get_data();
|
||||
unsigned type = 0;
|
||||
unsigned device = RETRO_DEVICE_MOUSE;
|
||||
|
||||
joypad_info.joy_idx = 0;
|
||||
joypad_info.auto_binds = NULL;
|
||||
joypad_info.axis_threshold = 0.0f;
|
||||
joypad_info.joy_idx = 0;
|
||||
joypad_info.auto_binds = NULL;
|
||||
joypad_info.axis_threshold = 0.0f;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
@ -402,7 +404,7 @@ int16_t menu_input_mouse_state(enum menu_input_mouse_state state)
|
||||
break;
|
||||
}
|
||||
|
||||
return current_input->input_state(current_input_data, joypad_info,
|
||||
return input_ptr->input_state(input_data, joypad_info,
|
||||
NULL, 0, device, 0, type);
|
||||
}
|
||||
|
||||
|
@ -210,6 +210,8 @@ static void menu_input_key_bind_poll_bind_state(
|
||||
{
|
||||
unsigned b;
|
||||
rarch_joypad_info_t joypad_info;
|
||||
const input_driver_t *input_ptr = input_get_ptr();
|
||||
void *input_data = input_get_data();
|
||||
const input_device_driver_t *joypad =
|
||||
input_driver_get_joypad_driver();
|
||||
const input_device_driver_t *sec_joypad =
|
||||
@ -229,7 +231,8 @@ static void menu_input_key_bind_poll_bind_state(
|
||||
joypad_info.auto_binds = NULL;
|
||||
joypad_info.axis_threshold = 0.0f;
|
||||
|
||||
state->skip = timed_out || current_input->input_state(current_input_data, joypad_info,
|
||||
state->skip = timed_out || input_ptr->input_state(input_data,
|
||||
joypad_info,
|
||||
NULL,
|
||||
0, RETRO_DEVICE_KEYBOARD, 0, RETROK_RETURN);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user