love does some parsing of the SDL mapping string inside getGamepadMapping. There may be a bug in that. In the first post it was already determined that SDL does recognize it as a gamepad (the SDL_GameController API does recognize it), and apparently the input callbacks work.raidho36 wrote:The getGamepadMapping goes down to according SDL function, if there's a bug it's in SDL. Pretty sure though it's just SDL can't pick up the controller as XBox gamepad for whatever reason.
joystick:getGamepadMapping(buttonName) always returns nil
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- 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
Re: joystick:getGamepadMapping(buttonName) always returns nil
It will only return nil if SDL_GameControllerMappingForGUID fails or if its returned mapped string doesn't contains the requested input map. So either mapping for that GUID does not exist altogether, or it's empty (since standard map is requested, i.e. it can't be absent from valid standard mapping).
Re: joystick:getGamepadMapping(buttonName) always returns nil
slime wrote:What's the output of [wiki]Joystick:getGUID[/wiki] for you?
Code: Select all
print(love.joystick.getJoysticks()[1]:getGUID())
prints:
78696e70757401000000000000000000
Re: joystick:getGamepadMapping(buttonName) always returns nil
I remember reading that SDL uses this list for mapping:
https://github.com/gabomdq/SDL_GameCont ... llerdb.txt.
If that's the case, my GUID (78696e70757401000000000000000000) does not appear in the list, and there is no entry for Xbox controller for windows in the list which is weird.
Could anyone confirm that this is the default map used by SDL and Love?
Thanks for the help
https://github.com/gabomdq/SDL_GameCont ... llerdb.txt.
If that's the case, my GUID (78696e70757401000000000000000000) does not appear in the list, and there is no entry for Xbox controller for windows in the list which is weird.
Could anyone confirm that this is the default map used by SDL and Love?
Thanks for the help
- 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
It doesn't use that list by default, although you can make use of it with [wiki]love.joystick.loadGamepadMappings[/wiki].
SDL uses an internal list inside its source code by default: https://github.com/spurious/SDL-mirror/ ... erdb.h#L32
I'm not sure what's up with your GUID. SDL may have changed its XInput controller GUIDs without changing the mapping string in the file above, possibly.
SDL uses an internal list inside its source code by default: https://github.com/spurious/SDL-mirror/ ... erdb.h#L32
I'm not sure what's up with your GUID. SDL may have changed its XInput controller GUIDs without changing the mapping string in the file above, possibly.
Re: joystick:getGamepadMapping(buttonName) always returns nil
That makes more sense. My GUID does not appear in this list either, but maybe it's not supposed to appear. My controller is recognized as a XInput Controller by LOVE, that's what getName() returns. Maybe it should fall under this case, note that no GUID is used in this case.slime wrote:SDL uses an internal list inside its source code by default: https://github.com/spurious/SDL-mirror/ ... erdb.h#L32.
Code: Select all
static const char *s_ControllerMappings [] =
{
#if SDL_JOYSTICK_XINPUT
"xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
#endif
...
BTW sorry for my English, is far from good.
Re: joystick:getGamepadMapping(buttonName) always returns nil
can someone check if getGamepadMapping is working with a xbox controller? It does not matter if it is wired or wireless (I have both types to test).
It will be good to know what value of getGUID() do you get for your xbox controller?
and what name do you get from getName()?
this is the code I would like you to test, with a Xbox controller plugged in:
this code for me prints:
thanks in advance you are the best
It will be good to know what value of getGUID() do you get for your xbox controller?
and what name do you get from getName()?
this is the code I would like you to test, with a Xbox controller plugged in:
Code: Select all
local joystick = love.joystick.getJoysticks()[1]
local a,b,c = joystick:getGamepadMapping("a")
print(a,b,c)
print(joystick:getGUID())
print(joystick:getName())
Code: Select all
nil nil nil
78696e70757401000000000000000000
XInput Controller #1
Re: joystick:getGamepadMapping(buttonName) always returns nil
Linux here; mine is recognized as
Still no mappings though.
Code: Select all
nil nil nil
030000005e0400008e02000014010000
Microsoft X-Box 360 pad
Re: joystick:getGamepadMapping(buttonName) always returns nil
then it is not just me with the nil result.raidho36 wrote:Still no mappings though.
I think that for an Xbox controller getName is expected to return "Xbox Controller #x" in windows, can somebody confirm if this is the case?
- 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
"XInput Controller" is correct for a 360 gamepad on Windows. I just tested (on Windows) with my 360 controller and it returns nil for getGamepadMapping as well, even though [wiki]love.gamepadpressed[/wiki] and related gamepad functionality still works as expected.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 5 guests