Move apple_key_map_hidusage over to input_common.c

This commit is contained in:
twinaphex 2014-10-03 15:31:34 +02:00
parent 5c09e6be84
commit de2392be89
4 changed files with 150 additions and 149 deletions

View File

@ -75,151 +75,6 @@ const struct apple_key_name_map_entry apple_key_name_map[] =
{ "nul", 0x00},
};
const struct rarch_key_map apple_key_map_hidusage[] =
{
{ KEY_Delete, RETROK_BACKSPACE },
{ KEY_Tab, RETROK_TAB },
// RETROK_CLEAR },
{ KEY_Enter, RETROK_RETURN },
{ KEY_Pause, RETROK_PAUSE },
{ KEY_Escape, RETROK_ESCAPE },
{ KEY_Space, RETROK_SPACE },
// RETROK_EXCLAIM },
// RETROK_QUOTEDBL },
// RETROK_HASH },
// RETROK_DOLLAR },
// RETROK_AMPERSAND },
{ KEY_Quote, RETROK_QUOTE },
// RETROK_LEFTPAREN },
// RETROK_RIGHTPAREN },
// RETROK_ASTERISK },
// RETROK_PLUS },
{ KEY_Comma, RETROK_COMMA },
{ KEY_Minus, RETROK_MINUS },
{ KEY_Period, RETROK_PERIOD },
{ KEY_Slash, RETROK_SLASH },
{ KEY_0, RETROK_0 },
{ KEY_1, RETROK_1 },
{ KEY_2, RETROK_2 },
{ KEY_3, RETROK_3 },
{ KEY_4, RETROK_4 },
{ KEY_5, RETROK_5 },
{ KEY_6, RETROK_6 },
{ KEY_7, RETROK_7 },
{ KEY_8, RETROK_8 },
{ KEY_9, RETROK_9 },
// RETROK_COLON },
{ KEY_Semicolon, RETROK_SEMICOLON },
// RETROK_LESS },
{ KEY_Equals, RETROK_EQUALS },
// RETROK_GREATER },
// RETROK_QUESTION },
// RETROK_AT },
{ KEY_LeftBracket, RETROK_LEFTBRACKET },
{ KEY_Backslash, RETROK_BACKSLASH },
{ KEY_RightBracket, RETROK_RIGHTBRACKET },
// RETROK_CARET },
// RETROK_UNDERSCORE },
{ KEY_Grave, RETROK_BACKQUOTE },
{ KEY_A, RETROK_a },
{ KEY_B, RETROK_b },
{ KEY_C, RETROK_c },
{ KEY_D, RETROK_d },
{ KEY_E, RETROK_e },
{ KEY_F, RETROK_f },
{ KEY_G, RETROK_g },
{ KEY_H, RETROK_h },
{ KEY_I, RETROK_i },
{ KEY_J, RETROK_j },
{ KEY_K, RETROK_k },
{ KEY_L, RETROK_l },
{ KEY_M, RETROK_m },
{ KEY_N, RETROK_n },
{ KEY_O, RETROK_o },
{ KEY_P, RETROK_p },
{ KEY_Q, RETROK_q },
{ KEY_R, RETROK_r },
{ KEY_S, RETROK_s },
{ KEY_T, RETROK_t },
{ KEY_U, RETROK_u },
{ KEY_V, RETROK_v },
{ KEY_W, RETROK_w },
{ KEY_X, RETROK_x },
{ KEY_Y, RETROK_y },
{ KEY_Z, RETROK_z },
{ KEY_DeleteForward, RETROK_DELETE },
{ KP_0, RETROK_KP0 },
{ KP_1, RETROK_KP1 },
{ KP_2, RETROK_KP2 },
{ KP_3, RETROK_KP3 },
{ KP_4, RETROK_KP4 },
{ KP_5, RETROK_KP5 },
{ KP_6, RETROK_KP6 },
{ KP_7, RETROK_KP7 },
{ KP_8, RETROK_KP8 },
{ KP_9, RETROK_KP9 },
{ KP_Point, RETROK_KP_PERIOD },
{ KP_Divide, RETROK_KP_DIVIDE },
{ KP_Multiply, RETROK_KP_MULTIPLY },
{ KP_Subtract, RETROK_KP_MINUS },
{ KP_Add, RETROK_KP_PLUS },
{ KP_Enter, RETROK_KP_ENTER },
{ KP_Equals, RETROK_KP_EQUALS },
{ KEY_Up, RETROK_UP },
{ KEY_Down, RETROK_DOWN },
{ KEY_Right, RETROK_RIGHT },
{ KEY_Left, RETROK_LEFT },
{ KEY_Insert, RETROK_INSERT },
{ KEY_Home, RETROK_HOME },
{ KEY_End, RETROK_END },
{ KEY_PageUp, RETROK_PAGEUP },
{ KEY_PageDown, RETROK_PAGEDOWN },
{ KEY_F1, RETROK_F1 },
{ KEY_F2, RETROK_F2 },
{ KEY_F3, RETROK_F3 },
{ KEY_F4, RETROK_F4 },
{ KEY_F5, RETROK_F5 },
{ KEY_F6, RETROK_F6 },
{ KEY_F7, RETROK_F7 },
{ KEY_F8, RETROK_F8 },
{ KEY_F9, RETROK_F9 },
{ KEY_F10, RETROK_F10 },
{ KEY_F11, RETROK_F11 },
{ KEY_F12, RETROK_F12 },
{ KEY_F13, RETROK_F13 },
{ KEY_F14, RETROK_F14 },
{ KEY_F15, RETROK_F15 },
// RETROK_NUMLOCK },
{ KEY_CapsLock, RETROK_CAPSLOCK },
// RETROK_SCROLLOCK },
{ KEY_RightShift, RETROK_RSHIFT },
{ KEY_LeftShift, RETROK_LSHIFT },
{ KEY_RightControl, RETROK_RCTRL },
{ KEY_LeftControl, RETROK_LCTRL },
{ KEY_RightAlt, RETROK_RALT },
{ KEY_LeftAlt, RETROK_LALT },
{ KEY_RightGUI, RETROK_RMETA },
{ KEY_LeftGUI, RETROK_RMETA },
// RETROK_LSUPER },
// RETROK_RSUPER },
// RETROK_MODE },
// RETROK_COMPOSE },
// RETROK_HELP },
{ KEY_PrintScreen, RETROK_PRINT },
// RETROK_SYSREQ },
// RETROK_BREAK },
{ KEY_Menu, RETROK_MENU },
// RETROK_POWER },
// RETROK_EURO },
// RETROK_UNDO },
{ 0, RETROK_UNKNOWN }
};
const char* apple_keycode_hidusage_to_name(uint32_t hid_usage)
{
for (int i = 0; apple_key_name_map[i].hid_id; i ++)
@ -421,7 +276,7 @@ int32_t apple_input_find_any_key(void)
#ifdef IOS
apple_gamecontroller_poll_all();
#endif
input_init_keyboard_lut(apple_key_map_hidusage);
input_init_keyboard_lut(rarch_key_map_apple_hid);
for (i = 0; apple_key_name_map[i].hid_id; i++)
if (apple->keys[apple_key_name_map[i].hid_id])
@ -504,7 +359,7 @@ static void *apple_input_init(void)
if (!apple)
return NULL;
input_init_keyboard_lut(apple_key_map_hidusage);
input_init_keyboard_lut(rarch_key_map_apple_hid);
apple->joypad = input_joypad_init_driver(g_settings.input.joypad_driver);

View File

@ -165,7 +165,6 @@ struct apple_key_name_map_entry
};
extern const struct apple_key_name_map_entry apple_key_name_map[];
extern const struct rarch_key_map apple_key_map_hidusage[];
const char* apple_keycode_hidusage_to_name(uint32_t hid_usage);

