lego: add MxDSType enum, add it to all ctors, refactor MxDSObject (#73)

* lego: add MxDSType enum, add to all ctors

* refactor header

* re-type members

* add size assert for MxDSObject

* fix Parse param

* fix types
This commit is contained in:
Christian Semmler 2023-07-03 19:24:51 +02:00 committed by GitHub
parent d64a04705c
commit e0e338ee44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 78 additions and 52 deletions

View file

@ -4,9 +4,10 @@
MxDSAction::MxDSAction()
{
// TODO
this->SetType(MxDSType_Action);
}
// OFFSET: LEGO1 0x100ada80
// OFFSET: LEGO1 0x100ada80 STUB
MxDSAction::~MxDSAction()
{
// TODO

View file

@ -3,11 +3,10 @@
// OFFSET: LEGO1 0x100c8ff0
MxDSAnim::MxDSAnim()
{
// TODO
this->SetType(MxDSType_Anim);
}
// OFFSET: LEGO1 0x100c91a0
MxDSAnim::~MxDSAnim()
{
// TODO
}

View file

@ -1,13 +1,12 @@
#include "mxdsevent.h"
// OFFSET: LEGO1 0x100c95f0 STUB
// OFFSET: LEGO1 0x100c95f0
MxDSEvent::MxDSEvent()
{
// TODO
this->SetType(MxDSType_Event);
}
// OFFSET: LEGO1 0x100c97a0 STUB
// OFFSET: LEGO1 0x100c97a0
MxDSEvent::~MxDSEvent()
{
// TODO
}

View file

@ -4,9 +4,10 @@
MxDSMediaAction::MxDSMediaAction()
{
// TODO
this->SetType(MxDSType_MediaAction);
}
// OFFSET: LEGO1 0x100c8cf0
// OFFSET: LEGO1 0x100c8cf0 STUB
MxDSMediaAction::~MxDSMediaAction()
{
// TODO

View file

@ -3,11 +3,12 @@
// OFFSET: LEGO1 0x100c9b90
MxDSMultiAction::MxDSMultiAction()
{
// TODO
this->SetType(MxDSType_MultiAction);
}
// OFFSET: LEGO1 0x100ca060
// OFFSET: LEGO1 0x100ca060 STUB
MxDSMultiAction::~MxDSMultiAction()
{
// TODO
}

View file

@ -3,10 +3,12 @@
#include <string.h>
#include <stdlib.h>
DECOMP_SIZE_ASSERT(MxDSObject, 0x2c);
// OFFSET: LEGO1 0x100bf6a0
MxDSObject::MxDSObject()
{
this->m_unk0c = 0;
this->SetType(MxDSType_Object);
this->m_sourceName = NULL;
this->m_unk14 = 0;
this->m_objectName = NULL;
@ -83,15 +85,15 @@ void MxDSObject::SetSourceName(const char *p_sourceName)
}
// OFFSET: LEGO1 0x100bf9c0
int MxDSObject::unk14()
undefined4 MxDSObject::unk14()
{
return 10;
}
// OFFSET: LEGO1 0x100bf9d0
unsigned int MxDSObject::CalculateUnk08()
MxU32 MxDSObject::CalculateUnk08()
{
unsigned int unk08;
MxU32 unk08;
if (this->m_sourceName)
unk08 = strlen(this->m_sourceName) + 3;
@ -111,16 +113,16 @@ unsigned int MxDSObject::CalculateUnk08()
}
// OFFSET: LEGO1 0x100bfa20
void MxDSObject::Parse(char **p_source, MxU16 p_unk24)
void MxDSObject::Parse(char **p_source, MxS16 p_unk24)
{
this->SetSourceName(*p_source);
*p_source += strlen(this->m_sourceName) + 1;
this->m_unk14 = *(int*) *p_source;
this->m_unk14 = *(undefined4*) *p_source;
*p_source += 4;
this->SetObjectName(*p_source);
*p_source += strlen(this->m_objectName) + 1;
this->m_unk1c = *(int*) *p_source;
this->m_unk1c = *(undefined4*) *p_source;
*p_source += 4;
this->m_unk24 = p_unk24;

View file

@ -1,21 +1,25 @@
#ifndef MXDSOBJECT_H
#define MXDSOBJECT_H
#include "decomp.h"
#include "mxcore.h"
#include "mxatomid.h"
#include "mxdstypes.h"
// VTABLE 0x100dc868
// SIZE 0x2c
class MxDSObject : public MxCore
{
public:
__declspec(dllexport) void SetObjectName(const char *p_objectName);
MxDSObject();
virtual ~MxDSObject() override;
MxDSObject &operator=(MxDSObject &p_dsObject);
void CopyFrom(MxDSObject &p_dsObject);
MxDSObject &operator=(MxDSObject &p_dsObject);
__declspec(dllexport) void SetObjectName(const char *p_objectName);
void SetSourceName(const char *p_sourceName);
// OFFSET: LEGO1 0x100bf730
inline virtual const char *ClassName() const override { return "MxDSObject"; }; // vtable+0c
@ -23,33 +27,33 @@ class MxDSObject : public MxCore
// OFFSET: LEGO1 0x100bf740
inline virtual MxBool IsA(const char *name) const override { return !strcmp(name, MxDSObject::ClassName()) || MxCore::IsA(name); }; // vtable+10;
virtual int unk14(); // vtable+14;
virtual unsigned int CalculateUnk08(); // vtable+18;
virtual void Parse(char **p_source, MxU16 p_unk24); // vtable+1c;
void SetSourceName(const char *p_sourceName);
virtual undefined4 unk14(); // vtable+14;
virtual MxU32 CalculateUnk08(); // vtable+18;
virtual void Parse(char **p_source, MxS16 p_unk24); // vtable+1c;
inline const MxAtomId& GetAtomId() { return this->m_atomId; }
inline int GetUnknown1c() { return this->m_unk1c; }
inline undefined4 GetUnknown1c() { return this->m_unk1c; }
inline void SetUnknown1c(int p_unk1c) { this->m_unk1c = p_unk1c; }
inline void SetUnknown1c(undefined4 p_unk1c) { this->m_unk1c = p_unk1c; }
inline void SetUnknown24(MxS16 p_unk24) { this->m_unk24 = p_unk24; }
// OFFSET: ISLE 0x401c40
// OFFSET: LEGO1 0x10005530
inline void SetAtomId(MxAtomId p_atomId) { this->m_atomId = p_atomId; }
protected:
inline void SetType(MxDSType p_type) { this->m_type = p_type; }
private:
unsigned int m_unk08;
MxS16 m_unk0c;
MxU32 m_unk08;
MxU16 m_type;
char* m_sourceName;
int m_unk14;
undefined4 m_unk14;
char *m_objectName;
int m_unk1c;
undefined4 m_unk1c;
MxAtomId m_atomId;
MxS16 m_unk24;
MxU16 m_unk26;
int m_unk28;
undefined4 m_unk28;
};
#endif // MXDSOBJECT_H

View file

@ -3,11 +3,10 @@
// OFFSET: LEGO1 0x100c8870
MxDSObjectAction::MxDSObjectAction()
{
// TODO
this->SetType(MxDSType_ObjectAction);
}
// OFFSET: LEGO1 0x100c8a20
MxDSObjectAction::~MxDSObjectAction()
{
// TODO
}

View file

@ -3,11 +3,10 @@
// OFFSET: LEGO1 0x100cae80
MxDSParallelAction::MxDSParallelAction()
{
this->SetType(MxDSType_ParallelAction);
}
// OFFSET: LEGO1 0x100cb040
MxDSParallelAction::~MxDSParallelAction()
{
}

View file

@ -3,11 +3,12 @@
// OFFSET: LEGO1 0x100cb2b0
MxDSSelectAction::MxDSSelectAction()
{
// TODO
this->SetType(MxDSType_SelectAction);
}
// OFFSET: LEGO1 0x100cb8d0
// OFFSET: LEGO1 0x100cb8d0 STUB
MxDSSelectAction::~MxDSSelectAction()
{
// TODO
}

View file

@ -3,11 +3,12 @@
// OFFSET: LEGO1 0x100ca9d0
MxDSSerialAction::MxDSSerialAction()
{
// TODO
this->SetType(MxDSType_SerialAction);
}
// OFFSET: LEGO1 0x100cac10
// OFFSET: LEGO1 0x100cac10 STUB
MxDSSerialAction::~MxDSSerialAction()
{
// TODO
}

View file

@ -4,10 +4,10 @@
MxDSSound::MxDSSound()
{
// TODO
this->SetType(MxDSType_Sound);
}
// OFFSET: LEGO1 0x100c9470
MxDSSound::~MxDSSound()
{
// TODO
}

View file

@ -3,11 +3,10 @@
// OFFSET: LEGO1 0x100c98c0
MxDSStill::MxDSStill()
{
// TODO
this->SetType(MxDSType_Still);
}
// OFFSET: LEGO1 0x100c9a70
MxDSStill::~MxDSStill()
{
// TODO
}

20
LEGO1/mxdstypes.h Executable file
View file

@ -0,0 +1,20 @@
#ifndef MXDSTYPES_H
#define MXDSTYPES_H
enum MxDSType
{
MxDSType_Object = 0,
MxDSType_Action = 1,
MxDSType_MediaAction = 2,
MxDSType_Anim = 3,
MxDSType_Sound = 4,
MxDSType_MultiAction = 5,
MxDSType_SerialAction = 6,
MxDSType_ParallelAction = 7,
MxDSType_Event = 8,
MxDSType_SelectAction = 9,
MxDSType_Still = 10,
MxDSType_ObjectAction = 11,
};
#endif // MXDSTYPES_H