(Android) Move input code to autoconfigs

This commit is contained in:
twinaphex 2014-08-19 14:10:01 +02:00
parent 3c2aed9564
commit 41bd5b3244

View File

@ -18,156 +18,6 @@ static void android_input_set_keybinds(void *data, unsigned device,
switch (device)
{
case DEVICE_KEYBOARD_RETROPAD:
g_settings.input.device[port] = device;
strlcpy(g_settings.input.device_names[port], "RetroKeyboard",
sizeof(g_settings.input.device_names[port]));
// Keyboard
// TODO: Map L2/R2/L3/R3
android->keycode_lut[54] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
android->keycode_lut[29] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
android->keycode_lut[60] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
android->keycode_lut[66] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
android->keycode_lut[19] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
android->keycode_lut[20] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
android->keycode_lut[21] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
android->keycode_lut[22] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
android->keycode_lut[52] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
android->keycode_lut[47] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
android->keycode_lut[45] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
android->keycode_lut[51] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
/* Misc control scheme */
android->keycode_lut[131] |= ((RARCH_MENU_TOGGLE + 1) << shift);
android->keycode_lut[132] |= ((RARCH_SAVE_STATE_KEY+1) << shift);
android->keycode_lut[134] |= ((RARCH_LOAD_STATE_KEY+1) << shift);
android->keycode_lut[137] |= ((RARCH_STATE_SLOT_PLUS+1) << shift);
android->keycode_lut[136] |= ((RARCH_STATE_SLOT_MINUS+1) << shift);
android->keycode_lut[62] |= ((RARCH_FAST_FORWARD_KEY+1) << shift);
android->keycode_lut[40] |= ((RARCH_FAST_FORWARD_HOLD_KEY+1) << shift);
android->keycode_lut[121] |= ((RARCH_PAUSE_TOGGLE+1) << shift);
android->keycode_lut[39] |= ((RARCH_FRAMEADVANCE+1) << shift);
android->keycode_lut[36] |= ((RARCH_RESET+1) << shift);
android->keycode_lut[46] |= ((RARCH_REWIND+1) << shift);
android->keycode_lut[139] |= ((RARCH_MUTE+1) << shift);
android->keycode_lut[111] |= ((RARCH_QUIT_KEY+1) << shift);
break;
case DEVICE_IDROID_CON:
g_settings.input.device[port] = device;
strlcpy(g_settings.input.device_names[port], "i.droid",
sizeof(g_settings.input.device_names[port]));
android->keycode_lut[189] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
android->keycode_lut[190] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
android->keycode_lut[188] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
android->keycode_lut[191] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
android->keycode_lut[192] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
android->keycode_lut[193] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
android->keycode_lut[194] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
android->keycode_lut[195] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
android->keycode_lut[196] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
android->keycode_lut[197] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
android->keycode_lut[198] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift);
android->keycode_lut[199] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift);
break;
case DEVICE_USB_2_AXIS_8_BUTTON_GAMEPAD:
g_settings.input.device[port] = device;
strlcpy(g_settings.input.device_names[port], "USB 2 Axis 8 button",
sizeof(g_settings.input.device_names[port]));
android->keycode_lut[188] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
android->keycode_lut[189] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
android->keycode_lut[190] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
android->keycode_lut[191] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
android->keycode_lut[192] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
android->keycode_lut[193] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
android->keycode_lut[194] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
android->keycode_lut[195] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
break;
case DEVICE_CYPRESS_USB:
g_settings.input.device[port] = device;
strlcpy(g_settings.input.device_names[port], "Cypress USB",
sizeof(g_settings.input.device_names[port]));
android->keycode_lut[96] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
android->keycode_lut[97] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
android->keycode_lut[98] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
android->keycode_lut[99] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
android->keycode_lut[100] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
android->keycode_lut[101] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
android->keycode_lut[102] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
android->keycode_lut[103] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
android->keycode_lut[104] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
break;
case DEVICE_TOODLES_2008_CHIMP:
g_settings.input.device[port] = device;
strlcpy(g_settings.input.device_names[port], "Toodles 2008 Chimp",
sizeof(g_settings.input.device_names[port]));
android->keycode_lut[96] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
android->keycode_lut[99] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
android->keycode_lut[101] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
android->keycode_lut[100] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
android->keycode_lut[97] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
android->keycode_lut[98] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
android->keycode_lut[103] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
android->keycode_lut[102] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
android->keycode_lut[104] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
android->keycode_lut[105] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
break;
case DEVICE_HOLTEK_JC_U912F:
g_settings.input.device[port] = device;
strlcpy(g_settings.input.device_names[port], "Elecom JC-U912F",
sizeof(g_settings.input.device_names[port]));
android->keycode_lut[195] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
android->keycode_lut[194] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
android->keycode_lut[193] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
android->keycode_lut[192] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
android->keycode_lut[188] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
android->keycode_lut[189] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
android->keycode_lut[190] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
android->keycode_lut[191] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
android->keycode_lut[196] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift);
android->keycode_lut[190] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift);
android->keycode_lut[198] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
android->keycode_lut[199] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
break;
case DEVICE_THRUST_PREDATOR:
g_settings.input.device[port] = device;
strlcpy(g_settings.input.device_names[port], "Trust Predator",
sizeof(g_settings.input.device_names[port]));
/* TODO: L3/R3 */
android->keycode_lut[189] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
android->keycode_lut[190] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
android->keycode_lut[191] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
android->keycode_lut[188] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
android->keycode_lut[194] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
android->keycode_lut[195] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
android->keycode_lut[192] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
android->keycode_lut[193] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
android->keycode_lut[196] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
android->keycode_lut[197] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
break;
case DEVICE_THRUSTMASTER_T_MINI:
g_settings.input.device[port] = device;
strlcpy(g_settings.input.device_names[port], "Thrustmaster T Mini",
sizeof(g_settings.input.device_names[port]));
android->keycode_lut[105]|= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
android->keycode_lut[104]|= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
android->keycode_lut[96]|= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
android->keycode_lut[99]|= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
android->keycode_lut[97]|= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
android->keycode_lut[98]|= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
android->keycode_lut[100]|= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
android->keycode_lut[101]|= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
android->keycode_lut[104]|= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
android->keycode_lut[103]|= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
break;
case DEVICE_CCPCREATIONS_WIIUSE_IME:
g_settings.input.device[port] = device;
strlcpy(g_settings.input.device_names[port], "ccpCreations WiiUse IME",