Skip to content

Commit 5b19d1c

Browse files
authored
Added offset and size assertions to API structs (#192)
* CSD offset assertions * Havok offset assertions * Sonicteam::Camera offset assertions * Sonicteam::Enemy offset assertions * Sonicteam::Message offset assertions * Sonicteam::Mission offset assertions * Sonicteam::Player offset assertions * Sonicteam::SoX offset assertions * Sonicteam::StdImageFilters offset assertions * Sonicteam::System::Diagnostics offset assertions * Sonicteam offset assertions * Namespace clean-up
1 parent 5cd3a77 commit 5b19d1c

File tree

198 files changed

+1176
-89
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+1176
-89
lines changed

MarathonRecomp/api/Chao/CSD/Core/csdRCObject.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,10 @@ namespace Chao::CSD
1919
xpointer<void> m_Field0C;
2020
be<uint32_t> m_Field10;
2121
};
22+
23+
MARATHON_ASSERT_OFFSETOF(RCPtrAbs::RCObject, m_pVftable, 0x00);
24+
MARATHON_ASSERT_OFFSETOF(RCPtrAbs::RCObject, m_pMemory, 0x04);
25+
MARATHON_ASSERT_OFFSETOF(RCPtrAbs::RCObject, m_ReferenceCount, 0x08);
26+
MARATHON_ASSERT_OFFSETOF(RCPtrAbs::RCObject, m_Field0C, 0x0C);
27+
MARATHON_ASSERT_OFFSETOF(RCPtrAbs::RCObject, m_Field10, 0x10);
2228
}

MarathonRecomp/api/Chao/CSD/Core/csdRCPtrAbs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@ namespace Chao::CSD
1818
xpointer<Vftable> m_pVftable;
1919
xpointer<RCObject> m_pObject;
2020
};
21+
22+
MARATHON_ASSERT_OFFSETOF(RCPtrAbs, m_pVftable, 0x00);
23+
MARATHON_ASSERT_OFFSETOF(RCPtrAbs, m_pObject, 0x04);
2124
}

MarathonRecomp/api/Chao/CSD/Core/csdTexList.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@ namespace Chao::CSD
1616
xpointer<Vftable> m_pVftable;
1717
RCPtr<uint8_t> m_pRCData;
1818
};
19+
20+
MARATHON_ASSERT_OFFSETOF(CTexList, m_pVftable, 0x00);
21+
MARATHON_ASSERT_OFFSETOF(CTexList, m_pRCData, 0x04);
1922
}

MarathonRecomp/api/Chao/CSD/Manager/csdmNode.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ namespace Chao::CSD
1717
xpointer<CMotionPattern> m_pMotionPattern;
1818
MARATHON_INSERT_PADDING(0x18);
1919
};
20+
21+
MARATHON_ASSERT_OFFSETOF(CNode, m_pMotionPattern, 0x50);
2022
}

MarathonRecomp/api/Chao/CSD/Manager/csdmObserverBase.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ namespace Chao::CSD
1616
xpointer<Vftable> m_pVftable;
1717
MARATHON_INSERT_PADDING(0x0C);
1818
};
19+
20+
MARATHON_ASSERT_OFFSETOF(CObserverBase<void>, m_pVftable, 0x00);
1921
}

MarathonRecomp/api/Chao/CSD/Manager/csdmProject.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,8 @@ namespace Chao::CSD
2323
RCPtr<CTexList> m_rcTexList;
2424
MARATHON_INSERT_PADDING(0x1C);
2525
};
26+
27+
MARATHON_ASSERT_OFFSETOF(Project, pRootNode, 0x00);
28+
29+
MARATHON_ASSERT_OFFSETOF(CProject, m_rcTexList, 0x28);
2630
}

MarathonRecomp/api/Chao/CSD/Manager/csdmResourceBase.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@ namespace Chao::CSD
1818
MARATHON_INSERT_PADDING(4);
1919
xpointer<T> m_pResource;
2020
};
21+
22+
MARATHON_ASSERT_OFFSETOF(CResourceBase<void>, m_pVftable, 0x00);
23+
MARATHON_ASSERT_OFFSETOF(CResourceBase<void>, m_pResource, 0x08);
2124
}

