Name some MxDSChunk flags (#394)

This commit is contained in:
Christian Semmler
2024-01-02 13:32:01 -05:00
committed by GitHub
parent 3f2fac72e4
commit afe537b99e
11 changed files with 23 additions and 27 deletions

View File

@@ -298,18 +298,17 @@ MxResult MxDSBuffer::ParseChunk(
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_Split) {
MxU32 length = p_header->GetLength() + MxDSChunk::ReturnE() + 8; MxU32 length = p_header->GetLength() + MxDSChunk::ReturnE() + 8;
MxDSBuffer* buffer = new MxDSBuffer(); MxDSBuffer* buffer = new MxDSBuffer();
if (buffer && buffer->AllocateBuffer(length, MxDSBufferType_Allocate) == SUCCESS && if (buffer && buffer->AllocateBuffer(length, MxDSBufferType_Allocate) == SUCCESS &&
buffer->CalcBytesRemaining((MxU8*) p_data) == SUCCESS) { buffer->CalcBytesRemaining((MxU8*) p_data) == SUCCESS) {
*p_streamingAction = new MxDSStreamingAction((MxDSStreamingAction&) *p_action); *p_streamingAction = new MxDSStreamingAction((MxDSStreamingAction&) *p_action);
;
if (*p_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_Split;
delete p_header; delete p_header;
(*p_streamingAction)->SetUnknowna0(buffer); (*p_streamingAction)->SetUnknowna0(buffer);
@@ -324,7 +323,7 @@ MxResult MxDSBuffer::ParseChunk(
return FAILURE; return FAILURE;
} }
else { else {
if (p_header->GetFlags() & MxDSChunk::Flag_Bit2) { if (p_header->GetFlags() & MxDSChunk::Flag_End) {
if (m_unk0x30->HasId(p_header->GetObjectId())) { if (m_unk0x30->HasId(p_header->GetObjectId())) {
if (m_unk0x30->GetFlags() & MxDSAction::Flag_Bit3 && if (m_unk0x30->GetFlags() & MxDSAction::Flag_Bit3 &&
(m_unk0x30->GetLoopCount() > 1 || m_unk0x30->GetDuration() == -1)) { (m_unk0x30->GetLoopCount() > 1 || m_unk0x30->GetDuration() == -1)) {
@@ -474,7 +473,7 @@ MxResult MxDSBuffer::CalcBytesRemaining(MxU8* p_data)
memcpy(m_pBuffer + m_writeOffset - m_bytesRemaining, ptr, bytesRead); memcpy(m_pBuffer + m_writeOffset - m_bytesRemaining, ptr, bytesRead);
if (m_writeOffset == m_bytesRemaining) if (m_writeOffset == m_bytesRemaining)
*(MxU32*) (m_pBuffer + 4) = *MxStreamChunk::IntoPlus0x12(m_pBuffer) + MxStreamChunk::ReturnE(); *(MxU32*) (m_pBuffer + 4) = *MxStreamChunk::IntoLength(m_pBuffer) + MxStreamChunk::ReturnE();
m_bytesRemaining -= bytesRead; m_bytesRemaining -= bytesRead;
result = SUCCESS; result = SUCCESS;

View File

@@ -15,9 +15,8 @@ MxDSChunk::MxDSChunk()
// FUNCTION: LEGO1 0x100be170 // FUNCTION: LEGO1 0x100be170
MxDSChunk::~MxDSChunk() MxDSChunk::~MxDSChunk()
{ {
if (m_flags & Flag_Bit1) { if (m_flags & Flag_Bit1)
delete[] m_data; delete[] m_data;
}
} }
// FUNCTION: LEGO1 0x100be1e0 // FUNCTION: LEGO1 0x100be1e0

View File

@@ -11,11 +11,9 @@ class MxDSChunk : public MxCore {
public: public:
enum { enum {
Flag_Bit1 = 0x01, Flag_Bit1 = 0x01,
Flag_Bit2 = 0x02, Flag_End = 0x02,
Flag_Bit3 = 0x04, Flag_Bit3 = 0x04,
Flag_Bit4 = 0x08, Flag_Split = 0x10,
Flag_Bit5 = 0x10,
Flag_Bit8 = 0x80,
Flag_Bit16 = 0x8000 Flag_Bit16 = 0x8000
}; };

View File

@@ -119,7 +119,7 @@ void MxDSSubscriber::FUN_100b8390(MxStreamChunk* p_chunk)
if (p_chunk) if (p_chunk)
delete p_chunk; delete p_chunk;
} }
else if ((p_chunk->GetFlags() & MxStreamChunk::Flag_Bit1) != 0 && p_chunk) else if (p_chunk->GetFlags() & MxDSChunk::Flag_Bit1 && p_chunk)
delete p_chunk; delete p_chunk;
} }
} }

View File

@@ -40,7 +40,7 @@ void MxLoopingFlcPresenter::NextFrame()
{ {
MxStreamChunk* chunk = NextChunk(); MxStreamChunk* chunk = NextChunk();
if (chunk->GetFlags() & MxStreamChunk::Flag_Bit2) { if (chunk->GetFlags() & MxDSChunk::Flag_End) {
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Repeating; m_currentTickleState = TickleState_Repeating;
} }

View File

@@ -51,7 +51,7 @@ void MxLoopingSmkPresenter::NextFrame()
{ {
MxStreamChunk* chunk = NextChunk(); MxStreamChunk* chunk = NextChunk();
if (chunk->GetFlags() & MxStreamChunk::Flag_Bit2) { if (chunk->GetFlags() & MxDSChunk::Flag_End) {
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Repeating; m_currentTickleState = TickleState_Repeating;
} }

View File

@@ -185,7 +185,7 @@ void MxMediaPresenter::StreamingTickle()
m_currentChunk = NextChunk(); m_currentChunk = NextChunk();
if (m_currentChunk) { if (m_currentChunk) {
if (m_currentChunk->GetFlags() & MxDSChunk::Flag_Bit2) { if (m_currentChunk->GetFlags() & MxDSChunk::Flag_End) {
m_subscriber->FUN_100b8390(m_currentChunk); m_subscriber->FUN_100b8390(m_currentChunk);
m_currentChunk = NULL; m_currentChunk = NULL;
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;

View File

@@ -54,7 +54,7 @@ MxResult MxStreamChunk::SendChunk(MxStreamListMxDSSubscriber& p_subscriberList,
{ {
for (MxStreamListMxDSSubscriber::iterator it = p_subscriberList.begin(); it != p_subscriberList.end(); it++) { for (MxStreamListMxDSSubscriber::iterator it = p_subscriberList.begin(); it != p_subscriberList.end(); it++) {
if ((*it)->GetObjectId() == m_objectId && (*it)->GetUnknown48() == p_obj24val) { if ((*it)->GetObjectId() == m_objectId && (*it)->GetUnknown48() == p_obj24val) {
if (m_flags & MxDSChunk::Flag_Bit2 && m_buffer) { if (m_flags & MxDSChunk::Flag_End && m_buffer) {
m_buffer->ReleaseRef(this); m_buffer->ReleaseRef(this);
m_buffer = NULL; m_buffer = NULL;
} }
@@ -77,23 +77,23 @@ void MxStreamChunk::SetBuffer(MxDSBuffer* p_buffer)
// FUNCTION: LEGO1 0x100c3180 // FUNCTION: LEGO1 0x100c3180
MxU16* MxStreamChunk::IntoFlags(MxU8* p_buffer) MxU16* MxStreamChunk::IntoFlags(MxU8* p_buffer)
{ {
return (MxU16*) (p_buffer + 8); return (MxU16*) (p_buffer + 0x08);
} }
// FUNCTION: LEGO1 0x100c3190 // FUNCTION: LEGO1 0x100c3190
MxU32* MxStreamChunk::IntoPlus0xa(MxU8* p_buffer) MxU32* MxStreamChunk::IntoObjectId(MxU8* p_buffer)
{ {
return (MxU32*) (p_buffer + 0xa); return (MxU32*) (p_buffer + 0x0a);
} }
// FUNCTION: LEGO1 0x100c31a0 // FUNCTION: LEGO1 0x100c31a0
MxU32* MxStreamChunk::IntoPlus0xe(MxU8* p_buffer) MxLong* MxStreamChunk::IntoTime(MxU8* p_buffer)
{ {
return (MxU32*) (p_buffer + 0xe); return (MxLong*) (p_buffer + 0x0e);
} }
// FUNCTION: LEGO1 0x100c31b0 // FUNCTION: LEGO1 0x100c31b0
MxU32* MxStreamChunk::IntoPlus0x12(MxU8* p_buffer) MxU32* MxStreamChunk::IntoLength(MxU8* p_buffer)
{ {
return (MxU32*) (p_buffer + 0x12); return (MxU32*) (p_buffer + 0x12);
} }

View File

@@ -35,9 +35,9 @@ public:
void SetBuffer(MxDSBuffer* p_buffer); void SetBuffer(MxDSBuffer* p_buffer);
static MxU16* IntoFlags(MxU8* p_buffer); static MxU16* IntoFlags(MxU8* p_buffer);
static MxU32* IntoPlus0x12(MxU8* p_buffer); static MxU32* IntoObjectId(MxU8* p_buffer);
static MxU32* IntoPlus0xa(MxU8* p_buffer); static MxLong* IntoTime(MxU8* p_buffer);
static MxU32* IntoPlus0xe(MxU8* p_buffer); static MxU32* IntoLength(MxU8* p_buffer);
private: private:
MxDSBuffer* m_buffer; // 0x1c MxDSBuffer* m_buffer; // 0x1c

View File

@@ -240,7 +240,7 @@ void MxVideoPresenter::NextFrame()
{ {
MxStreamChunk* chunk = NextChunk(); MxStreamChunk* chunk = NextChunk();
if (chunk->GetFlags() & MxStreamChunk::Flag_Bit2) { if (chunk->GetFlags() & MxDSChunk::Flag_End) {
m_subscriber->FUN_100b8390(chunk); m_subscriber->FUN_100b8390(chunk);
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Repeating; m_currentTickleState = TickleState_Repeating;

View File

@@ -201,7 +201,7 @@ void MxWavePresenter::StreamingTickle()
if (!(m_action->GetFlags() & MxDSAction::Flag_Looping)) { if (!(m_action->GetFlags() & MxDSAction::Flag_Looping)) {
MxStreamChunk* chunk = FUN_100b5650(); MxStreamChunk* chunk = FUN_100b5650();
if (chunk && chunk->GetFlags() & MxDSChunk::Flag_Bit2 && !(chunk->GetFlags() & MxDSChunk::Flag_Bit16)) { if (chunk && chunk->GetFlags() & MxDSChunk::Flag_End && !(chunk->GetFlags() & MxDSChunk::Flag_Bit16)) {
chunk->SetFlags(chunk->GetFlags() | MxDSChunk::Flag_Bit16); chunk->SetFlags(chunk->GetFlags() | MxDSChunk::Flag_Bit16);
m_currentChunk = new MxStreamChunk; m_currentChunk = new MxStreamChunk;