Reported in version: HG 2.1
Reported for operating system, platform: All, All
Comments on the original bug report:
On 2018-01-16 14:47:50 +0000, Andrew Eikum wrote:
Created attachment 3141
Patch to remove XINPUT_STATE_EX
This revision introduced the XINPUT_STATE_EX and XINPUT_GAMEPAD_EX structs, which are identical to XINPUT_STATE and XINPUT_GAMEPAD, but add an extra 4 bytes for "padding":
changeset: 6690:9548c8a58103
user: Sam Lantinga slouken@libsdl.org
date: Mon Nov 26 16:37:54 2012 -0800
summary: Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
As far as I can tell, these structs do not exist in the win32 API. Tests against Microsoft's xinput DLLs show that it never writes to this padding field.
These bogus structs have been copied into mumble-voip[1] and into Wine[2] and from there into mingw-w64. It actually caused a bug in Wine due to our writing into the padding field, which the application never allocated, because it doesn't exist.
To stem the spread of these structs and prevent confusion, I suggest eliminating these structs from SDL. I've attached a diff here that eliminates them from libSDL. Note that I didn't regenerate configure and other build files, as I'm not familiar with your build system.
If you desire to keep the EX versions for type safety reasons, then I suggest eliminating the dwPaddingReserved field.
See also my thread on the Discourse[3].
I suspect the same may be true of XINPUT_BATTERY_INFORMATION_EX, but I didn't test this struct against Microsoft's implementation.
I believe this struct is used with the undocumented XInputGetStateEx() function (ordinal 100)
Have you tried verifying that?
On 2018-01-17 13:45:04 +0000, Andrew Eikum wrote:
Yes, that's what I tested with. I set dwPaddingReserved to some value, called that function, and verified that it still had the original value afterwards. Additionally, real win32 apps do not allocate memory for dwPaddingReserved before calling ordinal 100, and they do not crash.
This bug report was migrated from our old Bugzilla tracker.
These attachments are available in the static archive:
Reported in version: HG 2.1 Reported for operating system, platform: All, All
Comments on the original bug report:
On 2018-01-16 14:47:50 +0000, Andrew Eikum wrote:
On 2018-01-16 20:09:41 +0000, Sam Lantinga wrote:
On 2018-01-17 13:45:04 +0000, Andrew Eikum wrote: