resonance 1.0.1
Loading...
Searching...
No Matches
Rnd::Object Class Referenceabstract

Base of every object the renderer can load, resolve by name, and serialise. More...

#include <object.h>

Inheritance diagram for Rnd::Object:
Collaboration diagram for Rnd::Object:

Public Member Functions

 Object ()
 Construct an unnamed object.
 Object (const HxStr &name)
 Construct an object and register it under name.
virtual ~Object ()
 Erase the registry entry and release the name buffer.
void SetName (const HxStr &name)
 Re-register this object under a different name.
void AddRef (Object *pReferrer)
 Register pReferrer as a store of a pointer to this object.
void RemoveRef (Object *pReferrer)
 Drop one registration made by AddRef().
virtual void DumpText (Dbg &sink)
 Write a human-readable description of this object to sink.
virtual void Save (Stream &stream)=0
 Write this object's serialised form to stream.
virtual void Replace (Object *pFrom, Object *pTo)=0
 Replace every stored pointer to pFrom with pTo.
virtual const HxStr & ClassName () const =0
 Report the name of this object's most derived class.
virtual void Copy (const Object *pSource, unsigned nFlags)=0
 Copy the state of pSource into this object.
virtual void Load (Stream &stream)=0
 Read this object's serialised form from stream.

Public Attributes

HxStr mName
int mInternal

Protected Member Functions

void ReleaseAllRefs ()
 Tell every referrer to drop its pointer to this object.

Protected Attributes

std::list< Object * > mRefs

Friends

class Manager

Detailed Description

Base of every object the renderer can load, resolve by name, and serialise.

Its RTTI descriptor is at 0x0086f678. It is a leaf class with no base. Every renderer mix-in (Animatable, Collideable, Drawable, Transformable) derives from this class virtually. The subobject therefore sits at the end of the most derived object.

The class is 0x1c bytes. Following the g++ 2.x layout for a class with no base, the vptr sits after the data members at +0x18, and the eight-entry vtable is at 0x00829010.

Construction registers the object in Rnd::TheManager under its name, and destruction erases that registration. A second object stores a pointer to this one by registering itself through AddRef(). ReleaseAllRefs() then notifies every referrer through Replace() before this object goes away.

Constructor & Destructor Documentation

◆ Object() [1/2]

Rnd::Object::Object ( )

Construct an unnamed object.

mInternal, mMerge, and mDeleting are not written, so an object built this way starts with three indeterminate fields. The named constructor does initialise all three.

Ghidra address:
NTSC-U/C: 0x0053fc08
Ghidra address:
PAL: 0x0057f8c0

◆ Object() [2/2]

Rnd::Object::Object ( const HxStr & name)
explicit

Construct an object and register it under name.

A name already present in Rnd::TheManager produces the report "%s already exists" and then transfers control to the abort handler of Rnd::TheDbg. The map entry is overwritten with this object either way.

Parameters
nameThe registry key for this object.
Ghidra address:
NTSC-U/C: 0x0053e0d8
Ghidra address:
PAL: 0x0057dd08

◆ ~Object()

virtual Rnd::Object::~Object ( )
virtual

Erase the registry entry and release the name buffer.

Ghidra address:
NTSC-U/C: 0x0053e348
Ghidra address:
PAL: 0x0057dfa8

Member Function Documentation

◆ ReleaseAllRefs()

void Rnd::Object::ReleaseAllRefs ( )
protected

Tell every referrer to drop its pointer to this object.

Sets mDeleting, collapses adjacent duplicates in mRefs, calls Replace() on each referrer with a null replacement, then empties mRefs. Every derived destructor runs this immediately before the object goes away.

Ghidra address:
NTSC-U/C: 0x0053fca0
Ghidra address:
PAL: 0x0057f960

◆ SetName()

void Rnd::Object::SetName ( const HxStr & name)

Re-register this object under a different name.

A name equal to mName is discarded without further work, and a name already present in Rnd::TheManager produces the report "%s already exists" and no change.

Parameters
nameThe new registry key.
Ghidra address:
NTSC-U/C: 0x0053e400
Ghidra address:
PAL: 0x0057e070

◆ AddRef()

void Rnd::Object::AddRef ( Object * pReferrer)

Register pReferrer as a store of a pointer to this object.

A pReferrer equal to this object is discarded. The same referrer may register more than once, and ReleaseAllRefs() collapses the duplicates.

Parameters
pReferrerThe object that stores a pointer to this one.
Ghidra address:
NTSC-U/C: 0x0053e720
Ghidra address:
PAL: 0x0057e3b0

◆ RemoveRef()

void Rnd::Object::RemoveRef ( Object * pReferrer)

Drop one registration made by AddRef().

Does nothing while mDeleting is set, because ReleaseAllRefs() is already walking the list.

Parameters
pReferrerThe object whose registration is to be dropped.
Ghidra address:
NTSC-U/C: 0x0053e7d0
Ghidra address:
PAL: 0x0057e460

◆ DumpText()

