Example #1
0
        /// <summary>
        /// 
        /// </summary>
        public void Go()
        {
            string filePath = Path.Combine("..", "..");
            string fileDirectory = "Data";
            string fileName = "cursor.png";
            if (File.Exists(fileName))
            {
                filePath = "";
                fileDirectory = "";
            }
            else if (File.Exists(Path.Combine(fileDirectory, fileName)))
            {
                filePath = "";
            }

            string file = Path.Combine(Path.Combine(filePath, fileDirectory), fileName);

            Events.Tick += new EventHandler<TickEventArgs>(Tick);
            Events.KeyboardDown +=
                new EventHandler<KeyboardEventArgs>(this.KeyboardDown);
            Events.Quit += new EventHandler<QuitEventArgs>(this.Quit);
            Events.JoystickAxisMotion +=
                             new EventHandler<JoystickAxisEventArgs>(this.JoystickAxisChanged);
            Events.JoystickButtonDown += new EventHandler<JoystickButtonEventArgs>(this.JoystickButtonDown);
            joystick = Joysticks.OpenJoystick(0);

            try
            {
                Video.WindowIcon();
                Video.WindowCaption = "SdlDotNet - Joystick Example";
                screen = Video.SetVideoMode(width, height, true);
                Mouse.ShowCursor = false; // hide the cursor

                Surface surf =
                    screen.CreateCompatibleSurface(width, height, true);
                surf.Fill(new Rectangle(new Point(0, 0),
                    surf.Size), System.Drawing.Color.Black);

                cursor = new Surface(file);

                Events.Run();
            }
            catch
            {
                throw;
            }
        }
Example #2
0
 protected override void OnMenuOptionChanged()
 {
     if (SelectedMenuIndex == 0)
     {
         if (Items[0].Options[0] != "N/A")
         {
             if (Items[0].SelectedOptionIndex == 0)// NO
             {
                 useJoystick = false;
                 Items[2].Options.Clear();
                 Items[2].Options.Add(Settings.Key_HardReset);
                 Items[3].Options.Clear();
                 Items[3].Options.Add(Settings.Key_SoftReset);
                 Items[4].Options.Clear();
                 Items[4].Options.Add(Settings.Key_SwitchFullscreen);
                 Items[5].Options.Clear();
                 Items[5].Options.Add(Settings.Key_TakeSnap);
                 Items[6].Options.Clear();
                 Items[6].Options.Add(Settings.Key_SaveState);
                 Items[7].Options.Clear();
                 Items[7].Options.Add(Settings.Key_LoadState);
                 Items[8].Options.Clear();
                 Items[8].Options.Add(Settings.Key_ShutdownEmu);
                 Items[9].Options.Clear();
                 Items[9].Options.Add(Settings.Key_TogglePause);
                 Items[10].Options.Clear();
                 Items[10].Options.Add(Settings.Key_ToggleTurbo);
                 Items[11].Options.Clear();
                 Items[11].Options.Add(Settings.Key_RecordSound);
                 Items[12].Options.Clear();
                 Items[12].Options.Add(Settings.Key_ToggleFrameSkip);
                 Items[13].Options.Clear();
                 Items[13].Options.Add(Settings.Key_StateSlot0);
                 Items[14].Options.Clear();
                 Items[14].Options.Add(Settings.Key_StateSlot1);
                 Items[15].Options.Clear();
                 Items[15].Options.Add(Settings.Key_StateSlot2);
                 Items[16].Options.Clear();
                 Items[16].Options.Add(Settings.Key_StateSlot3);
                 Items[17].Options.Clear();
                 Items[17].Options.Add(Settings.Key_StateSlot4);
                 Items[18].Options.Clear();
                 Items[18].Options.Add(Settings.Key_StateSlot5);
                 Items[19].Options.Clear();
                 Items[19].Options.Add(Settings.Key_StateSlot6);
                 Items[20].Options.Clear();
                 Items[20].Options.Add(Settings.Key_StateSlot7);
                 Items[21].Options.Clear();
                 Items[21].Options.Add(Settings.Key_StateSlot8);
                 Items[22].Options.Clear();
                 Items[22].Options.Add(Settings.Key_StateSlot9);
                 Items[23].Options.Clear();
                 Items[23].Options.Add(Settings.Key_ShowGameStatus);
             }
             else
             {
                 useJoystick = true;
                 Items[2].Options.Clear();
                 Items[2].Options.Add(Settings.JoyKey_HardReset);
                 Items[3].Options.Clear();
                 Items[3].Options.Add(Settings.JoyKey_SoftReset);
                 Items[4].Options.Clear();
                 Items[4].Options.Add(Settings.JoyKey_SwitchFullscreen);
                 Items[5].Options.Clear();
                 Items[5].Options.Add(Settings.JoyKey_TakeSnap);
                 Items[6].Options.Clear();
                 Items[6].Options.Add(Settings.JoyKey_SaveState);
                 Items[7].Options.Clear();
                 Items[7].Options.Add(Settings.JoyKey_LoadState);
                 Items[8].Options.Clear();
                 Items[8].Options.Add(Settings.JoyKey_ShutdownEmu);
                 Items[9].Options.Clear();
                 Items[9].Options.Add(Settings.JoyKey_TogglePause);
                 Items[10].Options.Clear();
                 Items[10].Options.Add(Settings.JoyKey_ToggleTurbo);
                 Items[11].Options.Clear();
                 Items[11].Options.Add(Settings.JoyKey_RecordSound);
                 Items[12].Options.Clear();
                 Items[12].Options.Add(Settings.JoyKey_ToggleFrameSkip);
                 Items[13].Options.Clear();
                 Items[13].Options.Add(Settings.JoyKey_StateSlot0);
                 Items[14].Options.Clear();
                 Items[14].Options.Add(Settings.JoyKey_StateSlot1);
                 Items[15].Options.Clear();
                 Items[15].Options.Add(Settings.JoyKey_StateSlot2);
                 Items[16].Options.Clear();
                 Items[16].Options.Add(Settings.JoyKey_StateSlot3);
                 Items[17].Options.Clear();
                 Items[17].Options.Add(Settings.JoyKey_StateSlot4);
                 Items[18].Options.Clear();
                 Items[18].Options.Add(Settings.JoyKey_StateSlot5);
                 Items[19].Options.Clear();
                 Items[19].Options.Add(Settings.JoyKey_StateSlot6);
                 Items[20].Options.Clear();
                 Items[20].Options.Add(Settings.JoyKey_StateSlot7);
                 Items[21].Options.Clear();
                 Items[21].Options.Add(Settings.JoyKey_StateSlot8);
                 Items[22].Options.Clear();
                 Items[22].Options.Add(Settings.JoyKey_StateSlot9);
                 Items[23].Options.Clear();
                 Items[23].Options.Add(Settings.JoyKey_ShowGameStatus);
             }
         }
     }
     if (SelectedMenuIndex == 1)
     {
         if (Items[1].Options[0] != "N/A")
         {
             joystick = Joysticks.OpenJoystick(Items[1].SelectedOptionIndex);
         }
     }
 }
