Skip to content

Commit

Permalink
Fixed loggin of window focus.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyall committed Feb 22, 2024
1 parent 4855bf0 commit df8eb22
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,31 +711,21 @@ void Miscellaneous()
spdlog::info("Window Focus: Address is {:s}+{:x}", sExeName.c_str(), (uintptr_t)WindowFocusScanResult - (uintptr_t)baseModule);

static SafetyHookMid WindowFocusMidHook{};
WindowFocusMidHook = safetyhook::create_mid(WindowFocusScanResult + 0xC,
WindowFocusMidHook = safetyhook::create_mid(WindowFocusScanResult + 0xF,
[](SafetyHookContext& ctx)
{
if (!bPauseOnFocusLoss)
{
// or ZF rflag
ctx.rflags &= 0x40;
}

if ((uint8_t)ctx.rflags + 0x40 == (uint8_t)66)
{
iWindowFocusStatus = 1;
}
else if ((uint8_t)ctx.rflags + 0x40 == (uint8_t)134)
{
iWindowFocusStatus = 0;
ctx.rdx |= 1;
}
iWindowFocusStatus = ctx.rdx & 0xFF;
});

}
else if (!WindowFocusScanResult)
{
spdlog::error("Window Focus: Pattern scan failed.");
}

}

DWORD __stdcall Main(void*)
Expand Down

0 comments on commit df8eb22

Please sign in to comment.