Isle
Loading...
Searching...
No Matches
MxDiskStreamProvider Class Reference

[AI] Disk-based stream provider for resource loading using background streaming and multithreading. More...

#include <mxdiskstreamprovider.h>

Inheritance diagram for MxDiskStreamProvider:
Collaboration diagram for MxDiskStreamProvider:

Public Member Functions

 MxDiskStreamProvider ()
 [AI] Constructs a disk stream provider, initializing critical members and preparing for disk-based streaming. More...
 
 ~MxDiskStreamProvider () override
 [AI] Cleans up the disk stream provider, including terminating the worker thread and releasing file and action resources. More...
 
const char * ClassName () const override
 [AI] Returns the runtime class name. More...
 
MxBool IsA (const char *p_name) const override
 [AI] Tests if the object is of, or derives from, the supplied class name. More...
 
MxResult WaitForWorkToComplete ()
 [AI] Blocks until all scheduled streaming work is finished (used by the streaming worker thread). More...
 
MxResult FUN_100d1780 (MxDSStreamingAction *p_action)
 [AI] Schedules a streaming action to read data (SI chunk) from disk and buffers it asynchronously. More...
 
void PerformWork ()
 [AI] Performs a single unit of scheduled streaming work, i.e., loading data for queued actions. More...
 
MxResult FUN_100d1b20 (MxDSStreamingAction *p_action)
 [AI] Finalizes merging of streaming buffers and updates streamed data for a given action. More...
 
MxResult SetResourceToGet (MxStreamController *p_resource) override
 [AI] Opens and prepares a resource for streaming from disk based on the controller's atom (resource key). More...
 
MxU32 GetFileSize () override
 [AI] Gets the size, in bytes, of the open file/buffer to be streamed. More...
 
MxS32 GetStreamBuffersNum () override
 [AI] Gets the number of stream buffers/splits for the file, used to drive parallel reads. More...
 
void VTable0x20 (MxDSAction *p_action) override
 [AI] Cancels or reclaims outstanding streaming actions based on object ID, returning associated actions to free buffer. More...
 
MxU32 GetLengthInDWords () override
 [AI] Returns file length as dword-count for bulk/integer-based streaming use cases. More...
 
MxU32GetBufferForDWords () override
 [AI] Returns a pointer to the buffer for raw dword access (SI file data block). More...
 
- Public Member Functions inherited from MxStreamProvider
 MxStreamProvider ()
 [AI] Default constructor. Initializes stream provider with no lookup or file resource attached. [AI] More...
 
const char * ClassName () const override
 [AI] Returns the name identifier for this class. More...
 
MxBool IsA (const char *p_name) const override
 [AI] Checks if this object is of the requested class name, or a subclass thereof. More...
 
virtual MxResult SetResourceToGet (MxStreamController *p_pLookup)
 [AI] Attaches a stream controller as the resource to provide data for. More...
 
virtual MxU32 GetFileSize ()=0
 [AI] Gets the file size, in bytes, of the underlying SI file resource. More...
 
virtual MxS32 GetStreamBuffersNum ()=0
 [AI] Returns the number of stream buffers internally maintained for this resource. More...
 
virtual void VTable0x20 (MxDSAction *p_action)
 [AI] Virtual hook for subclasses to react to new stream actions being queued. More...
 
virtual MxU32 GetLengthInDWords ()=0
 [AI] Gets the full buffer length, interpreted as a DWORD-count, for direct buffer streaming. More...
 
virtual MxU32GetBufferForDWords ()=0
 [AI] Returns a pointer to the underlying buffer, cast as an array of DWORDs, for streaming purposes. More...
 
- Public Member Functions inherited from MxCore
 MxCore ()
 [AI] Constructs a new MxCore object and assigns it a unique id. More...
 
virtual ~MxCore ()
 [AI] Virtual destructor. Required for correct polymorphic cleanup in derived classes. More...
 
virtual MxLong Notify (MxParam &p_param)
 [AI] Virtual callback notification mechanism. More...
 
virtual MxResult Tickle ()
 [AI] Called by tickle managers to allow the object to update itself. More...
 
virtual const char * ClassName () const
 [AI] Returns the runtime class name of this object. More...
 