virtual void Rnd::Object::DumpText ( Dbg & sink)
virtual

Write a human-readable description of this object to sink.

Vtable slot 2. The referrer list is included only when the dump level of sink is positive. Dbg::Print() is two instructions that discard their text in the shipped build. The routine therefore produces no output on this target. The literals it passes remain in .rodata regardless, and the recovered member titles came from them.

Parameters
sinkThe diagnostic sink to write to.
Ghidra address:
NTSC-U/C: 0x0053e5a8
Ghidra address:
PAL: 0x0057e238

Reimplemented in Rnd::Animatable, Rnd::Arena, Rnd::Blur, Rnd::Button, Rnd::Cam, Rnd::Collideable, Rnd::Drawable, Rnd::Environ, Rnd::Font, Rnd::Generator, Rnd::Light, Rnd::LightAnim, Rnd::Mat, Rnd::MatAnim, Rnd::Mesh, Rnd::MeshAnim, Rnd::Movie, Rnd::MultiMesh, Rnd::ParticleSys, Rnd::ParticleSysAnim, Rnd::String, Rnd::Tex, Rnd::Text, Rnd::TransAnim, Rnd::Transformable, Rnd::Tunnel, and Rnd::View.

◆ Save()

virtual void Rnd::Object::Save ( Stream & stream)
pure virtual

◆ Replace()

virtual void Rnd::Object::Replace ( Object * pFrom,
Object * pTo )
pure virtual

Replace every stored pointer to pFrom with pTo.

Vtable slot 4. A null pTo means the referenced object is going away and the pointer is to be dropped.

Parameters
pFromThe object being replaced.
pToThe replacement, or null.

Implemented in Rnd::Animatable, Rnd::Arena, Rnd::Blur, Rnd::Button, Rnd::Cam, Rnd::Collideable, Rnd::Drawable, Rnd::Environ, Rnd::Font, Rnd::Generator, Rnd::Light, Rnd::LightAnim, Rnd::Mat, Rnd::MatAnim, Rnd::Mesh, Rnd::MeshAnim, Rnd::Movie, Rnd::MultiMesh, Rnd::ParticleSys, Rnd::ParticleSysAnim, Rnd::String, Rnd::Tex, Rnd::Text, Rnd::TransAnim, Rnd::Transformable, Rnd::Tunnel, and Rnd::View.

◆ ClassName()

virtual const HxStr & Rnd::Object::ClassName ( ) const
pure virtual

Report the name of this object's most derived class.

Vtable slot 5. The returned string is the key a .rnd file writes for the class, not the mangled RTTI name.

Returns
The class name.

Implemented in Rnd::Arena, Rnd::Blur, Rnd::Button, Rnd::Cam, Rnd::Environ, Rnd::Font, Rnd::Generator, Rnd::Light, Rnd::LightAnim, Rnd::Mat, Rnd::MatAnim, Rnd::Mesh, Rnd::MeshAnim, Rnd::Movie, Rnd::MultiMesh, Rnd::ParticleSys, Rnd::ParticleSysAnim, Rnd::String, Rnd::Tex, Rnd::Text, Rnd::TransAnim, Rnd::Tunnel, and Rnd::View.

◆ Copy()

virtual void Rnd::Object::Copy ( const Object * pSource,
unsigned nFlags )
pure virtual

Copy the state of pSource into this object.

Vtable slot 6. Only the fields selected by nFlags are copied; see kCopyChildLists.

Parameters
pSourceThe object to copy from.
nFlagsThe set of fields to copy.

Implemented in Rnd::Animatable, Rnd::Arena, Rnd::Blur, Rnd::Button, Rnd::Cam, Rnd::Collideable, Rnd::Drawable, Rnd::Environ, Rnd::Font, Rnd::Generator, Rnd::Light, Rnd::LightAnim, Rnd::Mat, Rnd::MatAnim, Rnd::Mesh, Rnd::MeshAnim, Rnd::Movie, Rnd::MultiMesh, Rnd::ParticleSys, Rnd::ParticleSysAnim, Rnd::String, Rnd::Tex, Rnd::Text, Rnd::TransAnim, Rnd::Transformable, Rnd::Tunnel, and Rnd::View.

◆ Load()

virtual void Rnd::Object::Load ( Stream & stream)
pure virtual

◆ Manager

friend class Manager
friend

Member Data Documentation

◆ mRefs

std::list<Object *> Rnd::Object::mRefs
protected

◆ mName

HxStr Rnd::Object::mName

Registry key. Public because the draws-list writer and the reference dumper both read the name of an unrelated object, and the image exposes no accessor for it; either call could equally be an inlined accessor. +0x04

◆ mInternal

int Rnd::Object::mInternal

Set for an object the renderer created rather than a file. Public because Rnd::Manager::Read() tests it at 0x0051b6e4 when it finds an existing object under an incoming name, and ClearInternalObjects() sweeps on it. Both are outside this hierarchy and the image has no accessor. +0x0c


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