love.joystick.setGamepadMapping for unrecognised joysticks?

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.
Post Reply
User avatar
Eamonn
Party member
Posts: 550
Joined: Sat May 04, 2013 1:29 pm
Location: Ireland

love.joystick.setGamepadMapping for unrecognised joysticks?

Post 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!
"In those quiet moments, you come into my mind" - Liam Reilly
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: love.joystick.setGamepadMapping for unrecognised joystic

Post 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.
User avatar
Eamonn
Party member
Posts: 550
Joined: Sat May 04, 2013 1:29 pm
Location: Ireland

Re: love.joystick.setGamepadMapping for unrecognised joystic

Post 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? :(
"In those quiet moments, you come into my mind" - Liam Reilly
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: love.joystick.setGamepadMapping for unrecognised joystic

Post 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.
wolf
Prole
Posts: 13
Joined: Tue Jan 12, 2021 10:24 am

Re: love.joystick.setGamepadMapping for unrecognised joysticks?

Post 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.
User avatar
D0NM
Party member
Posts: 250
Joined: Mon Feb 08, 2016 10:35 am
Location: Zabuyaki
Contact:

Re: love.joystick.setGamepadMapping for unrecognised joysticks?

Post 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" )
Our LÖVE Gamedev blog Zabuyaki (an open source retro beat 'em up game). Twitter: @Zabuyaki.
:joker: LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua :joker:
Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests