From eddf7e34b41e1cdb2c838e8687cc83e42dba2dbf Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 31 Oct 2026 20:00:20 +0000 Subject: [PATCH] Decompile fn_12608 (UISerachStoreInfoWnd::ItemAt) Batch #8647 by youko: 0 byte-identical, 1 confirmed by peer review. - fn_12608 UISerachStoreInfoWnd::ItemAt: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, eAthena, gordaoprogramas Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Window/UISerachStoreInfoWnd.cpp | 32 +++++++++++++++++++++++ Source/UI/Window/UISerachStoreInfoWnd.h | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/Source/UI/Window/UISerachStoreInfoWnd.cpp b/Source/UI/Window/UISerachStoreInfoWnd.cpp index 5a852f15..83d070e6 100644 --- a/Source/UI/Window/UISerachStoreInfoWnd.cpp +++ b/Source/UI/Window/UISerachStoreInfoWnd.cpp @@ -40,6 +40,13 @@ struct SearchStoreQueryPacket { static_assert(offsetof(SearchStoreQueryPacket, ids) == 0xF); +struct SearchStoreResult { + /* 0000 */ unsigned char unknown_0000[0x60]; + /* 0060 */ ITEM_INFO item; +}; + +static_assert(sizeof(SearchStoreResult) == sizeof(SessionEntry5BD4)); + // OFFSET: 0x009121F0 // FUNCTION: fn_12527 UISerachStoreInfoWnd::UISerachStoreInfoWnd() @@ -48,6 +55,31 @@ UISerachStoreInfoWnd::UISerachStoreInfoWnd() this->unknown_00F0.clear(); } +// OFFSET: 0x0091BBC0 +// FUNCTION: fn_12608 +ITEM_INFO UISerachStoreInfoWnd::ItemAt(int x, int y) { + ITEM_INFO item(0); + this->unknown_00E0 = -1; + if (g_session.unknown_5BD4.empty()) { + return item; + } + + if (x > 5 && x < this->geometry.width - 10 && y > 100 && y < (this->unknown_00E8 + 10) * 10) { + const int row = (y - 100) / this->unknown_00E8; + this->unknown_00E0 = row; + const unsigned int index = row + (this->unknown_00DC - 1) * 10; + if (index >= g_session.unknown_5BD4.size()) { + return item; + } + + std::vector::iterator it = g_session.unknown_5BD4.begin() + index; + if (it != g_session.unknown_5BD4.end()) { + item = reinterpret_cast(*it).item; + } + } + return item; +} + // OFFSET: 0x009296E0 // FUNCTION: fn_12653 void UISerachStoreInfoWnd::Slot15(int width, int height) { diff --git a/Source/UI/Window/UISerachStoreInfoWnd.h b/Source/UI/Window/UISerachStoreInfoWnd.h index 05794fb3..2b092f35 100644 --- a/Source/UI/Window/UISerachStoreInfoWnd.h +++ b/Source/UI/Window/UISerachStoreInfoWnd.h @@ -19,7 +19,7 @@ public: void Paint() override; void Slot32(int x, int y) override; int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override; - ITEM_INFO ItemAt(int x, int y); + __declspec(noinline) ITEM_INFO ItemAt(int x, int y); protected: /* 00B4 */ UIRadioBtn* m_radios[2];