feat(profile): update 3.3.5a profile

This commit is contained in:
phaneron 2024-11-27 01:59:15 -05:00
parent 9053d61b6b
commit e1bab2b375
186 changed files with 1204 additions and 43942 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,455 @@
#ifndef M2_DATA_H
#define M2_DATA_H
#include "system/types.h"
#include "gx/buffer.h"
#include "tempest/vector.h"
#include "tempest/box.h"
#include "tempest/quaternion.h"
DECLARE_STRUCT(M2SequenceTimes);
DECLARE_STRUCT(M2TrackBase);
DECLARE_STRUCT(M2Attachment);
DECLARE_STRUCT(M2Batch);
DECLARE_STRUCT(M2Bounds);
DECLARE_STRUCT(M2Camera);
DECLARE_STRUCT(M2Color);
DECLARE_STRUCT(M2CompQuat);
DECLARE_STRUCT(M2CompBone__CompressData);
DECLARE_STRUCT(M2CompBone);
DECLARE_STRUCT(M2Event);
DECLARE_STRUCT(M2Light);
DECLARE_STRUCT(M2Loop);
DECLARE_STRUCT(M2Material);
DECLARE_STRUCT(M2Particle);
DECLARE_STRUCT(M2Ribbon);
DECLARE_STRUCT(M2Sequence);
DECLARE_STRUCT(M2SkinSection);
DECLARE_STRUCT(M2Texture);
DECLARE_STRUCT(M2TextureTransform);
DECLARE_STRUCT(M2TextureWeight);
DECLARE_STRUCT(M2Vertex);
DECLARE_STRUCT(M2Data);
DECLARE_STRUCT(M2SkinProfile);
// from whoa: src/model/M2Data.hpp
/*
M2Array has been modified from the implementation present in 12340. The
implementation present in 12340 looks like this:
template<class T>
struct M2Array {
uint32_t count;
union {
T* data;
uint32_t offset;
}
};
On a 32-bit system, sizeof(M2Array) == 8 bytes in memory: 4 bytes for the
count, and 4 bytes for the union. This lines up with M2Array in the .m2
files: each M2Array is 8 bytes.
In 12340 (and until 64-bit support was introduced), the M2Init functions
simply adjust the M2Array when loading:
m2Data->someM2Array.offset =
(uint32_t)m2Data + m2Data->someM2Array.offset;
This ensures T* data points to the appropriate (absolute) location in
memory.
Unfortunately, this approach fails on 64-bit systems. On a 64-bit system,
M2Array would occupy 12 bytes in memory: 4 bytes for the count, and 8 bytes
for the union. This would make the approach outlined above fail.
As a result, on 64-bit systems, a different approach is used: M2Arrays are
assumed (reasonably so) to only exist within the same structure that their
on-disk offsets reference. Thus, M2Init adjusts the M2Array when loading:
uintptr_t absoluteOffset =
(uintptr_t)m2Data + m2Data->someM2Array.offset;
uintptr_t relativeOffset =
absoluteOffset - (uintptr_t)&m2Data->someM2Array;
m2Data->someM2Array.offset =
(uint32_t)relativeOffset;
By storing the relative offset, access to the data is possible by adding
the relative offset to the address of the M2Array:
uintptr_t absoluteOffset =
(uintptr_t)m2Data->someM2Array + m2Data->someM2Array.offset;
T* data = (T*)absoluteOffset;
*/
#define M2_ARRAY(T) typedef struct M2Array_##T M2Array_##T; \
struct M2Array_##T { \
uint32_t count; \
union { \
T* data; \
uint32_t offset; \
} data_or_offset; \
};
// declare basic types here
M2_ARRAY(ubyte4);
M2_ARRAY(uint32_t);
M2_ARRAY(C2Vector); // required by M2PartTrack
#define M2_SEQUENCE_KEYS(T) \
M2_ARRAY(T); \
typedef struct M2SequenceKeys_##T M2SequenceKeys_##T; \
struct M2SequenceKeys_##T { \
M2Array_##T keys; \
};
struct M2SequenceTimes {
M2Array_uint32_t times;
};
M2_ARRAY(M2SequenceTimes);
struct M2TrackBase {
uint16_t trackType;
uint16_t loopIndex;
M2Array_M2SequenceTimes sequenceTimes;
};
// template<class T>
// class M2Track : public M2TrackBase
#define M2_TRACK(T) \
M2_SEQUENCE_KEYS(T); \
M2_ARRAY(M2SequenceKeys_##T); \
typedef struct M2Track_##T M2Track_##T; \
struct M2Track_##T { \
M2TrackBase b_base; \
M2Array_M2SequenceKeys_##T sequenceKeys; \
};
// declare basic types here
M2_TRACK(uint8_t);
M2_TRACK(uint16_t);
M2_TRACK(fixed16);
M2_TRACK(float);
M2_TRACK(C3Vector);
M2_TRACK(C4Quaternion);
struct M2Attachment {
uint32_t attachmentId;
uint16_t boneIndex;
C3Vector position;
M2Track_uint8_t visibilityTrack;
};
M2_ARRAY(M2Attachment);
struct M2Batch {
uint8_t flags;
int8_t priorityPlane;
uint16_t shader;
uint16_t skinSectionIndex;
uint16_t geosetIndex;
uint16_t colorIndex;
uint16_t materialIndex;
uint16_t materialLayer;
uint16_t textureCount;
uint16_t textureComboIndex;
uint16_t textureCoordComboIndex;
uint16_t textureWeightComboIndex;
uint16_t textureTransformComboIndex;
};
M2_ARRAY(M2Batch);
struct M2Bounds {
CAaBox extent;
float radius;
};
#define M2_SPLINE_KEY(T) \
typedef struct M2SplineKey_##T M2SplineKey_##T; \
struct M2SplineKey_##T { \
T value; \
T inTan; \
T outTan; \
};
// declare types here
M2_SPLINE_KEY(float);
M2_SPLINE_KEY(C3Vector);
M2_TRACK(M2SplineKey_float);
M2_TRACK(M2SplineKey_C3Vector);
struct M2Camera {
uint32_t cameraId;
float fieldOfView;
float farClip;
float nearClip;
M2Track_M2SplineKey_C3Vector positionTrack;
C3Vector positionPivot;
M2Track_M2SplineKey_C3Vector targetTrack;
C3Vector targetPivot;
M2Track_M2SplineKey_float rollTrack;
};
M2_ARRAY(M2Camera);
struct M2Color {
M2Track_C3Vector colorTrack;
M2Track_fixed16 alphaTrack;
};
M2_ARRAY(M2Color);
struct M2CompQuat {
uint32_t auCompQ[2];
};
M2_TRACK(M2CompQuat);
struct M2CompBone__CompressData {
uint16_t uDistToFurthDesc;
uint16_t uZRatioOfChain;
};
struct M2CompBone {
uint32_t boneId;
uint32_t flags;
uint16_t parentIndex;
uint16_t uDistToParent;
union {
M2CompBone__CompressData CompressData;
uint32_t boneNameCRC;
};
M2Track_C3Vector translationTrack;
M2Track_M2CompQuat rotationTrack;
M2Track_C3Vector scaleTrack;
C3Vector pivot;
};
M2_ARRAY(M2CompBone);
struct M2Event {
uint32_t eventId;
uint32_t data;
uint16_t boneIndex;
C3Vector position;
M2TrackBase eventTrack;
};
M2_ARRAY(M2Event);
struct M2Light {
uint16_t lightType;
uint16_t boneIndex;
C3Vector position;
M2Track_C3Vector ambientColorTrack;
M2Track_float ambientIntensityTrack;
M2Track_C3Vector diffuseColorTrack;
M2Track_float diffuseIntensityTrack;
M2Track_float attenuationStartTrack;
M2Track_float attenuationEndTrack;
M2Track_uint8_t visibilityTrack;
};
M2_ARRAY(M2Light);
struct M2Loop {
uint32_t length;
};
M2_ARRAY(M2Loop);
struct M2Material {
uint16_t flags;
uint16_t blendMode;
};
M2_ARRAY(M2Material);
#define M2_PART_TRACK(T) \
typedef struct M2PartTrack_##T M2PartTrack_##T; \
struct M2PartTrack_##T { \
M2Array_fixed16 times; \
M2Array_##T values; \
};
// declare types here
M2_PART_TRACK(fixed16);
M2_PART_TRACK(uint16_t);
M2_PART_TRACK(C2Vector);
M2_PART_TRACK(C3Vector);
struct M2Particle {
uint32_t particleId;
uint32_t flags;
C3Vector position;
uint16_t boneIndex;
uint16_t textureIndex;
M2Array_uint8_t geometryMdl;
M2Array_uint8_t recursionMdl;
uint8_t blendMode;
uint8_t emitterType;
uint16_t colorIndex;
uint16_t pad;
int16_t priorityPlane;
uint16_t rows;
uint16_t cols;
M2Track_float speedTrack;
M2Track_float variationTrack;
M2Track_float latitudeTrack;
M2Track_float longitudeTrack;
M2Track_float gravityTrack;
M2Track_float lifeTrack;
float lifeVariation;
M2Track_float emissionRateTrack;
float emissionRateVariation;
M2Track_float widthTrack;
M2Track_float lengthTrack;
M2Track_float zsourceTrack;
M2PartTrack_C3Vector colorTrack;
M2PartTrack_fixed16 alphaTrack;
M2PartTrack_C2Vector scaleTrack;
C2Vector scaleVariation;
M2PartTrack_uint16_t headCellTrack;
M2PartTrack_uint16_t tailCellTrack;
float tailLength;
float twinkleFPS;
float twinkleOnOff;
CRange twinkleScale;
float ivelScale;
float drag;
float initialSpin;
float initialSpinVariation;
float spin;
float spinVariation;
CAaBox tumble;
C3Vector windVector;
float windTime;
float followSpeed1;
float followScale1;
float followSpeed2;
float followScale2;
M2Array_C3Vector spline;
M2Track_uint8_t visibilityTrack;
};
M2_ARRAY(M2Particle);
struct M2Ribbon {
uint32_t ribbonId;
uint16_t boneIndex;
C3Vector position;
M2Track_uint16_t textureIndices;
M2Track_uint16_t materialIndices;
M2Track_C3Vector colorTrack;
M2Track_fixed16 alphaTrack;
M2Track_float heightAboveTrack;
M2Track_float heightBelowTrack;
float edgesPerSecond;
float edgeLifetime;
float gravity;
uint16_t textureRows;
uint16_t textureCols;
M2Track_uint16_t textureSlotTrack;
M2Track_uint8_t visibilityTrack;
int16_t priorityPlane;
uint16_t pad;
};
M2_ARRAY(M2Ribbon);
struct M2Sequence {
uint16_t id;
uint16_t variationIndex;
uint32_t duration;
float movespeed;
uint32_t flags;
uint32_t frequency;
CiRange replay;
uint32_t blendtime;
M2Bounds bounds;
uint16_t variationNext;
uint16_t aliasNext;
};
M2_ARRAY(M2Sequence);
struct M2SkinSection {
uint32_t skinSectionId;
uint16_t vertexStart;
uint16_t vertexCount;
uint16_t indexStart;
uint16_t indexCount;
uint16_t boneCount;
uint16_t boneComboIndex;
uint16_t boneInfluences;
uint16_t centerBoneIndex;
C3Vector centerPosition;
C3Vector sortCenterPosition;
float sortRadius;
};
M2_ARRAY(M2SkinSection);
struct M2Texture {
uint32_t textureId;
uint16_t flags;
M2Array_uint8_t filename;
};
M2_ARRAY(M2Texture);
struct M2TextureTransform {
M2Track_C3Vector translationTrack;
M2Track_M2CompQuat rotationTrack;
M2Track_C3Vector scaleTrack;
};
M2_ARRAY(M2TextureTransform);
struct M2TextureWeight {
M2Track_fixed16 weightTrack;
};
M2_ARRAY(M2TextureWeight);
struct M2Vertex {
C3Vector position;
ubyte4 weights;
ubyte4 indices;
C3Vector normal;
C2Vector texcoord[2];
};
M2_ARRAY(M2Vertex);
// .m2 files
struct M2Data {
uint32_t MD20;
uint32_t version;
M2Array_uint8_t name;
uint32_t flags;
M2Array_M2Loop loops;
M2Array_M2Sequence sequences;
M2Array_uint16_t sequenceIdxHashById;
M2Array_M2CompBone bones;
M2Array_uint16_t boneIndicesById;
M2Array_M2Vertex vertices;
uint32_t numSkinProfiles;
M2Array_M2Color colors;
M2Array_M2Texture textures;
M2Array_M2TextureWeight textureWeights;
M2Array_M2TextureTransform textureTransforms;
M2Array_uint16_t textureIndicesById;
M2Array_M2Material materials;
M2Array_uint16_t boneCombos;
M2Array_uint16_t textureCombos;
M2Array_uint16_t textureCoordCombos;
M2Array_uint16_t textureWeightCombos;
M2Array_uint16_t textureTransformCombos;
M2Bounds bounds;
M2Bounds collisionBounds;
M2Array_uint16_t collisionIndices;
M2Array_C3Vector collisionPositions;
M2Array_C3Vector collisionFaceNormals;
M2Array_M2Attachment attachments;
M2Array_uint16_t attachmentIndicesById;
M2Array_M2Event events;
M2Array_M2Light lights;
M2Array_M2Camera cameras;
M2Array_uint16_t cameraIndicesById;
M2Array_M2Ribbon ribbons;
M2Array_M2Particle particles;
M2Array_uint16_t textureCombinerCombos;
};
// .skin files
struct M2SkinProfile {
uint32_t magic;
M2Array_uint16_t vertices;
M2Array_uint16_t indices;
M2Array_ubyte4 bones;
M2Array_M2SkinSection skinSections;
M2Array_M2Batch batches;
uint32_t boneCountMax;
};
#endif

