From 674b54cbcecb340fdb9a012b03074d7c8f0ef17b Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Fri, 30 Oct 2026 03:25:15 +0000 Subject: [PATCH] Decompile 6 functions in Source/UI/Window/UIBattleMsgOptionWnd.cpp, Source/UI/Window/UIBattleMsgOptionWnd.h, ... Batch #4473 by youko: 0 byte-identical, 6 confirmed by peer review. - fn_12606 UIBattleMsgOptionWnd::RowAt: logic confirmed by peer review - fn_12614 UIQuickSlotWnd::SlotX: logic confirmed by peer review - fn_12615 UIQuickSlotWnd::SlotAt: logic confirmed by peer review - fn_12619 UISubChatHisWnd::Slot42: logic confirmed by peer review - fn_12611 SetRoMapMarker: logic confirmed by peer review - fn_12622 UIRoMapWnd::ClearRecords: logic confirmed by peer review Peer-reviewed-by: eAthena, willerthal, KWDev Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Chat/UISubChatHisWnd.cpp | 7 +++++ Source/UI/Chat/UISubChatHisWnd.h | 19 +++++++++++++- Source/UI/Shortcuts/ShortcutCooldowns.cpp | 27 ++++++++++++++++++++ Source/UI/Shortcuts/UIQuickSlotWnd.h | 2 ++ Source/UI/Window/UIBattleMsgOptionWnd.cpp | 22 ++++++++++++++++ Source/UI/Window/UIBattleMsgOptionWnd.h | 1 + Source/UI/Window/UIRoMapWnd.cpp | 30 ++++++++++++++++++++++ Source/UI/Window/UIRoMapWnd.h | 31 +++++++++++++++++++++++ 8 files changed, 138 insertions(+), 1 deletion(-) diff --git a/Source/UI/Chat/UISubChatHisWnd.cpp b/Source/UI/Chat/UISubChatHisWnd.cpp index a7d6ff04..0a89d6eb 100644 --- a/Source/UI/Chat/UISubChatHisWnd.cpp +++ b/Source/UI/Chat/UISubChatHisWnd.cpp @@ -10,3 +10,10 @@ // OFFSET: 0x009309B0 // OFFSET: 0x00931710 + +// OFFSET: 0x0091C9E0 +// FUNCTION: fn_12619 +bool UISubChatHisWnd::Slot42(void* output) { + *static_cast(output) = this->m_state; + return true; +} diff --git a/Source/UI/Chat/UISubChatHisWnd.h b/Source/UI/Chat/UISubChatHisWnd.h index 5d9f5cf1..e39f0f12 100644 --- a/Source/UI/Chat/UISubChatHisWnd.h +++ b/Source/UI/Chat/UISubChatHisWnd.h @@ -5,14 +5,27 @@ class UIEditCtrl; +struct SubChatHistoryState { + /* 0000 */ int unknown_0000; + /* 0004 */ int unknown_0004; + /* 0008 */ int unknown_0008; + /* 000C */ int unknown_000C; + /* 0010 */ int unknown_0010; + /* 0014 */ int unknown_0014; + /* 0018 */ int unknown_0018; +}; + class UISubChatHisWnd : public UIFrameWnd { public: void Slot25(int x, int y) override; void Slot26(int x, int y) override; void Slot31(int x, int y) override; + bool Slot42(void* output) override; private: - /* 00B4 */ unsigned char unknown_00B4[0x34]; + /* 00B4 */ unsigned char unknown_00B4[0xC]; + /* 00C0 */ SubChatHistoryState m_state; + /* 00DC */ unsigned char unknown_00DC[0xC]; /* 00E8 */ int m_inputHeight; /* 00EC */ int m_inputWidth; /* 00F0 */ int unknown_00F0; @@ -21,4 +34,8 @@ private: /* 012C */ UIEditCtrl* m_edit; }; +#if defined(_WIN32) && !defined(_WIN64) +static_assert(sizeof(SubChatHistoryState) == 0x1C); +#endif + #endif diff --git a/Source/UI/Shortcuts/ShortcutCooldowns.cpp b/Source/UI/Shortcuts/ShortcutCooldowns.cpp index 4df61850..3bcd873e 100644 --- a/Source/UI/Shortcuts/ShortcutCooldowns.cpp +++ b/Source/UI/Shortcuts/ShortcutCooldowns.cpp @@ -343,6 +343,33 @@ void UIQuickSlotWnd::Slot19() { this->Invalidate(); } +// OFFSET: 0x0091C4D0 +// FUNCTION: fn_12614 +int UIQuickSlotWnd::SlotX(int slot) { + for (int index = 0; index < 2; ++index) { + if (index == slot) { + return index * 29 + 5; + } + } + + return -1; +} + +// OFFSET: 0x0091C500 +// FUNCTION: fn_12615 +int UIQuickSlotWnd::SlotAt(int x, int y) { + if (y < 0 || y >= 24 || (x > 58 && x < this->geometry.width)) { + return -1; + } + + const int index = (x - 4) / 29; + if (x > index * 29 + 30) { + return -1; + } + + return index; +} + // OFFSET: 0x00932E90 // FUNCTION: fn_12719 void UISeekPartyWnd::Slot19() { diff --git a/Source/UI/Shortcuts/UIQuickSlotWnd.h b/Source/UI/Shortcuts/UIQuickSlotWnd.h index d8fa1c86..60d42b5d 100644 --- a/Source/UI/Shortcuts/UIQuickSlotWnd.h +++ b/Source/UI/Shortcuts/UIQuickSlotWnd.h @@ -39,6 +39,8 @@ class UIQuickSlotWnd : public UIFrameWnd { public: void Slot19() override; void Paint() override; + int SlotX(int slot); + int SlotAt(int x, int y); protected: /* 00B4 */ int m_selected; diff --git a/Source/UI/Window/UIBattleMsgOptionWnd.cpp b/Source/UI/Window/UIBattleMsgOptionWnd.cpp index b89d569c..7362faa9 100644 --- a/Source/UI/Window/UIBattleMsgOptionWnd.cpp +++ b/Source/UI/Window/UIBattleMsgOptionWnd.cpp @@ -3,6 +3,8 @@ #include "Contents/MessageTable.h" #include "UI/Lists/UIScrollBar.h" +#include + // OFFSET: 0x009335E0 // FUNCTION: fn_12726 void UIBattleMsgOptionWnd::Slot35(int delta) { @@ -56,4 +58,24 @@ UIBattleMsgOptionWnd::UIBattleMsgOptionWnd(UIWindowContext& windows, UIFrameCont this->text = LookupMessage(0x509); } +// OFFSET: 0x0091BA20 +// FUNCTION: fn_12606 +int UIBattleMsgOptionWnd::RowAt(int x, int y) { + if (x >= 0 && y >= 17 && y < this->m_visibleRows * 20 + 17) { + const int column = x / this->geometry.width; + int row = 0; + int index = 0; + for (std::vector::iterator it = this->messages.begin(); it != this->messages.end(); ++it, ++index) { + if (std::strcmp(LookupMessage(0x60D), *it) != 0 && index >= this->unknown_00C4) { + if (row == (y - 17) / 20 + column) { + return index; + } + ++row; + } + } + } + + return -1; +} + // OFFSET: 0x009305F0 diff --git a/Source/UI/Window/UIBattleMsgOptionWnd.h b/Source/UI/Window/UIBattleMsgOptionWnd.h index 5dc44822..7c20cac0 100644 --- a/Source/UI/Window/UIBattleMsgOptionWnd.h +++ b/Source/UI/Window/UIBattleMsgOptionWnd.h @@ -13,6 +13,7 @@ public: UIBattleMsgOptionWnd(UIWindowContext& windows, UIFrameContext& frames); void Slot26(int x, int y) override; void Slot35(int delta) override; + int RowAt(int x, int y); /* 00B4 */ UIScrollBar* m_scrollBar; /* 00B8 */ int unknown_00B8; diff --git a/Source/UI/Window/UIRoMapWnd.cpp b/Source/UI/Window/UIRoMapWnd.cpp index 58935813..5fd76208 100644 --- a/Source/UI/Window/UIRoMapWnd.cpp +++ b/Source/UI/Window/UIRoMapWnd.cpp @@ -1,6 +1,36 @@ #include "UI/Window/UIRoMapWnd.h" +#include "Contents/MapSkyMgr.h" + // OFFSET: 0x00931080 // FUNCTION: fn_12697 void UIRoMapWnd::Slot25(int, int) { } + +// OFFSET: 0x0091BE80 +// FUNCTION: fn_12611 +void SetRoMapMarker(std::string name, const WorldViewArea& area, RoMapMarker& marker) { + const int width = area.right - area.left; + const int height = area.bottom - area.top; + const float centerX = static_cast(width) * g_depthAverageHalf + static_cast(area.left); + const float centerY = static_cast(height) * g_depthAverageHalf + static_cast(area.top); + + marker.name = name; + marker.area = area; + marker.centerX = centerX; + marker.centerY = centerY; + marker.width = static_cast(width); + marker.height = static_cast(height); +} + +// OFFSET: 0x0091CF40 +// FUNCTION: fn_12622 +void UIRoMapWnd::ClearRecords() { + this->m_records.clear(); + this->unknown_00D0 = 0; + this->unknown_00C4 = 0; + this->unknown_00C8 = 0; + this->unknown_00C0 = 0; + this->unknown_00BC = 0; + this->unknown_00CC = 0; +} diff --git a/Source/UI/Window/UIRoMapWnd.h b/Source/UI/Window/UIRoMapWnd.h index 3b235eda..fbb5422f 100644 --- a/Source/UI/Window/UIRoMapWnd.h +++ b/Source/UI/Window/UIRoMapWnd.h @@ -1,11 +1,42 @@ #ifndef RAGNAROK_SOURCE_UI_WINDOW_UIROMAPWND_H #define RAGNAROK_SOURCE_UI_WINDOW_UIROMAPWND_H +#include "Contents/WorldView/WorldViewData.h" #include "UI/Window/UIFrameWnd.h" +#include +#include + +struct RoMapMarker { + /* 0000 */ std::string name; + /* 0018 */ WorldViewArea area; + /* 002C */ float centerX; + /* 0030 */ float centerY; + /* 0034 */ float width; + /* 0038 */ float height; +}; + +void SetRoMapMarker(std::string name, const WorldViewArea& area, RoMapMarker& marker); + class UIRoMapWnd : public UIFrameWnd { public: void Slot25(int x, int y) override; + void ClearRecords(); + +private: + /* 00B4 */ std::list m_records; + /* 00BC */ int unknown_00BC; + /* 00C0 */ int unknown_00C0; + /* 00C4 */ int unknown_00C4; + /* 00C8 */ int unknown_00C8; + /* 00CC */ unsigned char unknown_00CC; + /* 00D0 */ int unknown_00D0; }; +#if defined(_WIN32) && !defined(_WIN64) +static_assert(sizeof(RoMapMarker) == 0x3C); +static_assert(offsetof(RoMapMarker, area) == 0x18); +static_assert(offsetof(RoMapMarker, centerX) == 0x2C); +#endif + #endif