(Android) Going to need a different way of identifying pads that identify

themselves by HID name 'Broadcom HID" - until then, this can go
This commit is contained in:
twinaphex 2014-06-14 03:29:13 +02:00
parent 341230c106
commit aeeb962b3d

View File

@ -361,148 +361,6 @@ static void android_input_set_keybinds(void *data, unsigned device,
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_BROADCOM_BLUETOOTH_HID:
RARCH_LOG("Bluetooth HID\n");
if ((g_settings.input.icade_count +1) < 4)
{
g_settings.input.device[port] = device;
g_settings.input.icade_count++;
RARCH_LOG("Using icade profile %u\n", g_settings.input.icade_count - 1);
switch(g_settings.input.icade_profile[g_settings.input.icade_count - 1]) /* was just incremented... */
{
case ICADE_PROFILE_RED_SAMURAI:
/* TODO: unsure about Select button here */
/* TODO: hookup right stick
* RStick Up: 37
* RStick Down: 39
* RStick Left:38
* RStick Right: 40 */
/* Red Samurai */
strlcpy(g_settings.input.device_names[port], "Red Samurai",
sizeof(g_settings.input.device_names[port]));
android->keycode_lut[51] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
android->keycode_lut[47] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
android->keycode_lut[29] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
android->keycode_lut[32]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+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[4] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
android->keycode_lut[66] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
android->keycode_lut[16] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift);
android->keycode_lut[7] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift);
android->keycode_lut[12] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
android->keycode_lut[13] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
android->keycode_lut[14] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
android->keycode_lut[15] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
/* unsure if the person meant the SNES-mapping here or whether it's the pad */
android->keycode_lut[8] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
android->keycode_lut[9] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
android->keycode_lut[10] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
android->keycode_lut[11] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
break;
case ICADE_PROFILE_IPEGA_PG9017:
strlcpy(g_settings.input.device_names[port], "iPega PG-9017",
sizeof(g_settings.input.device_names[port]));
/* This maps to SNES layout, not button labels on gamepad -- SNES layout has A to the right of B */
android->keycode_lut[188] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); /* Button labeled X on gamepad */
android->keycode_lut[189] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); /* Button labeled A on gamepad */
android->keycode_lut[190] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); /* Button labeled B on gamepad */
android->keycode_lut[191] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); /* Button labeled Y on gamepad */
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[196] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
android->keycode_lut[197] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
/* These don't work, in gamepad mode the dpad sends AXIS_HAT_X and AXIS_HAT_Y motion events
instead of button events, so they get processed by engine_handle_dpad_getaxisvalue() */
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);
break;
case ICADE_PROFILE_IPEGA_PG9017_MODE2:
strlcpy(g_settings.input.device_names[port], "iPega PG-9017 (Mode2)",
sizeof(g_settings.input.device_names[port]));
android->keycode_lut[AKEYCODE_M] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
android->keycode_lut[38] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
android->keycode_lut[39] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
android->keycode_lut[37] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
android->keycode_lut[45] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
android->keycode_lut[AKEYCODE_P] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
android->keycode_lut[46] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
android->keycode_lut[AKEYCODE_Y] |= ((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);
break;
case ICADE_PROFILE_G910:
strlcpy(g_settings.input.device_names[port], "G910",
sizeof(g_settings.input.device_names[port]));
/* Face buttons map to SNES layout, not button labels on gamepad -- SNES layout has A to the right of B */
android->keycode_lut[AKEYCODE_NUMPAD_LCK_3] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); /* Button labeled X on gamepad */
android->keycode_lut[AKEYCODE_NUMPAD_LCK_0] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); /* Button labeled A on gamepad */
android->keycode_lut[AKEYCODE_NUMPAD_LCK_1] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); /* Button labeled B on gamepad */
android->keycode_lut[AKEYCODE_NUMPAD_LCK_4] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); /* Button labeled Y on gamepad */
android->keycode_lut[AKEYCODE_NUMPAD_LCK_6] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
android->keycode_lut[AKEYCODE_NUMPAD_LCK_8] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
android->keycode_lut[AKEYCODE_NUMPAD_LCK_2] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift);
android->keycode_lut[AKEYCODE_NUMPAD_LCK_7] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
android->keycode_lut[AKEYCODE_NUMPAD_LCK_9] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
android->keycode_lut[AKEYCODE_NUMPAD_LCK_5] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift);
android->keycode_lut[AKEYCODE_NUMPAD_SUB] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
android->keycode_lut[AKEYCODE_OTHR_108] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
/* These don't work, in gamepad mode the dpad sends AXIS_HAT_X and AXIS_HAT_Y motion events
instead of button events, so they get processed by engine_handle_dpad_getaxisvalue() */
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);
break;
case ICADE_PROFILE_GAMESTOP_WIRELESS:
strlcpy(g_settings.input.device_names[port], "Gamestop Wireless",
sizeof(g_settings.input.device_names[port]));
android->keycode_lut[51] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
android->keycode_lut[47] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
android->keycode_lut[29] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
android->keycode_lut[32] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+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[10] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
android->keycode_lut[11] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
android->keycode_lut[8] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
android->keycode_lut[9] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
android->keycode_lut[12] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
android->keycode_lut[14] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
android->keycode_lut[111] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
android->keycode_lut[66] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
android->keycode_lut[13] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
android->keycode_lut[15] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
android->keycode_lut[16] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift);
android->keycode_lut[7] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift);
break;
case ICADE_PROFILE_MOGA_HERO_POWER:
strlcpy(g_settings.input.device_names[port], "Moga Hero Power",
sizeof(g_settings.input.device_names[port]));
android->keycode_lut[AKEYCODE_NUMPAD_LCK_0] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
android->keycode_lut[AKEYCODE_NUMPAD_LCK_1] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
android->keycode_lut[AKEYCODE_NUMPAD_LCK_3] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
android->keycode_lut[AKEYCODE_NUMPAD_LCK_4] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
android->keycode_lut[AKEYCODE_NUMPAD_LCK_6] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
android->keycode_lut[AKEYCODE_NUMPAD_LCK_7] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
android->keycode_lut[4] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
android->keycode_lut[AKEYCODE_OTHR_108] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
android->keycode_lut[106] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift);
android->keycode_lut[107] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift);
}
}
break;
case DEVICE_THRUST_PREDATOR:
g_settings.input.device[port] = device;
strlcpy(g_settings.input.device_names[port], "Trust Predator",
@ -706,21 +564,6 @@ static void android_input_set_keybinds(void *data, unsigned device,
android->keycode_lut[68] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
android->keycode_lut[127] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
break;
case DEVICE_NONE:
default:
g_settings.input.device[port] = 0;
strlcpy(g_settings.input.device_names[port], "Unknown",
sizeof(g_settings.input.device_names[port]));
break;
}
for (i = 0; i < RARCH_BIND_LIST_END; i++)
{
g_settings.input.binds[port][i].id = i;
g_settings.input.binds[port][i].joykey = g_settings.input.binds[port][i].def_joykey;
g_settings.input.binds[port][i].joyaxis = g_settings.input.binds[port][i].def_joyaxis;
}
android->keycode_lut[82] |= ((RARCH_MENU_TOGGLE + 1) << shift);
}
}