Decompile 4 functions in Source/Contents/ClientTiming.cpp, Source/Client/Session.h

Batch #1467 by ragnarok-clanker: 0 byte-identical, 4 confirmed by peer review.

- fn_23466 CSession::GetServerTime: logic confirmed by peer review
- fn_23605 CSession::AddPingSample: logic confirmed by peer review
- fn_23637 CSession::SetServerTime: logic confirmed by peer review
- fn_23638 CSession::SetHotkeyDescription: logic confirmed by peer review

Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
Adds to the build: Source/Contents/ClientTiming.cpp
This commit is contained in:
ragnarok-clanker 2026-10-28 14:02:41 +00:00
commit c351db5d57
3 changed files with 135 additions and 8 deletions

View file

@ -24,6 +24,11 @@ struct SessionRecord6144 {
/* 0031 */ std::uint8_t unknown_0031[7]; /* 0031 */ std::uint8_t unknown_0031[7];
}; };
struct SessionShop {
/* 0000 */ unsigned char unknown_0000;
/* 0004 */ std::vector<std::map<int, std::pair<int, int>>> unknown_0004;
};
class CSession { class CSession {
public: public:
/* 0000 */ std::uint32_t unknown_0000; /* 0000 */ std::uint32_t unknown_0000;
@ -31,7 +36,10 @@ public:
/* 000C */ CPlayerSkillBundle m_skillBundle; /* 000C */ CPlayerSkillBundle m_skillBundle;
/* 0084 */ std::list<CSkillInfo> m_homunSkills; /* 0084 */ std::list<CSkillInfo> m_homunSkills;
/* 008C */ std::list<CSkillInfo> m_mercSkills; /* 008C */ std::list<CSkillInfo> m_mercSkills;
/* 0094 */ unsigned char unknown_0094[0x38C]; /* 0094 */ unsigned char unknown_0094[0x28];
/* 00BC */ unsigned char m_hotkeyPage;
/* 00BD */ unsigned char unknown_00BD[3];
/* 00C0 */ std::string m_hotkeyDescriptions[36];
/* 0420 */ std::uint32_t unknown_0420[36]; /* 0420 */ std::uint32_t unknown_0420[36];
/* 04B0 */ NormalItemSlot m_shortcutSlots[36]; /* 04B0 */ NormalItemSlot m_shortcutSlots[36];
/* 05AC */ NormalItemSlot m_secondaryShortcutSlots[36]; /* 05AC */ NormalItemSlot m_secondaryShortcutSlots[36];
@ -45,7 +53,11 @@ public:
/* 0778 */ std::vector<std::pair<int, int>> unknown_0778; /* 0778 */ std::vector<std::pair<int, int>> unknown_0778;
/* 0784 */ std::map<std::int64_t, std::int64_t> unknown_0784; /* 0784 */ std::map<std::int64_t, std::int64_t> unknown_0784;
/* 078C */ std::map<std::int64_t, std::int64_t> unknown_078C; /* 078C */ std::map<std::int64_t, std::int64_t> unknown_078C;
/* 0794 */ unsigned char unknown_0794[0x704]; /* 0794 */ std::uint32_t m_serverTimeOffset;
/* 0798 */ int m_serverTimeAdjustCount;
/* 079C */ unsigned char unknown_079C[0x04];
/* 07A0 */ std::uint32_t m_averagePing;
/* 07A4 */ unsigned char unknown_07A4[0x6F4];
/* 0E98 */ int unknown_0E98; /* 0E98 */ int unknown_0E98;
/* 0E9C */ unsigned char unknown_0E9C[0x7C]; /* 0E9C */ unsigned char unknown_0E9C[0x7C];
/* 0F18 */ int m_playerX; /* 0F18 */ int m_playerX;
@ -56,18 +68,26 @@ public:
/* 0F30 */ unsigned char unknown_0F30[0x78]; /* 0F30 */ unsigned char unknown_0F30[0x78];
/* 0FA8 */ const char* const* m_jobNamesBegin; /* 0FA8 */ const char* const* m_jobNamesBegin;
/* 0FAC */ const char* const* m_jobNamesEnd; /* 0FAC */ const char* const* m_jobNamesEnd;
/* 0FB0 */ unsigned char unknown_0FB0[0xA8]; /* 0FB0 */ unsigned char unknown_0FB0[0x34];
/* 0FE4 */ std::list<std::uint32_t> m_pingSamples;
/* 0FEC */ unsigned char unknown_0FEC[0x6C];
/* 1058 */ int m_petActionTable[5][5][7]; /* 1058 */ int m_petActionTable[5][5][7];
/* 1314 */ unsigned char unknown_1314[0x314]; /* 1314 */ unsigned char unknown_1314[0x2F8];
/* 160C */ char m_navigationPlayerMap[0x1C];
/* 1628 */ int m_job; /* 1628 */ int m_job;
/* 162C */ unsigned char unknown_162C[0x24]; /* 162C */ unsigned char unknown_162C[0x24];
/* 1650 */ int m_level; /* 1650 */ int m_level;
/* 1654 */ unsigned char unknown_1654[0xBC]; /* 1654 */ unsigned char unknown_1654[0xBC];
/* 1710 */ std::list<ItemInfo> m_inventoryItems; /* 1710 */ std::list<ItemInfo> m_inventoryItems;
/* 1718 */ unsigned char unknown_1718[0x1438]; /* 1718 */ unsigned char unknown_1718[0x20];
/* 1738 */ std::list<ItemInfo> unknown_1738;
/* 1740 */ std::list<ItemInfo> unknown_1740;
/* 1748 */ unsigned char unknown_1748[0x1408];
/* 2B50 */ ItemInfo unknown_2B50[10]; /* 2B50 */ ItemInfo unknown_2B50[10];
/* 3500 */ ItemInfo unknown_3500[10]; /* 3500 */ ItemInfo unknown_3500[10];
/* 3EB0 */ unsigned char unknown_3EB0[0x1408]; /* 3EB0 */ unsigned char unknown_3EB0[0x9B0];
/* 4860 */ ItemInfo m_itemSlots[10];
/* 5210 */ unsigned char unknown_5210[0xA8];
/* 52B8 */ std::vector<const char*> m_accessoryNames; /* 52B8 */ std::vector<const char*> m_accessoryNames;
/* 52C4 */ unsigned char unknown_52C4[0x294]; /* 52C4 */ unsigned char unknown_52C4[0x294];
/* 5558 */ int unknown_5558; /* 5558 */ int unknown_5558;
@ -79,13 +99,31 @@ public:
/* 6144 */ std::map<int, SessionRecord6144> unknown_6144; /* 6144 */ std::map<int, SessionRecord6144> unknown_6144;
/* 614C */ unsigned char unknown_614C[0x20]; /* 614C */ unsigned char unknown_614C[0x20];
/* 616C */ std::vector<int> unknown_616C; /* 616C */ std::vector<int> unknown_616C;
/* 6178 */ unsigned char unknown_6178[0x1FA4]; /* 6178 */ unsigned char unknown_6178[0x1F3C];
/* 80B4 */ std::map<std::string, int> m_nameToId;
/* 80BC */ std::map<int, SessionShop> m_shops;
/* 80C4 */ unsigned char unknown_80C4[0x58];
/* 811C */ std::vector<ItemInfo> m_cardItems; /* 811C */ std::vector<ItemInfo> m_cardItems;
/* 8128 */ unsigned char unknown_8128[0x10]; /* 8128 */ unsigned char unknown_8128[0x0C];
/* 8134 */ int unknown_8134;
/* 8138 */ std::int64_t m_startTimeTicks; /* 8138 */ std::int64_t m_startTimeTicks;
/* 8140 */ std::int64_t m_loginTimeTicks; /* 8140 */ std::int64_t m_loginTimeTicks;
/* 8148 */ int unknown_8148; /* 8148 */ int unknown_8148;
std::uint32_t GetServerTime();
std::uint32_t AddPingSample(std::uint32_t sample);
std::uint32_t SetServerTime(std::uint32_t serverTime);
void SetHotkeyDescription(const char* description, int index);
void AddItemSlot(ItemInfo item);
SessionShop* GetShop(int shopId);
void SetShopFlag(int shopId, char flag);
void SetShopItem(int shopId, unsigned int index, int itemId, int first, int second);
bool AddShopName(std::string name, int shopId);
int SetUnknown8134(int value);
void ClearUnknown1710(int id);
void ClearUnknown1740(int id);
void ClearUnknown1738(int id);
std::uint32_t SyncServerTime(std::uint32_t serverTime);
int GetPetFood(int job); int GetPetFood(int job);
void GetPetIllustName(int job, int, char* buffer); void GetPetIllustName(int job, int, char* buffer);
int GetPetJobByEggItem(int eggItemId); int GetPetJobByEggItem(int eggItemId);
@ -139,6 +177,19 @@ static_assert(offsetof(SessionRecord6144, unknown_002C) == 0x2C);
static_assert(offsetof(SessionRecord6144, unknown_0030) == 0x30); static_assert(offsetof(SessionRecord6144, unknown_0030) == 0x30);
static_assert(offsetof(CSession, m_additionalSkills) == 0x4); static_assert(offsetof(CSession, m_additionalSkills) == 0x4);
static_assert(offsetof(CSession, m_level) == 0x1650); static_assert(offsetof(CSession, m_level) == 0x1650);
static_assert(offsetof(CSession, m_hotkeyPage) == 0xBC);
static_assert(offsetof(CSession, m_hotkeyDescriptions) == 0xC0);
static_assert(offsetof(CSession, m_serverTimeOffset) == 0x794);
static_assert(offsetof(CSession, m_serverTimeAdjustCount) == 0x798);
static_assert(offsetof(CSession, m_averagePing) == 0x7A0);
static_assert(offsetof(CSession, m_pingSamples) == 0xFE4);
static_assert(offsetof(CSession, m_navigationPlayerMap) == 0x160C);
static_assert(offsetof(CSession, unknown_1738) == 0x1738);
static_assert(offsetof(CSession, unknown_1740) == 0x1740);
static_assert(offsetof(CSession, m_itemSlots) == 0x4860);
static_assert(offsetof(CSession, m_nameToId) == 0x80B4);
static_assert(offsetof(CSession, m_shops) == 0x80BC);
static_assert(offsetof(CSession, unknown_8134) == 0x8134);
static_assert(offsetof(CSession, m_skillBundle) == 0xC); static_assert(offsetof(CSession, m_skillBundle) == 0xC);
static_assert(offsetof(CSession, m_homunSkills) == 0x84); static_assert(offsetof(CSession, m_homunSkills) == 0x84);
static_assert(offsetof(CSession, m_mercSkills) == 0x8C); static_assert(offsetof(CSession, m_mercSkills) == 0x8C);

View file

@ -0,0 +1,75 @@
#include "Client/Session.h"
#include "UI/Window/UIWindow.h"
#include "UI/Window/UIWindowMgr.h"
#include <timeapi.h>
#include <windows.h>
// OFFSET: 0x00DE0A50
// FUNCTION: fn_23466
std::uint32_t CSession::GetServerTime() {
return timeGetTime() - this->m_serverTimeOffset - 72;
}
// OFFSET: 0x00DFEF40
// FUNCTION: fn_23605
std::uint32_t CSession::AddPingSample(std::uint32_t sample) {
this->m_pingSamples.push_back(sample);
while (this->m_pingSamples.size() > 3) {
this->m_pingSamples.pop_front();
}
std::uint32_t sum = 0;
for (std::uint32_t value : this->m_pingSamples) {
sum += value;
}
this->m_averagePing = sum / this->m_pingSamples.size();
return this->m_averagePing;
}
// OFFSET: 0x00E00130
// FUNCTION: fn_23637
std::uint32_t CSession::SetServerTime(std::uint32_t serverTime) {
const std::uint32_t offset = timeGetTime() - serverTime;
this->m_serverTimeOffset = offset;
this->m_serverTimeAdjustCount = 0;
return offset;
}
// OFFSET: 0x00E00160
// FUNCTION: fn_23638
void CSession::SetHotkeyDescription(const char* description, int index) {
for (int slot = 9 * this->m_hotkeyPage; slot < 9 * (this->m_hotkeyPage + 1); ++slot) {
if (this->m_hotkeyDescriptions[slot] == description) {
this->m_hotkeyDescriptions[slot] = "nothing";
}
}
if (description[0] == '\0') {
this->m_hotkeyDescriptions[index] = "nothing";
} else {
this->m_hotkeyDescriptions[index] = description;
}
}
// OFFSET: 0x00E00320
// OFFSET: 0x00E003D0
// OFFSET: 0x00E004D0
// OFFSET: 0x00E004F0
// OFFSET: 0x00E006E0
// OFFSET: 0x00E010B0
// OFFSET: 0x00E01670
// OFFSET: 0x00E016A0
// OFFSET: 0x00E016D0
// OFFSET: 0x00E01700

View file

@ -284,6 +284,7 @@
"Source/Contents/CashEmotionMgr.cpp": 4, "Source/Contents/CashEmotionMgr.cpp": 4,
"Source/Contents/ClientItemLists.cpp": 4, "Source/Contents/ClientItemLists.cpp": 4,
"Source/Contents/ClientState.cpp": 4, "Source/Contents/ClientState.cpp": 4,
"Source/Contents/ClientTiming.cpp": 4,
"Source/Contents/Configuration/OptionWriter.cpp": 4, "Source/Contents/Configuration/OptionWriter.cpp": 4,
"Source/Contents/Configuration/ScriptOptions.cpp": 4, "Source/Contents/Configuration/ScriptOptions.cpp": 4,
"Source/Contents/Configuration/ServiceConfiguration.cpp": 4, "Source/Contents/Configuration/ServiceConfiguration.cpp": 4,