wavelength 1.0.0
Loading...
Searching...
No Matches
RndLoader Class Reference

Loader of one .rnd file, which reads the file over several frames. More...

#include <rndloader.h>

Classes

class  Callback
 Interface a loader consults before it creates each object of its file. More...
class  ObjectLoader
 One object of the file, with what the loader does with its record. More...

Public Types

enum  Flags { kAsync = 1 , kReportExisting = 2 , kDeleteObjects = 4 }
 Behaviour bits of a load, as RndManager::AddLoader() takes them. More...
typedef void(RndLoader::* State) (float fDeadlineMs)
 A stage of the load, which works until a deadline on the system clock in milliseconds.

Public Member Functions

 RndLoader (const char *pszFile, int nFlags, Callback *pCallback, BinStream *pStream)
 Create a loader for a file.
 ~RndLoader ()
 End the load, delete the loaded objects when kDeleteObjects is set, and leave the queue.
void * operator new (size_t nSize)
 Allocate a loader, billed to Loader.
void operator delete (void *pBlock)
 Release a loader.
bool IsLoaded () const
 Report whether the load has ended.
void Poll (float fDeadlineMs)
 Advance the load until a deadline.
void LoadFile (float fDeadlineMs)
 Open a stream on the file unless one was given, then start PreloadHeader().
void RemapClassName (char *pszClass)
 Rewrite a class name of an older version to the name the registry knows.
void PreloadHeader (float fDeadlineMs)
 Wait for the stream, read the version and the object count, then start CreateObjects().
void CreateObjects (float fDeadlineMs)
 Read the object table, find or create each object, and record what to do with its record.
void LoadResources (float fDeadlineMs)
 Read the texture files of the file and start reading them, then start LoadObjects().
void LoadObjects (float fDeadlineMs)
 Load or skip the record of each object while the stream has data, then start DeleteObjects().
void DeleteObjects (float fDeadlineMs)
 Delete the objects created only to be skipped, then end the load.
void DoneLoading (float fDeadlineMs)
 The final stage, which does nothing.
void Finish ()
 End the load unless it has ended, releasing the stream it opened.
const String & GetFile () const
const std::list< RndObject * > & GetObjects () const
std::list< RndObject * > & GetObjects ()

Detailed Description

Loader of one .rnd file, which reads the file over several frames.

The RTTI includes the class name. RndManager::AddLoader() creates the loader and queues it. The load is a sequence of stages, each a member that does as much as a deadline allows and then hands over to the next stage. A stage that finishes runs the next one at once.

Member Typedef Documentation

◆ State

typedef void(RndLoader::* RndLoader::State) (float fDeadlineMs)

A stage of the load, which works until a deadline on the system clock in milliseconds.

Member Enumeration Documentation

◆ Flags

Behaviour bits of a load, as RndManager::AddLoader() takes them.

Enumerator
kAsync 

Load across frames instead of before AddLoader() returns.

kReportExisting 

Report the objects of the file that exist and are not loaded.

kDeleteObjects 

Delete the loaded objects when the loader is deleted.

Constructor & Destructor Documentation

◆ RndLoader()

RndLoader::RndLoader ( const char * pszFile,
int nFlags,
Callback * pCallback,
BinStream * pStream )

Create a loader for a file.

A synchronous load runs to the end before the constructor returns.

Parameters
pszFileThe file.
nFlagsThe Flags of the load.
pCallbackThe callback consulted for each object, or null.
pStreamThe stream to read instead of the file, or null.
Ghidra address:
NTSC-U/C: 0x0022c6a0
Ghidra address:
PAL: 0x00235368

◆ ~RndLoader()

RndLoader::~RndLoader ( )

End the load, delete the loaded objects when kDeleteObjects is set, and leave the queue.

Ghidra address:
NTSC-U/C: 0x0022da38
Ghidra address:
PAL: 0x002366f0

Member Function Documentation

◆ operator new()

void * RndLoader::operator new ( size_t nSize)
inline

Allocate a loader, billed to Loader.

Parameters
nSizeThe object size the compiler supplies.
Returns
The block.

◆ operator delete()

void RndLoader::operator delete ( void * pBlock)
inline

Release a loader.

Parameters
pBlockThe block.

◆ IsLoaded()

