mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-03 06:13:40 +01:00
reloaded by default, corehook => minhook
This commit is contained in:
parent
0dbf51330c
commit
6c06645b00
4 changed files with 9 additions and 7 deletions
|
|
@ -25,7 +25,7 @@ namespace Dalamud.Configuration.Internal
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether the DalamudForceCoreHook setting has been enabled.
|
/// Gets a value indicating whether the DalamudForceCoreHook setting has been enabled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool DalamudForceCoreHook { get; } = GetEnvironmentVariable("DALAMUD_FORCE_COREHOOK");
|
public static bool DalamudForceMinHook { get; } = GetEnvironmentVariable("DALAMUD_FORCE_COREHOOK");
|
||||||
|
|
||||||
private static bool GetEnvironmentVariable(string name)
|
private static bool GetEnvironmentVariable(string name)
|
||||||
=> bool.Parse(Environment.GetEnvironmentVariable(name) ?? "false");
|
=> bool.Parse(Environment.GetEnvironmentVariable(name) ?? "false");
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ namespace Dalamud.Hooking
|
||||||
/// <param name="address">A memory address to install a hook.</param>
|
/// <param name="address">A memory address to install a hook.</param>
|
||||||
/// <param name="detour">Callback function. Delegate must have a same original function prototype.</param>
|
/// <param name="detour">Callback function. Delegate must have a same original function prototype.</param>
|
||||||
public Hook(IntPtr address, T detour)
|
public Hook(IntPtr address, T detour)
|
||||||
: this(address, detour, true)
|
: this(address, detour, false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -44,7 +44,7 @@ namespace Dalamud.Hooking
|
||||||
public Hook(IntPtr address, T detour, bool useMinHook)
|
public Hook(IntPtr address, T detour, bool useMinHook)
|
||||||
{
|
{
|
||||||
address = HookManager.FollowJmp(address);
|
address = HookManager.FollowJmp(address);
|
||||||
this.isMinHook = true;
|
this.isMinHook = EnvironmentConfiguration.DalamudForceMinHook || useMinHook;
|
||||||
|
|
||||||
var hasOtherHooks = HookManager.Originals.ContainsKey(address);
|
var hasOtherHooks = HookManager.Originals.ContainsKey(address);
|
||||||
if (!hasOtherHooks)
|
if (!hasOtherHooks)
|
||||||
|
|
@ -140,7 +140,7 @@ namespace Dalamud.Hooking
|
||||||
/// <param name="detour">Callback function. Delegate must have a same original function prototype.</param>
|
/// <param name="detour">Callback function. Delegate must have a same original function prototype.</param>
|
||||||
/// <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)
|
public static Hook<T> FromSymbol(string moduleName, string exportName, T detour)
|
||||||
=> FromSymbol(moduleName, exportName, detour, true);
|
=> FromSymbol(moduleName, exportName, detour, false);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a hook. Hooking address is inferred by calling to GetProcAddress() function.
|
/// Creates a hook. Hooking address is inferred by calling to GetProcAddress() function.
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@ using ImGuiNET;
|
||||||
using ImGuiScene;
|
using ImGuiScene;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using SharpDX.Direct3D11;
|
|
||||||
|
|
||||||
namespace Dalamud.Interface.Internal.Windows
|
namespace Dalamud.Interface.Internal.Windows
|
||||||
{
|
{
|
||||||
|
|
@ -73,6 +72,7 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
private UIDebug addonInspector = null;
|
private UIDebug addonInspector = null;
|
||||||
|
|
||||||
private Hook<MessageBoxWDelegate>? messageBoxMinHook;
|
private Hook<MessageBoxWDelegate>? messageBoxMinHook;
|
||||||
|
private bool hookUseMinHook = false;
|
||||||
|
|
||||||
// IPC
|
// IPC
|
||||||
private ICallGateProvider<string, string> ipcPub;
|
private ICallGateProvider<string, string> ipcPub;
|
||||||
|
|
@ -1589,8 +1589,10 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
ImGui.Checkbox("Use MinHook", ref this.hookUseMinHook);
|
||||||
|
|
||||||
if (ImGui.Button("Create"))
|
if (ImGui.Button("Create"))
|
||||||
this.messageBoxMinHook = Hook<MessageBoxWDelegate>.FromSymbol("User32", "MessageBoxW", this.MessageBoxWDetour);
|
this.messageBoxMinHook = Hook<MessageBoxWDelegate>.FromSymbol("User32", "MessageBoxW", this.MessageBoxWDetour, this.hookUseMinHook);
|
||||||
|
|
||||||
if (ImGui.Button("Enable"))
|
if (ImGui.Button("Enable"))
|
||||||
this.messageBoxMinHook?.Enable();
|
this.messageBoxMinHook?.Enable();
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ namespace Dalamud.Support
|
||||||
DoPluginTest = configuration.DoPluginTest,
|
DoPluginTest = configuration.DoPluginTest,
|
||||||
InterfaceLoaded = interfaceManager?.IsReady ?? false,
|
InterfaceLoaded = interfaceManager?.IsReady ?? false,
|
||||||
ThirdRepo = configuration.ThirdRepoList,
|
ThirdRepo = configuration.ThirdRepoList,
|
||||||
ForcedCoreHook = EnvironmentConfiguration.DalamudForceCoreHook,
|
ForcedCoreHook = EnvironmentConfiguration.DalamudForceMinHook,
|
||||||
};
|
};
|
||||||
|
|
||||||
var encodedPayload = Convert.ToBase64String(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(payload)));
|
var encodedPayload = Convert.ToBase64String(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(payload)));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue