Add MxDSSound (#111)

This commit is contained in:
Christian Semmler 2023-08-16 13:15:59 -04:00 committed by GitHub
parent bb0d5be921
commit 51ac526f8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 61 additions and 5 deletions

View file

@ -42,6 +42,7 @@ class MxDSObject : public MxCore
protected: protected:
inline void SetType(MxDSType p_type) { this->m_type = p_type; } inline void SetType(MxDSType p_type) { this->m_type = p_type; }
inline MxDSType GetType() { return (MxDSType) this->m_type; }
private: private:
MxU32 m_sizeOnDisk; MxU32 m_sizeOnDisk;

View file

@ -1,9 +1,11 @@
#include "mxdssound.h" #include "mxdssound.h"
DECOMP_SIZE_ASSERT(MxDSSound, 0xc0)
// OFFSET: LEGO1 0x100c92c0 // OFFSET: LEGO1 0x100c92c0
MxDSSound::MxDSSound() MxDSSound::MxDSSound()
{ {
this->m_lastField = 0x4f; this->m_volume = 0x4f;
this->SetType(MxDSType_Sound); this->SetType(MxDSType_Sound);
} }
@ -11,3 +13,50 @@ MxDSSound::MxDSSound()
MxDSSound::~MxDSSound() MxDSSound::~MxDSSound()
{ {
} }
// OFFSET: LEGO1 0x100c94c0
void MxDSSound::CopyFrom(MxDSSound &p_dsSound)
{
this->SetType(p_dsSound.GetType());
this->m_volume = p_dsSound.m_volume;
}
// OFFSET: LEGO1 0x100c94e0
MxDSSound &MxDSSound::operator=(MxDSSound &p_dsSound)
{
if (this == &p_dsSound)
return *this;
MxDSMediaAction::operator=(p_dsSound);
this->CopyFrom(p_dsSound);
return *this;
}
// OFFSET: LEGO1 0x100c95d0
MxU32 MxDSSound::GetSizeOnDisk()
{
MxU32 totalSizeOnDisk = MxDSMediaAction::GetSizeOnDisk();
this->m_sizeOnDisk = sizeof(this->m_volume);
return totalSizeOnDisk + 4;
}
// OFFSET: LEGO1 0x100c95a0
void MxDSSound::Deserialize(char **p_source, MxS16 p_unk24)
{
MxDSMediaAction::Deserialize(p_source, p_unk24);
this->m_volume = *(MxS32*) *p_source;
*p_source += sizeof(MxS32);
}
// OFFSET: LEGO1 0x100c9510
MxDSAction *MxDSSound::Clone()
{
MxDSSound *clone = new MxDSSound();
if (clone)
*clone = *this;
return clone;
}

View file

@ -2,7 +2,6 @@
#define MXDSSOUND_H #define MXDSSOUND_H
#include "mxdsmediaaction.h" #include "mxdsmediaaction.h"
#include "mxtypes.h"
// VTABLE 0x100dcdd0 // VTABLE 0x100dcdd0
// SIZE 0xc0 // SIZE 0xc0
@ -12,6 +11,9 @@ class MxDSSound : public MxDSMediaAction
MxDSSound(); MxDSSound();
virtual ~MxDSSound() override; virtual ~MxDSSound() override;
void CopyFrom(MxDSSound &p_dsSound);
MxDSSound &operator=(MxDSSound &p_dsSound);
// OFFSET: LEGO1 0x100c9330 // OFFSET: LEGO1 0x100c9330
inline virtual const char *ClassName() const override // vtable+0x0c inline virtual const char *ClassName() const override // vtable+0x0c
{ {
@ -24,10 +26,14 @@ class MxDSSound : public MxDSMediaAction
{ {
return !strcmp(name, MxDSSound::ClassName()) || MxDSMediaAction::IsA(name); return !strcmp(name, MxDSSound::ClassName()) || MxDSMediaAction::IsA(name);
} }
virtual MxU32 GetSizeOnDisk(); // vtable+18;
virtual void Deserialize(char **p_source, MxS16 p_unk24); // vtable+1c;
virtual MxDSAction *Clone(); // vtable+2c;
private: private:
MxS32 m_unkb8; MxU32 m_sizeOnDisk;
MxLong m_lastField; // 0xbc MxS32 m_volume; // 0xbc
}; };
#endif // MXDSSOUND_H #endif // MXDSSOUND_H