Controller detection

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Controller detection
by on (#122521)
The next compo is likely to include entries that can be played with a specialized controller, such as a mouse or Zapper. But in order to get to the entry, the player will have to run through the multicart menu. One could plug a standard controller into one port and the specialized controller into the other, but that doesn't help if a game allows, say, two Zappers or two mice. So for the next compo's menu, I may need to support more controllers. This means I'll need to detect what controller is plugged into the first and second ports.

So I'm working on a process of elimination procedure to detect what's plugged in. Are there any useful NES controller types that I missed, other than the (not completely reverse engineered) Power Glove and Miracle piano?

In before zzo38 points out that I didn't mention any Famicom-exclusive controllers such as the keyboard. I'm excluding them for two reasons: 1. I currently cannot test with them on hardware, and 2. Famicom users can use the hardwired controllers to select a game.
Re: Controller detection
by on (#122522)
It might be nice to support the SUBOR mouse (given the comment somewhere about people being disappointed that Thwaite didn't work with it), but the only documentation I know of is nocash's.
Re: Controller detection
by on (#122526)
Assuming you mean EveryNES, which documents Hori Track and the SUBOR mouse: In order to support peripherals that don't plug into an NES, I'd have to 1. buy a famiclone that supports the controller and 2. buy an appropriate flash solution, as I'm told most famiclones don't work with my PowerPak.
Re: Controller detection
by on (#122529)
Such controller detection codes would be good thing to have even for things other than the multicart menu, so that they can be reused for other program that need to do such a detection. For this reason, it would be useful for the "Controller detection" article to mention controllers that aren't usable on the compo multicart menu (such as the Family BASIC keyboard, and several others, whether NES, Famicom, or both, but I don't know of any you haven't already mentioned); it may be useful if writing programs that optionally support some input devices but it can still run without them (for example, Thwaite can work with or without the mouse).

You are correct that you don't need to support the keyboard in the menu, but I don't see what point the powerglove or piano is for the menu. It makes sense for the standard controller and mouse at least; there may be others (maybe the Power Pad?), depending on what programs are subbmitted to the compo (if it is a device that is only used on the second player port or Famicom expansion port, then you can simplify it by not using them in the menu, if you want to; knowing how to detect is still useful though).

One other input device I know is the Super PakPak analog controller (which doesn't even exist as far as I know, although a specification exists), although I don't expect any compo games to use it so you don't need to support it in the menu (maybe someone will, you should ask if necessary, but it looks like it is meant to be used with a standard controller anyways, or at least the DOWN, A, B, and START buttons). Nevertheless like I mentioned in the first paragraph, it may be helpful to provide program to detect it.
Re: Controller detection
by on (#122582)
It tentatively looks like the SUBOR mouse is using the standard DE9 Famiclone connection, so making the converter would be as easy as the SNES-to-NES converter. Although finding a famiclone mouse might be a bit trickier.