From 21d392dc46d66d7d320d6cd15ee254e5b2842b65 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Mon, 2 Nov 2026 11:56:46 +0000 Subject: [PATCH] Decompile fn_17253 (UIWindowMgr::SendNotice) Batch #9924 by ragnarok-clanker: 0 byte-identical, 1 confirmed by peer review. - fn_17253 UIWindowMgr::SendNotice: logic confirmed by peer review Reviewed-by: ragnarok-clanker --- Source/UI/Window/UIWindowMgr.cpp | 121 +++++++++++++++++++++++++++++++ Source/UI/Window/UIWindowMgr.h | 7 +- 2 files changed, 126 insertions(+), 2 deletions(-) diff --git a/Source/UI/Window/UIWindowMgr.cpp b/Source/UI/Window/UIWindowMgr.cpp index cf58a4ea..08eaf6e6 100644 --- a/Source/UI/Window/UIWindowMgr.cpp +++ b/Source/UI/Window/UIWindowMgr.cpp @@ -62,6 +62,11 @@ #include "Render/Primitives/AlphaRectangle.h" #include "UI/Cooldowns/CooldownOwner.h" #include "UI/Text/UITransBalloonText.h" +#include "UI/Text/TextWrapping.h" +#include "UI/Chat/UIWhisperWnd.h" +#include "UI/Chat/UINewChatWnd.h" +#include "UI/Window/UIChatRoomWnd.h" +#include "UI/Shortcuts/ShortcutVisibility.h" namespace { #pragma pack(push, 1) @@ -1557,6 +1562,122 @@ int UIWindowMgr::LoadReplayWindows(const std::vector& data) { return static_cast(offset); } +// OFFSET: 0x00AA9100 +// FUNCTION: fn_17253 +int UIWindowMgr::SendNotice(int selector, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d, std::intptr_t e) { + const char* text = reinterpret_cast(a); + switch (selector) { + case 1: + case 19: { + if (g_replayAnimationScaling != 0 && !Replay::Instance().header.options.recordRestricted) { + break; + } + std::uint32_t color = static_cast(b); + if (this->window_01C8 != nullptr) { + if (color == 0) { + color = 0xFFFFFF; + } + if (std::strcmp(text, "No Msg") != 0 && std::strcmp(text, "NO MSG") != 0) { + this->window_01C8->SendMsg(nullptr, selector == 19 ? 115 : 37, a, color, c, d); + } + break; + } + if (color == 0) { + color = 0xFFFFFF; + } + std::vector lines; + WrapPlainText(text, lines, 94, 0); + for (unsigned int index = 0; index < lines.size(); ++index) { + std::string line; + line = lines[index]; + this->unknown_04C4.push_back({line, color}); + } + break; + } + case 2: + if (this->window_01C8 != nullptr) { + this->window_01C8->SendMsg(nullptr, 15, a, 0, 0, 0); + } + break; + case 3: + reinterpret_cast(*this).Show(1, 1); + if (this->window_01C8 != nullptr) { + this->window_01C8->SendMsg(nullptr, 16, 0, 0, 0, 0); + } + break; + case 4: + if (this->unknown_01BC != nullptr) { + this->unknown_01BC->SendMsg(nullptr, 17, a, 0, 0, 0); + } + break; + case 5: + if (this->window_027C != nullptr) { + this->window_027C->SendMsg(nullptr, 37, a, b, 0, 0); + } + break; + case 6: + if (this->window_01C8 != nullptr) { + static_cast(this->window_01C8)->SaveChatLogs(); + } + break; + case 7: + if (this->window_027C != nullptr) { + static_cast(this->window_027C)->SaveChatLog(); + } + break; + case 8: + case 9: + this->sub_A978D0(51)->SendMsg(nullptr, 65, a, b, 0, 0); + break; + case 10: + this->CloseWindow(51); + break; + case 14: { + std::string name(text); + if (this->namedWindows.find(name) != this->namedWindows.end()) { + return 0; + } + UIWhisperWnd* window = new UIWhisperWnd(*reinterpret_cast(nullptr), *reinterpret_cast(nullptr)); + window->SetSize(280, 120); + this->rendered.push_back(window); + window->SendMsg(nullptr, 34, reinterpret_cast(&this->m_whisperPlacement), 0, 0, 0); + window->Show(1); + window->m_target = name; + window->SetId(67); + if (b == 0) { + window->m_name = name; + } else { + window->m_name = name + " (" + reinterpret_cast(b) + ") *^_^*"; + } + if (c != 0) { + window->m_code = std::string(reinterpret_cast(c)); + } + const int count = static_cast(this->namedWindows.size()); + if (count != 0) { + const int offset = count * 17; + const int x = this->m_whisperPlacement.x + offset; + const int y = this->m_whisperPlacement.y + offset; + if (x > 0 && this->m_whisperPlacement.width + x < g_renderer->viewport.width - 17 && y > 0 && + this->m_whisperPlacement.height + y < g_renderer->viewport.height - 17) { + window->Move(x, y); + } else if (offset > 0 && this->m_whisperPlacement.width + offset < g_renderer->viewport.width - 17 && + this->m_whisperPlacement.height + offset < g_renderer->viewport.height - 17) { + window->Move(offset, offset); + } + } + this->RegisterNamedWindow(name, window); + this->AddWhisperName(name.c_str()); + return 1; + } + case 154: + for (auto it = this->namedWindows.begin(); it != this->namedWindows.end(); ++it) { + it->second->SendMsg(nullptr, 154, a, 0, 0, 0); + } + break; + } + return 0; +} + // OFFSET: 0x00AA8F50 // FUNCTION: fn_17252 void UIWindowMgr::BroadcastMessage21() { diff --git a/Source/UI/Window/UIWindowMgr.h b/Source/UI/Window/UIWindowMgr.h index 31b80432..9fdf66ea 100644 --- a/Source/UI/Window/UIWindowMgr.h +++ b/Source/UI/Window/UIWindowMgr.h @@ -1,6 +1,7 @@ #ifndef RAGNAROK_SOURCE_UI_WINDOW_UIWINDOWMGR_H #define RAGNAROK_SOURCE_UI_WINDOW_UIWINDOWMGR_H +#include "Contents/UserData/NormalItemSlots.h" #include "UI/Layout/SnapRectangle.h" #include @@ -151,7 +152,7 @@ public: /* 01A0 */ UIWindow* hoverWindow; /* 01A4 */ std::deque modalWindows; /* 01B8 */ UIWindow* window_01B8; - /* 01BC */ std::uint32_t unknown_01BC; + /* 01BC */ UIWindow* unknown_01BC; /* 01C0 */ UIWindow* unknown_01C0; /* 01C4 */ UIWindow* unknown_01C4; /* 01C8 */ UIWindow* window_01C8; @@ -361,7 +362,9 @@ public: /* 077C */ int unknown_077C; /* 0780 */ unsigned char unknown_0780[0x10]; /* 0790 */ int unknown_0790; - /* 0794 */ unsigned char unknown_0794[0x158]; + /* 0794 */ unsigned char unknown_0794[0xB4]; + /* 0848 */ WindowPlacement m_whisperPlacement; + /* 0858 */ unsigned char unknown_0858[0x94]; /* 08EC */ int unknown_08EC; /* 08F0 */ unsigned char unknown_08F0[0x20]; /* 0910 */ int unknown_0910;