joystick:getGamepadMapping(buttonName) always returns nil

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: joystick:getGamepadMapping(buttonName) always returns nil

Post by raidho36 »

There's no reason it shouldn't work - it is a gamepad. It's just there's no stock mapping for it.
User avatar
slime
Solid Snayke
Posts: 3163
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: joystick:getGamepadMapping(buttonName) always returns nil

Post by slime »

love.gamepadpressed and friends don't work without a mapping between the joystick button and axis indices and the gamepad control scheme. Joystick:getGamepadMapping is supposed to retrieve that mapping, but it isn't happening in this case even though the mapping exists.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: joystick:getGamepadMapping(buttonName) always returns nil

Post by raidho36 »

For what I can tell, SDL_GameControllerMappingForGUID fails to return mapping string, presumably due to GUID from SDL_JoystickGetGUIDFromString being invalid - that function will produce GUID from any input but if it wasn't a valid joystick GUID then it won't be useful, as per docs.
User avatar
sandygk
Prole
Posts: 20
Joined: Mon Nov 28, 2016 9:22 pm

Re: joystick:getGamepadMapping(buttonName) always returns nil

Post by sandygk »

can anyone confirm if getGamepadMapping() works with other controllers? it doesn't seem to work with Xbox controllers
User avatar
sandygk
Prole
Posts: 20
Joined: Mon Nov 28, 2016 9:22 pm

Re: joystick:getGamepadMapping(buttonName) always returns nil

Post by sandygk »

OK, so, what to do now?
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: joystick:getGamepadMapping(buttonName) always returns nil

Post by raidho36 »

You can just not use it. All other gamepad functionality works fine.
User avatar
slime
Solid Snayke
Posts: 3163
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: joystick:getGamepadMapping(buttonName) always returns nil

Post by slime »

sandygk wrote:can anyone confirm if getGamepadMapping() works with other controllers? it doesn't seem to work with Xbox controllers
It works when I use my 360 controller in macOS. I suspect this is a bug in how SDL handles xinput controllers on Windows/Linux (in macOS there's no xinput).

I may be able to make getGamepadMapping use an alternative API in SDL to work around the issue, if it doesn't get fixed in SDL itself. We'll see.
User avatar
sandygk
Prole
Posts: 20
Joined: Mon Nov 28, 2016 9:22 pm

Re: joystick:getGamepadMapping(buttonName) always returns nil

Post by sandygk »

that would be great :D
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: joystick:getGamepadMapping(buttonName) always returns nil

Post by raidho36 »

I don't think it's a bug in the way SDL handles controllers (mine does works if you use *Gamepad functions), it's the function that should return mapping by GUID that may be bugged. Or the function that returns GUID is bugged - that's a possibility as well.
User avatar
sandygk
Prole
Posts: 20
Joined: Mon Nov 28, 2016 9:22 pm

Re: joystick:getGamepadMapping(buttonName) always returns nil

Post by sandygk »

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 5 guests