Subscribe via RSS
16May/110

Creating two more MAME Controllers

I've since realised that, after building the original two MAME Arcade Controllers, I've needed two more to really re-live the old classic games. I suppose one more would've been OK for games like Rampage, but TMNT, Simpsons Arcade and Sunset Riders need all four players... so... the following lists the relevant information to build controllers 3 and 4.

Sunset Riders

It turns out F12 saves snapshots of MAME games... so I couldn't resist...

Sunset Riders Sunset Riders Sunset Riders
0005 Sunset Riders Sunset Riders

Key Mapping

Below lists the mapping for the two new controllers to be created. I went ahead and used the default keys from MAME plus whatever else was free...

NOTE: Out-of-the-box MAME does not specify buttons 4,5,6 for Players 3 and 4! You can set these very easily in the 'default' config by using the basic MAME GUI (run mame.exe without any command line options)...

Button Player 3 Pins Player 4 Pins
Joy UP I 6, 22 Numpad 8 8, 22
Joy LEFT J 7, 21 Numpad 4 4, 23
Joy DOWN K 6, 21 Numpad 2 8, 21
Joy RIGHT L 5, 21 Numpad 6 14, 23
Button 1 R-CTRL 13, 20 Numpad 0 8, 24
Button 2 R-SHIFT 10, 20 Numpad . 14, 24
Button 3 ENTER 1, 20 Numpad ENTER 12, 21
Button 4 / 3, 26 Numpad + 12, 22
Button 5 . 5, 20 Numpad - 12, 26
Button 6 , 6, 20 Numpad * 12, 20
Player Button 3 16, 19 4 11, 19
Insert Coin 7 7, 19 8 6, 19

Building the other two controllers

I bought cheaper controls for these two... but to no real benefit. I did save AUD$10, but I don't really like the button microswitches. The buttons aren't as tall and they do look cheaper. They're also a lot less 'clickier'. On the positive side: the short-stick joysticks feel nicer during game-play and are a lot more sensitive.

Player 3 and 4

Player 3 and 4 White vs. Black LITEON Board?

The build of these two followed the exact same path as the previous two (see the previous post) using cheap Microsoft Keyboards. It turns out that they were now a different colour (White vs. Black) and I decided to replace my current keyboards on other computers with the new ones. I therefore used a standard black MS Keyboard for Player 3 and a 'Microsoft Comfort Curve' for Player 4.

The MS Comfort Curve had a completely different matrix and the circuit board inside was much easier to solder to. Either way, the process was still the same in determining the pins and then wiring everything up. Testing was made a lot easier as well as I found the below testing applications to work out exactly what I'd messed up :)

Player 3 Player 4 All 4 lined up

After running out of solder and then later butane I got them together and we gave them a go. All went well until Players 1 and 4 hit magical key combinations... It seems that, although the keyboards are separate devices, you can still produce an ALT-ENTER or CTRL-ALT-DEL by having each player pressing each of the keys separately. This has since been remedied in the final section of this post!

Testing your new creation

I found out that Windows 7 (and possibly Windows Vista?) but not Windows XP has the mskey.exe keyboard test application (I have since found out that you can Download the Intellisense Software here which contains this application.) It came in very handy until I plugged 12v into a USB hub and cooked the HDD in my TV-pc (luckily only the HD, the PSU managed to protect everything else!) and lost my Windows 7 install. For Windows XP systems (of which all my computers are now back to) I downloaded and used the PassMark KeyboardTest application. At first, the Google search result made the application look like a typing tutor, but after downloading I realised it was exactly what I needed.

Microsoft Keyboard Diagnostics

PassMark KeyboardTest

MAME Configuration

So, as previously mentioned, MAME doesn't specify Buttons 4,5,6 for Players 3 and 4 by default. I suppose there aren't many games that have more than 3 buttons for all four players? I can't think of any... but my memory is quite hazy as to what 4-player games Combat Zone had back at Tuggeranong Hyperdome.

Either way, we've specified them above and we also need to make sure they map to the correct player/keys in MAME. Here's a snippet for Player 4 in my default.cfg:

<input>
 <port type="P4_JOYSTICKRIGHT_UP">
  <newseq type="standard">KEYCODE_6PAD KEYCODE_8PAD</newseq>
 </port>
 <port type="P4_JOYSTICKRIGHT_DOWN">
  <newseq type="standard">KEYCODE_2PAD KEYCODE_6PAD</newseq>
 </port>
 <port type="P4_JOYSTICKLEFT_UP">
  <newseq type="standard">KEYCODE_4PAD KEYCODE_8PAD</newseq>
 </port>
 <port type="P4_JOYSTICKLEFT_DOWN">
  <newseq type="standard">KEYCODE_2PAD KEYCODE_4PAD</newseq>
 </port>
 <port type="P4_BUTTON4">
  <newseq type="standard">KEYCODE_PLUSPAD</newseq>
 </port>
 <port type="P4_BUTTON5">
  <newseq type="standard">KEYCODE_MINUSPAD</newseq>
 </port>
 <port type="P4_BUTTON6">
  <newseq type="standard">KEYCODE_ASTERISK</newseq>
 </port>
</input>

As you can see, the default.cfg only adds in controls we have overridden... the others must be hard-coded into mame.exe. Drop the configuration file in to your mame/cfg directory (note that you may want to check your file first as you could have other customisations!) and then you'll have the appropriate settings ready to go!

