From f14aad442f0a3b14d9b394ac81a4e880cb2ca8ce Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sun, 1 Nov 2026 11:49:39 +0000 Subject: [PATCH] Decompile fn_17218 (UIWindowMgr::ShowWaitDBSaveWindow) Batch #9397 by Bielhp: 0 byte-identical, 1 confirmed by peer review. - fn_17218 UIWindowMgr::ShowWaitDBSaveWindow: logic confirmed by peer review Peer-reviewed-by: secret, gordaoprogramas, Toshiro Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Window/UIWindowMgr.cpp | 43 ++++++++++++++++++++++++++++++++ Source/UI/Window/UIWindowMgr.h | 3 +++ 2 files changed, 46 insertions(+) diff --git a/Source/UI/Window/UIWindowMgr.cpp b/Source/UI/Window/UIWindowMgr.cpp index 378a92c9..83584736 100644 --- a/Source/UI/Window/UIWindowMgr.cpp +++ b/Source/UI/Window/UIWindowMgr.cpp @@ -58,6 +58,7 @@ #include "Contents/Hotkeys/EmotionHotkeys.h" #include "Contents/Messenger/ClientMessenger.h" #include "UI/Text/TextMarkup.h" +#include "UI/Dialogs/UIWaitDBSaveWnd.h" namespace { #pragma pack(push, 1) struct AddFriendPacket { @@ -3645,3 +3646,45 @@ bool UIWindowMgr::CloseWindow(int id) { return closed; } + +// OFFSET: 0x00AA2A00 +// FUNCTION: fn_17218 +void UIWindowMgr::ShowWaitDBSaveWindow(UIWindowContext& windows, UIWaitDBSaveWndContext& waitContext) { + if (this->window_4F2AC != nullptr) { + return; + } + + this->window_4F2AC = new UIWaitDBSaveWnd(windows, waitContext); + this->window_4F2AC->SetSize(g_renderer->viewport.width, g_renderer->viewport.height); + this->window_4F2AC->Move(0, 0); + this->window_4F2AC->SetId(10024); + this->rendered.push_back(this->window_4F2AC); + + UIWindow* window = this->window_4F2AC; + if (window && (this->modal == nullptr || this->window_4F174 == window) && !this->LookupWindow(278) && !this->LookupWindow(4) && + !this->LookupWindow(199) && !this->LookupWindow(200)) { + int companion = -1; + if (window->geometry.id == 12) { + companion = 234; + } else if (window->geometry.id == 82) { + companion = 250; + } + + if (companion != -1) { + const auto entry = std::find_if(this->rendered.begin(), this->rendered.end(), [&](const UIWindow* value) { return value->geometry.id == companion; }); + if (entry != this->rendered.end()) { + UIWindow* value = *entry; + this->rendered.erase(entry); + this->rendered.push_back(value); + } + } + + const auto entry = std::find(this->rendered.begin(), this->rendered.end(), window); + if (entry != this->rendered.end()) { + this->rendered.erase(entry); + this->rendered.push_back(window); + } + } + + this->window_4F2AC->Show(1); +} diff --git a/Source/UI/Window/UIWindowMgr.h b/Source/UI/Window/UIWindowMgr.h index 0a5d37e8..e60acc29 100644 --- a/Source/UI/Window/UIWindowMgr.h +++ b/Source/UI/Window/UIWindowMgr.h @@ -20,6 +20,8 @@ class CWebBrowser; struct MessengerMember; struct ReplayOptions; struct ModeDragState; +struct UIWaitDBSaveWndContext; +struct UIWindowContext; struct WindowTextEntry { /* 0000 */ std::string text; @@ -559,6 +561,7 @@ public: bool ProcessHotkeyAction(int action, int pressed); bool sub_AA35F0(int action); bool ProcessKeyDown(int key, int keyData, int pressed); + void ShowWaitDBSaveWindow(UIWindowContext& windows, UIWaitDBSaveWndContext& waitContext); void SendEmotionHotkey(int index); };