From 7a88edb84cb563b0107197b55f5a795f61b17fe3 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Wed, 28 Oct 2026 20:23:55 +0000 Subject: [PATCH] Decompile fn_23848 (CSession::LoadXmlTables) Batch #1684 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_23848 CSession::LoadXmlTables: logic confirmed by peer review Reviewed-by: ragnarok-clanker Adds to the build: Source/Contents/ClientXmlTables.cpp --- Source/Client/Session.h | 10 +++++++++- Source/Contents/ClientXmlTables.cpp | 28 ++++++++++++++++++++++++++++ Source/Resource/XmlNode.h | 3 +++ data/compile.json | 1 + 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 Source/Contents/ClientXmlTables.cpp diff --git a/Source/Client/Session.h b/Source/Client/Session.h index 646760c..0d7610e 100644 --- a/Source/Client/Session.h +++ b/Source/Client/Session.h @@ -5,6 +5,7 @@ #include "Contents/Items/ItemInfo.h" #include "Contents/Skills/PlayerSkillBundle.h" #include "Contents/UserData/NormalItemSlots.h" +#include "Resource/XmlNode.h" #include #include @@ -81,7 +82,11 @@ public: /* 0FE4 */ std::list m_pingSamples; /* 0FEC */ unsigned char unknown_0FEC[0x6C]; /* 1058 */ int m_petActionTable[5][5][7]; - /* 1314 */ unsigned char unknown_1314[0x2F8]; + /* 1314 */ unsigned char unknown_1314[0x258]; + /* 156C */ XmlDocument m_petTalkTable; + /* 159C */ XmlDocument m_monsterSkillInfo; + /* 15CC */ XmlDocument m_monsterTalkTable; + /* 15FC */ unsigned char unknown_15FC[0x10]; /* 160C */ char m_navigationPlayerMap[0x1C]; /* 1628 */ int m_job; /* 162C */ unsigned char unknown_162C[0x24]; @@ -215,6 +220,7 @@ public: int MercSkillLevel(int skillId) const; int HomunSkillLevel(int skillId) const; int SyncUnknown0E98(); + void LoadXmlTables(); std::string GetAccessoryName(int id); void CollectCardItems(); int GetRobeAlpha(int robeId); @@ -244,6 +250,8 @@ 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_petTalkTable) == 0x156C); +static_assert(offsetof(CSession, m_monsterTalkTable) == 0x15CC); static_assert(offsetof(CSession, m_navigationPlayerMap) == 0x160C); static_assert(offsetof(CSession, unknown_1738) == 0x1738); static_assert(offsetof(CSession, unknown_1740) == 0x1740); diff --git a/Source/Contents/ClientXmlTables.cpp b/Source/Contents/ClientXmlTables.cpp new file mode 100644 index 0000000..4279a33 --- /dev/null +++ b/Source/Contents/ClientXmlTables.cpp @@ -0,0 +1,28 @@ +#include "Client/Input/InputCharset.h" +#include "Client/Session.h" +#include "File/File.h" +#include "Resource/XmlNode.h" + +// OFFSET: 0x00E1A2B0 +// FUNCTION: fn_23848 +void CSession::LoadXmlTables() { + CFile petTalkFile; + petTalkFile.Open(g_serverLanguage->ServiceName("PetTalkTable.xml"), 0, true, false); + const char* petTalk = static_cast(petTalkFile.GetData()); + this->m_petTalkTable.Parse(petTalk, petTalk + petTalkFile.GetSize()); + petTalkFile.Close(); + + CFile skillFile; + if (skillFile.Open("MonsterSkillInfo.xml", 0, true, false)) { + const char* skillInfo = static_cast(skillFile.GetData()); + this->m_monsterSkillInfo.Parse(skillInfo, skillInfo + skillFile.GetSize()); + skillFile.Close(); + } + + CFile talkFile; + if (talkFile.Open("MonsterTalkTable.xml", 0, true, false)) { + const char* monsterTalk = static_cast(talkFile.GetData()); + this->m_monsterTalkTable.Parse(monsterTalk, monsterTalk + talkFile.GetSize()); + talkFile.Close(); + } +} diff --git a/Source/Resource/XmlNode.h b/Source/Resource/XmlNode.h index 0a6acf6..f49e52f 100644 --- a/Source/Resource/XmlNode.h +++ b/Source/Resource/XmlNode.h @@ -23,6 +23,9 @@ struct XmlNode { }; struct XmlDocument : XmlNode { + // INLINED + XmlDocument() : XmlNode("XMLDocument"), buffer(nullptr) { + } void Reset(); char* TerminateName(char* begin, char* end); char* ParseElements(XmlNode* parent, char* cursor, char* end); diff --git a/data/compile.json b/data/compile.json index ff3b3fe..75c86e7 100644 --- a/data/compile.json +++ b/data/compile.json @@ -291,6 +291,7 @@ "Source/Contents/ClientItemLists.cpp": 4, "Source/Contents/ClientState.cpp": 4, "Source/Contents/ClientTiming.cpp": 4, + "Source/Contents/ClientXmlTables.cpp": 4, "Source/Contents/Configuration/OptionWriter.cpp": 4, "Source/Contents/Configuration/ScriptOptions.cpp": 4, "Source/Contents/Configuration/ServiceConfiguration.cpp": 4,