Beispiel #1
0
        static void Main()
        {
            try
            {
                ////////////// MOD LOADER DLL SKELETON CODE ///////////////////////////////////////////////////////////////////////////////////////////////////
                AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(SonicHeroes.Misc.SonicHeroes_Miscallenous.CurrentDomain_SetAssemblyResolve);
                Sonic_Heroes_Networking_Client.SetupClient(IPAddress.Loopback);                                                                                                            /// Set up networking with the Sonic Heroes Mod Loader.
                Sonic_Heroes_Networking_Client_II.SetupClient(IPAddress.Loopback);                                                                                                         /// Set up networking with the Sonic Heroes Mod Loader.
                byte[] Response = Sonic_Heroes_Networking_Client.SendData_Alternate(Message_Type.Client_Call_Send_Message, Encoding.ASCII.GetBytes(Mod_Name + " | Loading... OK!"), true); /// Say to the Mod Loader that we have loaded so the end user can know.
                Sonic_Heroes_Process = Process.GetCurrentProcess();                                                                                                                        /// We will use this for reading and writing memory.
                ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                // Load the Controller Deadzone Config
                Controller_Deadzones = new Controller_Config_Deadzones();
                Load_Controller_Deadzone_Configuration();

                // Define the controller manager.
                SonicHeroes_Joystick_Manager = new SonicHeroes.Controller.DirectInput_Joystick_Manager();


                // Declare new hook.
                Heroes_Controller_Function_Hook = new SonicHeroes.Hooking.Injection
                                                  (
                    (IntPtr)0x445B3A,     // Immediately after the controls are acquired by the game.
                    (Heroes_Controller_Function_Delegate)Heroes_Controller_Function_Override,
                    6
                                                  );

                // Activate our hook!
                Heroes_Controller_Function_Hook.Activate();
            }
            catch (Exception Ex) { Sonic_Heroes_Networking_Client.SendData_Alternate(Message_Type.Client_Call_Send_Message, Encoding.ASCII.GetBytes(Mod_Name + " Failed To Load: " + Ex.Message), false); }
        }
Beispiel #2
0
        /// <summary>
        /// Main Menu Controller Handling Method
        /// </summary>
        public override void Handle_Controller_Inputs(Sonic_Heroes_Joystick.Controller_Inputs_Generic P1_Controller, SonicHeroes.Controller.DirectInput_Joystick_Manager Controller_Manager)
        {
            // Execute Base Controller Code. UP/DOWN navigation + back button.
            base.Handle_Controller_Inputs(P1_Controller, Controller_Manager);

            // Check menu to load if A_Button is pressed.
            if (P1_Controller.ControllerButtons.Button_A)
            {
                // Toggle X/Y/Z Button
                if (Menu_Index == (int)Menu_Items.Menu_Item_Position_XYZ)
                {
                    Program.Feature_Position_XYZ_Window_X.Toggle_Overlay_Status(); Set_Toggle_State();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Enhanced_Debug_Movement_Mode)
                {
                    Program.Feature_Enhanced_Debug_Movement_Mode_X.Toggle_Free_Movement_Mode(); Set_Toggle_State();
                }

                // Set New Menu Bounds
                if (Program.Sonic_Heroes_Overlay.Ready_To_Render)
                {
                    Set_Drawing_Properties();
                }

                // Wait for button release.
                Wait_For_Controller_Release(Controller_Keys.Button_A, Controller_Manager);
            }
        }
