diff --git a/LEGO1/mxdiskstreamcontroller.cpp b/LEGO1/mxdiskstreamcontroller.cpp index 721599c8..489d1b74 100644 --- a/LEGO1/mxdiskstreamcontroller.cpp +++ b/LEGO1/mxdiskstreamcontroller.cpp @@ -115,16 +115,16 @@ MxResult MxDiskStreamController::VTable0x24(MxDSAction* p_action) return FAILURE; } -// STUB: LEGO1 0x100c8640 -MxResult MxDiskStreamController::Tickle() -{ - // TODO - return SUCCESS; -} - // FUNCTION: LEGO1 0x100c84a0 void MxDiskStreamController::InsertToList74(MxDSBuffer* p_buffer) { MxAutoLocker lock(&this->m_criticalSection); m_list0x74.push_back(p_buffer); } + +// STUB: LEGO1 0x100c8640 +MxResult MxDiskStreamController::Tickle() +{ + // TODO + return SUCCESS; +} diff --git a/LEGO1/mxdsbuffer.cpp b/LEGO1/mxdsbuffer.cpp index 8a474cfa..c0e73f68 100644 --- a/LEGO1/mxdsbuffer.cpp +++ b/LEGO1/mxdsbuffer.cpp @@ -51,7 +51,7 @@ MxResult MxDSBuffer::AllocateBuffer(MxU32 p_bufferSize, MxDSBufferType p_mode) else if (p_mode == MxDSBufferType_Chunk) { MxStreamer* streamer = Streamer(); // I have no clue as to what this does, or even if its correct. Maybe it's related to storing chunks in - // MxRamStreamController? + // MxDiskStreamController? if (p_bufferSize >> 10 == 0x40) { i = 0; while (i < 22) { @@ -121,6 +121,13 @@ MxResult MxDSBuffer::SetBufferPointer(MxU32* p_buffer, MxU32 p_size) return SUCCESS; } +// STUB: LEGO1 0x100c67b0 +MxResult MxDSBuffer::FUN_100c67b0(MxStreamController* p_controller, MxDSAction* p_action, undefined4*) +{ + // TODO STUB + return FAILURE; +} + // FUNCTION: LEGO1 0x100c68a0 MxResult MxDSBuffer::CreateObject(MxStreamController* p_controller, MxU32* p_data, MxDSAction* p_action, undefined4) { @@ -130,56 +137,59 @@ MxResult MxDSBuffer::CreateObject(MxStreamController* p_controller, MxU32* p_dat MxCore* header = ReadChunk(p_data, p_action->GetUnknown24()); - if (*p_data == FOURCC('M', 'x', 'O', 'b')) { - return StartPresenterFromAction(p_controller, p_action, (MxDSAction*) header); + if (header == NULL) { + return FAILURE; } - if (*p_data == FOURCC('M', 'x', 'C', 'h')) { - if (m_unk0x30->HasId(((MxStreamChunk*) header)->GetUnk0xc()) == 0) { + switch (*p_data) { + case FOURCC('M', 'x', 'C', 'h'): + if (!m_unk0x30->HasId(((MxStreamChunk*) header)->GetUnk0xc())) { delete header; return SUCCESS; } return ParseChunk(p_controller, p_data, p_action, (MxStreamChunk*) header); + case FOURCC('M', 'x', 'O', 'b'): + return StartPresenterFromAction(p_controller, p_action, (MxDSAction*) header); + default: + delete header; + return FAILURE; } - - delete header; - return FAILURE; } // FUNCTION: LEGO1 0x100c6960 MxResult MxDSBuffer::StartPresenterFromAction( MxStreamController* p_controller, MxDSAction* p_action1, - MxDSAction* p_object_header + MxDSAction* p_objectheader ) { if (!m_unk0x30->GetInternalAction()) { - p_object_header->SetAtomId(p_action1->GetAtomId()); - p_object_header->SetUnknown28(p_action1->GetUnknown28()); - p_object_header->SetUnknown84(p_action1->GetUnknown84()); - p_object_header->SetOrigin(p_action1->GetOrigin()); - p_object_header->SetUnknown90(p_action1->GetUnknown90()); - p_object_header->MergeFrom(*p_action1); + p_objectheader->SetAtomId(p_action1->GetAtomId()); + p_objectheader->SetUnknown28(p_action1->GetUnknown28()); + p_objectheader->SetUnknown84(p_action1->GetUnknown84()); + p_objectheader->SetOrigin(p_action1->GetOrigin()); + p_objectheader->SetUnknown90(p_action1->GetUnknown90()); + p_objectheader->MergeFrom(*p_action1); - m_unk0x30->SetInternalAction(p_object_header->Clone()); + m_unk0x30->SetInternalAction(p_objectheader->Clone()); - p_controller->InsertActionToList54(p_object_header); + p_controller->InsertActionToList54(p_objectheader); - if (MxOmni::GetInstance()->CreatePresenter(p_controller, *p_object_header) != SUCCESS) { + if (MxOmni::GetInstance()->CreatePresenter(p_controller, *p_objectheader) != SUCCESS) { return FAILURE; } - m_unk0x30->SetLoopCount(p_object_header->GetLoopCount()); - m_unk0x30->SetFlags(p_object_header->GetFlags()); - m_unk0x30->SetDuration(p_object_header->GetDuration()); + m_unk0x30->SetLoopCount(p_objectheader->GetLoopCount()); + m_unk0x30->SetFlags(p_objectheader->GetFlags()); + m_unk0x30->SetDuration(p_objectheader->GetDuration()); if (m_unk0x30->GetInternalAction() == NULL) { return FAILURE; } } - else if (p_object_header) { - delete p_object_header; + else if (p_objectheader) { + delete p_objectheader; } return SUCCESS; @@ -220,13 +230,6 @@ MxCore* MxDSBuffer::ReadChunk(MxU32* p_chunkData, MxU16 p_flags) return result; } -// STUB: LEGO1 0x100c67b0 -MxResult MxDSBuffer::FUN_100c67b0(MxStreamController* p_controller, MxDSAction* p_action, undefined4*) -{ - // TODO STUB - return FAILURE; -} - // FUNCTION: LEGO1 0x100c6f80 void MxDSBuffer::FUN_100c6f80(MxU32 p_writeOffset) { diff --git a/LEGO1/mxdsbuffer.h b/LEGO1/mxdsbuffer.h index 17d38689..9a93d7f3 100644 --- a/LEGO1/mxdsbuffer.h +++ b/LEGO1/mxdsbuffer.h @@ -32,11 +32,11 @@ class MxDSBuffer : public MxCore { MxResult AllocateBuffer(MxU32 p_bufferSize, MxDSBufferType p_mode); MxResult SetBufferPointer(MxU32* p_buffer, MxU32 p_size); + MxResult FUN_100c67b0(MxStreamController* p_controller, MxDSAction* p_action, undefined4*); MxResult CreateObject(MxStreamController* p_controller, MxU32* p_data, MxDSAction* p_action, undefined4); MxResult StartPresenterFromAction(MxStreamController* p_controller, MxDSAction* p_action1, MxDSAction* p_action2); MxResult ParseChunk(MxStreamController* p_controller, MxU32* p_data, MxDSAction* p_action, MxStreamChunk* p_header); MxCore* ReadChunk(MxU32* p_chunkData, MxU16 p_flags); - MxResult FUN_100c67b0(MxStreamController* p_controller, MxDSAction* p_action, undefined4*); void FUN_100c6f80(MxU32 p_writeOffset); inline MxU8* GetBuffer() { return m_pBuffer; } diff --git a/LEGO1/mxstreamcontroller.cpp b/LEGO1/mxstreamcontroller.cpp index 0a3145d6..e882898b 100644 --- a/LEGO1/mxstreamcontroller.cpp +++ b/LEGO1/mxstreamcontroller.cpp @@ -133,21 +133,6 @@ MxResult MxStreamController::VTable0x30(MxDSAction* p_action) return result; } -// FUNCTION: LEGO1 0x100c1e70 -MxPresenter* MxStreamController::FUN_100c1e70(MxDSAction& p_action) -{ - MxAutoLocker locker(&m_criticalSection); - MxPresenter* result = NULL; - if (p_action.GetObjectId() != -1) { - MxDSAction* action = m_unk0x3c.Find(&p_action, FALSE); - if (action != NULL) { - result = action->GetUnknown28(); - } - } - - return result; -} - // FUNCTION: LEGO1 0x100c1da0 MxResult MxStreamController::InsertActionToList54(MxDSAction* p_action) { @@ -163,6 +148,21 @@ MxResult MxStreamController::InsertActionToList54(MxDSAction* p_action) } } +// FUNCTION: LEGO1 0x100c1e70 +MxPresenter* MxStreamController::FUN_100c1e70(MxDSAction& p_action) +{ + MxAutoLocker locker(&m_criticalSection); + MxPresenter* result = NULL; + if (p_action.GetObjectId() != -1) { + MxDSAction* action = m_unk0x3c.Find(&p_action, FALSE); + if (action != NULL) { + result = action->GetUnknown28(); + } + } + + return result; +} + // STUB: LEGO1 0x100c1f00 MxResult MxStreamController::FUN_100c1f00(MxDSAction* p_action) {