View file

@ -0,0 +1,28 @@
#ifndef M2_LIGHT_H
#define M2_LIGHT_H
DECLARE_STRUCT(CM2Light);
#include "m2/scene.h"
struct CM2Light {
CM2Scene* m_scene;
uint32_t dword4;
uint32_t m_type;
C3Vector m_pos;
float float10;
float float14;
float float18;
C3Vector m_dir;
C3Vector m_ambColor;
C3Vector m_dirColor;
C3Vector m_specColor;
float m_constantAttenuation;
float m_linearAttenuation;
float m_quadraticAttenuation;
uint32_t m_visible;
CM2Light** m_lightPrev;
CM2Light* m_lightNext;
};
#endif

View file

@ -0,0 +1,34 @@
#ifndef M2_LIGHTING_H
#define M2_LIGHTING_H
DECLARE_STRUCT(CM2Lighting);
#include "m2/scene.h"
#include "tempest/vector.h"
#include "tempest/sphere.h"
#include "tempest/plane.h"
struct CM2Lighting {
CM2Scene* m_scene;
CAaSphere sphere4;
uint32_t m_flags;
C3Vector vector18;
C3Vector vector24;
C3Vector vector30;
C3Vector vector3C;
C3Vector vector48;
C3Vector m_sunAmbient;
C3Vector m_sunDiffuse;
C3Vector m_sunSpecular;
C3Vector m_sunDir;
CM2Light* m_lights[4];
uint32_t m_lightCount;
float m_fogStart;
float m_fogEnd;
float m_fogScale;
float m_fogDensity;
C3Vector m_fogColor;
C4Plane m_liquidPlane;
};
#endif

