Windows Problem with ps4 controller input

asollazzo

Member
Hey guys, so recently i was adding controller support to my game and ran into a problem. Using 1 ps4 controller works fine, but using 2 at once gets a little crazy.

Sometimes they will work, other times 1 controller will somehow control both gamemaker pad inputs, and when removing the first controller the second will also get removed along with a spam of this error "Lost device -> Wireless Controller - 80040209" in the debug console.

This happens in my current project aswell as a fresh project with nothing but gamemakers own code to connect and disconnect controller inputs.

While trying to track down what was going on i found someone else that had the same issue a while back but he never seemed to get the problem resolved. https://forum.yoyogames.com/index.php?threads/funky-gamepads-issue.38952/

This only seems to happen with directinput controllers as running the game through steam runs the ps4 controllers as xinput and everything works fine.

Any help would be appreciated !
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Could you share the code that you're using for the gamepad detection and removal?
 

asollazzo

Member
Sure im using this, straight from the gamemaker blog, https://www.yoyogames.com/blog/75/how-to-setup-and-use-gamepads
I removed pretty much all the uneeded code and its running in an empty room in a persistent object's async event to make sure my other code wasnt messing with it.

GML:
show_debug_message("Event = " + async_load[? "event_type"]);        // Debug cocde so you can see which event has been
show_debug_message("Pad = " + string(async_load[? "pad_index"]));   // triggered and the pad associated with it.

switch(async_load[? "event_type"])             // Parse the async_load map to see which event has been triggered
{
case "gamepad discovered":                     // A game pad has been discovered
    var pad = async_load[? "pad_index"];       // Get the pad index value from the async_load map

    break;
case "gamepad lost":                           // Gamepad has been removed or otherwise disabled
    var pad = async_load[? "pad_index"];       // Get the pad index

    break;
}
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Okay, yeah, that should be fine... In this case I'd file a bug report and include a link to a test project that shows the issue (for you). I'd also link to the other forum topic that talks about this issue too to show there is precedence. Something is obviously not right, and while I suspect it may be a driver issue or something outside of GMS that is actually causing this, it certainly needs looking into.
 

asollazzo

Member
Looks like bug report it is then. I just tested on my laptop and it too has the same issue (main pc is windows 10, laptop windows 8), so im not really sure whats going on. Controller i assume isnt faulty because no matter which of the 2 i plug in first unplugging it also unplugs the other (it only gets unplugged within gamemaker, windows still detects it fine ?).
 
Top