mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-06-01 10:45:32 +00:00
Fix controller add linux
This commit is contained in:
parent
835b2dd3ed
commit
6d486e6ea5
|
@ -704,7 +704,7 @@ static void GamepadAddDevice(const char* devPath) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == GAMEPAD_COUNT) {
|
if (controller == GAMEPAD_COUNT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -718,19 +718,18 @@ static void GamepadAddDevice(const char* devPath) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy the device path */
|
/* copy the device path */
|
||||||
STATE[i].device = strdup(devPath);
|
STATE[controller].device = strdup(devPath);
|
||||||
if (STATE[i].device == NULL) {
|
if (STATE[controller].device == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reset device state */
|
/* reset device state */
|
||||||
GamepadResetState((GAMEPAD_DEVICE)i);
|
GamepadResetState((GAMEPAD_DEVICE)controller);
|
||||||
|
|
||||||
fcntl(fd, F_SETFL, O_NONBLOCK);
|
fcntl(fd, F_SETFL, O_NONBLOCK);
|
||||||
STATE[i].fd = fd;
|
STATE[controller].fd = fd;
|
||||||
STATE[i].flags |= FLAG_CONNECTED;
|
STATE[controller].flags |= FLAG_CONNECTED;
|
||||||
|
|
||||||
int controller = i;
|
|
||||||
{
|
{
|
||||||
int i, t;
|
int i, t;
|
||||||
unsigned long keybit[NBITS(KEY_MAX)] = { 0 };
|
unsigned long keybit[NBITS(KEY_MAX)] = { 0 };
|
||||||
|
|
Loading…
Reference in New Issue
Block a user