public Feature_Force_Load_Level() { // Retrieves all of the available possible levels that could be loaded, as well as their individual Stage IDs. Get_All_Levels(); /// <summary> /// x86 Mnemonics which dynamically load the appropriate blending address based on the currently controlling character. /// </summary> string[] Menu_Enter_Hook_ASM_Mnemonics = new string[] { "use32", "mov eax,[edi+0x58]", "push dword 0x40578D", "ret" }; // Get Assembly Code for the Mnemonics byte[] Menu_Enter_Hook_ASM_Bytes = Program.Sonic_Heroes_Networking_Client.SendData_Alternate(Message_Type.Client_Call_Assemble_x86_Mnemonics, Serialize_x86_ASM_Mnemonics(Menu_Enter_Hook_ASM_Mnemonics), true); // Set Hook - Hooked at random address triggered post loading of main menu. Menu_Enter_Hook_ASM = new SonicHeroes.Hooking.ASM_Hook((IntPtr)0x405785, Menu_Enter_Hook_ASM_Bytes, 8, Program.Sonic_Heroes_Networking_Client, true); // Activate Hook Such that Menu_Enter_Hook Picks up the New Bytes. Menu_Enter_Hook_ASM.Activate(); // Set Hook - Hooked at random address triggered post loading of main menu. Menu_Enter_Hook = new SonicHeroes.Hooking.Injection((IntPtr)0x405785, (Force_Level_Load_Hook)Force_Load_Level_Method, 8, Program.Sonic_Heroes_Networking_Client, false); // Deactivate Hook. Menu_Enter_Hook_ASM.Deactivate(); // At startup set initial teams to be Team Sonic for P1 and disable others Program.Sonic_Heroes_Process.WriteMemory((IntPtr)0x8D6920, new byte[] { 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }); }
/// <summary> /// Forcefully loads a level once player is in main menu. /// </summary> private void Force_Load_Level_Method() { // Commit to the writing of the stage IDs to memory. Program.Sonic_Heroes_Process.WriteMemory((IntPtr)0x8D66F0, BitConverter.GetBytes((int)2)); // Set Game State to 2 (In Level) // Set the game load status to -1 to force a stage load. Program.Sonic_Heroes_Process.WriteMemory((IntPtr)0xA81FFC, BitConverter.GetBytes((int)-1)); // Disable hook Menu_Enter_Hook.Deactivate(); Menu_Enter_Hook_ASM.Deactivate(); }