Isle
Loading...
Searching...
No Matches
mxstreamer.h
Go to the documentation of this file.
1#ifndef MXSTREAMER_H
2#define MXSTREAMER_H
3
4#include "decomp.h"
5#include "mxcore.h"
6#include "mxmemorypool.h"
8#include "mxstl/stlcompat.h"
10#include "mxtypes.h"
11
12#include <assert.h>
13
14class MxDSObject;
15
20
28public:
36 : MxNotificationParam(p_type, p_sender)
37 {
38 m_controller = p_ctrlr;
39 }
40
45 MxNotificationParam* Clone() const override;
46
51 MxStreamController* GetController() { return m_controller; }
52
53private:
54 MxStreamController* m_controller;
55};
56
65class MxStreamer : public MxCore {
66public:
70 enum OpenMode {
73 };
74
78 MxStreamer();
82 ~MxStreamer() override;
83
91 MxStreamController* Open(const char* p_name, MxU16 p_openMode);
92
100 MxLong Close(const char* p_name);
101
108 MxLong Notify(MxParam& p_param) override;
109
113 const char* ClassName() const override
114 {
115 return "MxStreamer";
116 }
117
123 MxBool IsA(const char* p_name) const override
124 {
125 return !strcmp(p_name, MxStreamer::ClassName()) || MxCore::IsA(p_name);
126 }
127
133 virtual MxResult Create();
134
140 MxBool FUN_100b9b30(MxDSObject& p_dsObject);
141
147 MxStreamController* GetOpenStream(const char* p_name);
148
153 void FUN_100b98f0(MxDSAction* p_action);
154
162
169
175 MxResult DeleteObject(MxDSAction* p_dsAction);
176
185 {
186 switch (p_blockSize) {
187 case 0x40:
188 return m_pool64.Get();
189
190 case 0x80:
191 return m_pool128.Get();
192
193 default:
194 assert("Invalid block size for memory pool" == NULL);
195 break;
196 }
197
198 return NULL;
199 }
200
206 void ReleaseMemoryBlock(MxU8* p_block, MxU32 p_blockSize)
207 {
208 switch (p_blockSize) {
209 case 0x40:
210 m_pool64.Release(p_block);
211 break;
212
213 case 0x80:
214 m_pool128.Release(p_block);
215 break;
216
217 default:
218 assert("Invalid block size for memory pool" == NULL);
219 break;
220 }
221 }
222
223private:
224 list<MxStreamController*> m_controllers;
225 MxMemoryPool64 m_pool64;
226 MxMemoryPool128 m_pool128;
227};
228
229#endif // MXSTREAMER_H
[AI] Base virtual class for all Mindscape engine (Mx) objects.
Definition: mxcore.h:15
virtual MxBool IsA(const char *p_name) const
[AI] Checks whether this object's class type or parents match the given name.
Definition: mxcore.h:46
[AI] Represents an action deserialized from SI chunks, holding key animation or script parameters suc...
Definition: mxdsaction.h:17
[AI] Base class for any object deserialized from an SI (script/data) file in the LEGO Island engine.
Definition: mxdsobject.h:44
[AI] Fixed-size memory pool template for fast allocation and deallocation.
Definition: mxmemorypool.h:21
void Release(MxU8 *p_buf)
[AI] Releases the block at the given pointer back into the pool.
Definition: mxmemorypool.h:104
MxU8 * Get()
[AI] Gets a pointer to the next available block in the memory pool.
Definition: mxmemorypool.h:84
[AI] Parameter object representing a single notification or event, carrying an identifier and sender ...
[AI] MxParam serves as a polymorphic base class for parameter passing in event and notification syste...
Definition: mxparam.h:7
[AI] Controller for streaming and managing multimedia resources and actions during gameplay.
Streamer notification param for streaming events in MxStreamer [AI].
Definition: mxstreamer.h:27
MxStreamController * GetController()
[AI] Retrieve the stream controller associated with this notification.
Definition: mxstreamer.h:51
MxStreamerNotification(NotificationId p_type, MxCore *p_sender, MxStreamController *p_ctrlr)
[AI] Create a streamer notification with a controller reference.
Definition: mxstreamer.h:35
MxNotificationParam * Clone() const override
[AI] Clone this notification param.
Definition: mxstreamer.cpp:125
Streams and manages media data, handles memory pools for RAM/disk streaming [AI].
Definition: mxstreamer.h:65
MxStreamController * Open(const char *p_name, MxU16 p_openMode)
Open a stream, returning a controller for further access [AI].
Definition: mxstreamer.cpp:62
void ReleaseMemoryBlock(MxU8 *p_block, MxU32 p_blockSize)
Return a previously-acquired memory block to the pool.
Definition: mxstreamer.h:206
MxResult DeleteObject(MxDSAction *p_dsAction)
Ask all controllers to remove a DS Action's object.
Definition: mxstreamer.cpp:188
MxBool FUN_100b9b30(MxDSObject &p_dsObject)
Check stream state for a dsObject's Atom ID.
Definition: mxstreamer.cpp:215
MxResult AddStreamControllerToOpenList(MxStreamController *p_stream)
Add a controller to the open list, asserting if already present.
Definition: mxstreamer.cpp:154
MxU8 * GetMemoryBlock(MxU32 p_blockSize)
Allocate a temporary memory block from the streamer pool.
Definition: mxstreamer.h:184
MxStreamController * GetOpenStream(const char *p_name)
Search for and return an open stream controller with a matching name.
Definition: mxstreamer.cpp:132
~MxStreamer() override
Destructor—Stops all stream controllers and unregisters from notification manager.
Definition: mxstreamer.cpp:39
MxLong Notify(MxParam &p_param) override
Handle notifications, including deferred controller deletion [AI].
Definition: mxstreamer.cpp:226
MxLong Close(const char *p_name)
Close a named stream and remove its controller from the open list [AI].
Definition: mxstreamer.cpp:98
MxResult FUN_100b99b0(MxDSAction *p_action)
Internal: Calls stream controller's specific command for action execution.
Definition: mxstreamer.cpp:171
const char * ClassName() const override
Return the class name string at runtime.
Definition: mxstreamer.h:113
MxBool IsA(const char *p_name) const override
Query for run-time type information by class name.
Definition: mxstreamer.h:123
MxStreamer()
Construct a streamer and register it for notifications.
Definition: mxstreamer.cpp:21
OpenMode
Available streaming resource loading modes.
Definition: mxstreamer.h:70
@ e_diskStream
Load streaming resource from disk [AI].
Definition: mxstreamer.h:71
@ e_RAMStream
Load streaming resource fully to RAM [AI].
Definition: mxstreamer.h:72
virtual MxResult Create()
Allocate memory pools needed for streaming operation.
Definition: mxstreamer.cpp:28
void FUN_100b98f0(MxDSAction *p_action)
Internal: Delegate stream operation on MxDSAction to a DiskStreamController if present.
Definition: mxstreamer.cpp:144
#define NULL
[AI] Null pointer value (C/C++ semantics).
Definition: legotypes.h:26
NotificationId
Several of those should be defined in LegoOmni.
MxMemoryPool< 128, 2 > MxMemoryPool128
Memory pool for 128-byte blocks, 2 blocks total. [AI].
Definition: mxstreamer.h:19
MxMemoryPool< 64, 22 > MxMemoryPool64
Memory pool for 64-byte blocks, 22 blocks total. [AI].
Definition: mxstreamer.h:17
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
MxLong MxResult
[AI]
Definition: mxtypes.h:106
int MxLong
[AI]
Definition: mxtypes.h:83
unsigned char MxU8
[AI]
Definition: mxtypes.h:8
unsigned short MxU16
[AI]
Definition: mxtypes.h:20
unsigned int MxU32
[AI]
Definition: mxtypes.h:32
[AI] STL compatibility layer header to provide consistent STL (Standard Template Library) types and a...