Specifications

keys to the Nunchuck and Classic Controller attach-
ments, so all I had to do for it to work with snes9x
was create a new configuration file that mapped all
the keys. Here is my buttons-snes9x file:
Wiimote.A = KEY_X
Wiimote.B = KEY_S
Wiimote.Up = KEY_LEFT
Wiimote.Down = KEY_RIGHT
Wiimote.Left = KEY_DOWN
Wiimote.Right = KEY_UP
Wiimote.Minus = KEY_TAB
Wiimote.Plus = KEY_ENTER
Wiimote.Home = KEY_ESC
Wiimote.1 = KEY_C
Wiimote.2 = KEY_D
Nunchuk.C = BTN_LEFT
Nunchuk.Z = BTN_RIGHT
Classic.Up = KEY_UP
Classic.Down = KEY_DOWN
Classic.Left = KEY_LEFT
Classic.Right = KEY_RIGHT
Classic.Minus = KEY_SPACE
Classic.Plus = KEY_ENTER
Classic.Home = KEY_ESC
Classic.A = KEY_D
Classic.B = KEY_C
Classic.X = KEY_S
Classic.Y = KEY_X
#Classic.ZL =
#Classic.ZR =
Classic.L = KEY_A
Classic.R = KEY_Z
Even though I planned to use the Classic
Controller, I tried to map as many of the regular
Wiimote keys to buttons that made sense, so you
could potentially play at least some games with the
regular Wiimote as well. If you notice, I also left
bindings for the special ZL and ZR keys blank, so
you could bind them to extra keys.
Wiimote Control for MAME
One of the best game system emulators out there is
MAME. MAME emulates classic arcade games, and
there are many guides out there (including in Linux
Journal itself) on how to use MAME to create your
own arcade cabinet. Well, I haven’t cleared away
the time for that project yet, but I did want to use
my Wiimote and Classic Controller attachment for
MAME games. MAME has a large number of bind-
ings (press Tab in MAME to see a list), so it was
difficult to choose which to bind to the extra keys.
Here is a sample buttons-xmame file I created:
Wiimote.A = KEY_P
Wiimote.B = KEY_5
Wiimote.Up = KEY_LEFT
Wiimote.Down = KEY_RIGHT
Wiimote.Left = KEY_DOWN
Wiimote.Right = KEY_UP
Wiimote.Minus = KEY_2
Wiimote.Plus = KEY_1
Wiimote.Home = KEY_F3
Wiimote.1 = KEY_LEFTCTRL
Wiimote.2 = KEY_LEFTALT
Nunchuk.C = BTN_LEFT
Nunchuk.Z = BTN_RIGHT
Classic.Up = KEY_UP
Classic.Down = KEY_DOWN
Classic.Left = KEY_LEFT
Classic.Right = KEY_RIGHT
Classic.Minus = KEY_2
Classic.Plus = KEY_1
Classic.Home = KEY_F3
Classic.A = KEY_LEFTCTRL
Classic.B = KEY_LEFTALT
Classic.X = KEY_SPACE
Classic.Y = KEY_LEFTSHIFT
Classic.ZL = KEY_5
Classic.ZR = KEY_P
Classic.L = KEY_Z
Classic.R = KEY_X
In addition to the standard bindings you might
expect, the home key resets MAME; the plus key
selects single player; minus selects two players; ZL
on the Classic Controller and B on the Wiimote
insert a coin; and ZR on the Classic Controller and
A on the Wiimote pause. These are by no means
perfect bindings, so I recommend you experiment
with different keys that work better for you.
The possibilities with wminput go much further
than what I’ve presented here. There also are con-
figuration files that use the analog joystick inputs
on the Classic Controller, the IR sensors on the
Wiimote and the accelerometers on the Nunchuck.
Wminput isn’t just a handy way to play video
games on your laptop or desktop. The fact that the
connection to the computer is wireless makes the
Wiimote a great gaming input for a MythTV client
or other computer connected to your PC. As for
me, I think I’ll be spending a few more days trying
to beat this impossible Super Mario Brothers hack
that has been floating around the Internet.
I
Kyle Rankin is a Senior Systems Administrator in the San Francisco Bay Area and
the author of a number of books, including
Knoppix Hacks
and
Ubuntu Hacks
for
O’Reilly Media. He is currently the president of the North Bay Linux Users’ Group.
34 |
august 2008 www.linuxjournal.com
HACK AND /
COLUMNS