virtual MxBool IsA (const char *p_name) const
 [AI] Checks whether this object's class type or parents match the given name. More...
 
MxU32 GetId ()
 [AI] Gets the unique (per-process) id assigned to this object instance. More...
 

Static Public Member Functions

static MxBool FUN_100d1af0 (MxDSStreamingAction *p_action)
 [AI] Returns whether a streaming action can be processed (buffer conditions met). More...
 

Protected Attributes

MxDiskStreamProviderThread m_thread
 [AI] Thread object handling streaming actions asynchronously. More...
 
MxSemaphore m_busySemaphore
 [AI] Semaphore used to synchronize and signal work for the background thread. More...
 
MxBool m_remainingWork
 [AI] Indicates whether more streaming work remains for the thread. More...
 
MxBool m_unk0x35
 [AI] Internal flag signaling available work for the thread or shutdown in progress. More...
 
MxCriticalSection m_criticalSection
 [AI] Synchronizes access to the work item queue (m_list). More...
 
MxDSObjectList m_list
 [AI] List of streaming actions to be processed/completed by the thread. More...
 
- Protected Attributes inherited from MxStreamProvider
MxStreamControllerm_pLookup
 [AI] The stream controller using this provider as its data source. [AI] More...
 
MxDSFilem_pFile
 [AI] Pointer to the loaded SI file associated with this provider. [AI] More...
 

Detailed Description

[AI] Disk-based stream provider for resource loading using background streaming and multithreading.

[AI] Handles asynchronous loading and management of resources from disk by employing internal buffering, file/stream semantics, synchronization, and thread-based execution. Supports the LEGO SI file streaming system. SIZE: 0x60 [AI]

Definition at line 58 of file mxdiskstreamprovider.h.

Constructor & Destructor Documentation

◆ MxDiskStreamProvider()

MxDiskStreamProvider::MxDiskStreamProvider ( )

[AI] Constructs a disk stream provider, initializing critical members and preparing for disk-based streaming.

Definition at line 39 of file mxdiskstreamprovider.cpp.

◆ ~MxDiskStreamProvider()

MxDiskStreamProvider::~MxDiskStreamProvider ( )
override

[AI] Cleans up the disk stream provider, including terminating the worker thread and releasing file and action resources.

Definition at line 47 of file mxdiskstreamprovider.cpp.

Member Function Documentation

◆ ClassName()

const char * MxDiskStreamProvider::ClassName ( ) const
overridevirtual

[AI] Returns the runtime class name.

Returns
"MxDiskStreamProvider" [AI]

Reimplemented from MxCore.

◆ FUN_100d1780()

MxResult MxDiskStreamProvider::FUN_100d1780 ( MxDSStreamingAction p_action)

[AI] Schedules a streaming action to read data (SI chunk) from disk and buffers it asynchronously.

Parameters
p_actionThe streaming action to schedule. [AI]
Returns
[AI]

Definition at line 177 of file mxdiskstreamprovider.cpp.

◆ FUN_100d1af0()

MxBool MxDiskStreamProvider::FUN_100d1af0 ( MxDSStreamingAction p_action)
static

[AI] Returns whether a streaming action can be processed (buffer conditions met).

Parameters
p_actionThe streaming action to test. [AI]
Returns
[AI]

Definition at line 279 of file mxdiskstreamprovider.cpp.

◆ FUN_100d1b20()

MxResult MxDiskStreamProvider::FUN_100d1b20 ( MxDSStreamingAction p_action)

[AI] Finalizes merging of streaming buffers and updates streamed data for a given action.

Parameters
p_actionThe streaming action to finalize/merge. [AI]
Returns
[AI]

Definition at line 290 of file mxdiskstreamprovider.cpp.

◆ GetBufferForDWords()

MxU32 * MxDiskStreamProvider::GetBufferForDWords ( )
overridevirtual

[AI] Returns a pointer to the buffer for raw dword access (SI file data block).

Returns
[AI]

Implements MxStreamProvider.

Definition at line 398 of file mxdiskstreamprovider.cpp.

◆ GetFileSize()

MxU32 MxDiskStreamProvider::GetFileSize ( )
overridevirtual

[AI] Gets the size, in bytes, of the open file/buffer to be streamed.

