130 lines
8.8 KiB
Plaintext
130 lines
8.8 KiB
Plaintext
static void android_input_set_keybinds(void *data, unsigned device,
|
|
unsigned port, unsigned id, unsigned keybind_action)
|
|
{
|
|
android_input_t *android = (android_input_t*)data;
|
|
|
|
if (keybind_action & (1ULL << KEYBINDS_ACTION_SET_DEFAULT_BINDS))
|
|
{
|
|
int i;
|
|
|
|
/* eight 8-bit values are packed into one uint64_t
|
|
* one for each of the 8 pads */
|
|
unsigned shift = 8 + (port * 8);
|
|
|
|
// NOTE - we have to add '1' to the bit mask because
|
|
// RETRO_DEVICE_ID_JOYPAD_B is 0
|
|
|
|
RARCH_LOG("Detecting keybinds. Device %u port %u id %u keybind_action %u\n", device, port, id, keybind_action);
|
|
|
|
switch (device)
|
|
{
|
|
case DEVICE_CCPCREATIONS_WIIUSE_IME:
|
|
g_settings.input.device[port] = device;
|
|
strlcpy(g_settings.input.device_names[port], "ccpCreations WiiUse IME",
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
|
/* Player 1 */
|
|
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[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_UP+1) << shift);
|
|
android->keycode_lut[11] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
android->keycode_lut[12] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
android->keycode_lut[13] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
android->keycode_lut[AKEYCODE_M] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
android->keycode_lut[AKEYCODE_P] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
android->keycode_lut[33] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
android->keycode_lut[30] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
android->keycode_lut[34] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
android->keycode_lut[35] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
android->keycode_lut[31] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
android->keycode_lut[71] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
android->keycode_lut[72] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
android->keycode_lut[54] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
android->keycode_lut[36] |= ((RARCH_RESET+1) << shift);
|
|
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[31] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
android->keycode_lut[54] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
/* Player 2 */
|
|
shift += 8;
|
|
android->keycode_lut[37] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
android->keycode_lut[39] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
android->keycode_lut[38] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
android->keycode_lut[AKEYCODE_O]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
android->keycode_lut[55] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
android->keycode_lut[56] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
android->keycode_lut[24] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
android->keycode_lut[25] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
android->keycode_lut[88] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
android->keycode_lut[87] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
android->keycode_lut[126] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
android->keycode_lut[86] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
android->keycode_lut[6] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
android->keycode_lut[5] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
android->keycode_lut[81] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
android->keycode_lut[69] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
android->keycode_lut[73] |= ((RARCH_RESET+1) << shift);
|
|
android->keycode_lut[40] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
android->keycode_lut[46] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
android->keycode_lut[84] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
android->keycode_lut[61] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
/* Player 3 */
|
|
shift += 8;
|
|
android->keycode_lut[92] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
android->keycode_lut[93] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
android->keycode_lut[89] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
android->keycode_lut[90]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
android->keycode_lut[1]|= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
android->keycode_lut[2]|= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
android->keycode_lut[107]|= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
android->keycode_lut[106]|= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
android->keycode_lut[62]|= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
android->keycode_lut[63]|= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
android->keycode_lut[64]|= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
android->keycode_lut[65]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
android->keycode_lut[99]|= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
android->keycode_lut[100]|= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
android->keycode_lut[96]|= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
android->keycode_lut[97]|= ((RETRO_DEVICE_ID_JOYPAD_B+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_L2+1) << shift);
|
|
android->keycode_lut[105]|= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
/* Player 4 */
|
|
shift += 8;
|
|
android->keycode_lut[AKEYCODE_N] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
android->keycode_lut[45] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
android->keycode_lut[48] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
android->keycode_lut[75]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
android->keycode_lut[83]|= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
android->keycode_lut[91]|= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
android->keycode_lut[108]|= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
android->keycode_lut[109]|= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
android->keycode_lut[28]|= ((RARCH_RESET+1) << shift);
|
|
android->keycode_lut[115] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
android->keycode_lut[116] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
//android->keycode_lut[48] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); -- Left meta
|
|
//android->keycode_lut[75]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); -- right meta
|
|
android->keycode_lut[8] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
android->keycode_lut[120] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
android->keycode_lut[121] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
android->keycode_lut[122] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
android->keycode_lut[98] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
android->keycode_lut[101] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
android->keycode_lut[68] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
android->keycode_lut[127] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
break;
|
|
}
|
|
}
|
|
}
|