• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Windows [SOLVED] DirectInput controller not detected in any slot

P

pixelkitty

Guest
Hi. Was hoping someone could help. I'm trying to test my gamepad control code, and I can't get GMS to detect DirectInput controllers. Tested with both my PS4 gamepad connected by bluetooth, and a SmartJoy USB adapter for a PS2 controller.

I know about Xinput vs DirectInput slots, but that doesn't seem to be the issue. I check gamepad_get_device_count, and get 12 slots, as expected in windows. Then I loop through checking gamepad_is_connected(i) for 0-11, and I get false on every slot. No gamepad found.

But the system detects it. USB controller config sees them fine. Other games see them fine. So, I'm kind of stumped. Any ideas?

Tested with XBOne controller with adapter, works fine detected on slot 0.

Windows 10. Latest GMS 1.4.

Relevant code:

for (var i = 0; i < gamepad_get_device_count(); i++)
{
show_debug_message("checking slot " + string(i));
if (gamepad_is_connected(i))
{
show_debug_message("Slot " + string(i) + " was connected. Creating instance.");
//create gamepad object instance code removed for brevity
}
else
{
show_debug_message("Slot " + string(i) + " was not found");
}
}
 
Last edited by a moderator:
P

pixelkitty

Guest
Found the solution. Seems to be a timing issue. The game checks for controllers before the DirectInput controllers are found. I added code to redo the entire check on a debug key press, and the controller is found on the first repeat of the code.

Was going to add code to monitor gamepad changes anyway. Guess I'll bump that up in importance.
 
Top