2023-09-25 22:30:56 -04:00
|
|
|
#include "mxstreamcontroller.h"
|
|
|
|
|
2023-10-07 14:05:45 -04:00
|
|
|
#include "legoomni.h"
|
2023-10-24 19:38:27 -04:00
|
|
|
#include "mxautolocker.h"
|
2023-11-05 10:25:38 -05:00
|
|
|
#include "mxnextactiondatastart.h"
|
2023-11-28 08:26:39 -05:00
|
|
|
#include "mxstreamchunk.h"
|
2023-11-05 10:25:38 -05:00
|
|
|
|
2023-11-28 08:26:39 -05:00
|
|
|
DECOMP_SIZE_ASSERT(MxStreamController, 0x64)
|
2023-11-05 10:25:38 -05:00
|
|
|
DECOMP_SIZE_ASSERT(MxNextActionDataStart, 0x14)
|
2023-09-25 22:30:56 -04:00
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100b9400
|
2023-11-21 03:44:45 -05:00
|
|
|
MxResult MxStreamController::vtable0x18(undefined4 p_unknown, undefined4 p_unknown2)
|
|
|
|
{
|
|
|
|
return FAILURE;
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100b9410
|
2023-11-21 03:44:45 -05:00
|
|
|
MxResult MxStreamController::vtable0x1C(undefined4 p_unknown, undefined4 p_unknown2)
|
|
|
|
{
|
|
|
|
return FAILURE;
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100b9420
|
2023-11-21 03:44:45 -05:00
|
|
|
MxResult MxStreamController::vtable0x28()
|
|
|
|
{
|
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100c0b90
|
2023-09-25 22:30:56 -04:00
|
|
|
MxStreamController::MxStreamController()
|
|
|
|
{
|
2023-11-28 08:26:39 -05:00
|
|
|
m_provider = NULL;
|
|
|
|
m_unk2c = 0; // TODO: probably also NULL
|
|
|
|
m_action0x60 = NULL;
|
2023-09-25 22:30:56 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// TEMPLATE: LEGO1 0x100c0d60
|
2023-11-28 08:26:39 -05:00
|
|
|
// list<MxDSAction *,allocator<MxDSAction *> >::~list<MxDSAction *,allocator<MxDSAction *> >
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// TEMPLATE: LEGO1 0x100c0dd0
|
2023-11-28 08:26:39 -05:00
|
|
|
// list<MxDSSubscriber *,allocator<MxDSSubscriber *> >::~list<MxDSSubscriber *,allocator<MxDSSubscriber *> >
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// TEMPLATE: LEGO1 0x100c0e40
|
2023-11-28 08:26:39 -05:00
|
|
|
// list<MxDSSubscriber *,allocator<MxDSSubscriber *> >::_Buynode
|
|
|
|
|
|
|
|
// clang-format off
|
2023-12-06 07:10:45 -05:00
|
|
|
// TEMPLATE: LEGO1 0x100c0e70
|
2023-11-28 08:26:39 -05:00
|
|
|
// list<MxNextActionDataStart *,allocator<MxNextActionDataStart *> >::~list<MxNextActionDataStart *,allocator<MxNextActionDataStart *> >
|
|
|
|
// clang-format on
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// TEMPLATE: LEGO1 0x100c0ee0
|
2023-11-28 08:26:39 -05:00
|
|
|
// list<MxNextActionDataStart *,allocator<MxNextActionDataStart *> >::_Buynode
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// TEMPLATE: LEGO1 0x100c0fc0
|
2023-11-28 08:26:39 -05:00
|
|
|
// MxStreamListMxDSSubscriber::~MxStreamListMxDSSubscriber
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// TEMPLATE: LEGO1 0x100c1010
|
2023-11-28 08:26:39 -05:00
|
|
|
// MxStreamListMxDSAction::~MxStreamListMxDSAction
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// TEMPLATE: LEGO1 0x100c1060
|
2023-11-28 08:26:39 -05:00
|
|
|
// MxStreamListMxNextActionDataStart::~MxStreamListMxNextActionDataStart
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// TEMPLATE: LEGO1 0x100c10b0
|
2023-11-28 08:26:39 -05:00
|
|
|
// MxStreamList<MxDSSubscriber *>::~MxStreamList<MxDSSubscriber *>
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// TEMPLATE: LEGO1 0x100c1100
|
2023-11-28 08:26:39 -05:00
|
|
|
// MxStreamList<MxDSAction *>::~MxStreamList<MxDSAction *>
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// TEMPLATE: LEGO1 0x100c1150
|
2023-11-28 08:26:39 -05:00
|
|
|
// MxStreamList<MxNextActionDataStart *>::~MxStreamList<MxNextActionDataStart *>
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// TEMPLATE: LEGO1 0x100c11a0
|
2023-11-28 08:26:39 -05:00
|
|
|
// List<MxDSSubscriber *>::~List<MxDSSubscriber *>
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// TEMPLATE: LEGO1 0x100c11f0
|
2023-11-28 08:26:39 -05:00
|
|
|
// List<MxDSAction *>::~List<MxDSAction *>
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// TEMPLATE: LEGO1 0x100c1240
|
2023-11-28 08:26:39 -05:00
|
|
|
// List<MxNextActionDataStart *>::~List<MxNextActionDataStart *>
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// STUB: LEGO1 0x100c1290
|
2023-09-25 22:30:56 -04:00
|
|
|
MxStreamController::~MxStreamController()
|
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
// TODO
|
2023-09-25 22:30:56 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100c1520
|
2023-10-24 19:38:27 -04:00
|
|
|
MxResult MxStreamController::Open(const char* p_filename)
|
2023-09-25 22:30:56 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
char sourceName[256];
|
|
|
|
MxAutoLocker locker(&m_criticalSection);
|
2023-09-25 22:30:56 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
MakeSourceName(sourceName, p_filename);
|
|
|
|
this->atom = MxAtomId(sourceName, LookupMode_LowerCase2);
|
|
|
|
return SUCCESS;
|
2023-09-25 22:30:56 -04:00
|
|
|
}
|
2023-10-07 09:05:44 -04:00
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100c1690
|
2023-10-08 16:41:34 -04:00
|
|
|
MxResult MxStreamController::vtable0x20(MxDSAction* p_action)
|
2023-10-07 09:05:44 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
MxAutoLocker locker(&m_criticalSection);
|
2023-10-10 04:27:00 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
MxResult result;
|
|
|
|
MxU32 offset = 0;
|
2023-10-10 04:27:00 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
MxS32 objectId = p_action->GetObjectId();
|
|
|
|
MxStreamProvider* provider = m_provider;
|
2023-10-10 04:27:00 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
if ((MxS32) provider->GetLengthInDWords() > objectId)
|
|
|
|
offset = provider->GetBufferForDWords()[objectId];
|
2023-10-10 04:27:00 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
if (offset)
|
|
|
|
result = vtable0x2c(p_action, offset);
|
|
|
|
else
|
|
|
|
result = FAILURE;
|
2023-10-10 04:27:00 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
return result;
|
2023-10-07 09:05:44 -04:00
|
|
|
}
|
2023-10-08 16:41:34 -04:00
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// STUB: LEGO1 0x100c1740
|
2023-10-08 16:41:34 -04:00
|
|
|
MxResult MxStreamController::vtable0x24(undefined4 p_unknown)
|
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
// TODO STUB
|
|
|
|
return FAILURE;
|
2023-10-08 16:41:34 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100c1800
|
2023-11-05 10:25:38 -05:00
|
|
|
MxResult MxStreamController::FUN_100c1800(MxDSAction* p_action, MxU32 p_val)
|
|
|
|
{
|
|
|
|
MxNextActionDataStart* dataActionStart =
|
|
|
|
new MxNextActionDataStart(p_action->GetObjectId(), p_action->GetUnknown24(), p_val);
|
|
|
|
if (dataActionStart == NULL) {
|
|
|
|
return FAILURE;
|
|
|
|
}
|
2023-11-28 08:26:39 -05:00
|
|
|
|
|
|
|
m_nextActionList.push_back(dataActionStart);
|
|
|
|
return SUCCESS;
|
2023-11-05 10:25:38 -05:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// STUB: LEGO1 0x100c1a00
|
2023-11-21 03:44:45 -05:00
|
|
|
MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_bufferval)
|
2023-10-08 16:41:34 -04:00
|
|
|
{
|
2023-11-21 03:44:45 -05:00
|
|
|
return FAILURE;
|
2023-10-08 16:41:34 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100c1c10
|
2023-10-10 04:27:00 -04:00
|
|
|
MxResult MxStreamController::vtable0x2c(MxDSAction* p_action, MxU32 p_bufferval)
|
2023-10-08 16:41:34 -04:00
|
|
|
{
|
2023-11-05 10:25:38 -05:00
|
|
|
MxAutoLocker locker(&m_criticalSection);
|
|
|
|
if (FUN_100c1a00(p_action, p_bufferval) != SUCCESS) {
|
|
|
|
return FAILURE;
|
|
|
|
}
|
|
|
|
return FUN_100c1800(p_action, (p_bufferval / m_provider->GetFileSize()) * m_provider->GetFileSize());
|
2023-10-08 16:41:34 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// STUB: LEGO1 0x100c1ce0
|
2023-10-08 16:41:34 -04:00
|
|
|
MxResult MxStreamController::vtable0x30(undefined4 p_unknown)
|
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
return FAILURE;
|
2023-10-08 16:41:34 -04:00
|
|
|
}
|
2023-11-05 10:25:38 -05:00
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// STUB: LEGO1 0x100c20d0
|
2023-11-21 03:44:45 -05:00
|
|
|
MxBool MxStreamController::FUN_100c20d0(MxDSObject& p_obj)
|
2023-11-05 10:25:38 -05:00
|
|
|
{
|
2023-11-21 03:44:45 -05:00
|
|
|
// TODO
|
|
|
|
return TRUE;
|
2023-11-05 10:25:38 -05:00
|
|
|
}
|