Skip to content

WASD mapped to the Left GamePad Stick for moving, sometimes gets stuck #61

Open

Description

@luttje

I tried this in Portal 1 and with both v 0.7.0 and 0.6.0 the game will occasionally not catch me releasing A and get me stuck walking towards the left.

A theory on why this happens:

  • Some Keyboard input is inadvertently captured besides the simulated gamepad input, but the release isn't.

I think this might be the case, because on my other monitor the tester shows the gamepad stick movement just fine.

Activity

  1. added
    bug
    on Nov 1, 2023
  2. added this to the Launch stable (1.0.0) milestone on Nov 1, 2023
  3. luttje commented on Nov 1, 2023

    @luttje
    CollaboratorAuthor

    The 'sometimes' can be replicated consistently by:

    • Press and hold down A
    • Press and release W
    • Release A

    Nevermind, it's a bit different

  4. luttje commented on Nov 1, 2023

    @luttje
    CollaboratorAuthor

    Relevant mappings:
    image

    Config where problem occurs:
    image

  5. luttje commented on Nov 1, 2023

    @luttje
    CollaboratorAuthor

    Note: an issue with how mappings for gamepad sticks currently work:

    Keyboard input: S KeyDown -> GamePad 2 Left x=0 y=-32768
    Keyboard input: S KeyUp -> GamePad 2 Left x=0 y=32767
    This will get the stick into position 0, -1

  6. luttje commented on Nov 1, 2023

    @luttje
    CollaboratorAuthor

    Note: Abort should really be tied to Releasing Escape (not pressing as it is now), since overriding default behavior may keep escape stuck pressed down

  7. luttje commented on Nov 1, 2023

    @luttje
    CollaboratorAuthor

    I'm having serious trouble reproducing it if I remove the mouse-move -> right stick mapping. Also I feel that this may be a problem with the game not having focus, keyboard input getting picked up (but only press) then game input getting picked up by it and switching to gamepad mode, but when the gamepad somehow gets deactivated (by keyboard input sneaking into the game again?) it gets stuck on the last pressed (but never released input key).

    It's quite the bug to reproduce and it's even hard to explain. I'll put more work into this another time.

  8. luttje commented on Nov 1, 2023

    @luttje
    CollaboratorAuthor

    I think this is a race condition between simulated game inputs. Consider the following happening in sequence:

    • Thread A: Mouse Move -> Right Stick gets the controller state
    • Thread B: Keyboard WASD -> Left stick gets the controller
    • Thread A: Mouse Move -> Right Stick Updates the controller state
    • Thread B: Keyboard WASD -> Left stick Updates the controller state with now outdated information

    This is different orders would explain the weird behavior. I will try ensure only one thread is manipulating the input at a time. Or use a queue of some sort

  9. added a commit that references this issue on Nov 2, 2023
  10. luttje commented on Nov 11, 2023

    @luttje
    CollaboratorAuthor
  11. luttje commented on Nov 19, 2023

    @luttje
    CollaboratorAuthor

    Notes for possible solutions...

    Other libraries:

    Other windows hook related sources:

    Other techniques and sources:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions