2012-10-16 17:46:31 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2014-01-01 00:50:59 +00:00
|
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
|
|
|
* Copyright (C) 2011-2014 - Daniel De Matteis
|
|
|
|
* Copyright (C) 2012-2014 - Michael Lelli
|
|
|
|
* Copyright (C) 2013-2014 - Steven Crowe
|
2012-10-16 17:46:31 +00:00
|
|
|
*
|
|
|
|
* 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-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2012-10-28 21:20:22 +00:00
|
|
|
#include <android/keycodes.h>
|
2012-11-01 04:48:20 +00:00
|
|
|
#include <unistd.h>
|
2013-03-03 22:17:16 +00:00
|
|
|
#include <dlfcn.h>
|
2012-12-31 17:02:20 +00:00
|
|
|
#include "input_autodetect.h"
|
2013-11-03 16:02:40 +00:00
|
|
|
#include "../../../frontend/platform/platform_android.h"
|
2012-12-21 00:31:01 +00:00
|
|
|
#include "../../../input/input_common.h"
|
2012-11-01 05:21:18 +00:00
|
|
|
#include "../../../performance.h"
|
2012-10-16 17:46:31 +00:00
|
|
|
#include "../../../general.h"
|
|
|
|
#include "../../../driver.h"
|
2012-11-17 20:36:22 +00:00
|
|
|
|
2013-01-08 23:39:32 +00:00
|
|
|
#define MAX_TOUCH 16
|
2013-11-01 15:33:32 +00:00
|
|
|
#define PRESSED_UP(x, y) ((y <= dzone_min))
|
|
|
|
#define PRESSED_DOWN(x, y) ((y >= dzone_max))
|
|
|
|
#define PRESSED_LEFT(x, y) ((x <= dzone_min))
|
|
|
|
#define PRESSED_RIGHT(x, y) ((x >= dzone_max))
|
2012-10-28 21:20:22 +00:00
|
|
|
|
2013-11-02 23:27:58 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
float x;
|
|
|
|
float y;
|
|
|
|
float z;
|
|
|
|
} sensor_t;
|
|
|
|
|
2012-12-27 22:03:35 +00:00
|
|
|
struct input_pointer
|
|
|
|
{
|
|
|
|
int16_t x, y;
|
2013-01-11 15:32:49 +00:00
|
|
|
int16_t full_x, full_y;
|
2012-12-27 22:03:35 +00:00
|
|
|
};
|
|
|
|
|
2013-03-04 01:19:11 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
AXIS_X = 0,
|
|
|
|
AXIS_Y = 1,
|
|
|
|
AXIS_Z = 11,
|
2013-07-12 02:11:08 +00:00
|
|
|
AXIS_RZ = 14,
|
|
|
|
AXIS_HAT_X = 15,
|
2013-07-31 17:04:28 +00:00
|
|
|
AXIS_HAT_Y = 16,
|
|
|
|
AXIS_LTRIGGER = 17,
|
|
|
|
AXIS_RTRIGGER = 18,
|
2013-12-16 16:08:06 +00:00
|
|
|
AXIS_GAS = 22,
|
|
|
|
AXIS_BRAKE = 23,
|
2013-03-04 01:19:11 +00:00
|
|
|
};
|
2013-03-03 22:17:16 +00:00
|
|
|
|
2014-06-07 03:41:02 +00:00
|
|
|
#define MAX_AXIS 10
|
|
|
|
|
2013-11-01 15:33:32 +00:00
|
|
|
typedef struct android_input
|
|
|
|
{
|
2013-11-20 18:00:21 +00:00
|
|
|
jmethodID onBackPressed;
|
2013-11-01 15:33:32 +00:00
|
|
|
unsigned pads_connected;
|
|
|
|
int state_device_ids[MAX_PADS];
|
2014-06-07 03:41:02 +00:00
|
|
|
uint8_t pad_state[MAX_PADS][(LAST_KEYCODE + 7) / 8];
|
|
|
|
|
2013-11-01 15:33:32 +00:00
|
|
|
uint64_t keycode_lut[LAST_KEYCODE];
|
2014-06-07 03:41:02 +00:00
|
|
|
int16_t analog_state[MAX_PADS][MAX_AXIS];
|
2013-11-02 23:27:58 +00:00
|
|
|
sensor_t accelerometer_state;
|
2013-11-01 15:33:32 +00:00
|
|
|
unsigned dpad_emulation[MAX_PLAYERS];
|
|
|
|
struct input_pointer pointer[MAX_TOUCH];
|
|
|
|
unsigned pointer_count;
|
2013-11-02 23:27:58 +00:00
|
|
|
ASensorManager* sensorManager;
|
|
|
|
ASensorEventQueue* sensorEventQueue;
|
2013-11-01 15:33:32 +00:00
|
|
|
} android_input_t;
|
|
|
|
|
2014-06-02 11:42:24 +00:00
|
|
|
extern const rarch_joypad_driver_t android_joypad;
|
|
|
|
|
2014-06-07 03:41:02 +00:00
|
|
|
void (*engine_handle_dpad)(void *data, AInputEvent*, int, char*, size_t, int, bool, unsigned);
|
2013-11-03 11:06:14 +00:00
|
|
|
static bool android_input_set_sensor_state(void *data, unsigned port, enum retro_sensor_action action, unsigned event_rate);
|
2013-03-04 10:18:22 +00:00
|
|
|
|
|
|
|
extern float AMotionEvent_getAxisValue(const AInputEvent* motion_event,
|
|
|
|
int32_t axis, size_t pointer_index);
|
2013-03-03 22:17:16 +00:00
|
|
|
|
|
|
|
static typeof(AMotionEvent_getAxisValue) *p_AMotionEvent_getAxisValue;
|
|
|
|
|
|
|
|
#define AMotionEvent_getAxisValue (*p_AMotionEvent_getAxisValue)
|
|
|
|
|
2014-06-07 03:41:02 +00:00
|
|
|
static inline bool get_bit(const uint8_t *buf, unsigned bit)
|
|
|
|
{
|
|
|
|
return buf[bit >> 3] & (1 << (bit & 7));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void clear_bit(uint8_t *buf, unsigned bit)
|
|
|
|
{
|
|
|
|
buf[bit >> 3] &= ~(1 << (bit & 7));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void set_bit(uint8_t *buf, unsigned bit)
|
|
|
|
{
|
|
|
|
buf[bit >> 3] |= 1 << (bit & 7);
|
|
|
|
}
|
|
|
|
|
2013-11-01 15:33:32 +00:00
|
|
|
static void engine_handle_dpad_default(void *data, AInputEvent *event,
|
2014-06-07 03:41:02 +00:00
|
|
|
int port, char *msg, size_t msg_sizeof,
|
2013-07-31 17:04:28 +00:00
|
|
|
int source, bool debug_enable, unsigned emulation)
|
2013-03-04 10:18:22 +00:00
|
|
|
{
|
2014-06-07 03:41:02 +00:00
|
|
|
size_t motion_pointer = AMotionEvent_getAction(event) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
|
2013-11-01 15:33:32 +00:00
|
|
|
android_input_t *android = (android_input_t*)data;
|
2013-08-12 20:24:26 +00:00
|
|
|
float dzone_min = -g_settings.input.axis_threshold;
|
|
|
|
float dzone_max = g_settings.input.axis_threshold;
|
2013-03-04 10:18:22 +00:00
|
|
|
float x = AMotionEvent_getX(event, motion_pointer);
|
|
|
|
float y = AMotionEvent_getY(event, motion_pointer);
|
|
|
|
|
2014-06-07 03:41:02 +00:00
|
|
|
android->analog_state[port][0] = (int16_t)(x * 32767.0f);
|
|
|
|
android->analog_state[port][1] = (int16_t)(y * 32767.0f);
|
2013-03-04 10:18:22 +00:00
|
|
|
|
|
|
|
if (debug_enable)
|
|
|
|
snprintf(msg, msg_sizeof, "Pad %d : x = %.2f, y = %.2f, src %d.\n",
|
2014-06-02 12:28:26 +00:00
|
|
|
port, x, y, source);
|
2013-03-04 10:18:22 +00:00
|
|
|
}
|
|
|
|
|
2013-11-01 15:33:32 +00:00
|
|
|
static void engine_handle_dpad_getaxisvalue(void *data, AInputEvent *event,
|
2014-06-07 03:41:02 +00:00
|
|
|
int port, char *msg, size_t msg_sizeof, int source,
|
2013-07-31 17:04:28 +00:00
|
|
|
bool debug_enable, unsigned emulation)
|
2013-03-04 10:18:22 +00:00
|
|
|
{
|
2014-06-07 03:41:02 +00:00
|
|
|
size_t motion_pointer = AMotionEvent_getAction(event) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
|
2013-11-01 15:33:32 +00:00
|
|
|
android_input_t *android = (android_input_t*)data;
|
2013-03-04 10:18:22 +00:00
|
|
|
float x = AMotionEvent_getAxisValue(event, AXIS_X, motion_pointer);
|
|
|
|
float y = AMotionEvent_getAxisValue(event, AXIS_Y, motion_pointer);
|
|
|
|
float z = AMotionEvent_getAxisValue(event, AXIS_Z, motion_pointer);
|
|
|
|
float rz = AMotionEvent_getAxisValue(event, AXIS_RZ, motion_pointer);
|
2013-07-12 02:11:08 +00:00
|
|
|
float hatx = AMotionEvent_getAxisValue(event, AXIS_HAT_X, motion_pointer);
|
|
|
|
float haty = AMotionEvent_getAxisValue(event, AXIS_HAT_Y, motion_pointer);
|
2013-07-31 17:04:28 +00:00
|
|
|
float ltrig = AMotionEvent_getAxisValue(event, AXIS_LTRIGGER, motion_pointer);
|
|
|
|
float rtrig = AMotionEvent_getAxisValue(event, AXIS_RTRIGGER, motion_pointer);
|
2014-06-07 03:41:02 +00:00
|
|
|
float brake = AMotionEvent_getAxisValue(event, AXIS_BRAKE, motion_pointer);
|
|
|
|
float gas = AMotionEvent_getAxisValue(event, AXIS_GAS, motion_pointer);
|
|
|
|
|
|
|
|
// XXX: this could be a loop instead, but do we really want to loop through every axis?
|
|
|
|
android->analog_state[port][0] = (int16_t)(x * 32767.0f);
|
|
|
|
android->analog_state[port][1] = (int16_t)(y * 32767.0f);
|
|
|
|
android->analog_state[port][2] = (int16_t)(z * 32767.0f);
|
|
|
|
android->analog_state[port][3] = (int16_t)(rz * 32767.0f);
|
|
|
|
android->analog_state[port][4] = (int16_t)(hatx * 32767.0f);
|
|
|
|
android->analog_state[port][5] = (int16_t)(haty * 32767.0f);
|
|
|
|
android->analog_state[port][6] = (int16_t)(ltrig * 32767.0f);
|
|
|
|
android->analog_state[port][7] = (int16_t)(rtrig * 32767.0f);
|
|
|
|
android->analog_state[port][8] = (int16_t)(brake * 32767.0f);
|
|
|
|
android->analog_state[port][9] = (int16_t)(gas * 32767.0f);
|
2013-07-31 17:04:28 +00:00
|
|
|
|
2013-03-04 10:18:22 +00:00
|
|
|
if (debug_enable)
|
2013-12-16 16:08:06 +00:00
|
|
|
snprintf(msg, msg_sizeof, "Pad %d : x %.2f, y %.2f, z %.2f, rz %.2f, src %d.\n",
|
2014-06-02 12:28:26 +00:00
|
|
|
port, x, y, z, rz, source);
|
2013-03-04 10:18:22 +00:00
|
|
|
}
|
|
|
|
|
2014-01-08 23:02:14 +00:00
|
|
|
static bool android_input_use_keycode_lut;
|
|
|
|
static uint64_t android_input_keycode_lut[LAST_KEYCODE];
|
|
|
|
|
2013-03-02 21:56:58 +00:00
|
|
|
static void *android_input_init(void)
|
|
|
|
{
|
2013-11-20 18:00:21 +00:00
|
|
|
JNIEnv *env;
|
|
|
|
jclass class;
|
2013-03-13 22:17:33 +00:00
|
|
|
unsigned i, j, k;
|
2013-11-20 18:00:21 +00:00
|
|
|
struct android_app *android_app = (struct android_app*)g_android;
|
2013-11-01 15:33:32 +00:00
|
|
|
android_input_t *android = (android_input_t*)calloc(1, sizeof(*android));
|
|
|
|
if (!android)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
android->pads_connected = 0;
|
2013-03-02 21:56:58 +00:00
|
|
|
|
2014-01-08 23:02:14 +00:00
|
|
|
// TODO: rewrite code to not change input binds
|
2014-06-07 03:41:02 +00:00
|
|
|
/*
|
2014-01-08 23:02:14 +00:00
|
|
|
if (!android_input_use_keycode_lut)
|
2013-03-13 22:17:33 +00:00
|
|
|
{
|
2014-01-08 23:02:14 +00:00
|
|
|
for (j = 0; j < LAST_KEYCODE; j++)
|
|
|
|
android_input_keycode_lut[j] = 0;
|
|
|
|
|
|
|
|
if (!g_settings.input.autodetect_enable)
|
2013-03-13 22:17:33 +00:00
|
|
|
{
|
2014-01-08 23:02:14 +00:00
|
|
|
for (j = 0; j < MAX_PADS; j++)
|
2013-03-13 22:17:33 +00:00
|
|
|
{
|
2014-01-08 23:02:14 +00:00
|
|
|
uint8_t shift = 8 + (j * 8);
|
|
|
|
for (k = 0; k < RARCH_FIRST_CUSTOM_BIND; k++)
|
2013-03-13 22:17:33 +00:00
|
|
|
{
|
2014-01-08 23:02:14 +00:00
|
|
|
if (g_settings.input.binds[j][k].valid && g_settings.input.binds[j][k].joykey && g_settings.input.binds[j][k].joykey < LAST_KEYCODE)
|
|
|
|
{
|
|
|
|
RARCH_LOG("binding %llu to %d (p%d)\n", g_settings.input.binds[j][k].joykey, k, j);
|
|
|
|
android_input_keycode_lut[g_settings.input.binds[j][k].joykey] |= ((k + 1) << shift);
|
|
|
|
}
|
2013-03-13 22:17:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-01-08 23:02:14 +00:00
|
|
|
|
|
|
|
android_input_use_keycode_lut = true;
|
2013-03-13 22:17:33 +00:00
|
|
|
}
|
2013-03-02 21:56:58 +00:00
|
|
|
|
2014-01-08 23:02:14 +00:00
|
|
|
memcpy(android->keycode_lut, android_input_keycode_lut, sizeof(android_input_keycode_lut));
|
|
|
|
|
2013-07-31 17:04:28 +00:00
|
|
|
for (i = 0; i < MAX_PADS; i++)
|
2013-03-04 01:19:11 +00:00
|
|
|
{
|
2013-07-31 17:04:28 +00:00
|
|
|
for (j = 0; j < RARCH_FIRST_META_KEY; j++)
|
2013-03-02 21:56:58 +00:00
|
|
|
{
|
2013-03-04 01:19:11 +00:00
|
|
|
g_settings.input.binds[i][j].id = i;
|
|
|
|
g_settings.input.binds[i][j].joykey = 0;
|
2013-03-02 21:56:58 +00:00
|
|
|
}
|
|
|
|
|
2013-03-04 01:19:11 +00:00
|
|
|
g_settings.input.binds[i][RETRO_DEVICE_ID_JOYPAD_B].joykey = (1ULL << RETRO_DEVICE_ID_JOYPAD_B);
|
|
|
|
g_settings.input.binds[i][RETRO_DEVICE_ID_JOYPAD_Y].joykey = (1ULL << RETRO_DEVICE_ID_JOYPAD_Y);
|
|
|
|
g_settings.input.binds[i][RETRO_DEVICE_ID_JOYPAD_SELECT].joykey = (1ULL << RETRO_DEVICE_ID_JOYPAD_SELECT);
|
|
|
|
g_settings.input.binds[i][RETRO_DEVICE_ID_JOYPAD_START].joykey = (1ULL << RETRO_DEVICE_ID_JOYPAD_START);
|
|
|
|
g_settings.input.binds[i][RETRO_DEVICE_ID_JOYPAD_UP].joykey = (1ULL << RETRO_DEVICE_ID_JOYPAD_UP);
|
|
|
|
g_settings.input.binds[i][RETRO_DEVICE_ID_JOYPAD_DOWN].joykey = (1ULL << RETRO_DEVICE_ID_JOYPAD_DOWN);
|
|
|
|
g_settings.input.binds[i][RETRO_DEVICE_ID_JOYPAD_LEFT].joykey = (1ULL << RETRO_DEVICE_ID_JOYPAD_LEFT);
|
|
|
|
g_settings.input.binds[i][RETRO_DEVICE_ID_JOYPAD_RIGHT].joykey = (1ULL << RETRO_DEVICE_ID_JOYPAD_RIGHT);
|
|
|
|
g_settings.input.binds[i][RETRO_DEVICE_ID_JOYPAD_A].joykey = (1ULL << RETRO_DEVICE_ID_JOYPAD_A);
|
|
|
|
g_settings.input.binds[i][RETRO_DEVICE_ID_JOYPAD_X].joykey = (1ULL << RETRO_DEVICE_ID_JOYPAD_X);
|
|
|
|
g_settings.input.binds[i][RETRO_DEVICE_ID_JOYPAD_L].joykey = (1ULL << RETRO_DEVICE_ID_JOYPAD_L);
|
|
|
|
g_settings.input.binds[i][RETRO_DEVICE_ID_JOYPAD_R].joykey = (1ULL << RETRO_DEVICE_ID_JOYPAD_R);
|
|
|
|
g_settings.input.binds[i][RETRO_DEVICE_ID_JOYPAD_L2].joykey = (1ULL << RETRO_DEVICE_ID_JOYPAD_L2);
|
|
|
|
g_settings.input.binds[i][RETRO_DEVICE_ID_JOYPAD_R2].joykey = (1ULL << RETRO_DEVICE_ID_JOYPAD_R2);
|
|
|
|
g_settings.input.binds[i][RETRO_DEVICE_ID_JOYPAD_L3].joykey = (1ULL << RETRO_DEVICE_ID_JOYPAD_L3);
|
|
|
|
g_settings.input.binds[i][RETRO_DEVICE_ID_JOYPAD_R3].joykey = (1ULL << RETRO_DEVICE_ID_JOYPAD_R3);
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[i] = ANALOG_DPAD_DUALANALOG;
|
2013-03-02 21:56:58 +00:00
|
|
|
}
|
2014-06-07 03:41:02 +00:00
|
|
|
*/
|
2013-03-03 22:17:16 +00:00
|
|
|
|
2013-03-15 00:22:52 +00:00
|
|
|
for (i = 0; i < MAX_PLAYERS; i++)
|
|
|
|
strlcpy(g_settings.input.device_names[i], "Custom", sizeof(g_settings.input.device_names[i]));
|
|
|
|
|
2013-03-04 10:18:22 +00:00
|
|
|
if ((dlopen("/system/lib/libandroid.so", RTLD_LOCAL | RTLD_LAZY)) == 0)
|
|
|
|
{
|
|
|
|
RARCH_WARN("Unable to open libandroid.so\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p_AMotionEvent_getAxisValue = dlsym(RTLD_DEFAULT, "AMotionEvent_getAxisValue");
|
|
|
|
|
2014-01-20 15:28:02 +00:00
|
|
|
if (p_AMotionEvent_getAxisValue)
|
2013-03-04 10:18:22 +00:00
|
|
|
{
|
|
|
|
RARCH_LOG("Setting engine_handle_dpad to 'Get Axis Value' (for reading extra analog sticks)");
|
|
|
|
engine_handle_dpad = engine_handle_dpad_getaxisvalue;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RARCH_LOG("Setting engine_handle_dpad to 'Default'");
|
|
|
|
engine_handle_dpad = engine_handle_dpad_default;
|
|
|
|
}
|
|
|
|
}
|
2013-03-03 22:17:16 +00:00
|
|
|
|
2013-11-20 18:00:21 +00:00
|
|
|
env = jni_thread_getenv();
|
|
|
|
if (!env)
|
|
|
|
goto retobj;
|
|
|
|
|
|
|
|
GET_OBJECT_CLASS(env, class, android_app->activity->clazz);
|
|
|
|
if (!class)
|
|
|
|
goto retobj;
|
|
|
|
|
2014-01-04 04:36:08 +00:00
|
|
|
#if 0
|
2013-11-20 18:00:21 +00:00
|
|
|
GET_METHOD_ID(env, android->onBackPressed, class, "onBackPressed", "()V");
|
|
|
|
if (!android->onBackPressed)
|
|
|
|
{
|
|
|
|
RARCH_ERR("Could not set onBackPressed JNI function pointer.\n");
|
|
|
|
goto retobj;
|
|
|
|
}
|
2014-01-04 04:36:08 +00:00
|
|
|
#endif
|
2013-11-20 18:00:21 +00:00
|
|
|
|
|
|
|
retobj:
|
2013-11-01 15:33:32 +00:00
|
|
|
return android;
|
2013-03-02 21:56:58 +00:00
|
|
|
}
|
|
|
|
|
2013-03-13 22:17:33 +00:00
|
|
|
int zeus_id = -1;
|
|
|
|
int zeus_second_id = -1;
|
2013-06-16 16:18:15 +00:00
|
|
|
unsigned zeus_port;
|
2013-03-13 22:17:33 +00:00
|
|
|
|
2013-03-14 01:24:57 +00:00
|
|
|
static void android_input_set_keybinds(void *data, unsigned device,
|
|
|
|
unsigned port, unsigned id, unsigned keybind_action)
|
2013-03-13 22:17:33 +00:00
|
|
|
{
|
2013-11-01 15:33:32 +00:00
|
|
|
android_input_t *android = (android_input_t*)data;
|
|
|
|
|
2013-03-14 01:24:57 +00:00
|
|
|
if (keybind_action & (1ULL << KEYBINDS_ACTION_SET_DEFAULT_BINDS))
|
|
|
|
{
|
2014-06-08 03:32:22 +00:00
|
|
|
int i;
|
|
|
|
|
2013-03-14 01:24:57 +00:00
|
|
|
/* eight 8-bit values are packed into one uint64_t
|
|
|
|
* one for each of the 8 pads */
|
|
|
|
unsigned shift = 8 + (port * 8);
|
2013-03-13 22:17:33 +00:00
|
|
|
|
2013-03-14 01:24:57 +00:00
|
|
|
// NOTE - we have to add '1' to the bit mask because
|
|
|
|
// RETRO_DEVICE_ID_JOYPAD_B is 0
|
2013-03-13 22:17:33 +00:00
|
|
|
|
2013-07-04 01:41:19 +00:00
|
|
|
RARCH_LOG("Detecting keybinds. Device %u port %u id %u keybind_action %u\n", device, port, id, keybind_action);
|
|
|
|
|
2013-03-14 01:24:57 +00:00
|
|
|
switch (device)
|
|
|
|
{
|
|
|
|
case DEVICE_LOGITECH_RUMBLEPAD2:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Logitech Rumblepad 2",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2013-11-01 15:33:32 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_LOGITECH_DUAL_ACTION:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Logitech Dual Action",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_R2+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);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_SELECT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BACK] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
2013-06-16 16:25:17 +00:00
|
|
|
case DEVICE_LOGITECH_PRECISION_GAMEPAD:
|
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Logitech Precision",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_NONE;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
2013-06-16 16:25:17 +00:00
|
|
|
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
2013-06-16 16:25:17 +00:00
|
|
|
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
2013-06-16 16:25:17 +00:00
|
|
|
break;
|
2013-06-04 09:14:14 +00:00
|
|
|
case DEVICE_GAMEMID:
|
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "GameMID",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_SELECT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_THUMBR] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_THUMBL] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift);
|
2013-06-04 09:14:14 +00:00
|
|
|
|
|
|
|
/* left analog stick - TODO */
|
|
|
|
/* right analog stick - TODO */
|
|
|
|
/* menu button? */
|
|
|
|
break;
|
2013-07-14 08:06:10 +00:00
|
|
|
case DEVICE_ICONTROLPAD_HID_JOYSTICK:
|
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "iControlPad HID Joystick profile",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_14] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_13] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_15] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
2013-07-14 08:06:10 +00:00
|
|
|
break;
|
2013-03-14 01:24:57 +00:00
|
|
|
case DEVICE_ICONTROLPAD_BLUEZ_IME:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
2013-07-14 08:06:10 +00:00
|
|
|
strlcpy(g_settings.input.device_names[port], "iControlPad SPP profile (using Bluez IME)",
|
2013-03-15 00:22:52 +00:00
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_SELECT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
|
|
|
|
/* left analog stick */
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_W] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_S] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_A] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_D] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
|
|
|
|
/* right analog stick - TODO */
|
|
|
|
// Left - 11
|
|
|
|
// Right - 13
|
|
|
|
// Down - 12
|
|
|
|
// Up - 15
|
|
|
|
break;
|
|
|
|
case DEVICE_TTT_THT_ARCADE:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "TTT THT Arcade",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2013-03-14 01:24:57 +00:00
|
|
|
/* same as Rumblepad 2 - merge? */
|
2013-11-01 15:33:32 +00:00
|
|
|
//android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
|
|
|
|
/* TODO - unsure about pad 2 still */
|
2013-03-13 22:17:33 +00:00
|
|
|
#if 0
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_13] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_14] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_15] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_16] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
2013-03-13 22:17:33 +00:00
|
|
|
#endif
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_TOMMO_NEOGEOX_ARCADE:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "TOMMO Neogeo X Arcade",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_NONE;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_MADCATZ_PC_USB_STICK:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Madcatz PC USB Stick",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_LSTICK;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); /* request hack */
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); /* request hack */
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_MODE] |= ((RARCH_QUIT_KEY+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_LOGICOOL_RUMBLEPAD2:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Logicool Rumblepad 2",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2013-03-14 01:24:57 +00:00
|
|
|
// Rumblepad 2 DInput */
|
|
|
|
/* TODO: Add L3/R3 */
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_IDROID_X360:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "iDroid x360",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 23:14:08 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_INSERT] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_MINUS] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_SLASH] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_MOVE_END] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_LEFT_BRACKET] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_FORWARD_DEL] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_MEDIA_PLAY] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_EQUALS] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_MENU] |= ((RARCH_MENU_TOGGLE+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
// Left Analog Up: 152
|
|
|
|
// Left Analog Down: 146
|
|
|
|
// Left Analog Right: 150
|
|
|
|
// Left Analog Left: 148
|
|
|
|
// Right Analog Up: 92 (AKEYCODE_PAGE_UP)
|
|
|
|
// Right Analog Down: 93 (AKEYCODE_PAGE_DOWN)
|
|
|
|
// Right Analog Right: 113 (AKEYCODE_CTRL_LEFT)
|
|
|
|
// Right Analog Left: 72 (AKEYCODE_RIGHT_BRACKET)
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_NUMPAD_8] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_NUMPAD_2] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_NUMPAD_6] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_NUMPAD_4] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_ZEEMOTE_STEELSERIES:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Zeemote Steelseries",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_MODE] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_HUIJIA_USB_SNES:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Huijia USB SNES",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
2013-03-14 01:24:57 +00:00
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_NONE;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_SUPER_SMARTJOY:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Super Smartjoy",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
2013-03-14 01:24:57 +00:00
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_NONE;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_SAITEK_RUMBLE_P480:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Saitek Rumble P480",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_MS_SIDEWINDER_DUAL_STRIKE:
|
|
|
|
/* TODO - unfinished */
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "MS Sidewinder Dual Strike",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_LSTICK;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_L2) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_MS_SIDEWINDER:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "MS Sidewinder",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 23:14:08 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_LSTICK;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_MS_XBOX:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Xbox",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2013-11-01 15:33:32 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_MODE] |= ((RARCH_MENU_TOGGLE + 1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BACK] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_SELECT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_START] |= ((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);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_WISEGROUP_PLAYSTATION2:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "WiseGroup PlayStation2",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2013-11-01 15:33:32 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_13] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_15] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_16] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_14] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_JCPS102_PLAYSTATION2:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "JCPS102 PlayStation2",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_13] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_15] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_16] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_14] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_GENERIC_PLAYSTATION2_CONVERTER:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Generic PlayStation2",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_13] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_15] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_16] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_14] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_KEYBOARD_RETROPAD:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Generic Keyboard",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2013-03-14 01:24:57 +00:00
|
|
|
// Keyboard
|
|
|
|
// TODO: Map L2/R2/L3/R3
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_NONE;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_Z] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_A] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_SHIFT_RIGHT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_ENTER] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_X] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_S] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_Q] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_W] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
|
|
|
|
/* Misc control scheme */
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_F1] |= ((RARCH_MENU_TOGGLE + 1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_F2] |= ((RARCH_SAVE_STATE_KEY+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_F4] |= ((RARCH_LOAD_STATE_KEY+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_F7] |= ((RARCH_STATE_SLOT_PLUS+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_F6] |= ((RARCH_STATE_SLOT_MINUS+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_SPACE] |= ((RARCH_FAST_FORWARD_KEY+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_L] |= ((RARCH_FAST_FORWARD_HOLD_KEY+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BREAK] |= ((RARCH_PAUSE_TOGGLE+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_K] |= ((RARCH_FRAMEADVANCE+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_H] |= ((RARCH_RESET+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_R] |= ((RARCH_REWIND+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_F9] |= ((RARCH_MUTE+1) << shift);
|
|
|
|
|
|
|
|
android->keycode_lut[AKEYCODE_ESCAPE] |= ((RARCH_QUIT_KEY+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_PLAYSTATION3_VERSION1:
|
2013-08-12 22:00:00 +00:00
|
|
|
case DEVICE_PLAYSTATION3_VERSION2:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
2013-08-12 22:00:00 +00:00
|
|
|
strlcpy(g_settings.input.device_names[port], "PlayStation3",
|
2013-03-15 00:22:52 +00:00
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_SELECT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_R2+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);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RARCH_MENU_TOGGLE+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
2013-03-30 07:55:44 +00:00
|
|
|
case DEVICE_SEGA_VIRTUA_STICK_HIGH_GRADE:
|
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Sega Virtua Stick",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_LSTICK;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_MODE] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L2] |= ((RARCH_MENU_TOGGLE+1) << shift);
|
2013-03-30 07:55:44 +00:00
|
|
|
break;
|
2013-03-14 01:24:57 +00:00
|
|
|
case DEVICE_PSMOVE_NAVI:
|
|
|
|
/* TODO - unfinished */
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "PS Move Navi",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_LSTICK;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_15] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_14] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_UNKNOWN] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_JXD_S7300B:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "JXD S7300B",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_ENTER] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_SPACE] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
|
2013-11-01 15:33:32 +00:00
|
|
|
//android->keycode_lut[AKEYCODE_VOLUME_UP] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
//android->keycode_lut[AKEYCODE_VOLUME_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
2013-11-29 14:10:39 +00:00
|
|
|
case DEVICE_JXD_S7800B:
|
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "JXD S7800B",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-29 14:10:39 +00:00
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_SELECT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
break;
|
2013-03-14 01:24:57 +00:00
|
|
|
case DEVICE_IDROID_CON:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "i.droid",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_NYKO_PLAYPAD_PRO:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Nyko Playpad Pro",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BACK] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+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);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
2013-06-16 16:32:46 +00:00
|
|
|
case DEVICE_ONLIVE_WIRELESS_CONTROLLER:
|
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Onlive Wireless",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
|
|
|
/* TODO - Does D-pad work as D-pad? */
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BACK] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
2013-06-16 16:32:46 +00:00
|
|
|
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
2013-06-16 16:32:46 +00:00
|
|
|
|
|
|
|
/* TODO -
|
|
|
|
* LT - find out value
|
|
|
|
* RT - find out value
|
|
|
|
*/
|
|
|
|
break;
|
2013-03-14 01:24:57 +00:00
|
|
|
case DEVICE_GENIUS_MAXFIRE_G08XU:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Genius Maxfire G08XU",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_NONE;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_USB_2_AXIS_8_BUTTON_GAMEPAD:
|
2013-03-15 00:22:52 +00:00
|
|
|
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]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_BUFFALO_BGC_FC801:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Buffalo BGC FC801",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_NONE;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_RETROUSB_RETROPAD:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "RetroUSB NES",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_NONE;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_RETROUSB_SNES_RETROPORT:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "RetroUSB SNES",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_NONE;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_CYPRESS_USB:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Cypress USB",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG; // No idea
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_MAYFLASH_WII_CLASSIC:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_NONE;
|
2013-03-15 00:22:52 +00:00
|
|
|
strlcpy(g_settings.input.device_names[port], "Mayflash Wii Classic",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
2013-03-14 01:24:57 +00:00
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_14] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_13] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_15] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_SZMY_POWER_DUAL_BOX_WII:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "SZMy Power Dual Box Wii",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
2013-03-14 01:24:57 +00:00
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_LSTICK; // No idea
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_13] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_15] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_16] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_14] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_TOODLES_2008_CHIMP:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Toodles 2008 Chimp",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_LSTICK;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_ARCHOS_GAMEPAD:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Archos Gamepad",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_SELECT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_JXD_S5110:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "JXD S5110",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_SPACE] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_ENTER] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
2013-12-16 09:52:26 +00:00
|
|
|
case DEVICE_JXD_S5110_SKELROM:
|
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "JXD S5110 Skelrom",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_SELECT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
break;
|
2013-05-13 08:21:06 +00:00
|
|
|
case DEVICE_OUYA:
|
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "OUYA",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2013-11-01 15:33:32 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_THUMBL] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_THUMBR] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_MENU] |= ((RARCH_MENU_TOGGLE+1) << shift);
|
2013-05-13 08:21:06 +00:00
|
|
|
break;
|
2013-06-28 12:05:58 +00:00
|
|
|
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]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
2013-06-28 12:05:58 +00:00
|
|
|
break;
|
2013-03-14 01:24:57 +00:00
|
|
|
case DEVICE_XPERIA_PLAY:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Xperia Play",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2013-06-16 16:18:15 +00:00
|
|
|
if ((zeus_second_id != -1 && (zeus_second_id == id)))
|
2013-03-14 01:24:57 +00:00
|
|
|
{
|
|
|
|
port = zeus_port;
|
|
|
|
shift = 8 + (port * 8);
|
|
|
|
}
|
2013-03-13 22:17:33 +00:00
|
|
|
|
2013-11-07 20:44:44 +00:00
|
|
|
g_extern.lifecycle_state |= (1ULL << MODE_INPUT_XPERIA_PLAY_HACK);
|
2013-03-14 01:24:57 +00:00
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_NONE;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_DPAD_CENTER] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BACK] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_MENU] |= ((RARCH_MENU_TOGGLE+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_SELECT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_BROADCOM_BLUETOOTH_HID:
|
2013-07-04 01:41:19 +00:00
|
|
|
RARCH_LOG("Bluetooth HID\n");
|
2013-03-14 01:24:57 +00:00
|
|
|
if ((g_settings.input.icade_count +1) < 4)
|
2013-03-13 22:17:33 +00:00
|
|
|
{
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
2013-03-14 01:24:57 +00:00
|
|
|
g_settings.input.icade_count++;
|
2013-07-04 01:41:19 +00:00
|
|
|
RARCH_LOG("Using icade profile %u\n", g_settings.input.icade_count - 1);
|
2013-03-14 01:24:57 +00:00
|
|
|
|
2013-07-04 01:41:19 +00:00
|
|
|
switch(g_settings.input.icade_profile[g_settings.input.icade_count - 1]) /* was just incremented... */
|
2013-03-14 01:24:57 +00:00
|
|
|
{
|
|
|
|
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 */
|
2013-07-04 01:41:19 +00:00
|
|
|
strlcpy(g_settings.input.device_names[port], "Red Samurai",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_W] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_S] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_A] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_D]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BACK] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_ENTER] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_9] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_0] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_6] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_7] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_8] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
|
|
|
|
/* unsure if the person meant the SNES-mapping here or whether it's the pad */
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_1] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_3] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_4] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case ICADE_PROFILE_IPEGA_PG9017:
|
2013-07-04 01:41:19 +00:00
|
|
|
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 */
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); /* Button labeled X on gamepad */
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); /* Button labeled A on gamepad */
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); /* Button labeled B on gamepad */
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); /* Button labeled Y on gamepad */
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
2013-07-12 02:11:08 +00:00
|
|
|
/* 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() */
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
2013-08-06 23:12:46 +00:00
|
|
|
case ICADE_PROFILE_IPEGA_PG9017_MODE2:
|
|
|
|
strlcpy(g_settings.input.device_names[port], "iPega PG-9017 (Mode2)",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_M] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_J] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_K] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_I] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_Q] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_P] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_R] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_Y] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
2013-08-06 23:12:46 +00:00
|
|
|
break;
|
2013-10-22 21:31:48 +00:00
|
|
|
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 */
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
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);
|
2013-10-22 21:31:48 +00:00
|
|
|
/* 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() */
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
2013-10-22 21:31:48 +00:00
|
|
|
break;
|
2013-05-25 23:13:24 +00:00
|
|
|
case ICADE_PROFILE_GAMESTOP_WIRELESS:
|
2013-07-04 01:41:19 +00:00
|
|
|
strlcpy(g_settings.input.device_names[port], "Gamestop Wireless",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_W] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_S] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_A] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_D] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_3] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_4] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_1] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_7] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_ESCAPE] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_ENTER] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_6] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_8] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_9] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_0] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift);
|
2013-05-25 23:13:24 +00:00
|
|
|
break;
|
2013-12-16 16:41:41 +00:00
|
|
|
case ICADE_PROFILE_MOGA_HERO_POWER:
|
2014-01-12 20:16:20 +00:00
|
|
|
strlcpy(g_settings.input.device_names[port], "Moga Hero Power",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
|
|
|
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);
|
2013-03-14 01:24:57 +00:00
|
|
|
}
|
2013-03-13 22:17:33 +00:00
|
|
|
}
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_THRUST_PREDATOR:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
2014-01-12 22:47:57 +00:00
|
|
|
strlcpy(g_settings.input.device_names[port], "Trust Predator",
|
2013-03-15 00:22:52 +00:00
|
|
|
sizeof(g_settings.input.device_names[port]));
|
2013-03-14 01:24:57 +00:00
|
|
|
/* TODO: L3/R3 */
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_DRAGONRISE:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "DragonRise",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
2013-03-14 01:24:57 +00:00
|
|
|
/* TODO: L3/R3 */
|
2014-04-04 12:17:39 +00:00
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
2014-04-04 12:17:39 +00:00
|
|
|
|
|
|
|
case DEVICE_SAMSUNG_GAMEPAD_EIGP20:
|
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Samsung Game Pad EI-GP20",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
|
|
|
|
|
|
|
//B: "Pad 0: 96, ac=1, src = 1281"
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
//A: "Pad 0: 97, ac=1, src = 1281"
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
//X: "Pad 0: 99, ac=1, src = 1281"
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
//Y: "Pad 0: 100, ac=1, src = 1281"
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
//Left Trigger: "Pad 0: 102, ac=1, src = 1281"
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
//Right Trigger: "Pad 0: 103, ac=1, src = 1281"
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
//Play Button: "Pad 0: 0, ac=1, src = 1281"
|
|
|
|
//Start: "Pad 0: 108, ac=1, src = 1281"
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
//Select: "Pad 0: 109, ac=1, src = 1281"
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_SELECT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-25 23:13:24 +00:00
|
|
|
case DEVICE_TOMEE_NES_USB:
|
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Tomee NES USB",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_NONE;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R2]|= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L2]|= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A]|= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B]|= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
2013-05-25 23:13:24 +00:00
|
|
|
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]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R2]|= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L2]|= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A]|= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X]|= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B]|= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_C]|= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y]|= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Z]|= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L2]|= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1]|= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
2013-05-25 23:13:24 +00:00
|
|
|
break;
|
2013-06-06 10:29:34 +00:00
|
|
|
case DEVICE_DEFENDER_GAME_RACER_CLASSIC:
|
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Defender Game Racer Classic",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_NONE;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_10]|= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_1]|= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_2]|= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_3]|= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_4]|= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_5]|= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_6]|= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_7]|= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_8]|= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_9]|= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
2013-06-06 10:29:34 +00:00
|
|
|
break;
|
2013-03-14 01:24:57 +00:00
|
|
|
case DEVICE_MOGA_IME:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Moga IME",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
2013-03-14 01:24:57 +00:00
|
|
|
/* TODO:
|
|
|
|
* right stick up: 188
|
|
|
|
* right stick down: 189
|
|
|
|
* right stick left: 190
|
|
|
|
* right stick right: 191
|
|
|
|
*/
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_LSTICK;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_START]|= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_SELECT]|= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A]|= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B]|= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X]|= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y]|= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1]|= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1]|= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
2013-07-31 17:04:28 +00:00
|
|
|
case DEVICE_NVIDIA_SHIELD:
|
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "NVIDIA Shield",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
2013-11-01 15:33:32 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2014-06-08 03:32:22 +00:00
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_B].def_joykey = (AKEYCODE_BUTTON_A);
|
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_Y].def_joykey = (AKEYCODE_BUTTON_X);
|
|
|
|
|
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_SELECT].def_joykey = (AKEYCODE_BUTTON_THUMBL);
|
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_START].def_joykey = (AKEYCODE_BUTTON_THUMBR);
|
|
|
|
|
|
|
|
|
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_A].def_joykey = (AKEYCODE_BUTTON_B);
|
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_X].def_joykey = (AKEYCODE_BUTTON_Y);
|
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_L].def_joykey = (AKEYCODE_BUTTON_L1);
|
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R].def_joykey = (AKEYCODE_BUTTON_R1);
|
|
|
|
|
|
|
|
|
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_L3].def_joykey = (RETRO_DEVICE_ID_JOYPAD_L3);
|
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R3].def_joykey = (RETRO_DEVICE_ID_JOYPAD_R3);
|
|
|
|
|
|
|
|
g_settings.input.binds[port][RARCH_MENU_TOGGLE].def_joykey = (AKEYCODE_BUTTON_START);
|
|
|
|
|
|
|
|
g_settings.input.binds[port][RARCH_ANALOG_LEFT_X_PLUS].def_joykey = NO_BTN;
|
|
|
|
g_settings.input.binds[port][RARCH_ANALOG_LEFT_X_MINUS].def_joykey = NO_BTN;
|
|
|
|
g_settings.input.binds[port][RARCH_ANALOG_LEFT_Y_PLUS].def_joykey = NO_BTN;
|
|
|
|
g_settings.input.binds[port][RARCH_ANALOG_LEFT_Y_MINUS].def_joykey = NO_BTN;
|
|
|
|
g_settings.input.binds[port][RARCH_ANALOG_RIGHT_X_PLUS].def_joykey = NO_BTN;
|
|
|
|
g_settings.input.binds[port][RARCH_ANALOG_RIGHT_X_MINUS].def_joykey = NO_BTN;
|
|
|
|
g_settings.input.binds[port][RARCH_ANALOG_RIGHT_Y_PLUS].def_joykey = NO_BTN;
|
|
|
|
g_settings.input.binds[port][RARCH_ANALOG_RIGHT_Y_MINUS].def_joykey = NO_BTN;
|
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_B].def_joyaxis = AXIS_NONE;
|
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_Y].def_joyaxis = AXIS_NONE;
|
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_SELECT].def_joyaxis = AXIS_NONE;
|
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_START].def_joyaxis = AXIS_NONE;
|
2014-06-08 17:14:58 +00:00
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_UP].def_joyaxis = AXIS_NEG(5);
|
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_DOWN].def_joyaxis = AXIS_POS(5);
|
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_LEFT].def_joyaxis = AXIS_NEG(4);
|
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_RIGHT].def_joyaxis = AXIS_POS(4);
|
2014-06-08 03:32:22 +00:00
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_A].def_joyaxis = AXIS_NONE;
|
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_X].def_joyaxis = AXIS_NONE;
|
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_L].def_joyaxis = AXIS_NONE;
|
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R].def_joyaxis = AXIS_NONE;
|
2014-06-08 17:14:58 +00:00
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_L2].def_joyaxis = AXIS_POS(6);
|
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R2].def_joyaxis = AXIS_POS(7);
|
2014-06-08 03:32:22 +00:00
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_L3].def_joyaxis = AXIS_NONE;
|
|
|
|
g_settings.input.binds[port][RETRO_DEVICE_ID_JOYPAD_R3].def_joyaxis = AXIS_NONE;
|
|
|
|
g_settings.input.binds[port][RARCH_ANALOG_LEFT_X_PLUS].def_joyaxis = AXIS_POS(0);
|
|
|
|
g_settings.input.binds[port][RARCH_ANALOG_LEFT_X_MINUS].def_joyaxis = AXIS_NEG(0);
|
|
|
|
g_settings.input.binds[port][RARCH_ANALOG_LEFT_Y_PLUS].def_joyaxis = AXIS_POS(1);
|
|
|
|
g_settings.input.binds[port][RARCH_ANALOG_LEFT_Y_MINUS].def_joyaxis = AXIS_NEG(1);
|
|
|
|
g_settings.input.binds[port][RARCH_ANALOG_RIGHT_X_PLUS].def_joyaxis = AXIS_POS(2);
|
|
|
|
g_settings.input.binds[port][RARCH_ANALOG_RIGHT_X_MINUS].def_joyaxis = AXIS_NEG(2);
|
|
|
|
g_settings.input.binds[port][RARCH_ANALOG_RIGHT_Y_PLUS].def_joyaxis = AXIS_POS(3);
|
|
|
|
g_settings.input.binds[port][RARCH_ANALOG_RIGHT_Y_MINUS].def_joyaxis = AXIS_NEG(3);
|
2013-07-31 17:04:28 +00:00
|
|
|
break;
|
2013-09-18 23:35:59 +00:00
|
|
|
case DEVICE_MUCH_IREADGO_I5:
|
|
|
|
g_settings.input.device[port] = device;
|
2014-01-12 22:47:57 +00:00
|
|
|
strlcpy(g_settings.input.device_names[port], "MUCH iReadyGo i5",
|
2013-09-18 23:35:59 +00:00
|
|
|
sizeof(g_settings.input.device_names[port]));
|
2013-11-01 15:33:32 +00:00
|
|
|
|
2014-01-12 22:47:57 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
|
2014-01-07 10:19:28 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_CENTER] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
2014-01-07 10:19:28 +00:00
|
|
|
|
2013-09-18 23:35:59 +00:00
|
|
|
break;
|
2013-09-19 00:07:49 +00:00
|
|
|
case DEVICE_WIKIPAD:
|
|
|
|
/* untested : D-pad/analogs */
|
|
|
|
/* untested: L2/R2 */
|
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Wikipad",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
2014-01-12 22:47:57 +00:00
|
|
|
|
2013-11-01 15:33:32 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+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);
|
|
|
|
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BACK] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
2013-09-19 00:07:49 +00:00
|
|
|
break;
|
2013-09-19 00:13:34 +00:00
|
|
|
case DEVICE_FC30_GAMEPAD:
|
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "FC30 Gamepad",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
2014-01-12 22:47:57 +00:00
|
|
|
|
2013-11-01 15:33:32 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_NONE;
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
2013-09-19 00:13:34 +00:00
|
|
|
break;
|
2013-03-14 01:24:57 +00:00
|
|
|
case DEVICE_CCPCREATIONS_WIIUSE_IME:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = device;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "ccpCreations WiiUse IME",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
2014-01-12 22:47:57 +00:00
|
|
|
|
2013-11-01 15:33:32 +00:00
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_NONE;
|
2013-03-14 01:24:57 +00:00
|
|
|
|
|
|
|
/* Player 1 */
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_DPAD_RIGHT]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_1] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_3] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_4] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_5] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_6] |= ((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[AKEYCODE_E] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_B] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_F] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_G] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_C] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_LEFT_BRACKET] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_RIGHT_BRACKET] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_Z] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_H] |= ((RARCH_RESET+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_W] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_S] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_A] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_D] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_C] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_Z] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
|
|
|
|
/* Player 2 */
|
|
|
|
shift += 8;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_I] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_K] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_J] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_O]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_COMMA] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_PERIOD] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_VOLUME_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_VOLUME_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_MEDIA_PREVIOUS] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_MEDIA_NEXT] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_MEDIA_PLAY] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_MEDIA_STOP] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_ENDCALL] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_CALL] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_PLUS] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_MINUS] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BACKSLASH] |= ((RARCH_RESET+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_L] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_R] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_SEARCH] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_TAB] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
|
|
|
|
/* Player 3 */
|
|
|
|
shift += 8;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_PAGE_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_PAGE_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_MEDIA_REWIND] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_MEDIA_FAST_FORWARD]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_SOFT_LEFT]|= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_SOFT_RIGHT]|= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_THUMBR]|= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_THUMBL]|= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_SPACE]|= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_SYM]|= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_EXPLORER]|= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_ENVELOPE]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_X]|= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Y]|= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_A]|= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_B]|= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L1]|= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R1]|= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_L2]|= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_R2]|= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
|
|
|
|
/* Player 4 */
|
|
|
|
shift += 8;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_N] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_Q] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_T] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_APOSTROPHE]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_NOTIFICATION]|= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_MUTE]|= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_START]|= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_SELECT]|= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_CLEAR]|= ((RARCH_RESET+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_CAPS_LOCK] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_SCROLL_LOCK] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
|
|
|
//android->keycode_lut[AKEYCODE_T] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); -- Left meta
|
|
|
|
//android->keycode_lut[AKEYCODE_APOSTROPHE]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); -- right meta
|
|
|
|
android->keycode_lut[AKEYCODE_META_FUNCTION_ON] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_SYSRQ] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BREAK] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_MOVE_HOME] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_GRAVE] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
|
|
|
|
android->keycode_lut[AKEYCODE_MEDIA_PAUSE] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
case DEVICE_NONE:
|
|
|
|
default:
|
2013-03-15 00:22:52 +00:00
|
|
|
g_settings.input.device[port] = 0;
|
|
|
|
strlcpy(g_settings.input.device_names[port], "Unknown",
|
|
|
|
sizeof(g_settings.input.device_names[port]));
|
2014-01-12 22:47:57 +00:00
|
|
|
|
|
|
|
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
2013-03-14 01:24:57 +00:00
|
|
|
break;
|
|
|
|
}
|
2013-03-13 22:17:33 +00:00
|
|
|
|
2014-06-08 04:51:06 +00:00
|
|
|
for (i = 0; i < RARCH_BIND_LIST_END; i++)
|
2014-06-08 03:32:22 +00:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2013-11-01 15:33:32 +00:00
|
|
|
android->keycode_lut[AKEYCODE_MENU] |= ((RARCH_MENU_TOGGLE + 1) << shift);
|
2013-03-14 01:24:57 +00:00
|
|
|
}
|
2013-03-13 22:17:33 +00:00
|
|
|
}
|
|
|
|
|
2014-06-02 12:28:26 +00:00
|
|
|
static int android_input_poll_event_type_motion(android_input_t *android, AInputEvent *event,
|
2014-06-07 03:41:02 +00:00
|
|
|
float *x, float *y, int port, int source)
|
2014-06-02 12:28:26 +00:00
|
|
|
{
|
|
|
|
if (source & ~(AINPUT_SOURCE_TOUCHSCREEN | AINPUT_SOURCE_MOUSE))
|
|
|
|
{
|
2014-06-07 03:41:02 +00:00
|
|
|
//if (android->dpad_emulation[port] != ANALOG_DPAD_NONE)
|
2014-06-02 12:28:26 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-06-07 03:41:02 +00:00
|
|
|
int getaction = AMotionEvent_getAction(event);
|
|
|
|
int action = getaction & AMOTION_EVENT_ACTION_MASK;
|
|
|
|
size_t motion_pointer = getaction >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
|
2014-06-02 12:28:26 +00:00
|
|
|
bool keyup = (action == AMOTION_EVENT_ACTION_UP ||
|
|
|
|
action == AMOTION_EVENT_ACTION_CANCEL || action == AMOTION_EVENT_ACTION_POINTER_UP) ||
|
|
|
|
(source == AINPUT_SOURCE_MOUSE && action != AMOTION_EVENT_ACTION_DOWN);
|
|
|
|
|
|
|
|
if (keyup && motion_pointer < MAX_TOUCH)
|
|
|
|
{
|
|
|
|
memmove(android->pointer + motion_pointer,
|
|
|
|
android->pointer + motion_pointer + 1,
|
|
|
|
(MAX_TOUCH - motion_pointer - 1) * sizeof(struct input_pointer));
|
|
|
|
if (android->pointer_count > 0)
|
|
|
|
android->pointer_count--;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int pointer_max = min(AMotionEvent_getPointerCount(event), MAX_TOUCH);
|
|
|
|
for (motion_pointer = 0; motion_pointer < pointer_max; motion_pointer++)
|
|
|
|
{
|
|
|
|
*x = AMotionEvent_getX(event, motion_pointer);
|
|
|
|
*y = AMotionEvent_getY(event, motion_pointer);
|
|
|
|
|
|
|
|
input_translate_coord_viewport(*x, *y,
|
|
|
|
&android->pointer[motion_pointer].x, &android->pointer[motion_pointer].y,
|
|
|
|
&android->pointer[motion_pointer].full_x, &android->pointer[motion_pointer].full_y);
|
|
|
|
|
|
|
|
android->pointer_count = max(android->pointer_count, motion_pointer + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void android_input_poll_event_type_key(android_input_t *android, struct android_app *android_app,
|
2014-06-08 04:51:06 +00:00
|
|
|
AInputEvent *event, int port, int keycode, int source, int type_event, int *handled)
|
2014-06-02 12:28:26 +00:00
|
|
|
{
|
|
|
|
int action = AKeyEvent_getAction(event);
|
|
|
|
|
2014-06-07 03:41:02 +00:00
|
|
|
// some controllers send both the up and down events at once when the button is released for "special" buttons, like menu buttons
|
|
|
|
// work around that by only using down events for meta keys (which get cleared every poll anyway)
|
2014-06-08 04:51:06 +00:00
|
|
|
if (action == AKEY_EVENT_ACTION_UP)
|
2014-06-07 03:41:02 +00:00
|
|
|
clear_bit(android->pad_state[port], keycode);
|
|
|
|
else if (action == AKEY_EVENT_ACTION_DOWN)
|
|
|
|
set_bit(android->pad_state[port], keycode);
|
2014-06-02 12:28:26 +00:00
|
|
|
|
2014-06-07 03:41:02 +00:00
|
|
|
if ((keycode == AKEYCODE_VOLUME_UP || keycode == AKEYCODE_VOLUME_DOWN))// && android->keycode_lut[keycode] == 0)
|
2014-06-02 12:28:26 +00:00
|
|
|
*handled = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-04 13:12:04 +00:00
|
|
|
// Handle all events. If our activity is in pause state, block until we're unpaused.
|
|
|
|
|
2013-03-02 21:56:58 +00:00
|
|
|
static void android_input_poll(void *data)
|
|
|
|
{
|
2013-03-04 13:12:04 +00:00
|
|
|
int ident;
|
2013-11-22 20:12:13 +00:00
|
|
|
struct android_app *android_app = (struct android_app*)g_android;
|
2013-11-01 15:33:32 +00:00
|
|
|
android_input_t *android = (android_input_t*)data;
|
2013-03-08 20:32:27 +00:00
|
|
|
|
2013-03-04 13:12:04 +00:00
|
|
|
while ((ident = ALooper_pollAll((input_key_pressed_func(RARCH_PAUSE_TOGGLE)) ? -1 : 0,
|
|
|
|
NULL, NULL, NULL)) >= 0)
|
|
|
|
{
|
2013-03-04 15:15:58 +00:00
|
|
|
if (ident == LOOPER_ID_INPUT)
|
2013-03-04 14:52:09 +00:00
|
|
|
{
|
|
|
|
bool debug_enable = g_settings.input.debug_enable;
|
|
|
|
AInputEvent* event = NULL;
|
|
|
|
|
|
|
|
// Read all pending events.
|
2013-11-18 00:20:28 +00:00
|
|
|
do
|
2013-03-04 14:52:09 +00:00
|
|
|
{
|
2013-11-02 17:59:17 +00:00
|
|
|
//int processed = 0;
|
2013-07-29 13:13:02 +00:00
|
|
|
while (AInputQueue_getEvent(android_app->inputQueue, &event) >= 0)
|
2013-03-04 14:52:09 +00:00
|
|
|
{
|
|
|
|
bool long_msg_enable = false;
|
|
|
|
int32_t handled = 1;
|
|
|
|
char msg[128];
|
2014-06-02 12:28:26 +00:00
|
|
|
int source, id, keycode, type_event, port;
|
2013-07-29 13:13:02 +00:00
|
|
|
int predispatched;
|
2013-03-04 14:52:09 +00:00
|
|
|
|
|
|
|
msg[0] = 0;
|
2013-07-31 17:04:28 +00:00
|
|
|
predispatched = AInputQueue_preDispatchEvent(android_app->inputQueue,event);
|
2013-03-04 14:52:09 +00:00
|
|
|
|
2013-07-29 13:13:02 +00:00
|
|
|
if (predispatched)
|
|
|
|
continue;
|
2013-03-04 14:52:09 +00:00
|
|
|
|
|
|
|
source = AInputEvent_getSource(event);
|
|
|
|
id = AInputEvent_getDeviceId(event);
|
|
|
|
if (id == zeus_second_id)
|
|
|
|
id = zeus_id;
|
|
|
|
|
|
|
|
type_event = AInputEvent_getType(event);
|
2014-06-02 12:28:26 +00:00
|
|
|
port = -1;
|
2013-03-04 14:52:09 +00:00
|
|
|
|
|
|
|
if (source & (AINPUT_SOURCE_TOUCHSCREEN | AINPUT_SOURCE_MOUSE | AINPUT_SOURCE_TOUCHPAD))
|
2014-06-02 12:28:26 +00:00
|
|
|
port = 0; // touch overlay is always player 1
|
2013-03-04 14:52:09 +00:00
|
|
|
else
|
|
|
|
{
|
2013-10-22 13:08:17 +00:00
|
|
|
unsigned i;
|
2013-11-01 15:33:32 +00:00
|
|
|
for (i = 0; i < android->pads_connected; i++)
|
|
|
|
if (android->state_device_ids[i] == id)
|
2014-06-02 12:28:26 +00:00
|
|
|
port = i;
|
2013-03-04 14:52:09 +00:00
|
|
|
}
|
|
|
|
|
2014-06-02 12:28:26 +00:00
|
|
|
if (port < 0)
|
2013-03-04 14:52:09 +00:00
|
|
|
{
|
2014-06-02 12:28:26 +00:00
|
|
|
port = android->pads_connected;
|
2013-07-28 15:59:35 +00:00
|
|
|
if (g_settings.input.autodetect_enable)
|
2013-07-31 17:04:28 +00:00
|
|
|
{
|
|
|
|
bool primary = false;
|
2014-06-02 12:28:26 +00:00
|
|
|
input_autodetect_setup(android_app, msg, sizeof(msg), port, id, source, &primary);
|
2013-07-31 17:04:28 +00:00
|
|
|
|
|
|
|
if (primary)
|
|
|
|
{
|
|
|
|
RARCH_LOG("Found primary input device.\n");
|
2013-11-01 15:33:32 +00:00
|
|
|
memmove(android->state_device_ids + 1, android->state_device_ids,
|
|
|
|
android->pads_connected * sizeof(android->state_device_ids[0]));
|
2014-06-02 12:28:26 +00:00
|
|
|
port = 0;
|
2013-11-01 15:33:32 +00:00
|
|
|
android->state_device_ids[0] = id;
|
|
|
|
android->pads_connected++;
|
2013-07-31 17:04:28 +00:00
|
|
|
}
|
|
|
|
else
|
2013-11-01 15:33:32 +00:00
|
|
|
android->state_device_ids[android->pads_connected++] = id;
|
2013-07-31 17:04:28 +00:00
|
|
|
}
|
|
|
|
else
|
2013-11-01 15:33:32 +00:00
|
|
|
android->state_device_ids[android->pads_connected++] = id;
|
2013-07-28 15:59:35 +00:00
|
|
|
|
2013-03-04 14:52:09 +00:00
|
|
|
long_msg_enable = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type_event == AINPUT_EVENT_TYPE_MOTION)
|
|
|
|
{
|
2014-06-02 12:28:26 +00:00
|
|
|
float x = 0.0f;
|
|
|
|
float y = 0.0f;
|
2013-03-04 14:52:09 +00:00
|
|
|
|
2014-06-07 03:41:02 +00:00
|
|
|
if (android_input_poll_event_type_motion(android, event, &x, &y, port, source))
|
|
|
|
engine_handle_dpad(android, event, port, msg, sizeof(msg), source, debug_enable,
|
2014-06-02 12:28:26 +00:00
|
|
|
android->dpad_emulation[port]);
|
2013-03-04 14:52:09 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (debug_enable)
|
2014-06-02 12:28:26 +00:00
|
|
|
snprintf(msg, sizeof(msg), "Pad %d : x = %.2f, y = %.2f, src %d.\n", port, x, y, source);
|
2013-03-04 14:52:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (type_event == AINPUT_EVENT_TYPE_KEY)
|
|
|
|
{
|
2014-06-07 03:41:02 +00:00
|
|
|
keycode = AKeyEvent_getKeyCode(event);
|
2014-06-08 04:51:06 +00:00
|
|
|
android_input_poll_event_type_key(android, android_app, event, port, keycode, source, type_event, &handled);
|
2013-08-22 22:14:10 +00:00
|
|
|
if (debug_enable)
|
2014-06-07 03:41:02 +00:00
|
|
|
snprintf(msg, sizeof(msg), "Pad %d : %d, src = %d.\n", port, keycode, source);
|
2013-03-04 14:52:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (msg[0] != 0)
|
2013-07-31 17:04:28 +00:00
|
|
|
{
|
|
|
|
msg_queue_clear(g_extern.msg_queue);
|
2013-03-04 14:52:09 +00:00
|
|
|
msg_queue_push(g_extern.msg_queue, msg, 0, long_msg_enable ? 180 : 30);
|
2013-07-31 17:04:28 +00:00
|
|
|
RARCH_LOG("Input debug: %s\n", msg);
|
|
|
|
}
|
2013-03-04 14:52:09 +00:00
|
|
|
|
|
|
|
AInputQueue_finishEvent(android_app->inputQueue, event, handled);
|
2013-11-02 17:59:17 +00:00
|
|
|
//processed = 1;
|
2013-03-04 14:52:09 +00:00
|
|
|
}
|
2013-11-02 17:59:17 +00:00
|
|
|
#if 0
|
2013-07-29 13:13:02 +00:00
|
|
|
if (processed == 0)
|
|
|
|
RARCH_WARN("Failure reading next input event: %s\n", strerror(errno));
|
2013-11-02 17:59:17 +00:00
|
|
|
#endif
|
2013-11-18 00:20:28 +00:00
|
|
|
}while (AInputQueue_hasEvents(android_app->inputQueue));
|
2013-03-04 14:52:09 +00:00
|
|
|
}
|
2013-11-02 23:27:58 +00:00
|
|
|
else if (ident == LOOPER_ID_USER)
|
|
|
|
{
|
2014-01-20 15:28:02 +00:00
|
|
|
if ((android_app->sensor_state_mask & (1ULL << RETRO_SENSOR_ACCELEROMETER_ENABLE))
|
|
|
|
&& android_app->accelerometerSensor)
|
2013-11-02 23:27:58 +00:00
|
|
|
{
|
|
|
|
ASensorEvent event;
|
|
|
|
while (ASensorEventQueue_getEvents(android->sensorEventQueue, &event, 1) > 0)
|
|
|
|
{
|
|
|
|
android->accelerometer_state.x = event.acceleration.x;
|
|
|
|
android->accelerometer_state.y = event.acceleration.y;
|
|
|
|
android->accelerometer_state.z = event.acceleration.z;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-03-04 15:15:58 +00:00
|
|
|
else if (ident == LOOPER_ID_MAIN)
|
2013-11-22 16:41:45 +00:00
|
|
|
engine_handle_cmd(driver.input_data);
|
2013-03-04 13:12:04 +00:00
|
|
|
}
|
2012-10-16 17:46:31 +00:00
|
|
|
}
|
|
|
|
|
2012-10-28 21:20:22 +00:00
|
|
|
static int16_t android_input_state(void *data, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned index, unsigned id)
|
2012-10-16 17:46:31 +00:00
|
|
|
{
|
2013-11-01 15:33:32 +00:00
|
|
|
android_input_t *android = (android_input_t*)data;
|
|
|
|
|
2012-12-17 19:53:36 +00:00
|
|
|
switch (device)
|
2012-10-28 21:20:22 +00:00
|
|
|
{
|
2012-12-17 19:53:36 +00:00
|
|
|
case RETRO_DEVICE_JOYPAD:
|
2014-06-07 03:41:02 +00:00
|
|
|
#if 1
|
2014-06-02 11:42:24 +00:00
|
|
|
return input_joypad_pressed(&android_joypad, port, binds[port], id);
|
|
|
|
#else
|
2013-12-28 02:44:37 +00:00
|
|
|
return ((android->pad_state[port] & binds[port][id].joykey) && (port < android->pads_connected));
|
2014-06-02 11:42:24 +00:00
|
|
|
#endif
|
2013-07-31 17:04:28 +00:00
|
|
|
case RETRO_DEVICE_ANALOG:
|
2014-06-07 03:41:02 +00:00
|
|
|
#if 1
|
2014-06-02 11:42:24 +00:00
|
|
|
return input_joypad_analog(&android_joypad, port, index, id, binds[port]);
|
|
|
|
#else
|
2013-11-01 15:33:32 +00:00
|
|
|
if (port >= android->pads_connected)
|
2013-07-31 17:04:28 +00:00
|
|
|
return 0;
|
2013-07-31 19:17:50 +00:00
|
|
|
switch ((index << 1) | id)
|
2013-07-31 17:04:28 +00:00
|
|
|
{
|
|
|
|
case (RETRO_DEVICE_INDEX_ANALOG_LEFT << 1) | RETRO_DEVICE_ID_ANALOG_X:
|
2013-12-28 02:44:37 +00:00
|
|
|
return android->analog_state[port][0][0];
|
2013-07-31 17:04:28 +00:00
|
|
|
case (RETRO_DEVICE_INDEX_ANALOG_LEFT << 1) | RETRO_DEVICE_ID_ANALOG_Y:
|
2013-12-28 02:44:37 +00:00
|
|
|
return android->analog_state[port][0][1];
|
2013-07-31 17:04:28 +00:00
|
|
|
case (RETRO_DEVICE_INDEX_ANALOG_RIGHT << 1) | RETRO_DEVICE_ID_ANALOG_X:
|
2013-12-28 02:44:37 +00:00
|
|
|
return android->analog_state[port][1][0];
|
2013-07-31 17:04:28 +00:00
|
|
|
case (RETRO_DEVICE_INDEX_ANALOG_RIGHT << 1) | RETRO_DEVICE_ID_ANALOG_Y:
|
2013-12-28 02:44:37 +00:00
|
|
|
return android->analog_state[port][1][1];
|
2013-07-31 17:04:28 +00:00
|
|
|
}
|
2014-06-02 11:42:24 +00:00
|
|
|
break;
|
|
|
|
#endif
|
2012-12-21 00:31:01 +00:00
|
|
|
case RETRO_DEVICE_POINTER:
|
2013-07-31 17:04:28 +00:00
|
|
|
switch (id)
|
2012-12-21 00:31:01 +00:00
|
|
|
{
|
|
|
|
case RETRO_DEVICE_ID_POINTER_X:
|
2013-11-01 15:33:32 +00:00
|
|
|
return android->pointer[index].x;
|
2012-12-21 00:31:01 +00:00
|
|
|
case RETRO_DEVICE_ID_POINTER_Y:
|
2013-11-01 15:33:32 +00:00
|
|
|
return android->pointer[index].y;
|
2012-12-21 00:31:01 +00:00
|
|
|
case RETRO_DEVICE_ID_POINTER_PRESSED:
|
2013-11-01 15:33:32 +00:00
|
|
|
return (index < android->pointer_count) && (android->pointer[index].x != -0x8000) && (android->pointer[index].y != -0x8000);
|
2013-01-11 15:32:49 +00:00
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
2014-06-02 11:42:24 +00:00
|
|
|
break;
|
2013-01-11 15:32:49 +00:00
|
|
|
case RARCH_DEVICE_POINTER_SCREEN:
|
2013-07-31 17:04:28 +00:00
|
|
|
switch (id)
|
2013-01-11 15:32:49 +00:00
|
|
|
{
|
|
|
|
case RETRO_DEVICE_ID_POINTER_X:
|
2013-11-01 15:33:32 +00:00
|
|
|
return android->pointer[index].full_x;
|
2013-01-11 15:32:49 +00:00
|
|
|
case RETRO_DEVICE_ID_POINTER_Y:
|
2013-11-01 15:33:32 +00:00
|
|
|
return android->pointer[index].full_y;
|
2013-01-11 15:32:49 +00:00
|
|
|
case RETRO_DEVICE_ID_POINTER_PRESSED:
|
2013-11-01 15:33:32 +00:00
|
|
|
return (index < android->pointer_count) && (android->pointer[index].full_x != -0x8000) && (android->pointer[index].full_y != -0x8000);
|
2012-12-21 00:31:01 +00:00
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
2014-06-02 11:42:24 +00:00
|
|
|
break;
|
2012-12-17 19:53:36 +00:00
|
|
|
}
|
2014-01-20 13:52:53 +00:00
|
|
|
|
|
|
|
return 0;
|
2012-10-16 17:46:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool android_input_key_pressed(void *data, int key)
|
|
|
|
{
|
2014-06-08 04:51:06 +00:00
|
|
|
return ((g_extern.lifecycle_state | driver.overlay_state.buttons) & (1ULL << key))
|
|
|
|
|| input_joypad_pressed(&android_joypad, 0, g_settings.input.binds[0], key);
|
2012-10-16 17:46:31 +00:00
|
|
|
}
|
|
|
|
|
2012-11-26 23:50:29 +00:00
|
|
|
static void android_input_free_input(void *data)
|
2012-10-16 17:46:31 +00:00
|
|
|
{
|
2014-06-02 12:34:31 +00:00
|
|
|
android_input_t *android = (android_input_t*)data;
|
|
|
|
if (!android)
|
|
|
|
return;
|
|
|
|
|
2014-06-07 03:41:02 +00:00
|
|
|
if (android->sensorManager)
|
|
|
|
ASensorManager_destroyEventQueue(android->sensorManager, android->sensorEventQueue);
|
|
|
|
|
2014-05-29 21:57:58 +00:00
|
|
|
free(data);
|
2012-10-16 17:46:31 +00:00
|
|
|
}
|
|
|
|
|
2013-11-02 20:50:38 +00:00
|
|
|
static uint64_t android_input_get_capabilities(void *data)
|
2013-11-02 20:16:57 +00:00
|
|
|
{
|
|
|
|
uint64_t caps = 0;
|
|
|
|
|
|
|
|
caps |= (1 << RETRO_DEVICE_JOYPAD);
|
|
|
|
caps |= (1 << RETRO_DEVICE_POINTER);
|
|
|
|
caps |= (1 << RETRO_DEVICE_ANALOG);
|
|
|
|
|
|
|
|
return caps;
|
|
|
|
}
|
|
|
|
|
2013-11-02 23:27:58 +00:00
|
|
|
static void android_input_enable_sensor_manager(void *data)
|
|
|
|
{
|
|
|
|
android_input_t *android = (android_input_t*)data;
|
|
|
|
struct android_app *android_app = (struct android_app*)g_android;
|
|
|
|
|
|
|
|
android->sensorManager = ASensorManager_getInstance();
|
2013-11-22 20:12:13 +00:00
|
|
|
android_app->accelerometerSensor = ASensorManager_getDefaultSensor(android->sensorManager,
|
2013-11-02 23:27:58 +00:00
|
|
|
ASENSOR_TYPE_ACCELEROMETER);
|
|
|
|
android->sensorEventQueue = ASensorManager_createEventQueue(android->sensorManager,
|
|
|
|
android_app->looper, LOOPER_ID_USER, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
2013-11-03 11:06:14 +00:00
|
|
|
static bool android_input_set_sensor_state(void *data, unsigned port, enum retro_sensor_action action, unsigned event_rate)
|
2013-11-02 23:27:58 +00:00
|
|
|
{
|
|
|
|
android_input_t *android = (android_input_t*)data;
|
2013-11-22 20:12:13 +00:00
|
|
|
struct android_app *android_app = (struct android_app*)g_android;
|
2013-11-02 23:27:58 +00:00
|
|
|
|
|
|
|
if (event_rate == 0)
|
|
|
|
event_rate = 60;
|
|
|
|
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case RETRO_SENSOR_ACCELEROMETER_ENABLE:
|
2014-01-20 15:28:02 +00:00
|
|
|
if (!android_app->accelerometerSensor)
|
2013-11-02 23:27:58 +00:00
|
|
|
android_input_enable_sensor_manager(android);
|
|
|
|
|
2014-01-20 15:28:02 +00:00
|
|
|
if (android_app->accelerometerSensor)
|
|
|
|
ASensorEventQueue_enableSensor(android->sensorEventQueue,
|
|
|
|
android_app->accelerometerSensor);
|
2013-11-02 23:27:58 +00:00
|
|
|
|
|
|
|
// events per second (in us).
|
2014-01-20 15:28:02 +00:00
|
|
|
if (android_app->accelerometerSensor)
|
|
|
|
ASensorEventQueue_setEventRate(android->sensorEventQueue,
|
|
|
|
android_app->accelerometerSensor, (1000L / event_rate) * 1000);
|
2013-11-02 23:27:58 +00:00
|
|
|
|
2013-11-22 20:12:13 +00:00
|
|
|
android_app->sensor_state_mask &= ~(1ULL << RETRO_SENSOR_ACCELEROMETER_DISABLE);
|
|
|
|
android_app->sensor_state_mask |= (1ULL << RETRO_SENSOR_ACCELEROMETER_ENABLE);
|
2013-11-03 11:06:14 +00:00
|
|
|
return true;
|
|
|
|
|
2013-11-02 23:27:58 +00:00
|
|
|
case RETRO_SENSOR_ACCELEROMETER_DISABLE:
|
2014-01-20 15:28:02 +00:00
|
|
|
if (android_app->accelerometerSensor)
|
|
|
|
ASensorEventQueue_disableSensor(android->sensorEventQueue,
|
|
|
|
android_app->accelerometerSensor);
|
2013-11-02 23:27:58 +00:00
|
|
|
|
2013-11-22 20:12:13 +00:00
|
|
|
android_app->sensor_state_mask &= ~(1ULL << RETRO_SENSOR_ACCELEROMETER_ENABLE);
|
|
|
|
android_app->sensor_state_mask |= (1ULL << RETRO_SENSOR_ACCELEROMETER_DISABLE);
|
2013-11-03 11:06:14 +00:00
|
|
|
return true;
|
2014-01-20 14:01:40 +00:00
|
|
|
default:
|
|
|
|
return false;
|
2014-01-20 13:52:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-01-20 13:59:06 +00:00
|
|
|
static float android_input_get_sensor_input(void *data, unsigned port, unsigned id)
|
2014-01-20 13:52:53 +00:00
|
|
|
{
|
|
|
|
android_input_t *android = (android_input_t*)data;
|
2013-11-03 11:06:14 +00:00
|
|
|
|
2014-01-20 13:59:06 +00:00
|
|
|
switch (id)
|
2014-01-20 13:52:53 +00:00
|
|
|
{
|
2014-01-20 16:16:25 +00:00
|
|
|
case RETRO_SENSOR_ACCELEROMETER_X:
|
2014-01-20 13:52:53 +00:00
|
|
|
return android->accelerometer_state.x;
|
2014-01-20 16:16:25 +00:00
|
|
|
case RETRO_SENSOR_ACCELEROMETER_Y:
|
2014-01-20 13:52:53 +00:00
|
|
|
return android->accelerometer_state.y;
|
2014-01-20 16:16:25 +00:00
|
|
|
case RETRO_SENSOR_ACCELEROMETER_Z:
|
2014-01-20 13:52:53 +00:00
|
|
|
return android->accelerometer_state.z;
|
2013-11-02 23:27:58 +00:00
|
|
|
}
|
2014-01-20 13:52:53 +00:00
|
|
|
|
|
|
|
return 0;
|
2013-11-02 23:27:58 +00:00
|
|
|
}
|
|
|
|
|
2014-04-17 18:47:11 +00:00
|
|
|
unsigned android_input_devices_size(void *data)
|
|
|
|
{
|
|
|
|
return DEVICE_LAST;
|
|
|
|
}
|
|
|
|
|
2014-06-02 11:42:24 +00:00
|
|
|
static const rarch_joypad_driver_t *android_input_get_joypad_driver(void *data)
|
|
|
|
{
|
|
|
|
return &android_joypad;
|
|
|
|
}
|
|
|
|
|
2012-10-16 17:46:31 +00:00
|
|
|
const input_driver_t input_android = {
|
2012-11-26 23:50:29 +00:00
|
|
|
android_input_init,
|
2012-10-16 17:46:31 +00:00
|
|
|
android_input_poll,
|
|
|
|
android_input_state,
|
|
|
|
android_input_key_pressed,
|
2012-11-26 23:50:29 +00:00
|
|
|
android_input_free_input,
|
2013-03-14 01:24:57 +00:00
|
|
|
android_input_set_keybinds,
|
2013-11-02 23:27:58 +00:00
|
|
|
android_input_set_sensor_state,
|
2014-01-20 13:52:53 +00:00
|
|
|
android_input_get_sensor_input,
|
2013-11-02 20:16:57 +00:00
|
|
|
android_input_get_capabilities,
|
2014-04-17 18:47:11 +00:00
|
|
|
android_input_devices_size,
|
2012-10-16 17:46:31 +00:00
|
|
|
"android_input",
|
2014-06-02 11:42:24 +00:00
|
|
|
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
android_input_get_joypad_driver,
|
|
|
|
};
|
|
|
|
|
|
|
|
static bool android_joypad_init(void)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool android_joypad_button(unsigned port_num, uint16_t joykey)
|
|
|
|
{
|
|
|
|
android_input_t *android = (android_input_t*)driver.input_data;
|
|
|
|
|
2014-06-07 03:41:02 +00:00
|
|
|
if (!android || port_num >= MAX_PADS || joykey >= LAST_KEYCODE)
|
2014-06-02 11:42:24 +00:00
|
|
|
return false;
|
|
|
|
|
2014-06-07 03:41:02 +00:00
|
|
|
return get_bit(android->pad_state[port_num], joykey);
|
2014-06-02 11:42:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int16_t android_joypad_axis(unsigned port_num, uint32_t joyaxis)
|
|
|
|
{
|
|
|
|
android_input_t *android = (android_input_t*)driver.input_data;
|
|
|
|
if (!android || joyaxis == AXIS_NONE || port_num >= MAX_PADS)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
int val = 0;
|
|
|
|
|
|
|
|
int axis = -1;
|
|
|
|
bool is_neg = false;
|
|
|
|
bool is_pos = false;
|
|
|
|
|
2014-06-07 03:41:02 +00:00
|
|
|
if (AXIS_NEG_GET(joyaxis) < MAX_AXIS)
|
2014-06-02 11:42:24 +00:00
|
|
|
{
|
|
|
|
axis = AXIS_NEG_GET(joyaxis);
|
|
|
|
is_neg = true;
|
|
|
|
}
|
2014-06-07 03:41:02 +00:00
|
|
|
else if (AXIS_POS_GET(joyaxis) < MAX_AXIS)
|
2014-06-02 11:42:24 +00:00
|
|
|
{
|
|
|
|
axis = AXIS_POS_GET(joyaxis);
|
|
|
|
is_pos = true;
|
|
|
|
}
|
|
|
|
|
2014-06-07 03:41:02 +00:00
|
|
|
val = android->analog_state[port_num][axis];
|
2014-06-02 11:42:24 +00:00
|
|
|
|
|
|
|
if (is_neg && val > 0)
|
|
|
|
val = 0;
|
|
|
|
else if (is_pos && val < 0)
|
|
|
|
val = 0;
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void android_joypad_poll(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool android_joypad_query_pad(unsigned pad)
|
|
|
|
{
|
|
|
|
android_input_t *android = (android_input_t*)driver.input_data;
|
2014-06-07 03:41:02 +00:00
|
|
|
return (pad < MAX_PLAYERS && pad < android->pads_connected);
|
2014-06-02 11:42:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const char *android_joypad_name(unsigned pad)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void android_joypad_destroy(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
const rarch_joypad_driver_t android_joypad = {
|
|
|
|
android_joypad_init,
|
|
|
|
android_joypad_query_pad,
|
|
|
|
android_joypad_destroy,
|
|
|
|
android_joypad_button,
|
|
|
|
android_joypad_axis,
|
|
|
|
android_joypad_poll,
|
|
|
|
NULL,
|
|
|
|
android_joypad_name,
|
|
|
|
"android",
|
2012-10-16 17:46:31 +00:00
|
|
|
};
|