fix: proper kbm and controller input

This commit is contained in:
NOTPIES 2026-03-03 00:08:42 -03:00
parent 43d20374a4
commit f83a6ab2e5
6 changed files with 19 additions and 3 deletions

View file

@ -471,7 +471,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
#endif #endif
#ifdef _WINDOWS64 #ifdef _WINDOWS64
if (!g_KBMInput.IsMouseGrabbed()) if (!g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive())
{ {
int deltaX = g_KBMInput.GetMouseDeltaX(); int deltaX = g_KBMInput.GetMouseDeltaX();
int deltaY = g_KBMInput.GetMouseDeltaY(); int deltaY = g_KBMInput.GetMouseDeltaY();
@ -716,7 +716,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
// If there is no stick input, and we are over a slot, then snap pointer to slot centre. // If there is no stick input, and we are over a slot, then snap pointer to slot centre.
// 4J - TomK - only if this particular component allows so! // 4J - TomK - only if this particular component allows so!
#ifdef _WINDOWS64 #ifdef _WINDOWS64
if(g_KBMInput.IsMouseGrabbed() && CanHaveFocus(eSectionUnderPointer)) if((g_KBMInput.IsMouseGrabbed() || !g_KBMInput.IsKBMActive()) && CanHaveFocus(eSectionUnderPointer))
#else #else
if(CanHaveFocus(eSectionUnderPointer)) if(CanHaveFocus(eSectionUnderPointer))
#endif #endif

View file

@ -691,7 +691,7 @@ void UIController::tickInput()
#endif #endif
{ {
#ifdef _WINDOWS64 #ifdef _WINDOWS64
if (!g_KBMInput.IsMouseGrabbed()) if (!g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive())
{ {
UIScene *pScene = NULL; UIScene *pScene = NULL;
for (int grp = 0; grp < eUIGroup_COUNT && !pScene; ++grp) for (int grp = 0; grp < eUIGroup_COUNT && !pScene; ++grp)

View file

@ -45,6 +45,7 @@ void UIScene_AbstractContainerMenu::handleDestroy()
g_savedInventoryCursorPos.y = m_pointerPos.y; g_savedInventoryCursorPos.y = m_pointerPos.y;
g_savedInventoryCursorPos.hasSavedPos = true; g_savedInventoryCursorPos.hasSavedPos = true;
g_KBMInput.SetScreenCursorHidden(false);
g_KBMInput.SetCursorHiddenForUI(false); g_KBMInput.SetCursorHiddenForUI(false);
#endif #endif
@ -82,6 +83,7 @@ void UIScene_AbstractContainerMenu::InitDataAssociations(int iPad, AbstractConta
void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex) void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex)
{ {
#ifdef _WINDOWS64 #ifdef _WINDOWS64
g_KBMInput.SetScreenCursorHidden(true);
g_KBMInput.SetCursorHiddenForUI(true); g_KBMInput.SetCursorHiddenForUI(true);
#endif #endif

View file

@ -37,6 +37,7 @@ void KeyboardMouseInput::Init()
m_windowFocused = true; m_windowFocused = true;
m_hasInput = false; m_hasInput = false;
m_kbmActive = true; m_kbmActive = true;
m_screenWantsCursorHidden = false;
RAWINPUTDEVICE rid; RAWINPUTDEVICE rid;
rid.usUsagePage = 0x01; // HID_USAGE_PAGE_GENERIC rid.usUsagePage = 0x01; // HID_USAGE_PAGE_GENERIC

View file

@ -69,6 +69,9 @@ public:
void SetKBMActive(bool active) { m_kbmActive = active; } void SetKBMActive(bool active) { m_kbmActive = active; }
bool IsKBMActive() const { return m_kbmActive; } bool IsKBMActive() const { return m_kbmActive; }
void SetScreenCursorHidden(bool hidden) { m_screenWantsCursorHidden = hidden; }
bool IsScreenCursorHidden() const { return m_screenWantsCursorHidden; }
float GetMoveX() const; float GetMoveX() const;
float GetMoveY() const; float GetMoveY() const;
@ -112,6 +115,8 @@ private:
bool m_hasInput; bool m_hasInput;
bool m_kbmActive; bool m_kbmActive;
bool m_screenWantsCursorHidden;
}; };
extern KeyboardMouseInput g_KBMInput; extern KeyboardMouseInput g_KBMInput;

View file

@ -1204,6 +1204,14 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
g_KBMInput.SetKBMActive(true); g_KBMInput.SetKBMActive(true);
} }
if (!g_KBMInput.IsMouseGrabbed())
{
if (!g_KBMInput.IsKBMActive())
g_KBMInput.SetCursorHiddenForUI(true);
else if (!g_KBMInput.IsScreenCursorHidden())
g_KBMInput.SetCursorHiddenForUI(false);
}
PIXEndNamedEvent(); PIXEndNamedEvent();
PIXBeginNamedEvent(0,"Profile manager tick"); PIXBeginNamedEvent(0,"Profile manager tick");
// ProfileManager.Tick(); // ProfileManager.Tick();