HTML5 gamepad disconnect freeze

AshumBesherAshumBesher Member, PRO Posts: 129

I'm working on adding controller support for my game. I'm testing using an Xbox One controller with a USB. It all works fine except for one thing. If I disconnect the USB mid-game, the game screen freezes. Is there a fix for this? Thanks.

Comments

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,223

    Is this happening in browser or in wrapper?

    I've never seen the problem in browser, but I only have the PS4 controller and our arcade sticks to play with.

    If it's in wrapper, let me know which version of nw.js / electron you're using so we can look at it.

    If it's in browser, let me know what browser you're testing with.

  • AshumBesherAshumBesher Member, PRO Posts: 129

    It's happening in the wrapper (nw,js 0.63.0), but I also made a quick test project in the online creator and it happens in the online creator preview too.

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,223

    @AshumBesher are you using Chrome or Firefox?

  • AshumBesherAshumBesher Member, PRO Posts: 129

    It happens in the online creator in both Chrome and Edge.

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,223

    K, thx. I guess it's time to go grab an Xbox controller!

  • AshumBesherAshumBesher Member, PRO Posts: 129

    It's an unusual bug. When it freezes, it seems as though the game is still running as it should but the video just isn't refreshing. I noticed when I reconnect the controller, it resumes the game from after the amount of "frozen" time has passed, so gameplay was still happening in the background while the screen was stuck. I'm not sure if I explained this well, but I hope this helps narrow down the problem.

  • AshumBesherAshumBesher Member, PRO Posts: 129

    Tonight I tested with a Nintendo Switch pro controller via USB, same thing happens.

  • AshumBesherAshumBesher Member, PRO Posts: 129

    Has anybody been able to replicate this?

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,223

    @AshumBesher found the source of it. Looking into one other issue and will push an update.

  • AshumBesherAshumBesher Member, PRO Posts: 129

    Great, thanks :)

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,223

    This fix has been pushed, let us know if you run into any issues.

  • AshumBesherAshumBesher Member, PRO Posts: 129

    The controller disconnects without freezing the game now, thank you. However the game.players.player1.joystick.connected doesn't seem to change back to false after disconnect.

  • AshumBesherAshumBesher Member, PRO Posts: 129

    Since the game.players.player1.joystick.connected doesn't change back to false on disconnect, any rules I make based on that don't work. Is there a fix for this? Thanks.

  • AshumBesherAshumBesher Member, PRO Posts: 129

    Never mind, I figured out a fix, I edited a few lines in the "gse-export" JavaScript file. I had pretty much no idea what I was doing, but I got it working with trial and error haha.

Sign In or Register to comment.