2023-06-29 04:10:08 -04:00
|
|
|
#include "mxmediapresenter.h"
|
|
|
|
|
2023-11-13 05:22:58 -05:00
|
|
|
#include "mxactionnotificationparam.h"
|
2023-11-12 07:47:01 -05:00
|
|
|
#include "mxautolocker.h"
|
2023-11-13 05:22:58 -05:00
|
|
|
#include "mxcompositepresenter.h"
|
|
|
|
#include "mxnotificationmanager.h"
|
2023-11-12 07:47:01 -05:00
|
|
|
#include "mxstreamchunk.h"
|
|
|
|
|
2023-07-02 03:00:28 -04:00
|
|
|
DECOMP_SIZE_ASSERT(MxMediaPresenter, 0x50);
|
|
|
|
|
2023-10-08 09:46:09 -04:00
|
|
|
// OFFSET: LEGO1 0x1000c550
|
|
|
|
MxMediaPresenter::~MxMediaPresenter()
|
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
Destroy(TRUE);
|
2023-10-08 09:46:09 -04:00
|
|
|
}
|
|
|
|
|
2023-11-12 07:47:01 -05:00
|
|
|
// OFFSET: LEGO1 0x1000c5b0
|
|
|
|
void MxMediaPresenter::Destroy()
|
2023-06-29 04:10:08 -04:00
|
|
|
{
|
2023-11-12 07:47:01 -05:00
|
|
|
Destroy(FALSE);
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
|
|
|
|
2023-09-11 13:43:55 -04:00
|
|
|
// OFFSET: LEGO1 0x100b54e0
|
2023-06-29 04:10:08 -04:00
|
|
|
void MxMediaPresenter::Init()
|
|
|
|
{
|
2023-11-12 07:47:01 -05:00
|
|
|
this->m_subscriber = NULL;
|
|
|
|
this->m_chunks = NULL;
|
|
|
|
this->m_cursor = NULL;
|
|
|
|
this->m_currentChunk = NULL;
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
2023-10-05 06:31:20 -04:00
|
|
|
|
2023-11-12 07:47:01 -05:00
|
|
|
// OFFSET: LEGO1 0x100b54f0
|
2023-10-13 12:43:45 -04:00
|
|
|
void MxMediaPresenter::Destroy(MxBool p_fromDestructor)
|
2023-11-12 07:47:01 -05:00
|
|
|
{
|
|
|
|
{
|
|
|
|
MxAutoLocker lock(&m_criticalSection);
|
|
|
|
|
|
|
|
if (m_currentChunk && m_subscriber)
|
|
|
|
m_subscriber->FUN_100b8390(m_currentChunk);
|
|
|
|
|
|
|
|
if (m_subscriber)
|
|
|
|
delete m_subscriber;
|
|
|
|
|
|
|
|
if (m_cursor)
|
|
|
|
delete m_cursor;
|
|
|
|
|
|
|
|
if (m_chunks) {
|
|
|
|
MxStreamChunkListCursor cursor(m_chunks);
|
|
|
|
MxStreamChunk* chunk;
|
|
|
|
|
|
|
|
while (cursor.Next(chunk))
|
|
|
|
if (chunk->m_unk18)
|
|
|
|
delete[] chunk->m_unk18;
|
|
|
|
|
|
|
|
delete m_chunks;
|
|
|
|
}
|
|
|
|
|
|
|
|
Init();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!p_fromDestructor)
|
|
|
|
MxPresenter::Destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
// OFFSET: LEGO1 0x100b5d10 STUB
|
|
|
|
MxResult MxMediaPresenter::Tickle()
|
2023-10-08 09:46:09 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
// TODO
|
2023-11-12 07:47:01 -05:00
|
|
|
return SUCCESS;
|
2023-10-08 09:46:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// OFFSET: LEGO1 0x100b5d90 STUB
|
|
|
|
void MxMediaPresenter::StreamingTickle()
|
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
// TODO
|
2023-10-08 09:46:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// OFFSET: LEGO1 0x100b5e10 STUB
|
|
|
|
void MxMediaPresenter::RepeatingTickle()
|
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
// TODO
|
2023-10-08 09:46:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// OFFSET: LEGO1 0x100b5ef0
|
|
|
|
void MxMediaPresenter::DoneTickle()
|
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
m_previousTickleStates |= 1 << m_currentTickleState;
|
|
|
|
m_currentTickleState = TickleState_Idle;
|
|
|
|
EndAction();
|
2023-10-08 09:46:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// OFFSET: LEGO1 0x100b6030 STUB
|
|
|
|
void MxMediaPresenter::Enable(MxBool p_enable)
|
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
// TODO
|
2023-10-08 09:46:09 -04:00
|
|
|
}
|
|
|
|
|
2023-11-12 07:47:01 -05:00
|
|
|
// OFFSET: LEGO1 0x100b5700
|
|
|
|
MxResult MxMediaPresenter::StartAction(MxStreamController* p_controller, MxDSAction* p_action)
|
2023-10-08 09:46:09 -04:00
|
|
|
{
|
2023-11-12 07:47:01 -05:00
|
|
|
MxResult result = FAILURE;
|
|
|
|
MxAutoLocker lock(&m_criticalSection);
|
2023-10-08 09:46:09 -04:00
|
|
|
|
2023-11-12 07:47:01 -05:00
|
|
|
if (MxPresenter::StartAction(p_controller, p_action) == SUCCESS) {
|
|
|
|
if (m_action->GetFlags() & MxDSAction::Flag_Looping) {
|
|
|
|
m_chunks = new MxStreamChunkList;
|
|
|
|
m_cursor = new MxStreamChunkListCursor(m_chunks);
|
|
|
|
|
|
|
|
if (!m_chunks && !m_cursor)
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p_controller) {
|
|
|
|
m_subscriber = new MxDSSubscriber;
|
|
|
|
|
|
|
|
if (!m_subscriber ||
|
|
|
|
m_subscriber->FUN_100b7ed0(p_controller, p_action->GetObjectId(), p_action->GetUnknown24()) != SUCCESS)
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
result = SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
done:
|
|
|
|
return result;
|
2023-10-08 09:46:09 -04:00
|
|
|
}
|
|
|
|
|
2023-11-13 05:22:58 -05:00
|
|
|
// OFFSET: LEGO1 0x100b5bc0
|
2023-10-08 09:46:09 -04:00
|
|
|
void MxMediaPresenter::EndAction()
|
|
|
|
{
|
2023-11-13 05:22:58 -05:00
|
|
|
MxAutoLocker lock(&m_criticalSection);
|
|
|
|
|
|
|
|
if (!m_action)
|
|
|
|
return;
|
|
|
|
|
|
|
|
m_currentChunk = NULL;
|
|
|
|
|
|
|
|
if (m_action->GetFlags() & MxDSAction::Flag_World &&
|
|
|
|
(!m_compositePresenter || !m_compositePresenter->VTable0x64(2))) {
|
|
|
|
MxPresenter::Enable(FALSE);
|
|
|
|
SetTickleState(TickleState::TickleState_Idle);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
MxDSAction* action = m_action;
|
|
|
|
MxPresenter::EndAction();
|
|
|
|
|
|
|
|
if (m_subscriber) {
|
|
|
|
delete m_subscriber;
|
|
|
|
m_subscriber = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (action && action->GetUnknown8c()) {
|
|
|
|
NotificationManager()->Send(
|
|
|
|
action->GetUnknown8c(),
|
|
|
|
&MxEndActionNotificationParam(c_notificationEndAction, this, action, FALSE)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2023-10-08 09:46:09 -04:00
|
|
|
}
|
|
|
|
|
2023-10-05 06:31:20 -04:00
|
|
|
// OFFSET: LEGO1 0x100b5f10 STUB
|
|
|
|
void MxMediaPresenter::VTable0x58()
|
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
// TODO
|
2023-10-05 06:31:20 -04:00
|
|
|
}
|