mirror of https://github.com/libsdl-org/SDL
Fixed crash if RAWINPUT is not initialized
We shouldn't be doing any of this work in that case
This commit is contained in:
parent
2e3404db01
commit
dfc5e6964e
|
@ -1105,8 +1105,13 @@ static void RAWINPUT_PostUpdate(void)
|
||||||
|
|
||||||
static void RAWINPUT_JoystickDetect(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) {
|
if (remote_desktop != SDL_RAWINPUT_remote_desktop) {
|
||||||
SDL_RAWINPUT_remote_desktop = remote_desktop;
|
SDL_RAWINPUT_remote_desktop = remote_desktop;
|
||||||
|
|
||||||
|
@ -2028,8 +2033,12 @@ static void RAWINPUT_JoystickClose(SDL_Joystick *joystick)
|
||||||
|
|
||||||
SDL_bool RAWINPUT_RegisterNotifications(HWND hWnd)
|
SDL_bool RAWINPUT_RegisterNotifications(HWND hWnd)
|
||||||
{
|
{
|
||||||
RAWINPUTDEVICE rid[SDL_arraysize(subscribed_devices)];
|
|
||||||
int i;
|
int i;
|
||||||
|
RAWINPUTDEVICE rid[SDL_arraysize(subscribed_devices)];
|
||||||
|
|
||||||
|
if (!SDL_RAWINPUT_inited) {
|
||||||
|
return SDL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < SDL_arraysize(subscribed_devices); i++) {
|
for (i = 0; i < SDL_arraysize(subscribed_devices); i++) {
|
||||||
rid[i].usUsagePage = USB_USAGEPAGE_GENERIC_DESKTOP;
|
rid[i].usUsagePage = USB_USAGEPAGE_GENERIC_DESKTOP;
|
||||||
|
@ -2050,6 +2059,10 @@ int RAWINPUT_UnregisterNotifications()
|
||||||
int i;
|
int i;
|
||||||
RAWINPUTDEVICE rid[SDL_arraysize(subscribed_devices)];
|
RAWINPUTDEVICE rid[SDL_arraysize(subscribed_devices)];
|
||||||
|
|
||||||
|
if (!SDL_RAWINPUT_inited) {
|
||||||
|
return SDL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < SDL_arraysize(subscribed_devices); i++) {
|
for (i = 0; i < SDL_arraysize(subscribed_devices); i++) {
|
||||||
rid[i].usUsagePage = USB_USAGEPAGE_GENERIC_DESKTOP;
|
rid[i].usUsagePage = USB_USAGEPAGE_GENERIC_DESKTOP;
|
||||||
rid[i].usUsage = subscribed_devices[i];
|
rid[i].usUsage = subscribed_devices[i];
|
||||||
|
|
Loading…
Reference in New Issue