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:

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.

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.

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)

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){}