Beispiel #3
0
        // Controller Handler
        public override void Handle_Controller_Inputs(Sonic_Heroes_Joystick.Controller_Inputs_Generic P1_Controller, SonicHeroes.Controller.DirectInput_Joystick_Manager Controller_Manager)
        {
            // Execute Base Controller Code. UP/DOWN navigation + back button.
            base.Handle_Controller_Inputs(P1_Controller, Controller_Manager);

            // Check for directional button presses
            if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.LEFT)
            {
                // Check any known menu items
                if (Menu_Index == (int)Menu_Items.Menu_Item_Current_Bank)
                {
                    Program.Feature_PAC_Clip_Player_X.Decrement_Current_Bank();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Current_Sound)
                {
                    Program.Feature_PAC_Clip_Player_X.Decrement_Current_Bank_Sound();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Current_Music_Track)
                {
                    Program.Feature_ADX_Player_X.Decrement_Current_ADX_Track();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Current_AFS_Archive)
                {
                    Program.Feature_AFS_Utilities_X.Decrement_Current_AFS_Archive();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Current_Bank3_Bank_Archive)
                {
                    Program.Feature_PAC_Clip_Player_X.Decrement_Current_Bank3_Bank();
                }

                // Refresh Menu State
                Set_Toggle_State();

                // Sleep the thread for repeat inputs.
                DPAD_Longpress_Sleep();
            }
            else if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.RIGHT)
            {
                // Check any known menu items
                if (Menu_Index == (int)Menu_Items.Menu_Item_Current_Bank)
                {
                    Program.Feature_PAC_Clip_Player_X.Increment_Current_Bank();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Current_Sound)
                {
                    Program.Feature_PAC_Clip_Player_X.Increment_Current_Bank_Sound();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Current_Music_Track)
                {
                    Program.Feature_ADX_Player_X.Increment_Current_ADX_Track();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Current_AFS_Archive)
                {
                    Program.Feature_AFS_Utilities_X.Increment_Current_AFS_Archive();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Current_Bank3_Bank_Archive)
                {
                    Program.Feature_PAC_Clip_Player_X.Increment_Current_Bank3_Bank();
                }

                // Refresh Menu State
                Set_Toggle_State();

                // Sleep the thread for repeat inputs.
                DPAD_Longpress_Sleep();
            }

            // Toggle any items if necessary.
            if (P1_Controller.ControllerButtons.Button_A)
            {
                // Check any known menu items
                if (Menu_Index == (int)Menu_Items.Menu_Item_Current_Sound)
                {
                    Program.Feature_PAC_Clip_Player_X.Play_Sound_Bank();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Current_Music_Track)
                {
                    Program.Feature_ADX_Player_X.Play_ADX_Track();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Current_AFS_Archive)
                {
                    Program.Feature_AFS_Utilities_X.Switch_AFS_File();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Current_Bank3_Bank_Archive)
                {
                    Program.Feature_PAC_Clip_Player_X.Reload_Bank3();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Current_Disable_Character_Action_Sounds)
                {
                    Program.Feature_Toggle_Character_Chatter_X.Toggle_CharacterChatter();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Current_Disable_Character_Comment_Sounds)
                {
                    Program.Feature_Toggle_Character_Chatter_X.Toggle_CharacterCommentChatter();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Toggle_Music_OnPause)
                {
                    Program.Feature_Toggle_Music_OnPause_X.Toggle_Music_OnPause();
                }

                // Refresh Menu State
                Set_Toggle_State();

                // Wait for user to release button.
                Wait_For_Controller_Release(Controller_Keys.Button_A, Controller_Manager);
            }
        }
        // Controller Handler
        public override void Handle_Controller_Inputs(Sonic_Heroes_Joystick.Controller_Inputs_Generic P1_Controller, SonicHeroes.Controller.DirectInput_Joystick_Manager Controller_Manager)
        {
            // Execute Base Controller Code. UP/DOWN navigation + back button.
            base.Handle_Controller_Inputs(P1_Controller, Controller_Manager);

            // Check any known controller buttons.
            if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.LEFT)
            {
                if (Menu_Index == (int)Menu_Items.Menu_Item_Field_Of_View_Scale)
                {
                    Program.Feature_Enhanced_FOV_Fix_X.Decrement_Field_Of_View_Scale();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_RGB_Colour_Cycle_Rate)
                {
                    Program.Feature_Cycle_RGB_Colours_X.Decrement_Colours_Per_Second();
                }

                // Refresh Menu State
                Set_Toggle_State();

                // Sleep the thread for repeat inputs.
                DPAD_Longpress_Sleep();
            }
            else if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.RIGHT)
            {
                if (Menu_Index == (int)Menu_Items.Menu_Item_Field_Of_View_Scale)
                {
                    Program.Feature_Enhanced_FOV_Fix_X.Increment_Field_Of_View_Scale();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_RGB_Colour_Cycle_Rate)
                {
                    Program.Feature_Cycle_RGB_Colours_X.Increment_Colours_Per_Second();
                }

                // Refresh Menu State
                Set_Toggle_State();

                // Sleep the thread for repeat inputs.
                DPAD_Longpress_Sleep();
            }

            // Check any known button presses.
            if (P1_Controller.ControllerButtons.Button_A)
            {
                // Check Indexes
                if (Menu_Index == (int)Menu_Items.Menu_Item_Toggle_Aspect_Ratio_Fix)
                {
                    Program.Feature_Enhanced_FOV_Fix_X.Button_Set_FOV_Aspect_Ratio_Fix();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_RGB_Formation_Barriers)
                {
                    Program.Feature_Cycle_RGB_Colours_X.Toggle_HUE_Cycle_Formation_Barriers();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_RGB_Character_Balls)
                {
                    Program.Feature_Cycle_RGB_Colours_X.Toggle_HUE_Cycle_Character_Balls();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_RGB_Character_Trails)
                {
                    Program.Feature_Cycle_RGB_Colours_X.Toggle_HUE_Cycle_Character_Trails();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_RGB_Character_Tornadoes)
                {
                    Program.Feature_Cycle_RGB_Colours_X.Toggle_HUE_Cycle_Character_Tornadoes();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_RGB_Combined)
                {
                    Program.Feature_Cycle_RGB_Colours_X.Toggle_HUE_Cycle_All_Combined();
                }

                // Refresh Menu State
                Set_Toggle_State();

                // Wait for release.
                Wait_For_Controller_Release(Controller_Keys.Button_A, Controller_Manager);
            }
        }
        // Controller Handler
        public override void Handle_Controller_Inputs(Sonic_Heroes_Joystick.Controller_Inputs_Generic P1_Controller, SonicHeroes.Controller.DirectInput_Joystick_Manager Controller_Manager)
        {
            // Execute Base Controller Code. UP/DOWN navigation + back button.
            base.Handle_Controller_Inputs(P1_Controller, Controller_Manager);

            if (P1_Controller.ControllerButtons.Button_A)
            {
                // Toggle Super Sonic/Tails/Nipples Enchilada.
                if (Menu_Index == (int)Menu_Items.Menu_Item_Enter_Level)
                {
                    Program.Feature_Force_Load_Level_X.Force_Load_Level();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Easy_Menu_Test)
                {
                    Program.Feature_Force_Load_Level_X.Force_Load_Debug_Menu();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_SET_Editor)
                {
                    Program.Feature_Set_Editor_X.SET_Editor_Toggle();
                }

                // Set Menu Bounds
                Set_Toggle_State();
                if (Program.Sonic_Heroes_Overlay.Ready_To_Render)
                {
                    Set_Drawing_Properties();
                }

                // Wait for button release.
                Wait_For_Controller_Release(Controller_Keys.Button_A, Controller_Manager);
            }

            if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.LEFT)
            {
                if (Menu_Index == (int)Menu_Items.Menu_Item_Select_Level)
                {
                    Program.Feature_Force_Load_Level_X.Decrement_StageID_Index();
                }

                // Set Menu Bounds
                Set_Toggle_State();
                if (Program.Sonic_Heroes_Overlay.Ready_To_Render)
                {
                    Set_Drawing_Properties();
                }

                // Sleep for Repeat Inputs.
                DPAD_Longpress_Sleep();
            }
            else if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.RIGHT)
            {
                if (Menu_Index == (int)Menu_Items.Menu_Item_Select_Level)
                {
                    Program.Feature_Force_Load_Level_X.Increment_StageID_Index();
                }

                // Set Menu Bounds
                Set_Toggle_State();
                if (Program.Sonic_Heroes_Overlay.Ready_To_Render)
                {
                    Set_Drawing_Properties();
                }

                // Sleep for Repeat Inputs.
                DPAD_Longpress_Sleep();
            }
        }
        /// <summary>
        /// Main Menu Controller Handling Method
        /// </summary>
        public override void Handle_Controller_Inputs(Sonic_Heroes_Joystick.Controller_Inputs_Generic P1_Controller, SonicHeroes.Controller.DirectInput_Joystick_Manager Controller_Manager)
        {
            // Execute Base Controller Code. UP/DOWN navigation + back button.
            base.Handle_Controller_Inputs(P1_Controller, Controller_Manager);

            // Check menu to load if A_Button is pressed.
            if (P1_Controller.ControllerButtons.Button_A)
            {
                // Toggle Super Sonic/Tails/Nipples Enchilada.
                if (Menu_Index == (int)Menu_Items.Menu_Item_Magnetic_Barrier)
                {
                    Program.Feature_Magnetic_Barrier_X.Toggle_Magnetic_Barrier();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Party_Mode)
                {
                    Program.Feature_Party_Mode_X.Toggle_Party_Mode();
                }

                // Refresh Menu State
                Set_Toggle_State();

                // Set New Menu Bounds
                if (Program.Sonic_Heroes_Overlay.Ready_To_Render)
                {
                    Set_Drawing_Properties();
                }

                // Wait for button release.
                Wait_For_Controller_Release(Controller_Keys.Button_A, Controller_Manager);
            }
            else if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.LEFT)
            {
                // Toggle Super Sonic/Tails/Nipples Enchilada.
                if (Menu_Index == (int)Menu_Items.Menu_Item_Magnetic_Barrier_Base_Speed)
                {
                    Program.Feature_Magnetic_Barrier_X.Decrement_Base_Speed();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Magnetic_Barrier_Distance_Speed)
                {
                    Program.Feature_Magnetic_Barrier_X.Decrement_Distance_Speed_Scale();
                }

                // Refresh Menu State
                Set_Toggle_State();

                // Longpress DPAD
                DPAD_Longpress_Sleep();
            }
            else if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.RIGHT)
            {
                // Toggle Super Sonic/Tails/Nipples Enchilada.
                if (Menu_Index == (int)Menu_Items.Menu_Item_Magnetic_Barrier_Base_Speed)
                {
                    Program.Feature_Magnetic_Barrier_X.Increment_Base_Speed();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Magnetic_Barrier_Distance_Speed)
                {
                    Program.Feature_Magnetic_Barrier_X.Increment_Distance_Speed_Scale();
                }

                // Refresh Menu State
                Set_Toggle_State();

                // Longpress DPAD
                DPAD_Longpress_Sleep();
            }
        }
