mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-01-25 01:21:02 +00:00
Fixed reading input from the Razer Atrox Arcade Stick using Windows Gaming Input
(cherry picked from commit 172cfca51332a845abf9c141ae56aa121fe4ada5)
This commit is contained in:
parent
f5b3247aae
commit
1cdd6dc829
|
@ -837,17 +837,20 @@ static void WGI_JoystickUpdate(SDL_Joystick *joystick)
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = __x_ABI_CWindows_CGaming_CInput_CIRawGameController_GetCurrentReading(hwdata->controller, nbuttons, buttons, nhats, hats, naxes, axes, ×tamp);
|
hr = __x_ABI_CWindows_CGaming_CInput_CIRawGameController_GetCurrentReading(hwdata->controller, nbuttons, buttons, nhats, hats, naxes, axes, ×tamp);
|
||||||
if (SUCCEEDED(hr) && timestamp != hwdata->timestamp) {
|
if (SUCCEEDED(hr) && (!timestamp || timestamp != hwdata->timestamp)) {
|
||||||
UINT32 i;
|
UINT32 i;
|
||||||
SDL_bool all_zero = SDL_TRUE;
|
SDL_bool all_zero = SDL_FALSE;
|
||||||
|
|
||||||
/* The axes are all zero when the application loses focus */
|
/* The axes are all zero when the application loses focus */
|
||||||
|
if (naxes > 0) {
|
||||||
|
all_zero = SDL_TRUE;
|
||||||
for (i = 0; i < naxes; ++i) {
|
for (i = 0; i < naxes; ++i) {
|
||||||
if (axes[i] != 0.0f) {
|
if (axes[i] != 0.0f) {
|
||||||
all_zero = SDL_FALSE;
|
all_zero = SDL_FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (all_zero) {
|
if (all_zero) {
|
||||||
SDL_PrivateJoystickForceRecentering(joystick);
|
SDL_PrivateJoystickForceRecentering(joystick);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue