From d69386560ffd9815b5f871bbb3489010ed1e090e Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Sun, 21 Jan 2024 07:56:17 -0500 Subject: [PATCH] fix --- LEGO1/lego/legoomni/include/legocachesound.h | 3 ++ .../include/legoloadcachesoundpresenter.h | 17 ++++++---- .../src/audio/legoloadcachesoundpresenter.cpp | 32 ++++++++++++++++--- 3 files changed, 42 insertions(+), 10 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legocachesound.h b/LEGO1/lego/legoomni/include/legocachesound.h index 5d587835..d2b20415 100644 --- a/LEGO1/lego/legoomni/include/legocachesound.h +++ b/LEGO1/lego/legoomni/include/legocachesound.h @@ -1,6 +1,7 @@ #ifndef LEGOCACHESOUND_H #define LEGOCACHESOUND_H +#include "decomp.h" #include "mxcore.h" // VTABLE: LEGO1 0x100d4718 @@ -28,6 +29,8 @@ class LegoCacheSound : public MxCore { private: void Init(); + + undefined m_padding0x8[0x80]; // 0x08 }; #endif // LEGOCACHESOUND_H diff --git a/LEGO1/lego/legoomni/include/legoloadcachesoundpresenter.h b/LEGO1/lego/legoomni/include/legoloadcachesoundpresenter.h index dbfd478e..bdbb6c97 100644 --- a/LEGO1/lego/legoomni/include/legoloadcachesoundpresenter.h +++ b/LEGO1/lego/legoomni/include/legoloadcachesoundpresenter.h @@ -4,6 +4,8 @@ #include "decomp.h" #include "mxwavepresenter.h" +class LegoCacheSound; + // VTABLE: LEGO1 0x100d5fa8 // SIZE 0x90 class LegoLoadCacheSoundPresenter : public MxWavePresenter { @@ -27,12 +29,15 @@ class LegoLoadCacheSoundPresenter : public MxWavePresenter { void Init(); void Destroy(MxBool p_fromDestructor); - undefined4* m_unk0x6c; // 0x6c - undefined4* m_unk0x70; // 0x70 - undefined4 m_unk0x74; // 0x74 - undefined4 m_unk0x78; // 0x78 - undefined m_unk0x7c; // 0x7c - undefined4 m_unk0x80[4]; // 0x80 + LegoCacheSound* m_cacheSound; // 0x6c + undefined4* m_unk0x70; // 0x70 + undefined4* m_unk0x74; // 0x74 + undefined4 m_unk0x78; // 0x78 + undefined m_unk0x7c; // 0x4c + undefined4 m_waveFormat2; // 0x54 + undefined4 m_samplesPerSec; // 0x81 + undefined4 m_avgBytesPerSec; // 0x85 + undefined4 m_blockalign; // 0x89 }; // SYNTHETIC: LEGO1 0x10018460 diff --git a/LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp b/LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp index 9aeac8ba..4d153cc9 100644 --- a/LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp +++ b/LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp @@ -1,5 +1,9 @@ #include "legoloadcachesoundpresenter.h" +#include "legocachesound.h" +#include "mxstreamchunk.h" +#include "mxwavepresenter.h" + DECOMP_SIZE_ASSERT(LegoLoadCacheSoundPresenter, 0x90) // FUNCTION: LEGO1 0x10018340 @@ -29,22 +33,42 @@ void LegoLoadCacheSoundPresenter::Destroy(MxBool p_fromDestructor) MxWavePresenter::Destroy(p_fromDestructor); } -// STUB: LEGO1 0x10018510 +// FUNCTION: LEGO1 0x10018510 void LegoLoadCacheSoundPresenter::ReadyTickle() { - // TODO + MxStreamChunk* chunk = NextChunk(); + if (chunk) { + WaveFormat* header = (WaveFormat*) chunk->GetData(); + m_unk0x78 = 0; + undefined4* buf = new undefined4[header->m_dataSize]; + m_unk0x70 = buf; + m_unk0x74 = buf; + m_cacheSound = new LegoCacheSound(); + + // parse header + m_waveFormat2 = header->m_waveFormatEx.wFormatTag; // TODO: Match + m_samplesPerSec = header->m_waveFormatEx.nSamplesPerSec; + m_avgBytesPerSec = header->m_waveFormatEx.nAvgBytesPerSec; + m_blockalign = header->m_waveFormatEx.nBlockAlign; + + m_subscriber->DestroyChunk(chunk); + ProgressTickleState(e_streaming); + } } // STUB: LEGO1 0x100185f0 void LegoLoadCacheSoundPresenter::StreamingTickle() { // TODO + EndAction(); } -// STUB: LEGO1 0x100186f0 +// FUNCTION: LEGO1 0x100186f0 void LegoLoadCacheSoundPresenter::DoneTickle() { - // TODO + if (m_unk0x7c != 0) { + EndAction(); + } } // STUB: LEGO1 0x10018700