From 3cd37e7d47e70e3c46aaa0f0b224922b36da1198 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Fri, 30 Oct 2026 11:09:23 +0000 Subject: [PATCH] Decompile 7 functions in Source/UI/Window/UIWindowMgr.cpp, Source/UI/Window/UIWindowMgr.h Batch #5342 by eAthena: 0 byte-identical, 7 confirmed by peer review. - fn_17240 UIWindowMgr::CenterSurface0478: logic confirmed by peer review - fn_17242 UIWindowMgr::SaveReplaySettings: logic confirmed by peer review - fn_17243 UIWindowMgr::SaveReplayReserved: logic confirmed by peer review - fn_17245 UIWindowMgr::ApplyReplayOptions: logic confirmed by peer review - fn_17247 UIWindowMgr::LoadReplaySettings: logic confirmed by peer review - fn_17248 UIWindowMgr::LoadReplayReserved: logic confirmed by peer review - fn_17252 UIWindowMgr::BroadcastMessage21: logic confirmed by peer review Peer-reviewed-by: meitogi, Millenium, Snow Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Window/UIWindowMgr.cpp | 172 ++++++++++++++++++++++++++++++- Source/UI/Window/UIWindowMgr.h | 28 ++++- 2 files changed, 197 insertions(+), 3 deletions(-) diff --git a/Source/UI/Window/UIWindowMgr.cpp b/Source/UI/Window/UIWindowMgr.cpp index c724c95c..2f08fc7a 100644 --- a/Source/UI/Window/UIWindowMgr.cpp +++ b/Source/UI/Window/UIWindowMgr.cpp @@ -11,14 +11,14 @@ #include "UI/Window/MiniPartyWndAreaMgr.h" #include "UI/Window/UIWindow.h" #include "UI/Window/UIWindowMgr.h" - +#include "Render/DeviceContext/DCSurface.h" #include #include #include #include #include #include - +#include "Render/Textures/Surface.h" namespace { #pragma pack(push, 1) struct AddFriendPacket { @@ -779,3 +779,171 @@ void UIWindowMgr::ShowWindowsWithId(int id, unsigned char show) { } } } + +namespace { + +#pragma pack(push, 1) +struct ReplaySettingHeader { + /* 0000 */ std::int16_t tag; + /* 0002 */ int size; + + ReplaySettingHeader() : tag(0), size(0) { + } + + ~ReplaySettingHeader() { + this->tag = 0; + this->size = 0; + } + + void Read(const unsigned char* source) { + this->size = 0; + this->tag = 0; + std::memcpy(this, source, sizeof(*this)); + } +}; +#pragma pack(pop) + +static_assert(sizeof(ReplaySettingHeader) == 6); + +} + +// OFFSET: 0x00AA80A0 +// FUNCTION: fn_17240 +void UIWindowMgr::CenterSurface0478() { + this->unknown_04FC = 0; + if (this->unknown_0478) { + int x = static_cast(GetRenderSystemHolder()->Width() - this->unknown_047C) / 2; + int height = this->unknown_0480; + int y = static_cast(GetRenderSystemHolder()->Height() - height) / 2; + reinterpret_cast(this->unknown_0478)->Stretch(x, y, this->unknown_047C, height); + } +} + +// OFFSET: 0x00AA8130 +// FUNCTION: fn_17242 +std::vector UIWindowMgr::SaveReplaySettings() { + std::vector data; + { + std::vector chunk(6); + *reinterpret_cast(&chunk[0]) = 25000; + *reinterpret_cast(&chunk[2]) = 0; + data.insert(data.end(), chunk.begin(), chunk.end()); + } + { + std::vector chunk(10); + *reinterpret_cast(&chunk[0]) = 25010; + *reinterpret_cast(&chunk[2]) = 4; + *reinterpret_cast(&chunk[6]) = this->unknown_0064; + data.insert(data.end(), chunk.begin(), chunk.end()); + } + { + std::vector chunk(6); + *reinterpret_cast(&chunk[0]) = 25001; + *reinterpret_cast(&chunk[2]) = 0; + data.insert(data.end(), chunk.begin(), chunk.end()); + } + return data; +} + +// OFFSET: 0x00AA8440 +// FUNCTION: fn_17243 +std::vector UIWindowMgr::SaveReplayReserved() { + std::vector data; + { + std::vector chunk(6); + *reinterpret_cast(&chunk[0]) = 26000; + *reinterpret_cast(&chunk[2]) = 0; + data.insert(data.end(), chunk.begin(), chunk.end()); + } + { + std::vector chunk(6); + *reinterpret_cast(&chunk[0]) = 26001; + *reinterpret_cast(&chunk[2]) = 0; + data.insert(data.end(), chunk.begin(), chunk.end()); + } + return data; +} + +// OFFSET: 0x00AA8980 +// FUNCTION: fn_17245 +void UIWindowMgr::ApplyReplayOptions(const ReplayOptions& options) { + this->unknown_05A4 = 0; + this->unknown_0588 = 0; + this->unknown_0568 = 0; + this->unknown_054C = 0; + this->unknown_073C = 0; + this->unknown_077C = 0; + this->unknown_05BC = 0; + this->unknown_05D0 = 0; + this->unknown_0758 = options.unknown_0007; + this->unknown_003C = options.recordRestricted; +} + +// OFFSET: 0x00AA8B20 +// FUNCTION: fn_17247 +int UIWindowMgr::LoadReplaySettings(const std::vector& data) { + if (data.empty()) { + return -1; + } + + ReplaySettingHeader header; + unsigned offset = 6; + header.Read(data.data()); + if (header.tag != 25000) { + offset = static_cast(-1); + } else { + while (offset < data.size()) { + header.Read(data.data() + offset); + offset += 6; + if (header.tag == 25001) { + break; + } + if (header.tag == 25010) { + std::memcpy(&this->unknown_0064, data.data() + offset, header.size); + } + offset += header.size; + } + } + return static_cast(offset); +} + +// OFFSET: 0x00AA8C30 +// FUNCTION: fn_17248 +int UIWindowMgr::LoadReplayReserved(const std::vector& data) { + if (data.empty()) { + return -1; + } + + ReplaySettingHeader header; + unsigned offset = 6; + header.Read(data.data()); + if (header.tag != 26000) { + offset = static_cast(-1); + } else { + while (offset < data.size()) { + header.Read(data.data() + offset); + offset += 6; + if (header.tag == 26001) { + break; + } + offset += header.size; + } + } + return static_cast(offset); +} + +// OFFSET: 0x00AA8F50 +// FUNCTION: fn_17252 +void UIWindowMgr::BroadcastMessage21() { + UIWindow* window = this->window_03DC; + if (window || (window = this->unknown_03B0) != nullptr) { + window->SendMsg(nullptr, 21, 0, 0, 0, 0); + return; + } + + for (UIWindow* rendered : this->rendered) { + if (rendered->Slot02()) { + rendered->SendMsg(nullptr, 21, 0, 0, 0, 0); + } + } +} diff --git a/Source/UI/Window/UIWindowMgr.h b/Source/UI/Window/UIWindowMgr.h index 0bb32841..c6c2181a 100644 --- a/Source/UI/Window/UIWindowMgr.h +++ b/Source/UI/Window/UIWindowMgr.h @@ -17,6 +17,7 @@ class UIWindow; class CWebBrowser; struct MessengerMember; +struct ReplayOptions; struct WindowTextEntry { /* 0000 */ std::string text; @@ -350,7 +351,25 @@ public: /* 050C */ std::list hiddenWindows; /* 0514 */ unsigned char unknown_0514[0x12]; /* 0526 */ bool unknown_0526; - /* 0527 */ unsigned char unknown_0527[0x49D]; + /* 0527 */ unsigned char unknown_0527[0x25]; + /* 054C */ int unknown_054C; + /* 0550 */ unsigned char unknown_0550[0x18]; + /* 0568 */ int unknown_0568; + /* 056C */ unsigned char unknown_056C[0x1C]; + /* 0588 */ int unknown_0588; + /* 058C */ unsigned char unknown_058C[0x18]; + /* 05A4 */ int unknown_05A4; + /* 05A8 */ unsigned char unknown_05A8[0x14]; + /* 05BC */ int unknown_05BC; + /* 05C0 */ unsigned char unknown_05C0[0x10]; + /* 05D0 */ int unknown_05D0; + /* 05D4 */ unsigned char unknown_05D4[0x168]; + /* 073C */ int unknown_073C; + /* 0740 */ unsigned char unknown_0740[0x18]; + /* 0758 */ int unknown_0758; + /* 075C */ unsigned char unknown_075C[0x20]; + /* 077C */ int unknown_077C; + /* 0780 */ unsigned char unknown_0780[0x244]; /* 09C4 */ std::map browsers; /* 09CC */ int unknown_09CC; /* 09D0 */ CWebBrowser* browser_09D0; @@ -484,6 +503,13 @@ public: bool HasNavigationBlocker(); bool HasPendingDialog(); void CancelActiveDialog(); + void CenterSurface0478(); + std::vector SaveReplaySettings(); + std::vector SaveReplayReserved(); + void ApplyReplayOptions(const ReplayOptions& options); + int LoadReplaySettings(const std::vector& data); + int LoadReplayReserved(const std::vector& data); + void BroadcastMessage21(); }; extern UIWindowMgr g_windowMgr;