MarathonRecomp/api/Chao/CSD/Manager/csdmScene.h

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,48 @@ namespace Chao::CSD
119119
be<MotionRepeatType> m_MotionRepeatType;
120120
MARATHON_INSERT_PADDING(0x2C);
121121
};
122+
123+
MARATHON_ASSERT_OFFSETOF(CastLink, ChildCastIndex, 0x00);
124+
MARATHON_ASSERT_OFFSETOF(CastLink, SiblingCastIndex, 0x04);
125+
126+
MARATHON_ASSERT_OFFSETOF(CastNode, CastCount, 0x00);
127+
MARATHON_ASSERT_OFFSETOF(CastNode, pCasts, 0x08);
128+
MARATHON_ASSERT_OFFSETOF(CastNode, RootCastIndex, 0x10);
129+
MARATHON_ASSERT_OFFSETOF(CastNode, pCastLinks, 0x18);
130+
131+
MARATHON_ASSERT_OFFSETOF(CastIndex, pCastName, 0x00);
132+
MARATHON_ASSERT_OFFSETOF(CastIndex, CastNodeIndex, 0x08);
133+
MARATHON_ASSERT_OFFSETOF(CastIndex, CastIndex, 0x0C);
134+
135+
MARATHON_ASSERT_OFFSETOF(Scene, FPS, 0x08);
136+
MARATHON_ASSERT_OFFSETOF(Scene, CastNodeCount, 0x30);
137+
MARATHON_ASSERT_OFFSETOF(Scene, pCastNodes, 0x38);
138+
MARATHON_ASSERT_OFFSETOF(Scene, CastCount, 0x40);
139+
MARATHON_ASSERT_OFFSETOF(Scene, pCastIndices, 0x48);
140+
MARATHON_ASSERT_OFFSETOF(Scene, AnimationCount, 0x50);
141+
MARATHON_ASSERT_OFFSETOF(Scene, pAnimationKeyFrameDataList, 0x58);
142+
MARATHON_ASSERT_OFFSETOF(Scene, pAnimationDictionary, 0x60);
143+
MARATHON_ASSERT_OFFSETOF(Scene, AspectRatio, 0x68);
144+
MARATHON_ASSERT_OFFSETOF(Scene, pAnimationFrameDataList, 0x70);
145+
146+
MARATHON_ASSERT_OFFSETOF(SceneIndex, pSceneName, 0x00);
147+
MARATHON_ASSERT_OFFSETOF(SceneIndex, SceneIndex, 0x08);
148+
149+
MARATHON_ASSERT_OFFSETOF(SceneNodeIndex, pSceneNodeName, 0x00);
150+
MARATHON_ASSERT_OFFSETOF(SceneNodeIndex, SceneNodeIndex, 0x04);
151+
152+
MARATHON_ASSERT_OFFSETOF(SceneNode, SceneCount, 0x00);
153+
MARATHON_ASSERT_OFFSETOF(SceneNode, pScenes, 0x08);
154+
MARATHON_ASSERT_OFFSETOF(SceneNode, pSceneIndices, 0x10);
155+
MARATHON_ASSERT_OFFSETOF(SceneNode, SceneNodeCount, 0x18);
156+
MARATHON_ASSERT_OFFSETOF(SceneNode, pSceneNodes, 0x20);
157+
MARATHON_ASSERT_OFFSETOF(SceneNode, pSceneNodeIndices, 0x28);
158+
159+
MARATHON_ASSERT_OFFSETOF(CScene, m_PrevMotionFrame, 0x7C);
160+
MARATHON_ASSERT_OFFSETOF(CScene, m_MotionFrame, 0x80);
161+
MARATHON_ASSERT_OFFSETOF(CScene, m_MotionSpeed, 0x84);
162+
MARATHON_ASSERT_OFFSETOF(CScene, m_MotionStartFrame, 0x88);
163+
MARATHON_ASSERT_OFFSETOF(CScene, m_MotionEndFrame, 0x8C);
164+
MARATHON_ASSERT_OFFSETOF(CScene, m_MotionDisableFlag, 0x9C);
165+
MARATHON_ASSERT_OFFSETOF(CScene, m_MotionRepeatType, 0xB0);
122166
}

MarathonRecomp/api/Chao/CSD/Manager/csdmSubjectBase.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ namespace Chao::CSD
1717
xpointer<Vftable> m_pVftable;
1818
MARATHON_INSERT_PADDING(0x0C);
1919
};
20+
21+
static_assert(__builtin_offsetof(SubjectBase<void, void>, m_pVftable) == 0x00);
2022
}

MarathonRecomp/api/Marathon.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@
157157
#include "Sonicteam/SoX/Graphics/Technique.h"
158158
#include "Sonicteam/SoX/Graphics/TechniqueFXL.h"
159159
#include "Sonicteam/SoX/Graphics/Transforms.h"
160+
#include "Sonicteam/SoX/Graphics/Vertex.h"
160161
#include "Sonicteam/SoX/Graphics/Xenon/DeviceXenon.h"
161162
#include "Sonicteam/SoX/Graphics/Xenon/TextureXenon.h"
162163
#include "Sonicteam/SoX/IResource.h"

0 commit comments

Comments
 (0)