bool RndLoader::IsLoaded ( ) const

Report whether the load has ended.

Returns
Whether the stage is DoneLoading().
Ghidra address:
NTSC-U/C: 0x0022c908
Ghidra address:
PAL: 0x002355d0

◆ Poll()

void RndLoader::Poll ( float fDeadlineMs)

Advance the load until a deadline.

Parameters
fDeadlineMsThe system clock time the step must finish by, in milliseconds.
Ghidra address:
NTSC-U/C: 0x0022c958
Ghidra address:
PAL: 0x00235620

◆ LoadFile()

void RndLoader::LoadFile ( float fDeadlineMs)

Open a stream on the file unless one was given, then start PreloadHeader().

A file that fails to open ends the load.

Parameters
fDeadlineMsThe deadline.
Ghidra address:
NTSC-U/C: 0x0022c988
Ghidra address:
PAL: 0x00235650

◆ RemapClassName()

void RndLoader::RemapClassName ( char * pszClass)

Rewrite a class name of an older version to the name the registry knows.

Each rewrite applies below the version that introduced it. The name is inferred.

Parameters
pszClassThe class name to rewrite in place.
Ghidra address:
NTSC-U/C: 0x0022ca60
Ghidra address:
PAL: 0x00235728

◆ PreloadHeader()

void RndLoader::PreloadHeader ( float fDeadlineMs)

Wait for the stream, read the version and the object count, then start CreateObjects().

A version newer than RndManager::sRev ends the load, as does an asynchronous load of a version before 7.

Parameters
fDeadlineMsThe deadline.
Ghidra address:
NTSC-U/C: 0x0022cce8
Ghidra address:
PAL: 0x002359b0

◆ CreateObjects()

void RndLoader::CreateObjects ( float fDeadlineMs)

Read the object table, find or create each object, and record what to do with its record.

A callback that returns a negative value stops the stage without ending the load. An existing object that is internal or of another class ends the load. The texture count is read next, and the stage continues with LoadResources() from version 9, otherwise with LoadObjects().

Parameters
fDeadlineMsThe deadline.
Ghidra address:
NTSC-U/C: 0x0022ce90
Ghidra address:
PAL: 0x00235b58

◆ LoadResources()

void RndLoader::LoadResources ( float fDeadlineMs)

Read the texture files of the file and start reading them, then start LoadObjects().

An asynchronous load keeps up to mTextures.size() reads in flight and finishes once every read is done. From version 10 a texture of an object that is not loaded is not read. A synchronous load skips the list.

Parameters
fDeadlineMsThe deadline.
Ghidra address:
NTSC-U/C: 0x0022d3a0
Ghidra address:
PAL: 0x00236058

◆ LoadObjects()

void RndLoader::LoadObjects ( float fDeadlineMs)

Load or skip the record of each object while the stream has data, then start DeleteObjects().

Parameters
fDeadlineMsThe deadline.
Ghidra address:
NTSC-U/C: 0x0022d6d8
Ghidra address:
PAL: 0x00236390

◆ DeleteObjects()

void RndLoader::DeleteObjects ( float fDeadlineMs)

Delete the objects created only to be skipped, then end the load.

Parameters
fDeadlineMsThe deadline.
Ghidra address:
NTSC-U/C: 0x0022d850
Ghidra address:
PAL: 0x00236508

◆ DoneLoading()

void RndLoader::DoneLoading ( float fDeadlineMs)

The final stage, which does nothing.

Parameters
fDeadlineMsThe deadline.
Ghidra address:
NTSC-U/C: 0x0022d960
Ghidra address:
PAL: 0x00236618

◆ Finish()

void RndLoader::Finish ( )

End the load unless it has ended, releasing the stream it opened.

The resources the renderer read are released unless the stage is DeleteObjects(). The name is inferred.

Ghidra address:
NTSC-U/C: 0x0022d968
Ghidra address:
PAL: 0x00236620

◆ GetFile()

const String & RndLoader::GetFile ( ) const
inline
Returns
The file.

◆ GetObjects() [1/2]

const std::list< RndObject * > & RndLoader::GetObjects ( ) const
inline
Returns
Objects.

◆ GetObjects() [2/2]

std::list< RndObject * > & RndLoader::GetObjects ( )
inline
Returns
Objects, for writing.

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