/// <summary> /// Initializes Orion by attaching to the specified CSGO process. /// </summary> /// <param name="process">The process.</param> /// <param name="isInjected">if set to <c>true</c> [is injected].</param> public static void Attach(Process process, bool isInjected = false) { if (_isAttached) { return; } // We won't require the injector for now - we're completely passive. if (isInjected) { Memory = new LocalProcessMemory(process); } else { Memory = new ExternalProcessMemory(process); } ClientBase = Memory.GetModule("client.dll").BaseAddress; EngineBase = Memory.GetModule("engine.dll").BaseAddress; ClientSize = Memory.GetModule("client.dll").ModuleMemorySize; EngineSize = Memory.GetModule("engine.dll").ModuleMemorySize; BaseOffsets.Init(); _log.Debug($"Client Base Address: 0x{ClientBase}"); _log.Debug($"Engine Base Address: 0x{EngineBase}"); //Patchables.BaseOffsets.Initialize(); _log.Info("Initializing ObjectManager.."); Objects = new ObjectManager(ClientBase + (int)BaseOffsets.EntityList, 128); GlowObjects = new GlowManager(ClientBase + (int)BaseOffsets.GlowObjBase); var clientState = Memory.Read <IntPtr>(EngineBase + (int)BaseOffsets.ClientState); _log.Debug($"Engine Pointer: 0x{clientState}"); if (clientState == IntPtr.Zero) { throw new Exception("Couldn't find Engine Ptr - are you sure your offsets are up to date?"); } _log.Info("Initializing GameClient.."); Client = new GameClient(clientState); _log.Debug($"Orion attached successfully to process with ID {process.Id}."); _isAttached = true; }
/// <summary> /// Reads a member of the specified type at the specified offset. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="offset">The offset.</param> /// <returns></returns> protected T ReadField <T>(BaseOffsets offset) where T : struct { return(ReadField <T>((int)offset)); }