fix controller breaking when mouse goes of any buttons

This commit is contained in:
Devlrxxh 2026-03-06 14:53:09 +01:00
parent de46641cda
commit aa00b2dd40

View file

@ -773,12 +773,12 @@ void UIController::tickInput()
{ {
// If system/commerce UI up, don't handle input // If system/commerce UI up, don't handle input
//if(!m_bSysUIShowing && !m_bSystemUIShowing) //if(!m_bSysUIShowing && !m_bSystemUIShowing)
if(!m_bSystemUIShowing) if (!m_bSystemUIShowing)
{ {
#ifdef ENABLE_IGGY_PERFMON #ifdef ENABLE_IGGY_PERFMON
if (m_iggyPerfmonEnabled) if (m_iggyPerfmonEnabled)
{ {
if(InputManager.ButtonPressed(ProfileManager.GetPrimaryPad(), ACTION_MENU_STICK_PRESS)) m_iggyPerfmonEnabled = !m_iggyPerfmonEnabled; if (InputManager.ButtonPressed(ProfileManager.GetPrimaryPad(), ACTION_MENU_STICK_PRESS)) m_iggyPerfmonEnabled = !m_iggyPerfmonEnabled;
} }
else else
#endif #endif
@ -786,7 +786,7 @@ void UIController::tickInput()
#ifdef _WINDOWS64 #ifdef _WINDOWS64
if (!g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive()) 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)
{ {
pScene = m_groups[grp]->GetTopScene(eUILayer_Debug); pScene = m_groups[grp]->GetTopScene(eUILayer_Debug);
@ -799,7 +799,7 @@ void UIController::tickInput()
} }
if (pScene && pScene->getMovie()) if (pScene && pScene->getMovie())
{ {
Iggy *movie = pScene->getMovie(); Iggy* movie = pScene->getMovie();
int rawMouseX = g_KBMInput.GetMouseX(); int rawMouseX = g_KBMInput.GetMouseX();
int rawMouseY = g_KBMInput.GetMouseY(); int rawMouseY = g_KBMInput.GetMouseY();
F32 mouseX = (F32)rawMouseX; F32 mouseX = (F32)rawMouseX;
@ -845,8 +845,7 @@ void UIController::tickInput()
break; break;
} }
} }
if (hitObject != IGGY_FOCUS_NULL && hitObject != currentFocus) // <-- THE FIX
if (hitObject != currentFocus)
{ {
IggyPlayerSetFocusRS(movie, hitObject, 0); IggyPlayerSetFocusRS(movie, hitObject, 0);
} }
@ -868,35 +867,31 @@ void UIController::tickInput()
// Get main panel offset (controls are positioned relative to it) // Get main panel offset (controls are positioned relative to it)
S32 panelOffsetX = 0, panelOffsetY = 0; S32 panelOffsetX = 0, panelOffsetY = 0;
UIControl *pMainPanel = pScene->GetMainPanel(); UIControl* pMainPanel = pScene->GetMainPanel();
if (pMainPanel) if (pMainPanel)
{ {
pMainPanel->UpdateControl(); pMainPanel->UpdateControl();
panelOffsetX = pMainPanel->getXPos(); panelOffsetX = pMainPanel->getXPos();
panelOffsetY = pMainPanel->getYPos(); panelOffsetY = pMainPanel->getYPos();
} }
bool leftPressed = g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_LEFT); bool leftPressed = g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_LEFT);
bool leftDown = leftPressed || g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_LEFT); bool leftDown = leftPressed || g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_LEFT);
if (m_mouseDraggingSliderScene != eUIScene_COUNT && m_mouseDraggingSliderScene != pScene->getSceneType()) if (m_mouseDraggingSliderScene != eUIScene_COUNT && m_mouseDraggingSliderScene != pScene->getSceneType())
{ {
m_mouseDraggingSliderScene = eUIScene_COUNT; m_mouseDraggingSliderScene = eUIScene_COUNT;
m_mouseDraggingSliderId = -1; m_mouseDraggingSliderId = -1;
} }
if (leftPressed) if (leftPressed)
{ {
vector<UIControl *> *controls = pScene->GetControls(); vector<UIControl*>* controls = pScene->GetControls();
if (controls) if (controls)
{ {
for (size_t i = 0; i < controls->size(); ++i) for (size_t i = 0; i < controls->size(); ++i)
{ {
UIControl *ctrl = (*controls)[i]; UIControl* ctrl = (*controls)[i];
if (!ctrl || ctrl->getControlType() != UIControl::eSlider || !ctrl->getVisible()) if (!ctrl || ctrl->getControlType() != UIControl::eSlider || !ctrl->getVisible())
continue; continue;
UIControl_Slider* pSlider = (UIControl_Slider*)ctrl;
UIControl_Slider *pSlider = (UIControl_Slider *)ctrl;
pSlider->UpdateControl(); pSlider->UpdateControl();
S32 cx = pSlider->getXPos() + panelOffsetX; S32 cx = pSlider->getXPos() + panelOffsetX;
S32 cy = pSlider->getYPos() + panelOffsetY; S32 cy = pSlider->getYPos() + panelOffsetY;
@ -904,7 +899,6 @@ void UIController::tickInput()
S32 ch = pSlider->getHeight(); S32 ch = pSlider->getHeight();
if (cw <= 0 || ch <= 0) if (cw <= 0 || ch <= 0)
continue; continue;
if (sceneMouseX >= cx && sceneMouseX <= cx + cw && sceneMouseY >= cy && sceneMouseY <= cy + ch) if (sceneMouseX >= cx && sceneMouseX <= cx + cw && sceneMouseY >= cy && sceneMouseY <= cy + ch)
{ {
m_mouseDraggingSliderScene = pScene->getSceneType(); m_mouseDraggingSliderScene = pScene->getSceneType();
@ -914,10 +908,9 @@ void UIController::tickInput()
} }
} }
} }
if (leftDown && m_mouseDraggingSliderScene == pScene->getSceneType() && m_mouseDraggingSliderId >= 0) if (leftDown && m_mouseDraggingSliderScene == pScene->getSceneType() && m_mouseDraggingSliderId >= 0)
{ {
UIControl_Slider *pSlider = FindSliderById(pScene, m_mouseDraggingSliderId); UIControl_Slider* pSlider = FindSliderById(pScene, m_mouseDraggingSliderId);
if (pSlider && pSlider->getVisible()) if (pSlider && pSlider->getVisible())
{ {
pSlider->UpdateControl(); pSlider->UpdateControl();