Implement/match Lego3DWavePresenter::StartingTickle (#972)

* Implement/match Lego3DWavePresenter::StartingTickle

* Fix annotation

* Add StreamingTickle

* Rename
This commit is contained in:
Christian Semmler
2024-05-30 10:27:18 -04:00
committed by GitHub
parent 650903d043
commit ab4ba9fc4f
7 changed files with 54 additions and 34 deletions

View File

@@ -306,12 +306,12 @@ add_library(lego1 SHARED
LEGO1/lego/legoomni/src/actors/radio.cpp LEGO1/lego/legoomni/src/actors/radio.cpp
LEGO1/lego/legoomni/src/actors/skateboard.cpp LEGO1/lego/legoomni/src/actors/skateboard.cpp
LEGO1/lego/legoomni/src/actors/towtrack.cpp LEGO1/lego/legoomni/src/actors/towtrack.cpp
LEGO1/lego/legoomni/src/audio/lego3dsound.cpp
LEGO1/lego/legoomni/src/audio/lego3dwavepresenter.cpp LEGO1/lego/legoomni/src/audio/lego3dwavepresenter.cpp
LEGO1/lego/legoomni/src/audio/legocachsound.cpp LEGO1/lego/legoomni/src/audio/legocachsound.cpp
LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp
LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp
LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp
LEGO1/lego/legoomni/src/audio/legounknown100d5778.cpp
LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp
LEGO1/lego/legoomni/src/build/buildingentity.cpp LEGO1/lego/legoomni/src/build/buildingentity.cpp
LEGO1/lego/legoomni/src/build/helicopterstate.cpp LEGO1/lego/legoomni/src/build/helicopterstate.cpp

View File

@@ -1,5 +1,5 @@
#ifndef LEGOUNKNOWN100D5778_H #ifndef LEGO3DSOUND_H
#define LEGOUNKNOWN100D5778_H #define LEGO3DSOUND_H
#include "decomp.h" #include "decomp.h"
#include "mxtypes.h" #include "mxtypes.h"
@@ -10,20 +10,20 @@ class LegoROI;
// VTABLE: LEGO1 0x100d5778 // VTABLE: LEGO1 0x100d5778
// SIZE 0x30 // SIZE 0x30
class LegoUnknown100d5778 { class Lego3DSound {
public: public:
LegoUnknown100d5778(); Lego3DSound();
virtual ~LegoUnknown100d5778(); virtual ~Lego3DSound();
void Init(); void Init();
MxResult FUN_100116a0(LPDIRECTSOUND p_dsound, undefined4, undefined4 p_unk0x2c); MxResult Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char*, MxS32 p_volume);
void Destroy(); void Destroy();
undefined4 FUN_100118e0(LPDIRECTSOUNDBUFFER p_dsBuffer); undefined4 FUN_100118e0(LPDIRECTSOUNDBUFFER p_directSoundBuffer);
void FUN_10011ca0(); void FUN_10011ca0();
MxS32 FUN_10011cf0(undefined4, undefined4); MxS32 FUN_10011cf0(undefined4, undefined4);
// SYNTHETIC: LEGO1 0x10011650 // SYNTHETIC: LEGO1 0x10011650
// LegoUnknown100d5778::`scalar deleting destructor' // Lego3DSound::`scalar deleting destructor'
private: private:
undefined m_unk0x04[4]; // 0x04 undefined m_unk0x04[4]; // 0x04
@@ -34,7 +34,7 @@ private:
MxBool m_unk0x15; // 0x15 MxBool m_unk0x15; // 0x15
undefined4 m_unk0x18; // 0x18 undefined4 m_unk0x18; // 0x18
undefined m_unk0x1c[0x10]; // 0x1c undefined m_unk0x1c[0x10]; // 0x1c
undefined4 m_unk0x2c; // 0x2c MxS32 m_volume; // 0x2c
}; };
#endif // LEGOUNKNOWN100D5778_H #endif // LEGO3DSOUND_H

View File

@@ -2,7 +2,7 @@
#define LEGO3DWAVEPRESENTER_H #define LEGO3DWAVEPRESENTER_H
#include "decomp.h" #include "decomp.h"
#include "legounknown100d5778.h" #include "lego3dsound.h"
#include "mxwavepresenter.h" #include "mxwavepresenter.h"
// VTABLE: LEGO1 0x100d52b0 // VTABLE: LEGO1 0x100d52b0
@@ -31,8 +31,8 @@ public:
// Lego3DWavePresenter::`scalar deleting destructor' // Lego3DWavePresenter::`scalar deleting destructor'
private: private:
undefined m_unk0x6c[4]; // 0x6c undefined m_unk0x6c[4]; // 0x6c
LegoUnknown100d5778 m_unk0x70; // 0x70 Lego3DSound m_sound; // 0x70
}; };
#endif // LEGO3DWAVEPRESENTER_H #endif // LEGO3DWAVEPRESENTER_H

