/// <summary> /// Initializes a new instance of the <see cref="GameGui"/> class. /// This class is responsible for many aspects of interacting with the native game UI. /// </summary> /// <param name="baseAddress">The base address of the native GuiManager class.</param> /// <param name="scanner">The SigScanner instance.</param> /// <param name="dalamud">The Dalamud instance.</param> internal GameGui(IntPtr baseAddress, SigScanner scanner, Dalamud dalamud) { this.dalamud = dalamud; this.address = new GameGuiAddressResolver(baseAddress); this.address.Setup(scanner); Log.Verbose("===== G A M E G U I ====="); Log.Verbose($"GameGuiManager address 0x{this.address.BaseAddress.ToInt64():X}"); Log.Verbose($"SetGlobalBgm address 0x{this.address.SetGlobalBgm.ToInt64():X}"); Log.Verbose($"HandleItemHover address 0x{this.address.HandleItemHover.ToInt64():X}"); Log.Verbose($"HandleItemOut address 0x{this.address.HandleItemOut.ToInt64():X}"); Log.Verbose($"HandleImm address 0x{this.address.HandleImm.ToInt64():X}"); Log.Verbose($"GetUIObject address 0x{this.address.GetUIObject.ToInt64():X}"); Log.Verbose($"GetAgentModule address 0x{this.address.GetAgentModule.ToInt64():X}"); this.Chat = new ChatGui(this.address.ChatManager, scanner, dalamud); this.PartyFinder = new PartyFinderGui(scanner, dalamud); this.Toast = new ToastGui(scanner, dalamud); this.FlyText = new FlyTextGui(scanner, dalamud); this.setGlobalBgmHook = new Hook <SetGlobalBgmDelegate>(this.address.SetGlobalBgm, this.HandleSetGlobalBgmDetour); this.handleItemHoverHook = new Hook <HandleItemHoverDelegate>(this.address.HandleItemHover, this.HandleItemHoverDetour); this.handleItemOutHook = new Hook <HandleItemOutDelegate>(this.address.HandleItemOut, this.HandleItemOutDetour); this.handleActionHoverHook = new Hook <HandleActionHoverDelegate>(this.address.HandleActionHover, this.HandleActionHoverDetour); this.handleActionOutHook = new Hook <HandleActionOutDelegate>(this.address.HandleActionOut, this.HandleActionOutDetour); this.handleImmHook = new Hook <HandleImmDelegate>(this.address.HandleImm, this.HandleImmDetour); this.getUIObject = Marshal.GetDelegateForFunctionPointer <GetUIObjectDelegate>(this.address.GetUIObject); this.getMatrixSingleton = Marshal.GetDelegateForFunctionPointer <GetMatrixSingletonDelegate>(this.address.GetMatrixSingleton); this.screenToWorldNative = Marshal.GetDelegateForFunctionPointer <ScreenToWorldNativeDelegate>(this.address.ScreenToWorld); this.toggleUiHideHook = new Hook <ToggleUiHideDelegate>(this.address.ToggleUiHide, this.ToggleUiHideDetour); this.GetBaseUIObject = Marshal.GetDelegateForFunctionPointer <GetBaseUIObjectDelegate>(this.address.GetBaseUIObject); this.getUIObjectByName = Marshal.GetDelegateForFunctionPointer <GetUIObjectByNameDelegate>(this.address.GetUIObjectByName); this.getUiModule = Marshal.GetDelegateForFunctionPointer <GetUiModuleDelegate>(this.address.GetUIModule); this.getAgentModule = Marshal.GetDelegateForFunctionPointer <GetAgentModuleDelegate>(this.address.GetAgentModule); }
/// <summary> /// Initializes a new instance of the <see cref="GameGui"/> class. /// This class is responsible for many aspects of interacting with the native game UI. /// </summary> internal GameGui() { this.address = new GameGuiAddressResolver(); this.address.Setup(); Log.Verbose("===== G A M E G U I ====="); Log.Verbose($"GameGuiManager address 0x{this.address.BaseAddress.ToInt64():X}"); Log.Verbose($"SetGlobalBgm address 0x{this.address.SetGlobalBgm.ToInt64():X}"); Log.Verbose($"HandleItemHover address 0x{this.address.HandleItemHover.ToInt64():X}"); Log.Verbose($"HandleItemOut address 0x{this.address.HandleItemOut.ToInt64():X}"); Log.Verbose($"HandleImm address 0x{this.address.HandleImm.ToInt64():X}"); Log.Verbose($"GetAgentModule address 0x{this.address.GetAgentModule.ToInt64():X}"); Service <ChatGui> .Set(new ChatGui(this.address.ChatManager)); Service <PartyFinderGui> .Set(); Service <ToastGui> .Set(); Service <FlyTextGui> .Set(); Service <ContextMenu> .Set(); Service <DtrBar> .Set(); this.setGlobalBgmHook = new Hook <SetGlobalBgmDelegate>(this.address.SetGlobalBgm, this.HandleSetGlobalBgmDetour); this.handleItemHoverHook = new Hook <HandleItemHoverDelegate>(this.address.HandleItemHover, this.HandleItemHoverDetour); this.handleItemOutHook = new Hook <HandleItemOutDelegate>(this.address.HandleItemOut, this.HandleItemOutDetour); this.handleActionHoverHook = new Hook <HandleActionHoverDelegate>(this.address.HandleActionHover, this.HandleActionHoverDetour); this.handleActionOutHook = new Hook <HandleActionOutDelegate>(this.address.HandleActionOut, this.HandleActionOutDetour); this.handleImmHook = new Hook <HandleImmDelegate>(this.address.HandleImm, this.HandleImmDetour); this.getMatrixSingleton = Marshal.GetDelegateForFunctionPointer <GetMatrixSingletonDelegate>(this.address.GetMatrixSingleton); this.screenToWorldNative = Marshal.GetDelegateForFunctionPointer <ScreenToWorldNativeDelegate>(this.address.ScreenToWorld); this.toggleUiHideHook = new Hook <ToggleUiHideDelegate>(this.address.ToggleUiHide, this.ToggleUiHideDetour); this.getAgentModule = Marshal.GetDelegateForFunctionPointer <GetAgentModuleDelegate>(this.address.GetAgentModule); this.utf8StringFromSequenceHook = new Hook <Utf8StringFromSequenceDelegate>(this.address.Utf8StringFromSequence, this.Utf8StringFromSequenceDetour); }