public static void Initialize() { if (Kernel32.GetModuleHandle("game.dll") == IntPtr.Zero) { throw new Exception("Attempted to initialize " + typeof(InternalInput).Name + " before 'game.dll' has been loaded."); } if (!GameAddresses.IsReady) { throw new Exception("Attempted to initialize " + typeof(InternalInput).Name + " before " + typeof(GameAddresses).Name + " was ready."); } var address = IntPtr.Zero; address = GameAddresses.WndProc; Trace.Write("WndProc: 0x" + address.ToString("X8") + " . "); InternalInput.WndProc = Memory.InstallHook(address, new WndProcPrototype(InternalInput.WndProcHook), true, false); Trace.WriteLine("hook installed!"); address = GameAddresses.Unknown__UpdateMouse; Trace.Write("Unknown__UpdateMouse: 0x" + address.ToString("X8") + " . "); InternalInput.Unknown__UpdateMouse = Memory.InstallHook(address, new Unknown__UpdateMousePrototype(InternalInput.Unknown__UpdateMouseHook), true, false); Trace.WriteLine("hook installed!"); address = GameAddresses.CGameUI__DisplayChatMessage; Trace.Write("CGameUI__DisplayChatMessage: 0x" + address.ToString("X8") + " . "); InternalInput.CGameUI__DisplayChatMessage = Memory.InstallHook(address, new CGameUI__DisplayChatMessagePrototype(InternalInput.CGameUI__DisplayChatMessageHook), true, false); Trace.WriteLine("hook installed!"); }
public unsafe static void Initialize() { if (Kernel32.GetModuleHandle("game.dll") == IntPtr.Zero) { throw new Exception("Attempted to initialize " + typeof(Input).Name + " before 'game.dll' has been loaded."); } if (!GameAddresses.IsReady) { throw new Exception($"Attempted to initialize {typeof(Input).Name} before {typeof(GameAddresses).Name} was ready."); } WndProc = Memory.InstallHook(GameAddresses.WndProc, new WndProcPrototype(WndProcHook), true, false); Unknown__UpdateMouse = Memory.InstallHook(GameAddresses.Unknown__UpdateMouse, new Unknown__UpdateMousePrototype(Unknown__UpdateMouseHook), true, false); CGameUI__DisplayChatMessage = Memory.InstallHook(GameAddresses.CGameUI__DisplayChatMessage, new CGameUI__DisplayChatMessagePrototype(CGameUI__DisplayChatMessageHook), true, false); }