mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
chore: add back minhook env var
This commit is contained in:
parent
2549877546
commit
04464de9e6
2 changed files with 31 additions and 5 deletions
|
|
@ -3,6 +3,7 @@ using System.Diagnostics;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
using Dalamud.Configuration.Internal;
|
||||||
using Dalamud.Hooking.Internal;
|
using Dalamud.Hooking.Internal;
|
||||||
|
|
||||||
namespace Dalamud.Hooking
|
namespace Dalamud.Hooking
|
||||||
|
|
@ -59,6 +60,9 @@ namespace Dalamud.Hooking
|
||||||
[Obsolete("Use Hook<T>.FromAddress instead.")]
|
[Obsolete("Use Hook<T>.FromAddress instead.")]
|
||||||
private Hook(IntPtr address, T detour, bool useMinHook, Assembly callingAssembly)
|
private Hook(IntPtr address, T detour, bool useMinHook, Assembly callingAssembly)
|
||||||
{
|
{
|
||||||
|
if (EnvironmentConfiguration.DalamudForceMinHook)
|
||||||
|
useMinHook = true;
|
||||||
|
|
||||||
address = HookManager.FollowJmp(address);
|
address = HookManager.FollowJmp(address);
|
||||||
if (useMinHook)
|
if (useMinHook)
|
||||||
this.compatHookImpl = new MinHookHook<T>(address, detour, callingAssembly);
|
this.compatHookImpl = new MinHookHook<T>(address, detour, callingAssembly);
|
||||||
|
|
@ -214,6 +218,9 @@ namespace Dalamud.Hooking
|
||||||
/// <returns>The hook with the supplied parameters.</returns>
|
/// <returns>The hook with the supplied parameters.</returns>
|
||||||
public static Hook<T> FromSymbol(string moduleName, string exportName, T detour, bool useMinHook)
|
public static Hook<T> FromSymbol(string moduleName, string exportName, T detour, bool useMinHook)
|
||||||
{
|
{
|
||||||
|
if (EnvironmentConfiguration.DalamudForceMinHook)
|
||||||
|
useMinHook = true;
|
||||||
|
|
||||||
var moduleHandle = NativeFunctions.GetModuleHandleW(moduleName);
|
var moduleHandle = NativeFunctions.GetModuleHandleW(moduleName);
|
||||||
if (moduleHandle == IntPtr.Zero)
|
if (moduleHandle == IntPtr.Zero)
|
||||||
throw new Exception($"Could not get a handle to module {moduleName}");
|
throw new Exception($"Could not get a handle to module {moduleName}");
|
||||||
|
|
@ -240,6 +247,9 @@ namespace Dalamud.Hooking
|
||||||
/// <returns>The hook with the supplied parameters.</returns>
|
/// <returns>The hook with the supplied parameters.</returns>
|
||||||
public static Hook<T> FromAddress(IntPtr procAddress, T detour, bool useMinHook = false)
|
public static Hook<T> FromAddress(IntPtr procAddress, T detour, bool useMinHook = false)
|
||||||
{
|
{
|
||||||
|
if (EnvironmentConfiguration.DalamudForceMinHook)
|
||||||
|
useMinHook = true;
|
||||||
|
|
||||||
procAddress = HookManager.FollowJmp(procAddress);
|
procAddress = HookManager.FollowJmp(procAddress);
|
||||||
if (useMinHook)
|
if (useMinHook)
|
||||||
return new MinHookHook<T>(procAddress, detour, Assembly.GetCallingAssembly());
|
return new MinHookHook<T>(procAddress, detour, Assembly.GetCallingAssembly());
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ using Dalamud.Configuration.Internal;
|
||||||
using Dalamud.Game.ClientState.Conditions;
|
using Dalamud.Game.ClientState.Conditions;
|
||||||
using Dalamud.Game.Gui;
|
using Dalamud.Game.Gui;
|
||||||
using Dalamud.Game.Internal;
|
using Dalamud.Game.Internal;
|
||||||
|
using Dalamud.Interface.Colors;
|
||||||
using Dalamud.Interface.Internal.ManagedAsserts;
|
using Dalamud.Interface.Internal.ManagedAsserts;
|
||||||
using Dalamud.Interface.Internal.Windows;
|
using Dalamud.Interface.Internal.Windows;
|
||||||
using Dalamud.Interface.Internal.Windows.PluginInstaller;
|
using Dalamud.Interface.Internal.Windows.PluginInstaller;
|
||||||
|
|
@ -438,12 +439,9 @@ namespace Dalamud.Interface.Internal
|
||||||
|
|
||||||
if (!this.isImGuiDrawDevMenu && !condition.Any())
|
if (!this.isImGuiDrawDevMenu && !condition.Any())
|
||||||
{
|
{
|
||||||
var config = Service<DalamudConfiguration>.Get();
|
|
||||||
|
|
||||||
ImGui.PushStyleColor(ImGuiCol.Button, Vector4.Zero);
|
ImGui.PushStyleColor(ImGuiCol.Button, Vector4.Zero);
|
||||||
ImGui.PushStyleColor(ImGuiCol.ButtonActive, Vector4.Zero);
|
ImGui.PushStyleColor(ImGuiCol.ButtonActive, Vector4.Zero);
|
||||||
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, Vector4.Zero);
|
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, Vector4.Zero);
|
||||||
ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(0, 0, 0, 1));
|
|
||||||
ImGui.PushStyleColor(ImGuiCol.TextSelectedBg, new Vector4(0, 0, 0, 1));
|
ImGui.PushStyleColor(ImGuiCol.TextSelectedBg, new Vector4(0, 0, 0, 1));
|
||||||
ImGui.PushStyleColor(ImGuiCol.Border, new Vector4(0, 0, 0, 1));
|
ImGui.PushStyleColor(ImGuiCol.Border, new Vector4(0, 0, 0, 1));
|
||||||
ImGui.PushStyleColor(ImGuiCol.BorderShadow, new Vector4(0, 0, 0, 1));
|
ImGui.PushStyleColor(ImGuiCol.BorderShadow, new Vector4(0, 0, 0, 1));
|
||||||
|
|
@ -467,8 +465,26 @@ namespace Dalamud.Interface.Internal
|
||||||
ImGui.End();
|
ImGui.End();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (EnvironmentConfiguration.DalamudForceMinHook)
|
||||||
|
{
|
||||||
|
ImGui.SetNextWindowPos(windowPos, ImGuiCond.Always);
|
||||||
|
ImGui.SetNextWindowBgAlpha(1);
|
||||||
|
|
||||||
|
if (ImGui.Begin(
|
||||||
|
"Disclaimer",
|
||||||
|
ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoBackground |
|
||||||
|
ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.NoMove |
|
||||||
|
ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoMouseInputs |
|
||||||
|
ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoSavedSettings))
|
||||||
|
{
|
||||||
|
ImGui.TextColored(ImGuiColors.DalamudRed, "Is force MinHook!");
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.End();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.PopStyleVar(4);
|
ImGui.PopStyleVar(4);
|
||||||
ImGui.PopStyleColor(8);
|
ImGui.PopStyleColor(7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue