WiiMote PPJoy Mapping Script v1.51
By: Bighead - bighead.0@gmail.com
This script uses GlovePIE and PPJoy to enable DirectInput support for the wiimote and all attached extensions. It started as a personal script to use with my classic controller because I didn't like all the other ones I found at the time. Over time I eventually got hold of more extensions and added support for them too. I also have friends visit who play N64 emulation on occasion so I added support for multiple wiimotes. It eventually has become the only script I'll ever need for use in emulators. It can also be combined with various other joystick manipulation programs such as x360ce and Xpadder for even more functionality.

*There used to be a bug in the script when Guitar support was added that caused the inputs to freak out when a Motion Plus was attached along with an extension. This happened because I read the wiimote pitch values to tilt the guitar for star power. This has been fixed, and you can safely keep your Motion Plus attached at all times and still use any extension this script supports.

- Windows XP/2000/Vista/7/8
- PPJoy v0.8.4.5+ 
- GlovePIE v0.43/v0.45 
- Driver Signature Enforcement Overrider 1.3b (Vista/7 64-Bit)

- Up to 4 wiimotes
- No Extension
- Nunchuk
- Classic Controller
- Wii Guitar
- Wii Drums (GH World Tour)

There are four versions of the script that defines up to how many wiimotes it will support. I have included four versions because I figured why run more code than you have to, although it probably doesn't matter much. Multiple player versions also work with less wiimotes. For example, if you are only using 2 wiimotes, the 4-Player version of the script will still work fine.
For a complete tutorial on how to setup the Wiimote to work with Windows:
Wiimote in Windows Tutorial

Or you can try to follow the steps below...

Step 1: Test Mode (64-Bit Windows Only)
Windows Vista/7
- Download Driver Signature Enforcer Overrider and run it.
- Click "Enable Test Mode", then hit Next.
- Restart the computer to finish putting Windows in test mode.

Windows 8
- Open command prompt as adminstrator.
- Enter the command bcdedit -set TESTSIGNING ON and hit enter.
- Restart the computer to finish putting Windows in test mode.

Step 2: Install PPJoy and add a Joystick
- Open the configuration.
- Click Add, then again Add.
- PPJoy Virtual Joystick 1 should appear.

Step 3: Configure PPJoy Mapping
- Click PPJoy Virtual Joystick 1 and click Mapping.
- Select "Set a custom mapping for this controller", then click Next.
- Choose: 4 Axes, 16 Buttons, 1 POV hats. Configure the next part depending on your OS.

Axis 1:  X Axis
Axis 2:  Y Axis
Axis 3:  Z Axis*
Axis 4:  Z Rotation

* Windows 8 use "Y Rotation" instead of Z Axis.

- Click Next...

X Axis:     Analog 0
Y Axis:     Analog 1
Z Axis:     Analog 2*
Z Rotation: Analog 3

* Windows 8 user should see "Y Rotation: Analog 2".

- Keep clicking next until you are finished.
- Repeat the steps for up to 4 wiimotes if desired.

Step 4: Connect the Wiimote to the PC
Put the wiimote in discovery mode and use your bluetooth software to connect it to the PC.

Step 5: Run Script in GlovePIE
The controller should now be viewable in Windows Game Controller Settings as PPJoy Virtual Joystick. Run the GlovePie script, and the controller settings window should respond to wiimote input.
Controller Modes:

Press the "Home" button on any device to switch modes. The Wiimote LEDs will match the current mode.

  No Extensions (Sideways Wiimote)
   Mode 1 - Standard button setup with D-Pad.
   Mode 2 - Switches all buttons to a different set of buttons except D-Pad.

  Wiimote + Nunchuck
   Mode 1 - Analog Stick functions normally but there is no D-Pad support.
   Mode 2 - Analog Stick functions as logical D-Pad but disables analog functions.

  Classic Controller
   Mode 1 - Left Analog and D-Pad have their own unique input (analog + digital).
   Mode 2 - Makes the Left Analog function as the D-Pad (digital only).

  Wii Guitar
   Mode 1 - Emulator mode to set up buttons for PCSX2.
  *Mode 2 - Guitar Hero III PC Mode for the PC version of GHIII. (Player 1 Only in all scripts)

  Wii Drums (GH World Tour)
   Mode 1 and Mode 2 do not have seperate functions.

*Make sure the wiimote is in Mode 2 BEFORE loading Guitar Hero III. The game will enable controls for the first device it detects input for. Since Mode 2 maps to keyboard input, you want the game to play with the keyboard. Once loaded, just play as normal (skip intros with Green or Start). It should also be noted that the Wii Guitar in the 2/3/4-Player versions of the script, Modes function identically for all wiimotes other than Player 1's. In other words, you only get "Mode 1". GHIII PC does not have support for two players using the keyboard. At least one official USB guitar is required for multiplayer.
Wiimote Identification:

When a script is started in GlovePIE, LED 1 and 4 will light up for about 2 seconds on all Wiimotes. This means that GlovePIE has started talking to them. Next each Wiimote will light up an LED to signify its PPJoy ID: Wiimote 1 will light up LED 1, Wiimote 2 lights up LED 2, Wiimote 3 LED 3, and Wiimote 4 LED 4. This also lasts for 2 seconds before each wiimote kicks into "Mode 1" and only LED 1 is lit on all wiimotes.

A new feature starting with v1.5, in the 2-4 Player versions of the script, you can press the Spacebar on the keyboard and the wiimote LEDs will light up which PPJoy ID each wiimote has. This lasts for 2 seconds and returns every Wiimote to Mode 1. This is useful if you wish to keep track of your wiimotes if you have specific settings for whatever you are using it for (emulators, games, etc).
Additional Info:

- When a script is started in GlovePIE with one of the 2-4 Player script versions, each wiimote will light a single LED to signify which wiimote ID it has (from 1-4) for 2 seconds. After that, "Mode 1" will kick in and light LED 1 on all wiimotes.

- It is possible to switch extensions while the script is running. If you do, then make sure NOT to hold down any buttons while unplugging/plugging the extensions or buttons can get "stuck".

- Nunchuk modes are useful for games that require both D-Pad and Analog Stick. You can switch modes in PSX emulators without having to remap the digital and analog functions.

- Classic Controller Mode 2 is useful for PSX games that don't have Analog support. If you wish to use the analog over the digital for a game that only has digital, then you can without having to remap anything (ex: FFVII).

- Guitar Mode 1 allows easy button mapping to PCSX2. All buttons are supported. To correctly map the whammy bar, set key for "Whammy Down", press and hold the Whammy. Now, set key for "Whammmy Up" and release. Tilt is also supported. "Select/Tilt" can be mapped twice to support Star Power for both Select and Tilt.

- Guitar Mode 2 maps to default GHIII PC keyboard buttons. Reset in-game mapping if changes were done. This will always load the game in "Lefty Mode" so make sure to always change this unless you're a Lefty!

- Wii Drums are untested!! Report to me if you use this script for Drums and whether they work or not.

Ideas that started as the basis of the script:
Analog Range - New method from SPRSTR (old method by lednerg and GameFreakDude) on GlovePie forum:
Basic coding ideas - User WiiAreVenom on a message board:
(Unfortunately, this page is gone so I can't link to it.)
Change Log:

- Fixed an issue with wiimote inputs going haywire if a MotionPlus was attached with an extension (such as the Nunchuk and Classic Controller). This was caused by reading the "Pitch" values. Apparently, using "SmoothPitch" does not have this issue.

- Switching controller modes is now more responsive.
- Range of analog sticks are now more accurate. They are treated as an octagon instead of a circle (credit: SPRSTR).
- Increased the initial controller recognition delay to 2 seconds (from 1.5) when using 2+ Player scripts.
- In the 2-4 player scripts, pressing Space on the keyboard will now force all wiimotes to light up the LED that corresponds to their PPJoy ID for 2 seconds. This also puts them all back into "Mode 1".

- Update ReadMe for support for Windows 8.

- Zero out analogs when switching modes or extensions to avoid them getting "stuck".
- Fix occasional LED start up bug by forcing all LED states.
- Added initial delay on LED start up to easily signify which player each wiimote is.
- Slightly adjusted Wii Guitar "tilt" angle in emulator mode.

- Wii Guitar and Drums support.
- Added three/four player scripts.

- Fixed analog sticks to reach corners.
- Added a two player script.

- Nunchuk support.
- Classic Controller support.

- Initial script which was never released.