View file

@ -0,0 +1,270 @@
#ifndef M2_MODEL_H
#define M2_MODEL_H
DECLARE_STRUCT(M2ModelAttachment);
DECLARE_STRUCT(M2ModelBoneSeq);
DECLARE_STRUCT(M2ModelBone);
DECLARE_STRUCT(M2ModelCamera);
DECLARE_STRUCT(M2ModelColor);
DECLARE_STRUCT(M2ModelLight);
DECLARE_STRUCT(M2ModelRibbon);
DECLARE_STRUCT(M2ModelTextureTransform);
DECLARE_STRUCT(M2ModelTextureWeight);
DECLARE_STRUCT(M2ModelOptGeo);
DECLARE_STRUCT(CM2ModelCall);
DECLARE_STRUCT(CM2Model);
#include "camera/camera.h"
#include "m2/data.h"
#include "m2/scene.h"
#include "m2/shared.h"
#include "m2/lighting.h"
#include "m2/ribbon.h"
#include "tempest/vector.h"
#include "tempest/quaternion.h"
#include "gx/texture.h"
// template<class T>
#define M2_MODEL_TRACK(T) \
typedef struct M2ModelTrack_##T M2ModelTrack_##T; \
struct M2ModelTrack_##T { \
uint32_t currentKey; \
M2Track_##T* sourceTrack; \
T currentValue; \
};
M2_MODEL_TRACK(uint8_t);
M2_MODEL_TRACK(float);
M2_MODEL_TRACK(C3Vector);
M2_MODEL_TRACK(C4Quaternion);
struct M2ModelAttachment {
int32_t unk;
};
struct M2ModelBoneSeq {
uint32_t uint0;
uint16_t uint4;
uint16_t uint6;
uint16_t uint8;
uint8_t uintA;
uint8_t uintB;
uint32_t uintC;
uint32_t uint10;
float float14;
float float18;
uint32_t uint1C;
uint32_t uint20;
};
struct M2ModelBone {
M2ModelTrack_C3Vector translationTrack;
M2ModelTrack_C4Quaternion rotationTrack;
M2ModelTrack_C3Vector scaleTrack;
M2ModelBoneSeq sequence;
M2ModelBoneSeq secondarySequence;
uint32_t flags;
uint32_t uint90;
uint16_t uint94;
uint32_t uint9C;
float floatA0;
float floatA4;
float floatA8;
};
struct M2ModelCamera {
M2ModelTrack_C3Vector positionTrack;
M2ModelTrack_C3Vector targetTrack;
M2ModelTrack_float rollTrack;
HCAMERA m_camera;
};
struct M2ModelColor {
M2ModelTrack_C3Vector colorTrack;
M2ModelTrack_float alphaTrack;
};
struct M2ModelLight {
M2ModelTrack_C3Vector ambientColorTrack;
M2ModelTrack_float ambientIntensityTrack;
M2ModelTrack_C3Vector diffuseColorTrack;
M2ModelTrack_float diffuseIntensityTrack;
M2ModelTrack_uint8_t visibilityTrack;
uint32_t uint64;
CM2Light light;
};
struct M2ModelRibbon {
uint32_t dword0;
uint32_t dword4;
uint32_t dword8;
uint32_t dwordC;
uint32_t dword10;
uint32_t dword14;
uint32_t dword18;
uint32_t dword1C;
uint32_t dword20;
uint32_t dword24;
uint32_t dword28;
uint32_t dword2C;
uint32_t dword30;
uint32_t dword34;
uint32_t dword38;
uint32_t dword3C;
uint32_t dword40;
uint32_t dword44;
uint32_t dword48;
uint32_t dword4C;
};
struct M2ModelTextureTransform {
int32_t unk;
};
struct M2ModelTextureWeight {
M2ModelTrack_float weightTrack;
};
struct M2ModelOptGeo {
M2Batch* batches;
uint32_t dword4;
M2SkinSection* skinSections;
uint32_t dwordC;
uint32_t dword10;
uint32_t dword14;
uint32_t dword18;
CShaderEffect** effects;
uint32_t dword20;
uint32_t dword24;
uint32_t dword28;
uint32_t dword2C;
uint32_t dword30;
uint32_t dword34;
uint32_t dword38;
uint32_t dword3C;
uint32_t dword40;
uint32_t dword44;
uint32_t dword48;
uint32_t dword4C;
};
struct CM2ModelCall {
uint32_t type;
CM2ModelCall* modelCallNext;
uint32_t time;
uint32_t args[8];
};
struct CM2Model {
uint32_t m_refCount;
uint32_t m_flags;
CM2Model** m_scenePrev;
CM2Model* m_sceneNext;
// uint32_t m_loaded : 1;
// uint32_t m_flag2 : 1;
// uint32_t m_flag4 : 1;
// uint32_t m_flag8 : 1;
// uint32_t m_flag10 : 1;
// uint32_t m_flag20 : 1;
// uint32_t m_flag40 : 1;
// uint32_t m_flag80 : 1;
// uint32_t m_flag100 : 1;
// uint32_t m_flag200 : 1;
// uint32_t m_flag400 : 1;
// uint32_t m_flag800 : 1;
// uint32_t m_flag1000 : 1;
// uint32_t m_flag2000 : 1;
// uint32_t m_flag4000 : 1;
// uint32_t m_flag8000 : 1;
// uint32_t m_flag10000 : 1;
// uint32_t m_flag20000 : 1;
// uint32_t m_flag40000 : 1;
// uint32_t m_flag80000 : 1;
// uint32_t m_flag100000 : 1;
// uint32_t m_flag200000 : 1;
// uint32_t m_flag400000 : 1;
uint32_t f_flags;
uint32_t dword14;
CM2Model** m_callbackPrev;
CM2Model* m_callbackNext;
void* m_loadedCallback;
void* m_loadedArg;
CM2Scene* m_scene;
CM2Shared* m_shared;
CM2Model* model30;
CM2ModelCall* m_modelCallList;
CM2ModelCall** m_modelCallTail;
uint32_t dword3C;
CM2Model** m_animatePrev;
CM2Model* m_animateNext;
CM2Model* m_attachParent;
void* m_attachments;
uint32_t dword50;
uint32_t dword54;
CM2Model* model58;
uint32_t dword5C;
CM2Model* model60;
uint32_t m_time;
CM2Model** m_drawPrev;
CM2Model* m_drawNext;
uint32_t* m_loops;
uint32_t uint74;
uint32_t dword78;
uint32_t dword7C;
uint32_t dword80;
uint32_t dword84;
float float88;
uint32_t uint8C;
uint32_t uint90;
M2ModelBone* m_bones;
C44Matrix* m_boneMatrices;
void* m_skinSections;
M2ModelColor* m_colors;
HTEXTURE* m_textures;
M2ModelTextureWeight* m_textureWeights;
void* m_textureTransforms;
C44Matrix* m_textureMatrices;
C44Matrix matrixB4;
C44Matrix matrixF4;
C44Matrix matrix134;
uint32_t dword174;
float m_alpha;
uint32_t dword17C;
uint32_t dword180;
uint32_t dword184;
uint32_t dword188;
uint32_t dword18C;
uint32_t dword190;
uint32_t dword194;
float float198;
float alpha19C;
C3Vector m_currentDiffuse;
C3Vector m_currentEmissive;
uint32_t dword1B8;
void* m_drawCallback;
uint32_t dword1C0;
uint32_t dword1C4;
uint32_t dword1C8;
uint32_t dword1CC;
M2ModelLight* m_lights;
CM2Lighting m_lighting;
CM2Lighting* m_currentLighting;
void* m_lightingCallback;
void* m_lightingArg;
M2ModelCamera* m_cameras;
M2ModelRibbon* m_ribbons;
CRibbonEmitter* m_ribbonEmitters;
void* m_particles;
uint32_t dword2C4;
uint32_t dword2C8;
uint32_t dword2CC;
M2ModelOptGeo* m_optGeo;
uint32_t dword2D4;
uint32_t dword2D8;
uint32_t dword2DC;
uint32_t dword2E0;
uint32_t dword2E4;
uint32_t dword2E8;
uint32_t dword2EC;
};
#endif

View file

@ -0,0 +1,115 @@
#ifndef M2_RIBBON_H
#define M2_RIBBON_H
#include "system/types.h"
#include "gx/types.h"
#include "gx/texture.h"
#include "storm/array.h"
#include "storm/array/uint32_t.h"
#include "tempest/vector.h"
DECLARE_STRUCT(CRibbonMat);
DECLARE_STRUCT(CRibbonEmitter);
struct CRibbonMat {
// int32 enableLighting : 1;
// int32 enableFog : 1;
// int32 enableDepthTest : 1;
// int32 enableDepthWrite : 1;
// int32 enableCulling : 1;
uint32_t f_flags;
EGxBlend alpha;
};
STORM_TS_GROWABLE_ARRAY(CRibbonMat);
struct CRibbonEmitter {
uint32_t m_refCount;
uint32_t dword4;
uint32_t dword8;
uint32_t dwordC;
uint32_t dword10;
uint32_t dword14;
uint32_t dword18;
uint32_t dword1C;
uint32_t dword20;
uint32_t dword24;
uint32_t dword28;
uint32_t dword2C;
uint32_t dword30;
uint32_t dword34;
uint32_t dword38;
uint32_t dword3C;
uint32_t dword40;
uint32_t dword44;
uint32_t dword48;
uint32_t dword4C;
uint32_t dword50;
uint32_t dword54;
float m_ooLifeSpan;
float m_tmpDU;
float m_tmpDV;
float m_ooTmpDU;
float m_ooTmpDV;
uint32_t dword6C;
uint32_t dword70;
uint32_t dword74;
uint32_t dword78;
uint32_t dword7C;
uint32_t dword80;
uint32_t dword84;
uint32_t dword88;
uint32_t dword8C;
uint32_t dword90;
uint32_t dword94;
uint32_t dword98;
uint32_t dword9C;
uint32_t dwordA0;
uint32_t dwordA4;
uint32_t dwordA8;
uint32_t dwordAC;
uint32_t dwordB0;
uint32_t dwordB4;
uint32_t dwordB8;
uint32_t dwordBC;
uint32_t dwordC0;
uint32_t dwordC4;
uint32_t dwordC8;
uint32_t dwordCC;
uint32_t dwordD0;
uint32_t dwordD4;
uint32_t dwordD8;
uint32_t dwordDC;
uint32_t dwordE0;
uint32_t dwordE4;
uint32_t dwordE8;
uint32_t dwordEC;
uint32_t dwordF0;
uint32_t dwordF4;
uint32_t dwordF8;
uint32_t dwordFC;
uint32_t dword100;
uint32_t dword104;
uint32_t dword108;
uint32_t dword10C;
float m_edgeLifeSpan;
TSGrowableArray_CRibbonMat m_materials;
TSGrowableArray_HTEXTURE m_textures;
TSGrowableArray_uint32_t m_replaces;
CImVector m_diffuseClr;
uint32_t dword148;
uint32_t dword14C;
uint32_t dword150;
uint32_t dword154;
uint32_t dword158;
uint32_t dword15C;
uint32_t dword160;
uint32_t dword164;
uint32_t dword168;
uint32_t dword16C;
uint32_t m_texSlot;
float m_above;
float m_below;
float m_gravity;
};
#endif

