mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-08 02:17:13 +00:00
(GX) No longer depend on global pointer in input driver
This commit is contained in:
parent
b6609d576b
commit
e2d510e4f6
@ -37,6 +37,7 @@ typedef struct gx_input
|
||||
{
|
||||
bool blocked;
|
||||
const input_device_driver_t *joypad;
|
||||
uint64_t lifecycle_state;
|
||||
} gx_input_t;
|
||||
|
||||
static int16_t gx_input_state(void *data, const struct retro_keybind **binds,
|
||||
@ -94,9 +95,8 @@ static void gx_input_poll(void *data)
|
||||
static bool gx_input_key_pressed(void *data, int key)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
gx_input_t *gx = (gx_input_t*)data;
|
||||
return (global->lifecycle_state & (1ULL << key)) ||
|
||||
return (gx->lifecycle_state & (1ULL << key)) ||
|
||||
input_joypad_pressed(gx->joypad, 0, settings->input.binds[0], key);
|
||||
}
|
||||
|
||||
|
@ -350,7 +350,7 @@ static void gx_joypad_poll(void)
|
||||
{
|
||||
unsigned i, j, port;
|
||||
uint8_t gcpad = 0;
|
||||
global_t *global = global_get_ptr();
|
||||
gx_input_t *gx = (gx_input_t*)input_driver_get_ptr();
|
||||
|
||||
pad_state[0] = 0;
|
||||
pad_state[1] = 0;
|
||||
@ -540,9 +540,8 @@ static void gx_joypad_poll(void)
|
||||
}
|
||||
|
||||
uint64_t *state_p1 = &pad_state[0];
|
||||
uint64_t *lifecycle_state = &global->lifecycle_state;
|
||||
|
||||
*lifecycle_state &= ~((1ULL << RARCH_MENU_TOGGLE));
|
||||
gx->lifecycle_state &= ~((1ULL << RARCH_MENU_TOGGLE));
|
||||
|
||||
if (g_menu)
|
||||
{
|
||||
@ -555,7 +554,7 @@ static void gx_joypad_poll(void)
|
||||
| (1ULL << GX_CLASSIC_HOME)
|
||||
#endif
|
||||
))
|
||||
*lifecycle_state |= (1ULL << RARCH_MENU_TOGGLE);
|
||||
gx->lifecycle_state |= (1ULL << RARCH_MENU_TOGGLE);
|
||||
}
|
||||
|
||||
static bool gx_joypad_init(void *data)
|
||||
|
@ -178,6 +178,14 @@ static const input_driver_t *input_get_ptr(driver_t *driver)
|
||||
return driver->input;
|
||||
}
|
||||
|
||||
input_driver_t *input_driver_get_ptr(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return NULL;
|
||||
return driver->input_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* input_driver_set_rumble_state:
|
||||
* @port : User number.
|
||||
|
@ -98,6 +98,8 @@ extern input_driver_t input_qnx;
|
||||
extern input_driver_t input_rwebinput;
|
||||
extern input_driver_t input_null;
|
||||
|
||||
input_driver_t *input_driver_get_ptr(void);
|
||||
|
||||
/**
|
||||
* input_driver_find_handle:
|
||||
* @index : index of driver to get handle to.
|
||||
|
Loading…
x
Reference in New Issue
Block a user