Example #3
0
 public override void OnOpen()
 {
     // Load joystick stuff
     Joysticks.Initialize();
     bool joyKeys = false;
     if (Joysticks.NumberOfJoysticks > 0)
     {
         Items[0].Options.Clear();
         Items[0].Options.Add("NO");
         Items[0].Options.Add("YES");
         Items[0].SelectedOptionIndex = Settings.Key_Shortcuts_UseJoystick ? 1 : 0;
         useJoystick = Settings.Key_Shortcuts_UseJoystick;
         Items[1].Options.Clear();
         if (Settings.Key_Shortcuts_JoystickIndex < Joysticks.NumberOfJoysticks)
         {
             for (int i = 0; i < Joysticks.NumberOfJoysticks; i++)
             {
                 Items[1].Options.Add(i.ToString());
             }
             Items[1].SelectedOptionIndex = Settings.Key_Shortcuts_JoystickIndex;
         }
         else
         {
             Items[1].SelectedOptionIndex = 0;
         }
         joystick = Joysticks.OpenJoystick(Items[1].SelectedOptionIndex);
         joyKeys = true;
     }
     else
     {
         useJoystick = false;
         Items[0].Options.Clear();
         Items[0].Options.Add("N/A");
         Items[0].SelectedOptionIndex = 0;
         Items[1].Options.Clear();
         Items[1].Options.Add("N/A");
         Items[1].SelectedOptionIndex = 0;
     }
     if (!(joyKeys && Settings.Key_Shortcuts_UseJoystick))
     {
         Items[2].Options.Clear();
         Items[2].Options.Add(Settings.Key_HardReset);
         Items[3].Options.Clear();
         Items[3].Options.Add(Settings.Key_SoftReset);
         Items[4].Options.Clear();
         Items[4].Options.Add(Settings.Key_SwitchFullscreen);
         Items[5].Options.Clear();
         Items[5].Options.Add(Settings.Key_TakeSnap);
         Items[6].Options.Clear();
         Items[6].Options.Add(Settings.Key_SaveState);
         Items[7].Options.Clear();
         Items[7].Options.Add(Settings.Key_LoadState);
         Items[8].Options.Clear();
         Items[8].Options.Add(Settings.Key_ShutdownEmu);
         Items[9].Options.Clear();
         Items[9].Options.Add(Settings.Key_TogglePause);
         Items[10].Options.Clear();
         Items[10].Options.Add(Settings.Key_ToggleTurbo);
         Items[11].Options.Clear();
         Items[11].Options.Add(Settings.Key_RecordSound);
         Items[12].Options.Clear();
         Items[12].Options.Add(Settings.Key_ToggleFrameSkip);
         Items[13].Options.Clear();
         Items[13].Options.Add(Settings.Key_StateSlot0);
         Items[14].Options.Clear();
         Items[14].Options.Add(Settings.Key_StateSlot1);
         Items[15].Options.Clear();
         Items[15].Options.Add(Settings.Key_StateSlot2);
         Items[16].Options.Clear();
         Items[16].Options.Add(Settings.Key_StateSlot3);
         Items[17].Options.Clear();
         Items[17].Options.Add(Settings.Key_StateSlot4);
         Items[18].Options.Clear();
         Items[18].Options.Add(Settings.Key_StateSlot5);
         Items[19].Options.Clear();
         Items[19].Options.Add(Settings.Key_StateSlot6);
         Items[20].Options.Clear();
         Items[20].Options.Add(Settings.Key_StateSlot7);
         Items[21].Options.Clear();
         Items[21].Options.Add(Settings.Key_StateSlot8);
         Items[22].Options.Clear();
         Items[22].Options.Add(Settings.Key_StateSlot9);
         Items[23].Options.Clear();
         Items[23].Options.Add(Settings.Key_ShowGameStatus);
     }
     else
     {
         Items[2].Options.Clear();
         Items[2].Options.Add(Settings.JoyKey_HardReset);
         Items[3].Options.Clear();
         Items[3].Options.Add(Settings.JoyKey_SoftReset);
         Items[4].Options.Clear();
         Items[4].Options.Add(Settings.JoyKey_SwitchFullscreen);
         Items[5].Options.Clear();
         Items[5].Options.Add(Settings.JoyKey_TakeSnap);
         Items[6].Options.Clear();
         Items[6].Options.Add(Settings.JoyKey_SaveState);
         Items[7].Options.Clear();
         Items[7].Options.Add(Settings.JoyKey_LoadState);
         Items[8].Options.Clear();
         Items[8].Options.Add(Settings.JoyKey_ShutdownEmu);
         Items[9].Options.Clear();
         Items[9].Options.Add(Settings.JoyKey_TogglePause);
         Items[10].Options.Clear();
         Items[10].Options.Add(Settings.JoyKey_ToggleTurbo);
         Items[11].Options.Clear();
         Items[11].Options.Add(Settings.JoyKey_RecordSound);
         Items[12].Options.Clear();
         Items[12].Options.Add(Settings.JoyKey_ToggleFrameSkip);
         Items[13].Options.Clear();
         Items[13].Options.Add(Settings.JoyKey_StateSlot0);
         Items[14].Options.Clear();
         Items[14].Options.Add(Settings.JoyKey_StateSlot1);
         Items[15].Options.Clear();
         Items[15].Options.Add(Settings.JoyKey_StateSlot2);
         Items[16].Options.Clear();
         Items[16].Options.Add(Settings.JoyKey_StateSlot3);
         Items[17].Options.Clear();
         Items[17].Options.Add(Settings.JoyKey_StateSlot4);
         Items[18].Options.Clear();
         Items[18].Options.Add(Settings.JoyKey_StateSlot5);
         Items[19].Options.Clear();
         Items[19].Options.Add(Settings.JoyKey_StateSlot6);
         Items[20].Options.Clear();
         Items[20].Options.Add(Settings.JoyKey_StateSlot7);
         Items[21].Options.Clear();
         Items[21].Options.Add(Settings.JoyKey_StateSlot8);
         Items[22].Options.Clear();
         Items[22].Options.Add(Settings.JoyKey_StateSlot9);
         Items[23].Options.Clear();
         Items[23].Options.Add(Settings.JoyKey_ShowGameStatus);
     }
 }
Example #4
0
 public static void LoadShortcuts()
 { 
     if (Settings.Key_Shortcuts_UseJoystick)
     {
         Joysticks.Initialize();
         if (Joysticks.IsValidJoystickNumber(Settings.Key_Shortcuts_JoystickIndex))
         {
             joyState = Joysticks.OpenJoystick(Settings.Key_Shortcuts_JoystickIndex);
         }
     }
     Enum.TryParse<Key>(Settings.Key_SoftReset, out Key_SoftReset);
     Enum.TryParse<Key>(Settings.Key_HardReset, out Key_HardReset);
     Enum.TryParse<Key>(Settings.Key_SwitchFullscreen, out Key_SwitchFullscreen);
     Enum.TryParse<Key>(Settings.Key_TakeSnap, out Key_TakeSnap);
     Enum.TryParse<Key>(Settings.Key_SaveState, out Key_SaveState);
     Enum.TryParse<Key>(Settings.Key_LoadState, out Key_LoadState);
     Enum.TryParse<Key>(Settings.Key_StateSlot0, out Key_StateSlot0);
     Enum.TryParse<Key>(Settings.Key_StateSlot1, out Key_StateSlot1);
     Enum.TryParse<Key>(Settings.Key_StateSlot2, out Key_StateSlot2);
     Enum.TryParse<Key>(Settings.Key_StateSlot3, out Key_StateSlot3);
     Enum.TryParse<Key>(Settings.Key_StateSlot4, out Key_StateSlot4);
     Enum.TryParse<Key>(Settings.Key_StateSlot5, out Key_StateSlot5);
     Enum.TryParse<Key>(Settings.Key_StateSlot6, out Key_StateSlot6);
     Enum.TryParse<Key>(Settings.Key_StateSlot7, out Key_StateSlot7);
     Enum.TryParse<Key>(Settings.Key_StateSlot8, out Key_StateSlot8);
     Enum.TryParse<Key>(Settings.Key_StateSlot9, out Key_StateSlot9);
     Enum.TryParse<Key>(Settings.Key_ShutdownEmu, out Key_ShutdownEmu);
     Enum.TryParse<Key>(Settings.Key_TogglePause, out Key_TogglePause);
     Enum.TryParse<Key>(Settings.Key_ToggleTurbo, out Key_ToggleTurbo);
     Enum.TryParse<Key>(Settings.Key_RecordSound, out Key_RecordSound);
     Enum.TryParse<Key>(Settings.Key_ToggleFrameSkip, out Key_ToggleFrameSkip);
     Enum.TryParse<Key>(Settings.Key_ShowGameStatus, out Key_ShowGameStatus);
 }
Example #5
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="disposing"></param>
 protected virtual void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             if (this.screen != null)
             {
                 this.screen.Dispose();
                 this.screen = null;
             }
             if (this.cursor != null)
             {
                 this.cursor.Dispose();
                 this.cursor = null;
             }
             if (this.joystick != null)
             {
                 this.joystick.Dispose();
                 this.joystick = null;
             }
         }
         this.disposed = true;
     }
 }
Example #6
0
 protected override void OnMenuOptionChanged()
 {
     if (SelectedMenuIndex == 0)
     {
         if (Items[0].Options[0] != "N/A")
         {
             if (Items[0].SelectedOptionIndex == 0)// NO
             {
                 useJoystick = false;
                 Items[2].Options.Clear();
                 Items[2].Options.Add(Settings.Key_VS_CreditServiceButton);
                 Items[3].Options.Clear();
                 Items[3].Options.Add(Settings.Key_VS_DIPSwitch1);
                 Items[4].Options.Clear();
                 Items[4].Options.Add(Settings.Key_VS_DIPSwitch2);
                 Items[5].Options.Clear();
                 Items[5].Options.Add(Settings.Key_VS_DIPSwitch3);
                 Items[6].Options.Clear();
                 Items[6].Options.Add(Settings.Key_VS_DIPSwitch4);
                 Items[7].Options.Clear();
                 Items[7].Options.Add(Settings.Key_VS_DIPSwitch5);
                 Items[8].Options.Clear();
                 Items[8].Options.Add(Settings.Key_VS_DIPSwitch6);
                 Items[9].Options.Clear();
                 Items[9].Options.Add(Settings.Key_VS_DIPSwitch7);
                 Items[10].Options.Clear();
                 Items[10].Options.Add(Settings.Key_VS_DIPSwitch8);
                 Items[11].Options.Clear();
                 Items[11].Options.Add(Settings.Key_VS_CreditLeftCoinSlot);
                 Items[12].Options.Clear();
                 Items[12].Options.Add(Settings.Key_VS_CreditRightCoinSlot);
             }
             else
             {
                 useJoystick = true;
                 Items[2].Options.Clear();
                 Items[2].Options.Add(Settings.JoyKey_VS_CreditServiceButton);
                 Items[3].Options.Clear();
                 Items[3].Options.Add(Settings.JoyKey_VS_DIPSwitch1);
                 Items[4].Options.Clear();
                 Items[4].Options.Add(Settings.JoyKey_VS_DIPSwitch2);
                 Items[5].Options.Clear();
                 Items[5].Options.Add(Settings.JoyKey_VS_DIPSwitch3);
                 Items[6].Options.Clear();
                 Items[6].Options.Add(Settings.JoyKey_VS_DIPSwitch4);
                 Items[7].Options.Clear();
                 Items[7].Options.Add(Settings.JoyKey_VS_DIPSwitch5);
                 Items[8].Options.Clear();
                 Items[8].Options.Add(Settings.JoyKey_VS_DIPSwitch6);
                 Items[9].Options.Clear();
                 Items[9].Options.Add(Settings.JoyKey_VS_DIPSwitch7);
                 Items[10].Options.Clear();
                 Items[10].Options.Add(Settings.JoyKey_VS_DIPSwitch8);
                 Items[11].Options.Clear();
                 Items[11].Options.Add(Settings.JoyKey_VS_CreditLeftCoinSlot);
                 Items[12].Options.Clear();
                 Items[12].Options.Add(Settings.JoyKey_VS_CreditRightCoinSlot);
             }
         }
     }
     if (SelectedMenuIndex == 1)
     {
         if (Items[1].Options[0] != "N/A")
         {
             joystick = Joysticks.OpenJoystick(Items[1].SelectedOptionIndex);
         }
     }
 }
