Wiimote PPJoy Mouse Hybrid Script - v1.0
By: Bighead - bighead.0@gmail.com
http://bhemuhelp.co.nf
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Description:
This script is a hybrid of my PPJoy Button Mapping and Mouse scripts. It allows you to use the wiimote as a mouse and simultaneously supports input from a Nunchuk or Classic Controller. It also has specific features for the Nintendo DS emulator DeSmuME.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Requirements:
- Windows XP/2000/Vista/7/8 (32 or 64 bit)
- PPJoy v0.8.4.5+  - http://glovepie.org/PPJoySetup-0.8.4.5-early-release.exe
- GlovePIE v0.43/v0.45 - http://glovepie.org/glovepie_download.php
- Driver Signature Enforcement Overrider 1.3b (Vista/7 64-Bit) - http://www.ngohq.com/?page=dseo
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Supports:
- No Extension
- Nunchuk
- Classic Controller
- Wiimote as Mouse
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Setup:
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.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Buttons:
Left Click - Wiimote Button A
Right Click - Wiimote Button B

Tip: All the other wiimote buttons besides A, B, and Home are available as controller inputs. The wiimote D-Pad can be used as 4 unique digital inputs, which is useful when combined with a nunchuk. Up, Down, Left, and Right can be mapped to emulated console buttons such as Nintendo standard B, A, Y, X or Sony standard X, [], O, or /\. Plus and Minus make a very obvious choice for Start and Select, and Nunchuck C/Z and Wiimote 1/2 can also cover L1, R1, L2, and R2. Or you can just map the buttons however you want.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Configuration:
Changes to the config can be made in the header of the script after opening it in GlovePIE and before running it.

Smooth Mouse:
var.smoothmouse = true/false
Smooth mouse is a feature that gives much smoother mouse movements when pointing the wiimote at the sensors. Compared to 1:1 wiimote-mouse movement, it may feel like there is a slight delay at first but there is not.

Cursor Confinement (DeSmuME):
var.confinement = "none" / "top" / "buttom" / "left" / "right" / "dualscreen"
This option locks the mouse cursor to a defined section of the screen. This is useful while in fullscreen mode in DeSmuME when playing with both screens enabled (for games like Metroid Prime: Hunters). Wherever you have the touch screen located, enter that value for confinement. For example, if you are using "LCDs Layout >> Horizontal + Top First", then you would enter "right" because the touch screen will be on the right.  Use "none" if you want the wiimote mouse to have access to your entire screen, and use "dualscreen" if you want the wiimote mouse range to be able to span across two screens.
Note: This option has only been completely tested on a 16:9 1920x1080 resolution.

Cursor Click-Freeze Duration:
var.clickfreeze = 350ms
When wiimote A (Left Click) or wiimote B (Right Click) are pressed, the cursor will freeze for the given time in milliseconds. This makes it much easier to accurately click and double click. Changing this value to 0ms effectively disables this function which is useful for DeSmuME, or you can try a very small value like 25ms. This value by default is 350ms. If you find this is too fast and you have trouble double clicking, then try increasing this value.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Modes 1 and 2 - Analog/Digital Swap:
Press the Home button on any device to switch modes. The Wiimote LEDs will match the current mode.

  Wiimote No Extensions
   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 as logical analog but there is no D-Pad support.
   Mode 2 - Analog Stick functions as logical D-Pad but disables analog support.

  Wiimote + 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).

These modes are useful if you have D-Pad already mapped out and you want to switch to the analog without having to reassign any inputs.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Modes 3 and 4 - Freelook Toggle (DeSmuME):
These modes are designed specifically for DeSmuME with games like Metroid Prime: Hunters in mind.

Mode 3 and 4 for each extension are essentially the same as Mode 1 and 2 with one very important difference. While either of these modes are active, pressing the A button will toggle "Left Click" and hold it down until A is pressed again which will release it. While Left Click is toggled wiimote LED 1 will light up along with the current mode LED. This option allows you to freelook in emulated 3D games on DeSmuME that required you to use the stylus to aim. Use in conjunction with the "Confinement" option for the best results. You may also want to try adjusting the stylus movement speed in the game settings to fine tune it to a speed that you feel comfortable with.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Change Log:

v1.0
- Initial script.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------