mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-22 15:48:09 -05:00
Implement MxStreamController::FUN_100c1a00 (#357)
* Implement MxStreamController::FUN_100c1a00 * Move include
This commit is contained in:
parent
84056c6ea2
commit
afd24fbe18
5 changed files with 69 additions and 14 deletions
|
@ -784,11 +784,11 @@ inline void IsleApp::Tick(BOOL sleepIfNotNextFrame)
|
|||
LegoOmni::GetInstance()->CreateBackgroundAudio();
|
||||
BackgroundAudioManager()->Enable(this->m_useMusic);
|
||||
|
||||
MxStreamController* stream = Streamer()->Open("\\lego\\scripts\\isle\\isle", 0);
|
||||
MxStreamController* stream = Streamer()->Open("\\lego\\scripts\\isle\\isle", MxStreamer::e_DiskStream);
|
||||
MxDSAction ds;
|
||||
|
||||
if (!stream) {
|
||||
stream = Streamer()->Open("\\lego\\scripts\\nocd", 0);
|
||||
stream = Streamer()->Open("\\lego\\scripts\\nocd", MxStreamer::e_DiskStream);
|
||||
if (!stream) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -41,14 +41,14 @@ class MxDSStreamingAction : public MxDSAction {
|
|||
inline void SetBufferOffset(MxU32 p_bufferOffset) { m_bufferOffset = p_bufferOffset; }
|
||||
|
||||
private:
|
||||
MxU32 m_unk0x94;
|
||||
MxU32 m_bufferOffset;
|
||||
MxS32 m_unk0x9c;
|
||||
MxDSBuffer* m_unk0xa0;
|
||||
MxDSBuffer* m_unk0xa4;
|
||||
MxLong m_unk0xa8;
|
||||
undefined2 m_unk0xac;
|
||||
MxDSAction* m_internalAction;
|
||||
MxU32 m_unk0x94; // 0x94
|
||||
MxU32 m_bufferOffset; // 0x98
|
||||
MxS32 m_unk0x9c; // 0x9c
|
||||
MxDSBuffer* m_unk0xa0; // 0xa0
|
||||
MxDSBuffer* m_unk0xa4; // 0xa4
|
||||
MxLong m_unk0xa8; // 0xa8
|
||||
undefined2 m_unk0xac; // 0xac
|
||||
MxDSAction* m_internalAction; // 0xb0
|
||||
};
|
||||
|
||||
#endif // MXDSSTREAMINGACTION_H
|
||||
|
|
|
@ -36,6 +36,9 @@ class MxDSSubscriber : public MxCore {
|
|||
MxStreamChunk* FUN_100b8360();
|
||||
void FUN_100b8390(MxStreamChunk* p_chunk);
|
||||
|
||||
inline MxU32 GetObjectId() { return m_objectId; }
|
||||
inline MxS16 GetUnknown48() { return m_unk0x48; }
|
||||
|
||||
private:
|
||||
MxStreamChunkList m_unk0x08; // 0x08
|
||||
MxStreamChunkListCursor* m_unk0x20; // 0x20
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
#include "mxstreamcontroller.h"
|
||||
|
||||
#include "legoomni.h"
|
||||
#include "legoutil.h"
|
||||
#include "mxautolocker.h"
|
||||
#include "mxdsstreamingaction.h"
|
||||
#include "mxnextactiondatastart.h"
|
||||
#include "mxstreamchunk.h"
|
||||
#include "mxtimer.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxStreamController, 0x64)
|
||||
DECOMP_SIZE_ASSERT(MxNextActionDataStart, 0x14)
|
||||
|
@ -138,10 +140,60 @@ MxResult MxStreamController::FUN_100c1800(MxDSAction* p_action, MxU32 p_val)
|
|||
return SUCCESS;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100c1a00
|
||||
MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_bufferval)
|
||||
// FUNCTION: LEGO1 0x100c1a00
|
||||
MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_offset)
|
||||
{
|
||||
if (p_action->GetUnknown24() == -1) {
|
||||
MxS16 newUnknown24 = -1;
|
||||
|
||||
// These loops might be a template function in the list classes
|
||||
for (MxStreamListMxDSAction::iterator it = m_unk0x54.begin(); it != m_unk0x54.end(); it++) {
|
||||
MxDSAction* action = *it;
|
||||
|
||||
if (action->GetObjectId() == p_action->GetObjectId())
|
||||
newUnknown24 = Max(newUnknown24, action->GetUnknown24());
|
||||
}
|
||||
|
||||
if (newUnknown24 == -1) {
|
||||
for (MxStreamListMxDSAction::iterator it = m_unk0x3c.begin(); it != m_unk0x3c.end(); it++) {
|
||||
MxDSAction* action = *it;
|
||||
|
||||
if (action->GetObjectId() == p_action->GetObjectId())
|
||||
newUnknown24 = Max(newUnknown24, action->GetUnknown24());
|
||||
}
|
||||
|
||||
if (newUnknown24 == -1) {
|
||||
for (MxStreamListMxDSSubscriber::iterator it = m_subscriberList.begin(); it != m_subscriberList.end();
|
||||
it++) {
|
||||
MxDSSubscriber* subscriber = *it;
|
||||
|
||||
if (subscriber->GetObjectId() == p_action->GetObjectId())
|
||||
newUnknown24 = Max(newUnknown24, subscriber->GetUnknown48());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p_action->SetUnknown24(newUnknown24 + 1);
|
||||
}
|
||||
else {
|
||||
if (m_unk0x3c.Find(p_action, FALSE))
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
MxDSStreamingAction* streamingAction = new MxDSStreamingAction(*p_action, p_offset);
|
||||
|
||||
if (!streamingAction)
|
||||
return FAILURE;
|
||||
|
||||
MxU32 fileSize = m_provider->GetFileSize();
|
||||
streamingAction->SetBufferOffset(fileSize * (p_offset / fileSize));
|
||||
streamingAction->SetObjectId(p_action->GetObjectId());
|
||||
|
||||
MxLong time = Timer()->GetTime();
|
||||
streamingAction->SetUnknown90(time);
|
||||
|
||||
m_unk0x3c.push_back(streamingAction);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100c1c10
|
||||
|
|
|
@ -46,7 +46,7 @@ class MxStreamController : public MxCore {
|
|||
void FUN_100c15d0(MxDSSubscriber* p_subscriber);
|
||||
void FUN_100c1620(MxDSSubscriber* p_subscriber);
|
||||
MxResult FUN_100c1800(MxDSAction* p_action, MxU32 p_val);
|
||||
MxResult FUN_100c1a00(MxDSAction* p_action, MxU32 p_bufferval);
|
||||
MxResult FUN_100c1a00(MxDSAction* p_action, MxU32 p_offset);
|
||||
MxPresenter* FUN_100c1e70(MxDSAction& p_action);
|
||||
MxResult FUN_100c1f00(MxDSAction* p_action);
|
||||
MxBool FUN_100c20d0(MxDSObject& p_obj);
|
||||
|
|
Loading…
Reference in a new issue