View File

@@ -2,7 +2,7 @@
#define LEGOCACHSOUND_H #define LEGOCACHSOUND_H
#include "decomp.h" #include "decomp.h"
#include "legounknown100d5778.h" #include "lego3dsound.h"
#include "mxcore.h" #include "mxcore.h"
#include "mxstring.h" #include "mxstring.h"
@@ -47,7 +47,7 @@ private:
LPDIRECTSOUNDBUFFER m_dsBuffer; // 0x08 LPDIRECTSOUNDBUFFER m_dsBuffer; // 0x08
undefined m_unk0xc[4]; // 0x0c undefined m_unk0xc[4]; // 0x0c
LegoUnknown100d5778 m_unk0x10; // 0x10 Lego3DSound m_unk0x10; // 0x10
undefined* m_unk0x40; // 0x40 undefined* m_unk0x40; // 0x40
undefined4 m_unk0x44; // 0x44 undefined4 m_unk0x44; // 0x44
MxString m_string0x48; // 0x48 MxString m_string0x48; // 0x48

View File

@@ -1,25 +1,25 @@
#include "legounknown100d5778.h" #include "lego3dsound.h"
#include "legocharactermanager.h" #include "legocharactermanager.h"
#include "misc.h" #include "misc.h"
#include "mxomni.h" #include "mxomni.h"
DECOMP_SIZE_ASSERT(LegoUnknown100d5778, 0x30) DECOMP_SIZE_ASSERT(Lego3DSound, 0x30)
// FUNCTION: LEGO1 0x10011630 // FUNCTION: LEGO1 0x10011630
LegoUnknown100d5778::LegoUnknown100d5778() Lego3DSound::Lego3DSound()
{ {
Init(); Init();
} }
// FUNCTION: LEGO1 0x10011670 // FUNCTION: LEGO1 0x10011670
LegoUnknown100d5778::~LegoUnknown100d5778() Lego3DSound::~Lego3DSound()
{ {
Destroy(); Destroy();
} }
// FUNCTION: LEGO1 0x10011680 // FUNCTION: LEGO1 0x10011680
void LegoUnknown100d5778::Init() void Lego3DSound::Init()
{ {
m_dsBuffer = NULL; m_dsBuffer = NULL;
m_unk0x0c = NULL; m_unk0x0c = NULL;
@@ -27,16 +27,17 @@ void LegoUnknown100d5778::Init()
m_unk0x18 = 0; m_unk0x18 = 0;
m_unk0x14 = FALSE; m_unk0x14 = FALSE;
m_unk0x15 = FALSE; m_unk0x15 = FALSE;
m_unk0x2c = 79; m_volume = 79;
} }
// STUB: LEGO1 0x100116a0 // STUB: LEGO1 0x100116a0
MxResult LegoUnknown100d5778::FUN_100116a0(LPDIRECTSOUND p_dsound, undefined4, undefined4 p_unk0x2c) // FUNCTION: BETA10 0x10039647
MxResult Lego3DSound::Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char*, MxS32 p_volume)
{ {
m_unk0x2c = p_unk0x2c; m_volume = p_volume;
if (MxOmni::IsSound3D()) { if (MxOmni::IsSound3D()) {
p_dsound->QueryInterface(IID_IDirectSoundBuffer, (LPVOID*) &m_dsBuffer); p_directSoundBuffer->QueryInterface(IID_IDirectSoundBuffer, (LPVOID*) &m_dsBuffer);
if (m_dsBuffer == NULL) { if (m_dsBuffer == NULL) {
return FAILURE; return FAILURE;
} }
@@ -50,7 +51,7 @@ MxResult LegoUnknown100d5778::FUN_100116a0(LPDIRECTSOUND p_dsound, undefined4, u
} }
// FUNCTION: LEGO1 0x10011880 // FUNCTION: LEGO1 0x10011880
void LegoUnknown100d5778::Destroy() void Lego3DSound::Destroy()
{ {
if (m_dsBuffer) { if (m_dsBuffer) {
m_dsBuffer->Release(); m_dsBuffer->Release();
@@ -70,20 +71,21 @@ void LegoUnknown100d5778::Destroy()
} }
// STUB: LEGO1 0x100118e0 // STUB: LEGO1 0x100118e0
undefined4 LegoUnknown100d5778::FUN_100118e0(LPDIRECTSOUNDBUFFER p_dsBuffer) // FUNCTION: BETA10 0x10039a2a
undefined4 Lego3DSound::FUN_100118e0(LPDIRECTSOUNDBUFFER p_directSoundBuffer)
{ {
// TODO // TODO
return 0; return 0;
} }
// STUB: LEGO1 0x10011ca0 // STUB: LEGO1 0x10011ca0
void LegoUnknown100d5778::FUN_10011ca0() void Lego3DSound::FUN_10011ca0()
{ {
// TODO // TODO
} }
// STUB: LEGO1 0x10011cf0 // STUB: LEGO1 0x10011cf0
MxS32 LegoUnknown100d5778::FUN_10011cf0(undefined4, undefined4) MxS32 Lego3DSound::FUN_10011cf0(undefined4, undefined4)
{ {
// TODO // TODO
return 0; return 0;

View File

@@ -1,5 +1,7 @@
#include "lego3dwavepresenter.h" #include "lego3dwavepresenter.h"
#include "mxcompositepresenter.h"
#include "mxdsaction.h"
#include "mxomni.h" #include "mxomni.h"
DECOMP_SIZE_ASSERT(Lego3DWavePresenter, 0xa0) DECOMP_SIZE_ASSERT(Lego3DWavePresenter, 0xa0)
@@ -28,7 +30,8 @@ void Lego3DWavePresenter::Destroy()
} }
} }
// STUB: LEGO1 0x1004a810 // FUNCTION: LEGO1 0x1004a810
// FUNCTION: BETA10 0x1003a3b0
void Lego3DWavePresenter::StartingTickle() void Lego3DWavePresenter::StartingTickle()
{ {
if (MxOmni::IsSound3D()) { if (MxOmni::IsSound3D()) {
@@ -37,12 +40,27 @@ void Lego3DWavePresenter::StartingTickle()
MxWavePresenter::StartingTickle(); MxWavePresenter::StartingTickle();
// TODO if (m_dsBuffer != NULL) {
MxU16 extraLength;
char* buff;
m_action->GetExtra(extraLength, buff);
if (!strcmp(buff, "FROM_PARENT") && m_compositePresenter != NULL) {
m_compositePresenter->GetAction()->GetExtra(extraLength, buff);
}
if (m_sound.Create(m_dsBuffer, buff, m_volume) != SUCCESS) {
m_dsBuffer->Release();
m_dsBuffer = NULL;
EndAction();
}
}
} }
// STUB: LEGO1 0x1004a8b0 // FUNCTION: LEGO1 0x1004a8b0
// FUNCTION: BETA10 0x1003a4cc
void Lego3DWavePresenter::StreamingTickle() void Lego3DWavePresenter::StreamingTickle()
{ {
MxWavePresenter::StreamingTickle(); MxWavePresenter::StreamingTickle();
// TODO m_sound.FUN_100118e0(m_dsBuffer);
} }

View File

@@ -30,7 +30,7 @@ public:
virtual void SetVolume(MxS32 p_volume) { m_volume = p_volume; } // vtable+0x60 virtual void SetVolume(MxS32 p_volume) { m_volume = p_volume; } // vtable+0x60
protected: protected:
MxS32 m_volume; MxS32 m_volume; // 0x50
}; };
// SYNTHETIC: LEGO1 0x1000d370 // SYNTHETIC: LEGO1 0x1000d370