View file

@ -0,0 +1,51 @@
#ifndef M2_SCENE_H
#define M2_SCENE_H
DECLARE_STRUCT(CM2Scene);
#include "m2/cache.h"
#include "m2/types.h"
#include "m2/model.h"
#include "m2/light.h"
#include "storm/array/uint32_t.h"
#include "tempest/matrix.h"
struct CM2Scene {
uint32_t dword0;
CM2Cache* m_cache;
CM2Model* m_modelList;
uint32_t m_time;
uint32_t uint10;
uint32_t uint14;
uint32_t dword18;
uint32_t m_flags;
CM2Light* m_lightList;
uint32_t dword24;
CM2Model* m_animateList;
CM2Model* m_drawList;
uint32_t dword30;
TSGrowableArray_M2Element m_elements;
TSGrowableArray_uint32_t array44;
TSGrowableArray_uint32_t array54[3];
C44Matrix m_view;
C44Matrix m_viewInv;
uint32_t uint104;
uint32_t dword108;
uint32_t dword10C;
uint32_t dword110;
uint32_t dword114;
uint32_t dword118;
uint32_t dword11C;
uint32_t dword120;
uint32_t dword124;
uint32_t m_hitList;
uint32_t dword12C;
uint32_t dword130;
uint32_t dword134;
uint32_t dword138;
uint32_t dword13C;
uint32_t dword140;
uint32_t dword144;
};
#endif

