From f61f0747fa65bf59be88a74cd78f8e33e4066f99 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Wed, 28 Oct 2026 12:59:53 +0000 Subject: [PATCH] Decompile 2 functions in Source/Contents/MapSkyMgr.cpp, Source/Contents/MapSkyMgr.h, ... Batch #1449 by Yommy: 2 byte-identical, 0 confirmed by peer review. - fn_17872 CPathFinder::Height: byte-identical - fn_17873 CPathFinder::Width: byte-identical Merged automatically: every function is byte-identical to the original. Adds to the build: Source/Contents/MapSkyMgr.cpp, Source/Contents/EquipmentResources.cpp, Source/Contents/Pathfinding.cpp, Source/Resource/ImfResource.cpp --- Source/Client/Session.h | 7 ++++++- Source/Contents/EquipmentResources.cpp | 5 +++++ Source/Contents/MapSkyMgr.cpp | 3 +++ Source/Contents/MapSkyMgr.h | 23 ++++++++++++++++++++ Source/Contents/Pathfinding.cpp | 16 ++++++++++++++ Source/Contents/TerrainPathSearch.h | 8 +++++-- Source/Contents/World/WorldActors.h | 1 + Source/Contents/World/WorldObjects.cpp | 5 +++++ Source/Contents/World/WorldObjects.h | 3 +++ Source/Resource/ImfResource.cpp | 4 ++++ Source/Resource/ImfResource.h | 29 ++++++++++++++++++++++++++ Source/Script/LuaScript.cpp | 2 ++ Source/Script/LuaScript.h | 1 + data/compile.json | 4 ++++ 14 files changed, 108 insertions(+), 3 deletions(-) create mode 100644 Source/Contents/EquipmentResources.cpp create mode 100644 Source/Contents/MapSkyMgr.cpp create mode 100644 Source/Contents/MapSkyMgr.h create mode 100644 Source/Contents/Pathfinding.cpp create mode 100644 Source/Resource/ImfResource.cpp create mode 100644 Source/Resource/ImfResource.h diff --git a/Source/Client/Session.h b/Source/Client/Session.h index 5f84112..02ee6f8 100644 --- a/Source/Client/Session.h +++ b/Source/Client/Session.h @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -65,7 +66,9 @@ public: /* 1718 */ unsigned char unknown_1718[0x1438]; /* 2B50 */ ItemInfo unknown_2B50[10]; /* 3500 */ ItemInfo unknown_3500[10]; - /* 3EB0 */ unsigned char unknown_3EB0[0x16A8]; + /* 3EB0 */ unsigned char unknown_3EB0[0x1408]; + /* 52B8 */ std::vector m_accessoryNames; + /* 52C4 */ unsigned char unknown_52C4[0x294]; /* 5558 */ int unknown_5558; /* 555C */ unsigned char unknown_555C[0x47C]; /* 59D8 */ LuaScript* m_hotkeyScript; @@ -122,6 +125,7 @@ public: char* ConvertTooltipText(const char* source, char* output) const; int MercSkillLevel(int skillId) const; int SyncUnknown0E98(); + std::string GetAccessoryName(int id); void CollectCardItems(); }; @@ -157,6 +161,7 @@ static_assert(offsetof(CSession, m_job) == 0x1628); static_assert(offsetof(CSession, m_inventoryItems) == 0x1710); static_assert(offsetof(CSession, unknown_2B50) == 0x2B50); static_assert(offsetof(CSession, unknown_3500) == 0x3500); +static_assert(offsetof(CSession, m_accessoryNames) == 0x52B8); static_assert(offsetof(CSession, unknown_5558) == 0x5558); static_assert(offsetof(CSession, m_hotkeyScript) == 0x59D8); static_assert(offsetof(CSession, unknown_5C68) == 0x5C68); diff --git a/Source/Contents/EquipmentResources.cpp b/Source/Contents/EquipmentResources.cpp new file mode 100644 index 0000000..68d7e9f --- /dev/null +++ b/Source/Contents/EquipmentResources.cpp @@ -0,0 +1,5 @@ +#include "Client/Session.h" + +#include + +// OFFSET: 0x00E0A2C0 diff --git a/Source/Contents/MapSkyMgr.cpp b/Source/Contents/MapSkyMgr.cpp new file mode 100644 index 0000000..9a65856 --- /dev/null +++ b/Source/Contents/MapSkyMgr.cpp @@ -0,0 +1,3 @@ +#include "Contents/MapSkyMgr.h" + +// OFFSET: 0x005B8F00 diff --git a/Source/Contents/MapSkyMgr.h b/Source/Contents/MapSkyMgr.h new file mode 100644 index 0000000..72c17af --- /dev/null +++ b/Source/Contents/MapSkyMgr.h @@ -0,0 +1,23 @@ +#ifndef RAGNAROK_SOURCE_CONTENTS_MAPSKYMGR_H +#define RAGNAROK_SOURCE_CONTENTS_MAPSKYMGR_H + +#include "Script/LuaScript.h" + +class CMapSkyMgr { +public: + // INLINED + virtual ~CMapSkyMgr() { + if (this->m_script) { + this->m_script->Close(); + delete this->m_script; + this->m_script = nullptr; + } + } + + bool LoadData(); + +private: + /* 0004 */ LuaScript* m_script; +}; + +#endif diff --git a/Source/Contents/Pathfinding.cpp b/Source/Contents/Pathfinding.cpp new file mode 100644 index 0000000..1a10160 --- /dev/null +++ b/Source/Contents/Pathfinding.cpp @@ -0,0 +1,16 @@ +#include "Contents/TerrainPathSearch.h" +#include "Resource/World/TerrainResource.h" + +// OFFSET: 0x00AD85A0 + +// OFFSET: 0x00AD8DB0 +// FUNCTION: fn_17872 +int CPathFinder::Height() const { + return this->attr->height; +} + +// OFFSET: 0x00AD8DC0 +// FUNCTION: fn_17873 +int CPathFinder::Width() const { + return this->attr->width; +} diff --git a/Source/Contents/TerrainPathSearch.h b/Source/Contents/TerrainPathSearch.h index 53891d8..6e9f6af 100644 --- a/Source/Contents/TerrainPathSearch.h +++ b/Source/Contents/TerrainPathSearch.h @@ -7,6 +7,7 @@ #include #include #include +#include #include class C3dAttr; @@ -27,23 +28,26 @@ public: class CPathFinder { public: CPathFinder(); + ~CPathFinder(); /* 0000 */ C3dAttr* attr; /* 0004 */ int destinationX; /* 0008 */ int destinationY; /* 000C */ int nodeCount; /* 0010 */ MovementPathNode nodes[150]; - /* 1078 */ std::map unknown_1078; + /* 1078 */ std::map attrCache; /* 1080 */ bool useNodePool; /* 1084 */ std::vector nodePool; /* 1090 */ std::map nodeMap; /* 1098 */ MovementOpenList openList; void Reset(); + int Height() const; + int Width() const; }; #if defined(_WIN32) && !defined(_WIN64) -static_assert(offsetof(CPathFinder, unknown_1078) == 0x1078); +static_assert(offsetof(CPathFinder, attrCache) == 0x1078); static_assert(offsetof(CPathFinder, nodePool) == 0x1084); static_assert(offsetof(CPathFinder, nodeMap) == 0x1090); static_assert(offsetof(CPathFinder, openList) == 0x1098); diff --git a/Source/Contents/World/WorldActors.h b/Source/Contents/World/WorldActors.h index 996012c..7f6bc96 100644 --- a/Source/Contents/World/WorldActors.h +++ b/Source/Contents/World/WorldActors.h @@ -12,6 +12,7 @@ struct WorldActors { const std::uint32_t& localAccountId; CRenderObject* Find(std::uint32_t accountId) const; + CRenderObject* Lookup(std::uint32_t accountId) const; bool TargetPosition(const float* origin, std::uint32_t accountId, float* output) const; }; diff --git a/Source/Contents/World/WorldObjects.cpp b/Source/Contents/World/WorldObjects.cpp index 3ff682d..0b62485 100644 --- a/Source/Contents/World/WorldObjects.cpp +++ b/Source/Contents/World/WorldObjects.cpp @@ -1,6 +1,9 @@ #include "Contents/Actors/RenderObject.h" +#include "Contents/World/WorldActors.h" #include "Contents/World/WorldObjects.h" +// OFFSET: 0x00AC8220 + // OFFSET: 0x00ACA4E0 // FUNCTION: fn_17692 void WorldObjects::Remove(CRenderObject* object) { @@ -22,3 +25,5 @@ void WorldObjects::Clear() { entry = this->objects.erase(entry); } } + +// OFFSET: 0x00ACA980 diff --git a/Source/Contents/World/WorldObjects.h b/Source/Contents/World/WorldObjects.h index 335eabf..a26689e 100644 --- a/Source/Contents/World/WorldObjects.h +++ b/Source/Contents/World/WorldObjects.h @@ -1,8 +1,10 @@ #ifndef RAGNAROK_SOURCE_CONTENTS_WORLD_WORLDOBJECTS_H #define RAGNAROK_SOURCE_CONTENTS_WORLD_WORLDOBJECTS_H +#include #include +class CGameObject; class CRenderObject; struct WorldObjects { @@ -10,6 +12,7 @@ struct WorldObjects { void Remove(CRenderObject* object); void Clear(); + void SendObjectMessage(CGameObject* sender, std::uint64_t identity, int message, int a, int b, int c, int d); }; #endif diff --git a/Source/Resource/ImfResource.cpp b/Source/Resource/ImfResource.cpp new file mode 100644 index 0000000..ee30063 --- /dev/null +++ b/Source/Resource/ImfResource.cpp @@ -0,0 +1,4 @@ +#include "Resource/ImfResource.h" +#include "File/File.h" + +// OFFSET: 0x0074F190 diff --git a/Source/Resource/ImfResource.h b/Source/Resource/ImfResource.h new file mode 100644 index 0000000..1f334f0 --- /dev/null +++ b/Source/Resource/ImfResource.h @@ -0,0 +1,29 @@ +#ifndef RAGNAROK_SOURCE_RESOURCE_IMFRESOURCE_H +#define RAGNAROK_SOURCE_RESOURCE_IMFRESOURCE_H + +#include "Resource/Resource.h" + +#include + +struct ImfData { + /* 0000 */ std::vector priority; + /* 000C */ std::vector cx; + /* 0018 */ std::vector cy; +}; + +class CImfRes : public CRes { +public: + bool Load(const char* name) override; + +private: + /* 0110 */ std::vector> m_imfData; + /* 011C */ int m_maxAction[15]; + /* 0158 */ int m_maxMotion[15][104]; +}; + +#if defined(_WIN32) && !defined(_WIN64) +static_assert(sizeof(ImfData) == 36); +static_assert(sizeof(CImfRes) == 0x19B8); +#endif + +#endif diff --git a/Source/Script/LuaScript.cpp b/Source/Script/LuaScript.cpp index 3c86284..e78b3b1 100644 --- a/Source/Script/LuaScript.cpp +++ b/Source/Script/LuaScript.cpp @@ -102,6 +102,8 @@ void LuaScript::Error(const char* caption, const char* format, ...) { MessageBoxA(nullptr, text, caption, MB_OK); } +// OFFSET: 0x00AFDC60 + // OFFSET: 0x00AFC9A0 // FUNCTION: fn_18326 bool LuaScript::Call(std::string function, const char* signature, ...) { diff --git a/Source/Script/LuaScript.h b/Source/Script/LuaScript.h index ed9d244..2dded56 100644 --- a/Source/Script/LuaScript.h +++ b/Source/Script/LuaScript.h @@ -31,6 +31,7 @@ protected: private: void Error(const char* caption, const char* format, ...); + bool TableField(const char* signature, ...); }; #endif diff --git a/data/compile.json b/data/compile.json index d88bcea..8814ab6 100644 --- a/data/compile.json +++ b/data/compile.json @@ -312,6 +312,7 @@ "Source/Contents/Emblems/EmblemDownload.cpp": 4, "Source/Contents/Emblems/EmblemUpload.cpp": 2, "Source/Contents/Emblems/GuildEmblemReqBundle.cpp": 4, + "Source/Contents/EquipmentResources.cpp": 4, "Source/Contents/ForbiddenWords.cpp": 4, "Source/Contents/Ground/GroundDecals.cpp": 3, "Source/Contents/Ground/GroundGeometry.cpp": 3, @@ -344,6 +345,7 @@ "Source/Contents/Jobs/JobInheritance.cpp": 4, "Source/Contents/Jobs/JobNameInitialization.cpp": 4, "Source/Contents/Jobs/JobNames.cpp": 4, + "Source/Contents/MapSkyMgr.cpp": 4, "Source/Contents/MessageTable.cpp": 4, "Source/Contents/Messenger/ClientMessenger.cpp": 4, "Source/Contents/Messenger/MessengerMember.cpp": 4, @@ -383,6 +385,7 @@ "Source/Contents/Party/RegisterPartyAsyncWork.cpp": 4, "Source/Contents/Party/StopRecruitingAsyncWork.cpp": 4, "Source/Contents/Party/StopRecruitingCompletion.cpp": 2, + "Source/Contents/Pathfinding.cpp": 4, "Source/Contents/PetStatus.cpp": 4, "Source/Contents/PetStrings.cpp": 4, "Source/Contents/PlayerNameDictionary.cpp": 4, @@ -523,6 +526,7 @@ "Source/Resource/EZeffectResource.cpp": 3, "Source/Resource/GifLzw.cpp": 3, "Source/Resource/GifResource.cpp": 3, + "Source/Resource/ImfResource.cpp": 3, "Source/Resource/Models/AnimatedModelResource.cpp": 3, "Source/Resource/Models/ModelMesh.cpp": 3, "Source/Resource/Models/ModelResource.cpp": 3,