From 7b5f29a7ef4351e60413e663a1aeda89ac774023 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Wed, 11 Nov 2026 12:05:23 +0000 Subject: [PATCH] Decompile 10 functions in Source/UI/GameSettings/UIHotKeyWnd.cpp, Source/UI/Items/UIMerchantItemLogWnd.cpp, ... Batch #16976 by KWDev: 10 byte-identical, 0 confirmed by peer review. - fn_12740 UIHotKeyWnd::SaveHotkeys: byte-identical - fn_13575 UIMerchantItemLogWnd::OnCreate: byte-identical - fn_13578 UIMerchantItemLogWnd::OnProcess: byte-identical - fn_09912 UIRefining_Notice::Paint: byte-identical - fn_11504 UIWindow::WrapLinkText: byte-identical - fn_09228 UIAchListWnd::OnLBtnDown: byte-identical - fn_16914 UIWindow::UIWindow: byte-identical - fn_12099 UIWindow::DrawTitleBarAt: byte-identical - fn_07560 NAsyncWorkPtr::NAsyncWorkPtr: byte-identical - fn_10163 UIRuneSetinfoList::AddLine: byte-identical (already on main) Merged automatically: every function is byte-identical to the original. --- Source/UI/GameSettings/UIHotKeyWnd.cpp | 6 ++++-- Source/UI/Items/UIMerchantItemLogWnd.cpp | 5 +++-- Source/UI/Items/UIRefiningWnd.cpp | 6 +++--- Source/UI/RuneSystem/UIRuneSystemWindows.h | 2 +- Source/UI/RuneSystem/UIRuneSystemWnd.h | 2 +- Source/UI/Text/PixelTextWrapping.cpp | 10 +++++----- Source/UI/Text/UITextViewer.cpp | 4 ++-- Source/UI/Window/UIWindow.cpp | 7 +++++-- Source/UI/Window/WindowTitlebar.cpp | 3 ++- Source/Utility/Async/NAsyncWork.cpp | 4 ++-- 10 files changed, 28 insertions(+), 21 deletions(-) diff --git a/Source/UI/GameSettings/UIHotKeyWnd.cpp b/Source/UI/GameSettings/UIHotKeyWnd.cpp index b9c3defa6..cbe9d7c9f 100644 --- a/Source/UI/GameSettings/UIHotKeyWnd.cpp +++ b/Source/UI/GameSettings/UIHotKeyWnd.cpp @@ -195,8 +195,10 @@ void UIHotKeyWnd::SetHotkey(int tab, int index, HotkeyInfo info) { // OFFSET: 0x00934360 // FUNCTION: fn_12740 void UIHotKeyWnd::SaveHotkeys() { - for (unsigned int tab = 0; tab < 4; ++tab) { - for (const auto& entry : this->hotkeys[tab]) { + unsigned int tab = 0; + std::map* tables = this->hotkeys; + for (; tab < 4; ++tab) { + for (const auto& entry : tables[tab]) { g_session.m_hotkeyScript->Call("ChangeUserHotKey", "ddsdd", tab + 1, entry.first, entry.second.description.c_str(), entry.second.key1, entry.second.key2); if (tab == 1) { g_windowMgr.RefreshGameSettingHotkeys(); diff --git a/Source/UI/Items/UIMerchantItemLogWnd.cpp b/Source/UI/Items/UIMerchantItemLogWnd.cpp index 1ac2e26e1..7783ec17c 100644 --- a/Source/UI/Items/UIMerchantItemLogWnd.cpp +++ b/Source/UI/Items/UIMerchantItemLogWnd.cpp @@ -43,7 +43,8 @@ UIMerchantItemLogWnd::UIMerchantItemLogWnd(int mode) : UIItemBaseWnd() { void UIMerchantItemLogWnd::OnCreate(int width, int height) { UIStaticText* title = new UIStaticText(); title->SetSize(160, 15); - title->SetText(LookupMessage(2559 + (this->mode != 0)), 0); + const char* text = LookupMessage(2559 + (this->mode != 0)); + title->SetText(text, 0); title->Move(16, 2); title->shadow = 1; this->AddChild(title); @@ -194,7 +195,7 @@ void UIMerchantItemLogWnd::OnProcess() { } } - if (changed) { + if (changed == true) { this->Invalidate(); } } diff --git a/Source/UI/Items/UIRefiningWnd.cpp b/Source/UI/Items/UIRefiningWnd.cpp index e7c5ddd03..032856fd7 100644 --- a/Source/UI/Items/UIRefiningWnd.cpp +++ b/Source/UI/Items/UIRefiningWnd.cpp @@ -409,11 +409,11 @@ void UIRefining_Notice::Paint() { std::list lines; this->WrapFormattedText(this->text, &lines, this->geometry.width - 18, 0, 11, 0); - int offset = 0; + int row = 0; for (auto line = lines.begin(); line != lines.end(); ++line) { - this->DrawTextAt(18, static_cast((this->geometry.height - lines.size() * 11) * 0.5 + offset), line->c_str(), 0, 0, 11, color, 0, 0 + this->DrawTextAt(18, static_cast((this->geometry.height - lines.size() * 11) * 0.5 + row * 11), line->c_str(), 0, 0, 11, color, 0, 0 ); - offset += 11; + ++row; } } } diff --git a/Source/UI/RuneSystem/UIRuneSystemWindows.h b/Source/UI/RuneSystem/UIRuneSystemWindows.h index 2eba92156..28de75091 100644 --- a/Source/UI/RuneSystem/UIRuneSystemWindows.h +++ b/Source/UI/RuneSystem/UIRuneSystemWindows.h @@ -120,9 +120,9 @@ public: struct RuneSetInfoLine { // INLINED RuneSetInfoLine(std::string value, std::uint32_t lineColor, bool lineBold, int lineX) { - this->text = value; this->color = lineColor; this->bold = lineBold; + this->text = value; this->x = lineX; } diff --git a/Source/UI/RuneSystem/UIRuneSystemWnd.h b/Source/UI/RuneSystem/UIRuneSystemWnd.h index bc82b7be7..91e9ba609 100644 --- a/Source/UI/RuneSystem/UIRuneSystemWnd.h +++ b/Source/UI/RuneSystem/UIRuneSystemWnd.h @@ -122,9 +122,9 @@ public: struct RuneSetInfoLine { // INLINED RuneSetInfoLine(std::string value, std::uint32_t lineColor, bool lineBold, int lineX) { - this->text = value; this->color = lineColor; this->bold = lineBold; + this->text = value; this->x = lineX; } diff --git a/Source/UI/Text/PixelTextWrapping.cpp b/Source/UI/Text/PixelTextWrapping.cpp index fed79525b..2c1cbf4b2 100644 --- a/Source/UI/Text/PixelTextWrapping.cpp +++ b/Source/UI/Text/PixelTextWrapping.cpp @@ -133,14 +133,14 @@ void UIWindow::WrapPixelText(const char* text, std::vector& lines, // OFFSET: 0x008932D0 // FUNCTION: fn_11504 void UIWindow::WrapLinkText(int* kind, std::vector* lines, const std::string& text) { - int width = this->geometry.width; + const int width = this->geometry.width; if (*kind != 3) { - width -= 16; - this->WrapPixelText(text.c_str(), *lines, width); + const int inner = width - 16; + this->WrapPixelText(text.c_str(), *lines, inner); return; } - width -= 24; + const int inner = width - 24; std::vector wrapped; - this->WrapTextWithBreaks(text.c_str(), lines, &wrapped, width); + this->WrapTextWithBreaks(text.c_str(), lines, &wrapped, inner); } diff --git a/Source/UI/Text/UITextViewer.cpp b/Source/UI/Text/UITextViewer.cpp index 09b542c84..a61a261ae 100644 --- a/Source/UI/Text/UITextViewer.cpp +++ b/Source/UI/Text/UITextViewer.cpp @@ -110,12 +110,12 @@ void UITextViewer::OnLBtnDblClk(int, int) { // OFFSET: 0x007B78D0 // FUNCTION: fn_09228 void UIAchListWnd::OnLBtnDown(int x, int y) { - if (x < 0 || x > this->geometry.width - this->scrollBarWidth) { + if (x < 0 || this->geometry.width - this->scrollBarWidth < x) { return; } const int row = y / this->rowHeight; - if (static_cast(row) >= static_cast(this->achievementList->count)) { + if (static_cast(this->achievementList->count) <= static_cast(row)) { return; } diff --git a/Source/UI/Window/UIWindow.cpp b/Source/UI/Window/UIWindow.cpp index 57ec476f7..0e9606535 100644 --- a/Source/UI/Window/UIWindow.cpp +++ b/Source/UI/Window/UIWindow.cpp @@ -161,8 +161,11 @@ int __fastcall sub_5C22F0(const int* object) { // OFFSET: 0x00A79A90 // FUNCTION: fn_16914 UIWindow::UIWindow(unsigned char cached) - : parent(nullptr), hasTextBackground(0), textBackgroundColor(0), renderLayer(4), m_dirty(1), m_clip(0) { - this->m_uid = ++g_windowUid; + : parent(nullptr), hasTextBackground(0), textBackgroundColor(0), renderLayer(4), m_dirty(1) { + const std::uint32_t uid = g_windowUid + 1; + this->m_clip = 0; + g_windowUid = uid; + this->m_uid = uid; this->m_cached = cached; } diff --git a/Source/UI/Window/WindowTitlebar.cpp b/Source/UI/Window/WindowTitlebar.cpp index e57656261..50ebd775c 100644 --- a/Source/UI/Window/WindowTitlebar.cpp +++ b/Source/UI/Window/WindowTitlebar.cpp @@ -78,8 +78,9 @@ int UIWindow::DrawTitleBarAt(int x, int width, bool closeButton, const char* tit const int extent = width - right - left; const int count = extent / middleWidth + (extent % middleWidth != 0); + const int start = x + left; for (int index = 0; index < count; ++index) { - this->DrawBitmap(x + left + index * middleWidth, 0, middle, false); + this->DrawBitmap(start + index * middleWidth, 0, middle, false); } } diff --git a/Source/Utility/Async/NAsyncWork.cpp b/Source/Utility/Async/NAsyncWork.cpp index fc88b0d80..aca73feaa 100644 --- a/Source/Utility/Async/NAsyncWork.cpp +++ b/Source/Utility/Async/NAsyncWork.cpp @@ -29,8 +29,8 @@ NAsyncWorkPtr::NAsyncWorkPtr(NAsyncWorkPtr& other) : m_manager(other.m_manager), // OFFSET: 0x00731AC0 // FUNCTION: fn_07560 NAsyncWorkPtr::NAsyncWorkPtr(NRecycleObjectPoolMgr* manager, std::string poolName) : m_manager(manager), m_work(nullptr) { - if (manager) { - this->m_work = static_cast(manager->Acquire(poolName)); + if (this->m_manager) { + this->m_work = static_cast(this->m_manager->Acquire(poolName)); } }