gamepad_get_device_count not working correctly

Reporter: SuperRiderTH  |  Status: open  |  Last Modified: September 07, 2016, 11:00:34 PM

gamepad_get_device_count returns 32437344 with no controllers plugged in, and returns 32437345 with one plugged in.

This is quite wrong, and can cause game hanging with code such as:
for (i=0; i<gamepad_get_device_count(); i+=1)

RobertBColton  
This is corrected in #966 and the function will work the same as Studio after I finish that PR. In other words, it will always report 4 on Windows and then you have to use gamepad_is_connected to see the actual number of connected devices.

https://docs.yoyogames.com/source/dadiospice/002_reference/mouse,%20keyboard%20and%20other%20controls/gamepad%20input/gamepad_get_device_count.html

It will now just return the XInput constant XUSER_MAX_COUNT. Never hard code 4 into a game btw as it is possible, though highly unlikely, that Microsoft could update XInput with more controllers in the future.

Please sign in to post comments, or you can view this issue on GitHub.