Matche ParseChunk 100%

This commit is contained in:
Christian Semmler 2023-12-26 14:17:56 -05:00
parent dfda5c2503
commit 55f2674ea4

View File

@ -288,23 +288,21 @@ MxResult MxDSBuffer::ParseChunk(
if (m_unk0x30->GetFlags() & MxDSAction::Flag_Bit3 && m_unk0x30->GetUnknowna8() && p_header->GetTime() < 0) { if (m_unk0x30->GetFlags() & MxDSAction::Flag_Bit3 && m_unk0x30->GetUnknowna8() && p_header->GetTime() < 0) {
delete p_header; delete p_header;
goto done; return SUCCESS;
} }
p_header->SetTime(p_header->GetTime() + m_unk0x30->GetUnknowna8()); p_header->SetTime(p_header->GetTime() + m_unk0x30->GetUnknowna8());
if (p_header->GetFlags() & MxDSChunk::Flag_Bit5) { if (p_header->GetFlags() & MxDSChunk::Flag_Bit5) {
MxU32 und = MxDSChunk::ReturnE(); MxU32 length = p_header->GetLength() + MxDSChunk::ReturnE() + 8;
MxU32 length = p_header->GetLength();
MxDSBuffer* buffer = new MxDSBuffer(); MxDSBuffer* buffer = new MxDSBuffer();
if (buffer && buffer->AllocateBuffer(length + und + 8, MxDSBufferType_Allocate) == SUCCESS && if (buffer && buffer->AllocateBuffer(length, MxDSBufferType_Allocate) == SUCCESS &&
buffer->CalcBytesRemaining((MxU8*) p_data) == SUCCESS) { buffer->CalcBytesRemaining((MxU8*) p_data) == SUCCESS) {
// improve no temp var *p_streamingAction = new MxDSStreamingAction((MxDSStreamingAction&) *p_action);
MxDSStreamingAction* streamingAction = new MxDSStreamingAction((MxDSStreamingAction&) *p_action); ;
*p_streamingAction = streamingAction;
if (streamingAction) { if (*p_streamingAction) {
MxU16* flags = MxStreamChunk::IntoFlags(buffer->GetBuffer()); MxU16* flags = MxStreamChunk::IntoFlags(buffer->GetBuffer());
*flags = p_header->GetFlags() & ~MxDSChunk::Flag_Bit5; *flags = p_header->GetFlags() & ~MxDSChunk::Flag_Bit5;
@ -317,10 +315,8 @@ MxResult MxDSBuffer::ParseChunk(
if (buffer) if (buffer)
delete buffer; delete buffer;
if (p_header) delete p_header;
delete p_header; return FAILURE;
result = FAILURE;
} }
else { else {
if (p_header->GetFlags() & MxDSChunk::Flag_Bit2) { if (p_header->GetFlags() & MxDSChunk::Flag_Bit2) {