Live data from Hacker News

Building a USB SNES Controller

blog.chybby.com

81–90 of 101 posts

Re: Building a USB SNES Controller

#81
post #75

Controllers are surprisingly super easy to work with and a good gateway to some basic electronics hacking. I've actually gone the opposite direction from this post. I have a Neo Geo arcade board (JAMMA) and it has plugs for Neo Geo controllers (as in the controllers for the console version of the Neo Geo). I wanted to use the Neo Geo without plugging it into an arcade cabinet, so I got a "Supergun" board to play it o…

Yes. I got my start, back in the day, following along a magazine article on modifying an Atari 2600 joystick for use with the Tandy Color computer. Worked fairly well too, though I ended up modifying my Galaxian arcade game clone to work with it.

Re: Building a USB SNES Controller

#82
post #75

Controllers are surprisingly super easy to work with and a good gateway to some basic electronics hacking. I've actually gone the opposite direction from this post. I have a Neo Geo arcade board (JAMMA) and it has plugs for Neo Geo controllers (as in the controllers for the console version of the Neo Geo). I wanted to use the Neo Geo without plugging it into an arcade cabinet, so I got a "Supergun" board to play it o…

And I'll add my controller hacking as well: https://imgur.com/a/Mu43dqg As a poor college student, I home-built a dance pad for Dance Dance Revolution, out of wood and foil and by soldering the connections into a controller. Worked perfectly!

I love this.

It probably worked better than a cheap 'soft' pad.

Re: Building a USB SNES Controller

#84
I think the project is cool, but since a usb snes controller is, what 5$ on ebay (or more to have quality one), I find it too bad that you damage a working, vintage real snes controller that there will be less and less of.

Re: Building a USB SNES Controller

#85
post #72
post #39

Are there any implications of the polling rate not quite aligning as the original controller would've?

If for the sake of argument we are plugging this into an SNES emulator running at 60Hz, then the stack between the USB gamepad and the emulator already has to handle that the gamepad is not rigidly synced to the emulated SNES and will presumably take every input from the gamepad and use it as the emulated input to the SNES next time it asks, unless a new one comes in first. At slightly faster than 60Hz, the net effec…

[deleted]

Re: Building a USB SNES Controller

#86
post #74

Is Arduino real-time? I.e. is a 6 millisecond delay guaranteed to actually be 6 milliseconds?

Yes, it is real time, but due to interrupts you have to manage critical sections with cli() and sei() and your time base is a 16.000 MHz crystal.

Most instructions for ATmega and ATtiny execute in 1 clock cycle so writing deterministic, time-critical code is straightforward.

Re: Building a USB SNES Controller

#87

Earlier quoted context omitted.

And I'll add my controller hacking as well: https://imgur.com/a/Mu43dqg As a poor college student, I home-built a dance pad for Dance Dance Revolution, out of wood and foil and by soldering the connections into a controller. Worked perfectly!

I love this. It probably worked better than a cheap 'soft' pad.

Yes! Soft pads are the worst.

Re: Building a USB SNES Controller

#88
post #71
post #48

Earlier quoted context omitted.

The physical switches may actually bounce, so you might need some debounce logic, if it wasn't the shift register glitching out. It's pretty common for buttons to need this, often seen in keyboard firmware as well for similar reasons, the physical mechanism actually will oscillate a bit between states.

The way the NES and SNES work is that once per frame you read from the memory address mapped to the shift register to get all the bits out, one at a time. For certain inputs you only care if it's pressed now. Others you compare to previous state to see if it changed. Bounce could, theoretically, cause an input to be read as a non-input if it just bounced at exactly the wrong time, but it won't cause multiple inputs,…

Yes, it sounds like SNES implements debounce by just scanning slowly, but if you want to feed USB reports at maximum (or above maximum) specification, you will want to check the state more frequently, and you'll need an alternate mitigation for switch bounce.

Re: Building a USB SNES Controller

#89
post #75

Controllers are surprisingly super easy to work with and a good gateway to some basic electronics hacking. I've actually gone the opposite direction from this post. I have a Neo Geo arcade board (JAMMA) and it has plugs for Neo Geo controllers (as in the controllers for the console version of the Neo Geo). I wanted to use the Neo Geo without plugging it into an arcade cabinet, so I got a "Supergun" board to play it o…

A while ago I was a little into controller hardware hacking and did almost the same thing but for an MSX! Even wrote a blog entry, but unfortunately in Japanese (with pictures though): https://blog.qiqitori.com/2022/09/%E6%9D%90%E6%96%99%E8%B2%B...

And one year later I also used a Raspberry Pi Pico to convert a USB controller's signals to MSX: https://blog.qiqitori.com/2023/09/using-a-usb-hid-game-contr...

(And later, USB controller to Nintendo Switch, https://blog.qiqitori.com/2023/09/playing-on-the-nintendo-sw...)

Re: Building a USB SNES Controller

#90
post #39

Are there any implications of the polling rate not quite aligning as the original controller would've?

Yeah I too wondered why the author would target 60Hz at all. The fact that the SNES controller is polled at 60Hz is simply a consequence of the game reading the input at that rate. As mentioned in the other comment in this setup the polling of the controller is not in sync with the game reading the input at all. Thus even if you target a polling rate of 60Hz perfectly you'd actually have worse input latency than the…

I had a feeling the polling rate was probably to do with the frame rate of the SNES rather than some requirement of the controller. I'll try out a higher polling rate and see what happens.
Post reply on HN