Controllers

From Pandora Wiki
Revision as of 15:50, 19 April 2011 by ABC (talk | contribs) (Extra Information: cat)
Jump to: navigation, search

This includes instructions on installing software and configuration to pair Nintendo Wii Wiimotes using Bluetooth to the Pandora, and using them as joystick controllers. This was done under the base install of Angstrom Linux provided on the Pandora, using Hotfix 4. This does not include setting up a sensor bar type setup, but should allow you to use classic controllers that plug into the Wiimote.

PRECAUTION

Updating the list of packages (the command "sudo opkg update") should not affect your Pandora. However, upgrading or installing some packages may update core files on the Pandora and cause instability or prevent your Pandora from booting (requiring a reflash of your system).

These instructions worked in Hotfix 4 and 5. When Hotfix 5 was released, the update took 30 minutes to complete.

Installing the Drivers

Open a Terminal, and run the command "sudo opkg update" (without the quotes). It will give you a warning about responsibility, and asks for your user password. This will update the Angstrom packages stored on NAND.

Then install the Wiimote drivers and software, cwiid, using the command "sudo opkg install cwiid"

Pairing the Wiimote

Make sure Bluetooth is enabled. In Hotfix 4, there's a script to "Toggle Bluetooth Status" in the Pandora menu under the "System" category. A light will turn on on the left hand side of the Pandora if Bluetooth is on, next to the network light.

Open a Terminal, and run the command "wminput" and follow the directions. It will tell you to press 1+2 on the Wiimote to connect. On my Wiimotes, the lights flash and the fourth light on the Wiimote lights solid once paired. If you then quit the wminput application (for instance, by hitting CTRL-C), your Wiimote will un-pair and turn off. I usually just hide the Terminal in the background by minimizing the window while I run game emulators.

You can pair multiple Wiimotes, just run wminput a second time and follow the instructions to pair it. I only have two, and both lit the fourth light.

In PicoDrive, the Sega Genesis emulator, in the controller settings, if you push left or right it will display different joysticks configured. You can set up the buttons for different players there. The Wiimotes appeared as joysticks 1 and 2, in the order in which I paired them.

Changing the Wiimote Configuration

You can edit /etc/cwiid/wminput/default and /etc/cwiid/wminput/buttons to map the buttons of the Wiimote. You should quit wminput and restart them for these changes to take effect. They are plain text files. I edited them using vim from the command line, which is not the most user friendly thing to describe. Because they're system files, I needed to use sudo again, so I ran "sudo vim /etc/cwiid/wminput/default" in Terminal.

By default, the Wiimote is set up to control the mouse with the accelerometer. This means, as you tilt the Wiimote left and right, your mouse will shift around. I found it a bit distracting, and so I commented out two lines in /etc/cwiid/wminput/default so they look like this:

#Plugin.acc.X   = REL_X
#Plugin.acc.Y   = REL_Y

Also, I use the Wiimote "sideways", like a traditional Nintendo controller. I changed the direction pad to reflect this. Though you can do that within emulator configurations, it seemed handier to just have that set up by default. To do this, make these changes in /etc/cwiid/wminput/buttons

Wiimote.Up      = KEY_LEFT
Wiimote.Down    = KEY_RIGHT
Wiimote.Left    = KEY_DOWN
Wiimote.Right   = KEY_UP

It is also possible to map the Wiimote or extension buttons to a virtual gamepad. See below for instructions.

Using a Classic Controller

There are two ways to use a Wiimote or Classic Controller with the Pandora:

  • As a virtual gamepad. This means you can use it in games that support gamepads, and allows multiplayer in games that support it, but won't work in games that don't support gamepads.
  • As a clone of the Pandora's gaming controls, by mapping it to the same keys. This theoretically means it would work in games that don't have gamepad support, or allow you to change the controls at all, as long as they are using the Pandora controls. However, currently, not all games will register the input with this method. SuperTux, OpenTyrian, PandoraPanic and Snes9X4D4P will. Giana's Return, Sqrxz and psx4pandora won't. Additionally, Mupen64Plus with the default PPSP Input Plugin won't - but the Blight Input Plugin will.

As a virtual gamepad

The default profile doesn't have classic controller buttons defined, but cwiid comes with a gamepad profile which does. You can load it in wminput like this using a terminal:

wminput -c gamepad

Then connect your Wiimote and Classic Controller. You do not have to connect the Classic Controller before you connect the Wiimote.

However the analog sticks/dpad seemed to be set up wrong in the gamepad profile (/etc/cwiid/wminput/gamepad):

Classic.Dpad.X = ABS_X
Classic.Dpad.Y = ABS_Y
Classic.LStick.X = ABS_HAT0X
Classic.LStick.Y = ABS_HAT0Y
Classic.RStick.X = ABS_HAT1X
Classic.RStick.Y = ABS_HAT1Y

should be replaced with:

Classic.Dpad.X = ABS_HAT0X
Classic.Dpad.Y = ABS_HAT0Y
Classic.LStick.X = ABS_X
Classic.LStick.Y = ABS_Y
Classic.RStick.X = ABS_RX
Classic.RStick.Y = ABS_RY

Otherwise, you won't get proper analog input from the sticks, since PoV hats aren't analog.

As a clone of the Pandora's gaming controls

This method works well where it does, you get a clone of the Pandora's gaming controls (minus the nubs), that should theoretically work in all games that support the Pandora's gaming controls. However, because of differences in how the games receive input, not all will detect the "fake" input.

Here is the profile for the Pandora gaming controls:

# D-Pad
Classic.Up	= KEY_UP
Classic.Down	= KEY_DOWN
Classic.Left	= KEY_LEFT
Classic.Right	= KEY_RIGHT

# Select, Start and Space
Classic.Minus	= KEY_LEFTCTRL
Classic.Plus	= KEY_LEFTALT
Classic.Home	= KEY_SPACE

# BXYA on Pandora
Classic.A		= KEY_END
Classic.B		= KEY_PAGEDOWN
Classic.X		= KEY_PAGEUP
Classic.Y		= KEY_HOME
Classic.ZL		= KEY_Q
Classic.ZR		= KEY_P
Classic.L		= KEY_RIGHTSHIFT
Classic.R		= KEY_RIGHTCTRL

Save that in /etc/cwiid/wminput - you can name it whatever you want, as long as you load it in wminput using "wminput -c filename" - and make sure to save it using UNIX line endings (LF).

Once the profile is loaded and your Wiimote/Classic Controller is connected, it will automatically work in some games, but not in others. This might be possible to change to work in all games by modifying the wminput source code.

Extra Information