Decompile 6 functions in Source/UI/Window/UIWindowMgr.cpp, Source/UI/Window/UIWindow.cpp, ...

Batch #17363 by eAthena: 0 byte-identical, 6 confirmed by peer review.

- fn_16944 UIWindow::FlushPrimitives: logic confirmed by peer review
- fn_20963 CooldownDrawing::SubmitNormal: logic confirmed by peer review
- fn_17238 UIWindowMgr::DrawWindows: logic confirmed by peer review
- fn_17223 UIWindowMgr::ProcessKeyDown: logic confirmed by peer review
- fn_17233 UIWindowMgr::Shutdown: logic confirmed by peer review
- fn_17234 UIWindowMgr::ClearMapWindows: logic confirmed by peer review

Peer-reviewed-by: alisonrag, SapitoSucio, cremane
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
ragnarok-clanker 2026-11-11 22:07:32 +00:00
commit 9b8dbb21de
6 changed files with 99 additions and 89 deletions

View file

@ -59,5 +59,8 @@ extern template int std::_Traits_compare<std::char_traits<char>>(const char*, st
using SnapRectangleTree = std::_Tree<std::_Tmap_traits<UIWindow*, SnapRectangle, std::less<UIWindow*>, std::allocator<std::pair<UIWindow* const, SnapRectangle>>, false>>;
extern template std::_Tree_find_result<std::_Tree_node<std::pair<UIWindow* const, SnapRectangle>, void*>*>
SnapRectangleTree::_Find_lower_bound<UIWindow*>(UIWindow* const&) const;
using PersistentWindowTree = std::_Tree<std::_Tset_traits<UIWindow*, std::less<UIWindow*>, std::allocator<UIWindow*>, false>>;
extern template std::_Tree_find_result<std::_Tree_node<UIWindow*, void*>*>
PersistentWindowTree::_Find_lower_bound<UIWindow*>(UIWindow* const&) const;
extern template void std::vector<std::string>::push_back(std::string&&);
extern template std::string std::operator+(const std::string&, const char* const);

View file

@ -204,7 +204,7 @@ void CooldownDrawing::DrawReverse(CooldownState& value) {
// OFFSET: 0x00CA6670
// FUNCTION: fn_20963
void CooldownDrawing::SubmitNormal(RenderQueues& queues, bool depthAlpha, float depthStart, float depthEnd) {
void CooldownDrawing::SubmitNormal() {
Submit(this->normal);
}

View file

@ -15,7 +15,7 @@ struct CooldownDrawing {
void Draw(
int centerX, int centerY, int radiusX, int radiusY, CooldownState& value, int limit, int offsetX, int offsetY
);
void SubmitNormal(RenderQueues& queues, bool depthAlpha, float depthStart, float depthEnd);
void SubmitNormal();
void SubmitReverse(RenderQueues& queues, bool depthAlpha, float depthStart, float depthEnd);
private:

View file

@ -27,6 +27,7 @@
#include "Render/Primitives/RenderPrimitivePool.h"
#include "Render/Primitives/RenderQueues.h"
#include "Render/Renderer.h"
#include "Render/DX9/RendererDX9.h"
#include "Render/Textures/SpritePixels.h"
#include "Render/Text/TextContext.h"
#include "Render/Textures/Texture.h"
@ -80,11 +81,17 @@
#include <cstdio>
#include <cstring>
#include <functional>
#include <set>
#include <span>
#include <string>
#include <windows.h>
#include <timeapi.h>
template std::_Tree_find_result<std::_Tree_node<UIWindow*, void*>*>
std::_Tree<std::_Tset_traits<UIWindow*, std::less<UIWindow*>, std::allocator<UIWindow*>, false>>::_Find_lower_bound<UIWindow*>(
UIWindow* const&
) const;
namespace {
struct NavigationTargetLook {
/* 0000 */ int job;
@ -1152,9 +1159,9 @@ void UIWindow::DrawEmboldenedText(int x, int y, const char* text, std::uint32_t
// OFFSET: 0x00A7C470
// FUNCTION: fn_16944
void UIWindow::FlushPrimitives(RenderQueues& queues, bool depthAlpha, float depthStart, float depthEnd) {
void UIWindow::FlushPrimitives() {
for (RenderPrimitive* primitive : this->m_overlayPrimitives) {
queues.Submit(primitive, 513, depthAlpha, depthStart, depthEnd);
static_cast<CRendererDX9*>(g_renderer)->Submit(primitive, 513);
}
this->m_overlayPrimitives.clear();

View file

@ -151,7 +151,7 @@ public:
int x, int y, const std::string& text, int width, int lineSpacing, int align, int family, int height,
std::uint32_t color, unsigned char bold
);
void FlushPrimitives(RenderQueues& queues, bool depthAlpha, float depthStart, float depthEnd);
void FlushPrimitives();
void FillSurface(std::uint32_t color, const tagRECT* rectangle);
void WrapLinkText(int* kind, std::vector<std::string>* lines, const std::string& text);
void WrapTextWithBreaks(const char* text, std::vector<std::string>* lines, std::vector<bool>* breaks, int width);

View file

@ -380,10 +380,10 @@ void UIWindowMgr::DrawWindows() {
g_renderDiagnosticLine = 3850;
}
g_renderDiagnosticFile = g_windowManagerDiagnosticFile;
window->FlushPrimitives(g_renderer->queues, g_renderer->fog.supported != 0, g_depthStart, g_depthEnd);
window->FlushPrimitives();
g_renderDiagnosticLine = 3860;
g_renderDiagnosticFile = g_windowManagerDiagnosticFile;
g_cooldownOwner->Drawing().SubmitNormal(g_renderer->queues, g_renderer->fog.supported != 0, g_depthStart, g_depthEnd);
g_cooldownOwner->Drawing().SubmitNormal();
g_renderDiagnosticLine = 3866;
g_renderDiagnosticFile = g_windowManagerDiagnosticFile;
if (window == this->roulletteWnd) {
@ -948,10 +948,10 @@ void UIWindowMgr::Shutdown() {
}
for (UIWindow*& window : this->rendered) {
if (this->HasModalWindow() && this->persistentWindows.find(window) != this->persistentWindows.end()) {
if (this->HasModalWindow() && this->persistentWindows.count(window)) {
this->retainedPersistentWindow = true;
} else if (!this->HasModalWindow() || std::find(this->modalWindows.begin(), this->modalWindows.end(), window) == this->modalWindows.end()) {
if (this->persistentWindows.find(window) != this->persistentWindows.end()) {
if (this->persistentWindows.count(window)) {
this->persistentWindows.erase(window);
}
window->StoreInfo();
@ -1029,7 +1029,7 @@ void UIWindowMgr::ClearMapWindows() {
}
if (!this->modalWindows.empty() && this->modalWindows.back()) {
if (this->persistentWindows.find(window) != this->persistentWindows.end()) {
if (this->persistentWindows.count(window)) {
this->retainedPersistentWindow = true;
++entry;
continue;
@ -1576,104 +1576,104 @@ int UIWindowMgr::LoadReplayReserved(const std::vector<unsigned char>& data) {
// FUNCTION: fn_17223
bool UIWindowMgr::ProcessKeyDown(int key, int keyData, int pressed) {
this->imeInputActive = 1;
if (g_modeMgr.GetGameMode() == nullptr) {
return this->ProcessHotkeyAction(key, pressed);
}
if (this->LookupWindow(WID_HOTKEYWND) != nullptr) {
this->imeInputActive = 0;
} else if (!this->inputSuggestionsEnabled) {
UIWindow* hover = this->hoverWindow;
UIWindow* parent = hover ? hover->parent : nullptr;
if (!hover || !parent || parent == this->chatWnd || !parent->geometry.visible) {
if (g_modeMgr.GetGameMode() != nullptr) {
if (this->LookupWindow(WID_HOTKEYWND) != nullptr) {
this->imeInputActive = 0;
}
}
int action = this->TranslateHotkey(key, keyData);
if (this->hotkeyWnd != nullptr) {
static_cast<UIHotKeyWnd*>(this->hotkeyWnd)->AssignSelectedHotkey(action);
return false;
}
bool hoverOnButton = false;
if (this->inputSuggestionsEnabled) {
const UIWindow* window = this->chatWnd;
if (window) {
UIWindow* const* buttons = reinterpret_cast<UIWindow* const*>(reinterpret_cast<const char*>(window) + 0xBC);
if (this->hoverWindow == buttons[0] || this->hoverWindow == buttons[1]) {
hoverOnButton = true;
} else if (!this->inputSuggestionsEnabled) {
UIWindow* hover = this->hoverWindow;
UIWindow* parent = hover ? hover->parent : nullptr;
if (!hover || !parent || parent == this->chatWnd || !parent->geometry.visible) {
this->imeInputActive = 0;
}
}
}
if (!hoverOnButton) {
UIWindow* hover = this->hoverWindow;
if (hover) {
UIWindow* parent = hover->parent;
if (parent && parent != this->chatWnd && parent->geometry.visible) {
hoverOnButton = true;
int action = this->TranslateHotkey(key, keyData);
if (this->hotkeyWnd != nullptr) {
static_cast<UIHotKeyWnd*>(this->hotkeyWnd)->AssignSelectedHotkey(action);
return false;
}
bool hoverOnButton = false;
if (this->inputSuggestionsEnabled) {
const UIWindow* window = this->chatWnd;
if (window) {
UIWindow* const* buttons = reinterpret_cast<UIWindow* const*>(reinterpret_cast<const char*>(window) + 0xBC);
if (this->hoverWindow == buttons[0] || this->hoverWindow == buttons[1]) {
hoverOnButton = true;
}
}
}
if (!hoverOnButton) {
UIWindow* hover = this->hoverWindow;
if (hover) {
UIWindow* parent = hover->parent;
if (parent && parent != this->chatWnd && parent->geometry.visible) {
hoverOnButton = true;
}
}
}
}
if (hoverOnButton) {
if (this->modifierKey == 0) {
switch (this->keyCode) {
case VK_TAB:
case VK_RETURN:
case VK_SHIFT:
case VK_CONTROL:
case VK_MENU:
case VK_CAPITAL:
case VK_INSERT:
case VK_F1:
case VK_F2:
case VK_F3:
case VK_F4:
case VK_F5:
case VK_F6:
case VK_F7:
case VK_F8:
case VK_F9:
case VK_F10:
case VK_F11:
case VK_F12:
break;
default:
return this->ProcessHotkeyAction(key, pressed);
}
} else if (this->modifierKey == 0x10) {
return this->ProcessHotkeyAction(key, pressed);
} else if (this->modifierKey == 0x11) {
switch (this->keyCode) {
case 0x41:
case 0x43:
case 0x56:
case 0x58:
if (hoverOnButton) {
if (this->modifierKey == 0) {
switch (this->keyCode) {
case VK_TAB:
case VK_RETURN:
case VK_SHIFT:
case VK_CONTROL:
case VK_MENU:
case VK_CAPITAL:
case VK_INSERT:
case VK_F1:
case VK_F2:
case VK_F3:
case VK_F4:
case VK_F5:
case VK_F6:
case VK_F7:
case VK_F8:
case VK_F9:
case VK_F10:
case VK_F11:
case VK_F12:
break;
default:
return this->ProcessHotkeyAction(key, pressed);
}
} else if (this->modifierKey == 0x10) {
return this->ProcessHotkeyAction(key, pressed);
} else if (this->modifierKey == 0x11) {
switch (this->keyCode) {
case 0x41:
case 0x43:
case 0x56:
case 0x58:
return this->ProcessHotkeyAction(key, pressed);
}
}
}
int& lastKey = g_session.m_currentHotkey;
if (lastKey != key) {
if (pressed == 0) {
return this->ProcessHotkeyAction(key, pressed);
}
g_session.m_automaticSkills.DisableAll();
}
}
lastKey = key;
int& lastKey = g_session.m_currentHotkey;
if (lastKey != key) {
if (pressed == 0) {
if ((key == 0x0D || key == 0x20) && this->ProcessEnterKey()) {
return true;
}
if (!this->ProcessShortcutKey(action)) {
return this->ProcessHotkeyAction(key, pressed);
}
g_session.m_automaticSkills.DisableAll();
}
lastKey = key;
if ((key == 0x0D || key == 0x20) && this->ProcessEnterKey()) {
if (this->IsHoverParentVisible() || this->IsHoverOnWindow01C8Button()) {
this->imeInputActive = 1;
}
return true;
}
if (!this->ProcessShortcutKey(action)) {
return this->ProcessHotkeyAction(key, pressed);
}
if (this->IsHoverParentVisible() || this->IsHoverOnWindow01C8Button()) {
this->imeInputActive = 1;
}
return true;
return this->ProcessHotkeyAction(key, pressed);
}
// OFFSET: 0x00AA57E0