mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-26 01:28:30 -05:00
bc5ca621a4
* Add ncc tool * Add symlink * Fixes * Try this * Try this * Try this * Try this * Add include path * Update style * Update style * Add more rules * Fix style * Update styles * Fix name parameter * Fix MxParam p * Fix m_unk0x pattern * Allow 4 digits for relative hex * Add missing offset * Fix some parameters * Fix some vtables * Fix more vtables * Update rules, fixes * More fixes * More fixes * More fixes * More fixes * More fixes * More fixes * More fixes * Fix last issue * Update readme * Update readme * Update CONTRIBUTING.md * Fix annotations * Rename * Update CONTRIBUTING.md * Update README.md
148 lines
3.4 KiB
C++
148 lines
3.4 KiB
C++
#include "mxstreamcontroller.h"
|
|
|
|
#include "legoomni.h"
|
|
#include "mxautolocker.h"
|
|
#include "mxnextactiondatastart.h"
|
|
#include "mxstreamchunk.h"
|
|
|
|
DECOMP_SIZE_ASSERT(MxStreamController, 0x64)
|
|
DECOMP_SIZE_ASSERT(MxNextActionDataStart, 0x14)
|
|
|
|
// FUNCTION: LEGO1 0x100b9400
|
|
MxResult MxStreamController::VTable0x18(undefined4, undefined4)
|
|
{
|
|
return FAILURE;
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x100b9410
|
|
MxResult MxStreamController::VTable0x1c(undefined4, undefined4)
|
|
{
|
|
return FAILURE;
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x100b9420
|
|
MxResult MxStreamController::VTable0x28()
|
|
{
|
|
return SUCCESS;
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x100c0b90
|
|
MxStreamController::MxStreamController()
|
|
{
|
|
m_provider = NULL;
|
|
m_unk0x2c = 0; // TODO: probably also NULL
|
|
m_action0x60 = NULL;
|
|
}
|
|
|
|
// STUB: LEGO1 0x100c1290
|
|
MxStreamController::~MxStreamController()
|
|
{
|
|
// TODO
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x100c1520
|
|
MxResult MxStreamController::Open(const char* p_filename)
|
|
{
|
|
char sourceName[256];
|
|
MxAutoLocker locker(&m_criticalSection);
|
|
|
|
MakeSourceName(sourceName, p_filename);
|
|
this->m_atom = MxAtomId(sourceName, LookupMode_LowerCase2);
|
|
return SUCCESS;
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x100c1690
|
|
MxResult MxStreamController::VTable0x20(MxDSAction* p_action)
|
|
{
|
|
MxAutoLocker locker(&m_criticalSection);
|
|
|
|
MxResult result;
|
|
MxU32 offset = 0;
|
|
|
|
MxS32 objectId = p_action->GetObjectId();
|
|
MxStreamProvider* provider = m_provider;
|
|
|
|
if ((MxS32) provider->GetLengthInDWords() > objectId)
|
|
offset = provider->GetBufferForDWords()[objectId];
|
|
|
|
if (offset)
|
|
result = VTable0x2c(p_action, offset);
|
|
else
|
|
result = FAILURE;
|
|
|
|
return result;
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x100c1740
|
|
MxResult MxStreamController::VTable0x24(MxDSAction* p_action)
|
|
{
|
|
MxAutoLocker locker(&m_criticalSection);
|
|
VTable0x30(p_action);
|
|
m_action0x60 = m_unk0x54.Find(p_action, TRUE);
|
|
if (m_action0x60 == NULL) {
|
|
return FAILURE;
|
|
}
|
|
else {
|
|
p_action->SetUnknown24(m_action0x60->GetUnknown24());
|
|
p_action->SetObjectId(m_action0x60->GetObjectId());
|
|
return FUN_100c1f00(m_action0x60);
|
|
}
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x100c1800
|
|
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;
|
|
}
|
|
|
|
m_nextActionList.push_back(dataActionStart);
|
|
return SUCCESS;
|
|
}
|
|
|
|
// STUB: LEGO1 0x100c1a00
|
|
MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_bufferval)
|
|
{
|
|
return FAILURE;
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x100c1c10
|
|
MxResult MxStreamController::VTable0x2c(MxDSAction* p_action, MxU32 p_bufferval)
|
|
{
|
|
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());
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x100c1ce0
|
|
MxResult MxStreamController::VTable0x30(MxDSAction* p_action)
|
|
{
|
|
MxAutoLocker locker(&m_criticalSection);
|
|
MxResult result = FAILURE;
|
|
MxDSAction* action = m_unk0x3c.Find(p_action, TRUE);
|
|
if (action != NULL) {
|
|
MxNextActionDataStart* data = m_nextActionList.Find(action->GetObjectId(), action->GetUnknown24());
|
|
delete action;
|
|
delete data;
|
|
result = SUCCESS;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// STUB: LEGO1 0x100c1f00
|
|
MxResult MxStreamController::FUN_100c1f00(MxDSAction* p_action)
|
|
{
|
|
// TODO
|
|
return FAILURE;
|
|
}
|
|
|
|
// STUB: LEGO1 0x100c20d0
|
|
MxBool MxStreamController::FUN_100c20d0(MxDSObject& p_obj)
|
|
{
|
|
// TODO
|
|
return TRUE;
|
|
}
|