Example #7
0
 public override void OnOpen()
 {
     // Load joystick stuff
     Joysticks.Initialize();
     bool joyKeys = false;
     if (Joysticks.NumberOfJoysticks > 0)
     {
         Items[0].Options.Clear();
         Items[0].Options.Add("NO");
         Items[0].Options.Add("YES");
         Items[0].SelectedOptionIndex = Settings.Key_VS_UseJoystick ? 1 : 0;
         useJoystick = Settings.Key_P4_UseJoystick;
         Items[1].Options.Clear();
         if (Settings.Key_VS_JoystickIndex < Joysticks.NumberOfJoysticks)
         {
             for (int i = 0; i < Joysticks.NumberOfJoysticks; i++)
             {
                 Items[1].Options.Add(i.ToString());
             }
             Items[1].SelectedOptionIndex = Settings.Key_VS_JoystickIndex;
         }
         else
         {
             Items[1].SelectedOptionIndex = 0;
         }
         joystick = Joysticks.OpenJoystick(Items[1].SelectedOptionIndex);
         joyKeys = true;
     }
     else
     {
         useJoystick = false;
         Items[0].Options.Clear();
         Items[0].Options.Add("N/A");
         Items[0].SelectedOptionIndex = 0;
         Items[1].Options.Clear();
         Items[1].Options.Add("N/A");
         Items[1].SelectedOptionIndex = 0;
     }
     if (!(joyKeys && Settings.Key_VS_UseJoystick))
     {
         Items[2].Options.Clear();
         Items[2].Options.Add(Settings.Key_VS_CreditServiceButton);
         Items[3].Options.Clear();
         Items[3].Options.Add(Settings.Key_VS_DIPSwitch1);
         Items[4].Options.Clear();
         Items[4].Options.Add(Settings.Key_VS_DIPSwitch2);
         Items[5].Options.Clear();
         Items[5].Options.Add(Settings.Key_VS_DIPSwitch3);
         Items[6].Options.Clear();
         Items[6].Options.Add(Settings.Key_VS_DIPSwitch4);
         Items[7].Options.Clear();
         Items[7].Options.Add(Settings.Key_VS_DIPSwitch5);
         Items[8].Options.Clear();
         Items[8].Options.Add(Settings.Key_VS_DIPSwitch6);
         Items[9].Options.Clear();
         Items[9].Options.Add(Settings.Key_VS_DIPSwitch7);
         Items[10].Options.Clear();
         Items[10].Options.Add(Settings.Key_VS_DIPSwitch8);
         Items[11].Options.Clear();
         Items[11].Options.Add(Settings.Key_VS_CreditLeftCoinSlot);
         Items[12].Options.Clear();
         Items[12].Options.Add(Settings.Key_VS_CreditRightCoinSlot);
     }
     else
     {
         Items[2].Options.Clear();
         Items[2].Options.Add(Settings.JoyKey_VS_CreditServiceButton);
         Items[3].Options.Clear();
         Items[3].Options.Add(Settings.JoyKey_VS_DIPSwitch1);
         Items[4].Options.Clear();
         Items[4].Options.Add(Settings.JoyKey_VS_DIPSwitch2);
         Items[5].Options.Clear();
         Items[5].Options.Add(Settings.JoyKey_VS_DIPSwitch3);
         Items[6].Options.Clear();
         Items[6].Options.Add(Settings.JoyKey_VS_DIPSwitch4);
         Items[7].Options.Clear();
         Items[7].Options.Add(Settings.JoyKey_VS_DIPSwitch5);
         Items[8].Options.Clear();
         Items[8].Options.Add(Settings.JoyKey_VS_DIPSwitch6);
         Items[9].Options.Clear();
         Items[9].Options.Add(Settings.JoyKey_VS_DIPSwitch7);
         Items[10].Options.Clear();
         Items[10].Options.Add(Settings.JoyKey_VS_DIPSwitch8);
         Items[11].Options.Clear();
         Items[11].Options.Add(Settings.JoyKey_VS_CreditLeftCoinSlot);
         Items[12].Options.Clear();
         Items[12].Options.Add(Settings.JoyKey_VS_CreditRightCoinSlot);
     }
 }