View File

@ -973,6 +973,152 @@ const struct rarch_key_map rarch_key_map_linux[] = {
};
#endif
#ifdef __APPLE__
const struct rarch_key_map rarch_key_map_apple_hid[] = {
{ KEY_Delete, RETROK_BACKSPACE },
{ KEY_Tab, RETROK_TAB },
//RETROK_CLEAR },
{ KEY_Enter, RETROK_RETURN },
{ KEY_Pause, RETROK_PAUSE },
{ KEY_Escape, RETROK_ESCAPE },
{ KEY_Space, RETROK_SPACE },
//RETROK_EXCLAIM },
//RETROK_QUOTEDBL },
//RETROK_HASH },
//RETROK_DOLLAR },
//RETROK_AMPERSAND },
{ KEY_Quote, RETROK_QUOTE },
//RETROK_LEFTPAREN },
//RETROK_RIGHTPAREN },
//RETROK_ASTERISK },
//RETROK_PLUS },
{ KEY_Comma, RETROK_COMMA },
{ KEY_Minus, RETROK_MINUS },
{ KEY_Period, RETROK_PERIOD },
{ KEY_Slash, RETROK_SLASH },
{ KEY_0, RETROK_0 },
{ KEY_1, RETROK_1 },
{ KEY_2, RETROK_2 },
{ KEY_3, RETROK_3 },
{ KEY_4, RETROK_4 },
{ KEY_5, RETROK_5 },
{ KEY_6, RETROK_6 },
{ KEY_7, RETROK_7 },
{ KEY_8, RETROK_8 },
{ KEY_9, RETROK_9 },
//RETROK_COLON },
{ KEY_Semicolon, RETROK_SEMICOLON },
//RETROK_LESS },
{ KEY_Equals, RETROK_EQUALS },
//RETROK_GREATER },
//RETROK_QUESTION },
//RETROK_AT },
{ KEY_LeftBracket, RETROK_LEFTBRACKET },
{ KEY_Backslash, RETROK_BACKSLASH },
{ KEY_RightBracket, RETROK_RIGHTBRACKET },
//RETROK_CARET },
//RETROK_UNDERSCORE },
{ KEY_Grave, RETROK_BACKQUOTE },
{ KEY_A, RETROK_a },
{ KEY_B, RETROK_b },
{ KEY_C, RETROK_c },
{ KEY_D, RETROK_d },
{ KEY_E, RETROK_e },
{ KEY_F, RETROK_f },
{ KEY_G, RETROK_g },
{ KEY_H, RETROK_h },
{ KEY_I, RETROK_i },
{ KEY_J, RETROK_j },
{ KEY_K, RETROK_k },
{ KEY_L, RETROK_l },
{ KEY_M, RETROK_m },
{ KEY_N, RETROK_n },
{ KEY_O, RETROK_o },
{ KEY_P, RETROK_p },
{ KEY_Q, RETROK_q },
{ KEY_R, RETROK_r },
{ KEY_S, RETROK_s },
{ KEY_T, RETROK_t },
{ KEY_U, RETROK_u },
{ KEY_V, RETROK_v },
{ KEY_W, RETROK_w },
{ KEY_X, RETROK_x },
{ KEY_Y, RETROK_y },
{ KEY_Z, RETROK_z },
{ KEY_DeleteForward, RETROK_DELETE },
{ KP_0, RETROK_KP0 },
{ KP_1, RETROK_KP1 },
{ KP_2, RETROK_KP2 },
{ KP_3, RETROK_KP3 },
{ KP_4, RETROK_KP4 },
{ KP_5, RETROK_KP5 },
{ KP_6, RETROK_KP6 },
{ KP_7, RETROK_KP7 },
{ KP_8, RETROK_KP8 },
{ KP_9, RETROK_KP9 },
{ KP_Point, RETROK_KP_PERIOD },
{ KP_Divide, RETROK_KP_DIVIDE },
{ KP_Multiply, RETROK_KP_MULTIPLY },
{ KP_Subtract, RETROK_KP_MINUS },
{ KP_Add, RETROK_KP_PLUS },
{ KP_Enter, RETROK_KP_ENTER },
{ KP_Equals, RETROK_KP_EQUALS },
{ KEY_Up, RETROK_UP },
{ KEY_Down, RETROK_DOWN },
{ KEY_Right, RETROK_RIGHT },
{ KEY_Left, RETROK_LEFT },
{ KEY_Insert, RETROK_INSERT },
{ KEY_Home, RETROK_HOME },
{ KEY_End, RETROK_END },
{ KEY_PageUp, RETROK_PAGEUP },
{ KEY_PageDown, RETROK_PAGEDOWN },
{ KEY_F1, RETROK_F1 },
{ KEY_F2, RETROK_F2 },
{ KEY_F3, RETROK_F3 },
{ KEY_F4, RETROK_F4 },
{ KEY_F5, RETROK_F5 },
{ KEY_F6, RETROK_F6 },
{ KEY_F7, RETROK_F7 },
{ KEY_F8, RETROK_F8 },
{ KEY_F9, RETROK_F9 },
{ KEY_F10, RETROK_F10 },
{ KEY_F11, RETROK_F11 },
{ KEY_F12, RETROK_F12 },
{ KEY_F13, RETROK_F13 },
{ KEY_F14, RETROK_F14 },
{ KEY_F15, RETROK_F15 },
//RETROK_NUMLOCK },
{ KEY_CapsLock, RETROK_CAPSLOCK },
//RETROK_SCROLLOCK },
{ KEY_RightShift, RETROK_RSHIFT },
{ KEY_LeftShift, RETROK_LSHIFT },
{ KEY_RightControl, RETROK_RCTRL },
{ KEY_LeftControl, RETROK_LCTRL },
{ KEY_RightAlt, RETROK_RALT },
{ KEY_LeftAlt, RETROK_LALT },
{ KEY_RightGUI, RETROK_RMETA },
{ KEY_LeftGUI, RETROK_RMETA },
//RETROK_LSUPER },
//RETROK_RSUPER },
//RETROK_MODE },
//RETROK_COMPOSE },
//RETROK_HELP },
{ KEY_PrintScreen, RETROK_PRINT },
//RETROK_SYSREQ },
//RETROK_BREAK },
{ KEY_Menu, RETROK_MENU },
//RETROK_POWER },
//RETROK_EURO },
//RETROK_UNDO },
{ 0, RETROK_UNKNOWN }
};
#endif
static enum retro_key rarch_keysym_lut[RETROK_LAST];
void input_init_keyboard_lut(const struct rarch_key_map *map)
@ -1191,7 +1337,7 @@ const struct input_key_map input_config_key_map[] = {
{ "ralt", RETROK_RALT },
/* Keys not referenced in any keyboard mapping
* (except perhaps apple_key_map_hidusage) */
* (except perhaps rarch_key_map_apple_hid) */
{ "caret", RETROK_CARET },
{ "underscore", RETROK_UNDERSCORE },
{ "exclaim", RETROK_EXCLAIM },

View File

@ -150,6 +150,7 @@ extern const struct rarch_key_map rarch_key_map_sdl2[];
extern const struct rarch_key_map rarch_key_map_dinput[];
extern const struct rarch_key_map rarch_key_map_rwebinput[];
extern const struct rarch_key_map rarch_key_map_linux[];
extern const struct rarch_key_map rarch_key_map_apple_hid[];
void input_init_keyboard_lut(const struct rarch_key_map *map);
enum retro_key input_translate_keysym_to_rk(unsigned sym);