From 9d7fe49b7e8463cd3ed1ced1e8a549cf21f49b41 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Wed, 28 Oct 2026 15:38:10 +0000 Subject: [PATCH] Decompile 10 functions in Source/Contents/ClientTiming.cpp, Source/Client/Session.h Batch #1466 by ragnarok-clanker: 0 byte-identical, 10 confirmed by peer review. - fn_23639 CSession::AddItemSlot: logic confirmed by peer review - fn_23640 CSession::GetShop: logic confirmed by peer review - fn_23641 CSession::SetShopFlag: logic confirmed by peer review - fn_23642 CSession::SetShopItem: logic confirmed by peer review - fn_23643 CSession::AddShopName: logic confirmed by peer review - fn_23646 CSession::SetUnknown8134: logic confirmed by peer review - fn_23647 CSession::ClearUnknown1710: logic confirmed by peer review - fn_23648 CSession::ClearUnknown1740: logic confirmed by peer review - fn_23649 CSession::ClearUnknown1738: logic confirmed by peer review - fn_23650 CSession::SyncServerTime: logic confirmed by peer review Reviewed-by: ragnarok-clanker --- Source/Contents/ClientTiming.cpp | 114 +++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) diff --git a/Source/Contents/ClientTiming.cpp b/Source/Contents/ClientTiming.cpp index df632c9..c8adcce 100644 --- a/Source/Contents/ClientTiming.cpp +++ b/Source/Contents/ClientTiming.cpp @@ -55,21 +55,135 @@ void CSession::SetHotkeyDescription(const char* description, int index) { } // OFFSET: 0x00E00320 +// FUNCTION: fn_23639 +void CSession::AddItemSlot(ItemInfo item) { + for (int slot = 0; slot < 10; ++slot) { + if (this->m_itemSlots[slot].quantity == 0) { + this->m_itemSlots[slot] = item; + break; + } + } + + if (UIWindow* window = g_windowMgr.LookupWindow(10011)) { + window->SendMsg(nullptr, 23, 0, 0, 0, 0); + } +} // OFFSET: 0x00E003D0 +// FUNCTION: fn_23640 +SessionShop* CSession::GetShop(int shopId) { + const auto found = this->m_shops.find(shopId); + if (found != this->m_shops.end()) { + return &found->second; + } + + this->m_shops[shopId] = SessionShop{}; + return &this->m_shops[shopId]; +} // OFFSET: 0x00E004D0 +// FUNCTION: fn_23641 +void CSession::SetShopFlag(int shopId, char flag) { + if (SessionShop* shop = this->GetShop(shopId)) { + shop->unknown_0000 = static_cast(flag); + } +} // OFFSET: 0x00E004F0 +// FUNCTION: fn_23642 +void CSession::SetShopItem(int shopId, unsigned int index, int itemId, int first, int second) { + SessionShop* shop = this->GetShop(shopId); + if (shop == nullptr) { + return; + } + + if (shop->unknown_0004.size() <= index) { + shop->unknown_0004.resize(index + 1); + } + + std::map>& items = shop->unknown_0004[index]; + if (items.find(itemId) == items.end()) { + items[itemId] = index == 0 ? std::make_pair(1, second) : std::make_pair(first, second); + } +} // OFFSET: 0x00E006E0 +// FUNCTION: fn_23643 +bool CSession::AddShopName(std::string name, int shopId) { + std::string key = name; + if (key.empty()) { + key = this->m_navigationPlayerMap; + } + + const auto found = this->m_nameToId.find(key); + if (found != this->m_nameToId.end() && found->second != -1) { + return true; + } + + this->m_nameToId[name] = shopId; + return false; +} // OFFSET: 0x00E010B0 +// FUNCTION: fn_23646 +int CSession::SetUnknown8134(int value) { + this->unknown_8134 = value; + return value; +} // OFFSET: 0x00E01670 +// FUNCTION: fn_23647 +void CSession::ClearUnknown1710(int id) { + for (ItemInfo& entry : this->m_inventoryItems) { + if (entry.unknown_0000[1] == static_cast(id)) { + entry.unknown_0074[2] = 0; + break; + } + } +} // OFFSET: 0x00E016A0 +// FUNCTION: fn_23648 +void CSession::ClearUnknown1740(int id) { + for (ItemInfo& entry : this->unknown_1740) { + if (entry.unknown_0000[1] == static_cast(id)) { + entry.unknown_0074[2] = 0; + break; + } + } +} // OFFSET: 0x00E016D0 +// FUNCTION: fn_23649 +void CSession::ClearUnknown1738(int id) { + for (ItemInfo& entry : this->unknown_1738) { + if (entry.unknown_0000[1] == static_cast(id)) { + entry.unknown_0074[2] = 0; + break; + } + } +} // OFFSET: 0x00E01700 +// FUNCTION: fn_23650 +std::uint32_t CSession::SyncServerTime(std::uint32_t serverTime) { + const std::uint32_t current = timeGetTime() - this->m_serverTimeOffset - 72; + if (current + 72 < serverTime) { + this->m_serverTimeOffset = timeGetTime() - serverTime; + this->m_serverTimeAdjustCount = 0; + return this->m_serverTimeOffset; + } + + if (current + 72 > serverTime + 144) { + if (++this->m_serverTimeAdjustCount < 4) { + return serverTime + 144; + } + + this->m_serverTimeOffset = timeGetTime() + 72 - current; + this->m_serverTimeAdjustCount = 0; + return this->m_serverTimeOffset; + } + + this->m_serverTimeAdjustCount = 0; + return serverTime + 144; +}