Example #8
0
 protected override void OnMenuOptionChanged()
 {
     if (SelectedMenuIndex == 0)
     {
         if (Items[0].Options[0] != "N/A")
         {
             if (Items[0].SelectedOptionIndex == 0)// NO
             {
                 useJoystick = false;
                 Items[2].Options.Clear();
                 Items[2].Options.Add(Settings.Key_P2_ButtonA);
                 Items[3].Options.Clear();
                 Items[3].Options.Add(Settings.Key_P2_ButtonB);
                 Items[4].Options.Clear();
                 Items[4].Options.Add(Settings.Key_P2_ButtonTurboA);
                 Items[5].Options.Clear();
                 Items[5].Options.Add(Settings.Key_P2_ButtonTurboB);
                 Items[6].Options.Clear();
                 Items[6].Options.Add(Settings.Key_P2_ButtonStart);
                 Items[7].Options.Clear();
                 Items[7].Options.Add(Settings.Key_P2_ButtonSelect);
                 Items[8].Options.Clear();
                 Items[8].Options.Add(Settings.Key_P2_ButtonUp);
                 Items[9].Options.Clear();
                 Items[9].Options.Add(Settings.Key_P2_ButtonDown);
                 Items[10].Options.Clear();
                 Items[10].Options.Add(Settings.Key_P2_ButtonLeft);
                 Items[11].Options.Clear();
                 Items[11].Options.Add(Settings.Key_P2_ButtonRight);
             }
             else
             {
                 useJoystick = true;
                 Items[2].Options.Clear();
                 Items[2].Options.Add(Settings.JoyKey_P2_ButtonA);
                 Items[3].Options.Clear();
                 Items[3].Options.Add(Settings.JoyKey_P2_ButtonB);
                 Items[4].Options.Clear();
                 Items[4].Options.Add(Settings.JoyKey_P2_ButtonTurboA);
                 Items[5].Options.Clear();
                 Items[5].Options.Add(Settings.JoyKey_P2_ButtonTurboB);
                 Items[6].Options.Clear();
                 Items[6].Options.Add(Settings.JoyKey_P2_ButtonStart);
                 Items[7].Options.Clear();
                 Items[7].Options.Add(Settings.JoyKey_P2_ButtonSelect);
                 Items[8].Options.Clear();
                 Items[8].Options.Add(Settings.JoyKey_P2_ButtonUp);
                 Items[9].Options.Clear();
                 Items[9].Options.Add(Settings.JoyKey_P2_ButtonDown);
                 Items[10].Options.Clear();
                 Items[10].Options.Add(Settings.JoyKey_P2_ButtonLeft);
                 Items[11].Options.Clear();
                 Items[11].Options.Add(Settings.JoyKey_P2_ButtonRight);
             }
         }
     }
     if (SelectedMenuIndex == 1)
     {
         if (Items[1].Options[0] != "N/A")
         {
             joystick = Joysticks.OpenJoystick(Items[1].SelectedOptionIndex);
         }
     }
 }