Beispiel #7
0
        /// Disable Default InputHandler
        public void Controller_Handler(Sonic_Heroes_Joystick.Controller_Inputs_Generic P1_Controller, SonicHeroes.Controller.DirectInput_Joystick_Manager Controller_Manager)
        {
            // Get Information of whether the overlay should be shown and controls enabled.
            byte Is_Currently_In_Level = Program.Sonic_Heroes_Process.ReadMemory <byte>((IntPtr)SonicHeroesVariables.Game_CurrentState.CurrentlyInLevel, 1);

            // If menu is not open
            if (!Program.Draw_Current_Menu && Is_Currently_In_Level == 1)
            {
                if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.LEFT)
                {
                    // Back_Up_Characters
                    Back_Up_Character();

                    // Set Menu Text
                    Free_Movement_Mode_Menu.Set_Menu_Text(Player_Position_Index, Player_Positions[Player_Position_Index].Character_X, Player_Positions[Player_Position_Index].Character_Y, Player_Positions[Player_Position_Index].Character_Z);

                    // Longpress DPAD
                    Free_Movement_Mode_Menu.Wait_For_Controller_Release(Menu_Base.Controller_Keys.DPAD_LEFT, Controller_Manager);
                }
                else if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.RIGHT)
                {
                    // Restore Characters
                    Restore_Character();

                    // Longpress DPAD
                    Free_Movement_Mode_Menu.Wait_For_Controller_Release(Menu_Base.Controller_Keys.DPAD_RIGHT, Controller_Manager);
                }
                else if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.UP)
                {
                    // Toggle Free Movement Mode
                    if (Free_Movement_Enabled)
                    {
                        // Enable Camera
                        Program.Sonic_Heroes_Process.WriteMemory
                        (
                            (IntPtr)SonicHeroesVariables.Game_Camera_CurrentCamera.Camera_Enabled,
                            BitConverter.GetBytes((short)1)
                        );

                        // Enable Gravity/Natural Positioning
                        Program.Sonic_Heroes_Process.WriteMemory((IntPtr)0x599376, new byte[] { 0xD9, 0x9D, 0x18, 0x01, 0x00, 0x00 });
                        //Program.Sonic_Heroes_Process.WriteMemory((IntPtr)0x599366, new byte[] { 0xD9, 0x19 });
                        //Program.Sonic_Heroes_Process.WriteMemory((IntPtr)0x59938A, new byte[] { 0xD9, 0x9D, 0x1C, 0x01, 0x00, 0x00 });

                        Free_Movement_Enabled = false;
                    }
                    else
                    {
                        // Disable Camera
                        Program.Sonic_Heroes_Process.WriteMemory
                        (
                            (IntPtr)SonicHeroesVariables.Game_Camera_CurrentCamera.Camera_Enabled,
                            BitConverter.GetBytes((short)0)
                        );

                        // Reset Camera Rotation
                        Program.Sonic_Heroes_Process.WriteMemory
                        (
                            (IntPtr)SonicHeroesVariables.Game_Camera_CurrentCamera.Camera_Angle_Horizontal_BAMS,
                            BitConverter.GetBytes((short)0)
                        );

                        // Disable Gravity/Natural Positioning
                        Program.Sonic_Heroes_Process.WriteMemory((IntPtr)0x599376, new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 });
                        //Program.Sonic_Heroes_Process.WriteMemory((IntPtr)0x599366, new byte[] { 0x90, 0x90 });
                        //Program.Sonic_Heroes_Process.WriteMemory((IntPtr)0x59938A, new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 });

                        // Get Initial Positions.
                        int Player_Pointer = Program.Sonic_Heroes_Process.ReadMemory <int>((IntPtr)SonicHeroesVariables.Characters_Addresses.CurrentPlayerControlledCharacter_Pointer, 4);
                        Current_Player_Position.Character_X = Program.Sonic_Heroes_Process.ReadMemory <float>((IntPtr)SonicHeroesVariables.Characters_Addresses_Offsets.XPosition + Player_Pointer, 4);
                        Current_Player_Position.Character_Y = Program.Sonic_Heroes_Process.ReadMemory <float>((IntPtr)SonicHeroesVariables.Characters_Addresses_Offsets.YPosition + Player_Pointer, 4);
                        Current_Player_Position.Character_Z = Program.Sonic_Heroes_Process.ReadMemory <float>((IntPtr)SonicHeroesVariables.Characters_Addresses_Offsets.ZPosition + Player_Pointer, 4);

                        Free_Movement_Enabled = true;
                    }

                    // Longpress DPAD
                    Free_Movement_Mode_Menu.Wait_For_Controller_Release(Menu_Base.Controller_Keys.DPAD_UP, Controller_Manager);
                }
                else if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.DOWN)
                {
                    // Cycle Current Position
                    Increment_Current_Position();

                    // Longpress DPAD
                    Free_Movement_Mode_Menu.Wait_For_Controller_Release(Menu_Base.Controller_Keys.DPAD_DOWN, Controller_Manager);
                }

                // If free movement is enabled, handle free movement.
                if (Free_Movement_Enabled)
                {
                    // Get Controller Information
                    Sonic_Heroes_Joystick.Controller_Inputs_Generic Heroes_Controller_Button_Info = Controller_Manager.PlayerControllers[Menu_Base.controllerIndex].Get_Whole_Controller_State();

                    // Get Axis Values
                    float Stick_X = P1_Controller.LeftStick.X * 0.001F;                        // Normal Range = -1000 to 1000. Scale to -1 to 1
                    float Stick_Y = P1_Controller.LeftStick.Y * 0.001F;                        // Normal Range = -1000 to 1000. Scale to -1 to 1

                    float LT_Pressure = (P1_Controller.LeftTriggerPressure + 1000) * 0.0005F;  // Normal Range = -1000 to 1000. Changed to 0 - 2000.
                    float RT_Pressure = (P1_Controller.RightTriggerPressure + 1000) * 0.0005F; // Normal Range = -1000 to 1000. Changed to 0 - 2000.

                    // 20% Deadzone
                    if (Stick_X < 0.20F && Stick_X > -0.20F)
                    {
                        Stick_X = 0.0F;
                    }
                    if (Stick_Y < 0.20F && Stick_Y > -0.20F)
                    {
                        Stick_Y = 0.0F;
                    }
                    if (LT_Pressure < 0.20F)
                    {
                        LT_Pressure = 0.0F;
                    }
                    if (RT_Pressure < 0.20F)
                    {
                        RT_Pressure = 0.0F;
                    }

                    // Get Current Player Location
                    int Player_Pointer = Program.Sonic_Heroes_Process.ReadMemory <int>((IntPtr)SonicHeroesVariables.Characters_Addresses.CurrentPlayerControlledCharacter_Pointer, 4);

                    // Set new positions
                    Current_Player_Position.Character_X += Stick_X * Max_Movement_Speed;
                    Current_Player_Position.Character_Y  = Current_Player_Position.Character_Y - (LT_Pressure * Max_Movement_Speed) + (RT_Pressure * Max_Movement_Speed);
                    Current_Player_Position.Character_Z += Stick_Y * Max_Movement_Speed;

                    // Manipulate Positions
                    Program.Sonic_Heroes_Process.WriteMemory
                    (
                        (IntPtr)SonicHeroesVariables.Characters_Addresses_Offsets.XPosition + Player_Pointer,
                        BitConverter.GetBytes(Current_Player_Position.Character_X)
                    );

                    Program.Sonic_Heroes_Process.WriteMemory
                    (
                        (IntPtr)SonicHeroesVariables.Characters_Addresses_Offsets.YPosition + Player_Pointer,
                        BitConverter.GetBytes(Current_Player_Position.Character_Y)
                    );

                    Program.Sonic_Heroes_Process.WriteMemory
                    (
                        (IntPtr)SonicHeroesVariables.Characters_Addresses_Offsets.ZPosition + Player_Pointer,
                        BitConverter.GetBytes(Current_Player_Position.Character_Z)
                    );

                    // Manipulate Camera Positions
                    Program.Sonic_Heroes_Process.WriteMemory
                    (
                        (IntPtr)SonicHeroesVariables.Game_Camera_CurrentCamera.Camera_X,
                        BitConverter.GetBytes(Current_Player_Position.Character_X)
                    );

                    Program.Sonic_Heroes_Process.WriteMemory
                    (
                        (IntPtr)SonicHeroesVariables.Game_Camera_CurrentCamera.Camera_Y,
                        BitConverter.GetBytes(Current_Player_Position.Character_Y + 20.0F)
                    );

                    Program.Sonic_Heroes_Process.WriteMemory
                    (
                        (IntPtr)SonicHeroesVariables.Game_Camera_CurrentCamera.Camera_Z,
                        BitConverter.GetBytes(Current_Player_Position.Character_Z + 70.0F)
                    );
                }
            }
        }
        /// <summary>
        /// Main Controller Input Handler.
        /// </summary>
        /// <param name="P1_Controller"></param>
        /// <param name="Controller_Manager"></param>
        public virtual void Handle_Controller_Inputs(Sonic_Heroes_Joystick.Controller_Inputs_Generic P1_Controller, SonicHeroes.Controller.DirectInput_Joystick_Manager Controller_Manager)
        {
            // Returns to the previously set menu.
            if (P1_Controller.ControllerButtons.Button_B)
            {
                Program.Return_Last_Menu(); Wait_For_Controller_Release(Controller_Keys.Button_B, Controller_Manager); return;
            }

            // Up/Down Menu Movement with DPAD.
            if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.DOWN)
            {
                Increment_Menu_Index(); Wait_For_Controller_Release(Controller_Keys.DPAD_DOWN, Controller_Manager); Pass_MessageBox_Message(); return;
            }
            if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.UP)
            {
                Decrement_Menu_Index(); Wait_For_Controller_Release(Controller_Keys.DPAD_UP, Controller_Manager); Pass_MessageBox_Message(); return;
            }
        }