Diagonals and 4-Way Joysticks

Right, I couldn't work out why I couldn't get 'Steve' in 'Sunset Riders' to shoot on the diagonal... usually this was carried out by holding down the Up and Left (or Right) keys on the Keyboard, but it wasn't working. I scoured the internet and initially thought it was an issue with the way I'd wired up the joysticks.

Sunset Riders Sunset Riders Sunset Riders

It turns out that MAME has added in the ability to assign a separate key for the diagonal movements. This is great if you have an 8-way Joystick with actual individual microswitches on the diagonals, but I have a 4-way and I cannot, without logic circuits, wire up another key to activate when two of the direction microswitches are closed. I did actually start thinking of logical OR/AND gates to fire the specific keys when the direction goes diagonal, but this would require re-work on the sealed controllers. :)

mame-config

So, I went in to MAME and then mashed the keyboard on the configuration screen. It turns out that you can assign multiple keys to a direction. This then made life easy... I would make Player 1's "Up/Left" key 'Up' + 'Left' instead of the 'I' key on the keyboard.

After testing this new configuration I realised it wasn't actually MAME that was the problem! It turns out that there was an actual physical issue with the initial two joysticks I bought when compared to the second two...

Arcade Joystick differences

So, the diagonals worked on the new joysticks I bought... they seemed to be a lot happier at pressing two directions at once. Unfortunately, the original joysticks only really wanted to go one way at once... After a little investigation it turns out that the plastic spacer/washer that slides onto the joystick stem was not wide enough (circumference-wise) to actually activate two microswitches at once. I'd also misplaced the original 'extra' components from the intial build and therefore didn't know if wider spacers existed? Either way, I had to make the spacers fatter to ensure that diagonal movements could be easily made.

In the end I cheated and used duct tape around the spacer at the bottom of the stick to make it's circumference wider. This meant it was more keen to press two microswitches at once and the world was a happier place!

Spacer on original Joysticks Spacer Bigger spacer

The sticky-tape-fix was then tested for Player 1 and worked. I then did the same for Player 2 but had the controller back open in seconds after playing Bomberman as it turns out it was now too happy to go diagonal instead of 4-Way. Removing just over one layer of tape from the spacer on the joystick balanced out the circumference vs. microswitch equation and made the joystick much more responsive. Your mileage will vary with how much tape is required based on the sensitivity of the microswitches and how much travel/space you have between them and the center stick.

The verdict: Windows short-cut keys kill gameplay

The next step was to reconfigure any keys on the controllers to not use any modifier key (CTRL,ALT,SHIFT,ENTER) so as to not activate shortcuts during gameplay. When Player 1 and Player 4 pressed certain buttons (specifically ALT-ENTER) the MAME window would restore and, of course, it was possible that all four players could do a perfectly orchestrated CTRL-ALT-DEL and throw Windows XP to the Task Manager.

To do this I had to re-solder buttons on Controllers 1, 2, 3 and 4 to the nearest free keyboard button. Fortunately the Numpad had more than enough nearby keys free and there are still letters of the alphabet unused near Player 1's keys. The layout of buttons on the keyboard did not have to make sense to a human user and so any free buttons were used if the wiring was easier.

The Final Re-Mapping

So, in the end I re-mapped the modifier keys and also removed the duplicates between Players 2 and 3. Edits are in bold... NOTE: You must UNMAP 'T' from the 'Other Controls' area otherwise when Player 1 hits Button 2 you may receive a 'Tilt' message and game restart.

Button Player 1 Pins Player 2 Pins
Joy UP UP 12, 24 R 11, 22
Joy LEFT LEFT 12, 26 D 16, 21
Joy DOWN DOWN 4, 26 F 11, 21
Joy RIGHT RIGHT 8, 26 G 11, 24
Button 1 E 16, 22 A 18, 21
Button 2 T 11, 23 S 17, 24
Button 3 C 16, 20 Q 18, 22
Button 4 V 11, 20 W 17, 23
Button 5 Z 18, 20 U 7, 22
Button 6 X 17, 20 O 5, 22
Player Button 1 18, 19 2 17, 19
Insert Coin 5 11, 25 6 7, 25
Button Player 3 Pins Player 4 Pins
Joy UP I 6, 22 Numpad 8 8, 22
Joy LEFT K 6, 21 Numpad 4 4, 23
Joy DOWN J 7, 21 Numpad 2 8, 21
Joy RIGHT L 5, 21 Numpad 6 14, 23
Button 1 B 11, 26 Numpad 0 8, 24
Button 2 N 7, 26 Numpad . 14, 24
Button 3 M 7, 20 Numpad / 8, 20
Button 4 / 3, 26 Numpad + 12, 22
Button 5 . 5, 20 Numpad - 12, 26
Button 6 , 6, 20 Numpad * 12, 20
Player Button 3 16, 19 4 11, 19
Insert Coin 7 7, 19 8 6, 19
Download the configuration file here.
This configuration overwrites the diagonals for Player 1 and adds/corrects all of the other mappings listed above.

And this is now to be tested in gameplay... I've done the re-wiring and have tested individually but have done no actual thrashing with MAME.

The End

And that's that... it was enough fun playing with Player 1 and 4 making sure not to mash the same buttons at the same time... but it should be a lot better now once I organise the beer and the people to play... will see how we go!