Created
July 14, 2022 10:07
-
-
Save Schroedi/597e28a9a7363c18a00a5d55b28063ba to your computer and use it in GitHub Desktop.
Freeze and unfreeze PoE to use DPB's ObjectExplorer without hurry.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static partial class KeksTools | |
{ | |
[DllImport("kernel32.dll", SetLastError = true)] | |
static extern bool DebugActiveProcess(uint dwProcessId); | |
[DllImport("kernel32.dll", SetLastError = true)] | |
static extern bool DebugActiveProcessStop(uint dwProcessId); | |
private static bool WasHooked = false; | |
public static bool IsPoeFrozen { get; set; } | |
public static void FreezePoeToggle() | |
{ | |
// We can't check if the process has a debugger attached as DPB acts as debugger | |
// Therefore, we save the state | |
if (IsPoeFrozen) | |
{ | |
UnFreezePoe(); | |
} | |
else | |
{ | |
FreezePoe(); | |
} | |
} | |
public static void UnFreezePoe() | |
{ | |
DebugActiveProcessStop((uint) GameController.Instance.Window.Process.Id); | |
IsPoeFrozen = false; | |
if (WasHooked) | |
{ | |
LokiPoe.ProcessHookManager.Enable(); | |
} | |
} | |
public static void FreezePoe() | |
{ | |
WasHooked = LokiPoe.ProcessHookManager.IsEnabled; | |
LokiPoe.ProcessHookManager.Disable(); | |
DebugActiveProcess((uint) GameController.Instance.Window.Process.Id); | |
IsPoeFrozen = true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment