android/native/jni/input_android.c:

- Fixed off-by-one when using g_settings.input.icade_count to index in array of icade profiles. It has just been incremented...
- Added setting actual device names instead of generic "Broadcom Bluetooth HID" so the libretro menu shows it. Also added a bit of logging when detecting generic devices and selecting an icade profile.
- Fixed some wrong button assignments for iPega controller.
- Added a note about the dpad buttons not working, it's the next thing I want to fix.

android/phoenix/res/xml/prefs.xml:

- Fixed key names for icade profiles, input_autodetect_icade_profile_pad0 does not exist in the config as given in the root settings.c file, they start at 1.
This commit is contained in:
Jean-Sébastien Guay 2013-07-03 21:41:19 -04:00
parent b696388f34
commit 65cb65671f
2 changed files with 30 additions and 15 deletions

View File

@ -326,6 +326,8 @@ static void android_input_set_keybinds(void *data, unsigned device,
// 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_LOGITECH_RUMBLEPAD2:
@ -1224,14 +1226,14 @@ static void android_input_set_keybinds(void *data, unsigned device,
keycode_lut[AKEYCODE_BUTTON_START] |= ((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;
strlcpy(g_settings.input.device_names[port], "Broadcom Bluetooth HID",
sizeof(g_settings.input.device_names[port]));
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])
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 */
@ -1242,6 +1244,8 @@ static void android_input_set_keybinds(void *data, unsigned device,
* RStick Right: 40 */
/* Red Samurai */
strlcpy(g_settings.input.device_names[port], "Red Samurai",
sizeof(g_settings.input.device_names[port]));
keycode_lut[AKEYCODE_W] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
keycode_lut[AKEYCODE_S] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
keycode_lut[AKEYCODE_A] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
@ -1266,17 +1270,28 @@ static void android_input_set_keybinds(void *data, unsigned device,
keycode_lut[AKEYCODE_4] |= ((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]));
/* Todo: diagonals - patchy? */
keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
/* This maps to SNES layout, not button labels on gamepad -- SNES layout has A to the right of B */
keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); /* Button labeled X on gamepad */
keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); /* Button labeled A on gamepad */
keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); /* Button labeled B on gamepad */
keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); /* Button labeled Y on gamepad */
keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
/* These don't work, the dpad seems to send motion events instead of button events, so they get processed by
engine_handle_dpad_getaxisvalue() but it gets values of 0 for all axes... */
keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
keycode_lut[AKEYCODE_DPAD_RIGHT]|= ((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]));
keycode_lut[AKEYCODE_W] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
keycode_lut[AKEYCODE_S] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
keycode_lut[AKEYCODE_A] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);

View File

@ -189,25 +189,25 @@
<ListPreference
android:entries="@array/icade_profiles"
android:entryValues="@array/icade_profiles_values"
android:key="input_autodetect_icade_profile_pad0"
android:key="input_autodetect_icade_profile_pad1"
android:summary="Select the iCade profile to use for controller 1."
android:title="iCade profile Pad 1" />
<ListPreference
android:entries="@array/icade_profiles"
android:entryValues="@array/icade_profiles_values"
android:key="input_autodetect_icade_profile_pad1"
android:key="input_autodetect_icade_profile_pad2"
android:summary="Select the iCade profile to use for controller 2."
android:title="iCade profile Pad 2" />
<ListPreference
android:entries="@array/icade_profiles"
android:entryValues="@array/icade_profiles_values"
android:key="input_autodetect_icade_profile_pad2"
android:key="input_autodetect_icade_profile_pad3"
android:summary="Select the iCade profile to use for controller 3."
android:title="iCade profile Pad 3" />
<ListPreference
android:entries="@array/icade_profiles"
android:entryValues="@array/icade_profiles_values"
android:key="input_autodetect_icade_profile_pad3"
android:key="input_autodetect_icade_profile_pad4"
android:summary="Select the iCade profile to use for controller 4."
android:title="iCade profile Pad 4" />
</PreferenceCategory>