2023-06-19 20:18:53 -04:00
|
|
|
#include "mxdsobject.h"
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2023-07-03 13:24:51 -04:00
|
|
|
DECOMP_SIZE_ASSERT(MxDSObject, 0x2c);
|
|
|
|
|
2023-06-19 20:18:53 -04:00
|
|
|
// OFFSET: LEGO1 0x100bf6a0
|
|
|
|
MxDSObject::MxDSObject()
|
|
|
|
{
|
2023-07-03 13:24:51 -04:00
|
|
|
this->SetType(MxDSType_Object);
|
2023-06-29 12:08:06 -04:00
|
|
|
this->m_sourceName = NULL;
|
2023-06-19 20:18:53 -04:00
|
|
|
this->m_unk14 = 0;
|
2023-06-29 12:08:06 -04:00
|
|
|
this->m_objectName = NULL;
|
2023-06-21 18:18:37 -04:00
|
|
|
this->m_unk24 = -1;
|
2023-08-08 22:38:07 -04:00
|
|
|
this->m_objectId = -1;
|
2023-06-19 20:18:53 -04:00
|
|
|
this->m_unk28 = 0;
|
|
|
|
}
|
|
|
|
|
2023-06-29 04:10:08 -04:00
|
|
|
// OFFSET: LEGO1 0x100bf7e0
|
|
|
|
MxDSObject::~MxDSObject()
|
|
|
|
{
|
2023-06-29 12:08:06 -04:00
|
|
|
delete[] m_objectName;
|
|
|
|
delete[] m_sourceName;
|
|
|
|
}
|
|
|
|
|
|
|
|
// OFFSET: LEGO1 0x100bf870
|
|
|
|
void MxDSObject::CopyFrom(MxDSObject &p_dsObject)
|
|
|
|
{
|
|
|
|
this->SetSourceName(p_dsObject.m_sourceName);
|
|
|
|
this->m_unk14 = p_dsObject.m_unk14;
|
|
|
|
this->SetObjectName(p_dsObject.m_objectName);
|
2023-08-08 22:38:07 -04:00
|
|
|
this->m_objectId = p_dsObject.m_objectId;
|
2023-06-29 12:08:06 -04:00
|
|
|
this->m_unk24 = p_dsObject.m_unk24;
|
|
|
|
this->m_atomId = p_dsObject.m_atomId;
|
|
|
|
this->m_unk28 = p_dsObject.m_unk28;
|
|
|
|
}
|
|
|
|
|
|
|
|
// OFFSET: LEGO1 0x100bf8c0
|
|
|
|
MxDSObject &MxDSObject::operator=(MxDSObject &p_dsObject)
|
|
|
|
{
|
|
|
|
if (this == &p_dsObject)
|
|
|
|
return *this;
|
|
|
|
|
|
|
|
this->CopyFrom(p_dsObject);
|
|
|
|
return *this;
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
|
|
|
|
2023-06-19 20:18:53 -04:00
|
|
|
// OFFSET: LEGO1 0x100bf8e0
|
2023-06-30 19:24:46 -04:00
|
|
|
void MxDSObject::SetObjectName(const char *p_objectName)
|
2023-06-19 20:18:53 -04:00
|
|
|
{
|
2023-06-30 19:24:46 -04:00
|
|
|
if (p_objectName != this->m_objectName) {
|
2023-06-29 12:08:06 -04:00
|
|
|
delete[] this->m_objectName;
|
2023-06-19 20:18:53 -04:00
|
|
|
|
2023-06-30 19:24:46 -04:00
|
|
|
if (p_objectName) {
|
|
|
|
this->m_objectName = new char[strlen(p_objectName) + 1];
|
2023-06-29 12:08:06 -04:00
|
|
|
|
|
|
|
if (this->m_objectName) {
|
2023-06-30 19:24:46 -04:00
|
|
|
strcpy(this->m_objectName, p_objectName);
|
2023-06-29 12:08:06 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
this->m_objectName = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// OFFSET: LEGO1 0x100bf950
|
|
|
|
void MxDSObject::SetSourceName(const char *p_sourceName)
|
|
|
|
{
|
|
|
|
if (p_sourceName != this->m_sourceName) {
|
|
|
|
delete[] this->m_sourceName;
|
2023-06-19 20:18:53 -04:00
|
|
|
|
2023-06-29 12:08:06 -04:00
|
|
|
if (p_sourceName) {
|
|
|
|
this->m_sourceName = new char[strlen(p_sourceName) + 1];
|
|
|
|
|
|
|
|
if (this->m_sourceName) {
|
|
|
|
strcpy(this->m_sourceName, p_sourceName);
|
2023-06-19 20:18:53 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2023-06-29 12:08:06 -04:00
|
|
|
this->m_sourceName = NULL;
|
2023-06-19 20:18:53 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-06-29 12:08:06 -04:00
|
|
|
|
|
|
|
// OFFSET: LEGO1 0x100bf9c0
|
2023-07-03 13:24:51 -04:00
|
|
|
undefined4 MxDSObject::unk14()
|
2023-06-29 12:08:06 -04:00
|
|
|
{
|
|
|
|
return 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
// OFFSET: LEGO1 0x100bf9d0
|
2023-08-08 22:38:07 -04:00
|
|
|
MxU32 MxDSObject::GetSizeOnDisk()
|
2023-06-29 12:08:06 -04:00
|
|
|
{
|
2023-08-08 22:38:07 -04:00
|
|
|
MxU32 sizeOnDisk;
|
2023-06-29 12:08:06 -04:00
|
|
|
|
|
|
|
if (this->m_sourceName)
|
2023-08-08 22:38:07 -04:00
|
|
|
sizeOnDisk = strlen(this->m_sourceName) + 3;
|
2023-06-29 12:08:06 -04:00
|
|
|
else
|
2023-08-08 22:38:07 -04:00
|
|
|
sizeOnDisk = 3;
|
2023-06-29 12:08:06 -04:00
|
|
|
|
2023-08-08 22:38:07 -04:00
|
|
|
sizeOnDisk += 4;
|
2023-06-29 12:08:06 -04:00
|
|
|
|
|
|
|
if (this->m_objectName)
|
2023-08-08 22:38:07 -04:00
|
|
|
sizeOnDisk += strlen(this->m_objectName) + 1;
|
2023-06-29 12:08:06 -04:00
|
|
|
else
|
2023-08-08 22:38:07 -04:00
|
|
|
sizeOnDisk++;
|
2023-06-29 12:08:06 -04:00
|
|
|
|
2023-08-08 22:38:07 -04:00
|
|
|
sizeOnDisk += 4;
|
|
|
|
this->m_sizeOnDisk = sizeOnDisk;
|
|
|
|
return sizeOnDisk;
|
2023-06-29 12:08:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// OFFSET: LEGO1 0x100bfa20
|
2023-08-08 22:38:07 -04:00
|
|
|
void MxDSObject::Deserialize(char **p_source, MxS16 p_unk24)
|
2023-06-29 12:08:06 -04:00
|
|
|
{
|
|
|
|
this->SetSourceName(*p_source);
|
|
|
|
*p_source += strlen(this->m_sourceName) + 1;
|
2023-07-03 13:24:51 -04:00
|
|
|
this->m_unk14 = *(undefined4*) *p_source;
|
2023-08-08 22:38:07 -04:00
|
|
|
*p_source += sizeof(undefined4);
|
2023-06-29 12:08:06 -04:00
|
|
|
|
|
|
|
this->SetObjectName(*p_source);
|
|
|
|
*p_source += strlen(this->m_objectName) + 1;
|
2023-08-08 22:38:07 -04:00
|
|
|
this->m_objectId = *(MxU32*) *p_source;
|
|
|
|
*p_source += sizeof(MxU32);
|
2023-06-29 12:08:06 -04:00
|
|
|
|
|
|
|
this->m_unk24 = p_unk24;
|
|
|
|
}
|