isle/LEGO1/mxstreamcontroller.cpp
MS 1ae3b07dc2
Checkorder tool to keep functions in original binary order (#228)
* First commit of order tool

* More flexible match on module name. Bugfix on blank_or_comment

* Report inexact offset comments in verbose mode. Bugfix for exact regex

* Refactor checkorder into reusable isledecomp module

* Find bad comments in one pass, add awareness of TEMPLATE

* Refactor of state machine to prepare for reccmp integration

* Use isledecomp lib in reccmp

* Build isledecomp in GH actions, fix mypy complaint

* Ensure unit test cpp files will be ignored by reccmp

* Allow multiple offset markers, pep8 cleanup

* Remove unused variable

* Code style, remove unneeded module and TODO

* Final renaming and type hints

* Fix checkorder issues, add GH action and enforce (#2)

* Fix checkorder issues

* Add GH action

* Test error case

* Works

* Fixes

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
2023-11-21 09:44:45 +01:00

118 lines
2.6 KiB
C++

#include "mxstreamcontroller.h"
#include "legoomni.h"
#include "mxautolocker.h"
#include "mxnextactiondatastart.h"
DECOMP_SIZE_ASSERT(MxNextActionDataStart, 0x14)
// 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;
}
// OFFSET: LEGO1 0x100c0b90 STUB
MxStreamController::MxStreamController()
{
// TODO
}
// OFFSET: LEGO1 0x100c1290 STUB
MxStreamController::~MxStreamController()
{
// TODO
}
// OFFSET: LEGO1 0x100c1520
MxResult MxStreamController::Open(const char* p_filename)
{
char sourceName[256];
MxAutoLocker locker(&m_criticalSection);
MakeSourceName(sourceName, p_filename);
this->atom = MxAtomId(sourceName, LookupMode_LowerCase2);
return SUCCESS;
}
// OFFSET: 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;
}
// OFFSET: LEGO1 0x100c1740 STUB
MxResult MxStreamController::vtable0x24(undefined4 p_unknown)
{
// TODO STUB
return FAILURE;
}
// 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;
}
// OFFSET: LEGO1 0x100c1a00 STUB
MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_bufferval)
{
return FAILURE;
}
// OFFSET: 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());
}
// OFFSET: LEGO1 0x100c1ce0 STUB
MxResult MxStreamController::vtable0x30(undefined4 p_unknown)
{
return FAILURE;
}
// OFFSET: LEGO1 0x100c20d0 STUB
MxBool MxStreamController::FUN_100c20d0(MxDSObject& p_obj)
{
// TODO
return TRUE;
}