diff --git a/input/apple_input.c b/input/apple_input.c index 6b18bb972d..d7198d6470 100644 --- a/input/apple_input.c +++ b/input/apple_input.c @@ -245,7 +245,6 @@ extern const rarch_joypad_driver_t apple_joypad; static const rarch_joypad_driver_t* const g_joydriver = &apple_joypad; apple_input_data_t g_current_input_data; -apple_input_data_t g_polled_input_data; #ifdef OSX // Taken from https://github.com/depp/keycode, check keycode.h for license const unsigned char MAC_NATIVE_TO_HID[128] = { @@ -465,7 +464,7 @@ int32_t apple_input_find_any_axis(uint32_t port) static bool apple_key_pressed(enum retro_key key) { if ((int)key >= 0 && key < RETROK_LAST) - return g_polled_input_data.keys[input_translate_rk_to_keysym(key)]; + return g_current_input_data.keys[input_translate_rk_to_keysym(key)]; return false; } @@ -479,26 +478,26 @@ static bool apple_is_pressed(unsigned port_num, const struct retro_keybind *bind static void *apple_input_init(void) { input_init_keyboard_lut(apple_key_map_hidusage); - memset(&g_polled_input_data, 0, sizeof(g_polled_input_data)); + memset(&g_current_input_data, 0, sizeof(g_current_input_data)); return (void*)-1; } static void apple_input_poll(void *data) { + int i; (void)data; apple_gamecontroller_poll_all(); - memcpy(&g_polled_input_data, &g_current_input_data, sizeof(apple_input_data_t)); - for (int i = 0; i != g_polled_input_data.touch_count; i ++) + for (i = 0; i < g_current_input_data.touch_count; i ++) { - input_translate_coord_viewport(g_polled_input_data.touches[i].screen_x, g_polled_input_data.touches[i].screen_y, - &g_polled_input_data.touches[i].fixed_x, &g_polled_input_data.touches[i].fixed_y, - &g_polled_input_data.touches[i].full_x, &g_polled_input_data.touches[i].full_y); + input_translate_coord_viewport(g_current_input_data.touches[i].screen_x, g_current_input_data.touches[i].screen_y, + &g_current_input_data.touches[i].fixed_x, &g_current_input_data.touches[i].fixed_y, + &g_current_input_data.touches[i].full_x, &g_current_input_data.touches[i].full_y); } input_joypad_poll(g_joydriver); - g_polled_input_data.pad_buttons[0] |= apple_input_get_icade_buttons(); + g_current_input_data.pad_buttons[0] |= apple_input_get_icade_buttons(); g_current_input_data.mouse_delta[0] = 0; g_current_input_data.mouse_delta[1] = 0; @@ -524,13 +523,13 @@ static int16_t apple_input_state(void *data, const struct retro_keybind **binds, switch (id) { case RETRO_DEVICE_ID_MOUSE_X: - return g_polled_input_data.mouse_delta[0]; + return g_current_input_data.mouse_delta[0]; case RETRO_DEVICE_ID_MOUSE_Y: - return g_polled_input_data.mouse_delta[1]; + return g_current_input_data.mouse_delta[1]; case RETRO_DEVICE_ID_MOUSE_LEFT: - return g_polled_input_data.mouse_buttons & 1; + return g_current_input_data.mouse_buttons & 1; case RETRO_DEVICE_ID_MOUSE_RIGHT: - return g_polled_input_data.mouse_buttons & 2; + return g_current_input_data.mouse_buttons & 2; } } @@ -539,9 +538,9 @@ static int16_t apple_input_state(void *data, const struct retro_keybind **binds, { const bool want_full = device == RARCH_DEVICE_POINTER_SCREEN; - if (index < g_polled_input_data.touch_count && index < MAX_TOUCHES) + if (index < g_current_input_data.touch_count && index < MAX_TOUCHES) { - const apple_touch_data_t *touch = (const apple_touch_data_t *)&g_polled_input_data.touches[index]; + const apple_touch_data_t *touch = (const apple_touch_data_t *)&g_current_input_data.touches[index]; int16_t x = want_full ? touch->full_x : touch->fixed_x; int16_t y = want_full ? touch->full_y : touch->fixed_y; diff --git a/input/apple_input.h b/input/apple_input.h index eb5e0614f7..704abb940b 100644 --- a/input/apple_input.h +++ b/input/apple_input.h @@ -68,7 +68,6 @@ void apple_joypad_send_hid_control(struct apple_pad_connection* connection, uint // Input data for the main thread and the game thread extern apple_input_data_t g_current_input_data; -extern apple_input_data_t g_polled_input_data; // Main thread only void apple_input_enable_icade(bool on); diff --git a/input/apple_joypad.c b/input/apple_joypad.c index 94ab59e54e..6a53d18d88 100644 --- a/input/apple_joypad.c +++ b/input/apple_joypad.c @@ -168,7 +168,7 @@ static bool apple_joypad_button(unsigned port, uint16_t joykey) if (GET_HAT_DIR(joykey)) return false; else // Check the button - return (port < MAX_PLAYERS && joykey < 32) ? (g_polled_input_data.pad_buttons[port] & (1 << joykey)) != 0 : false; + return (port < MAX_PLAYERS && joykey < 32) ? (g_current_input_data.pad_buttons[port] & (1 << joykey)) != 0 : false; } static int16_t apple_joypad_axis(unsigned port, uint32_t joyaxis) @@ -182,12 +182,12 @@ static int16_t apple_joypad_axis(unsigned port, uint32_t joyaxis) if (AXIS_NEG_GET(joyaxis) < 4) { - val = g_polled_input_data.pad_axis[port][AXIS_NEG_GET(joyaxis)]; + val = g_current_input_data.pad_axis[port][AXIS_NEG_GET(joyaxis)]; val = (val < 0) ? val : 0; } else if(AXIS_POS_GET(joyaxis) < 4) { - val = g_polled_input_data.pad_axis[port][AXIS_POS_GET(joyaxis)]; + val = g_current_input_data.pad_axis[port][AXIS_POS_GET(joyaxis)]; val = (val > 0) ? val : 0; }