Replace deprecated HID APIs

This commit is contained in:
p-sam 2021-03-12 09:11:43 +00:00 committed by m4xw
parent 1bc588acbd
commit ac8a977492
3 changed files with 215 additions and 208 deletions

View File

@ -21,9 +21,9 @@
/* Abstraction of pointer coords */
#define TOUCH_AXIS_MAX 0x7fff
/* Size of rarch_key_map_switch */
#define SWITCH_NUM_SCANCODES 114
#define SWITCH_NUM_SCANCODES 110
/* See https://switchbrew.github.io/libnx/hid_8h.html */
#define SWITCH_MAX_SCANCODE 0xfb
#define SWITCH_MAX_SCANCODE 0xfb
#define MOUSE_MAX_X 1920
#define MOUSE_MAX_Y 1080
@ -115,7 +115,7 @@ typedef struct switch_input
bool mouse_button_left;
bool mouse_button_right;
bool mouse_button_middle;
uint64_t mouse_previous_report;
uint32_t mouse_previous_buttons;
/* touch mouse */
bool touch_mouse_indirect;
@ -150,14 +150,19 @@ static void finish_simulated_mouse_clicks(switch_input_t *sw, uint64_t currentTi
#ifdef HAVE_LIBNX
static void switch_input_poll(void *data)
{
MousePosition mouse_pos;
HidTouchScreenState touch_screen_state;
HidKeyboardState kbd_state;
HidMouseState mouse_state;
uint32_t touch_count;
bool key_pressed;
unsigned int i = 0;
int keySym = 0;
unsigned keyCode = 0;
int key_sym = 0;
unsigned key_code = 0;
uint16_t mod = 0;
uint64_t mouse_current_report = 0;
switch_input_t *sw = (switch_input_t*) data;
uint32_t touch_count = hidTouchCount();
hidGetTouchScreenStates(&touch_screen_state, 1);
touch_count = MIN(MULTITOUCH_LIMIT, touch_screen_state.count);
for (i = 0; i < MULTITOUCH_LIMIT; i++)
{
sw->previous_touch_state[i] = sw->touch_state[i];
@ -166,13 +171,11 @@ static void switch_input_poll(void *data)
if (sw->touch_state[i])
{
struct video_viewport vp;
touchPosition touch_position;
hidTouchRead(&touch_position, i);
sw->touch_previous_x[i] = sw->touch_x[i];
sw->touch_previous_y[i] = sw->touch_y[i];
sw->touch_x[i] = touch_position.px;
sw->touch_y[i] = touch_position.py;
sw->touch_x[i] = touch_screen_state.touches[i].x;
sw->touch_y[i] = touch_screen_state.touches[i].y;
/* convert from event coordinates to core and screen coordinates */
vp.x = 0;
@ -184,8 +187,8 @@ static void switch_input_poll(void *data)
video_driver_translate_coord_viewport_wrap(
&vp,
touch_position.px,
touch_position.py,
touch_screen_state.touches[i].x,
touch_screen_state.touches[i].y,
&sw->touch_x_viewport[i],
&sw->touch_y_viewport[i],
&sw->touch_x_screen[i],
@ -194,69 +197,68 @@ static void switch_input_poll(void *data)
}
mod = 0;
if (hidKeyboardHeld(KBD_LEFTALT) || hidKeyboardHeld(KBD_RIGHTALT))
hidGetKeyboardStates(&kbd_state, 1);
if (hidKeyboardStateGetKey(&kbd_state, HidKeyboardKey_LeftAlt) || hidKeyboardStateGetKey(&kbd_state, HidKeyboardKey_RightAlt))
mod |= RETROKMOD_ALT;
if (hidKeyboardHeld(KBD_LEFTCTRL) || hidKeyboardHeld(KBD_RIGHTCTRL))
if (hidKeyboardStateGetKey(&kbd_state, HidKeyboardKey_LeftControl) || hidKeyboardStateGetKey(&kbd_state, HidKeyboardKey_RightControl))
mod |= RETROKMOD_CTRL;
if (hidKeyboardHeld(KBD_LEFTSHIFT) || hidKeyboardHeld(KBD_RIGHTSHIFT))
if (hidKeyboardStateGetKey(&kbd_state, HidKeyboardKey_LeftShift) || hidKeyboardStateGetKey(&kbd_state, HidKeyboardKey_RightShift))
mod |= RETROKMOD_SHIFT;
for (i = 0; i < SWITCH_NUM_SCANCODES; i++)
{
keySym = rarch_key_map_switch[i].sym;
keyCode = input_keymaps_translate_keysym_to_rk(keySym);
if (hidKeyboardHeld(keySym) && !(sw->keyboard_state[keySym]))
key_sym = rarch_key_map_switch[i].sym;
key_code = input_keymaps_translate_keysym_to_rk(key_sym);
key_pressed = hidKeyboardStateGetKey(&kbd_state, key_sym);
if (key_pressed && !(sw->keyboard_state[key_sym]))
{
sw->keyboard_state[keySym] = true;
input_keyboard_event(true, keyCode, 0, mod, RETRO_DEVICE_KEYBOARD);
sw->keyboard_state[key_sym] = true;
input_keyboard_event(true, key_code, 0, mod, RETRO_DEVICE_KEYBOARD);
}
else if (!hidKeyboardHeld(keySym) && sw->keyboard_state[keySym])
else if (!key_pressed && sw->keyboard_state[key_sym])
{
sw->keyboard_state[keySym] = false;
input_keyboard_event(false, keyCode, 0, mod, RETRO_DEVICE_KEYBOARD);
sw->keyboard_state[key_sym] = false;
input_keyboard_event(false, key_code, 0, mod, RETRO_DEVICE_KEYBOARD);
}
}
/* update physical mouse buttons only when they change
* this allows the physical mouse and touch mouse to coexist */
mouse_current_report = hidMouseButtonsHeld();
if ((mouse_current_report & HidMouseButton_Left)
!= (sw->mouse_previous_report & HidMouseButton_Left))
hidGetMouseStates(&mouse_state, 1);
if ((mouse_state.buttons & HidMouseButton_Left)
!= (sw->mouse_previous_buttons & HidMouseButton_Left))
{
if (mouse_current_report & HidMouseButton_Left)
if (mouse_state.buttons & HidMouseButton_Left)
sw->mouse_button_left = true;
else
sw->mouse_button_left = false;
}
if ((mouse_current_report & HidMouseButton_Right)
!= (sw->mouse_previous_report & HidMouseButton_Right))
if ((mouse_state.buttons & HidMouseButton_Right)
!= (sw->mouse_previous_buttons & HidMouseButton_Right))
{
if (mouse_current_report & HidMouseButton_Right)
if (mouse_state.buttons & HidMouseButton_Right)
sw->mouse_button_right = true;
else
sw->mouse_button_right = false;
}
if ((mouse_current_report & HidMouseButton_Middle)
!= (sw->mouse_previous_report & HidMouseButton_Middle))
if ((mouse_state.buttons & HidMouseButton_Middle)
!= (sw->mouse_previous_buttons & HidMouseButton_Middle))
{
if (mouse_current_report & HidMouseButton_Middle)
if (mouse_state.buttons & HidMouseButton_Middle)
sw->mouse_button_middle = true;
else
sw->mouse_button_middle = false;
}
sw->mouse_previous_report = mouse_current_report;
sw->mouse_previous_buttons = mouse_state.buttons;
/* physical mouse position */
hidMouseRead(&mouse_pos);
sw->mouse_x_delta = mouse_state.delta_x;
sw->mouse_y_delta = mouse_state.delta_y;
sw->mouse_x_delta = mouse_pos.velocityX;
sw->mouse_y_delta = mouse_pos.velocityY;
sw->mouse_x += sw->mouse_x_delta;
sw->mouse_y += sw->mouse_y_delta;
sw->mouse_x = mouse_state.x;
sw->mouse_y = mouse_state.y;
/* touch mouse events
* handle_touch_mouse will update sw->mouse_* variables
@ -275,7 +277,7 @@ static void switch_input_poll(void *data)
else if (sw->mouse_y > MOUSE_MAX_Y)
sw->mouse_y = MOUSE_MAX_Y;
sw->mouse_wheel = mouse_pos.scrollVelocityY;
sw->mouse_wheel = mouse_state.wheel_delta_y;
}
#endif
@ -773,10 +775,6 @@ static void switch_input_free_input(void *data)
hidStopSixAxisSensor(sw->sixaxis_handles[i][j]);
free(sw);
#ifdef HAVE_LIBNX
hidExit();
#endif
}
static void* switch_input_init(const char *joypad_driver)
@ -789,7 +787,9 @@ static void* switch_input_init(const char *joypad_driver)
return NULL;
#ifdef HAVE_LIBNX
hidInitialize();
hidInitializeTouchScreen();
hidInitializeMouse();
hidInitializeKeyboard();
/*
Here we assume that the touch screen is always 1280x720
@ -802,7 +802,7 @@ static void* switch_input_init(const char *joypad_driver)
sw->mouse_x = 0;
sw->mouse_y = 0;
sw->mouse_previous_report = 0;
sw->mouse_previous_buttons = 0;
/* touch mouse init */
sw->touch_mouse_indirect = true;
@ -894,27 +894,34 @@ static float switch_input_get_sensor_input(void *data,
{
#ifdef HAVE_LIBNX
float f;
SixAxisSensorValues sixaxis;
unsigned int i;
HidSixAxisSensorState sixaxis;
switch_input_t *sw = (switch_input_t*) data;
if (id >= RETRO_SENSOR_ACCELEROMETER_X && id <= RETRO_SENSOR_GYROSCOPE_Z)
if (id >= RETRO_SENSOR_ACCELEROMETER_X && id <= RETRO_SENSOR_GYROSCOPE_Z
&& port < DEFAULT_MAX_PADS)
{
hidSixAxisSensorValuesRead(&sixaxis,
port == 0 ? CONTROLLER_P1_AUTO : port, 1);
for(i = 0; i < sw->sixaxis_handles_count[port]; i++)
{
hidGetSixAxisSensorStates(sw->sixaxis_handles[port][i], &sixaxis, 1);
if(sixaxis.delta_time)
break;
}
switch(id)
{
case RETRO_SENSOR_ACCELEROMETER_X:
return sixaxis.accelerometer.x;
return sixaxis.acceleration.x;
case RETRO_SENSOR_ACCELEROMETER_Y:
return sixaxis.accelerometer.y;
return sixaxis.acceleration.y;
case RETRO_SENSOR_ACCELEROMETER_Z:
return sixaxis.accelerometer.z;
return sixaxis.acceleration.z;
case RETRO_SENSOR_GYROSCOPE_X:
return sixaxis.gyroscope.x;
return sixaxis.angular_velocity.x;
case RETRO_SENSOR_GYROSCOPE_Y:
return sixaxis.gyroscope.y;
return sixaxis.angular_velocity.y;
case RETRO_SENSOR_GYROSCOPE_Z:
return sixaxis.gyroscope.z;
return sixaxis.angular_velocity.z;
}
}

View File

@ -23,9 +23,10 @@
extern uint64_t lifecycle_state;
/* TODO/FIXME - static globals */
static uint16_t pad_state[DEFAULT_MAX_PADS];
static uint16_t button_state[DEFAULT_MAX_PADS];
static int16_t analog_state[DEFAULT_MAX_PADS][2][2];
#ifdef HAVE_LIBNX
static PadState pad_states[DEFAULT_MAX_PADS];
static HidVibrationDeviceHandle vibration_handles[DEFAULT_MAX_PADS][2];
static HidVibrationDeviceHandle vibration_handleheld[2];
static HidVibrationValue vibration_values[DEFAULT_MAX_PADS][2];
@ -55,7 +56,7 @@ static void *switch_joypad_init(void *data)
{
#ifdef HAVE_LIBNX
unsigned i;
hidScanInput();
padConfigureInput(DEFAULT_MAX_PADS, HidNpadStyleSet_NpadStandard);
/* Switch like stop behavior with muted band channels
* and frequencies set to default. */
@ -66,6 +67,12 @@ static void *switch_joypad_init(void *data)
for (i = 0; i < DEFAULT_MAX_PADS; i++)
{
if(i == 0) {
padInitializeDefault(&pad_states[0]);
} else {
padInitialize(&pad_states[i], i);
}
padUpdate(&pad_states[i]);
switch_joypad_autodetect_add(i);
hidInitializeVibrationDevices(
vibration_handles[i], 2, i,
@ -90,14 +97,14 @@ static int16_t switch_joypad_button(unsigned port_num, uint16_t joykey)
{
if (port_num >= DEFAULT_MAX_PADS)
return 0;
return (pad_state[port_num] & (1 << joykey));
return (button_state[port_num] & (1 << joykey));
}
static void switch_joypad_get_buttons(unsigned port_num, input_bits_t *state)
{
if (port_num < DEFAULT_MAX_PADS)
{
BITS_COPY16_PTR(state, pad_state[port_num]);
BITS_COPY16_PTR(state, button_state[port_num]);
}
else
{
@ -170,7 +177,7 @@ static int16_t switch_joypad_state(
? binds[i].joyaxis : joypad_info->auto_binds[i].joyaxis;
if (
(uint16_t)joykey != NO_BTN
&& (pad_state[port_idx] & (1 << (uint16_t)joykey))
&& (button_state[port_idx] & (1 << (uint16_t)joykey))
)
ret |= ( 1 << i);
else if (joyaxis != AXIS_NONE &&
@ -184,7 +191,7 @@ static int16_t switch_joypad_state(
static bool switch_joypad_query_pad(unsigned pad)
{
return pad < DEFAULT_MAX_PADS && pad_state[pad];
return pad < DEFAULT_MAX_PADS && button_state[pad];
}
static void switch_joypad_destroy(void)
@ -218,10 +225,10 @@ static void switch_joypad_poll(void)
int i, handheld;
settings_t *settings = config_get_ptr();
hidScanInput();
padUpdate(&pad_states[0]);
handheld = padIsHandheld(&pad_states[0]);
handheld = hidGetHandheldMode();
if (previous_handheld == -1)
{
/* First call of this function, apply joycon settings
@ -330,21 +337,18 @@ static void switch_joypad_poll(void)
for (i = 0; i < DEFAULT_MAX_PADS; i++)
{
JoystickPosition joy_position_left, joy_position_right;
HidControllerID target = (i == 0) ? CONTROLLER_P1_AUTO : i;
pad_state[i] = hidKeysDown(target) | hidKeysHeld(target);
hidJoystickRead(&joy_position_left, target, JOYSTICK_LEFT);
hidJoystickRead(&joy_position_right, target, JOYSTICK_RIGHT);
HidAnalogStickState stick_left_state = padGetStickPos(&pad_states[i], 0);
HidAnalogStickState stick_right_state = padGetStickPos(&pad_states[i], 1);
button_state[i] = padGetButtons(&pad_states[i]);
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_LEFT]
[RETRO_DEVICE_ID_ANALOG_X] = joy_position_left.dx;
[RETRO_DEVICE_ID_ANALOG_X] = stick_left_state.x;
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_LEFT]
[RETRO_DEVICE_ID_ANALOG_Y] = -joy_position_left.dy;
[RETRO_DEVICE_ID_ANALOG_Y] = -stick_left_state.y;
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_RIGHT]
[RETRO_DEVICE_ID_ANALOG_X] = joy_position_right.dx;
[RETRO_DEVICE_ID_ANALOG_X] = stick_right_state.x;
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_RIGHT]
[RETRO_DEVICE_ID_ANALOG_Y] = -joy_position_right.dy;
[RETRO_DEVICE_ID_ANALOG_Y] = -stick_right_state.y;
}
}
#else
@ -355,7 +359,7 @@ static void switch_joypad_poll(void)
hid_controller_t *cont = &controllers[0];
hid_controller_state_entry_t ent = cont->main.entries[cont->main.latest_idx];
hid_controller_state_entry_t ent8 = (cont+8)->main.entries[(cont+8)->main.latest_idx];
pad_state[0] = ent.button_state | ent8.button_state;
button_state[0] = ent.button_state | ent8.button_state;
lsx = ent.left_stick_x;
lsy = ent.left_stick_y;
@ -365,15 +369,15 @@ static void switch_joypad_poll(void)
if (ent8.left_stick_x != 0 || ent8.left_stick_y != 0)
{
/* handheld overrides player 1 */
lsx = ent8.left_stick_x;
lsy = ent8.left_stick_y;
lsx = ent8.left_stick_x;
lsy = ent8.left_stick_y;
}
if (ent8.right_stick_x != 0 || ent8.right_stick_y != 0)
{
/* handheld overrides player 1 */
rsx = ent8.right_stick_x;
rsy = ent8.right_stick_y;
rsx = ent8.right_stick_x;
rsy = ent8.right_stick_y;
}
analog_state[0][RETRO_DEVICE_INDEX_ANALOG_LEFT]
@ -411,26 +415,26 @@ bool switch_joypad_set_rumble(unsigned pad,
vibration_values[pad][1].amp_high = amp;
}
handle = (pad == 0 && hidGetHandheldMode())
handle = (pad == 0 && !padIsNpadActive(&pad_states[0], HidNpadIdType_No1))
? vibration_handleheld : vibration_handles[pad];
return R_SUCCEEDED(hidSendVibrationValues(handle, vibration_values[pad], 2));
}
#endif
input_device_driver_t switch_joypad = {
switch_joypad_init,
switch_joypad_query_pad,
switch_joypad_destroy,
switch_joypad_button,
switch_joypad_init,
switch_joypad_query_pad,
switch_joypad_destroy,
switch_joypad_button,
switch_joypad_state,
switch_joypad_get_buttons,
switch_joypad_axis,
switch_joypad_poll,
switch_joypad_get_buttons,
switch_joypad_axis,
switch_joypad_poll,
#ifdef HAVE_LIBNX
switch_joypad_set_rumble,
#else
NULL, /* set_rumble */
NULL, /* set_rumble */
#endif
switch_joypad_name,
"switch"
switch_joypad_name,
"switch"
};

View File

@ -205,119 +205,115 @@ const struct input_key_map input_config_key_map[] = {
#ifdef HAVE_LIBNX
const struct rarch_key_map rarch_key_map_switch[] = {
{ KBD_A, RETROK_a },
{ KBD_B, RETROK_b },
{ KBD_C, RETROK_c },
{ KBD_D, RETROK_d },
{ KBD_E, RETROK_e },
{ KBD_F, RETROK_f },
{ KBD_G, RETROK_g },
{ KBD_H, RETROK_h },
{ KBD_I, RETROK_i },
{ KBD_J, RETROK_j },
{ KBD_K, RETROK_k },
{ KBD_L, RETROK_l },
{ KBD_M, RETROK_m },
{ KBD_N, RETROK_n },
{ KBD_O, RETROK_o },
{ KBD_P, RETROK_p },
{ KBD_Q, RETROK_q },
{ KBD_R, RETROK_r },
{ KBD_S, RETROK_s },
{ KBD_T, RETROK_t },
{ KBD_U, RETROK_u },
{ KBD_V, RETROK_v },
{ KBD_W, RETROK_w },
{ KBD_X, RETROK_x },
{ KBD_Y, RETROK_y },
{ KBD_Z, RETROK_z },
{ KBD_BACKSPACE, RETROK_BACKSPACE },
{ KBD_TAB, RETROK_TAB },
{ KBD_ENTER, RETROK_RETURN },
{ KBD_PAUSE, RETROK_PAUSE },
{ KBD_ESC, RETROK_ESCAPE },
{ KBD_SPACE, RETROK_SPACE },
{ KBD_HASHTILDE, RETROK_HASH },
{ KBD_APOSTROPHE, RETROK_QUOTE },
{ KBD_KPLEFTPAREN, RETROK_LEFTPAREN },
{ KBD_KPRIGHTPAREN, RETROK_RIGHTPAREN },
{ KBD_COMMA, RETROK_COMMA },
{ KBD_MINUS, RETROK_MINUS },
{ KBD_DOT, RETROK_PERIOD },
{ KBD_SLASH, RETROK_SLASH },
{ KBD_0, RETROK_0 },
{ KBD_1, RETROK_1 },
{ KBD_2, RETROK_2 },
{ KBD_3, RETROK_3 },
{ KBD_4, RETROK_4 },
{ KBD_5, RETROK_5 },
{ KBD_6, RETROK_6 },
{ KBD_7, RETROK_7 },
{ KBD_8, RETROK_8 },
{ KBD_9, RETROK_9 },
{ KBD_SEMICOLON, RETROK_SEMICOLON },
{ KBD_EQUAL, RETROK_EQUALS },
{ KBD_LEFTBRACE, RETROK_LEFTBRACKET },
{ KBD_BACKSLASH, RETROK_BACKSLASH },
{ KBD_RIGHTBRACE, RETROK_RIGHTBRACKET },
{ KBD_DELETE, RETROK_DELETE },
{ KBD_KP0, RETROK_KP0 },
{ KBD_KP1, RETROK_KP1 },
{ KBD_KP2, RETROK_KP2 },
{ KBD_KP3, RETROK_KP3 },
{ KBD_KP4, RETROK_KP4 },
{ KBD_KP5, RETROK_KP5 },
{ KBD_KP6, RETROK_KP6 },
{ KBD_KP7, RETROK_KP7 },
{ KBD_KP8, RETROK_KP8 },
{ KBD_KP9, RETROK_KP9 },
{ KBD_KPDOT, RETROK_KP_PERIOD },
{ KBD_KPSLASH, RETROK_KP_DIVIDE },
{ KBD_KPASTERISK, RETROK_KP_MULTIPLY },
{ KBD_KPMINUS, RETROK_KP_MINUS },
{ KBD_KPPLUS, RETROK_KP_PLUS },
{ KBD_KPENTER, RETROK_KP_ENTER },
{ KBD_KPEQUAL, RETROK_KP_EQUALS },
{ KBD_UP, RETROK_UP },
{ KBD_DOWN, RETROK_DOWN },
{ KBD_RIGHT, RETROK_RIGHT },
{ KBD_LEFT, RETROK_LEFT },
{ KBD_INSERT, RETROK_INSERT },
{ KBD_HOME, RETROK_HOME },
{ KBD_END, RETROK_END },
{ KBD_PAGEUP, RETROK_PAGEUP },
{ KBD_PAGEDOWN, RETROK_PAGEDOWN },
{ KBD_F1, RETROK_F1 },
{ KBD_F2, RETROK_F2 },
{ KBD_F3, RETROK_F3 },
{ KBD_F4, RETROK_F4 },
{ KBD_F5, RETROK_F5 },
{ KBD_F6, RETROK_F6 },
{ KBD_F7, RETROK_F7 },
{ KBD_F8, RETROK_F8 },
{ KBD_F9, RETROK_F9 },
{ KBD_F10, RETROK_F10 },
{ KBD_F11, RETROK_F11 },
{ KBD_F12, RETROK_F12 },
{ KBD_F13, RETROK_F13 },
{ KBD_F14, RETROK_F14 },
{ KBD_F15, RETROK_F15 },
{ KBD_NUMLOCK, RETROK_NUMLOCK },
{ KBD_CAPSLOCK, RETROK_CAPSLOCK },
{ KBD_SCROLLLOCK, RETROK_SCROLLOCK },
{ KBD_RIGHTSHIFT, RETROK_RSHIFT },
{ KBD_LEFTSHIFT, RETROK_LSHIFT },
{ KBD_RIGHTCTRL, RETROK_RCTRL },
{ KBD_LEFTCTRL, RETROK_LCTRL },
{ KBD_RIGHTALT, RETROK_RALT },
{ KBD_LEFTALT, RETROK_LALT },
{ KBD_LEFTMETA, RETROK_LMETA },
{ KBD_RIGHTMETA, RETROK_RMETA },
{ KBD_COMPOSE, RETROK_COMPOSE },
{ KBD_HELP, RETROK_HELP },
{ KBD_PAUSE, RETROK_BREAK },
{ KBD_POWER, RETROK_POWER },
{ KBD_UNDO, RETROK_UNDO },
{ HidKeyboardKey_A, RETROK_a },
{ HidKeyboardKey_B, RETROK_b },
{ HidKeyboardKey_C, RETROK_c },
{ HidKeyboardKey_D, RETROK_d },
{ HidKeyboardKey_E, RETROK_e },
{ HidKeyboardKey_F, RETROK_f },
{ HidKeyboardKey_G, RETROK_g },
{ HidKeyboardKey_H, RETROK_h },
{ HidKeyboardKey_I, RETROK_i },
{ HidKeyboardKey_J, RETROK_j },
{ HidKeyboardKey_K, RETROK_k },
{ HidKeyboardKey_L, RETROK_l },
{ HidKeyboardKey_M, RETROK_m },
{ HidKeyboardKey_N, RETROK_n },
{ HidKeyboardKey_O, RETROK_o },
{ HidKeyboardKey_P, RETROK_p },
{ HidKeyboardKey_Q, RETROK_q },
{ HidKeyboardKey_R, RETROK_r },
{ HidKeyboardKey_S, RETROK_s },
{ HidKeyboardKey_T, RETROK_t },
{ HidKeyboardKey_U, RETROK_u },
{ HidKeyboardKey_V, RETROK_v },
{ HidKeyboardKey_W, RETROK_w },
{ HidKeyboardKey_X, RETROK_x },
{ HidKeyboardKey_Y, RETROK_y },
{ HidKeyboardKey_Z, RETROK_z },
{ HidKeyboardKey_Backspace, RETROK_BACKSPACE },
{ HidKeyboardKey_Tab, RETROK_TAB },
{ HidKeyboardKey_Return, RETROK_RETURN },
{ HidKeyboardKey_Pause, RETROK_PAUSE },
{ HidKeyboardKey_Escape, RETROK_ESCAPE },
{ HidKeyboardKey_Space, RETROK_SPACE },
{ HidKeyboardKey_Tilde, RETROK_HASH },
{ HidKeyboardKey_Quote, RETROK_QUOTE },
{ HidKeyboardKey_Comma, RETROK_COMMA },
{ HidKeyboardKey_Minus, RETROK_MINUS },
{ HidKeyboardKey_Period, RETROK_PERIOD },
{ HidKeyboardKey_Slash, RETROK_SLASH },
{ HidKeyboardKey_D0, RETROK_0 },
{ HidKeyboardKey_D1, RETROK_1 },
{ HidKeyboardKey_D2, RETROK_2 },
{ HidKeyboardKey_D3, RETROK_3 },
{ HidKeyboardKey_D4, RETROK_4 },
{ HidKeyboardKey_D5, RETROK_5 },
{ HidKeyboardKey_D6, RETROK_6 },
{ HidKeyboardKey_D7, RETROK_7 },
{ HidKeyboardKey_D8, RETROK_8 },
{ HidKeyboardKey_D9, RETROK_9 },
{ HidKeyboardKey_Semicolon, RETROK_SEMICOLON },
{ HidKeyboardKey_Plus, RETROK_EQUALS },
{ HidKeyboardKey_OpenBracket, RETROK_LEFTBRACKET },
{ HidKeyboardKey_Pipe, RETROK_BACKSLASH },
{ HidKeyboardKey_CloseBracket, RETROK_RIGHTBRACKET },
{ HidKeyboardKey_Delete, RETROK_DELETE },
{ HidKeyboardKey_NumPad0, RETROK_KP0 },
{ HidKeyboardKey_NumPad1, RETROK_KP1 },
{ HidKeyboardKey_NumPad2, RETROK_KP2 },
{ HidKeyboardKey_NumPad3, RETROK_KP3 },
{ HidKeyboardKey_NumPad4, RETROK_KP4 },
{ HidKeyboardKey_NumPad5, RETROK_KP5 },
{ HidKeyboardKey_NumPad6, RETROK_KP6 },
{ HidKeyboardKey_NumPad7, RETROK_KP7 },
{ HidKeyboardKey_NumPad8, RETROK_KP8 },
{ HidKeyboardKey_NumPad9, RETROK_KP9 },
{ HidKeyboardKey_NumPadDot, RETROK_KP_PERIOD },
{ HidKeyboardKey_NumPadDivide, RETROK_KP_DIVIDE },
{ HidKeyboardKey_NumPadMultiply, RETROK_KP_MULTIPLY },
{ HidKeyboardKey_NumPadSubtract, RETROK_KP_MINUS },
{ HidKeyboardKey_NumPadAdd, RETROK_KP_PLUS },
{ HidKeyboardKey_NumPadEnter, RETROK_KP_ENTER },
{ HidKeyboardKey_NumPadEquals, RETROK_KP_EQUALS },
{ HidKeyboardKey_UpArrow, RETROK_UP },
{ HidKeyboardKey_DownArrow, RETROK_DOWN },
{ HidKeyboardKey_RightArrow, RETROK_RIGHT },
{ HidKeyboardKey_LeftArrow, RETROK_LEFT },
{ HidKeyboardKey_Insert, RETROK_INSERT },
{ HidKeyboardKey_Home, RETROK_HOME },
{ HidKeyboardKey_End, RETROK_END },
{ HidKeyboardKey_PageUp, RETROK_PAGEUP },
{ HidKeyboardKey_PageDown, RETROK_PAGEDOWN },
{ HidKeyboardKey_F1, RETROK_F1 },
{ HidKeyboardKey_F2, RETROK_F2 },
{ HidKeyboardKey_F3, RETROK_F3 },
{ HidKeyboardKey_F4, RETROK_F4 },
{ HidKeyboardKey_F5, RETROK_F5 },
{ HidKeyboardKey_F6, RETROK_F6 },
{ HidKeyboardKey_F7, RETROK_F7 },
{ HidKeyboardKey_F8, RETROK_F8 },
{ HidKeyboardKey_F9, RETROK_F9 },
{ HidKeyboardKey_F10, RETROK_F10 },
{ HidKeyboardKey_F11, RETROK_F11 },
{ HidKeyboardKey_F12, RETROK_F12 },
{ HidKeyboardKey_F13, RETROK_F13 },
{ HidKeyboardKey_F14, RETROK_F14 },
{ HidKeyboardKey_F15, RETROK_F15 },
{ HidKeyboardKey_NumLock, RETROK_NUMLOCK },
{ HidKeyboardKey_CapsLock, RETROK_CAPSLOCK },
{ HidKeyboardKey_ScrollLock, RETROK_SCROLLOCK },
{ HidKeyboardKey_RightShift, RETROK_RSHIFT },
{ HidKeyboardKey_LeftShift, RETROK_LSHIFT },
{ HidKeyboardKey_RightControl, RETROK_RCTRL },
{ HidKeyboardKey_LeftControl, RETROK_LCTRL },
{ HidKeyboardKey_RightAlt, RETROK_RALT },
{ HidKeyboardKey_LeftAlt, RETROK_LALT },
{ HidKeyboardKey_LeftGui, RETROK_LMETA },
{ HidKeyboardKey_RightGui, RETROK_RMETA },
{ HidKeyboardKey_Application, RETROK_COMPOSE },
{ HidKeyboardKey_Pause, RETROK_BREAK },
{ HidKeyboardKey_Power, RETROK_POWER },
{ 0, RETROK_UNKNOWN }
};
#endif