Skip to content

Commit

Permalink
Revert "fix: alt+tab input sticking" (#434)
Browse files Browse the repository at this point in the history
This reverts commit 6277a6c.
  • Loading branch information
doodlum authored Aug 18, 2024
1 parent a8a9600 commit 6d33dae
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,15 +310,27 @@ namespace Hooks
{
static LRESULT thunk(HWND a_hwnd, UINT a_msg, WPARAM a_wParam, LPARAM a_lParam)
{
if (a_msg == WM_KILLFOCUS || a_msg == WM_SETFOCUS) {
if (a_msg == WM_KILLFOCUS) {
Menu::GetSingleton()->OnFocusLost();
auto& io = ImGui::GetIO();
io.ClearInputKeys();
io.ClearEventsQueue();
}
return func(a_hwnd, a_msg, a_wParam, a_lParam);
}
static inline WNDPROC func;
static inline REL::Relocation<decltype(thunk)> func;
};

struct RegisterClassA_Hook
{
static ATOM thunk(WNDCLASSA* a_wndClass)
{
WndProcHandler_Hook::func = reinterpret_cast<uintptr_t>(a_wndClass->lpfnWndProc);
a_wndClass->lpfnWndProc = &WndProcHandler_Hook::thunk;

return func(a_wndClass);
}
static inline REL::Relocation<decltype(thunk)> func;
};

struct CreateRenderTarget_Main
Expand Down Expand Up @@ -475,11 +487,7 @@ namespace Hooks
stl::write_thunk_call<BSGraphics_Renderer_Init_InitD3D>(REL::RelocationID(75595, 77226).address() + REL::Relocate(0x50, 0x2BC));

logger::info("Hooking WndProcHandler");
WndProcHandler_Hook::func = reinterpret_cast<WNDPROC>(
SetWindowLongPtrA(
RE::BSGraphics::Renderer::GetSingleton()->GetRuntimeData().renderWindows[0].hWnd,
GWLP_WNDPROC,
reinterpret_cast<LONG_PTR>(WndProcHandler_Hook::thunk)));
stl::write_thunk_call_6<RegisterClassA_Hook>(REL::VariantID(75591, 77226, 0xDC4B90).address() + REL::VariantOffset(0x8E, 0x15C, 0x99).offset());

//logger::info("Hooking D3D11CreateDeviceAndSwapChain");
//*(FARPROC*)&ptrD3D11CreateDeviceAndSwapChain = GetProcAddress(GetModuleHandleA("d3d11.dll"), "D3D11CreateDeviceAndSwapChain");
Expand Down

0 comments on commit 6d33dae

Please sign in to comment.