mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-01-23 12:11:06 +00:00
Fixed crash if RAWINPUT is not initialized
We shouldn't be doing any of this work in that case (cherry picked from commit dfc5e6964eca0a0813768518d08cf1c80136e896)
This commit is contained in:
parent
6bf5f5a221
commit
9117b2e300
|
@ -1102,8 +1102,13 @@ static void RAWINPUT_PostUpdate(void)
|
|||
|
||||
static void RAWINPUT_JoystickDetect(void)
|
||||
{
|
||||
SDL_bool remote_desktop = GetSystemMetrics(SM_REMOTESESSION) ? SDL_TRUE : SDL_FALSE;
|
||||
SDL_bool remote_desktop;
|
||||
|
||||
if (!SDL_RAWINPUT_inited) {
|
||||
return;
|
||||
}
|
||||
|
||||
remote_desktop = GetSystemMetrics(SM_REMOTESESSION) ? SDL_TRUE : SDL_FALSE;
|
||||
if (remote_desktop != SDL_RAWINPUT_remote_desktop) {
|
||||
SDL_RAWINPUT_remote_desktop = remote_desktop;
|
||||
|
||||
|
@ -2008,8 +2013,12 @@ static void RAWINPUT_JoystickClose(SDL_Joystick *joystick)
|
|||
|
||||
SDL_bool RAWINPUT_RegisterNotifications(HWND hWnd)
|
||||
{
|
||||
RAWINPUTDEVICE rid[SDL_arraysize(subscribed_devices)];
|
||||
int i;
|
||||
RAWINPUTDEVICE rid[SDL_arraysize(subscribed_devices)];
|
||||
|
||||
if (!SDL_RAWINPUT_inited) {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
for (i = 0; i < SDL_arraysize(subscribed_devices); i++) {
|
||||
rid[i].usUsagePage = USB_USAGEPAGE_GENERIC_DESKTOP;
|
||||
|
@ -2030,6 +2039,10 @@ void RAWINPUT_UnregisterNotifications()
|
|||
int i;
|
||||
RAWINPUTDEVICE rid[SDL_arraysize(subscribed_devices)];
|
||||
|
||||
if (!SDL_RAWINPUT_inited) {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
for (i = 0; i < SDL_arraysize(subscribed_devices); i++) {
|
||||
rid[i].usUsagePage = USB_USAGEPAGE_GENERIC_DESKTOP;
|
||||
rid[i].usUsage = subscribed_devices[i];
|
||||
|
|
Loading…
Reference in a new issue