Split drm update input (#3397)
* Update `PLATFORM_DRM` implementation of `GetGamepadAxisCount` * Update * Update `PLATFORM_DRM` implementation of `GetGamepadName` * Add example to test gamepad info functions Fix typo * Update new gamepad info example * Move axis count update out of GamepadThread - race condition * Remove pointless if statement
This commit is contained in:
parent
101a9b0445
commit
daba1a2794
3 changed files with 65 additions and 14 deletions
|
|
@ -742,25 +742,12 @@ void OpenURL(const char *url)
|
|||
// Get gamepad internal name id
|
||||
const char *GetGamepadName(int gamepad)
|
||||
{
|
||||
const char *name = NULL;
|
||||
|
||||
if (CORE.Input.Gamepad.ready[gamepad])
|
||||
{
|
||||
ioctl(platform.gamepadStreamFd[gamepad], JSIOCGNAME(64), &CORE.Input.Gamepad.name[gamepad]);
|
||||
name = CORE.Input.Gamepad.name[gamepad];
|
||||
}
|
||||
|
||||
return name;
|
||||
return CORE.Input.Gamepad.name[gamepad];
|
||||
}
|
||||
|
||||
// Get gamepad axis count
|
||||
int GetGamepadAxisCount(int gamepad)
|
||||
{
|
||||
int axisCount = 0;
|
||||
|
||||
if (CORE.Input.Gamepad.ready[gamepad]) ioctl(platform.gamepadStreamFd[gamepad], JSIOCGAXES, &axisCount);
|
||||
CORE.Input.Gamepad.axisCount = axisCount;
|
||||
|
||||
return CORE.Input.Gamepad.axisCount;
|
||||
}
|
||||
|
||||
|
|
@ -1959,6 +1946,9 @@ static void InitGamepad(void)
|
|||
if (error != 0) TRACELOG(LOG_WARNING, "RPI: Failed to create gamepad input event thread");
|
||||
else TRACELOG(LOG_INFO, "RPI: Gamepad device initialized successfully");
|
||||
}
|
||||
|
||||
ioctl(platform.gamepadStreamFd[i], JSIOCGNAME(64), &CORE.Input.Gamepad.name[i]);
|
||||
ioctl(platform.gamepadStreamFd[i], JSIOCGAXES, &CORE.Input.Gamepad.axisCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue