mirror of
https://github.com/libretro/RetroArch
synced 2025-01-27 12:35:23 +00:00
Revert "Don't assume device IDs won't collide."
This reverts commit ef5b656f2396aaaa26c42d4ebc16b950adb10baf.
This commit is contained in:
parent
ef5b656f23
commit
4e3ffc0d72
@ -33,8 +33,8 @@
|
|||||||
#define MAX_DEVICE_IDS 50
|
#define MAX_DEVICE_IDS 50
|
||||||
|
|
||||||
static unsigned pads_connected;
|
static unsigned pads_connected;
|
||||||
static int state_device_ids[MAX_DEVICE_IDS];
|
|
||||||
static uint64_t state[MAX_PADS];
|
static uint64_t state[MAX_PADS];
|
||||||
|
static int8_t state_device_ids[MAX_DEVICE_IDS];
|
||||||
|
|
||||||
struct input_pointer
|
struct input_pointer
|
||||||
{
|
{
|
||||||
@ -75,7 +75,11 @@ static void *android_input_init(void)
|
|||||||
g_settings.input.binds[player][RETRO_DEVICE_ID_JOYPAD_R3].joykey = (1ULL << RETRO_DEVICE_ID_JOYPAD_R3);
|
g_settings.input.binds[player][RETRO_DEVICE_ID_JOYPAD_R3].joykey = (1ULL << RETRO_DEVICE_ID_JOYPAD_R3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < MAX_DEVICE_IDS; i++)
|
||||||
|
state_device_ids[i] = -1;
|
||||||
|
|
||||||
input_autodetect_init();
|
input_autodetect_init();
|
||||||
|
|
||||||
return (void*)-1;
|
return (void*)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +96,7 @@ static void android_input_poll(void *data)
|
|||||||
g_extern.lifecycle_state &= ~((1ULL << RARCH_RESET) | (1ULL << RARCH_REWIND) | (1ULL << RARCH_FAST_FORWARD_KEY) | (1ULL << RARCH_FAST_FORWARD_HOLD_KEY) | (1ULL << RARCH_MUTE) | (1ULL << RARCH_SAVE_STATE_KEY) | (1ULL << RARCH_LOAD_STATE_KEY) | (1ULL << RARCH_STATE_SLOT_PLUS) | (1ULL << RARCH_STATE_SLOT_MINUS));
|
g_extern.lifecycle_state &= ~((1ULL << RARCH_RESET) | (1ULL << RARCH_REWIND) | (1ULL << RARCH_FAST_FORWARD_KEY) | (1ULL << RARCH_FAST_FORWARD_HOLD_KEY) | (1ULL << RARCH_MUTE) | (1ULL << RARCH_SAVE_STATE_KEY) | (1ULL << RARCH_LOAD_STATE_KEY) | (1ULL << RARCH_STATE_SLOT_PLUS) | (1ULL << RARCH_STATE_SLOT_MINUS));
|
||||||
|
|
||||||
// Read all pending events.
|
// Read all pending events.
|
||||||
while (AInputQueue_hasEvents(android_app->inputQueue) > 0)
|
while(AInputQueue_hasEvents(android_app->inputQueue) > 0)
|
||||||
{
|
{
|
||||||
AInputEvent* event = NULL;
|
AInputEvent* event = NULL;
|
||||||
if (AInputQueue_getEvent(android_app->inputQueue, &event) < 0)
|
if (AInputQueue_getEvent(android_app->inputQueue, &event) < 0)
|
||||||
@ -103,17 +107,13 @@ static void android_input_poll(void *data)
|
|||||||
int source = AInputEvent_getSource(event);
|
int source = AInputEvent_getSource(event);
|
||||||
int id = AInputEvent_getDeviceId(event);
|
int id = AInputEvent_getDeviceId(event);
|
||||||
|
|
||||||
|
|
||||||
int type_event = AInputEvent_getType(event);
|
int type_event = AInputEvent_getType(event);
|
||||||
int state_id = -1;
|
int state_id = state_device_ids[id];
|
||||||
|
|
||||||
for (unsigned i = 0; i < pads_connected; i++)
|
if(state_id == -1)
|
||||||
if (state_device_ids[i] == id)
|
|
||||||
state_id = i;
|
|
||||||
|
|
||||||
if (state_id < 0)
|
|
||||||
{
|
{
|
||||||
state_id = pads_connected;
|
state_id = state_device_ids[id] = pads_connected++;
|
||||||
state_device_ids[pads_connected++] = id;
|
|
||||||
input_autodetect_setup(state_id, id, source);
|
input_autodetect_setup(state_id, id, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user