Beispiel #9
0
 /// Disable Default InputHandler
 public override void Handle_Controller_Inputs(Sonic_Heroes_Joystick.Controller_Inputs_Generic P1_Controller, SonicHeroes.Controller.DirectInput_Joystick_Manager Controller_Manager)
 {
 }
        /// <summary>
        /// Main Menu Controller Handling Method
        /// </summary>
        public override void Handle_Controller_Inputs(Sonic_Heroes_Joystick.Controller_Inputs_Generic P1_Controller, SonicHeroes.Controller.DirectInput_Joystick_Manager Controller_Manager)
        {
            // Execute Base Controller Code. UP/DOWN navigation + back button.
            base.Handle_Controller_Inputs(P1_Controller, Controller_Manager);

            // Check menu to load if A_Button is pressed.
            if (P1_Controller.ControllerButtons.Button_A)
            {
                // Toggle X/Y/Z Button


                // Set New Menu Bounds
                if (Program.Sonic_Heroes_Overlay.Ready_To_Render)
                {
                    Set_Drawing_Properties();
                }

                // Wait for button release.
                Wait_For_Controller_Release(Controller_Keys.Button_A, Controller_Manager);
            }

            if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.LEFT)
            {
                // Toggle X/Y/Z Variable
                if (Menu_Index == (int)Menu_Items.Menu_Item_Null)
                {
                    Set_Toggle_State();
                }

                // Longpress DPAD
                DPAD_Longpress_Sleep();
            }
            else if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.RIGHT)
            {
                // Toggle X/Y/Z Variable
                if (Menu_Index == (int)Menu_Items.Menu_Item_Null)
                {
                    Set_Toggle_State();
                }

                // Longpress DPAD
                DPAD_Longpress_Sleep();
            }
        }
