move detour into function

This commit is contained in:
goat 2021-10-26 23:34:10 +02:00
parent b0fac2bc47
commit e641cac71c
No known key found for this signature in database
GPG key ID: 7773BB5B43BA52E5

View file

@ -333,12 +333,7 @@ namespace Dalamud.Interface.Internal.Windows
if (ImGui.Button("Create"))
{
this.messageBoxMinHook = Hook<MessageBoxWDelegate>.FromSymbol(
"User32", "MessageBoxW",
(wnd, text, caption, type) =>
{
Log.Information("[DATAHOOK] {0} {1} {2} {3}", wnd, text, caption, type);
return this.messageBoxMinHook.Original(wnd, text, caption, type);
});
"User32", "MessageBoxW", MessageBoxWDetour);
}
if (ImGui.Button("Enable")) this.messageBoxMinHook?.Enable();
@ -380,6 +375,12 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.EndChild();
}
private int MessageBoxWDetour(IntPtr hwnd, string text, string caption, NativeFunctions.MessageBoxType type)
{
Log.Information("[DATAHOOK] {0} {1} {2} {3}", hwnd, text, caption, type);
return this.messageBoxMinHook.Original(hwnd, text, caption, type);
}
private void DrawServerOpCode()
{
ImGui.TextUnformatted(this.serverOpString);