- if (starting) {
- var.wiimoteReady = (Wiimote.battery != 0)
- //debugprint("Started. Wiimote Ready: " + var.wiimoteReady)
- var.RestartScript = false
- }
- if (var.RestartScript) {
- //debugprint("Attempting to restart the script!")
- chain("C:\Documents and Settings\Tom\My Documents\software\GLOVE PIE\autowiimote.PIE") // <---- Change this to the path and filename of THIS script
- }
- if (!var.wiimoteReady) {
- //debug = "Wiimote not ready - Framerate: " + pie.frameRate
- pie.Framerate = 2 //Makes GlovePie eat less CPU while waiting for wiimote to be Ready.
- if (Wiimote.battery != 0) { //Wiimote changed from not ready to ready, restart the script
- var.RestartScript = true
- }
- } else { //Wiimote is ready :o)
- //debug = "Wiimote ready! - Framerate: " + pie.frameRate
- if (Wiimote.battery == 0) { //Wiimote changed from ready to not ready, restart the script
- var.RestartScript = true
- }
- ********************************************************************
- * This code must be use with Gens/Fusion emulators.
- * For 1 or 2 players, Wiimotes/Classic controllers
- *
- * GPL License
- * Writen by Marc-Andre Larouche
- * marclar83@gmail.com
- * Version 0.2
- * tested on GlovePIE 0.29, Gens 2.14, Fusion 3.5
- *
- * you can also use alternative mapping for Mortal Kombat,
- * set "1 player 2 controllers" on Smash TV
- * for Dual thumbstick control on the 1st controller.
- *
- * September 2007
- ********************************************************************/
- /****************************
- Player 1
- ****************************/
- // Wiimote (3 buttons)
- Key.Up = Wiimote1.Right
- Key.Down = Wiimote1.Left
- Key.Left = Wiimote1.Up
- Key.Right = Wiimote1.Down
- Key.RightShift = Wiimote1.Minus
- Key.Enter = Wiimote1.Plus
- // Classic controller (6 buttons)
- Key.Up = Wiimote1.Classic.Up
- Key.Down = Wiimote1.Classic.Down
- Key.Left = Wiimote1.Classic.Left
- Key.Right = Wiimote1.Classic.Right
- Key.RightShift = Wiimote1.Classic.Minus
- Key.Enter = Wiimote1.Classic.Plus
- // P1 (default) buttons mapping
- // A,B,C
- Key.D = Wiimote1.A
- Key.A = Wiimote1.one
- Key.S = Wiimote1.two
- Key.A = Wiimote1.Classic.y
- Key.S = Wiimote1.Classic.b
- Key.D = Wiimote1.Classic.a
- Key.D = Wiimote1.B
- // X,Y,Z
- Key.Z = Wiimote1.Classic.x
- Key.X = Wiimote1.Classic.L
- Key.C = Wiimote1.Classic.R
- // P1 (Mortal Kombat) buttons mapping
- /* Remove comment to enable (put default controls in comment!)
- // A,B,C
- Key.S = Wiimote1.A
- Key.A = Wiimote1.one
- Key.D = Wiimote1.two
- Key.Z = Wiimote1.Classic.y
- Key.A = Wiimote1.Classic.b
- Key.D = Wiimote1.Classic.a
- // X,Y,Z
- Key.C = Wiimote1.Classic.x
- Key.X = Wiimote1.Classic.L
- Key.S = Wiimote1.Classic.R
- */
- /****************************
- Player 2
- ****************************/
- // Wiimote (3 buttons)
- Key.Y = Wiimote2.Right
- Key.H = Wiimote2.Left
- Key.G = Wiimote2.Up
- Key.J = Wiimote2.Down
- Key.T = Wiimote2.Minus
- Key.U = Wiimote2.Plus
- // Classic controller (6 buttons)
- Key.Y = Wiimote2.Classic.Up
- Key.H = Wiimote2.Classic.Down
- Key.G = Wiimote2.Classic.Left
- Key.J = Wiimote2.Classic.Right
- Key.T = Wiimote2.Classic.Minus
- Key.U = Wiimote2.Classic.Plus
- // P2 (default) button mapping
- // A,B,C
- Key.M = Wiimote2.A
- Key.K = Wiimote2.one
- Key.L = Wiimote2.two
- Key.K = Wiimote2.Classic.y
- Key.L = Wiimote2.Classic.b
- Key.M = Wiimote2.Classic.a
- // X,Y,Z
- Key.I = Wiimote2.Classic.x
- Key.O = Wiimote2.Classic.L
- Key.P = Wiimote2.Classic.R
- // P2 (Mortal Kombat) buttons mapping
- /* Remove comment to enable (put default controls in comment!)
- // A,B,C
- Key.L = Wiimote2.A
- Key.K = Wiimote2.one
- Key.M = Wiimote2.two
- Key.I = Wiimote2.Classic.y
- Key.K = Wiimote2.Classic.b
- Key.M = Wiimote2.Classic.a
- // X,Y,Z
- Key.P = Wiimote2.Classic.x
- Key.O = Wiimote2.Classic.L
- Key.L = Wiimote2.Classic.R
- */
- // Emulator Shared key
- //load state
- Key.F8 = Wiimote1.Classic.ZL
- Key.F8 = Wiimote2.Classic.ZL
- //save state
- Key.F5 = Wiimote1.Classic.ZR
- Key.F5 = Wiimote2.Classic.ZR
- //throttle
- Key.BackSpace = Wiimote1.Home
- Key.BackSpace = Wiimote2.Home
- Key.BackSpace = Wiimote1.Classic.Home
- Key.BackSpace = Wiimote2.Classic.Home
- // LED P1
- Wiimote1.LED1 = true;
- Wiimote1.LED2 = false;
- Wiimote1.LED3 = false;
- Wiimote1.LED4 = false;
- // LED P2
- Wiimote2.LED1 = false;
- Wiimote2.LED2 = true;
- Wiimote2.LED3 = false;
- Wiimote2.LED4 = false;
- // P1 Analog sticks
- // The following script mapped the left analog stick to the same controls as the D-pad
- Key.left = Wiimote1.Classic.Joy1X <= -25%
- Key.right = Wiimote1.Classic.Joy1X >= 25%
- Key.up = Wiimote1.Classic.Joy1Y <= -25%
- Key.down = Wiimote1.Classic.Joy1Y >= 25%
- // For Smash TV game I have mapped the Right Analog stick to P2 DPAD
- Key.G = Wiimote1.Classic.Joy2X <= -25%
- Key.J = Wiimote1.Classic.Joy2X >= 25%
- Key.Y = Wiimote1.Classic.Joy2Y <= -25%
- Key.H = Wiimote1.Classic.Joy2Y >= 25%
- // P2 Left Analog stick
- // The following script mapped the left analog stick to the same controls as the D-pad
- Key.G = Wiimote2.Classic.Joy1X <= -25%
- Key.J = Wiimote2.Classic.Joy1X >= 25%
- Key.Y = Wiimote2.Classic.Joy1Y <= -25%
- Key.H = Wiimote2.Classic.Joy1Y >= 25%
- //********** Put your wiimote code here!!!*********
- }