As seen being indicated on the forum, I used GamepadTool to map a Dualshock 3 on my Mac, as I wanted to use the D-Pad instead of the left stick.
After an extensive search, it seems to be impossible to map all d-pad buttons to the stick, at least by using the current SDL mapping. leftx and lefty only accepts one input, as it is not possible to create a virtual axis.
Even if the SDL2 source code actually says that "Buttons can be used as a controller axis and vice versa", pushing a button only sets a positive value to the axis. This results to be able to turn right and down, but not left and up.
So, I was wondering if it was possible to add
[b]dpleft[/b] as an alternative to [b](negative) leftx[/b] [b]dpright[/b] as an alternative to [b](positive) leftx[/b] [b]dpup[/b] as an alternative to [b](negative) lefty[/b] [b]dpdown[/b] as an alternative to [b](positive) lefty[/b] |
in a future release of Pico-8?
... or if there's something I can do to work around this issue?
The solution for this problem is to not try to map the d-pad button but instead map it to one of the "analog sticks" which as only for Horizontal and Vertical axis.
Why? Well not all USB controllers are the same. The gamepad tool assumes a d-pad is four separate buttons, but a lot of gamepads have the d-pad as two axis.
i've also encountered this problem: wiimotes won't map, nor is it possible to use ps3 controllers with the d-pad. pretty annoying. especially wiimotes.
here's a side quest. i've used gamepadtool to map my USB controller. everything works perfectly on Mac OS but when i play with the same mapping on Raspbian, the start button won't work (it's mapped to the pause menu)
I second the request!
it's up to pico-8 to check for SDL_CONTROLLER_DPAD_LEFT...etc as well as SDL_CONTROLLER_LEFT_AXIS_X...etc (not sure about the actual defines)
@catnipped: the mapping depends on the os, button #0 on macos could end up as #3 on raspbian. even the device ids are gathered differently.
you could try downloading gamecontrollerdb.txt from https://github.com/gabomdq/SDL_GameControllerDB
most gamepads are defined there, for windows,linux and macos. you'll still be out of luck about the dpad though, as it's really up to pico-8.
your comment helped! in the end, it was the device id that was different. installed https://github.com/Grumbel/sdl-jstest to find out what the device id was on linux.
i also want to add that, in addition to mapping the dpad, it would be neat to map the shoulder buttons to o and x as well.
+1 for DPAD support (I'm using a PS3 controller via bluetooth)
This d-pad issue has been brought up at least once before: https://www.lexaloffle.com/bbs/?pid=19855
It seems like an obvious decision (feature-request wise) for PICO-8 to support d-pad input (especially now that the KEYCONFIG utility shows a picture of a controller with 4 directional buttons and not a joystick). My guess is it has been a low priority compared to other features and zep just hasn't gotten to it yet :p
Meanwhile I've been happily using a fake NES controller with PICO-8 for like a year now, but only because for some reason whoever designed this particular knockoff controller decided its d-pad should show up as axes and not as a legit d-pad :)
@kittenmaster: I think there's an old compatibility consensus about always having the main directional gizmo defined as two axes. the digital pad is only a secondary input (the hat-switch/pov-hat on joysticks). so any gamepad without analog stick should work ok with pico8.
@ultrabrite: ah, I didn't know that; that explains it then! this same controller also shows like 10 extra buttons on it that are completely unused (prolly they just used the same board as a different controller that has more buttons) so I thought it might just be a quirk, but apparently the axes thing is not one of the quirks :)
thanks for the info :)
[Please log in to post a comment]