July 13th, 2009
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 pl1contrl=1 ; Keys for Select, Start, Up, Down, Left, Right, X, A, L, Y, B, R pl1selk=310 pl1startk=313 pl1upk=314 pl1downk=316 pl1leftk=317 pl1rightk=315 pl1Xk=322 pl1Ak=323 pl1Lk=320 pl1Yk=325 pl1Bk=324 pl1Rk=321
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.