Skip to content

Commit

Permalink
fix: disable input hook in title screen
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbeBryssinck committed Apr 26, 2022
1 parent 93697e7 commit 1548e48
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions Code/client/Services/Generic/InputService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,21 +207,28 @@ void ProcessKeyboard(uint16_t aKey, uint16_t aScanCode, cef_key_event_type_t aTy

spdlog::debug("ProcessKey, type: {}, key: {}, active: {}", aType, aKey, active);

// This is really hacky, but when the input hook is enabled initially, it does not propogate the KEYDOWN event
if (IsToggleKey(aKey) && (aType == KEYEVENT_KEYDOWN || (aType == KEYEVENT_KEYUP && !active)))
if (IsToggleKey(aKey))
{
if (!overlay.GetInGame())
{
TiltedPhoques::DInputHook::Get().SetEnabled(false);
}
// This is really hacky, but when the input hook is enabled initially, it does not propogate the KEYDOWN event
else if (aType == KEYEVENT_KEYDOWN || (aType == KEYEVENT_KEYUP && !active))
{
#if defined(TP_SKYRIM)
TiltedPhoques::DInputHook::Get().SetEnabled(!active);
overlay.SetActive(!active);
TiltedPhoques::DInputHook::Get().SetEnabled(!active);
overlay.SetActive(!active);
#else
pRenderer->SetVisible(!active);
pRenderer->SetVisible(!active);
#endif

// pRenderer->SetCursorVisible(!active);
pRenderer->SetCursorVisible(!active);

// This is to disable the Windows cursor
while (ShowCursor(FALSE) >= 0)
;
// This is to disable the Windows cursor
while (ShowCursor(FALSE) >= 0)
;
}
}
else if (active)
{
Expand Down Expand Up @@ -325,9 +332,7 @@ LRESULT CALLBACK InputService::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPAR
imgui.WndProcHandler(hwnd, uMsg, wParam, lParam);
}

#if defined(TP_SKYRIM)
//pRenderer->SetVisible(TiltedPhoques::DInputHook::Get().IsEnabled());
#else
#if TP_FALLOUT4
POINTER_FALLOUT4(uint8_t, s_viewportLock, 0x3846670);
*s_viewportLock = isVisible ? 1 : 0;
#endif
Expand Down

0 comments on commit 1548e48

Please sign in to comment.