I've finally finished my SMS GlovePIE script, which works surprisingly well. 
It includes motion control for the X, Y, and of course the R button. Tilt left for Y and right for X. Also, when spraying with Z, tilt the Wiimote up and down to control the amount of power.
You will need GlovePIE and PPJoy installed for the code to work.
Here's a good tutorial: http://forums.dolphin-emu.org/showthread.php?tid=15128
Here's a note on the tutorial: Don't follow his instructions on the dirver enforcement for Windows 7. Comments on the linked page say that it might cause problems. However, an easy and safe way is to press F8 during your system boot up. You have to press F8 during the boot screen (the one with your PC's manufacturer's logo). Then, a menu will pop up and near the bottom, there will be an option to disable driver enforcement during that boot only. Meaning, that you have to do it every time you turn your PC on, but it could protect you from problems.
OK, back to the script. After you have the programs ready, you will obviously need to input the controls into Dolphin. Surprisingly, the hardest part is getting the Wiimote to connect and STAY connected. When starting a GlovePIE script, the 1st and 4th LEDs on the Wiimote will light up and then will switch to 2 and 3. This always happens, and it eventually go back to the 1st LED. Getting and keeping the Wiimote connected can take an upwards of 10 minutes sometimes, so be patient.
...And finally, the script:
Please respond with comments and questions!

It includes motion control for the X, Y, and of course the R button. Tilt left for Y and right for X. Also, when spraying with Z, tilt the Wiimote up and down to control the amount of power.
You will need GlovePIE and PPJoy installed for the code to work.
Here's a good tutorial: http://forums.dolphin-emu.org/showthread.php?tid=15128
Here's a note on the tutorial: Don't follow his instructions on the dirver enforcement for Windows 7. Comments on the linked page say that it might cause problems. However, an easy and safe way is to press F8 during your system boot up. You have to press F8 during the boot screen (the one with your PC's manufacturer's logo). Then, a menu will pop up and near the bottom, there will be an option to disable driver enforcement during that boot only. Meaning, that you have to do it every time you turn your PC on, but it could protect you from problems.
OK, back to the script. After you have the programs ready, you will obviously need to input the controls into Dolphin. Surprisingly, the hardest part is getting the Wiimote to connect and STAY connected. When starting a GlovePIE script, the 1st and 4th LEDs on the Wiimote will light up and then will switch to 2 and 3. This always happens, and it eventually go back to the 1st LED. Getting and keeping the Wiimote connected can take an upwards of 10 minutes sometimes, so be patient.
...And finally, the script:
Quote:/*SwimyGreen's Super Mario Sunshine Wiimote Control Setup
Note: You WILL need PPJoy installed for this script unless you want
to reassign the buttons and sticks to another device.
Control Key
GameCube|Wii
A|A
B|B
X|Tilt right or press 1
Y|Tilt left or press 2
L|C
R|Z; Tilt the Wiimote up and down to increase spray power
Z|-
Start|+
Anlg Stk|Nunchuck Stick
C-Stick|D-Pad
Note: If you DON'T want motion control, enable Digital6 and disable
analog 5, 6, and 2 (aka lines 27,36, 37, and 40). Remember that you
won't be able to adjust the amount of Spray Nozzle power when
motion controls are turned off.*/
//Digital Buttons
PPJoy1.Digital0 = Wiimote1.Plus //Start
PPJoy1.Digital1 = Wiimote1.A //A Button
PPJoy1.Digital2 = Wiimote1.B //B Button
PPJoy1.Digital3 = Wiimote1.One //X Button Alternate
PPJoy1.Digital4 = Wiimote1.Two //Y Button Alternate
PPJoy1.Digital5 = Nunchuck1.C //L Button
//PPJoy1.Digital6 = Nunchuck1.Z //R Button (partial press)
PPJoy1.Digital7 = Wiimote1.Minus //Z Button
//Analog Sticks
PPJoy1.Analog0 = (Nunchuk1.JoyX+0)/1 //Analog Left-Right
PPJoy1.Analog1 = (Nunchuk1.JoyY+0)/1 //Analog Up-Down
//Analog Buttons
PPJoy1.Analog5 = (((HeldDown(Wiimote1.Roll >= 60, 0.1)) in degrees)+0)/1 //X Button
PPJoy1.Analog6 = (((HeldDown(Wiimote1.Roll <= -75, 0.1)) in degrees)+0)/1 //Y Button
/*Note: If you hold your Wiimote in your left hand, I'd reccomend
flipping the X and Y button positions above.*/
if Nunchuck1.Z then PPJoy1.Analog2 = (MapRange(Wiimote1.Pitch / 1, -90 degrees,90 degrees, -1,2)+0)/1 else PPJoy1.Analog2 = 0; //R Analog
//D-Pad
PPJoy1.Digital8 = Wiimote1.Up
PPJoy1.Digital9 = Wiimote1.Down
PPJoy1.Digital10 = Wiimote1.Left
PPJoy1.Digital11 = Wiimote1.Right
/*(Obviously) Anybody can redistribute and edit this script,
but please give me credit for it if you do.
Thanks!
~~SwimyGreen~~
*/
Please respond with comments and questions!