Example #9
0
 public override void OnOpen()
 {
     // Load joystick stuff
     Joysticks.Initialize();
     bool joyKeys = false;
     if (Joysticks.NumberOfJoysticks > 0)
     {
         Items[0].Options.Clear();
         Items[0].Options.Add("NO");
         Items[0].Options.Add("YES");
         Items[0].SelectedOptionIndex = Settings.Key_P2_UseJoystick ? 1 : 0;
         useJoystick = Settings.Key_P2_UseJoystick;
         Items[1].Options.Clear();
         if (Settings.Key_P2_JoystickIndex < Joysticks.NumberOfJoysticks)
         {
             for (int i = 0; i < Joysticks.NumberOfJoysticks; i++)
             {
                 Items[1].Options.Add(i.ToString());
             }
             Items[1].SelectedOptionIndex = Settings.Key_P2_JoystickIndex;
         }
         else
         {
             Items[1].SelectedOptionIndex = 0;
         }
         joystick = Joysticks.OpenJoystick(Items[1].SelectedOptionIndex);
         joyKeys = true;
     }
     else
     {
         useJoystick = false;
         Items[0].Options.Clear();
         Items[0].Options.Add("N/A");
         Items[0].SelectedOptionIndex = 0;
         Items[1].Options.Clear();
         Items[1].Options.Add("N/A");
         Items[1].SelectedOptionIndex = 0;
     }
     if (!(joyKeys && Settings.Key_P2_UseJoystick))
     {
         Items[2].Options.Clear();
         Items[2].Options.Add(Settings.Key_P2_ButtonA);
         Items[3].Options.Clear();
         Items[3].Options.Add(Settings.Key_P2_ButtonB);
         Items[4].Options.Clear();
         Items[4].Options.Add(Settings.Key_P2_ButtonTurboA);
         Items[5].Options.Clear();
         Items[5].Options.Add(Settings.Key_P2_ButtonTurboB);
         Items[6].Options.Clear();
         Items[6].Options.Add(Settings.Key_P2_ButtonStart);
         Items[7].Options.Clear();
         Items[7].Options.Add(Settings.Key_P2_ButtonSelect);
         Items[8].Options.Clear();
         Items[8].Options.Add(Settings.Key_P2_ButtonUp);
         Items[9].Options.Clear();
         Items[9].Options.Add(Settings.Key_P2_ButtonDown);
         Items[10].Options.Clear();
         Items[10].Options.Add(Settings.Key_P2_ButtonLeft);
         Items[11].Options.Clear();
         Items[11].Options.Add(Settings.Key_P2_ButtonRight);
     }
     else
     {
         Items[2].Options.Clear();
         Items[2].Options.Add(Settings.JoyKey_P2_ButtonA);
         Items[3].Options.Clear();
         Items[3].Options.Add(Settings.JoyKey_P2_ButtonB);
         Items[4].Options.Clear();
         Items[4].Options.Add(Settings.JoyKey_P2_ButtonTurboA);
         Items[5].Options.Clear();
         Items[5].Options.Add(Settings.JoyKey_P2_ButtonTurboB);
         Items[6].Options.Clear();
         Items[6].Options.Add(Settings.JoyKey_P2_ButtonStart);
         Items[7].Options.Clear();
         Items[7].Options.Add(Settings.JoyKey_P2_ButtonSelect);
         Items[8].Options.Clear();
         Items[8].Options.Add(Settings.JoyKey_P2_ButtonUp);
         Items[9].Options.Clear();
         Items[9].Options.Add(Settings.JoyKey_P2_ButtonDown);
         Items[10].Options.Clear();
         Items[10].Options.Add(Settings.JoyKey_P2_ButtonLeft);
         Items[11].Options.Clear();
         Items[11].Options.Add(Settings.JoyKey_P2_ButtonRight);
     }
 }
Example #10
0
 public SDL_Joystick_Joypad(int joystickIndex, int playerIndex)
 {
     this.playerIndex = playerIndex;
     LoadSettings();
     state = Joysticks.OpenJoystick(joystickIndex);
 }