Page 1 of 1
love.joystick.setGamepadMapping for unrecognised joysticks?
Posted: Sat Aug 30, 2014 3:06 pm
by Eamonn
love.joystick.setGamepadMapping, from what I've read, can be used to map a controller which is not recognised as a controller by LÖVE by default. I have an SNES controller, which other frameworks recognise, but LÖVE does not. How can I use love.joystick.setGamepadMapping to get LÖVE to recognise my controller? There are no examples on the wiki for this, just docs, whereas usually there is an example to help. Just the function synopsis:
success = love.joystick.setGamepadMapping( guid, button, inputtype, inputindex, hatdir )
Thanks!
Re: love.joystick.setGamepadMapping for unrecognised joystic
Posted: Sat Aug 30, 2014 3:27 pm
by bartbes
Eamonn wrote:I have an SNES controller, which other frameworks recognise, but LÖVE does not.
Let's start off by saying that love probably recognizes it, but as joystick, which means you can still use it, you just can't use the gamepad api. Then, the gamepad api is made for xbox360-like controllers, which the snes controller.. well.. isn't. Lastly,
the SDL documentation tells you what a mapping looks like.
Re: love.joystick.setGamepadMapping for unrecognised joystic
Posted: Sat Aug 30, 2014 3:36 pm
by Eamonn
LÖVE doesn't recognise it according to joystick:isGamepad()
I'll check that link, thanks! So I can't remap the SNES controller since it's nothing like the Xbox 360 controller?
Re: love.joystick.setGamepadMapping for unrecognised joystic
Posted: Sat Aug 30, 2014 4:01 pm
by bartbes
Eamonn wrote:LÖVE doesn't recognise it according to joystick:isGamepad()
.. as a gamepad. You've got a joystick object, you can use it.
Eamonn wrote:So I can't remap the SNES controller since it's nothing like the Xbox 360 controller?
You can try, but it seems unlikely to work.
Re: love.joystick.setGamepadMapping for unrecognised joysticks?
Posted: Wed May 12, 2021 8:01 am
by wolf
I'm struggling with the same issue.
However, it seems even though my 8BitDo SNES30 controller isn't properly recognised (only the X,Y,A,B buttons work as expected with the API), it should be possible to make it work manually.
I've noticed the joystick:getAxis() APIs actually do return the correct axis on the dpad.
So for some simple controllers, one approach could be to check the status of the dpad every game update and respond as needed. And perhaps this also works for other inputs.
I'm gonna try to implement something like this.
Re: love.joystick.setGamepadMapping for unrecognised joysticks?
Posted: Fri May 14, 2021 8:44 pm
by D0NM
There is no problem at all. I use 8BitDo gamepads as well.
Use a public SDL mapping DB
https://github.com/gabomdq/SDL_GameControllerDB
Read the DB file with
love.joystick.loadGamepadMappings( "res/gamecontrollerdb.txt" )