Loader of one .rnd file, which reads the file over several frames.
More...
#include <rndloader.h>
|
| 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...
|
|
| | 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 () |
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.
◆ State
| typedef void(RndLoader::* RndLoader::State) (float fDeadlineMs) |
A stage of the load, which works until a deadline on the system clock in milliseconds.
◆ 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.
|
◆ 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
-
| pszFile | The file. |
| nFlags | The Flags of the load. |
| pCallback | The callback consulted for each object, or null. |
| pStream | The 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
◆ operator new()
| void * RndLoader::operator new |
( |
size_t | nSize | ) |
|
|
inline |
Allocate a loader, billed to Loader.
- Parameters
-
| nSize | The object size the compiler supplies. |
- Returns
- The block.
◆ operator delete()
| void RndLoader::operator delete |
( |
void * | pBlock | ) |
|
|
inline |
Release a loader.
- Parameters
-
◆ 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
-
| fDeadlineMs | The 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
-
- 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
-
| pszClass | The 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
-
- 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
-
- 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
-
- 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
-
- 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
-
- Ghidra address:
- NTSC-U/C: 0x0022d850
- Ghidra address:
- PAL: 0x00236508
◆ DoneLoading()
| void RndLoader::DoneLoading |
( |
float | fDeadlineMs | ) |
|
The final stage, which does nothing.
- Parameters
-
- 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 |
◆ GetObjects() [1/2]
| const std::list< RndObject * > & RndLoader::GetObjects |
( |
| ) |
const |
|
inline |
◆ GetObjects() [2/2]
| std::list< RndObject * > & RndLoader::GetObjects |
( |
| ) |
|
|
inline |
- Returns
- Objects, for writing.
The documentation for this class was generated from the following file: