mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-01-06 21:37:47 +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 dfc5e6964e)
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user