From ce7abf8a8144392ebf247e185ea6034fb6774f40 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sun, 8 Nov 2026 00:16:25 +0000 Subject: [PATCH] Decompile 2 functions in Source/UI/Window/InputFocus.cpp, Source/UI/Window/UIWindowMgr.h, ... Batch #14868 by SapitoSucio: 1 byte-identical, 1 confirmed by peer review. - fn_17261 UIWindowMgr::SetPressedWindowRoot: logic confirmed by peer review - fn_12582 UINewChatWnd::ToggleInput: byte-identical Peer-reviewed-by: ragnarok-clanker, codeplay, NYD Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Chat/ChatSuggestions.cpp | 4 ++-- Source/UI/Window/InputFocus.cpp | 15 +++++++++++++-- Source/UI/Window/UIWindowMgr.h | 1 + Source/UI/Window/WindowMouseHit.cpp | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Source/UI/Chat/ChatSuggestions.cpp b/Source/UI/Chat/ChatSuggestions.cpp index 1c43699c9..900d5db9c 100644 --- a/Source/UI/Chat/ChatSuggestions.cpp +++ b/Source/UI/Chat/ChatSuggestions.cpp @@ -189,7 +189,7 @@ void UINewChatWnd::ToggleInput() { if (strlen(this->m_chatEdit->Text()) == 0) { g_windowMgr.inputSuggestionsEnabled = false; this->ApplyInputLayout(); - SetPressedWindowRoot(g_windowMgr.window_4F1D4, nullptr); + g_windowMgr.SetPressedWindowRoot(nullptr); } } else { g_windowMgr.inputSuggestionsEnabled = true; @@ -201,7 +201,7 @@ void UINewChatWnd::ToggleInput() { this->ResizeRows(static_cast(this->geometry.unknown_0030)); } - SetPressedWindowRoot(g_windowMgr.window_4F1D4, this->m_inputEdit); + g_windowMgr.SetPressedWindowRoot(this->m_inputEdit); } if (UIItemTagOnChat* tags = static_cast(this->m_chatEdit)->unknown_0144) { diff --git a/Source/UI/Window/InputFocus.cpp b/Source/UI/Window/InputFocus.cpp index fe1bd24f2..798f94d90 100644 --- a/Source/UI/Window/InputFocus.cpp +++ b/Source/UI/Window/InputFocus.cpp @@ -115,8 +115,19 @@ void UIWindowMgr::RefreshFocus(UIWindow* const& excludedRoot) { } } -// OFFSET: 0x00AA9E60 -// FUNCTION: fn_17261 +// INLINED void SetPressedWindowRoot(UIWindow*& pressedRoot, UIWindow* window) { pressedRoot = window ? window->Root() : nullptr; } + +// OFFSET: 0x00AA9E60 +// FUNCTION: fn_17261 +void UIWindowMgr::SetPressedWindowRoot(UIWindow* window) { + UIWindow* root = window; + if (root != nullptr) { + while (root->parent != nullptr) { + root = root->parent; + } + } + this->window_4F1D4 = root; +} diff --git a/Source/UI/Window/UIWindowMgr.h b/Source/UI/Window/UIWindowMgr.h index b2aacffa0..8703ca69a 100644 --- a/Source/UI/Window/UIWindowMgr.h +++ b/Source/UI/Window/UIWindowMgr.h @@ -564,6 +564,7 @@ public: bool IsLastFocus(UIWindow* value); void FocusPrevious(); void RefreshFocus(UIWindow* const& excludedRoot); + void SetPressedWindowRoot(UIWindow* window); bool IsHoverOnWindow01C8Button(); void SelectWhisperName(const char* name); void AddWhisperName(const char* name); diff --git a/Source/UI/Window/WindowMouseHit.cpp b/Source/UI/Window/WindowMouseHit.cpp index e052b6126..9613eaff6 100644 --- a/Source/UI/Window/WindowMouseHit.cpp +++ b/Source/UI/Window/WindowMouseHit.cpp @@ -262,7 +262,7 @@ int UIWindowMgr::ProcessMouse() { } if (g_mouse.buttons[0] == 1) { - SetPressedWindowRoot(this->window_4F1D4, window); + ::SetPressedWindowRoot(this->window_4F1D4, window); } if (window) {