push code

This commit is contained in:
Misha 2023-12-21 13:39:45 -05:00
parent afadca953b
commit 58ee551c01
No known key found for this signature in database
GPG Key ID: 8441D12AEF33FED8
8 changed files with 157 additions and 10 deletions

View File

@ -58,11 +58,41 @@ MxResult MxDiskStreamController::VTable0x34(undefined4)
return FAILURE;
}
// FUNCTION: LEGO1 0x100c7980
void MxDiskStreamController::FUN_100c7980()
{
MxDSBuffer* buffer;
MxDSStreamingAction* action = NULL;
MxAutoLocker lock(&this->m_criticalSection);
if (m_unk0x3c.size() != 0 || m_provider->GetStreamBuffersNum() > m_unk0x8c) {
buffer = new MxDSBuffer();
if (buffer->AllocateBuffer(m_provider->GetFileSize(), MxDSBufferType_Chunk) == SUCCESS) {
action = VTable0x28();
if (action) {
action->SetUnknowna0(buffer);
m_unk0x8c++;
}
else {
return;
}
}
else {
delete buffer;
return;
}
}
if (action) {
((MxDiskStreamProvider*) m_provider)->FUN_100d1780(action);
}
}
// STUB: LEGO1 0x100c7ac0
MxResult MxDiskStreamController::VTable0x28()
MxDSStreamingAction* MxDiskStreamController::VTable0x28()
{
// TODO
return FAILURE;
return NULL;
}
// STUB: LEGO1 0x100c7c00
@ -72,6 +102,35 @@ MxResult MxDiskStreamController::VTable0x30(MxDSAction* p_action)
return FAILURE;
}
// FUNCTION: LEGO1 0x100c7cb0
void MxDiskStreamController::FUN_100c7cb0(MxDSStreamingAction* p_action)
{
if (p_action->GetUnknowna0()) {
FUN_100c7ce0(p_action->GetUnknowna0());
}
p_action->SetUnknowna0(NULL);
delete p_action;
}
// FUNCTION: LEGO1 0x100c7ce0
void MxDiskStreamController::FUN_100c7ce0(MxDSBuffer* p_buffer)
{
switch (p_buffer->GetMode()) {
case MxDSBufferType_Chunk:
m_unk0x8c--;
case MxDSBufferType_Allocate:
case MxDSBufferType_Unknown:
delete p_buffer;
break;
}
}
// STUB: LEGO1 0x100c7d10
MxResult MxDiskStreamController::FUN_100c7d10()
{
return FAILURE;
}
// FUNCTION: LEGO1 0x100c7f40
void MxDiskStreamController::FUN_100c7f40(MxDSStreamingAction* p_streamingaction)
{
@ -122,9 +181,39 @@ void MxDiskStreamController::InsertToList74(MxDSBuffer* p_buffer)
m_list0x74.push_back(p_buffer);
}
// STUB: LEGO1 0x100c8640
MxResult MxDiskStreamController::Tickle()
// STUB: LEGO1 0x100c8540
void MxDiskStreamController::FUN_100c8540()
{
// TODO
}
// FUNCTION: LEGO1 0x100c8640
MxResult MxDiskStreamController::Tickle()
{
if (m_unk0xc4) {
FUN_100c7d10();
}
FUN_100c8540();
FUN_100c8720();
if (m_unk0x70) {
FUN_100c7980();
}
return SUCCESS;
}
// FUNCTION: LEGO1 0x100c8720
void MxDiskStreamController::FUN_100c8720()
{
MxAutoLocker lock(&this->m_critical9c);
MxDSStreamingAction* action;
while (m_list0xb8.size() != 0) {
action = (MxDSStreamingAction*) m_list0xb8.front();
m_list0xb8.pop_front();
FUN_100c7cb0(action);
}
}

View File