View file

@ -0,0 +1,28 @@
#ifndef M2_SHADER_EFFECT
#define M2_SHADER_EFFECT
DECLARE_STRUCT(CShaderEffect);
DECLARE_STRUCT(CShaderEffect_LocalLights);
#include "storm/hash.h"
#include "gx/shader.h"
STORM_TS_HASH(CShaderEffect, HASHKEY_STRI);
struct CShaderEffect_LocalLights {
float float0[44];
};
// class CShaderEffect : public TSHashObject<CShaderEffect, HASHKEY_STRI>
struct CShaderEffect {
TSHashObject_CShaderEffect_HASHKEY_STRI b_base;
uint32_t dword18;
uint32_t dword1C;
uint32_t dword20;
uint32_t dword24;
uint32_t dword28;
CGxShader* vertexShaders[90];
CGxShader* pixelShaders[16];
};
#endif

View file

@ -0,0 +1,52 @@
#ifndef M2_SHARED_H
#define M2_SHARED_H
DECLARE_STRUCT(CM2Shared);
#include "tempest/box.h"
#include "async/object.h"
#include "m2/cache.h"
#include "m2/model.h"
#include "m2/shadereffect.h"
struct CM2Shared {
uint32_t m_refCount;
CM2Cache* m_cache;
uint32_t m_flags;
CAsyncObject* asyncObject;
CM2Model* m_callbackList;
CM2Model** m_callbackTail;
uint32_t dword18;
uint32_t dword1C;
uint32_t dword20;
uint32_t numLowPrioritySequences;
void* lowPrioritySequences;
uint32_t dword2C;
CM2Shared** m_freePrev;
CM2Shared* m_freeNext;
uint32_t dword38;
uint8_t m_filePath[260];
uint8_t* ext;
uint32_t dword144;
uint32_t dword148;
uint32_t dword14C;
M2Data* data;
CAaBox aaBox154;
uint32_t size;
M2SkinProfile* skinProfile;
HTEXTURE* textures;
CGxPool* m_indexPool;
CGxBuf* m_indexBuf;
CGxPool* m_vertexPool;
CGxBuf* m_vertexBuf;
CShaderEffect** m_batchShaders;
M2SkinSection* m_skinSections;
uint32_t uint190;
uint32_t uint194;
uint32_t dword198;
uint32_t dword19C;
uint32_t dword1A0;
uint32_t dword1A4;
};
#endif

View file

@ -0,0 +1,73 @@
#ifndef M2_TYPES_HPP
#define M2_TYPES_HPP
#include "m2/data.h"
#include "storm/array.h"
DECLARE_STRUCT(CM2Model);
DECLARE_STRUCT(CShaderEffect);
DECLARE_ENUM(M2BLEND);
DECLARE_ENUM(M2COMBINER);
DECLARE_ENUM(M2LIGHTTYPE);
DECLARE_ENUM(M2PASS);
DECLARE_STRUCT(M2Element);
enum M2BLEND {
M2BLEND_OPAQUE = 0x0,
M2BLEND_ALPHA_KEY = 0x1,
M2BLEND_ALPHA = 0x2,
M2BLEND_NO_ALPHA_ADD = 0x3,
M2BLEND_ADD = 0x4,
M2BLEND_MOD = 0x5,
M2BLEND_MOD_2X = 0x6,
M2BLEND_COUNT = 0x7,
};
enum M2COMBINER {
M2COMBINER_OPAQUE = 0x0,
M2COMBINER_MOD = 0x1,
M2COMBINER_DECAL = 0x2,
M2COMBINER_ADD = 0x3,
M2COMBINER_MOD2X = 0x4,
M2COMBINER_FADE = 0x5,
M2COMBINER_MOD2X_NA = 0x6,
M2COMBINER_ADD_NA = 0x7,
M2COMBINER_OP_MASK = 0x7,
M2COMBINER_ENVMAP = 0x8,
M2COMBINER_STAGE_SHIFT = 0x4,
};
enum M2LIGHTTYPE {
M2LIGHT_0 = 0,
M2LIGHT_1 = 1
};
enum M2PASS {
M2PASS_0 = 0,
M2PASS_1 = 1,
M2PASS_2 = 2,
M2PASS_COUNT = 3
};
struct M2Element {
int32_t type;
CM2Model* model;
uint32_t flags;
float alpha;
float float10;
float float14;
int32_t index;
int32_t priorityPlane;
M2Batch* batch;
M2SkinSection* skinSection;
CShaderEffect* effect;
uint32_t vertexPermute;
uint32_t pixelPermute;
uint32_t dword3C;
uint32_t dword40;
};
STORM_TS_GROWABLE_ARRAY(M2Element);
#endif