Revert "Go through input_driver_get_data_ptr whenever we need input data"

This reverts commit 52c9a2ec43.
This commit is contained in:
Twinaphex 2015-11-28 18:58:33 +01:00
parent 52c9a2ec43
commit 3001729545
6 changed files with 35 additions and 30 deletions

View File

@ -27,8 +27,8 @@
int32_t cocoa_input_find_any_key(void)
{
unsigned i;
void **input_data = input_driver_get_data_ptr();
cocoa_input_data_t *apple = (cocoa_input_data_t*)&input_data;
driver_t *driver =driver_get_ptr();
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
if (!apple)
return 0;
@ -61,8 +61,8 @@ static int cocoa_input_find_any_button_ret(cocoa_input_data_t *apple,
int32_t cocoa_input_find_any_button(uint32_t port)
{
int ret = -1;
void **input_data = input_driver_get_data_ptr();
cocoa_input_data_t *apple = (cocoa_input_data_t*)&input_data;
driver_t *driver = driver_get_ptr();
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
if (!apple)
return -1;
@ -98,8 +98,8 @@ int32_t cocoa_input_find_any_button(uint32_t port)
int32_t cocoa_input_find_any_axis(uint32_t port)
{
int i;
void **input_data = input_driver_get_data_ptr();
cocoa_input_data_t *apple = (cocoa_input_data_t*)&input_data;
driver_t *driver = driver_get_ptr();
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
if (apple && apple->joypad)
apple->joypad->poll();

View File

@ -47,8 +47,8 @@ static bool android_joypad_init(void *data)
static bool android_joypad_button(unsigned port, uint16_t joykey)
{
uint8_t *buf = NULL;
void **input_data = input_driver_get_data_ptr();
android_input_t *android = (android_input_t*)&input_data;
driver_t *driver = driver_get_ptr();
android_input_t *android = driver ? (android_input_t*)driver->input_data : NULL;
if (!android || port >= MAX_PADS)
return false;
@ -85,8 +85,8 @@ static int16_t android_joypad_axis(unsigned port, uint32_t joyaxis)
int axis = -1;
bool is_neg = false;
bool is_pos = false;
void **input_data = input_driver_get_data_ptr();
android_input_t *android = (android_input_t*)&input_data;
driver_t *driver = driver_get_ptr();
android_input_t *android = driver ? (android_input_t*)driver->input_data : NULL;
if (!android || joyaxis == AXIS_NONE || port >= MAX_PADS)
return 0;
@ -118,9 +118,8 @@ static void android_joypad_poll(void)
static bool android_joypad_query_pad(unsigned pad)
{
void **input_data = input_driver_get_data_ptr();
android_input_t *android = (android_input_t*)&input_data;
driver_t *driver = driver_get_ptr();
android_input_t *android = driver ? (android_input_t*)driver->input_data : NULL;
return (pad < MAX_USERS && pad < android->pads_connected);
}

View File

@ -49,8 +49,8 @@ static bool qnx_joypad_init(void *data)
static bool qnx_joypad_button(unsigned port_num, uint16_t joykey)
{
void **input_data = input_driver_get_data_ptr();
qnx_input_t *qnx = (qnx_input_t*)&input_data;
driver_t *driver = driver_get_ptr();
qnx_input_t *qnx = (qnx_input_t*)driver->input_data;
if (!qnx || port_num >= MAX_PADS)
return false;
@ -60,8 +60,8 @@ static bool qnx_joypad_button(unsigned port_num, uint16_t joykey)
static uint64_t qnx_joypad_get_buttons(unsigned port_num)
{
void **input_data = input_driver_get_data_ptr();
qnx_input_t *qnx = (qnx_input_t*)&input_data;
driver_t *driver = driver_get_ptr();
qnx_input_t *qnx = (qnx_input_t*)driver->input_data;
if (!qnx || port_num >= MAX_PADS)
return 0;
@ -74,8 +74,8 @@ static int16_t qnx_joypad_axis(unsigned port_num, uint32_t joyaxis)
int axis = -1;
bool is_neg = false;
bool is_pos = false;
void **input_data = input_driver_get_data_ptr();
qnx_input_t *qnx = (qnx_input_t*)&input_data;
driver_t *driver = driver_get_ptr();
qnx_input_t *qnx = (qnx_input_t*)driver->input_data;
if (!qnx || joyaxis == AXIS_NONE || port_num >= MAX_PADS)
return 0;
@ -121,8 +121,8 @@ static void qnx_joypad_poll(void)
static bool qnx_joypad_query_pad(unsigned pad)
{
void **input_data = input_driver_get_data_ptr();
qnx_input_t *qnx = (qnx_input_t*)&input_data;
driver_t *driver = driver_get_ptr();
qnx_input_t *qnx = (qnx_input_t*)driver->input_data;
return (qnx && pad < MAX_USERS && qnx->pad_state[pad]);
}

View File

@ -72,8 +72,8 @@ static bool handle_small_keyboard(unsigned* code, bool down)
{ KEY_X, KP_2 }, { KEY_C, KP_3 },
{ 0 }
};
void **input_data = input_driver_get_data_ptr();
cocoa_input_data_t *apple = (cocoa_input_data_t*)&input_data;
driver_t *driver = driver_get_ptr();
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
unsigned translated_code = 0;
if (!map_initialized)
@ -273,11 +273,11 @@ static bool handle_icade_event(unsigned *code, bool *keydown)
void cocoa_input_keyboard_event(bool down,
unsigned code, uint32_t character, uint32_t mod, unsigned device)
{
void **input_data = input_driver_get_data_ptr();
driver_t *driver = driver_get_ptr();
#if TARGET_OS_IPHONE
settings_t *settings = config_get_ptr();
#endif
cocoa_input_data_t *apple = (cocoa_input_data_t*)&input_data;
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
if (!apple)
return;

View File

@ -46,11 +46,13 @@ void apple_rarch_exited(void)
- (void)sendEvent:(NSEvent *)event
{
NSEventType event_type;
void **input_data = (void**)input_driver_get_data_ptr();
cocoa_input_data_t *apple = (cocoa_input_data_t*)&input_data;
cocoa_input_data_t *apple = NULL;
driver_t *driver = driver_get_ptr();
if (!driver)
return;
[super sendEvent:event];
apple = (cocoa_input_data_t*)driver->input_data;
event_type = event.type;
if (!apple)
@ -205,6 +207,11 @@ static char** waiting_argv;
static void poll_iteration(void)
{
NSEvent *event = NULL;
driver_t *driver = driver_get_ptr();
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
if (!apple)
return;
do
{

View File

@ -108,8 +108,7 @@ static void handle_touch_event(NSArray* touches)
{
unsigned i;
driver_t *driver = driver_get_ptr();
void **input_data = input_driver_get_data_ptr();
cocoa_input_data_t *apple = (cocoa_input_data_t*)&input_data;
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
float scale = cocoagl_gfx_ctx_get_native_scale();
if (!apple)