libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
9.79k stars 1.82k forks source link

xinput values used within WGI codeblock #5580

Closed Jan200101 closed 2 years ago

Jan200101 commented 2 years ago

In the beginning of the rawinputjoystick files these two are defined

https://github.com/libsdl-org/SDL/blob/0f45a4e3036820f3ea00e4234e5a22a7f3702ed0/src/joystick/windows/SDL_rawinputjoystick.c#L48-L53

Later SDL_JOYSTICK_RAWINPUT_XINPUT is used to define these members of the joystick_hwdata struct https://github.com/libsdl-org/SDL/blob/0f45a4e3036820f3ea00e4234e5a22a7f3702ed0/src/joystick/windows/SDL_rawinputjoystick.c#L142-L150

but later on the member xinput_correlated is used within a WGI codeblock despite the possibility of it not being defined.

https://github.com/libsdl-org/SDL/blob/0f45a4e3036820f3ea00e4234e5a22a7f3702ed0/src/joystick/windows/SDL_rawinputjoystick.c#L1592-L1600

Jan200101 commented 2 years ago

There seems to be another case like this in the same file.

rumbled is defined within an ifdef block

https://github.com/libsdl-org/SDL/blob/0f45a4e3036820f3ea00e4234e5a22a7f3702ed0/src/joystick/windows/SDL_rawinputjoystick.c#L1280-L1283

but is later used without those same checks https://github.com/libsdl-org/SDL/blob/0f45a4e3036820f3ea00e4234e5a22a7f3702ed0/src/joystick/windows/SDL_rawinputjoystick.c#L1315-L1317