implement LegoLoadCacheSoundPresenter (#475)

* fix

* fixes

* Fix WaveFormat, match LegoLoadCacheSoundPresenter

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Misha
2024-01-21 10:30:19 -05:00
committed by GitHub
parent 3f35302e76
commit 8e1197d14c
6 changed files with 52 additions and 24 deletions

View File

@@ -1,6 +1,7 @@
#ifndef LEGOCACHESOUND_H
#define LEGOCACHESOUND_H
#include "decomp.h"
#include "mxcore.h"
// VTABLE: LEGO1 0x100d4718
@@ -28,6 +29,8 @@ public:
private:
void Init();
undefined m_padding0x08[0x80]; // 0x08
};
#endif // LEGOCACHESOUND_H

View File

@@ -4,6 +4,8 @@
#include "decomp.h"
#include "mxwavepresenter.h"
class LegoCacheSound;
// VTABLE: LEGO1 0x100d5fa8
// SIZE 0x90
class LegoLoadCacheSoundPresenter : public MxWavePresenter {
@@ -27,12 +29,12 @@ private:
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
undefined* m_unk0x70; // 0x70
undefined* m_unk0x74; // 0x74
undefined4 m_unk0x78; // 0x78
undefined m_unk0x7c; // 0x7c
PCMWAVEFORMAT m_pcmWaveFormat; // 0x7d
};
// SYNTHETIC: LEGO1 0x10018460

View File

@@ -1,5 +1,7 @@
#include "legocachesound.h"
DECOMP_SIZE_ASSERT(LegoCacheSound, 0x88)
// FUNCTION: LEGO1 0x100064d0
LegoCacheSound::LegoCacheSound()
{

View File

@@ -1,5 +1,9 @@
#include "legoloadcachesoundpresenter.h"
#include "legocachesound.h"
#include "mxstreamchunk.h"
#include "mxwavepresenter.h"
DECOMP_SIZE_ASSERT(LegoLoadCacheSoundPresenter, 0x90)
// FUNCTION: LEGO1 0x10018340
@@ -25,26 +29,44 @@ void LegoLoadCacheSoundPresenter::Init()
// FUNCTION: LEGO1 0x100184f0
void LegoLoadCacheSoundPresenter::Destroy(MxBool p_fromDestructor)
{
delete this->m_unk0x70;
delete[] this->m_unk0x70;
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;
MxU8* data = new MxU8[header->m_dataSize];
m_unk0x70 = data;
m_unk0x74 = data;
m_cacheSound = new LegoCacheSound;
memcpy(&m_pcmWaveFormat, &header->m_pcmWaveFormat.wf, sizeof(m_pcmWaveFormat));
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