mirror of
https://github.com/libretro/RetroArch
synced 2025-01-31 06:32:48 +00:00
Cut down on some extra ifdefs
This commit is contained in:
parent
3ff521ab0b
commit
bf06d67a30
@ -92,6 +92,7 @@ typedef struct psp_input
|
|||||||
|
|
||||||
static void psp_input_poll(void *data)
|
static void psp_input_poll(void *data)
|
||||||
{
|
{
|
||||||
|
psp_input_t *psp = (psp_input_t*)data;
|
||||||
#ifdef VITA
|
#ifdef VITA
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
int key_sym = 0;
|
int key_sym = 0;
|
||||||
@ -105,13 +106,7 @@ static void psp_input_poll(void *data)
|
|||||||
int mouse_velocity_y = 0;
|
int mouse_velocity_y = 0;
|
||||||
SceHidKeyboardReport k_reports[SCE_HID_MAX_REPORT];
|
SceHidKeyboardReport k_reports[SCE_HID_MAX_REPORT];
|
||||||
SceHidMouseReport m_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)
|
if (psp->keyboard_hid_handle > 0)
|
||||||
{
|
{
|
||||||
numReports = sceHidKeyboardRead(
|
numReports = sceHidKeyboardRead(
|
||||||
@ -225,6 +220,7 @@ static void psp_input_poll(void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
psp->mouse_x_delta = mouse_velocity_x;
|
psp->mouse_x_delta = mouse_velocity_x;
|
||||||
psp->mouse_y_delta = mouse_velocity_y;
|
psp->mouse_y_delta = mouse_velocity_y;
|
||||||
psp->mouse_x += mouse_velocity_x;
|
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)
|
else if (psp->mouse_y > MOUSE_MAX_Y)
|
||||||
psp->mouse_y = MOUSE_MAX_Y;
|
psp->mouse_y = MOUSE_MAX_Y;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (psp && psp->joypad)
|
||||||
|
psp->joypad->poll();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VITA
|
#ifdef VITA
|
||||||
@ -337,18 +336,18 @@ static void psp_input_free_input(void *data)
|
|||||||
|
|
||||||
static void* psp_input_initialize(const char *joypad_driver)
|
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));
|
psp_input_t *psp = (psp_input_t*)calloc(1, sizeof(*psp));
|
||||||
if (!psp)
|
if (!psp)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
psp->joypad = input_joypad_init_driver(joypad_driver, psp);
|
|
||||||
|
|
||||||
#ifdef VITA
|
#ifdef VITA
|
||||||
sceHidKeyboardEnumerate(&(psp->keyboard_hid_handle), 1);
|
sceHidKeyboardEnumerate(&(psp->keyboard_hid_handle), 1);
|
||||||
sceHidMouseEnumerate(&(psp->mouse_hid_handle), 1);
|
sceHidMouseEnumerate(&(psp->mouse_hid_handle), 1);
|
||||||
|
|
||||||
input_keymaps_init_keyboard_lut(rarch_key_map_vita);
|
input_keymaps_init_keyboard_lut(rarch_key_map_vita);
|
||||||
unsigned int i;
|
|
||||||
for (i = 0; i <= VITA_MAX_SCANCODE; i++)
|
for (i = 0; i <= VITA_MAX_SCANCODE; i++)
|
||||||
psp->keyboard_state[i] = false;
|
psp->keyboard_state[i] = false;
|
||||||
for (i = 0; i < 6; i++)
|
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_x = 0;
|
||||||
psp->mouse_y = 0;
|
psp->mouse_y = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
psp->joypad = input_joypad_init_driver(joypad_driver, psp);
|
||||||
|
|
||||||
return psp;
|
return psp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,12 +56,12 @@ static void kb_disconnection_callback(KBDKeyEvent *key)
|
|||||||
|
|
||||||
static void kb_key_callback(KBDKeyEvent *key)
|
static void kb_key_callback(KBDKeyEvent *key)
|
||||||
{
|
{
|
||||||
uint16_t mod = 0;
|
uint16_t mod = 0;
|
||||||
unsigned code = 0;
|
unsigned code = 0;
|
||||||
bool pressed = false;
|
bool pressed = false;
|
||||||
|
|
||||||
if (key->state > 0)
|
if (key->state > 0)
|
||||||
pressed = true;
|
pressed = true;
|
||||||
|
|
||||||
code = input_keymaps_translate_keysym_to_rk(
|
code = input_keymaps_translate_keysym_to_rk(
|
||||||
key->scancode);
|
key->scancode);
|
||||||
@ -69,22 +69,22 @@ static void kb_key_callback(KBDKeyEvent *key)
|
|||||||
keyboard_state[code] = pressed;
|
keyboard_state[code] = pressed;
|
||||||
|
|
||||||
if (key->modifier & KBD_WIIU_SHIFT)
|
if (key->modifier & KBD_WIIU_SHIFT)
|
||||||
mod |= RETROKMOD_SHIFT;
|
mod |= RETROKMOD_SHIFT;
|
||||||
|
|
||||||
if (key->modifier & KBD_WIIU_CTRL)
|
if (key->modifier & KBD_WIIU_CTRL)
|
||||||
mod |= RETROKMOD_CTRL;
|
mod |= RETROKMOD_CTRL;
|
||||||
|
|
||||||
if (key->modifier & KBD_WIIU_ALT)
|
if (key->modifier & KBD_WIIU_ALT)
|
||||||
mod |= RETROKMOD_ALT;
|
mod |= RETROKMOD_ALT;
|
||||||
|
|
||||||
if (key->modifier & KBD_WIIU_NUM_LOCK)
|
if (key->modifier & KBD_WIIU_NUM_LOCK)
|
||||||
mod |= RETROKMOD_NUMLOCK;
|
mod |= RETROKMOD_NUMLOCK;
|
||||||
|
|
||||||
if (key->modifier & KBD_WIIU_CAPS_LOCK)
|
if (key->modifier & KBD_WIIU_CAPS_LOCK)
|
||||||
mod |= RETROKMOD_CAPSLOCK;
|
mod |= RETROKMOD_CAPSLOCK;
|
||||||
|
|
||||||
if (key->modifier & KBD_WIIU_SCROLL_LOCK)
|
if (key->modifier & KBD_WIIU_SCROLL_LOCK)
|
||||||
mod |= RETROKMOD_SCROLLOCK;
|
mod |= RETROKMOD_SCROLLOCK;
|
||||||
|
|
||||||
input_keyboard_event(pressed, code, (char)key->UTF16, mod,
|
input_keyboard_event(pressed, code, (char)key->UTF16, mod,
|
||||||
RETRO_DEVICE_KEYBOARD);
|
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)
|
static uint64_t wiiu_input_get_capabilities(void *data)
|
||||||
{
|
{
|
||||||
(void)data;
|
|
||||||
|
|
||||||
return (1 << RETRO_DEVICE_JOYPAD) |
|
return (1 << RETRO_DEVICE_JOYPAD) |
|
||||||
(1 << RETRO_DEVICE_ANALOG) |
|
(1 << RETRO_DEVICE_ANALOG) |
|
||||||
(1 << RETRO_DEVICE_KEYBOARD) |
|
(1 << RETRO_DEVICE_KEYBOARD) |
|
||||||
|
Loading…
x
Reference in New Issue
Block a user