diff --git a/android/native/jni/input_android.c b/android/native/jni/input_android.c
index 9b024e003e..24f13a293e 100644
--- a/android/native/jni/input_android.c
+++ b/android/native/jni/input_android.c
@@ -2,6 +2,7 @@
* Copyright (C) 2010-2013 - Hans-Kristian Arntzen
* Copyright (C) 2011-2013 - Daniel De Matteis
* Copyright (C) 2012-2013 - Michael Lelli
+ * Copyright (C) 2013-2013 - Steven Crowe
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
@@ -60,6 +61,8 @@ enum
AXIS_HAT_Y = 16,
AXIS_LTRIGGER = 17,
AXIS_RTRIGGER = 18,
+ AXIS_GAS = 22,
+ AXIS_BRAKE = 23,
};
typedef struct android_input
@@ -132,6 +135,12 @@ static void engine_handle_dpad_getaxisvalue(void *data, AInputEvent *event,
float haty = AMotionEvent_getAxisValue(event, AXIS_HAT_Y, motion_pointer);
float ltrig = AMotionEvent_getAxisValue(event, AXIS_LTRIGGER, motion_pointer);
float rtrig = AMotionEvent_getAxisValue(event, AXIS_RTRIGGER, motion_pointer);
+
+ /* On some devices, the left and right triggers send AXIS_BRAKE / AXIS_GAS events, use those if AXIS_LTRIGGER / AXIS_RTRIGGER return zero */
+ if (ltrig == 0.0f)
+ ltrig = AMotionEvent_getAxisValue(event, AXIS_BRAKE, motion_pointer);
+ if (rtrig == 0.0f)
+ rtrig = AMotionEvent_getAxisValue(event, AXIS_GAS, motion_pointer);
*state_cur &= ~((1ULL << RETRO_DEVICE_ID_JOYPAD_LEFT) |
(1ULL << RETRO_DEVICE_ID_JOYPAD_L2) | (1ULL << RETRO_DEVICE_ID_JOYPAD_R2) |
@@ -168,7 +177,7 @@ static void engine_handle_dpad_getaxisvalue(void *data, AInputEvent *event,
}
if (debug_enable)
- snprintf(msg, msg_sizeof, "Pad %d : x %.2f, y %.2f, z %.2f, rz %.2f, src %d.\n",
+ snprintf(msg, msg_sizeof, "Pad %d : x %.2f, y %.2f, z %.2f, rz %.2f, src %d.\n",
state_id, x, y, z, rz, source);
}
@@ -1354,6 +1363,19 @@ static void android_input_set_keybinds(void *data, unsigned device,
android->keycode_lut[AKEYCODE_9] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift);
android->keycode_lut[AKEYCODE_0] |= ((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[AKEYCODE_BACK] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
+ android->keycode_lut[AKEYCODE_OTHR_108] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
+ android->keycode_lut[AKEYCODE_BUTTON_THUMBL] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift);
+ android->keycode_lut[AKEYCODE_BUTTON_THUMBR] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift);
}
}
break;
diff --git a/android/native/jni/input_autodetect.h b/android/native/jni/input_autodetect.h
index 2f9fdc3c85..7ed93fdb0a 100644
--- a/android/native/jni/input_autodetect.h
+++ b/android/native/jni/input_autodetect.h
@@ -1,6 +1,7 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2013 - Hans-Kristian Arntzen
* Copyright (C) 2011-2013 - Daniel De Matteis
+ * Copyright (C) 2013-2013 - Steven Crowe
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
@@ -27,6 +28,7 @@ enum {
ICADE_PROFILE_IPEGA_PG9017_MODE2,
ICADE_PROFILE_GAMESTOP_WIRELESS,
ICADE_PROFILE_G910,
+ ICADE_PROFILE_MOGA_HERO_POWER,
} icade_profile_enums;
enum {
diff --git a/android/phoenix/res/values/array.xml b/android/phoenix/res/values/array.xml
index d34d91f5b6..6f7a1d053e 100644
--- a/android/phoenix/res/values/array.xml
+++ b/android/phoenix/res/values/array.xml
@@ -52,6 +52,7 @@
- iPega PG-9017 (Mode 2)
- Gamestop Wireless
- G910
+ - Moga Hero Power
@@ -60,6 +61,7 @@
- 2
- 3
- 4
+ - 5