Beispiel #11
0
        /// <summary>
        /// Main Menu Controller Handling Method
        /// </summary>
        public override void Handle_Controller_Inputs(Sonic_Heroes_Joystick.Controller_Inputs_Generic P1_Controller, SonicHeroes.Controller.DirectInput_Joystick_Manager Controller_Manager)
        {
            // Execute Base Controller Code. UP/DOWN navigation + back button.
            base.Handle_Controller_Inputs(P1_Controller, Controller_Manager);

            // Check menu to load if A_Button is pressed.
            if (P1_Controller.ControllerButtons.Button_A)
            {
                // Toggle X/Y/Z Button
                if (Menu_Index == (int)Menu_Items.Menu_Item_Light_Speed_Attack)
                {
                    Program.Feature_Toggle_Moveset_Restrictions_X.Toggle_Light_Speed_Attack();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Light_Speed_Dash)
                {
                    Program.Feature_Toggle_Moveset_Restrictions_X.Toggle_Light_Speed_Dash();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Invisibility_Fixes)
                {
                    Program.Feature_Invisibility_Fixes_X.Toggle_Invisibility_Fixes();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Tornado_Hammer_Invisibility)
                {
                    Invisibility_Tweaks_Feature.Toggle_Hammer_Enables_Invisiblity();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Tornado_Spin_Invisibility)
                {
                    Invisibility_Tweaks_Feature.Toggle_Spin_Enables_Invisiblity();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Player_Starts_Invisible)
                {
                    Invisibility_Tweaks_Feature.Toggle_Player_Starts_Invisible();
                }

                // Refresh Menu State
                Set_Toggle_State();

                // Set New Menu Bounds
                if (Program.Sonic_Heroes_Overlay.Ready_To_Render)
                {
                    Set_Drawing_Properties();
                }

                // Wait for button release.
                Wait_For_Controller_Release(Controller_Keys.Button_A, Controller_Manager);
            }

            if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.LEFT)
            {
                // Toggle X/Y/Z Variable
                if (Menu_Index == (int)Menu_Items.Menu_Item_Tornado_Hammer_User)
                {
                    Program.Feature_Toggle_Moveset_Restrictions_X.Decrement_Tornado_Hammer_User();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Tornado_Leaf_User)
                {
                    Program.Feature_Toggle_Moveset_Restrictions_X.Decrement_Tornado_Leaf_Swirl_User();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Unlimited_Triangle_Jump_User)
                {
                    Program.Feature_Toggle_Moveset_Restrictions_X.Decrement_Unlimited_Triangle_Jump_User();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Disabled_Triangle_Jump_User)
                {
                    Program.Feature_Toggle_Moveset_Restrictions_X.Decrement_No_Triangle_Jump_User();
                }

                // Refresh Menu State
                Set_Toggle_State();

                // Longpress DPAD
                DPAD_Longpress_Sleep();
            }
            else if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.RIGHT)
            {
                // Toggle X/Y/Z Variable
                if (Menu_Index == (int)Menu_Items.Menu_Item_Tornado_Hammer_User)
                {
                    Program.Feature_Toggle_Moveset_Restrictions_X.Increment_Tornado_Hammer_User();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Tornado_Leaf_User)
                {
                    Program.Feature_Toggle_Moveset_Restrictions_X.Increment_Tornado_Leaf_Swirl_User();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Unlimited_Triangle_Jump_User)
                {
                    Program.Feature_Toggle_Moveset_Restrictions_X.Increment_Unlimited_Triangle_Jump_User();
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Disabled_Triangle_Jump_User)
                {
                    Program.Feature_Toggle_Moveset_Restrictions_X.Increment_No_Triangle_Jump_User();
                }

                // Refresh Menu State
                Set_Toggle_State();

                // Longpress DPAD
                DPAD_Longpress_Sleep();
            }
        }
        /// <summary>
        /// Main Menu Controller Handling Method
        /// </summary>
        public override void Handle_Controller_Inputs(Sonic_Heroes_Joystick.Controller_Inputs_Generic P1_Controller, SonicHeroes.Controller.DirectInput_Joystick_Manager Controller_Manager)
        {
            // Up/Down Menu Movement with DPAD.
            if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.DOWN)
            {
                Increment_Menu_Index(); Wait_For_Controller_Release(Controller_Keys.DPAD_DOWN, Controller_Manager); Pass_MessageBox_Message(); return;
            }
            if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.UP)
            {
                Decrement_Menu_Index(); Wait_For_Controller_Release(Controller_Keys.DPAD_UP, Controller_Manager); Pass_MessageBox_Message(); return;
            }

            // Check any known indexes
            if (P1_Controller.ControllerButtons.Button_A)
            {
                if (Menu_Index == (int)Menu_Items.Menu_Item_Sound_Test)
                {
                    Program.Set_New_Menu(Program.Menu_Sound_Test);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Physics_Swap)
                {
                    Program.Set_New_Menu(Program.Menu_Physics_Swapper);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Gameplay_Items)
                {
                    Program.Set_New_Menu(Program.Menu_Gameplay_Items);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Moveset_Tweaks)
                {
                    Program.Set_New_Menu(Program.Menu_Moveset_Tweaks);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Graphics_Tweaks)
                {
                    Program.Set_New_Menu(Program.Menu_Graphics_Tweaks);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_HUD_Tweaks)
                {
                    Program.Set_New_Menu(Program.Menu_HUD_Adjustments);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Trail_Editor)
                {
                    Program.Set_New_Menu(Program.Menu_Trail_Editor);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Misc)
                {
                    Program.Set_New_Menu(Program.Menu_Miscallenous);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Experiments)
                {
                    Program.Set_New_Menu(Program.Menu_Experiments);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Debug)
                {
                    Program.Set_New_Menu(Program.Menu_Debug_Stuff);
                }

                // Wait for button release.
                Wait_For_Controller_Release(Controller_Keys.Button_A, Controller_Manager);
            }
        }
        /// <summary>
        /// Main Menu Controller Handling Method
        /// </summary>
        public override void Handle_Controller_Inputs(Sonic_Heroes_Joystick.Controller_Inputs_Generic P1_Controller, SonicHeroes.Controller.DirectInput_Joystick_Manager Controller_Manager)
        {
            // Execute Base Controller Code. UP/DOWN navigation + back button.
            base.Handle_Controller_Inputs(P1_Controller, Controller_Manager);

            if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.LEFT)
            {
                // Toggle X/Y/Z Variable
                if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Sonic)
                {
                    Program.Feature_Physics_Swapper_X.Decrement_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Sonic);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Knuckles)
                {
                    Program.Feature_Physics_Swapper_X.Decrement_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Knuckles);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Tails)
                {
                    Program.Feature_Physics_Swapper_X.Decrement_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Tails);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Shadow)
                {
                    Program.Feature_Physics_Swapper_X.Decrement_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Shadow);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Omega)
                {
                    Program.Feature_Physics_Swapper_X.Decrement_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Omega);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Rouge)
                {
                    Program.Feature_Physics_Swapper_X.Decrement_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Rouge);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Amy)
                {
                    Program.Feature_Physics_Swapper_X.Decrement_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Amy);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Big)
                {
                    Program.Feature_Physics_Swapper_X.Decrement_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Big);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Cream)
                {
                    Program.Feature_Physics_Swapper_X.Decrement_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Cream);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Espio)
                {
                    Program.Feature_Physics_Swapper_X.Decrement_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Espio);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Vector)
                {
                    Program.Feature_Physics_Swapper_X.Decrement_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Vector);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Charmy)
                {
                    Program.Feature_Physics_Swapper_X.Decrement_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Charmy);
                }

                // Refresh all Strings
                Set_Toggle_State();

                // Longpress DPAD
                DPAD_Longpress_Sleep();
            }
            else if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.RIGHT)
            {
                // Toggle X/Y/Z Variable
                if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Sonic)
                {
                    Program.Feature_Physics_Swapper_X.Increment_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Sonic);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Knuckles)
                {
                    Program.Feature_Physics_Swapper_X.Increment_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Knuckles);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Tails)
                {
                    Program.Feature_Physics_Swapper_X.Increment_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Tails);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Shadow)
                {
                    Program.Feature_Physics_Swapper_X.Increment_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Shadow);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Omega)
                {
                    Program.Feature_Physics_Swapper_X.Increment_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Omega);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Rouge)
                {
                    Program.Feature_Physics_Swapper_X.Increment_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Rouge);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Amy)
                {
                    Program.Feature_Physics_Swapper_X.Increment_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Amy);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Big)
                {
                    Program.Feature_Physics_Swapper_X.Increment_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Big);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Cream)
                {
                    Program.Feature_Physics_Swapper_X.Increment_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Cream);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Espio)
                {
                    Program.Feature_Physics_Swapper_X.Increment_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Espio);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Vector)
                {
                    Program.Feature_Physics_Swapper_X.Increment_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Vector);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Character_Assignment_Charmy)
                {
                    Program.Feature_Physics_Swapper_X.Increment_Current_Physics_Character(Feature_Physics_Swap.Characters_Heroes.Charmy);
                }

                // Refresh all Strings
                Set_Toggle_State();

                // Longpress DPAD
                DPAD_Longpress_Sleep();
            }
        }
        /// Main Menu Controller Handling Method
        /// </summary>
        public override void Handle_Controller_Inputs(Sonic_Heroes_Joystick.Controller_Inputs_Generic P1_Controller, SonicHeroes.Controller.DirectInput_Joystick_Manager Controller_Manager)
        {
            // Execute Base Controller Code. UP/DOWN navigation + back button.
            base.Handle_Controller_Inputs(P1_Controller, Controller_Manager);

            // Check menu to load if A_Button is pressed.
            if (P1_Controller.ControllerButtons.Button_A)
            {
                // Toggle Super Sonic/Tails/Nipples Enchilada.
                if (Menu_Index == (int)Misc_Menu_Items.Menu_Item_Super_Sonic_Flag)
                {
                    Program.Feature_Toggle_Super_Metal_Characters_X.Toggle_Super_Sonic();
                }
                else if (Menu_Index == (int)Misc_Menu_Items.Menu_Item_Super_Tails_Flag)
                {
                    Program.Feature_Toggle_Super_Metal_Characters_X.Toggle_Super_Tails();
                }
                else if (Menu_Index == (int)Misc_Menu_Items.Menu_Item_Super_Knuckles_Flag)
                {
                    Program.Feature_Toggle_Super_Metal_Characters_X.Toggle_Super_Knuckles();
                }
                else if (Menu_Index == (int)Misc_Menu_Items.Menu_Item_Metal_Characters_Flag)
                {
                    Program.Feature_Toggle_Super_Metal_Characters_X.Toggle_Metal_Characters();
                }

                // Redraw Menu
                Set_Toggle_State();

                // Set New Menu Bounds
                if (Program.Sonic_Heroes_Overlay.Ready_To_Render)
                {
                    Set_Drawing_Properties();
                }

                // Wait for button release.
                Wait_For_Controller_Release(Controller_Keys.Button_A, Controller_Manager);
            }
        }
        // Controller Handler
        public override void Handle_Controller_Inputs(Sonic_Heroes_Joystick.Controller_Inputs_Generic P1_Controller, SonicHeroes.Controller.DirectInput_Joystick_Manager Controller_Manager)
        {
            // Execute Base Controller Code. UP/DOWN navigation + back button.
            base.Handle_Controller_Inputs(P1_Controller, Controller_Manager);

            // Check face buttons.
            if (P1_Controller.ControllerButtons.Button_A)
            {
                // String based Menu Item Recognition.
                if (Mod_Menu_Page_Strings[Menu_Index].StartsWith(String_Save_Character_Configuration))
                {
                    Program.Feature_Trail_Editor_X.Save_All_Character_Settings();
                }
                else if (Mod_Menu_Page_Strings[Menu_Index].StartsWith(String_Load_Character_Configuration))
                {
                    Program.Feature_Trail_Editor_X.Load_All_Character_Settings(false); Trail_Editor_Populate_Current_Menu();
                }
                else if (Mod_Menu_Page_Strings[Menu_Index].StartsWith(String_Load_Default_Stock_Configuration))
                {
                    Program.Feature_Trail_Editor_X.Load_All_Character_Settings(true); Trail_Editor_Populate_Current_Menu();
                }

                while (P1_Controller.ControllerButtons.Button_A)
                {
                    P1_Controller = Controller_Manager.PlayerControllers[controllerIndex].Get_Whole_Controller_State(); Thread.Sleep(8);
                }
                return;
            }

            // Check DPAD.
            if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.LEFT)
            {
                // Decrement Currently Selected Character (if on the correct field)
                Increment_Decrement_Current_Character(false);

                // Update Currently Shown Entries
                if (Menu_Index != (int)Menu_Item_List.Menu_Item_Character)
                {
                    Update_Trail_Editor_Entries(false);
                }

                // Sleep the thread for repeated inputs.
                Wait_For_Controller_Release(Controller_Keys.DPAD_LEFT, Controller_Manager);
            }
            if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.RIGHT)
            {
                // Increment Currently Selected Character (if on the correct field)
                Increment_Decrement_Current_Character(true);

                // Update Currently Shown Entries
                if (Menu_Index != (int)Menu_Item_List.Menu_Item_Character)
                {
                    Update_Trail_Editor_Entries(true);
                }

                // Sleep the thread for repeated inputs.
                Wait_For_Controller_Release(Controller_Keys.DPAD_RIGHT, Controller_Manager);
            }
        }
        /// <summary>
        /// Main Menu Controller Handling Method
        /// </summary>
        public override void Handle_Controller_Inputs(Sonic_Heroes_Joystick.Controller_Inputs_Generic P1_Controller, SonicHeroes.Controller.DirectInput_Joystick_Manager Controller_Manager)
        {
            // Execute Base Controller Code. UP/DOWN navigation + back button.
            base.Handle_Controller_Inputs(P1_Controller, Controller_Manager);

            // Check menu to load if A_Button is pressed.
            if (P1_Controller.ControllerButtons.Button_A)
            {
                // Toggle Super Sonic/Tails/Nipples Enchilada.
                if (Menu_Index == (int)Menu_Items.Menu_Item_Minimal_HUD_Toggle)
                {
                    Program.Feature_Minimal_HUD_X.Toggle_Minimal_HUD();
                }
                if (Menu_Index == (int)Menu_Items.Menu_Item_Disable_HUD)
                {
                    Program.Feature_Minimal_HUD_X.Toggle_HUD();
                }

                // Refresh Menu State
                Set_Toggle_State();

                // Set New Menu Bounds
                if (Program.Sonic_Heroes_Overlay.Ready_To_Render)
                {
                    Set_Drawing_Properties();
                }

                // Wait for button release.
                Wait_For_Controller_Release(Controller_Keys.Button_A, Controller_Manager);
            }

            if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.LEFT)
            {
                // Toggle Super Sonic/Tails/Nipples Enchilada.
                if (Menu_Index == (int)Menu_Items.Menu_Item_Corner_X_Offset)
                {
                    Program.Feature_Minimal_HUD_X.Change_X_Position(-0.01F);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Corner_Y_Offset)
                {
                    Program.Feature_Minimal_HUD_X.Change_Y_Position(-0.01F);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Corner_Item_Offset)
                {
                    Program.Feature_Minimal_HUD_X.Change_Vertical_Offset(-0.01F);
                }

                // Refresh Menu State
                Set_Toggle_State();

                // Longpress DPAD
                DPAD_Longpress_Sleep();
            }
            else if (P1_Controller.ControllerDPad == (int)Sonic_Heroes_Joystick.DPAD_Direction.RIGHT)
            {
                // Toggle Super Sonic/Tails/Nipples Enchilada.
                if (Menu_Index == (int)Menu_Items.Menu_Item_Corner_X_Offset)
                {
                    Program.Feature_Minimal_HUD_X.Change_X_Position(+0.01F);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Corner_Y_Offset)
                {
                    Program.Feature_Minimal_HUD_X.Change_Y_Position(+0.01F);
                }
                else if (Menu_Index == (int)Menu_Items.Menu_Item_Corner_Item_Offset)
                {
                    Program.Feature_Minimal_HUD_X.Change_Vertical_Offset(+0.01F);
                }

                // Refresh Menu State
                Set_Toggle_State();

                // Longpress DPAD
                DPAD_Longpress_Sleep();
            }
        }
        /// <summary>
        /// Waits for the user to release a key which they may currently be holding.
        /// </summary>
        /// <param name="Controller_Key_Release"></param>
        /// <param name="Controller_Manager"></param>
        public virtual void Wait_For_Controller_Release(Controller_Keys Controller_Key_Release, SonicHeroes.Controller.DirectInput_Joystick_Manager Controller_Manager)
        {
            switch (Controller_Key_Release)
            {
            case Controller_Keys.Button_A:
                while (Controller_Manager.PlayerControllers[controllerIndex].Get_Whole_Controller_State().ControllerButtons.Button_A)
                {
                    Thread.Sleep(16);
                }
                break;

            case Controller_Keys.Button_B:
                while (Controller_Manager.PlayerControllers[controllerIndex].Get_Whole_Controller_State().ControllerButtons.Button_B)
                {
                    Thread.Sleep(16);
                }
                break;

            case Controller_Keys.Button_X:
                while (Controller_Manager.PlayerControllers[controllerIndex].Get_Whole_Controller_State().ControllerButtons.Button_X)
                {
                    Thread.Sleep(16);
                }
                break;

            case Controller_Keys.Button_Y:
                while (Controller_Manager.PlayerControllers[controllerIndex].Get_Whole_Controller_State().ControllerButtons.Button_Y)
                {
                    Thread.Sleep(16);
                }
                break;

            case Controller_Keys.Button_Back:
                while (Controller_Manager.PlayerControllers[controllerIndex].Get_Whole_Controller_State().ControllerButtons.Button_Back)
                {
                    Thread.Sleep(16);
                }
                break;

            case Controller_Keys.Button_Start:
                while (Controller_Manager.PlayerControllers[controllerIndex].Get_Whole_Controller_State().ControllerButtons.Button_Start)
                {
                    Thread.Sleep(16);
                }
                break;

            case Controller_Keys.Optional_Button_Guide:
                while (Controller_Manager.PlayerControllers[controllerIndex].Get_Whole_Controller_State().ControllerButtons.Optional_Button_Guide)
                {
                    Thread.Sleep(16);
                }
                break;

            case Controller_Keys.Button_L1:
                while (Controller_Manager.PlayerControllers[controllerIndex].Get_Whole_Controller_State().ControllerButtons.Button_L1)
                {
                    Thread.Sleep(16);
                }
                break;

            case Controller_Keys.Button_L3:
                while (Controller_Manager.PlayerControllers[controllerIndex].Get_Whole_Controller_State().ControllerButtons.Button_L3)
                {
                    Thread.Sleep(16);
                }
                break;

            case Controller_Keys.Button_R1:
                while (Controller_Manager.PlayerControllers[controllerIndex].Get_Whole_Controller_State().ControllerButtons.Button_R1)
                {
                    Thread.Sleep(16);
                }
                break;

            case Controller_Keys.Button_R3:
                while (Controller_Manager.PlayerControllers[controllerIndex].Get_Whole_Controller_State().ControllerButtons.Button_R3)
                {
                    Thread.Sleep(16);
                }
                break;

            case Controller_Keys.DPAD_LEFT:
                while (Controller_Manager.PlayerControllers[controllerIndex].Get_Whole_Controller_State().ControllerDPad == (int)SonicHeroes.Controller.Sonic_Heroes_Joystick.DPAD_Direction.LEFT)
                {
                    Thread.Sleep(16);
                }
                break;

            case Controller_Keys.DPAD_RIGHT:
                while (Controller_Manager.PlayerControllers[controllerIndex].Get_Whole_Controller_State().ControllerDPad == (int)SonicHeroes.Controller.Sonic_Heroes_Joystick.DPAD_Direction.RIGHT)
                {
                    Thread.Sleep(16);
                }
                break;

            case Controller_Keys.DPAD_UP:
                while (Controller_Manager.PlayerControllers[controllerIndex].Get_Whole_Controller_State().ControllerDPad == (int)SonicHeroes.Controller.Sonic_Heroes_Joystick.DPAD_Direction.UP)
                {
                    Thread.Sleep(16);
                }
                break;

            case Controller_Keys.DPAD_DOWN:
                while (Controller_Manager.PlayerControllers[controllerIndex].Get_Whole_Controller_State().ControllerDPad == (int)SonicHeroes.Controller.Sonic_Heroes_Joystick.DPAD_Direction.DOWN)
                {
                    Thread.Sleep(16);
                }
                break;
            }
        }