1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

GMS 2 Gamepad woes - bugs?

Discussion in 'Programming' started by untune, Jul 2, 2017.

  1. untune

    untune Member

    Joined:
    Apr 9, 2017
    Posts:
    17
    I've been working on a system that handles input. I'm currently ensuring that gamepads connect and are tracked properly amongst multiple player objects but I've run into a few issues (I'm on Windows 7 x64):

    1. Direct Input pads crash the game. I've reported this one as it was apparently fixed, but I'm still getting it in 2.0.7. Connecting/disconnecting a DI pad a few times (anywhere between 1-3 tries) crashes the game - I've heard of it happening with PS4 pads and I had it with a cheap generic USB SNES pad. Happens in a completely blank project free of any resources.

    2. The gamepad_is_connected() function doesn't seem to work for DI pads. Found this one last night but I'm not sure about it. My system detects the pad through the async event and finds it at slot 4 as it should do, but prior to that I run a check on all 12 possible slots to see what is connected. It finds XInput pads without fail, but not the DI one - which is causing me issues as my data structures are reporting it missing. There does seem to be a delay in detecting DI pads, so I tested it by running my function to refresh the device list manually a few times but still, it reports false when I check slot 4. I also tried this in a completely blank project, tested for slot 4, got false. Again looped through all 12 slots and got 0.

    3. Steam pad just isn't detected full stop. The only other pad I have to test with is the Steam pad and I was expecting this to appear on an XI slot, but it doesn't even register through the async event or anything else I've set up to detect things. I disconnected all XBox pads in case of a conflict but it finds nothing. It treats the track pad as a mouse so I'm wondering if perhaps it doesn't register as a gamepad at all due to the way the driver is set up?

    Has anybody had any similar issues before I report 2 & 3?

    Cheers
     
  2. untune

    untune Member

    Joined:
    Apr 9, 2017
    Posts:
    17
    I've just noticed that the DirectInput pad also appears to register a disconnect event whenever the game window loses focus (i.e. pausing the debugger etc) but for some reason this never appeared to register before. I've made no changes that I can recall to the "gamepad lost" handler so that seems odd. This is why my internal list was always reporting the DI pad as not present, as it was removing it from the list every time I paused the debugger to check the contents.

    It would appear that this is correct behaviour for DI devices (depending how it's configured on the Windows API side, seemingly via CooperativeLevelFlags) i.e the device is only valid if the window is in the foreground, so it might be good to know for future reference.
     
  3. untune

    untune Member

    Joined:
    Apr 9, 2017
    Posts:
    17
    I've done futher testing and I think 2. can be ignored - the time delay to detect the pad as connected is much more significant with DI than XI and as a result, it's not picking it up when I run the check when I create my input object. So the function does work, but not immediately.

    After some further research it seems that 3. is also a Steam pad limitation as it does indeed see it as a keyboard and mouse and not as a regular device under XI or DI. It may well register input, but won't be detected by the gamepad functions. Steam Works apparently gives a lot more data but I haven't delved into that side of things - lots of useful information here: http://www.davetech.co.uk/gamemakersteamcontroller

    There are apparently some ways to hack it https://www.reddit.com/r/SteamController/comments/4b8zdp/xoutput_for_uwp_games/ so that it will be recognised as an XBox pad, but it's not ideal and I've not tested it. Probably best to treat it as a keyboard and adjust bindings to suit.

    So that just leaves 1. - it would be good if people could test it with PS4/non-XInput gamepads by simply creating a blank project, running it, and plugging the pad in and out of a USB port a few times (with the latest GMS2/runtime)

    Cheers
     
  4. Lahssoo

    Lahssoo Guest

    I reported that a few month ago too, with a dualshock 4, @rwkay said they were working on it : https://forum.yoyogames.com/index.p...oller-disconnect-reconnect.21769/#post-136559

    About the gamepad disconnection when the game loses focus, I scrapped the joystick part of the SDL and slapped it in a DLL, I now have a perfect control over my Dinput devices, sadly GMS 2 still crashes :/
     
    Last edited by a moderator: Jul 2, 2017
  5. untune

    untune Member

    Joined:
    Apr 9, 2017
    Posts:
    17
    @Lahssoo It was actually your original thread that I found when I first had this issue last week :D I didn't report it thinking that it was already being looked at. But I mentioned it on twitter, Russell said it was apparently already fixed; it's showing as resolved in the bug list so I've filed another report
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice