From 02df811b365acfaa4221ffcc68f424251f783a63 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 27 Oct 2026 13:57:41 +0000 Subject: [PATCH] Maintenance: Add mandatory field offset markers /* XXXX */ and assertions to Contents headers (part 1: Actors, Effects, Ground, Hotke Batch #1066 by ragnarok-clanker: no function's compiled code changes; checked with 70 compiled unit(s), including every includer of Source/Contents/Actors/RenderObject.h, Source/Contents/CashEmotionMgr.h, Source/Contents/Effects/AttachedEffect.h, Source/Contents/Effects/Effect.h, Source/Contents/Effects/EffectActor.h, Source/Contents/Effects/EffectParticle.h, Source/Contents/Effects/EffectPrimitiveState.h, Source/Contents/Emblems/GuildEmblemReqBundle.h, Source/Contents/Ground/GroundGeometry.h, Source/Contents/Ground/GroundSpatial.h, Source/Contents/Ground/GroundWaterState.h, Source/Contents/Ground/TerrainHeight.h, Source/Contents/Hotkeys/EmotionHotkeys.h, Source/Contents/Hotkeys/HotkeyInfo.h, Source/Contents/Hotkeys/UserHotkeyMgr.h, Source/Contents/InstantVar.h. --- Source/Contents/Actors/RenderObject.h | 5 ++- Source/Contents/CashEmotionMgr.h | 4 ++- Source/Contents/Effects/AttachedEffect.h | 5 ++- Source/Contents/Effects/Effect.h | 22 ++++++++----- Source/Contents/Effects/EffectActor.h | 5 ++- Source/Contents/Effects/EffectParticle.h | 3 +- .../Contents/Effects/EffectPrimitiveState.h | 33 +++++++++++-------- .../Contents/Emblems/GuildEmblemReqBundle.h | 9 +++-- Source/Contents/Ground/GroundGeometry.h | 12 ++++--- Source/Contents/Ground/GroundSpatial.h | 20 ++++++----- Source/Contents/Ground/GroundWaterState.h | 20 ++++++----- Source/Contents/Ground/TerrainHeight.h | 8 +++-- Source/Contents/Hotkeys/EmotionHotkeys.h | 6 ++-- Source/Contents/Hotkeys/HotkeyInfo.h | 11 ++++--- Source/Contents/Hotkeys/UserHotkeyMgr.h | 13 +++++--- Source/Contents/InstantVar.h | 2 +- 16 files changed, 112 insertions(+), 66 deletions(-) diff --git a/Source/Contents/Actors/RenderObject.h b/Source/Contents/Actors/RenderObject.h index 1836bd6..929a8a1 100644 --- a/Source/Contents/Actors/RenderObject.h +++ b/Source/Contents/Actors/RenderObject.h @@ -4,6 +4,8 @@ #include "Contents/Actors/GameObject.h" #include "Contents/Actors/RenderObjectState.h" +#include + class CRenderObject : public CGameObject { public: CRenderObject(ResourceMgr& resources, JobNames& names); @@ -33,11 +35,12 @@ public: unsigned char finishFrame, int timed, std::uint32_t duration, int loop ); - RenderObjectState render; + /* 0010 */ RenderObjectState render; }; #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(CRenderObject) == 0x138); +static_assert(offsetof(CRenderObject, render) == 0x0010); #endif #endif diff --git a/Source/Contents/CashEmotionMgr.h b/Source/Contents/CashEmotionMgr.h index f0184b9..2a8b6a1 100644 --- a/Source/Contents/CashEmotionMgr.h +++ b/Source/Contents/CashEmotionMgr.h @@ -1,6 +1,7 @@ #ifndef RAGNAROK_SOURCE_CONTENTS_CASHEMOTIONMGR_H #define RAGNAROK_SOURCE_CONTENTS_CASHEMOTIONMGR_H +#include #include #include #include @@ -8,7 +9,7 @@ struct CashEmotionData { int id; int subId; - std::string name; + /* 0008 */ std::string name; }; class CCashEmotionMgr { @@ -43,6 +44,7 @@ protected: extern CCashEmotionMgr* g_cashEmotionMgr; #if defined(_WIN32) && !defined(_WIN64) +static_assert(offsetof(CashEmotionData, name) == 0x08); static_assert(sizeof(CCashEmotionMgr) == 472); #endif diff --git a/Source/Contents/Effects/AttachedEffect.h b/Source/Contents/Effects/AttachedEffect.h index 0efc7f0..9f5c51c 100644 --- a/Source/Contents/Effects/AttachedEffect.h +++ b/Source/Contents/Effects/AttachedEffect.h @@ -4,15 +4,18 @@ #include "Contents/Effects/RagEffectState.h" #include "Contents/Actors/RenderObject.h" +#include + struct AttachedEffect : CRenderObject { AttachedEffect(ResourceMgr& resources, JobNames& names); ~AttachedEffect() override; - RagEffectState state; + /* 0138 */ RagEffectState state; }; #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(AttachedEffect) == 0x11CA8); +static_assert(offsetof(AttachedEffect, state) == 0x138); #endif #endif diff --git a/Source/Contents/Effects/Effect.h b/Source/Contents/Effects/Effect.h index 8be5757..0137801 100644 --- a/Source/Contents/Effects/Effect.h +++ b/Source/Contents/Effects/Effect.h @@ -1,16 +1,17 @@ #ifndef RAGNAROK_SOURCE_CONTENTS_EFFECTS_EFFECT_H #define RAGNAROK_SOURCE_CONTENTS_EFFECTS_EFFECT_H +#include #include #include #include #include struct EffectEvent { - int kind; - int frame; - int argument; - std::string text; + /* 0000 */ int kind; + /* 0004 */ int frame; + /* 0008 */ int argument; + /* 000C */ std::string text; }; class CEffect { @@ -30,18 +31,18 @@ public: /* 002C */ int unknown_002C; /* 0030 */ int unknown_0030; /* 0034 */ unsigned char outsideRange; - unsigned char unknown_0035[3]; + /* 0035 */ unsigned char unknown_0035[3]; /* 0038 */ int range; - unsigned char unknown_003C[116]; + /* 003C */ unsigned char unknown_003C[116]; /* 00B0 */ int unknown_00B0; /* 00B4 */ std::vector events; /* 00C0 */ unsigned char retained; - unsigned char unknown_00C1; + /* 00C1 */ unsigned char unknown_00C1; /* 00C2 */ unsigned char forceRender; - unsigned char unknown_00C3; + /* 00C3 */ unsigned char unknown_00C3; /* 00C4 */ int unknown_00C4; /* 00C8 */ unsigned char unknown_00C8; - unsigned char unknown_00C9[3]; + /* 00C9 */ unsigned char unknown_00C9[3]; }; struct EffectRetirement { @@ -51,7 +52,10 @@ struct EffectRetirement { #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(EffectEvent) == 36); +static_assert(offsetof(EffectEvent, text) == 0xC); static_assert(sizeof(CEffect) == 204); +static_assert(offsetof(CEffect, events) == 0xB4); +static_assert(offsetof(CEffect, unknown_00C8) == 0xC8); #endif #endif diff --git a/Source/Contents/Effects/EffectActor.h b/Source/Contents/Effects/EffectActor.h index 066f780..363948d 100644 --- a/Source/Contents/Effects/EffectActor.h +++ b/Source/Contents/Effects/EffectActor.h @@ -4,6 +4,8 @@ #include "Contents/Effects/EffectAttachments.h" #include "Contents/Actors/RenderObject.h" +#include + struct EffectActorState { EffectActorState(); ~EffectActorState(); @@ -21,12 +23,13 @@ struct EffectActor : CRenderObject { EffectActor(ResourceMgr& resources, JobNames& names); bool EffectVisible() const; - EffectActorState state; + /* 0138 */ EffectActorState state; }; #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(EffectActorState) == 28); static_assert(sizeof(EffectActor) == 0x158); +static_assert(offsetof(EffectActor, state) == 0x138); #endif #endif diff --git a/Source/Contents/Effects/EffectParticle.h b/Source/Contents/Effects/EffectParticle.h index b0113ee..118f19a 100644 --- a/Source/Contents/Effects/EffectParticle.h +++ b/Source/Contents/Effects/EffectParticle.h @@ -13,7 +13,7 @@ struct RagEffectState; struct EffectParticle : CRenderObject { EffectParticle(ResourceMgr& resources, JobNames& names); - EffectPrimitiveState state; + /* 0138 */ EffectPrimitiveState state; }; EffectParticle* CreateEffectParticle( @@ -23,6 +23,7 @@ EffectParticle* CreateEffectParticle( #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(EffectParticle) == 0xFA18); +static_assert(offsetof(EffectParticle, state) == 0x138); #endif #endif diff --git a/Source/Contents/Effects/EffectPrimitiveState.h b/Source/Contents/Effects/EffectPrimitiveState.h index 8af0feb..e5cc4e8 100644 --- a/Source/Contents/Effects/EffectPrimitiveState.h +++ b/Source/Contents/Effects/EffectPrimitiveState.h @@ -3,6 +3,7 @@ #include "Render/Primitives/RenderPrimitive.h" +#include #include #include @@ -11,23 +12,23 @@ struct RagEffectState; class CTexture; struct EffectVector3 { - float x; - float y; - float z; + /* 0000 */ float x; + /* 0004 */ float y; + /* 0008 */ float z; }; struct EffectPrimitiveRecord { - EffectVector3 position; - EffectVector3 corners[4]; - std::uint32_t unknown_003C; - float scale; - float angle; - float matrix[12]; - std::int32_t red; - std::int32_t green; - std::int32_t blue; - float alpha; - std::uint32_t color; + /* 0000 */ EffectVector3 position; + /* 000C */ EffectVector3 corners[4]; + /* 003C */ std::uint32_t unknown_003C; + /* 0040 */ float scale; + /* 0044 */ float angle; + /* 0048 */ float matrix[12]; + /* 0078 */ std::int32_t red; + /* 007C */ std::int32_t green; + /* 0080 */ std::int32_t blue; + /* 0084 */ float alpha; + /* 0088 */ std::uint32_t color; }; struct EffectPrimitiveState { @@ -147,6 +148,10 @@ struct EffectPrimitiveState { static_assert(sizeof(EffectVector3) == 12); static_assert(sizeof(EffectPrimitiveRecord) == 140); #if defined(_WIN32) && !defined(_WIN64) +static_assert(offsetof(EffectVector3, z) == 0x8); +static_assert(offsetof(EffectPrimitiveRecord, corners) == 0xC); +static_assert(offsetof(EffectPrimitiveRecord, matrix) == 0x48); +static_assert(offsetof(EffectPrimitiveRecord, color) == 0x88); static_assert(sizeof(EffectPrimitiveState) == 0xF8E0); #endif diff --git a/Source/Contents/Emblems/GuildEmblemReqBundle.h b/Source/Contents/Emblems/GuildEmblemReqBundle.h index fa7b020..4b657e7 100644 --- a/Source/Contents/Emblems/GuildEmblemReqBundle.h +++ b/Source/Contents/Emblems/GuildEmblemReqBundle.h @@ -21,10 +21,13 @@ public: protected: struct Recent { - std::uint32_t guildId; - std::uint32_t version; - std::uint32_t tick; + /* 0000 */ std::uint32_t guildId; + /* 0004 */ std::uint32_t version; + /* 0008 */ std::uint32_t tick; }; +#if defined(_WIN32) && !defined(_WIN64) + static_assert(sizeof(Recent) == 0xC); +#endif /* 0004 */ std::deque> m_pending; /* 0018 */ std::deque m_recent; }; diff --git a/Source/Contents/Ground/GroundGeometry.h b/Source/Contents/Ground/GroundGeometry.h index f48375f..32151f1 100644 --- a/Source/Contents/Ground/GroundGeometry.h +++ b/Source/Contents/Ground/GroundGeometry.h @@ -4,6 +4,7 @@ #include "Contents/Ground/GroundSpatial.h" #include "Contents/Ground/GroundWaterState.h" +#include #include class CGndRes; @@ -11,10 +12,10 @@ class TextureCache; struct GroundRenderContext; struct GroundLightmap { - unsigned char color[4]; - CTexture* texture; - float uv[4][2]; - std::uint32_t unknown_0028[4]; + /* 0000 */ unsigned char color[4]; + /* 0004 */ CTexture* texture; + /* 0008 */ float uv[4][2]; + /* 0028 */ std::uint32_t unknown_0028[4]; }; class GroundGeometry { @@ -75,6 +76,9 @@ private: #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(GroundLightmap) == 56); +static_assert(offsetof(GroundLightmap, texture) == 0x04); +static_assert(offsetof(GroundLightmap, uv) == 0x08); +static_assert(offsetof(GroundLightmap, unknown_0028) == 0x28); #endif #endif diff --git a/Source/Contents/Ground/GroundSpatial.h b/Source/Contents/Ground/GroundSpatial.h index dd6e9ee..2e5536e 100644 --- a/Source/Contents/Ground/GroundSpatial.h +++ b/Source/Contents/Ground/GroundSpatial.h @@ -1,6 +1,7 @@ #ifndef RAGNAROK_SOURCE_CONTENTS_GROUND_GROUNDSPATIAL_H #define RAGNAROK_SOURCE_CONTENTS_GROUND_GROUNDSPATIAL_H +#include #include #include @@ -10,14 +11,14 @@ struct GroundLightmap; struct GroundQuad { GroundQuad(); - float vertices[4][8]; - std::uint32_t unknown_0080; - CTexture* texture; - CTexture* lightmapTexture; - GroundLightmap* lightmap; - std::uint32_t color; - std::uint32_t selected; - std::uint32_t unknown_0098; + /* 0000 */ float vertices[4][8]; + /* 0080 */ std::uint32_t unknown_0080; + /* 0084 */ CTexture* texture; + /* 0088 */ CTexture* lightmapTexture; + /* 008C */ GroundLightmap* lightmap; + /* 0090 */ std::uint32_t color; + /* 0094 */ std::uint32_t selected; + /* 0098 */ std::uint32_t unknown_0098; }; struct GroundCell { @@ -45,6 +46,9 @@ struct GroundSpatial { #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(GroundQuad) == 156); +static_assert(offsetof(GroundQuad, texture) == 0x84); +static_assert(offsetof(GroundQuad, lightmap) == 0x8C); +static_assert(offsetof(GroundQuad, selected) == 0x94); static_assert(sizeof(GroundCell) == 84); #endif diff --git a/Source/Contents/Ground/GroundWaterState.h b/Source/Contents/Ground/GroundWaterState.h index 64c5786..9fe1561 100644 --- a/Source/Contents/Ground/GroundWaterState.h +++ b/Source/Contents/Ground/GroundWaterState.h @@ -1,6 +1,7 @@ #ifndef RAGNAROK_SOURCE_CONTENTS_GROUND_GROUNDWATERSTATE_H #define RAGNAROK_SOURCE_CONTENTS_GROUND_GROUNDWATERSTATE_H +#include #include #include @@ -9,15 +10,15 @@ class CTexture; class TextureCache; struct GroundWaterSurface { - float level; - int type; - float height; - float speed; - float pitch; - int animation; - int frame; - float phase; - CTexture* texture; + /* 0000 */ float level; + /* 0004 */ int type; + /* 0008 */ float height; + /* 000C */ float speed; + /* 0010 */ float pitch; + /* 0014 */ int animation; + /* 0018 */ int frame; + /* 001C */ float phase; + /* 0020 */ CTexture* texture; }; struct GroundWaterState { @@ -42,6 +43,7 @@ struct GroundWaterState { #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(GroundWaterSurface) == 36); +static_assert(offsetof(GroundWaterSurface, texture) == 0x20); #endif #endif diff --git a/Source/Contents/Ground/TerrainHeight.h b/Source/Contents/Ground/TerrainHeight.h index 8149db1..d60debc 100644 --- a/Source/Contents/Ground/TerrainHeight.h +++ b/Source/Contents/Ground/TerrainHeight.h @@ -1,11 +1,12 @@ #ifndef RAGNAROK_SOURCE_CONTENTS_GROUND_TERRAINHEIGHT_H #define RAGNAROK_SOURCE_CONTENTS_GROUND_TERRAINHEIGHT_H +#include #include struct TerrainHeightCell { - float heights[4]; - std::uint32_t type; + /* 0000 */ float heights[4]; + /* 0010 */ std::uint32_t type; }; struct TerrainHeight { @@ -29,5 +30,8 @@ struct TerrainHeight { }; static_assert(sizeof(TerrainHeightCell) == 20); +#if defined(_WIN32) && !defined(_WIN64) +static_assert(offsetof(TerrainHeightCell, type) == 0x10); +#endif #endif diff --git a/Source/Contents/Hotkeys/EmotionHotkeys.h b/Source/Contents/Hotkeys/EmotionHotkeys.h index 79e8bb8..b8d826e 100644 --- a/Source/Contents/Hotkeys/EmotionHotkeys.h +++ b/Source/Contents/Hotkeys/EmotionHotkeys.h @@ -1,6 +1,7 @@ #ifndef RAGNAROK_SOURCE_CONTENTS_HOTKEYS_EMOTIONHOTKEYS_H #define RAGNAROK_SOURCE_CONTENTS_HOTKEYS_EMOTIONHOTKEYS_H +#include #include #include #include @@ -9,8 +10,8 @@ class CRenderSystemBase; struct EmotionHotkeys { - std::vector current; - std::vector saved; + /* 0FF8 */ std::vector current; + /* 1004 */ std::vector saved; void Load(Json::Value& data); bool HasChanges() const; @@ -21,6 +22,7 @@ struct EmotionHotkeys { #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(EmotionHotkeys) == 24); +static_assert(offsetof(EmotionHotkeys, saved) == 12); #endif #endif diff --git a/Source/Contents/Hotkeys/HotkeyInfo.h b/Source/Contents/Hotkeys/HotkeyInfo.h index 3c564a9..6d87769 100644 --- a/Source/Contents/Hotkeys/HotkeyInfo.h +++ b/Source/Contents/Hotkeys/HotkeyInfo.h @@ -1,15 +1,16 @@ #ifndef RAGNAROK_SOURCE_CONTENTS_HOTKEYS_HOTKEYINFO_H #define RAGNAROK_SOURCE_CONTENTS_HOTKEYS_HOTKEYINFO_H +#include #include class LuaScript; struct HotkeyInfo { - int key1; - int key2; - std::string text; - std::string description; + /* 0000 */ int key1; + /* 0004 */ int key2; + /* 0008 */ std::string text; + /* 0020 */ std::string description; HotkeyInfo(); ~HotkeyInfo(); }; @@ -22,6 +23,8 @@ bool SkillUsesPercentSp(int id); #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(HotkeyInfo) == 56); +static_assert(offsetof(HotkeyInfo, text) == 8); +static_assert(offsetof(HotkeyInfo, description) == 0x0020); #endif #endif diff --git a/Source/Contents/Hotkeys/UserHotkeyMgr.h b/Source/Contents/Hotkeys/UserHotkeyMgr.h index c663cb1..3c5d3c6 100644 --- a/Source/Contents/Hotkeys/UserHotkeyMgr.h +++ b/Source/Contents/Hotkeys/UserHotkeyMgr.h @@ -23,12 +23,15 @@ public: protected: friend class CAccountLinkedUserDataMgr; struct Hotkey { - int tab; - int index; - int key1; - int key2; - std::string description; + /* 0000 */ int tab; + /* 0004 */ int index; + /* 0008 */ int key1; + /* 000C */ int key2; + /* 0010 */ std::string description; }; +#if defined(_WIN32) && !defined(_WIN64) + static_assert(sizeof(Hotkey) == 40); +#endif /* 0004 */ bool m_enabled; /* 0005 */ bool m_loaded; /* 0008 */ std::uint32_t m_changes; diff --git a/Source/Contents/InstantVar.h b/Source/Contents/InstantVar.h index 69f7175..7dae25c 100644 --- a/Source/Contents/InstantVar.h +++ b/Source/Contents/InstantVar.h @@ -13,7 +13,7 @@ public: void Clear(); private: - std::map m_values; + /* 0004 */ std::map m_values; }; #if defined(_WIN32) && !defined(_WIN64)