I’ve got a PS3 controller, but using it with Ubuntu is a huge hassle, not that it doesn’t work mind you, it’s just that most software doesn’t seem to expect 28 axes and 19 buttons that overlap with each other. I’m even perfectly happy using it with a USB cable but I am scorned nonetheless.

Anyway, while I don’t have a perfect solution, I have a good enough solution for ZSNES. ZSNES normally confuses the axes and buttons when configuring different keys, so the input dialog is basically useless. But, I noticed the start/select/PS buttons all don’t have axes so I guessed that the seemingly arbitrary values ZSNES uses for those specific keys were the only correct ones. So I used select (310 according to zsnes, and button 0) to determine the offset for the buttons.

Basically it means (310 + button #) = zsnes button #. At least on my computer. So I used jstest to get the button numbers and hand-edited my ~/.zsnes/zinput.cfg, ending up with this in the player 1 section:

; Player 1 Input
; Input Device: 0 = Unplugged, 1 = KEYBOARD/GAMEPAD
; Keys for Select, Start, Up, Down, Left, Right, X, A, L, Y, B, R

It works perfectly. Oh, and one last tip. I’m not sure how everyone experiences this, but the controller gives me no input until I press the PS button. This has the strange effect of turning on my PS3 when I unplug the controller later, but whatever.

14 Responses to “ZSNES and a sixaxis controller”

  1. Chazz Says:

    Thanks for this guide, got my zsnes controls working flawlessly. And my PS3 also comes on after unplugging the controller, weird…

  2. Evan L. Schemm Says:

    Works great. Please note that the starting value of 310 may not be the same for everyone (mine was 312). So, I had to add two to each of the values above. Then it works great!

  3. Bob Says:

    This works wonderfully for me, but I can only get one PS3 controller working with ZSNES and I want to play two player games. I can get two controllers working with me NES emulator but I need help figuring out ZSNES.

  4. Max Says:

    Bob: I only own one, so I can’t help you out there. Try using the same method as me, map a key to select on the second controller, then use that as the offset for the rest of the keys (you can get key offsets using jstest to get the button offsets)

    Good luck!

  5. Tam Says:


    Thanks for this guide and I was wondering if you got the Analog sticks working?
    Thanks again

  6. ben Says:

    perfect now i will play super mario world all night x

  7. roy Says:

    Thanks for sharing this tip! For anyone curious, the offset for dual shock 3 (white) is +4 from the settings above. In other words, pl1selk=314, pl1startk=317, etc..

  8. Yoni Says:

    If you want to use 2 of these controllers, use the same instructions for controller 2, but start at 383 instead of 310.

    A more general way to do this (in linux)

    Run zsnes and quit.
    Look for the lines (something like)
    Device 0 Sony PLAYSTATION(R)3 Controller
    27 axis, 19 buttons, 0 hats, 0 balls
    Device 1 Sony PLAYSTATION(R)3 Controller
    27 axis, 19 buttons, 0 hats, 0 balls

    Note the number of axes and buttons for controller 1 (first) and second (2).
    e.g. axes1, buttons1, axes2, buttons2

    Controller 1’s select button (base) will be 256 + (axes1*2)

    Controller 2’s select button (base) will be 256 + (axes1*2) + buttons1 + (axes2*2)
    Equivalently, it’s Controller 1’s base + buttons1 + (axes2*2)

    Unfortunately, you can’t use 3 controllers this way, because it has a hardcoded max offset of 448 (not sure why). It would have to be recompiled at least to get around this but that might be based on a dependency.

    You can see the logic for this in zsnes’s source code, in src/linux/sdllink.c in
    BOOL InitJoystickInput(void){}

  9. Yoni Says:

    The formulae I gave assume 0 hats and 0 balls. If you have any, look at the source code.

  10. maxl Says:

    Thanks for your work on this! i get to play snes games with my ps3 controller now

  11. Gabriel Says:

    Thank you very much! Though I could set the controller keys in the GUI in Arch Linux, I couldn’t in Gentoo and that solved my problem.

  12. theDole Says:

    What worked for me in the end:
    -Install QtSixad
    -Follow this tutorial:
    -Open up QtSixad Gui, device should be listed
    -Right click device, select “Configure this specific device”
    -Check Old mode, next
    -Uncheck all except buttons, next, finish
    -Set ZSNES config file to exactly what it says in OP:s guide
    -Enjoy Yoshis Island with perfect control!

    Ubuntu 10.10, SONY sixaxis white purchased today, hp laptop with onboard bluetooth (this is for wireless)

  13. Gamer Says:

    Additional Tip – edit the zsnesl.cfg file and edit KeyFastFrwrd=319 to make R2 the FastForward button

  14. Zsnes on Linux with a Dualshock 4 Controller | redjerseyrepairs Says:

    […] some good information on it here and […]

Leave a Reply