Isle
Loading...
Searching...
No Matches
mxdsbuffer.cpp
Go to the documentation of this file.
1#include "mxdsbuffer.h"
2
4#include "mxdschunk.h"
6#include "mxmisc.h"
7#include "mxomni.h"
8#include "mxstreamchunk.h"
10#include "mxstreamer.h"
11#include "mxstreamprovider.h"
12
14
15// FUNCTION: LEGO1 0x100c6470
16// FUNCTION: BETA10 0x10156f00
18{
19 m_pBuffer = NULL;
20 m_pIntoBuffer = NULL;
21 m_pIntoBuffer2 = NULL;
22 m_referenceCount = 0;
23 m_unk0x14 = 0;
24 m_unk0x18 = 0;
25 m_unk0x1c = 0;
26 m_writeOffset = 0;
27 m_bytesRemaining = 0;
28 m_mode = e_preallocated;
29 m_unk0x30 = 0;
30}
31
32// FUNCTION: LEGO1 0x100c6530
33// FUNCTION: BETA10 0x10156ff7
35{
36 assert(m_referenceCount == 0);
37
38 if (m_pBuffer != NULL) {
39 switch (m_mode) {
40 case e_allocate:
41 case e_unknown:
42 delete[] m_pBuffer;
43 break;
44
45 case e_chunk:
46 Streamer()->ReleaseMemoryBlock(m_pBuffer, m_writeOffset / 1024);
47 break;
48
49 case e_preallocated:
50 break;
51 }
52 }
53
54 m_unk0x14 = 0;
55 m_unk0x1c = 0;
56}
57
58// FUNCTION: LEGO1 0x100c6640
59// FUNCTION: BETA10 0x10157146
61{
62 MxResult result = FAILURE;
63
64 switch (p_mode) {
65 case e_allocate:
66 m_pBuffer = new MxU8[p_bufferSize];
67 assert(m_pBuffer); // m_firstRiffChunk?
68 break;
69
70 case e_chunk:
71 m_pBuffer = Streamer()->GetMemoryBlock(p_bufferSize / 1024);
72 break;
73 }
74
75 m_pIntoBuffer = m_pBuffer;
76 m_pIntoBuffer2 = m_pBuffer;
77
78 if (m_pBuffer != NULL) {
79 m_bytesRemaining = p_bufferSize;
80 m_writeOffset = m_bytesRemaining;
81 m_mode = p_mode;
82 result = SUCCESS;
83 }
84
85 return result;
86}
87
88// FUNCTION: LEGO1 0x100c6780
90{
91 m_pBuffer = p_buffer;
92 m_pIntoBuffer = p_buffer;
93 m_pIntoBuffer2 = p_buffer;
94 m_bytesRemaining = p_size;
95 m_writeOffset = p_size;
96 m_mode = e_preallocated;
97 return SUCCESS;
98}
99
100// FUNCTION: LEGO1 0x100c67b0
101// FUNCTION: BETA10 0x10157295
103 MxStreamController* p_controller,
104 MxDSAction* p_action,
105 MxDSStreamingAction** p_streamingAction
106)
107{
108 MxResult result = FAILURE;
109 MxU8* data = m_pBuffer;
110
111 m_unk0x30 = (MxDSStreamingAction*) p_controller->GetUnk0x3c().Find(p_action);
112 if (m_unk0x30 == NULL) {
113 return FAILURE;
114 }
115
116 while ((data = (MxU8*) SkipToData())) {
117 if (*p_streamingAction != NULL) {
118 MxDSBuffer* buffer = (*p_streamingAction)->GetUnknowna0();
119
120 if (buffer->CalcBytesRemaining(data)) {
121 goto done;
122 }
123
124 if (buffer->GetBytesRemaining() == 0) {
125 buffer->m_unk0x30 = m_unk0x30;
126
127 result = buffer->CreateObject(p_controller, (MxU32*) buffer->GetBuffer(), p_action, p_streamingAction);
128 if (result == SUCCESS) {
129 if (buffer->HasRef()) {
130 // Note: *p_streamingAction is always null in MxRamStreamProvider
131 ((MxDiskStreamController*) p_controller)->InsertToList74(buffer);
132 (*p_streamingAction)->ClearUnknowna0();
133 }
134
135 ((MxDiskStreamController*) p_controller)->FUN_100c7cb0(*p_streamingAction);
136 *p_streamingAction = NULL;
137 }
138 else {
139 goto done;
140 }
141 }
142 }
143 else {
144 result = CreateObject(p_controller, (MxU32*) data, p_action, p_streamingAction);
145
146 if (result == FAILURE) {
147 goto done;
148 }
149 else if (result == 1) {
150 // TODO: Not a MxResult value?
151 break;
152 }
153 }
154 }
155
156 result = SUCCESS;
157done:
158 return result;
159}
160
161// FUNCTION: LEGO1 0x100c68a0
162// FUNCTION: BETA10 0x10157450
164 MxStreamController* p_controller,
165 MxU32* p_data,
166 MxDSAction* p_action,
167 MxDSStreamingAction** p_streamingAction
168)
169{
170 if (p_data == NULL) {
171 return FAILURE;
172 }
173
174 MxCore* header = ReadChunk(this, p_data, p_action->GetUnknown24());
175
176 if (header == NULL) {
177 return FAILURE;
178 }
179
180 if (*p_data == FOURCC('M', 'x', 'O', 'b')) {
181 MxDSAction* action = (MxDSAction*) header;
182 return StartPresenterFromAction(p_controller, p_action, action);
183 }
184 else if (*p_data == FOURCC('M', 'x', 'C', 'h')) {
185 MxStreamChunk* chunk = (MxStreamChunk*) header;
186 if (!m_unk0x30->HasId((chunk)->GetObjectId())) {
187 delete header;
188 return SUCCESS;
189 }
190
191 return ParseChunk(p_controller, p_data, p_action, p_streamingAction, chunk);
192 }
193 else {
194 delete header;
195 }
196
197 return FAILURE;
198}
199
200// FUNCTION: LEGO1 0x100c6960
202 MxStreamController* p_controller,
203 MxDSAction* p_action1,
204 MxDSAction* p_objectheader
205)
206{
207 if (!m_unk0x30->GetInternalAction()) {
208 p_objectheader->SetAtomId(p_action1->GetAtomId());
209 p_objectheader->SetUnknown28(p_action1->GetUnknown28());
210 p_objectheader->SetUnknown84(p_action1->GetUnknown84());
211 p_objectheader->SetOrigin(p_action1->GetOrigin());
212 p_objectheader->SetUnknown90(p_action1->GetUnknown90());
213 p_objectheader->MergeFrom(*p_action1);
214
215 m_unk0x30->SetInternalAction(p_objectheader->Clone());
216
217 p_controller->InsertActionToList54(p_objectheader);
218
219 if (MxOmni::GetInstance()->CreatePresenter(p_controller, *p_objectheader) != SUCCESS) {
220 return FAILURE;
221 }
222
223 m_unk0x30->SetLoopCount(p_objectheader->GetLoopCount());
224 m_unk0x30->SetFlags(p_objectheader->GetFlags());
225 m_unk0x30->SetDuration(p_objectheader->GetDuration());
226
227 if (m_unk0x30->GetInternalAction() == NULL) {
228 return FAILURE;
229 }
230 }
231 else if (p_objectheader) {
232 delete p_objectheader;
233 }
234
235 return SUCCESS;
236}
237
238// FUNCTION: LEGO1 0x100c6a50
239// FUNCTION: BETA10 0x10157795
241 MxStreamController* p_controller,
242 MxU32* p_data,
243 MxDSAction* p_action,
244 MxDSStreamingAction** p_streamingAction,
245 MxStreamChunk* p_header
246)
247{
248 MxResult result = SUCCESS;
249
250 if (m_unk0x30->GetFlags() & MxDSAction::c_bit3 && m_unk0x30->GetUnknowna8() && p_header->GetTime() < 0) {
251 delete p_header;
252 return SUCCESS;
253 }
254
255 p_header->SetTime(p_header->GetTime() + m_unk0x30->GetUnknowna8());
256
257 if (p_header->GetChunkFlags() & DS_CHUNK_SPLIT) {
258 MxU32 length = p_header->GetLength() + MxDSChunk::GetHeaderSize() + 8;
259 MxDSBuffer* buffer = new MxDSBuffer();
260
261 if (!buffer || buffer->AllocateBuffer(length, e_allocate) != SUCCESS ||
262 buffer->CalcBytesRemaining((MxU8*) p_data) != SUCCESS ||
263 (*p_streamingAction = new MxDSStreamingAction((MxDSStreamingAction&) *p_action)) == NULL) {
264 delete buffer;
265 delete p_header;
266 return FAILURE;
267 }
268
269 MxU16* flags = MxStreamChunk::IntoFlags(buffer->GetBuffer());
270 *flags = p_header->GetChunkFlags() & ~DS_CHUNK_SPLIT;
271
272 delete p_header;
273 (*p_streamingAction)->SetUnknowna0(buffer);
274 }
275 else {
276 if (p_header->GetChunkFlags() & DS_CHUNK_END_OF_STREAM) {
277 if (m_unk0x30->HasId(p_header->GetObjectId())) {
278 if (m_unk0x30->GetFlags() & MxDSAction::c_bit3 &&
279 (m_unk0x30->GetLoopCount() > 1 || m_unk0x30->GetDuration() == -1)) {
280
281 if (p_action->GetObjectId() == p_header->GetObjectId()) {
282 MxU32 val = p_controller->GetProvider()->GetBufferForDWords()[m_unk0x30->GetObjectId()];
283
284 m_unk0x30->SetUnknown94(val);
285 m_unk0x30->SetBufferOffset(m_writeOffset * (val / m_writeOffset));
286
288 p_controller->FindNextActionDataStartFromStreamingAction(m_unk0x30);
289
290 if (data) {
291 data->SetData(m_unk0x30->GetBufferOffset());
292 }
293
294 m_unk0x30->FUN_100cd2d0();
295 }
296
297 delete p_header;
298 p_header = NULL;
299 }
300 else {
301 if (p_action->GetObjectId() == p_header->GetObjectId() &&
302 p_controller->VTable0x30(p_action) == SUCCESS) {
303 p_controller->GetProvider()->VTable0x20(p_action);
304 result = 1;
305 }
306 }
307 }
308 }
309
310 if (p_header) {
311 if (p_header->SendChunk(p_controller->GetSubscriberList(), TRUE, p_action->GetUnknown24()) != SUCCESS) {
312 delete p_header;
313 }
314 }
315 }
316
317 return result;
318}
319
320// FUNCTION: LEGO1 0x100c6d00
321// FUNCTION: BETA10 0x10157c94
322MxCore* MxDSBuffer::ReadChunk(MxDSBuffer* p_buffer, MxU32* p_chunkData, MxU16 p_flags)
323{
324 // This function reads a chunk. If it is an object, this function returns an MxDSObject. If it is a chunk,
325 // returns a MxDSChunk.
326 MxCore* result = NULL;
327 MxU8* dataStart = (MxU8*) p_chunkData + 8;
328
329 switch (*p_chunkData) {
330 case FOURCC('M', 'x', 'O', 'b'): {
331 MxDSObject* obj = DeserializeDSObjectDispatch(dataStart, p_flags);
332 result = obj;
333 break;
334 }
335 case FOURCC('M', 'x', 'C', 'h'): {
336 MxStreamChunk* chunk = new MxStreamChunk();
337 if (chunk && chunk->ReadChunk(p_buffer, (MxU8*) p_chunkData) != SUCCESS) {
338 delete chunk;
339 chunk = NULL;
340 }
341
342 result = chunk;
343 break;
344 }
345 }
346
347 return result;
348}
349
350// FUNCTION: LEGO1 0x100c6df0
351// FUNCTION: BETA10 0x10157e0a
353{
354 MxU8* result = NULL;
355
356 if (m_pIntoBuffer != NULL) {
357 while (TRUE) {
358 switch (*(MxU32*) m_pIntoBuffer) {
359 case FOURCC('M', 'x', 'O', 'b'):
360 case FOURCC('M', 'x', 'C', 'h'):
361 result = m_pIntoBuffer;
362 m_pIntoBuffer += (*(MxU32*) (m_pIntoBuffer + 4) & 1) + *(MxU32*) (m_pIntoBuffer + 4);
363 m_pIntoBuffer += 8;
364
365 if (m_pBuffer + m_writeOffset - 8 < m_pIntoBuffer) {
366 m_pIntoBuffer = NULL;
367 }
368
369 goto done;
370 case FOURCC('M', 'x', 'D', 'a'):
371 case FOURCC('M', 'x', 'S', 't'):
372 m_pIntoBuffer += 8;
373 break;
374 case FOURCC('M', 'x', 'H', 'd'):
375 m_pIntoBuffer += *(MxU32*) (m_pIntoBuffer + 4) + 8;
376 break;
377 case FOURCC('L', 'I', 'S', 'T'):
378 case FOURCC('R', 'I', 'F', 'F'):
379 m_pIntoBuffer += 12;
380 break;
381 default:
382 m_pIntoBuffer = NULL;
383 result = NULL;
384 goto done;
385 }
386
387 if (m_pIntoBuffer > m_pBuffer + m_writeOffset - 8) {
388 m_pIntoBuffer = NULL;
389 goto done;
390 }
391 }
392 }
393done:
394 m_pIntoBuffer2 = result;
395 return result;
396}
397
398// FUNCTION: LEGO1 0x100c6ec0
400{
401 if (m_referenceCount != 0) {
402 m_referenceCount--;
403 }
404 return 0;
405}
406
407// FUNCTION: LEGO1 0x100c6ee0
409{
410 if (p_chunk) {
411 m_referenceCount++;
412 }
413}
414
415// FUNCTION: LEGO1 0x100c6ef0
416// FUNCTION: BETA10 0x101580ad
418{
419 MxResult result = FAILURE;
420
421 if (m_mode == e_allocate && m_bytesRemaining != 0) {
422 MxU32 bytesRead;
423 MxU8* ptr;
424
425 if (m_writeOffset == m_bytesRemaining) {
426 ptr = p_data;
427 bytesRead = *(MxU32*) (p_data + 4) + 8;
428 }
429 else {
430 ptr = p_data + MxStreamChunk::GetHeaderSize() + 8;
431 bytesRead = (*(MxU32*) (p_data + 4)) - MxStreamChunk::GetHeaderSize();
432 }
433
434 if (bytesRead <= m_bytesRemaining) {
435 memcpy(m_pBuffer + m_writeOffset - m_bytesRemaining, ptr, bytesRead);
436
437 if (m_writeOffset == m_bytesRemaining) {
438 *(MxU32*) (m_pBuffer + 4) = *MxStreamChunk::IntoLength(m_pBuffer) + MxStreamChunk::GetHeaderSize();
439 }
440
441 m_bytesRemaining -= bytesRead;
442 result = SUCCESS;
443 }
444 }
445
446 return result;
447}
448
449// FUNCTION: LEGO1 0x100c6f80
451{
452 if (p_writeOffset < m_writeOffset) {
453 m_pIntoBuffer2 = m_pBuffer + p_writeOffset;
454 m_pIntoBuffer = m_pBuffer + p_writeOffset;
455 }
456}
457
458// FUNCTION: LEGO1 0x100c6fa0
460{
461 MxU8* current = p_data ? p_data : m_pBuffer;
462 MxU8* end = m_writeOffset + m_pBuffer - 8;
463
464 while (current <= end) {
465 switch (*((MxU32*) current)) {
466 case FOURCC('L', 'I', 'S', 'T'):
467 case FOURCC('R', 'I', 'F', 'F'):
468 current += 12;
469 break;
470 case FOURCC('M', 'x', 'D', 'a'):
471 case FOURCC('M', 'x', 'S', 't'):
472 current += 8;
473 break;
474 case FOURCC('M', 'x', 'O', 'b'):
475 case FOURCC('M', 'x', 'C', 'h'):
476 if (current != p_data) {
477 return current;
478 }
479 current = ((MxU32) current & 1) + current;
480 current += 8;
481 break;
482 case FOURCC('M', 'x', 'H', 'd'):
483 current += (((MxU32*) current)[1] + 8);
484 break;
485 default:
486 return NULL;
487 }
488 }
489
490 return NULL;
491}
492
493// FUNCTION: LEGO1 0x100c7090
494// FUNCTION: BETA10 0x1015842d
496{
497 MxResult result = FAILURE;
498
499 if (m_writeOffset >= p_buf->m_writeOffset) {
500 memcpy(m_pBuffer, p_buf->m_pBuffer, p_buf->m_writeOffset);
501 result = SUCCESS;
502 }
503
504 m_unk0x1c = p_buf->m_unk0x1c;
505 return result;
506}
507
508// FUNCTION: LEGO1 0x100c70d0
509MxResult MxDSBuffer::Append(MxU8* p_buffer1, MxU8* p_buffer2)
510{
511 if (p_buffer1 && p_buffer2) {
512 MxU32 size = ((MxU32*) p_buffer2)[1] - MxDSChunk::GetHeaderSize();
513 memcpy(p_buffer1 + ((MxU32*) p_buffer1)[1] + 8, p_buffer2 + MxDSChunk::GetHeaderSize() + 8, size);
514 ((MxU32*) p_buffer1)[1] += size;
515 return SUCCESS;
516 }
517 return FAILURE;
518}
[AI] Base virtual class for all Mindscape engine (Mx) objects.
Definition: mxcore.h:15
[AI] Represents an action deserialized from SI chunks, holding key animation or script parameters suc...
Definition: mxdsaction.h:17
MxU32 GetFlags()
[AI] Returns the flag field for this action (bitmask).
Definition: mxdsaction.h:177
virtual void SetDuration(MxLong p_duration)
[AI] Sets the duration of this action in ticks or time units.
Definition: mxdsaction.cpp:46
MxCore * GetUnknown84()
[AI] Returns a pointer to an associated or auxiliary core object.
Definition: mxdsaction.h:248
MxS32 GetLoopCount()
[AI] Returns the loop count for this action.
Definition: mxdsaction.h:203
virtual void SetUnknown90(MxLong p_unk0x90)
[AI] Set unknown value at offset 0x90, used as baseline in GetElapsedTime.
Definition: mxdsaction.cpp:60
virtual MxLong GetUnknown90()
[AI] Gets the unknown value at offset 0x90, likely a start timestamp.
Definition: mxdsaction.cpp:67
void SetOrigin(MxCore *p_origin)
[AI] Sets the origin core pointer for this action, if spatially transforming/localizing this action.
Definition: mxdsaction.h:265
void SetFlags(MxU32 p_flags)
[AI] Sets the flag bitmask controlling action logic (enabled, looping, etc).
Definition: mxdsaction.h:183
virtual MxLong GetDuration()
[AI] Gets the duration for which this action is intended to run.
Definition: mxdsaction.cpp:39
void SetUnknown84(MxCore *p_unk0x84)
[AI] Sets the auxiliary core pointer for this action.
Definition: mxdsaction.h:254
void SetLoopCount(MxS32 p_loopCount)
[AI] Sets the loop count for this action.
Definition: mxdsaction.h:209
virtual MxDSAction * Clone()
[AI] Clones (deep-copies) this action and returns a new pointer.
Definition: mxdsaction.cpp:146
virtual void MergeFrom(MxDSAction &p_dsAction)
[AI] Copies/merges properties from another action.
Definition: mxdsaction.cpp:166
MxCore * GetOrigin()
[AI] Returns a pointer to the "origin" core object, which may be used to localize the action.
Definition: mxdsaction.h:259
@ c_bit3
[AI] Unknown - possibly reserved [AI]
Definition: mxdsaction.h:22
[AI] Buffer for managing streamed DS (Data Stream) chunks and actions.
Definition: mxdsbuffer.h:50
MxU8 * SkipToData()
[AI] Scans this buffer forward to the next valid object or chunk and returns a pointer to its start.
Definition: mxdsbuffer.cpp:352
MxResult FUN_100c7090(MxDSBuffer *p_buf)
[AI] Copies buffer data and selected internal state from another buffer, if space allows.
Definition: mxdsbuffer.cpp:495
MxResult SetBufferPointer(MxU8 *p_buffer, MxU32 p_size)
[AI] Sets a buffer pointer and records its size.
Definition: mxdsbuffer.cpp:89
MxResult CalcBytesRemaining(MxU8 *p_data)
[AI] Calculates pending bytes remaining to be streamed, updates buffer state accordingly.
Definition: mxdsbuffer.cpp:417
MxU8 * GetBuffer()
[AI] Returns a pointer to the managed chunk data buffer.
void AddRef(MxDSChunk *p_chunk)
[AI] Increment reference count for this buffer (ownership by a chunk).
Definition: mxdsbuffer.cpp:408
MxU8 ReleaseRef(MxDSChunk *)
[AI] Decrement the buffer's chunk reference count.
Definition: mxdsbuffer.cpp:399
MxResult StartPresenterFromAction(MxStreamController *p_controller, MxDSAction *p_action1, MxDSAction *p_action2)
[AI] Launches a presenter for the given action if not already present.
Definition: mxdsbuffer.cpp:201
MxResult CreateObject(MxStreamController *p_controller, MxU32 *p_data, MxDSAction *p_action, MxDSStreamingAction **p_streamingAction)
[AI] Creates a presenter/action object by deserializing a data block.
Definition: mxdsbuffer.cpp:163
~MxDSBuffer() override
[AI] Destructor: Releases memory appropriately based on buffer management mode and asserts no referen...
Definition: mxdsbuffer.cpp:34
MxDSBuffer()
[AI] Constructs a buffer object and initializes all internal pointers and counters.
Definition: mxdsbuffer.cpp:17
MxU8 * FUN_100c6fa0(MxU8 *p_data)
[AI] Finds the next chunk boundary in the buffer, starting from an optional pointer.
Definition: mxdsbuffer.cpp:459
MxResult AllocateBuffer(MxU32 p_bufferSize, Type p_mode)
[AI] Allocates a buffer of a given size and memory mode.
Definition: mxdsbuffer.cpp:60
MxResult ParseChunk(MxStreamController *p_controller, MxU32 *p_data, MxDSAction *p_action, MxDSStreamingAction **p_streamingAction, MxStreamChunk *p_header)
[AI] Parses an MxStreamChunk for logical streaming actions, nested chunks, EoS, and splitting.
Definition: mxdsbuffer.cpp:240
void FUN_100c6f80(MxU32 p_writeOffset)
[AI] Sets the buffer's internal streaming position to the given write offset.
Definition: mxdsbuffer.cpp:450
static MxResult Append(MxU8 *p_buffer1, MxU8 *p_buffer2)
[AI] Appends one chunk/data stream buffer to another, adjusting sizes/headers.
Definition: mxdsbuffer.cpp:509
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
MxU32 GetBytesRemaining()
[AI] Returns the number of bytes remaining to stream in this buffer.
static MxCore * ReadChunk(MxDSBuffer *p_buffer, MxU32 *p_chunkData, MxU16 p_flags)
[AI] Reads an SI file object/chunk at given position in a buffer.
Definition: mxdsbuffer.cpp:322
Type
[AI] Buffer memory management type.
Definition: mxdsbuffer.h:55
@ e_preallocated
[AI] Preallocated memory passed in from outside.
Definition: mxdsbuffer.h:58
@ e_allocate
[AI] Newly allocated memory with new[].
Definition: mxdsbuffer.h:57
@ e_chunk
[AI] Chunk-managed memory (from Streamer pool).
Definition: mxdsbuffer.h:56
@ e_unknown
[AI] Unknown/other (may be unused or special).
Definition: mxdsbuffer.h:59
MxBool HasRef()
[AI] Checks whether there are any active references to this buffer.
[AI] Represents a chunk of data extracted from a stream (typically from a Mindscape/Mx SI file or str...
Definition: mxdschunk.h:38
static MxU32 GetHeaderSize()
[AI] Returns the fixed size of the chunk header, typically used for parsing binary streams.
Definition: mxdschunk.cpp:27
undefined4 GetObjectId()
[AI] Returns the object id of this chunk. [AI]
Definition: mxdschunk.h:99
MxU32 GetLength()
[AI] Returns the length in bytes of the data payload. [AI]
Definition: mxdschunk.h:105
MxLong GetTime()
[AI] Returns the time (timestamp or tick) associated with this chunk. [AI]
Definition: mxdschunk.h:102
MxU16 GetChunkFlags()
[AI] Returns the chunk's flag bitfield. [AI]
Definition: mxdschunk.h:96
void SetTime(MxLong p_time)
[AI] Sets the time (timestamp/tick/frame) associated with this chunk.
Definition: mxdschunk.h:85
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
const MxAtomId & GetAtomId()
[AI] Returns a const-reference to the object's atom identifier.
Definition: mxdsobject.h:133
void SetUnknown28(MxPresenter *p_unk0x28)
[AI] Sets the pointer at 0x28 (presenter or handler).
Definition: mxdsobject.h:155
virtual void SetAtomId(MxAtomId p_atomId)
[AI] Sets the atom id for this object instance, used for indexing or lookup.
Definition: mxdsobject.h:118
MxPresenter * GetUnknown28()
[AI] Returns the pointer stored at 0x28, likely a presenter or handler for this DS object.
Definition: mxdsobject.h:139
MxS16 GetUnknown24()
[AI] Returns the unknown 0x24 value (may be data version or usage state). [AI]
Definition: mxdsobject.h:136
MxU32 GetObjectId()
[AI] Returns the object id numeric value.
Definition: mxdsobject.h:130
[AI] Represents an action that streams data from a buffer within a DirectScript (DS) media timeline.
void SetBufferOffset(MxU32 p_bufferOffset)
[AI] Sets the current buffer read offset.
void FUN_100cd2d0()
[AI] Updates duration, loop count, and accumulates advanced streaming time for repeated playback.
MxBool HasId(MxU32 p_objectId) override
[AI] Determines if this action or its internal action correspond to the given object ID.
MxDSAction * GetInternalAction()
[AI] Returns the internal sub-action representing the actual user-level action being streamed.
void SetInternalAction(MxDSAction *p_dsAction)
[AI] Sets or replaces the internal action held by this streaming action (ownership is transferred).
MxLong GetUnknowna8()
[AI] Accumulated streaming duration, used for repeat or seek calculations.
void SetUnknown94(MxU32 p_unk0x94)
[AI] Sets the streaming offset/status at 0x94.
MxU32 GetBufferOffset()
[AI] Gets the buffer offset where streaming is currently positioned.
[AI] Controller for streaming from disk-based SI resources, manages buffers and streaming actions.
[AI] Contains data for scheduling the next action in a process, storing an object id,...
void SetData(MxU32 p_data)
[AI] Sets the data value for this action instance.
static MxOmni * GetInstance()
[AI] Returns the singleton instance of the MxOmni subsystem coordinator.
Definition: mxomni.cpp:289
[AI] Represents a streamable chunk of data, typically sourced from a media buffer and designed for no...
Definition: mxstreamchunk.h:19
static MxU32 * IntoLength(MxU8 *p_buffer)
[AI] Utility to cast a chunk header buffer into the data length field pointer, facilitating direct pa...
MxResult ReadChunk(MxDSBuffer *p_buffer, MxU8 *p_chunkData)
[AI] Reads the chunk's header and initializes from a chunk data buffer of a streamed data segment.
MxResult SendChunk(MxDSSubscriberList &p_subscriberList, MxBool p_append, MxS16 p_obj24val)
[AI] Dispatches this stream chunk to a list of subscribers matching certain criteria.
static MxU16 * IntoFlags(MxU8 *p_buffer)
[AI] Utility to cast a chunk header buffer into the flags field pointer, facilitating direct parsing.
[AI] Controller for streaming and managing multimedia resources and actions during gameplay.
MxStreamProvider * GetProvider()
[AI] Retrieves the current stream provider abstraction used to access file/memory resources.
MxNextActionDataStart * FindNextActionDataStartFromStreamingAction(MxDSStreamingAction *p_action)
[AI] Finds the corresponding next action data start (offset info) for a streaming action.
MxDSSubscriberList & GetSubscriberList()
[AI] Returns the list of current stream subscribers.
MxDSObjectList & GetUnk0x3c()
[AI] Returns the list of actions currently being streamed ("in progress" list).
virtual MxResult VTable0x30(MxDSAction *p_action)
[AI] Removes a completed action from in-progress ("unk0x3c") list and deletes its data block.
MxResult InsertActionToList54(MxDSAction *p_action)
[AI] Inserts a clone of the provided action into the pending ("unk0x54") list.
virtual void VTable0x20(MxDSAction *p_action)
[AI] Virtual hook for subclasses to react to new stream actions being queued.
virtual MxU32 * GetBufferForDWords()=0
[AI] Returns a pointer to the underlying buffer, cast as an array of DWORDs, for streaming purposes.
void ReleaseMemoryBlock(MxU8 *p_block, MxU32 p_blockSize)
Return a previously-acquired memory block to the pool.
Definition: mxstreamer.h:206
MxU8 * GetMemoryBlock(MxU32 p_blockSize)
Allocate a temporary memory block from the streamer pool.
Definition: mxstreamer.h:184
#define TRUE
Definition: d3drmdef.h:28
#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 DS_CHUNK_END_OF_STREAM
[AI] Flag bit indicating this chunk is the last in its stream.
Definition: mxdschunk.h:14
#define DS_CHUNK_SPLIT
[AI] Flag indicating this chunk is split (i.e., fragmented and needs reassembling).
Definition: mxdschunk.h:22
MxDSObject * DeserializeDSObjectDispatch(MxU8 *&, MxS16)
[AI] Reads and deserializes a DS object of the specific type from an SI buffer.
Definition: mxdsobject.cpp:210
MxStreamer * Streamer()
[AI] Returns the global streamer used for all chunked media streaming (SI file, audio,...
Definition: mxmisc.cpp:49
MxLong MxResult
[AI]
Definition: mxtypes.h:106
#define FOURCC(a, b, c, d)
[AI] Macro to compose a 32-bit code from four 8-bit characters (e.g., for resource and chunk IDs).
Definition: mxtypes.h:162
unsigned char MxU8
[AI]
Definition: mxtypes.h:8
unsigned short MxU16
[AI]
Definition: mxtypes.h:20
unsigned int MxU32
[AI]
Definition: mxtypes.h:32