/// <summary> /// This struct sets the XYZ position of the character. /// </summary> static void Get_Sonic_Statistics() { // Get XYZ int Character_Pointer = HeroesProcess.ReadMemory <int>(Sonic_Heroes_Process, (IntPtr)SonicHeroesVariables.Characters_Addresses.CurrentPlayerControlledCharacter_Pointer, 4); int Character_Memory_Position_X = Character_Pointer + (int)SonicHeroesVariables.Characters_Addresses_Offsets.XPosition; int Character_Memory_Position_Y = Character_Pointer + (int)SonicHeroesVariables.Characters_Addresses_Offsets.YPosition; int Character_Memory_Position_Z = Character_Pointer + (int)SonicHeroesVariables.Characters_Addresses_Offsets.ZPosition; int Character_Memory_Velocity_X = Character_Pointer + (int)SonicHeroesVariables.Characters_Addresses_Offsets.XVelocity; int Character_Memory_Velocity_Y = Character_Pointer + (int)SonicHeroesVariables.Characters_Addresses_Offsets.YVelocity; int Character_Memory_Velocity_Z = Character_Pointer + (int)SonicHeroesVariables.Characters_Addresses_Offsets.ZVelocity; // Gets the character Y position as a byte[] array and converts the byte[] array to a float. float Character_X_Position = HeroesProcess.ReadMemory <float>(Sonic_Heroes_Process, (IntPtr)Character_Memory_Position_X, 4); float Character_Y_Position = HeroesProcess.ReadMemory <float>(Sonic_Heroes_Process, (IntPtr)Character_Memory_Position_Y, 4); float Character_Z_Position = HeroesProcess.ReadMemory <float>(Sonic_Heroes_Process, (IntPtr)Character_Memory_Position_Z, 4); float Character_X_Velocity = HeroesProcess.ReadMemory <float>(Sonic_Heroes_Process, (IntPtr)Character_Memory_Velocity_X, 4); float Character_Y_Velocity = HeroesProcess.ReadMemory <float>(Sonic_Heroes_Process, (IntPtr)Character_Memory_Velocity_Y, 4); float Character_Z_Velocity = HeroesProcess.ReadMemory <float>(Sonic_Heroes_Process, (IntPtr)Character_Memory_Velocity_Z, 4); // Set the XYZ Position Drawing_Properties.Sonic_Statistics[(int)Sonic_Statistics.X_Position] = "X-Position: " + Character_X_Position.ToString("+00000.00000;-00000.00000;"); Drawing_Properties.Sonic_Statistics[(int)Sonic_Statistics.Y_Position] = "Y-Position: " + Character_Y_Position.ToString("+00000.00000;-00000.00000;"); Drawing_Properties.Sonic_Statistics[(int)Sonic_Statistics.Z_Position] = "Z-Position: " + Character_Z_Position.ToString("+00000.00000;-00000.00000;"); Drawing_Properties.Sonic_Statistics[(int)Sonic_Statistics.X_Velocity] = "X-Velocity: " + Character_X_Velocity.ToString("+00000.00000;-00000.00000;"); Drawing_Properties.Sonic_Statistics[(int)Sonic_Statistics.Y_Velocity] = "Y-Velocity: " + Character_Y_Velocity.ToString("+00000.00000;-00000.00000;"); Drawing_Properties.Sonic_Statistics[(int)Sonic_Statistics.Z_Velocity] = "Z-Velocity: " + Character_Z_Velocity.ToString("+00000.00000;-00000.00000;"); }
/// <summary> /// Sample D2D hook code which is injected and ran on each frame. /// </summary> static void Direct2D_Hook_Sample() { byte Is_Currently_In_Level = HeroesProcess.ReadMemory <byte>(Sonic_Heroes_Process, (IntPtr)SonicHeroesVariables.Game_CurrentState.CurrentlyInLevel, 1); byte Is_Pause_Menu_Open = HeroesProcess.ReadMemory <byte>(Sonic_Heroes_Process, (IntPtr)SonicHeroesVariables.Game_CurrentState.IsIngamePauseMenuOpen, 1); // If the pause menu is not open and the player is in a stage. if ((Is_Currently_In_Level == 1) && (Is_Pause_Menu_Open == 0)) { Sonic_Heroes_Overlay.DirectX_Render(); Screen_Clear = false; // Draw Sonic Statistics } else if (Screen_Clear == false) { Sonic_Heroes_Overlay.DirectX_Clear_Screen(); Screen_Clear = true; // Clear Screen } return; }
/// <summary> /// Sample D2D hook code which is injected and ran on each frame. /// </summary> static void Magnetic_Ring_Loop() { byte Is_Currently_In_Level = HeroesProcess.ReadMemory <byte>(Sonic_Heroes_Process, (IntPtr)SonicHeroesVariables.Game_CurrentState.CurrentlyInLevel, 1); byte Is_Pause_Menu_Open = HeroesProcess.ReadMemory <byte>(Sonic_Heroes_Process, (IntPtr)SonicHeroesVariables.Game_CurrentState.IsIngamePauseMenuOpen, 1); // If the pause menu is not open and the player is in a stage. if ((Is_Currently_In_Level == 1) && (Is_Pause_Menu_Open == 0)) { Identify_Ring_Addresses(); // Get all addresses of loaded rings. if (Currently_Active_Rings >= 0) { Retrieve_Player_Coordinates(); // Retrieves the current player coordinates. Move_All_Rings(); // Moves all currently loaded/found rings. } } return; }