pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

Javascript pastebin - collaborative debugging tool View Help


Posted by MukiEX on Sat 17 May 14:26
report abuse | download | new post

  1.  
  2.  
  3. /*********************************************************************/
  4. //                      Dreamcast Controls
  5. //               From here we use the joystick
  6. //               control information to map the
  7. //               propery controls to the Dreamcast
  8. //               emulator, PC game, or whatever.
  9. /*********************************************************************/
  10.  
  11. If ((Wiimote1.Classic.Exists == False)&&(Nunchuk1.Exists == False))
  12. debug = "Please connect a Classic Controller or Nunchuk"
  13.  
  14.     Wiimote1.Led1 = False
  15.     Wiimote1.Led2 = False
  16.     Wiimote1.Led3 = False
  17.     Wiimote1.Led4 = False
  18.  
  19. Endif
  20.  
  21. /*********************************************************************/
  22. //                          Classic Controller
  23. //               Everything works, including analog triggers
  24. //               Digital Triggers also work, read comments.
  25. /*********************************************************************/
  26.  
  27. If Wiimote1.Classic.Exists
  28.  
  29.   // constants
  30.   Var.DeadZone = 0.15;
  31.   Var.LiveZone = 1.0 - Var.DeadZone;
  32.  
  33.  
  34.  
  35.   // apply deadzone to X axis
  36.   If Var.JoyX1 < -Var.DeadZone
  37.      Var.JoyX1 = (Var.JoyX1 + Var.DeadZone) / Var.LiveZone;
  38.   Else
  39.     If Var.JoyX1 > Var.DeadZone
  40.       Var.JoyX1 = (Var.JoyX1 - Var.DeadZone) / Var.LiveZone;
  41.     Else
  42.       Var.JoyX1 = 0
  43.     EndIf
  44.   EndIf
  45.  
  46.   // apply deadzone to Y axis
  47.   If Var.JoyY1 < -Var.DeadZone
  48.      Var.JoyY1 = (Var.JoyY1 + Var.DeadZone) / Var.LiveZone;
  49.   Else
  50.       If Var.JoyY1 > Var.DeadZone
  51.         Var.JoyY1 = (Var.JoyY1 - Var.DeadZone) / Var.LiveZone;
  52.       Else
  53.         Var.JoyY1 = 0
  54.       EndIf
  55.   EndIf
  56.  
  57.   If !Var.Init
  58.      Var.Init = true
  59.      Var.ControlMode = "Standard"
  60.   EndIf
  61.  
  62.   If Pressed(HeldDown(Wiimote1.Home, 1s))||Pressed(HeldDown(Wiimote1.B, 1s))||Pressed(HeldDown(Wiimote1.A, 1s))
  63.      If Var.ControlMode == "Standard"
  64.         Var.ControlMode = "VirtualOn"
  65.      Elseif Var.ControlMode = "VirtualOn"
  66.         Var.ControlMode = "Standard"
  67.      EndIf
  68.      EndIf
  69.  
  70.  
  71.     PPJoy1.Digital1 = Wiimote1.Classic.x
  72.     PPJoy1.Digital2 = Wiimote1.Classic.b
  73.     PPJoy1.Digital8 = Wiimote1.Classic.Plus
  74.     PPJoy1.Digital9 = Wiimote1.Classic.Minus
  75.     PPJoy1.Digital10 = Wiimote1.Classic.Home
  76.  
  77.     PPJoy1.Digital20 = Wiimote1.Classic.Up
  78.     PPJoy1.Digital21 = Wiimote1.Classic.Down
  79.     PPJoy1.Digital22 = Wiimote1.Classic.Left
  80.     PPJoy1.Digital23 = Wiimote1.Classic.Right
  81.  
  82.     // In configuration of your emulator,
  83.     // slightly depress the triggers to
  84.     // have them act as "axis buttons"
  85.     // in order to get proper analog trigger
  86.     // support
  87.     If Wiimote1.Classic.L > 0.4
  88.         PPJoy1.Analog4 = Wiimote1.Classic.L
  89.     Else
  90.         PPJoy1.Analog4 = 0
  91.     EndIf
  92.     If Wiimote1.Classic.R > 0.4
  93.         PPJoy1.Analog5 = Wiimote1.Classic.R
  94.     Else
  95.         PPJoy1.Analog5 = 0
  96.     EndIf
  97.     // This is for digital versions of these buttons
  98.     PPJoy1.Digital16 = Wiimote1.Classic.L
  99.     PPJoy1.Digital17 = Wiimote1.Classic.R
  100.     PPJoy1.Digital18 = Wiimote1.Classic.LFull
  101.     PPJoy1.Digital19 = Wiimote1.Classic.RFull
  102.  
  103.   If Var.ControlMode == "Standard"
  104.     Wiimote1.Led1 = True
  105.     Wiimote1.Led2 = False
  106.     Wiimote1.Led3 = False
  107.     Wiimote1.Led4 = True
  108.  
  109.     // This is for stupid
  110.     // programs that can't detect the first joystick button
  111.     PPJoy1.Digital15 = Wiimote1.Classic.y
  112.  
  113.     PPJoy1.Digital0 = Wiimote1.Classic.y
  114.     PPJoy1.Digital3 = Wiimote1.Classic.a
  115.  
  116.     PPJoy1.Digital6 = Wiimote1.Classic.ZL
  117.     PPJoy1.Digital7 = Wiimote1.Classic.ZR
  118.     PPJoy1.Digital4 = Wiimote1.Classic.L
  119.     PPJoy1.Digital5 = Wiimote1.Classic.R
  120.    
  121.    
  122.     PPJoy1.Digital11 = Wiimote1.A
  123.     PPJoy1.Digital12 = Wiimote1.B
  124.     PPJoy1.Digital13 = Wiimote1.1
  125.     PPJoy1.Digital14 = Wiimote1.2
  126.    
  127.  
  128.    
  129.     PPJoy1.Digital24 = Wiimote1.Up
  130.     PPJoy1.Digital25 = Wiimote1.Down
  131.     PPJoy1.Digital26 = Wiimote1.Left
  132.     PPJoy1.Digital27 = Wiimote1.Right
  133.    
  134.     PPJoy1.Analog2 = Wiimote1.Classic.Joy2X
  135.     PPJoy1.Analog3 = Wiimote1.Classic.Joy2Y
  136.  
  137.     PPJoy1.Analog6 = Wiimote1.RawForceX
  138.     PPJoy1.Analog7 = Wiimote1.RawForceY
  139.     PPJoy1.Analog8 = Wiimote1.RawForceZ
  140.    
  141.    
  142.     Var.JoyX1 = Wiimote1.Classic.Joy1X
  143.     Var.JoyY1 = Wiimote1.Classic.Joy1Y
  144.  
  145.     PPJoy1.Analog0 = Var.JoyX1
  146.     PPJoy1.Analog1 = Var.JoyY1
  147.   EndIf
  148.  
  149.  
  150.   If Var.ControlMode == "VirtualOn"
  151.     Wiimote1.Led1 = False
  152.     Wiimote1.Led2 = True
  153.     Wiimote1.Led3 = True
  154.     Wiimote1.Led4 = False
  155.  
  156.  
  157.  
  158.  
  159.      Var.JoyDead1 = 0.3
  160.      // Move Forward
  161.      If ((Wiimote1.Classic.Joy1Y < -Var.JoyDead1)&&(Wiimote1.Classic.Joy2Y < -Var.JoyDead1))||Wiimote1.Classic.Up == True
  162.         PPJoy1.Digital20 = True
  163.      Else
  164.         PPJoy1.Digital20 = False
  165.      EndIf
  166.      // Move Backward
  167.      If ((Wiimote1.Classic.Joy1Y > Var.JoyDead1)&&(Wiimote1.Classic.Joy2Y > Var.JoyDead1))||Wiimote1.Classic.Down == True
  168.         PPJoy1.Digital21 = True
  169.      Else
  170.         PPJoy1.Digital21 = False
  171.      EndIf
  172.      // Move Left
  173.      If ((Wiimote1.Classic.Joy1X < -Var.JoyDead1)&&(Wiimote1.Classic.Joy2X < -Var.JoyDead1))||Wiimote1.Classic.Left == True
  174.         PPJoy1.Digital22 = True
  175.      Else
  176.         PPJoy1.Digital22 = False
  177.      EndIf
  178.      // Move Right
  179.      If ((Wiimote1.Classic.Joy1X > Var.JoyDead1)&&(Wiimote1.Classic.Joy2X > Var.JoyDead1))||Wiimote1.Classic.Right == True
  180.         PPJoy1.Digital23 = True
  181.      Else
  182.         PPJoy1.Digital23 = False
  183.      EndIf
  184.      // Turn Left
  185.      If (Wiimote1.Classic.Joy1Y < -Var.JoyDead1)&&(Wiimote1.Classic.Joy2Y > Var.JoyDead1)
  186.         PPJoy1.Analog0 = 0.5
  187.         Var.TurnRight = True
  188.      Else
  189.         Var.TurnRight = False
  190.      EndIf
  191.      // Turn Right
  192.      If (Wiimote1.Classic.Joy1Y > Var.JoyDead1)&&(Wiimote1.Classic.Joy2Y < -Var.JoyDead1)
  193.       PPJoy1.Analog0 = -0.5
  194.       Var.TurnLeft = True
  195.      Else
  196.       Var.TurnLeft = False
  197.      EndIf
  198.      // No Turn
  199.      If ((Var.TurnLeft == False)&&(Var.TurnRight == False))
  200.       PPJoy1.Analog0 = 0
  201.      EndIf
  202.      // Jump
  203.      If (Wiimote1.Classic.Joy1X < -Var.JoyDead1)&&(Wiimote1.Classic.Joy2X > Var.JoyDead1)
  204.         PPJoy1.Digital15 = True
  205.         PPJoy1.Digital1 = True
  206.      Else
  207.         PPJoy1.Digital15 = False
  208.         PPJoy1.Digital1 = False
  209.      EndIf
  210.      // Crouch
  211.      If ((Wiimote1.Classic.Joy1X > Var.JoyDead1)&&(Wiimote1.Classic.Joy2X < -Var.JoyDead1))||Wiimote1.Classic.b == True
  212.         PPJoy1.Digital2 = True
  213.      Else
  214.         PPJoy1.Digital2 = False
  215.      EndIf
  216.  
  217.     PPJoy1.Digital15 = Wiimote1.Classic.ZR
  218.     PPJoy1.Digital3 = Wiimote1.Classic.ZL
  219.  
  220.     If PPJoy1.Digital15 == True || PPJoy.Digital3 == True
  221.         PPJoy1.Digital0 = True
  222.         Wiimote1.Rumble = True
  223.     Else
  224.         PPJoy1.Digital0 = False
  225.         Wiimote1.Rumble = False
  226.     EndIf
  227.  
  228.  
  229.   EndIf
  230.   debug = "Classic Controller Connected; " + Var.ControlMode + ". Xtra: " + PPJoy1.Digital15
  231. EndIf
  232.  
  233.  
  234.  
  235. /*********************************************************************/
  236. //                      Nunchuk Controls (Virtual On)
  237. //               These controls were designed specifically
  238. //               for the Dreamcast "Virtual On" sequel.
  239. //
  240. //               In addition, the directional buttons
  241. //               on the Wiimote can navigate the menus
  242. /*********************************************************************/
  243.  
  244.  
  245. /*********************************************************************/
  246. //                      Joystick Controls
  247. //                 This is general joystick control
  248. //                 management. It lets you keep track
  249. //                 of which way our virtual joysticks
  250. //                 are pointed. Var.WiiLS_Left means :
  251. //
  252. //                 LS = Left Stick (Nunchuk)
  253. //                 _Left = Pointed Left
  254. //                 RS for Right Stick (Wiimote) and _Up/_Down/_Right
  255. //                 for those respective directions
  256. /*********************************************************************/
  257.  
  258.   // Wiimote/Nunchuk's minimum push for
  259.   // left or right Directions
  260.   Var.MinRightStick = 0.25
  261.   Var.MinLeftStick = 0.25
  262.  
  263.   // Wiimote/Nunchuk's minimum push for
  264.   // forward and backward directions
  265.   Var.MinRightForward = 0.5
  266.   Var.MinRightBackward = 0.3
  267.   Var.MinLeftForward = 0.5
  268.   Var.MinLeftBackward = 0.3
  269.  
  270.  
  271.  
  272. If Nunchuk1.Exists
  273.  
  274.    //Right weapon
  275.   If Wiimote1.B
  276.     Key.C = True
  277.     Wiimote1.LED4 = True
  278.   Else
  279.     Key.C = False
  280.     Wiimote1.LED4 = False
  281.   EndIf
  282.  
  283.   //Left weapon
  284.   If Nunchuk1.Zbutton
  285.     Wiimote1.LED1 = True
  286.     Key.D = True
  287.   Else
  288.     Wiimote1.LED1 = False
  289.     Key.D = False
  290.   EndIf
  291.  
  292.   //Dash
  293.   If Wiimote1.A  || Nunchuk1.CButton
  294.     Wiimote1.Rumble = True //Rumble feedback will be on while dashing
  295.     Wiimote1.LED2 and Wiimote1.LED3 = True //The two center LEDs will show us that we're dashing
  296.   Else
  297.     Key.X = False
  298.     Wiimote1.Rumble = False
  299.     Wiimote1.LED2 and Wiimote1.LED3 = False
  300.   EndIf
  301.   //Start
  302.   Key.Space = Wiimote1.Home
  303.  
  304.  
  305.  
  306.  
  307.   // Right stick
  308.   // Moving to the left
  309.   If Wiimote1.GX > Var.MinRightStick
  310.     Var.WiiRS_Left = True
  311.     Wiimote1.LED4 = True
  312.   Else
  313.     Var.WiiRS_Left = False
  314.     Wiimote1.LED4 = False
  315.   EndIf
  316.   // Moving to the right
  317.   If Wiimote1.GX < -Var.MinRightStick
  318.     Var.WiiRS_Right = True
  319.     Wiimote1.LED3 = True
  320.   Else
  321.     Var.WiiRS_Right = False
  322.     Wiimote1.LED3 = False
  323.   EndIf
  324.   // Tilted forward
  325.   If Wiimote1.GY > Var.MinRightForward
  326.   Var.WiiRS_Up = True
  327.   Else
  328.     Var.WiiRS_Up = False
  329.   EndIf
  330.  
  331.   // Tilted backward
  332.   If Wiimote1.GY < -Var.MinRightBackward
  333.     Var.WiiRS_Down = True
  334.   Else
  335.     Var.WiiRS_Down = False
  336.   EndIf
  337.  
  338.  
  339.   // Left stick
  340.   // Moving to the left
  341.   If Nunchuk1.GX > Var.MinLeftStick
  342.     Var.WiiLS_Left = True
  343.     Wiimote1.LED4 = True
  344.   Else
  345.     Var.WiiLS_Left = False
  346.     Wiimote1.LED4 = False
  347.   EndIf
  348.   // Moving to the right
  349.   If Nunchuk1.GX < -Var.MinLeftStick
  350.     Var.WiiLS_Right = True
  351.     Wiimote1.LED3 = True
  352.   Else
  353.     Var.WiiLS_Right = False
  354.     Wiimote1.LED3 = False
  355.   EndIf
  356.   // Tilted forward
  357.   If Nunchuk1.GY > Var.MinLeftForward
  358.     Var.WiiLS_Up = True
  359.   Else
  360.     Var.WiiLS_Up = False
  361.   EndIf
  362.   // Tilted backward
  363.   If Nunchuk1.GY < -Var.MinLeftBackward
  364.     Var.WiiLS_Down = True
  365.   Else
  366.     Var.WiiLS_Down = False
  367.   EndIf
  368.  
  369. *********************************************************************/
  370. //               If you're playing Virtual On
  371. //               somewhere else, or simply using
  372. //               another game that has dual joystick
  373. //               inputs, this is where you should start
  374. //               modifying the script. Remember to use
  375. //               WiiLS_Left and so forth as your source input.
  376. *********************************************************************/
  377.  
  378.   // Move Right
  379.   If (((Var.WiiLS_Right == True)&&(Var.WiiRS_Right == True))||(Wiimote1.Right == True))
  380.     Var.DebugText = "Moving Right"
  381.     PPJoy1.Digital23 = True
  382.   Else
  383.     PPJoy1.Digital23 = False
  384.   EndIf
  385.   // Move Left
  386.   If (((Var.WiiLS_Left == True)&&(Var.WiiRS_Left == True))||(Wiimote1.Left == True))
  387.     Var.DebugText = "Moving Left"
  388.     PPJoy1.Digital22 = True
  389.   Else
  390.     PPJoy1.Digital22 = False
  391.   EndIf
  392.   // Move Forward
  393.   If (((Var.WiiLS_Up == True)&&(Var.WiiRS_Up == True))||(Wiimote1.Up == True))
  394.     Var.DebugText = "Moving Forward"
  395.     PPJoy1.Digital20 = True
  396.   Else
  397.     PPJoy1.Digital20 = False
  398.   EndIf
  399.   // Move Backward
  400.   If (((Var.WiiLS_Down == True)&&(Var.WiiRS_Down == True))||(Wiimote1.Down == True))
  401.     Var.DebugText = "Moving Backward"
  402.     PPJoy1.Digital21 = True
  403.   Else
  404.     PPJoy1.Digital21 = False
  405.   EndIf
  406.   // Turn Right
  407.   If ((Var.WiiLS_Up == True)&&(Var.WiiRS_Down == True))
  408.     Var.DebugText = "Turning Right"
  409.     PPJoy1.Analog0 = Nunchuk1.GY
  410.     Var.TurningRight = True
  411.   Else
  412.     Var.TurningRight = False
  413.   EndIf
  414.   // Turn Left
  415.   If ((Var.WiiLS_Down == True)&&(Var.WiiRS_Up == True))
  416.     Var.DebugText = "Turning Left"
  417.     PPJoy1.Analog0 = Nunchuk1.GY
  418.     Var.TurningLeft = True
  419.   Else
  420.     Var.TurningLeft = False
  421.   EndIf
  422.   // No Turning
  423.   // The main reason I keep those TurningLeft
  424.   // and TurningRight variables is because I'm
  425.   // controlling the analog stick. Therefore I can't
  426.   // simply check button states to see if it's not turning
  427.   // in either direction
  428.   If ((Var.TurningRight == False)&&(Var.TurningLeft == False))
  429.     PPJoy1.Analog0 = 0
  430.   EndIf
  431.   // Flying
  432.   If ((Var.WiiLS_Left == True)&&(Var.WiiRS_Right == True))
  433.     Var.DebugText = "Flying"
  434.     PPJoy1.Digital1 = True
  435.   Else
  436.     PPJoy1.Digital1 = False
  437.   EndIf
  438.  
  439.   // Crouching
  440.   If (((Var.WiiLS_Right == True)&&(Var.WiiRS_Left == True))||(Wiimote1.Minus == True))
  441.     Var.DebugText = "Crouching"
  442.     PPJoy1.Digital2 = True
  443.   Else
  444.     PPJoy1.Digital2 = False
  445.   EndIf
  446.  
  447.   If ((Var.WiiLS_Right == False)&&(Var.WiiLS_Left == False)&&(Var.WiiLS_Up == False)&&(Var.WiiLS_Down == False)&&(Var.WiiRS_Right == False)&&(Var.WiiRS_Left == False)&&(Var.WiiRS_Up == False)&&(Var.WiiRS_Down == False))
  448.     Var.DebugText = "Neutral"
  449.   EndIf
  450.   // These are the Dreamcast Buttons
  451.   // They match up with the Classic Controller
  452.   // Dreamcast Script I have, so you only need
  453.   // to configure your emulator *once*.
  454.  
  455.   // This pauses
  456.   //PPJoy1.Digital10 = Wiimote1.Plus
  457.   PPJoy1.Digital8 = Wiimote1.Plus
  458.   // This is turbo AND cancel in the menus
  459.   PPJoy1.Digital3 = Wiimote1.A
  460.   // This is just turbo
  461.   PPJoy1.Digital0 = Nunchuk1.CButton
  462.   // This is for dumb programs that don't
  463.   // accept input from the first joystick
  464.   // button. Same on Classic Script
  465.   PPJoy1.Digital15 = Nunchuk1.CButton
  466.   // This is the left firing trigger
  467.   //PPJoy1.Digital6 = Nunchuk1.ZButton
  468.   If Nunchuk1.ZButton == True
  469.     PPJoy1.Digital16 = True
  470.     PPJoy1.Digital18 = True
  471.     PPJoy1.Analog4 = 1.0
  472.   Else
  473.     PPJoy1.Digital16 = False
  474.     PPJoy1.Digital18 = False
  475.     PPJoy1.Analog4 = 0
  476.   Endif
  477.   // This is the right firing trigger
  478.   //PPJoy1.Digital7 = Wiimote1.B
  479.   If Wiimote1.B == True
  480.     PPJoy1.Digital17 = True
  481.     PPJoy1.Digital19 = True
  482.     PPJoy1.Analog5 = 1.0
  483.   Else
  484.     PPJoy1.Digital17 = False
  485.     PPJoy1.Digital19 = False
  486.     PPJoy1.Analog5 = 0
  487.   Endif
  488.  
  489.  
  490.  
  491.   If ((Wiimote1.GX > -Var.MinRightStick)&&(Wiimote1.GX < Var.MinRightStick)&&(Wiimote1.GY < Var.MinRightForward)&&(Wiimote1.GY > Var.MinRightBackward))
  492.   var.debugR = "Neutral"
  493.   EndIf
  494.  
  495.   If ((Nunchuk1.GX > -Var.MinLeftStick)&&(Nunchuk1.GX < Var.MinLeftStick)&&(Nunchuk1.GY < Var.MinLeftForward)&&(Nunchuk1.GY > Var.MinLeftBackward))
  496.   var.debugL = "Neutral"
  497.   EndIf
  498.  
  499.   //debug = Var.DebugText + " StickX : " + Wiimote1.GX + ". StickY : " + Wiimote1.GY
  500.   debug = "Wiimote : " + Wiimote1.GX + "/" + Wiimote1.GY + ". Nunchuk : " + PPJoy1.Analog0 + "/" + PPJoy1.Analog1 + "    " + Var.DebugText
  501.  
  502. EndIf
  503.  
  504.  
  505.  
  506.  
  507. /*********************************************************************/
  508. //                      Dreamcast Controls
  509. //               From here we use the joystick
  510. //               control information to map the
  511. //               propery controls to the Dreamcast
  512. //               emulator, PC game, or whatever.
  513. /*********************************************************************/
  514.  
  515. If ((Wiimote2.Classic.Exists == False)&&(Nunchuk2.Exists == False))
  516. debug = "Please connect a Classic Controller or Nunchuk"
  517.  
  518.     Wiimote2.Led1 = False
  519.     Wiimote2.Led2 = False
  520.     Wiimote2.Led3 = False
  521.     Wiimote2.Led4 = False
  522.  
  523. Endif
  524.  
  525. /*********************************************************************/
  526. //                          Classic Controller
  527. //               Everything works, including analog triggers
  528. //               Digital Triggers also work, read comments.
  529. /*********************************************************************/
  530.  
  531. If Wiimote2.Classic.Exists
  532.  
  533.   // constants
  534.   Var.DeadZone = 0.15;
  535.   Var.LiveZone = 1.0 - Var.DeadZone;
  536.  
  537.  
  538.  
  539.   // apply deadzone to X axis
  540.   If Var.JoyX2 < -Var.DeadZone
  541.      Var.JoyX2 = (Var.JoyX2 + Var.DeadZone) / Var.LiveZone;
  542.   Else
  543.     If Var.JoyX2 > Var.DeadZone
  544.       Var.JoyX2 = (Var.JoyX2 - Var.DeadZone) / Var.LiveZone;
  545.     Else
  546.       Var.JoyX2 = 0
  547.     EndIf
  548.   EndIf
  549.  
  550.   // apply deadzone to Y axis
  551.   If Var.JoyY2 < -Var.DeadZone
  552.      Var.JoyY2 = (Var.JoyY2 + Var.DeadZone) / Var.LiveZone;
  553.   Else
  554.       If Var.JoyY2 > Var.DeadZone
  555.         Var.JoyY2 = (Var.JoyY2 - Var.DeadZone) / Var.LiveZone;
  556.       Else
  557.         Var.JoyY2 = 0
  558.       EndIf
  559.   EndIf
  560.  
  561.   If !Var.Init
  562.      Var.Init = true
  563.      Var.ControlMode = "Standard"
  564.   EndIf
  565.  
  566.   If Pressed(HeldDown(Wiimote2.Home, 1s))||Pressed(HeldDown(Wiimote2.B, 1s))||Pressed(HeldDown(Wiimote2.A, 1s))
  567.      If Var.ControlMode == "Standard"
  568.         Var.ControlMode = "VirtualOn"
  569.      Elseif Var.ControlMode = "VirtualOn"
  570.         Var.ControlMode = "Standard"
  571.      EndIf
  572.      EndIf
  573.  
  574.  
  575.     PPJoy2.Digital1 = Wiimote2.Classic.x
  576.     PPJoy2.Digital2 = Wiimote2.Classic.b
  577.     PPJoy2.Digital8 = Wiimote2.Classic.Plus
  578.     PPJoy2.Digital9 = Wiimote2.Classic.Minus
  579.     PPJoy2.Digital10 = Wiimote2.Classic.Home
  580.  
  581.     PPJoy2.Digital20 = Wiimote2.Classic.Up
  582.     PPJoy2.Digital21 = Wiimote2.Classic.Down
  583.     PPJoy2.Digital22 = Wiimote2.Classic.Left
  584.     PPJoy2.Digital23 = Wiimote2.Classic.Right
  585.  
  586.     // In configuration of your emulator,
  587.     // slightly depress the triggers to
  588.     // have them act as "axis buttons"
  589.     // in order to get proper analog trigger
  590.     // support
  591.     If Wiimote2.Classic.L > 0.4
  592.         PPJoy2.Analog4 = Wiimote2.Classic.L
  593.     Else
  594.         PPJoy2.Analog4 = 0
  595.     EndIf
  596.     If Wiimote2.Classic.R > 0.4
  597.         PPJoy2.Analog5 = Wiimote2.Classic.R
  598.     Else
  599.         PPJoy2.Analog5 = 0
  600.     EndIf
  601.     // This is for digital versions of these buttons
  602.     PPJoy2.Digital16 = Wiimote2.Classic.L
  603.     PPJoy2.Digital17 = Wiimote2.Classic.R
  604.     PPJoy2.Digital18 = Wiimote2.Classic.LFull
  605.     PPJoy2.Digital19 = Wiimote2.Classic.RFull
  606.  
  607.   If Var.ControlMode == "Standard"
  608.     Wiimote2.Led1 = True
  609.     Wiimote2.Led2 = False
  610.     Wiimote2.Led3 = False
  611.     Wiimote2.Led4 = True
  612.  
  613.     // This is for stupid
  614.     // programs that can't detect the first joystick button
  615.     PPJoy2.Digital15 = Wiimote2.Classic.y
  616.  
  617.     PPJoy2.Digital0 = Wiimote2.Classic.y
  618.     PPJoy2.Digital3 = Wiimote2.Classic.a
  619.  
  620.     PPJoy2.Digital6 = Wiimote2.Classic.ZL
  621.     PPJoy2.Digital7 = Wiimote2.Classic.ZR
  622.     PPJoy2.Digital4 = Wiimote2.Classic.L
  623.     PPJoy2.Digital5 = Wiimote2.Classic.R
  624.    
  625.    
  626.     PPJoy2.Digital11 = Wiimote2.A
  627.     PPJoy2.Digital12 = Wiimote2.B
  628.     PPJoy2.Digital13 = Wiimote2.1
  629.     PPJoy2.Digital14 = Wiimote2.2
  630.    
  631.  
  632.    
  633.     PPJoy2.Digital24 = Wiimote2.Up
  634.     PPJoy2.Digital25 = Wiimote2.Down
  635.     PPJoy2.Digital26 = Wiimote2.Left
  636.     PPJoy2.Digital27 = Wiimote2.Right
  637.    
  638.     PPJoy2.Analog2 = Wiimote2.Classic.Joy2X
  639.     PPJoy2.Analog3 = Wiimote2.Classic.Joy2Y
  640.  
  641.     PPJoy2.Analog6 = Wiimote2.RawForceX
  642.     PPJoy2.Analog7 = Wiimote2.RawForceY
  643.     PPJoy2.Analog8 = Wiimote2.RawForceZ
  644.    
  645.    
  646.     Var.JoyX2 = Wiimote2.Classic.Joy1X
  647.     Var.JoyY2 = Wiimote2.Classic.Joy1Y
  648.  
  649.     PPJoy2.Analog0 = Var.JoyX2
  650.     PPJoy2.Analog1 = Var.JoyY2
  651.   EndIf
  652.  
  653.  
  654.   If Var.ControlMode == "VirtualOn"
  655.     Wiimote2.Led1 = False
  656.     Wiimote2.Led2 = True
  657.     Wiimote2.Led3 = True
  658.     Wiimote2.Led4 = False
  659.  
  660.  
  661.  
  662.  
  663.      Var.JoyDead2 = 0.3
  664.      // Move Forward
  665.      If ((Wiimote2.Classic.Joy1Y < -Var.JoyDead2)&&(Wiimote2.Classic.Joy2Y < -Var.JoyDead2))||Wiimote2.Classic.Up == True
  666.         PPJoy2.Digital20 = True
  667.      Else
  668.         PPJoy2.Digital20 = False
  669.      EndIf
  670.      // Move Backward
  671.      If ((Wiimote2.Classic.Joy1Y > Var.JoyDead2)&&(Wiimote2.Classic.Joy2Y > Var.JoyDead2))||Wiimote2.Classic.Down == True
  672.         PPJoy2.Digital21 = True
  673.      Else
  674.         PPJoy2.Digital21 = False
  675.      EndIf
  676.      // Move Left
  677.      If ((Wiimote2.Classic.Joy1X < -Var.JoyDead2)&&(Wiimote2.Classic.Joy2X < -Var.JoyDead2))||Wiimote2.Classic.Left == True
  678.         PPJoy2.Digital22 = True
  679.      Else
  680.         PPJoy2.Digital22 = False
  681.      EndIf
  682.      // Move Right
  683.      If ((Wiimote2.Classic.Joy1X > Var.JoyDead2)&&(Wiimote2.Classic.Joy2X > Var.JoyDead2))||Wiimote2.Classic.Right == True
  684.         PPJoy2.Digital23 = True
  685.      Else
  686.         PPJoy2.Digital23 = False
  687.      EndIf
  688.      // Turn Left
  689.      If (Wiimote2.Classic.Joy1Y < -Var.JoyDead2)&&(Wiimote2.Classic.Joy2Y > Var.JoyDead2)
  690.         PPJoy2.Analog0 = 0.5
  691.         Var.TurnRight = True
  692.      Else
  693.         Var.TurnRight = False
  694.      EndIf
  695.      // Turn Right
  696.      If (Wiimote2.Classic.Joy1Y > Var.JoyDead2)&&(Wiimote2.Classic.Joy2Y < -Var.JoyDead2)
  697.       PPJoy2.Analog0 = -0.5
  698.       Var.TurnLeft = True
  699.      Else
  700.       Var.TurnLeft = False
  701.      EndIf
  702.      // No Turn
  703.      If ((Var.TurnLeft == False)&&(Var.TurnRight == False))
  704.       PPJoy2.Analog0 = 0
  705.      EndIf
  706.      // Jump
  707.      If (Wiimote2.Classic.Joy1X < -Var.JoyDead2)&&(Wiimote2.Classic.Joy2X > Var.JoyDead2)
  708.         PPJoy2.Digital15 = True
  709.         PPJoy2.Digital1 = True
  710.      Else
  711.         PPJoy2.Digital15 = False
  712.         PPJoy2.Digital1 = False
  713.      EndIf
  714.      // Crouch
  715.      If ((Wiimote2.Classic.Joy1X > Var.JoyDead2)&&(Wiimote2.Classic.Joy2X < -Var.JoyDead2))||Wiimote2.Classic.b == True
  716.         PPJoy2.Digital2 = True
  717.      Else
  718.         PPJoy2.Digital2 = False
  719.      EndIf
  720.  
  721.     PPJoy2.Digital15 = Wiimote2.Classic.ZR
  722.     PPJoy2.Digital3 = Wiimote2.Classic.ZL
  723.  
  724.     If PPJoy2.Digital15 == True || PPJoy.Digital3 == True
  725.         PPJoy2.Digital0 = True
  726.         Wiimote2.Rumble = True
  727.     Else
  728.         PPJoy2.Digital0 = False
  729.         Wiimote2.Rumble = False
  730.     EndIf
  731.  
  732.  
  733.   EndIf
  734.   debug = "Classic Controller Connected; " + Var.ControlMode + ". Xtra: " + PPJoy2.Digital15
  735. EndIf
  736.  
  737.  
  738.  
  739. /*********************************************************************/
  740. //                      Nunchuk Controls (Virtual On)
  741. //               These controls were designed specifically
  742. //               for the Dreamcast "Virtual On" sequel.
  743. //
  744. //               In addition, the directional buttons
  745. //               on the Wiimote can navigate the menus
  746. /*********************************************************************/
  747.  
  748.  
  749. /*********************************************************************/
  750. //                      Joystick Controls
  751. //                 This is general joystick control
  752. //                 management. It lets you keep track
  753. //                 of which way our virtual joysticks
  754. //                 are pointed. Var.WiiLS_Left means :
  755. //
  756. //                 LS = Left Stick (Nunchuk)
  757. //                 _Left = Pointed Left
  758. //                 RS for Right Stick (Wiimote) and _Up/_Down/_Right
  759. //                 for those respective directions
  760. /*********************************************************************/
  761.  
  762.   // Wiimote/Nunchuk's minimum push for
  763.   // left or right Directions
  764.   Var.MinRightStick = 0.25
  765.   Var.MinLeftStick = 0.25
  766.  
  767.   // Wiimote/Nunchuk's minimum push for
  768.   // forward and backward directions
  769.   Var.MinRightForward = 0.5
  770.   Var.MinRightBackward = 0.3
  771.   Var.MinLeftForward = 0.5
  772.   Var.MinLeftBackward = 0.3
  773.  
  774.  
  775.  
  776. If Nunchuk2.Exists
  777.  
  778.    //Right weapon
  779.   If Wiimote2.B
  780.     Key.C = True
  781.     Wiimote2.LED4 = True
  782.   Else
  783.     Key.C = False
  784.     Wiimote2.LED4 = False
  785.   EndIf
  786.  
  787.   //Left weapon
  788.   If Nunchuk2.Zbutton
  789.     Wiimote2.LED1 = True
  790.     Key.D = True
  791.   Else
  792.     Wiimote2.LED1 = False
  793.     Key.D = False
  794.   EndIf
  795.  
  796.   //Dash
  797.   If Wiimote2.A  || Nunchuk2.CButton
  798.     Wiimote2.Rumble = True //Rumble feedback will be on while dashing
  799.     Wiimote2.LED2 and Wiimote2.LED3 = True //The two center LEDs will show us that we're dashing
  800.   Else
  801.     Key.X = False
  802.     Wiimote2.Rumble = False
  803.     Wiimote2.LED2 and Wiimote2.LED3 = False
  804.   EndIf
  805.   //Start
  806.   Key.Space = Wiimote2.Home
  807.  
  808.  
  809.  
  810.  
  811.   // Right stick
  812.   // Moving to the left
  813.   If Wiimote2.GX > Var.MinRightStick
  814.     Var.WiiRS_Left = True
  815.     Wiimote2.LED4 = True
  816.   Else
  817.     Var.WiiRS_Left = False
  818.     Wiimote2.LED4 = False
  819.   EndIf
  820.   // Moving to the right
  821.   If Wiimote2.GX < -Var.MinRightStick
  822.     Var.WiiRS_Right = True
  823.     Wiimote2.LED3 = True
  824.   Else
  825.     Var.WiiRS_Right = False
  826.     Wiimote2.LED3 = False
  827.   EndIf
  828.   // Tilted forward
  829.   If Wiimote2.GY > Var.MinRightForward
  830.   Var.WiiRS_Up = True
  831.   Else
  832.     Var.WiiRS_Up = False
  833.   EndIf
  834.  
  835.   // Tilted backward
  836.   If Wiimote2.GY < -Var.MinRightBackward
  837.     Var.WiiRS_Down = True
  838.   Else
  839.     Var.WiiRS_Down = False
  840.   EndIf
  841.  
  842.  
  843.   // Left stick
  844.   // Moving to the left
  845.   If Nunchuk2.GX > Var.MinLeftStick
  846.     Var.WiiLS_Left = True
  847.     Wiimote2.LED4 = True
  848.   Else
  849.     Var.WiiLS_Left = False
  850.     Wiimote2.LED4 = False
  851.   EndIf
  852.   // Moving to the right
  853.   If Nunchuk2.GX < -Var.MinLeftStick
  854.     Var.WiiLS_Right = True
  855.     Wiimote2.LED3 = True
  856.   Else
  857.     Var.WiiLS_Right = False
  858.     Wiimote2.LED3 = False
  859.   EndIf
  860.   // Tilted forward
  861.   If Nunchuk2.GY > Var.MinLeftForward
  862.     Var.WiiLS_Up = True
  863.   Else
  864.     Var.WiiLS_Up = False
  865.   EndIf
  866.   // Tilted backward
  867.   If Nunchuk2.GY < -Var.MinLeftBackward
  868.     Var.WiiLS_Down = True
  869.   Else
  870.     Var.WiiLS_Down = False
  871.   EndIf
  872.  
  873. *********************************************************************/
  874. //               If you're playing Virtual On
  875. //               somewhere else, or simply using
  876. //               another game that has dual joystick
  877. //               inputs, this is where you should start
  878. //               modifying the script. Remember to use
  879. //               WiiLS_Left and so forth as your source input.
  880. *********************************************************************/
  881.  
  882.   // Move Right
  883.   If (((Var.WiiLS_Right == True)&&(Var.WiiRS_Right == True))||(Wiimote2.Right == True))
  884.     Var.DebugText = "Moving Right"
  885.     PPJoy2.Digi