Returns
[AI]

Implements MxStreamProvider.

Definition at line 380 of file mxdiskstreamprovider.cpp.

◆ GetLengthInDWords()

MxU32 MxDiskStreamProvider::GetLengthInDWords ( )
overridevirtual

[AI] Returns file length as dword-count for bulk/integer-based streaming use cases.

Returns
[AI]

Implements MxStreamProvider.

Definition at line 392 of file mxdiskstreamprovider.cpp.

◆ GetStreamBuffersNum()

MxS32 MxDiskStreamProvider::GetStreamBuffersNum ( )
overridevirtual

[AI] Gets the number of stream buffers/splits for the file, used to drive parallel reads.

Returns
[AI]

Implements MxStreamProvider.

Definition at line 386 of file mxdiskstreamprovider.cpp.

◆ IsA()

MxBool MxDiskStreamProvider::IsA ( const char *  p_name) const
overridevirtual

[AI] Tests if the object is of, or derives from, the supplied class name.

Parameters
p_nameThe class name to check against. [AI]
Returns
[AI]

Reimplemented from MxCore.

◆ PerformWork()

void MxDiskStreamProvider::PerformWork ( )

[AI] Performs a single unit of scheduled streaming work, i.e., loading data for queued actions.

[AI] Used internally by the worker thread to process actions on the work queue, handling buffer/finalization and controller callbacks.

Definition at line 213 of file mxdiskstreamprovider.cpp.

◆ SetResourceToGet()

MxResult MxDiskStreamProvider::SetResourceToGet ( MxStreamController p_resource)
overridevirtual

[AI] Opens and prepares a resource for streaming from disk based on the controller's atom (resource key).

[AI] Tries to open the resource from hard disk, then falls back to CD. Initializes queues and starts the thread.

Parameters
p_resourceThe stream controller resource descriptor. [AI]
Returns
[AI]

Reimplemented from MxStreamProvider.

Definition at line 85 of file mxdiskstreamprovider.cpp.

◆ VTable0x20()

void MxDiskStreamProvider::VTable0x20 ( MxDSAction p_action)
overridevirtual

[AI] Cancels or reclaims outstanding streaming actions based on object ID, returning associated actions to free buffer.

Parameters
p_actionThe DS action (can be a kill-all or single-object). [AI]

Reimplemented from MxStreamProvider.

Definition at line 117 of file mxdiskstreamprovider.cpp.

◆ WaitForWorkToComplete()

MxResult MxDiskStreamProvider::WaitForWorkToComplete ( )

[AI] Blocks until all scheduled streaming work is finished (used by the streaming worker thread).

[AI] Repeatedly waits on the busy semaphore and delegates to PerformWork as needed until remaining work is done.

Returns
[AI]

Definition at line 164 of file mxdiskstreamprovider.cpp.

Member Data Documentation

◆ m_busySemaphore

MxSemaphore MxDiskStreamProvider::m_busySemaphore
protected

[AI] Semaphore used to synchronize and signal work for the background thread.

Definition at line 163 of file mxdiskstreamprovider.h.

◆ m_criticalSection

MxCriticalSection MxDiskStreamProvider::m_criticalSection
protected

[AI] Synchronizes access to the work item queue (m_list).

Definition at line 178 of file mxdiskstreamprovider.h.

◆ m_list

MxDSObjectList MxDiskStreamProvider::m_list
protected

[AI] List of streaming actions to be processed/completed by the thread.

Definition at line 183 of file mxdiskstreamprovider.h.

◆ m_remainingWork

MxBool MxDiskStreamProvider::m_remainingWork
protected

[AI] Indicates whether more streaming work remains for the thread.

Definition at line 168 of file mxdiskstreamprovider.h.

◆ m_thread

MxDiskStreamProviderThread MxDiskStreamProvider::m_thread
protected

[AI] Thread object handling streaming actions asynchronously.

Definition at line 158 of file mxdiskstreamprovider.h.

◆ m_unk0x35

MxBool MxDiskStreamProvider::m_unk0x35
protected

[AI] Internal flag signaling available work for the thread or shutdown in progress.

Definition at line 173 of file mxdiskstreamprovider.h.


The documentation for this class was generated from the following files: