From bf06d67a3035fbb807925926a973688ef3731cc4 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 29 Aug 2020 19:59:04 +0200 Subject: [PATCH] Cut down on some extra ifdefs --- input/drivers/psp_input.c | 20 +++++++++++--------- input/drivers/wiiu_input.c | 22 ++++++++++------------ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/input/drivers/psp_input.c b/input/drivers/psp_input.c index 42771e44ef..10a07940e2 100644 --- a/input/drivers/psp_input.c +++ b/input/drivers/psp_input.c @@ -92,6 +92,7 @@ typedef struct psp_input static void psp_input_poll(void *data) { + psp_input_t *psp = (psp_input_t*)data; #ifdef VITA unsigned int i = 0; int key_sym = 0; @@ -105,13 +106,7 @@ static void psp_input_poll(void *data) int mouse_velocity_y = 0; SceHidKeyboardReport k_reports[SCE_HID_MAX_REPORT]; SceHidMouseReport m_reports[SCE_HID_MAX_REPORT]; -#endif - psp_input_t *psp = (psp_input_t*)data; - if (psp && psp->joypad) - psp->joypad->poll(); - -#ifdef VITA if (psp->keyboard_hid_handle > 0) { numReports = sceHidKeyboardRead( @@ -225,6 +220,7 @@ static void psp_input_poll(void *data) } } } + psp->mouse_x_delta = mouse_velocity_x; psp->mouse_y_delta = mouse_velocity_y; psp->mouse_x += mouse_velocity_x; @@ -239,6 +235,9 @@ static void psp_input_poll(void *data) else if (psp->mouse_y > MOUSE_MAX_Y) psp->mouse_y = MOUSE_MAX_Y; #endif + + if (psp && psp->joypad) + psp->joypad->poll(); } #ifdef VITA @@ -337,18 +336,18 @@ static void psp_input_free_input(void *data) static void* psp_input_initialize(const char *joypad_driver) { +#ifdef VITA + unsigned i; +#endif psp_input_t *psp = (psp_input_t*)calloc(1, sizeof(*psp)); if (!psp) return NULL; - psp->joypad = input_joypad_init_driver(joypad_driver, psp); - #ifdef VITA sceHidKeyboardEnumerate(&(psp->keyboard_hid_handle), 1); sceHidMouseEnumerate(&(psp->mouse_hid_handle), 1); input_keymaps_init_keyboard_lut(rarch_key_map_vita); - unsigned int i; for (i = 0; i <= VITA_MAX_SCANCODE; i++) psp->keyboard_state[i] = false; for (i = 0; i < 6; i++) @@ -356,6 +355,9 @@ static void* psp_input_initialize(const char *joypad_driver) psp->mouse_x = 0; psp->mouse_y = 0; #endif + + psp->joypad = input_joypad_init_driver(joypad_driver, psp); + return psp; } diff --git a/input/drivers/wiiu_input.c b/input/drivers/wiiu_input.c index 8bab476e2e..c4c1bb17f0 100644 --- a/input/drivers/wiiu_input.c +++ b/input/drivers/wiiu_input.c @@ -56,12 +56,12 @@ static void kb_disconnection_callback(KBDKeyEvent *key) static void kb_key_callback(KBDKeyEvent *key) { - uint16_t mod = 0; - unsigned code = 0; - bool pressed = false; + uint16_t mod = 0; + unsigned code = 0; + bool pressed = false; if (key->state > 0) - pressed = true; + pressed = true; code = input_keymaps_translate_keysym_to_rk( key->scancode); @@ -69,22 +69,22 @@ static void kb_key_callback(KBDKeyEvent *key) keyboard_state[code] = pressed; if (key->modifier & KBD_WIIU_SHIFT) - mod |= RETROKMOD_SHIFT; + mod |= RETROKMOD_SHIFT; if (key->modifier & KBD_WIIU_CTRL) - mod |= RETROKMOD_CTRL; + mod |= RETROKMOD_CTRL; if (key->modifier & KBD_WIIU_ALT) - mod |= RETROKMOD_ALT; + mod |= RETROKMOD_ALT; if (key->modifier & KBD_WIIU_NUM_LOCK) - mod |= RETROKMOD_NUMLOCK; + mod |= RETROKMOD_NUMLOCK; if (key->modifier & KBD_WIIU_CAPS_LOCK) - mod |= RETROKMOD_CAPSLOCK; + mod |= RETROKMOD_CAPSLOCK; if (key->modifier & KBD_WIIU_SCROLL_LOCK) - mod |= RETROKMOD_SCROLLOCK; + mod |= RETROKMOD_SCROLLOCK; input_keyboard_event(pressed, code, (char)key->UTF16, mod, RETRO_DEVICE_KEYBOARD); @@ -190,8 +190,6 @@ static void* wiiu_input_init(const char *joypad_driver) static uint64_t wiiu_input_get_capabilities(void *data) { - (void)data; - return (1 << RETRO_DEVICE_JOYPAD) | (1 << RETRO_DEVICE_ANALOG) | (1 << RETRO_DEVICE_KEYBOARD) |