@ -22,7 +22,7 @@ class MxDiskStreamController : public MxStreamController {
virtual MxResult VTable0x18(undefined4, undefined4) override; // vtable+0x18
virtual MxResult VTable0x20(MxDSAction* p_action) override; // vtable+0x20
virtual MxResult VTable0x24(MxDSAction* p_action) override; // vtable+0x24
virtual MxResult VTable0x28() override; // vtable+0x28
virtual MxDSStreamingAction* VTable0x28() override; // vtable+0x28
virtual MxResult VTable0x30(MxDSAction* p_action) override; // vtable+0x30
virtual MxResult VTable0x34(undefined4); // vtable+0x34
@ -50,8 +50,14 @@ class MxDiskStreamController : public MxStreamController {
MxStreamListMxDSAction m_list0xb8; // 0xb8
undefined m_unk0xc4; // 0xc4
void FUN_100c7cb0(MxDSStreamingAction* p_action);
void FUN_100c7ce0(MxDSBuffer* p_buffer);
MxResult FUN_100c7d10();
void FUN_100c7980();
void FUN_100c7f40(MxDSStreamingAction* p_streamingaction);
void InsertToList74(MxDSBuffer* p_buffer);
void FUN_100c8540();
void FUN_100c8720();
};
// TEMPLATE: LEGO1 0x100c7330

View File

@ -1,5 +1,6 @@
#include "mxdiskstreamprovider.h"
#include "mxdsbuffer.h"
#include "mxomni.h"
#include "mxstreamcontroller.h"
#include "mxstring.h"
@ -87,6 +88,13 @@ MxResult MxDiskStreamProvider::WaitForWorkToComplete()
return SUCCESS;
}
// STUB: LEGO1 0x100d1780
MxResult MxDiskStreamProvider::FUN_100d1780(MxDSStreamingAction* p_action)
{
// TODO
return FAILURE;
}
// STUB: LEGO1 0x100d18f0
void MxDiskStreamProvider::PerformWork()
{

View File

@ -10,6 +10,7 @@
#include "mxthread.h"
class MxDiskStreamProvider;
class MxDSStreamingAction;
// VTABLE: LEGO1 0x100dd130
class MxDiskStreamProviderThread : public MxThread {
@ -43,7 +44,7 @@ class MxDiskStreamProvider : public MxStreamProvider {
}
MxResult WaitForWorkToComplete();
MxResult FUN_100d1780(MxDSStreamingAction* p_action);
void PerformWork();
virtual MxResult SetResourceToGet(MxStreamController* p_resource) override; // vtable+0x14

View File

@ -55,6 +55,7 @@ class MxDSBuffer : public MxCore {
inline MxU8* GetBuffer() { return m_pBuffer; }
inline MxU32 GetWriteOffset() { return m_writeOffset; }
inline MxDSBufferType GetMode() { return m_mode; }
private:
MxU8* m_pBuffer; // 0x08

View File

@ -92,8 +92,42 @@ MxResult MxRAMStreamController::DeserializeObject(MxDSStreamingAction& p_action)
return result;
}
// STUB: LEGO1 0x100d0d80
// FUNCTION: LEGO1 0x100d0d80
undefined* __cdecl ReadData(MxU32* p_fileSizeBuffer, MxU32 p_fileSize)
{
MxU32* ptr = p_fileSizeBuffer;
MxU32* end = p_fileSizeBuffer + p_fileSize;
MxU32 objectId;
if (p_fileSizeBuffer < end) {
do {
MxU32* oldPtr = ptr;
if (*ptr = FOURCC('M', 'x', 'O', 'b')) {
ptr += 8;
MxDSObject* object = DeserializeDSObjectDispatch((MxU8**) &ptr, -1);
objectId = object->GetObjectId();
delete object;
ptr = (MxU32*) (oldPtr + oldPtr[1] + (oldPtr[1] & 1) + 8);
if (ptr < end) {
do {
oldPtr = ptr;
if (*ptr == FOURCC('M', 'x', 'C', 'h')) {
// todo
}
else {
ptr++;
}
} while (ptr < end);
}
}
else {
ptr++;
}
} while (ptr < end);
}
return NULL;
}

View File

@ -2,6 +2,7 @@
#include "legoomni.h"
#include "mxautolocker.h"
#include "mxdsstreamingaction.h"
#include "mxnextactiondatastart.h"
#include "mxstreamchunk.h"
@ -11,19 +12,21 @@ DECOMP_SIZE_ASSERT(MxNextActionDataStart, 0x14)
// FUNCTION: LEGO1 0x100b9400
MxResult MxStreamController::VTable0x18(undefined4, undefined4)
{
OutputDebugStringA("MxStreamController::VTable0x18 not implemented\n");
return FAILURE;
}
// FUNCTION: LEGO1 0x100b9410
MxResult MxStreamController::VTable0x1c(undefined4, undefined4)
{
OutputDebugStringA("MxStreamController::VTable0x1c not implemented\n");
return FAILURE;
}
// FUNCTION: LEGO1 0x100b9420
MxResult MxStreamController::VTable0x28()
MxDSStreamingAction* MxStreamController::VTable0x28()
{
return SUCCESS;
return NULL;
}
// FUNCTION: LEGO1 0x100c0b90
@ -105,6 +108,7 @@ MxResult MxStreamController::FUN_100c1800(MxDSAction* p_action, MxU32 p_val)
// STUB: LEGO1 0x100c1a00
MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_bufferval)
{
OutputDebugStringA("MxStreamController::FUN_100c1a00 not implemented\n");
return FAILURE;
}
@ -166,6 +170,7 @@ MxPresenter* MxStreamController::FUN_100c1e70(MxDSAction& p_action)
// STUB: LEGO1 0x100c1f00
MxResult MxStreamController::FUN_100c1f00(MxDSAction* p_action)
{
OutputDebugStringA("MxStreamController::FUN_100c1f00 not implemented\n");
// TODO
return FAILURE;
}
@ -173,6 +178,7 @@ MxResult MxStreamController::FUN_100c1f00(MxDSAction* p_action)
// STUB: LEGO1 0x100c20d0
MxBool MxStreamController::FUN_100c20d0(MxDSObject& p_obj)
{
OutputDebugStringA("MxStreamController::FUN_100c20d0 not implemented\n");
// TODO
return TRUE;
}

View File

@ -11,6 +11,8 @@
#include "mxstreamlist.h"
#include "mxstreamprovider.h"
class MxDSStreamingAction;
// VTABLE: LEGO1 0x100dc968
// SIZE 0x64
class MxStreamController : public MxCore {
@ -37,7 +39,7 @@ class MxStreamController : public MxCore {
virtual MxResult VTable0x1c(undefined4, undefined4); // vtable+0x1c
virtual MxResult VTable0x20(MxDSAction* p_action); // vtable+0x20
virtual MxResult VTable0x24(MxDSAction* p_action); // vtable+0x24
virtual MxResult VTable0x28(); // vtable+0x28
virtual MxDSStreamingAction* VTable0x28(); // vtable+0x28
virtual MxResult VTable0x2c(MxDSAction* p_action, MxU32 p_bufferval); // vtable+0x2c
virtual MxResult VTable0x30(MxDSAction* p_action); // vtable+0x30