示例#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); }
        }
        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.
                ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                // Thread used to update the overlay.
                while (true)
                {
                    Magnetic_Ring_Loop();
                    Thread.Sleep(16); // Roughly 60FPS
                }
            }
            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); }
        }
        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.
                ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                // Thread used to update the overlay.
                Heroes_D2D_Update_Thread =
                    new Thread
                    (
                        () =>
                {
                    while (true)
                    {
                        Direct2D_Hook_Sample();
                        Thread.Sleep(16);     // Roughly 60FPS
                    }
                }
                    );

                // Start Direct2D Update Thread
                Heroes_D2D_Update_Thread.Start();

                // Set up DirectX Rendering.
                Sonic_Heroes_Overlay.Initialize_DirectX();                           // Sets up a rendering device for DirectX
                Sonic_Heroes_Overlay.Direct2D_Render_Method = Draw_Sonic_Statistics; // Set the delegate to the DirectX drawing call.

                // Set capacity of array to store our information to be rendered out to the screen.
                Drawing_Properties.Sonic_Statistics = new String[6];

                Application.Run(Sonic_Heroes_Overlay.OverlayForm); // Hold the overlay in a thread.
            }
            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); }
        }
        static void Main()
        {
            try
            {
                // Set Culture
                System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
                CultureInfo.DefaultThreadCurrentCulture   = new CultureInfo("en-US");
                CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("en-US");

                ////////////// 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.
                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.
                ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                // Enable Aero Glass if Disabled
                // Check to see if composition is Enabled
                if (!Invoke_External_Class.DwmIsCompositionEnabled())
                {
                    Invoke_External_Class.DwmEnableComposition(true);
                }

                // Sets up DirectX & Direct2D
                Sonic_Heroes_Overlay = new SonicHeroes.Overlay.Overlay_External_Direct2D();
                Sonic_Heroes_Overlay.Initialize_DirectX();
                Sonic_Heroes_Overlay.direct2DRenderMethod = Draw_DirectX;
                Windows_Form_Thread = new Thread(() => { while (true)
                                                         {
                                                             Application.Run(Sonic_Heroes_Overlay.overlayWinForm);
                                                         }
                                                 });
                Windows_Form_Thread.Start();

                // Get Original OnFrame Controller Poll Instruction (Used for Controller Disabling)
                Original_Controller_Call_OnFrame = Sonic_Heroes_Process.ReadMemory((IntPtr)SonicHeroes_Functions.Controller_Polling_Functions.Master_Function_Control_OnFrame_Call, 5);

                // Initialize Controller
                Controller_Manager = new DirectInput_Joystick_Manager();

                // Initialize Thread to Update Controller Inputs.
                Heroes_Controller_Update_Thread = new Thread(() => {
                    while (true)
                    {
                        Controller_Poll_Method(); Thread.Sleep(16);
                    }
                }
                                                             );

                // Initialize Thread to Update GUI
                Heroes_GUI_Update_Thread = new Thread(() => {
                    while (true)
                    {
                        DirectX_Render_Method(); Thread.Sleep(16);
                    }
                });

                // Run the Two Individual Threads
                Heroes_GUI_Update_Thread.Start();
                Heroes_Controller_Update_Thread.Start();

                // Initialize Features
                Feature_PAC_Clip_Player_X               = new Feature_PAC_Utilities();
                Feature_Force_Load_Level_X              = new Feature_Force_Load_Level();
                Feature_ADX_Player_X                    = new Feature_ADX_Utilities();
                Feature_AFS_Utilities_X                 = new Feature_AFS_Utilities();
                Feature_Toggle_Character_Chatter_X      = new Feature_Toggle_Character_Chatter();
                Feature_Toggle_Music_OnPause_X          = new Feature_Toggle_Music_OnPause();
                Feature_Physics_Swapper_X               = new Feature_Physics_Swap();
                Feature_Magnetic_Barrier_X              = new Feature_Magnetic_Barrier();
                Feature_Party_Mode_X                    = new Feature_Party_Mode();
                Feature_Toggle_Moveset_Restrictions_X   = new Feature_Toggle_Moveset_Restrictions();
                Feature_Invisibility_Fixes_X            = new Feature_Invisbility_Fixes();
                Feature_Cycle_RGB_Colours_X             = new Feature_Cycle_RGB_Colours();
                Feature_Minimal_HUD_X                   = new Feature_Minimal_HUD();
                Feature_Trail_Editor_X                  = new Feature_Trail_Editor();
                Feature_Toggle_Super_Metal_Characters_X = new Feature_Toggle_Super_Metal_Characters();
                Feature_Position_XYZ_Window_X           = new Feature_Position_XYZ_Window();
                Feature_Enhanced_Debug_Movement_Mode_X  = new Feature_Enhanced_Debug_Movement_Mode();
                Feature_Set_Editor_X                    = new Feature_SET_Editor();
                Feature_Enhanced_FOV_Fix_X              = new Feature_Enhanced_FOV_Fix();
                Feature_Enhanced_FOV_Fix_X.Button_Set_FOV_Aspect_Ratio_Fix();

                // Initialize Menus
                Menu_Main            = new Menu_Main_Menu();
                Menu_Sound_Test      = new Menu_Sound_Test();
                Menu_Graphics_Tweaks = new Menu_Graphics_Tweaks();
                Menu_Trail_Editor    = new Menu_Trail_Editor();
                Menu_Miscallenous    = new Menu_Misc_Menu();
                Menu_Moveset_Tweaks  = new Menu_Moveset_Tweaks();
                Menu_Experiments     = new Menu_Experiments();
                Menu_Gameplay_Items  = new Menu_Gameplay_Items();
                Menu_Physics_Swapper = new Menu_Physics_Swapper();
                Menu_Debug_Stuff     = new Menu_Debug_Stuff();
                Menu_HUD_Adjustments = new Menu_HUD_Adjustments();

                // Set the current startup menu.
                Current_Menu = Menu_Main;

                // Load Station Square
                Feature_Toggle_Character_Chatter_X.Toggle_CharacterChatter();
                Feature_Toggle_Character_Chatter_X.Toggle_CharacterCommentChatter();
            }
            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 + " | " + Ex.StackTrace), false); }
        }