Changes/annotations

This commit is contained in:
Christian Semmler 2024-02-13 17:54:16 -05:00
parent 47d3e7a0e9
commit f857900cab
7 changed files with 50 additions and 46 deletions

View File

@ -27,14 +27,14 @@ class LegoCacheSound : public MxCore {
} }
virtual MxResult FUN_10006710(); // vtable+0x14 virtual MxResult FUN_10006710(); // vtable+0x14
virtual void FUN_10006920(); // vtable+0x18 virtual void Destroy(); // vtable+0x18
virtual void FUN_10006cd0(undefined4, undefined4); // vtable+0x1c virtual void FUN_10006cd0(undefined4, undefined4); // vtable+0x1c
inline const MxString& GetString0x48() const { return m_string0x48; } inline const MxString& GetString0x48() const { return m_string0x48; }
inline const undefined GetUnk0x58() { return m_unk0x58; } inline const undefined GetUnk0x58() const { return m_unk0x58; }
LegoCacheSound* FUN_10006960(); LegoCacheSound* FUN_10006960();
MxResult FUN_10006a30(char* p_str, MxBool p_unused); MxResult FUN_10006a30(char* p_str, MxBool);
void FUN_10006b80(); void FUN_10006b80();
void FUN_10006be0(); void FUN_10006be0();
@ -53,7 +53,7 @@ class LegoCacheSound : public MxCore {
undefined m_unk0x58; // 0x58 undefined m_unk0x58; // 0x58
PCMWAVEFORMAT m_unk0x59; // 0x59 PCMWAVEFORMAT m_unk0x59; // 0x59
MxBool m_isLooping; // 0x69 MxBool m_isLooping; // 0x69
undefined m_unk0x6a; // 0x6a MxBool m_unk0x6a; // 0x6a
undefined4 m_unk0x6c; // 0x6c undefined4 m_unk0x6c; // 0x6c
undefined m_unk0x70; // 0x70 undefined m_unk0x70; // 0x70
MxString m_string0x74; // 0x74 MxString m_string0x74; // 0x74

View File

@ -13,9 +13,10 @@ class LegoUnknown100d5778 {
public: public:
LegoUnknown100d5778(); LegoUnknown100d5778();
virtual ~LegoUnknown100d5778(); virtual ~LegoUnknown100d5778();
void Init(); void Init();
MxResult FUN_100116a0(LPDIRECTSOUND p_dsound, undefined4 p_two, undefined4 p_three); MxResult FUN_100116a0(LPDIRECTSOUND p_dsound, undefined4, undefined4 p_unk0x2c);
void FUN_10011880(); void Destroy();
undefined4 FUN_100118e0(LPDIRECTSOUNDBUFFER p_dsBuffer); undefined4 FUN_100118e0(LPDIRECTSOUNDBUFFER p_dsBuffer);
void FUN_10011ca0(); void FUN_10011ca0();

View File

@ -6,15 +6,16 @@
#include "mxstl/stlcompat.h" #include "mxstl/stlcompat.h"
#include "mxtypes.h" #include "mxtypes.h"
// SIZE 0x08
struct Element100d6b4c { struct Element100d6b4c {
Element100d6b4c() : m_sound(NULL), m_name(NULL){}; Element100d6b4c() : m_sound(NULL), m_name(NULL) {}
Element100d6b4c(LegoCacheSound* p_sound, const char* p_name) : m_sound(p_sound), m_name(p_name){}; Element100d6b4c(LegoCacheSound* p_sound, const char* p_name) : m_sound(p_sound), m_name(p_name) {}
Element100d6b4c(LegoCacheSound* p_sound) : m_sound(p_sound), m_name(p_sound->GetString0x48().GetData()){}; Element100d6b4c(LegoCacheSound* p_sound) : m_sound(p_sound), m_name(p_sound->GetString0x48().GetData()) {}
// FUNCTION: LEGO1 0x1003d030 // FUNCTION: LEGO1 0x1003d030
~Element100d6b4c() ~Element100d6b4c()
{ {
if (m_sound == NULL) { if (m_sound == NULL && m_name != NULL) {
delete[] const_cast<char*>(m_name); delete[] const_cast<char*>(m_name);
} }
} }
@ -25,27 +26,28 @@ struct Element100d6b4c {
inline LegoCacheSound* GetSound() const { return m_sound; } inline LegoCacheSound* GetSound() const { return m_sound; }
inline const char* GetName() const { return m_name; } inline const char* GetName() const { return m_name; }
friend struct Set100d6b4cComparator;
private: private:
LegoCacheSound* m_sound; LegoCacheSound* m_sound; // 0x00
const char* m_name; const char* m_name; // 0x04
}; };
struct Set100d6b4cComparator { struct Set100d6b4cComparator {
bool operator()(const Element100d6b4c& p_a, const Element100d6b4c& p_b) const bool operator()(const Element100d6b4c& p_a, const Element100d6b4c& p_b) const
{ {
return strcmpi(p_a.GetName(), p_b.GetName()) > 0; return strcmpi(p_a.m_name, p_b.m_name) > 0;
} }
}; };
typedef set<Element100d6b4c, Set100d6b4cComparator> Set100d6b4c; typedef set<Element100d6b4c, Set100d6b4cComparator> Set100d6b4c;
typedef list<Element100d6b4c> List100d6b4c; typedef list<Element100d6b4c> List100d6b4c;
// VTABLE: LEGO1 0x100d6b4c // VTABLE: LEGO1 0x100d6b4c
// SIZE 0x20 // SIZE 0x20
class LegoUnknown100d6b4c { class LegoUnknown100d6b4c {
public: public:
LegoUnknown100d6b4c(){}; LegoUnknown100d6b4c() {}
~LegoUnknown100d6b4c(); ~LegoUnknown100d6b4c();
virtual MxResult Tickle(); // vtable+0x00 virtual MxResult Tickle(); // vtable+0x00
@ -57,14 +59,13 @@ class LegoUnknown100d6b4c {
void FUN_1003dc40(LegoCacheSound** p_und); void FUN_1003dc40(LegoCacheSound** p_und);
private: private:
Set100d6b4c m_set; Set100d6b4c m_set; // 0x04
List100d6b4c m_list; List100d6b4c m_list; // 0x14
}; };
// TODO: Function names subject to change. // TODO: Function names subject to change.
// clang-format off // clang-format off
// TEMPLATE: LEGO1 0x10029c30 // TEMPLATE: LEGO1 0x10029c30
// _Tree<Element100d6b4c,Element100d6b4c,set<Element100d6b4c,Set100d6b4cComparator,allocator<Element100d6b4c> >::_Kfn,Set100d6b4cComparator,allocator<Element100d6b4c> >::~_Tree<Element100d6b4c,Element100d6b4c,set<Element100d6b4c,Set100d6b4cComparator,allocator<Element100d6b4c> >::_Kfn,Set100d6b4cComparator,allocator<Element100d6b4c> > // _Tree<Element100d6b4c,Element100d6b4c,set<Element100d6b4c,Set100d6b4cComparator,allocator<Element100d6b4c> >::_Kfn,Set100d6b4cComparator,allocator<Element100d6b4c> >::~_Tree<Element100d6b4c,Element100d6b4c,set<Element100d6b4c,Set100d6b4cComparator,allocator<Element100d6b4c> >::_Kfn,Set100d6b4cComparator,allocator<Element100d6b4c> >
@ -112,7 +113,6 @@ class LegoUnknown100d6b4c {
// GLOBAL: LEGO1 0x100f31cc // GLOBAL: LEGO1 0x100f31cc
// _Tree<Element100d6b4c,Element100d6b4c,set<Element100d6b4c,Set100d6b4cComparator,allocator<Element100d6b4c> >::_Kfn,Set100d6b4cComparator,allocator<Element100d6b4c> >::_Nil // _Tree<Element100d6b4c,Element100d6b4c,set<Element100d6b4c,Set100d6b4cComparator,allocator<Element100d6b4c> >::_Kfn,Set100d6b4cComparator,allocator<Element100d6b4c> >::_Nil
// clang-format on // clang-format on
#endif // LEGOUNKNOWN100D6B4C_H #endif // LEGOUNKNOWN100D6B4C_H

View File

@ -2,7 +2,7 @@
#include "mxomni.h" #include "mxomni.h"
DECOMP_SIZE_ASSERT(Lego3DWavePresenter, 0xa0); DECOMP_SIZE_ASSERT(Lego3DWavePresenter, 0xa0)
// FUNCTION: LEGO1 0x1004a7c0 // FUNCTION: LEGO1 0x1004a7c0
MxResult Lego3DWavePresenter::AddToManager() MxResult Lego3DWavePresenter::AddToManager()

View File

@ -16,17 +16,17 @@ LegoCacheSound::LegoCacheSound()
LegoCacheSound::~LegoCacheSound() LegoCacheSound::~LegoCacheSound()
{ {
// TODO // TODO
FUN_10006920(); Destroy();
} }
// FUNCTION: LEGO1 0x100066d0 // FUNCTION: LEGO1 0x100066d0
void LegoCacheSound::Init() void LegoCacheSound::Init()
{ {
m_dsBuffer = NULL; m_dsBuffer = NULL;
m_unk0x40 = 0; m_unk0x40 = NULL;
m_unk0x58 = 0; m_unk0x58 = 0;
memset(&m_unk0x59, 0, sizeof(m_unk0x59)); memset(&m_unk0x59, 0, sizeof(m_unk0x59));
m_unk0x6a = 0; m_unk0x6a = FALSE;
m_unk0x70 = 0; m_unk0x70 = 0;
m_isLooping = TRUE; m_isLooping = TRUE;
m_unk0x6c = 79; m_unk0x6c = 79;
@ -56,7 +56,7 @@ MxResult LegoCacheSound::FUN_10006710()
} }
// FUNCTION: LEGO1 0x10006920 // FUNCTION: LEGO1 0x10006920
void LegoCacheSound::FUN_10006920() void LegoCacheSound::Destroy()
{ {
if (m_dsBuffer) { if (m_dsBuffer) {
m_dsBuffer->Stop(); m_dsBuffer->Stop();
@ -76,7 +76,7 @@ LegoCacheSound* LegoCacheSound::FUN_10006960()
} }
// STUB: LEGO1 0x10006a30 // STUB: LEGO1 0x10006a30
MxResult LegoCacheSound::FUN_10006a30(char* p_str, MxBool p_unused) MxResult LegoCacheSound::FUN_10006a30(char* p_str, MxBool)
{ {
// TODO // TODO
// gets param2 from FUN_1003db10 // gets param2 from FUN_1003db10
@ -98,7 +98,7 @@ void LegoCacheSound::FUN_10006b80()
} }
m_unk0x58 = 0; m_unk0x58 = 0;
m_unk0x6a = 0; m_unk0x6a = FALSE;
m_unk0x10.FUN_10011ca0(); m_unk0x10.FUN_10011ca0();
if (m_string0x74.GetLength() != 0) { if (m_string0x74.GetLength() != 0) {
@ -110,13 +110,14 @@ void LegoCacheSound::FUN_10006b80()
void LegoCacheSound::FUN_10006be0() void LegoCacheSound::FUN_10006be0()
{ {
if (!m_isLooping) { if (!m_isLooping) {
DWORD dwStatus; DWORD dwStatus;
m_dsBuffer->GetStatus(&dwStatus); m_dsBuffer->GetStatus(&dwStatus);
if (m_unk0x70) { if (m_unk0x70) {
if (dwStatus == 0) { if (dwStatus == 0) {
return; return;
} }
m_unk0x70 = 0; m_unk0x70 = 0;
} }
@ -139,11 +140,11 @@ void LegoCacheSound::FUN_10006be0()
} }
m_dsBuffer->Stop(); m_dsBuffer->Stop();
m_unk0x6a = 1; m_unk0x6a = TRUE;
} }
else if (m_unk0x6a) { else if (m_unk0x6a) {
m_dsBuffer->Play(0, 0, m_isLooping); m_dsBuffer->Play(0, 0, m_isLooping);
m_unk0x6a = 0; m_unk0x6a = FALSE;
} }
} }
} }

View File

@ -3,7 +3,7 @@
#include "legoomni.h" #include "legoomni.h"
#include "legounksavedatawriter.h" #include "legounksavedatawriter.h"
DECOMP_SIZE_ASSERT(LegoUnknown100d5778, 0x30); DECOMP_SIZE_ASSERT(LegoUnknown100d5778, 0x30)
// FUNCTION: LEGO1 0x10011630 // FUNCTION: LEGO1 0x10011630
LegoUnknown100d5778::LegoUnknown100d5778() LegoUnknown100d5778::LegoUnknown100d5778()
@ -14,7 +14,7 @@ LegoUnknown100d5778::LegoUnknown100d5778()
// FUNCTION: LEGO1 0x10011670 // FUNCTION: LEGO1 0x10011670
LegoUnknown100d5778::~LegoUnknown100d5778() LegoUnknown100d5778::~LegoUnknown100d5778()
{ {
FUN_10011880(); Destroy();
} }
// FUNCTION: LEGO1 0x10011680 // FUNCTION: LEGO1 0x10011680
@ -30,9 +30,10 @@ void LegoUnknown100d5778::Init()
} }
// STUB: LEGO1 0x100116a0 // STUB: LEGO1 0x100116a0
MxResult LegoUnknown100d5778::FUN_100116a0(LPDIRECTSOUND p_dsound, undefined4 p_two, undefined4 p_three) MxResult LegoUnknown100d5778::FUN_100116a0(LPDIRECTSOUND p_dsound, undefined4, undefined4 p_unk0x2c)
{ {
m_unk0x2c = p_three; m_unk0x2c = p_unk0x2c;
if (MxOmni::IsSound3D()) { if (MxOmni::IsSound3D()) {
p_dsound->QueryInterface(IID_IDirectSoundBuffer, (LPVOID*) &m_dsBuffer); p_dsound->QueryInterface(IID_IDirectSoundBuffer, (LPVOID*) &m_dsBuffer);
if (m_dsBuffer == NULL) { if (m_dsBuffer == NULL) {
@ -48,7 +49,7 @@ MxResult LegoUnknown100d5778::FUN_100116a0(LPDIRECTSOUND p_dsound, undefined4 p_
} }
// FUNCTION: LEGO1 0x10011880 // FUNCTION: LEGO1 0x10011880
void LegoUnknown100d5778::FUN_10011880() void LegoUnknown100d5778::Destroy()
{ {
if (m_dsBuffer) { if (m_dsBuffer) {
m_dsBuffer->Release(); m_dsBuffer->Release();

View File

@ -3,7 +3,8 @@
#include "legoomni.h" #include "legoomni.h"
#include "legoworld.h" #include "legoworld.h"
DECOMP_SIZE_ASSERT(LegoUnknown100d6b4c, 0x20); DECOMP_SIZE_ASSERT(Element100d6b4c, 0x08)
DECOMP_SIZE_ASSERT(LegoUnknown100d6b4c, 0x20)
// FUNCTION: LEGO1 0x1003cf20 // FUNCTION: LEGO1 0x1003cf20
LegoUnknown100d6b4c::~LegoUnknown100d6b4c() LegoUnknown100d6b4c::~LegoUnknown100d6b4c()
@ -44,18 +45,16 @@ MxResult LegoUnknown100d6b4c::Tickle()
List100d6b4c::iterator listIter = m_list.begin(); List100d6b4c::iterator listIter = m_list.begin();
while (listIter != m_list.end()) { while (listIter != m_list.end()) {
LegoCacheSound* sound = (*listIter).GetSound(); LegoCacheSound* sound = (*listIter).GetSound();
if (sound->GetUnk0x58()) { if (sound->GetUnk0x58()) {
sound->FUN_10006be0(); sound->FUN_10006be0();
listIter++; listIter++;
continue;
} }
sound->FUN_10006b80(); else {
sound->FUN_10006b80();
List100d6b4c::iterator temp = listIter; m_list.erase(listIter++);
listIter++; delete sound;
}
m_list.erase(temp);
delete sound;
} }
return SUCCESS; return SUCCESS;
@ -89,9 +88,10 @@ LegoCacheSound* LegoUnknown100d6b4c::FUN_1003d290(LegoCacheSound* p_sound)
m_list.push_back(Element100d6b4c(p_sound)); m_list.push_back(Element100d6b4c(p_sound));
return p_sound; return p_sound;
} }
else {
delete p_sound; delete p_sound;
return sound; return sound;
}
} }
m_set.insert(Element100d6b4c(p_sound)); m_set.insert(Element100d6b4c(p_sound));
@ -119,6 +119,7 @@ LegoCacheSound* LegoUnknown100d6b4c::FUN_1003db10(LegoCacheSound* p_one, char* p
if (p_one->GetUnk0x58()) { if (p_one->GetUnk0x58()) {
LegoCacheSound* result = p_one->FUN_10006960(); LegoCacheSound* result = p_one->FUN_10006960();
if (result) { if (result) {
LegoCacheSound* t = FUN_1003d290(result); LegoCacheSound* t = FUN_1003d290(result);
t->FUN_10006a30(p_two, p_three); t->FUN_10006a30(p_two, p_three);