Isle
Loading...
Searching...
No Matches
mxramstreamcontroller.cpp
Go to the documentation of this file.
2
3#include "mxautolock.h"
6
8
9// FUNCTION: LEGO1 0x100c6110
11{
13 if (MxStreamController::Open(p_filename) != SUCCESS) {
14 return FAILURE;
15 }
16
19 if (m_provider->SetResourceToGet(this) != SUCCESS) {
20 return FAILURE;
21 }
22
24 ((MxRAMStreamProvider*) m_provider)->GetBufferOfFileSize(),
25 ((MxRAMStreamProvider*) m_provider)->GetFileSize()
26 );
27 m_buffer.SetBufferPointer(
28 ((MxRAMStreamProvider*) m_provider)->GetBufferOfFileSize(),
29 ((MxRAMStreamProvider*) m_provider)->GetFileSize()
30 );
31 return SUCCESS;
32 }
33
34 return FAILURE;
35}
36
37// FUNCTION: LEGO1 0x100c6210
39{
41 MxS32 unk0x24 = 0;
42 MxResult result = FAILURE;
43
44 if (p_action->GetUnknown24() == -1) {
45 p_action->SetUnknown24(-3);
46 MxDSObject* action = m_unk0x54.Find(p_action);
47 if (action != NULL) {
48 unk0x24 = action->GetUnknown24() + 1;
49 }
50 p_action->SetUnknown24(unk0x24);
51 }
52 else {
53 if (m_unk0x54.Find(p_action)) {
54 return FAILURE;
55 }
56 }
57
58 if (MxStreamController::VTable0x20(p_action) == SUCCESS) {
60 MxDSStreamingAction streamingaction(*action);
61 result = DeserializeObject(streamingaction);
62 }
63 return result;
64}
65
66// FUNCTION: LEGO1 0x100c6320
68{
69 MxDSAction action;
70 do {
71 if (m_action0x60 != NULL) {
72 delete m_action0x60;
74 }
75 action = *p_action;
77 } while (m_action0x60 != NULL);
78 return SUCCESS;
79}
80
81// FUNCTION: LEGO1 0x100c63c0
82MxResult MxRAMStreamController::DeserializeObject(MxDSStreamingAction& p_action)
83{
85 MxResult result;
87
88 do {
89 m_buffer.FUN_100c6f80(p_action.GetUnknown94());
90 // Probably not MxResult, see below
91 result = m_buffer.FUN_100c67b0(this, &p_action, &value);
92 } while (m_unk0x3c.Find(&p_action) != NULL);
93
94 return result == SUCCESS ? SUCCESS : FAILURE;
95}
[AI] Represents an action deserialized from SI chunks, holding key animation or script parameters suc...
Definition: mxdsaction.h:17
MxResult SetBufferPointer(MxU8 *p_buffer, MxU32 p_size)
[AI] Sets a buffer pointer and records its size.
Definition: mxdsbuffer.cpp:89
void FUN_100c6f80(MxU32 p_writeOffset)
[AI] Sets the buffer's internal streaming position to the given write offset.
Definition: mxdsbuffer.cpp:450
MxResult FUN_100c67b0(MxStreamController *p_controller, MxDSAction *p_action, MxDSStreamingAction **p_streamingAction)
[AI] Executes streaming action startup and object creation loop from an initial SI chunk.
Definition: mxdsbuffer.cpp:102
MxDSObject * Find(MxDSObject *p_action)
[AI] Finds a matching object in the list without removing it.
Definition: mxdsobject.h:28
[AI] Base class for any object deserialized from an SI (script/data) file in the LEGO Island engine.
Definition: mxdsobject.h:44
void SetUnknown24(MxS16 p_unk0x24)
[AI] Sets the unknown field at 0x24 (possibly version/state).
Definition: mxdsobject.h:151
MxS16 GetUnknown24()
[AI] Returns the unknown 0x24 value (may be data version or usage state). [AI]
Definition: mxdsobject.h:136
[AI] Represents an action that streams data from a buffer within a DirectScript (DS) media timeline.
MxU32 GetUnknown94()
[AI] Gets the streaming offset or status value at 0x94.
Derived stream controller that manages media streaming from memory buffers as opposed to disk.
MxResult VTable0x20(MxDSAction *p_action) override
Custom stream controller dispatch, likely for initial action activation or stream setup (unknown sema...
MxResult Open(const char *p_filename) override
Opens and prepares a resource from a memory buffer for streaming.
MxResult VTable0x24(MxDSAction *p_action) override
Custom stream controller dispatch, likely for ending, cleanup, or secondary phase action (unknown sem...
[AI] Provides RAM-backed stream data access.
virtual MxResult VTable0x24(MxDSAction *p_action)
[AI] Matches and processes an action in the "unk0x54" (pending) list and triggers sending to subscrib...
MxCriticalSection m_criticalSection
[AI] Protects streaming controller state for thread-safety.
virtual MxResult VTable0x20(MxDSAction *p_action)
[AI] Streams data for the provided action by determining data offset and reading required chunk.
MxDSObjectList m_unk0x3c
[AI] List of actions currently being processed/streamed ("in progress" actions).
MxDSAction * m_action0x60
[AI] Current action pointer used during processing, moved from pending to active as actions are proce...
virtual MxResult Open(const char *p_filename)
[AI] Opens a data stream with the specified resource filename.
MxStreamProvider * m_provider
[AI] Stream provider abstraction, handling resource IO (RAM/disk).
MxDSObjectList m_unk0x54
[AI] List of actions queued and ready to be streamed ("pending" actions).
virtual MxResult SetResourceToGet(MxStreamController *p_pLookup)
[AI] Attaches a stream controller as the resource to provide data for.
#define DECOMP_SIZE_ASSERT(T, S)
Definition: decomp.h:19
#define NULL
[AI] Null pointer value (C/C++ semantics).
Definition: legotypes.h:26
#define FAILURE
[AI] Used to indicate a failed operation in result codes.
Definition: legotypes.h:34
#define SUCCESS
[AI] Used to indicate a successful operation in result codes.
Definition: legotypes.h:30
#define AUTOLOCK(CS)
[AI] Macro for automatic locking using the MxAutoLock class. This macro instantiates an MxAutoLock ob...
Definition: mxautolock.h:5
MxU32 ReadData(MxU8 *p_fileSizeBuffer, MxU32 p_fileSize)
[AI] Rearranges split and unordered chunks within a memory buffer for SI resource files,...
MxLong MxResult
[AI]
Definition: mxtypes.h:106
signed int MxS32
[AI]
Definition: mxtypes.h:38