joystick:getGamepadMapping(buttonName) always returns nil with xbox controller on windows

Issue #1239 open
Sandy Gutierrez Kamayd
created an issue

I am using a xbox 360 controllers on windows (wired and wireless), when I try to get the inputindex for any button using the Joystick:getGamepadMapping()function I always get nil results, the function Joystick:isGamepadDown() works fine tho. I created a thread in the forums and other people had the same issue. This is the code:

   local inputtype, inputindex, hatdirection = joystick:getGamepadMapping("a")
   print("name", joystick:getName())
   print("is gamepad", joystick:isGamepad())
   print("inputtype", inputtype)
   print("inputindex", inputindex)
   print("hatdirection", hatdirection)


   name XInput Controller #1
   is gamepad true
   inputtype nil
   inputindex nil
   hatdirection nil

Comments (4)

  1. Raidho

    Not just windows, same problem in Linux. I suppose the mapping getter function (or underlying api) is bugged, since otherwise all gamepad functionality works fine.

  2. Alex Szpakowski

    The problem is with the GUID string returned as part of SDL_GameControllerMapping for XInput devices I believe. I plan to replace love's use of it with SDL_GameControllerGetBindForButton and SDL_GameControllerGetBindForAxis which seem to work fine (I also plan to see if I can fix the underlying issue in SDL's source code).

  3. Log in to comment