isle/LEGO1/mxmediapresenter.cpp

136 lines
2.4 KiB
C++
Raw Normal View History

#include "mxmediapresenter.h"
#include "mxautolocker.h"
#include "mxstreamchunk.h"
Implement MxObjectFactory::{MxObjectFactory,Create} + match sizes of Mx.*Presenter objects created by it (#59) * Get Isle building on MinGW32 (#63) * Add MxUnknown100dc6b0::~MxUnknown100dc6b0 stub * Declare destructor of MxOmni and MxTransitionManager in class * inline attribute must go first * Stub LegoState::Vtable0x14 for Act3State * MxStreamer::VTable0x14 is not an override * Stub MxEntity::Destroy for LegoState::Destroy * Stub MxUnknown100dc6e0 for MxSoundManager * ::ClassName and ::IsA are const methods * methods in the class body don't need a namespace * MxSoundManager subclasses MxUnknown100dc6e0 * LegoInputManager subclasses MxPresenter * NotificationId is an enum, and does not need __declspec(dllexport) * Fix final #endif of legoomni.h and mxobjectfactory.h * Add const alternative for LegoOmni::Create and MxVideoParam, only available for MinGW * Alternative approach to MinGW compatibility * MinGW on Linux is case sensitve * Don't delete a member variable. C++ automatically destructs member variables --------- Co-authored-by: MattKC <34096995+itsmattkc@users.noreply.github.com> * MxatomId: implement inline operator== * Add decomp.h header, containing macro's only used when matching the original binaries * Add in-line constructor of MxPresenter * MxMediaPresenter: add members to match size * MxVideoPresenter: add members to match size * MxCompositePresenter: add members to match size * MxFlcPresenter: add members to match size * MxSmkPresenter: add members to match size * MxStillPresenter: add members to match size * MxAudioPresenter: add members to match size * MxWavePresenter: add members to match size * MxMIDIPresenter: add members to match size * MxEventPresenter: add members to match size * MxLoopingFlcPresenter: add members to match size * MxLoopingSmkPresenter: add members to match size * MxLoopingMIDIPresenter: add check for size * Implement MxObjectFactory::{MxObjectFactory,Create} Matching of MxObjectFactory::Create is not good, because none of the other objects have been implemented. * Implement a few MxPresenter methods * Fix size of LegoInputManager * Fix name of first padding member of legoinputmanager.h * add DECOMP_SIZE_ASSERT macro * Use DECOMP_SIZE_ASSERT macro + convert to hexadecimal * fixed minor typos --------- Co-authored-by: MattKC <34096995+itsmattkc@users.noreply.github.com> Co-authored-by: itsmattkc <itsmattkc@gmail.com>
2023-07-02 03:00:28 -04:00
DECOMP_SIZE_ASSERT(MxMediaPresenter, 0x50);
// OFFSET: LEGO1 0x1000c550
MxMediaPresenter::~MxMediaPresenter()
{
2023-10-24 19:38:27 -04:00
Destroy(TRUE);
}
// OFFSET: LEGO1 0x1000c5b0
void MxMediaPresenter::Destroy()
{
Destroy(FALSE);
}
// OFFSET: LEGO1 0x100b54e0
void MxMediaPresenter::Init()
{
this->m_subscriber = NULL;
this->m_chunks = NULL;
this->m_cursor = NULL;
this->m_currentChunk = NULL;
}
// OFFSET: LEGO1 0x100b54f0
void MxMediaPresenter::Destroy(MxBool p_fromDestructor)
{
{
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-24 19:38:27 -04:00
// TODO
return SUCCESS;
}
// OFFSET: LEGO1 0x100b5d90 STUB
void MxMediaPresenter::StreamingTickle()
{
2023-10-24 19:38:27 -04:00
// TODO
}
// OFFSET: LEGO1 0x100b5e10 STUB
void MxMediaPresenter::RepeatingTickle()
{
2023-10-24 19:38:27 -04:00
// TODO
}
// OFFSET: LEGO1 0x100b5ef0
void MxMediaPresenter::DoneTickle()
{
2023-10-24 19:38:27 -04:00
m_previousTickleStates |= 1 << m_currentTickleState;
m_currentTickleState = TickleState_Idle;
EndAction();
}
// OFFSET: LEGO1 0x100b6030 STUB
void MxMediaPresenter::Enable(MxBool p_enable)
{
2023-10-24 19:38:27 -04:00
// TODO
}
// OFFSET: LEGO1 0x100b5700
MxResult MxMediaPresenter::StartAction(MxStreamController* p_controller, MxDSAction* p_action)
{
MxResult result = FAILURE;
MxAutoLocker lock(&m_criticalSection);
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;
}
// OFFSET: LEGO1 0x100b5bc0 STUB
void MxMediaPresenter::EndAction()
{
2023-10-24 19:38:27 -04:00
// TODO
}
// OFFSET: LEGO1 0x100b5f10 STUB
void MxMediaPresenter::VTable0x58()
{
2023-10-24 19:38:27 -04:00
// TODO
}