MAME on pi questions

I have long thought making one of the MAME arcade boxes would fun, and recently stumbled on some second hand arcade controls, so I've decided now's the time.

Seems like I'm really late to the party. Pimame.org, which I once bookmarked, seems to be off the air and I found several other projects that also look stalled.

The MAME side of things I feel confident I can handle, co-ercing Linux to do things for me is easy. Even if starting from source.

No, my questions are how the controllers work. The up-to-date pi MAME system, Recalbox, just says buy USB controllers or use a keyboard.

So, how did people do this before complete kits were on the market or without just off-the-shelf controllers?

Personally I've been leaning towards getting a Teensy 2 (Arduino board) and using that to wire the controllers like a custom USB keyboard, but I'm open to other suggestions.

I don't have the Pi for this yet, I was leaning towards a 3, but if there's a good reason for another one, I could still switch.

Elijah

------ was using MAME long before the Pi existed

Reply to
Eli the Bearded
Loading thread data ...

On Fri, 17 Nov 2017 19:27:39 +0000 (UTC), Eli the Bearded declaimed the following:

Would depend upon the controller type. Simple joysticks are just four digital switches, probably wired to be active-low, so when the stick is centered all read HIGH. Move the stick in X or Y activates the relevant switch, making it read LOW. Move the stick on a diagonal activates one each of X and Y switches... So four GPIO inputs per joystick (note: if the joystick common lead is attached to a GPIO output that is used as a selector, you could poll two joysticks using 4 input pins and two output pins -- have the output/selects in a pulled-high configuration and set the GPIO Low to select a joystick). Add another input for each trigger/button.

If you have actual analog joysticks -- you'd need some A/D converter logic*. You might still be able to use a polling scheme, changing between X1, Y1, X2, Y2 -- though the conversion time may have an effect on polling speed. Having separate A/Ds for each channel/joystick using a common "start conversion", with polled read-out from the A/D would be more costly, but faster.

* For the R-Pi, this will require external converters as it does not have in-built A/D capability; whereas the BeagleBone Black has 12-bit A/D internal (Arduino tends to run 10-bit A/D).

While Raspbian/NOOBS doesn't currently provide a 64-bit OS version, so you won't be taking advantage of 64-bit processing, the multiple cores of the 3 could be effective: one core could be running a process dedicated to handling the controller inputs, placing results into a shared memory location from which the rest of the system can grab them as needed.

How this would fit within the MAME system I can't say -- perhaps by exposing A/D converters through kernel drivers which update entries in the "sys" file system?

--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
Reply to
Dennis Lee Bieber

I haven't taken it apart to examine or test the wiring, but I'm working under the assumption it is wired like a traditional arcade stick: big metal lever activates one[*] of four Cherry "micro" switches (not micro by today's standards, but a standard industrial form-factor unchanged since at least the 80s). This leads to easy wiring as a keyboard, even if the grid will be seriously odd by having so little grid.

[*] Or two of four on a diagonal.

There are a bunch of the arcade style buttons, too, which are definitely the Cherry D44 "micro" switches (or off-brand equivilent).

The Cherry D44 switches I've used in the past are three conductor for NO or NC use. (The are also good for several amps at 120V and available with various lever attachments, so damned handy for lots of uses.)

Yeah, I know I could wire straight GPIO, but I don't know if that's easy to get working with MAME. Part of why I'm asking.

(I used GPIO and a Cherry micro switch for an alarm clock project. The system only polls the GPIO while the alarm is ringing, waiting for a turn-off. The Cherry switch sits in a wooden box and the entire lid of the box is the actuator. Good for sleepy fumbling. The rest of the alarm clock UI is controlled by a touch screen. Long story short, I have no idea how that sort of input could be used with an off-the-shelf program.)

Interesting.

I was thinking more along the lines of does one have some better GPIO / etc, or some configuration that takes a useful shield board, rather than 64 bit and core count.

Therein lies the rub of that approach.

Elijah

------ wrote his own GPIO library for the alarm clock

Reply to
Eli the Bearded

So I opened it up and examined it. Exactly the controls I was expecting, although off-brand D44 style micro switches. And it apparently is already wired as a keyboard and an old-skool serial DB9 joysick. But there are clear signs that that someone has f***ed with it. Also that this was a commercial product (name on a circuit board inside)[*].

One of two joysticks had no switches attached, instead the switches were loose and wrapped in tissue paper. (Well, three of them; one is missing.) Plus at least one segment of wire has been replaced. Looks easy-peasy to repair and rewire.

[*] The company that built is still around and now sells a USB version with the same form factor as this. I've emailed them asking if I can just buy the controller board.

Elijah

------ and enough space for a Pi inside

Reply to
Eli the Bearded

They do and I've placed an order. I've also hedged my bets and bought a Teensy, too.

Elijah

------ hopefully will get parts before the weekend

Reply to
Eli the Bearded

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.