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"
|
|
|
|
|
|
|
|
DECOMP_SIZE_ASSERT(MxNextActionDataStart, 0x14)
|
2023-09-25 22:30:56 -04:00
|
|
|
|
2023-11-21 03:44:45 -05:00
|
|
|
// OFFSET: LEGO1 0x100b9400
|
|
|
|
MxResult MxStreamController::vtable0x18(undefined4 p_unknown, undefined4 p_unknown2)
|
|
|
|
{
|
|
|
|
return FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// OFFSET: LEGO1 0x100b9410
|
|
|
|
MxResult MxStreamController::vtable0x1C(undefined4 p_unknown, undefined4 p_unknown2)
|
|
|
|
{
|
|
|
|
return FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// OFFSET: LEGO1 0x100b9420
|
|
|
|
MxResult MxStreamController::vtable0x28()
|
|
|
|
{
|
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
|
2023-09-25 22:30:56 -04:00
|
|
|
// OFFSET: LEGO1 0x100c0b90 STUB
|
|
|
|
MxStreamController::MxStreamController()
|
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
// TODO
|
2023-09-25 22:30:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// OFFSET: LEGO1 0x100c1290 STUB
|
|
|
|
MxStreamController::~MxStreamController()
|
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
// TODO
|
2023-09-25 22:30:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// OFFSET: 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-10-10 04:27:00 -04:00
|
|
|
// OFFSET: 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
|
|
|
|
|
|
|
// OFFSET: LEGO1 0x100c1740 STUB
|
|
|
|
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-11-05 10:25:38 -05:00
|
|
|
// OFFSET: LEGO1 0x100c1800 STUB
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
// TODO: insert dataActionStart to a list
|
|
|
|
return FAILURE;
|
|
|
|
}
|
|
|
|
|
2023-11-21 03:44:45 -05:00
|
|
|
// OFFSET: LEGO1 0x100c1a00 STUB
|
|
|
|
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-11-05 10:25:38 -05:00
|
|
|
// OFFSET: 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
|
|
|
}
|
|
|
|
|
|
|
|
// OFFSET: LEGO1 0x100c1ce0 STUB
|
|
|
|
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-11-21 03:44:45 -05:00
|
|
|
// OFFSET: LEGO1 0x100c20d0 STUB
|
|
|
|
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
|
|
|
}
|