resonance 1.0.1
Loading...
Searching...
No Matches
MetFreqMakerAssetManager Class Reference

Owner of the art and sound assets the FreQ maker works from. More...

#include <metfreqmakerassetmanager.h>

Public Member Functions

 MetFreqMakerAssetManager ()
 Start with no assets, no loaded templates, and two persona loaders.
virtual ~MetFreqMakerAssetManager ()
 Delete the two persona loaders.
bool PollLoad ()
 Advance the asset load by one step and report whether it has finished.
void WaitForLoad ()
 Block until PollLoad() reports the assets resident, running RndAsyncLoader::PollAsyncLoads() between attempts.
std::vector< MetPersonaData * > * GetIdentityList ()
 Resolve the list of prefabricated identities the FreQ maker offers.
std::vector< MetPersonaData * > * GetAllIdentities ()
 Resolve the full list of identities, the one at +0x74.
void StartIdentityLoads ()
 Queue the reads of both persona files.
bool AreIdentitiesLoaded ()
 Pump the asynchronous layer and report whether both persona files are parsed.
bool AreLoadersReady ()
 Report through both loaders whether the assets are resident.
FreqPartTemplate * GetPart (int nId)
 Report the part template with one identifier.
HxStr NextMeshName ()
 Generate a fresh object name, autogen_obj_ followed by the value of a counter the call then advances.
Rnd::Mesh * CloneMesh (const HxStr &name)
 Create a mesh under one name as a copy of the template mesh, in the default colour.
void ApplyPartScale (Rnd::Mesh *pMesh, FreqPartTemplate *pTemplate, float *pScaleX, float *pScaleZ, float flFactorX, float flFactorZ)
 Scale a mesh to one part template.
Color * ColorAt (const Vector2 &position)
 Report the colour at one position of the spectrum palette.
Color * SampleTexture (Rnd::Tex *pTex, float flU, float flV)
 Read the colour of one texel of a texture.
bool PaintTexel (Rnd::Tex *pTex, const Color &color, float flU, float flV)
 Write one colour into one texel of a texture.
bool ScaleMesh (Rnd::Mesh *pMesh, int nOrthonormalize, float flScaleX, float flScaleY, float flScaleZ)
 Scale the three basis rows of a mesh's local transform.
std::map< HxStr, FreqPartTemplate * > * GetPartsByName ()
 Report the part templates by name, once PollLoad() has run and its result is discarded.
FreqPartTemplate * FindPart (const HxStr &name)
 Report the part template registered under one name.
std::list< FreqPartTemplate * > * TemplatesInCategory (int nCategory)
 Report the templates of one category.
void StartAssetLoad ()
 Create and queue the load of the FreQ maker asset file once.
void ReleaseParts ()
 Delete every part template and forget them, so the next PollLoad() reloads.
std::list< Rnd::Object * > GetLoadedObjects ()
 Report a copy of the objects the asset load produced, once PollLoad() has run and its result is discarded.

Static Public Member Functions

static void Create ()
 Allocate the one instance through CreateInstance().
static MetFreqMakerAssetManager * shared ()
 Return the one instance through Instance().
static void Destroy ()
 Delete the one instance through DestroyInstance().
static void CreateInstance ()
 Allocate the one instance and record it for Instance().
static void DestroyInstance ()
 Delete the one instance through its virtual destructor.
static MetFreqMakerAssetManager * Instance ()
 Return the one instance, or null before CreateInstance() has created it.

Static Public Attributes

static constexpr int kCategoryCount = 11
 The number of part categories, which count from 1.

Detailed Description

Owner of the art and sound assets the FreQ maker works from.

Its RTTI descriptor is at 0x0086f7a8. It is a leaf class with no base. Following the g++ 2.x layout for a class with no base, the vptr sits after the data members at +0x80, and the object is 0x84 bytes. The two-entry vtable at 0x007f0908 makes the destructor the one virtual the class declares.

The manager loads MetaGame/persona/freq_maker_inventory_assets.rnd in the background. Once the load completes, PollLoad() builds one FreqPartTemplate for each part texture it produced, and the two MetFreqLoader objects read the pre-fab personas. The destructor deletes the two loaders and leaves the templates, the asset load, and the two prototypes in place.

The translation unit spans 0x0024f798 to 0x00255790.

The one instance is created by CreateInstance(), which allocates exactly 0x84 bytes, runs the constructor, and records the result in the global at 0x006a0f30 that Instance() reads. Creation and access are separate routines, so neither accessor constructs on first use.

The public Create(), shared(), and Destroy() are one-call forwarders defined at the start of the unit, and the bodies they reach are defined near its end. Every caller outside the unit goes through a forwarder except MetNullRenderer's constructor, which reads Instance() directly.

The titles shared(), PollLoad(), and WaitForLoad() are inferred, and so are the three body titles CreateInstance(), Instance(), and DestroyInstance(). No string in the image identifies any of them.

Constructor & Destructor Documentation

◆ MetFreqMakerAssetManager()

MetFreqMakerAssetManager::MetFreqMakerAssetManager ( )

Start with no assets, no loaded templates, and two persona loaders.

The loaders read pers_PS2.dat and teamfreq_pers_PS2.dat under the pre-fab persona directory of GetFreqRoot() into mPrefabIdentities and mTeamFreqIdentities.

Ghidra address:
NTSC-U/C: 0x00250b18
Ghidra address:
PAL: 0x00266050

◆ ~MetFreqMakerAssetManager()

virtual MetFreqMakerAssetManager::~MetFreqMakerAssetManager ( )
virtual

Delete the two persona loaders.

The templates, the asset load, and the prototypes are not released.

Ghidra address:
NTSC-U/C: 0x00250808
Ghidra address:
PAL: 0x00265d40

Member Function Documentation

◆ Create()

void MetFreqMakerAssetManager::Create ( )
static

Allocate the one instance through CreateInstance().

MetRenderer's and MetNullRenderer's constructors are the callers. The title is inferred.

Ghidra address:
NTSC-U/C: 0x00254930
Ghidra address:
PAL: 0x00269ff8

◆ shared()

MetFreqMakerAssetManager * MetFreqMakerAssetManager::shared ( )
static

Return the one instance through Instance().

Fifty call sites across ten classes reach the instance this way.

Returns
The instance, or null before Create().
Ghidra address:
NTSC-U/C: 0x00254950
Ghidra address:
PAL: 0x0026a018

◆ Destroy()

void MetFreqMakerAssetManager::Destroy ( )
static

Delete the one instance through DestroyInstance().

MetRenderer's and MetNullRenderer's destructors are the callers. The title is inferred.

Ghidra address:
NTSC-U/C: 0x00254970
Ghidra address:
PAL: 0x0026a038

◆ CreateInstance()

void MetFreqMakerAssetManager::CreateInstance ( )
static

Allocate the one instance and record it for Instance().

Create() is the only caller.

Ghidra address:
NTSC-U/C: 0x00255158
Ghidra address:
PAL: 0x0026a820

◆ DestroyInstance()

void MetFreqMakerAssetManager::DestroyInstance ( )
static

Delete the one instance through its virtual destructor.

The pointer Instance() reports is not cleared. Destroy() is the only caller.

Ghidra address:
NTSC-U/C: 0x002551b8
Ghidra address:
PAL: 0x0026a880

◆ Instance()

MetFreqMakerAssetManager * MetFreqMakerAssetManager::Instance ( )
static

Return the one instance, or null before CreateInstance() has created it.

shared() and MetNullRenderer's constructor are the callers.

Returns
The instance.
Ghidra address:
NTSC-U/C: 0x002551f0
Ghidra address:
PAL: 0x0026a8b8

◆ PollLoad()

bool MetFreqMakerAssetManager::PollLoad ( )

Advance the asset load by one step and report whether it has finished.

A completed load reports success without doing work. Otherwise the routine starts the asset load if needed, pumps the asynchronous loads, and returns false while the asset load is still running. On completion it resolves the prototype material and mesh, rebuilds the part templates from every loaded texture other than the spectrum, the burn prototype, the frame, and the four burn textures, numbers them in load order, marks the load complete, and starts the persona loads.

Returns
True once every asset is resident.
Ghidra address:
NTSC-U/C: 0x0024f798
Ghidra address:
PAL: 0x00264bd8

◆ WaitForLoad()

void MetFreqMakerAssetManager::WaitForLoad ( )

Block until PollLoad() reports the assets resident, running RndAsyncLoader::PollAsyncLoads() between attempts.

Ghidra address:
NTSC-U/C: 0x00255200
Ghidra address:
PAL: 0x0026a8c8

◆ GetIdentityList()

std::vector< MetPersonaData * > * MetFreqMakerAssetManager::GetIdentityList ( )

Resolve the list of prefabricated identities the FreQ maker offers.

The body waits for the load through WaitForLoad() and then spins on AreIdentitiesLoaded() before returning the team FreQ list when GlobalSettings::mTeamFreqUnlocked is set, and the pre-fab list otherwise. The title is inferred from the element type and from the one caller, MetLoadNewFreqScreen::AcquireIdentityList().

Returns
One of the two lists. It is never null.
Ghidra address:
NTSC-U/C: 0x00255090
Ghidra address:
PAL: 0x0026a758

◆ GetAllIdentities()

std::vector< MetPersonaData * > * MetFreqMakerAssetManager::GetAllIdentities ( )

Resolve the full list of identities, the one at +0x74.

The body waits for the load through WaitForLoad() and spins on the same two asynchronous requests as GetIdentityList(), and then returns the +0x74 vector without a selector. The title is inferred from the one caller, CreditsRoll::Reset(), which searches every identity by name.

Returns
The list. It is never null.
Ghidra address:
NTSC-U/C: 0x00255100
Ghidra address:
PAL: 0x0026a7c8

◆ StartIdentityLoads()

void MetFreqMakerAssetManager::StartIdentityLoads ( )

Queue the reads of both persona files.

PollLoad() runs it. The title is inferred.

Ghidra address:
NTSC-U/C: 0x00254fd0
Ghidra address:
PAL: 0x0026a698

◆ AreIdentitiesLoaded()

bool MetFreqMakerAssetManager::AreIdentitiesLoaded ( )

Pump the asynchronous layer and report whether both persona files are parsed.

Both loaders are polled on every call. MetSonyScreen's slot 26 calls it, and GetIdentityList() and GetAllIdentities() expand the same body. The title is inferred.

Returns
True once both lists are filled.
Ghidra address:
NTSC-U/C: 0x00255000
Ghidra address:
PAL: 0x0026a6c8

◆ AreLoadersReady()

bool MetFreqMakerAssetManager::AreLoadersReady ( )

Report through both loaders whether the assets are resident.

The image has no caller. The title is inferred.

Returns
True when both loaders report the assets resident.
Ghidra address:
NTSC-U/C: 0x00255048
Ghidra address:
PAL: 0x0026a710

◆ GetPart()

FreqPartTemplate * MetFreqMakerAssetManager::GetPart ( int nId)

Report the part template with one identifier.

Runs PollLoad() first and discards its result. The identifier is not range-checked. The title is inferred.

Parameters
nIdThe template identifier.
Returns
The template.
Ghidra address:
NTSC-U/C: 0x00254a18
Ghidra address:
PAL: 0x0026a0e0

◆ NextMeshName()

HxStr MetFreqMakerAssetManager::NextMeshName ( )

Generate a fresh object name, autogen_obj_ followed by the value of a counter the call then advances.

The title is inferred.

Returns
The name.
Ghidra address:
NTSC-U/C: 0x00254e50
Ghidra address:
PAL: 0x0026a518

◆ CloneMesh()

Rnd::Mesh * MetFreqMakerAssetManager::CloneMesh ( const HxStr & name)

Create a mesh under one name as a copy of the template mesh, in the default colour.

Runs PollLoad() first and discards its result, creates the mesh through Rnd::Mesh::sNew, copies mMeshTemplate into it with no flags, and applies g_freqMakerDefaultColor. The title is inferred.

Parameters
nameThe name of the new mesh.
Returns
The mesh.
Ghidra address:
NTSC-U/C: 0x00254a58
Ghidra address:
PAL: 0x0026a120

◆ ApplyPartScale()

void MetFreqMakerAssetManager::ApplyPartScale ( Rnd::Mesh * pMesh,
FreqPartTemplate * pTemplate,
float * pScaleX,
float * pScaleZ,
float flFactorX,
float flFactorZ )

Scale a mesh to one part template.

The template's x and z scales are converted from 1/128 units and reported through pScaleX and pScaleZ. The mesh's local basis is rebuilt as orthonormal around its y row, its x row is scaled by the x scale times flFactorX, its z row by the z scale times flFactorZ, and the mesh is marked dirty. The body does not read this object. The title is inferred.

Parameters
pMeshThe mesh to scale.
pTemplateThe template whose scale applies.
pScaleXReceives the template's x scale.
pScaleZReceives the template's z scale.
flFactorXThe further factor on the x row.
flFactorZThe further factor on the z row.
Ghidra address:
NTSC-U/C: 0x00254b30
Ghidra address:
PAL: 0x0026a1f8

◆ ColorAt()

Color * MetFreqMakerAssetManager::ColorAt ( const Vector2 & position)

Report the colour at one position of the spectrum palette.

The palette texture, g_spectrumTextureName, is resolved out of Rnd::TheManager on first use and kept in mPaletteTex. The title is inferred.

Parameters
positionThe palette position, each coordinate from 0 to 1.
Returns
The colour, in storage SampleTexture() shares between calls.
Ghidra address:
NTSC-U/C: 0x00254f30
Ghidra address:
PAL: 0x0026a5f8

◆ SampleTexture()

Color * MetFreqMakerAssetManager::SampleTexture ( Rnd::Tex * pTex,
float flU,
float flV )

Read the colour of one texel of a texture.

The coordinates are scaled by the texture's bitmap size, and the texel's three channels are converted from bytes to the unit range in a Color that every call shares, with an alpha of

  1. The body does not read this object. The title is inferred.
Parameters
pTexThe texture.
flUThe horizontal coordinate, from 0 to 1.
flVThe vertical coordinate, from 0 to 1.
Returns
The shared colour.
Ghidra address:
NTSC-U/C: 0x00250638
Ghidra address:
PAL: 0x00265b70

◆ PaintTexel()

bool MetFreqMakerAssetManager::PaintTexel ( Rnd::Tex * pTex,
const Color & color,
float flU,
float flV )

Write one colour into one texel of a texture.

The colour's three channels are scaled to bytes, and the texel under the coordinates scaled by the texture's bitmap size is written. The body does not read this object, and the image has no caller. The title is inferred.

Parameters
pTexThe texture.
colorThe colour. Its alpha is not written.
flUThe horizontal coordinate, from 0 to 1.
flVThe vertical coordinate, from 0 to 1.
Returns
Always true.
Ghidra address:
NTSC-U/C: 0x00254cf8
Ghidra address:
PAL: 0x0026a3c0

◆ ScaleMesh()

bool MetFreqMakerAssetManager::ScaleMesh ( Rnd::Mesh * pMesh,
int nOrthonormalize,
float flScaleX,
float flScaleY,
float flScaleZ )

Scale the three basis rows of a mesh's local transform.

With nOrthonormalize equal to 1 the basis is first rebuilt as orthonormal around its y row. The mesh is marked dirty. The body does not read this object, and the image has no caller. The title is inferred.

Parameters
pMeshThe mesh.
nOrthonormalize1 to rebuild the basis first.
flScaleXThe factor on the x row.
flScaleYThe factor on the y row.
flScaleZThe factor on the z row.
Returns
Always true.
Ghidra address:
NTSC-U/C: 0x00254c20
Ghidra address:
PAL: 0x0026a2e8

◆ GetPartsByName()

std::map< HxStr, FreqPartTemplate * > * MetFreqMakerAssetManager::GetPartsByName ( )

Report the part templates by name, once PollLoad() has run and its result is discarded.

MetFreqMakerInventoryScreen's slot 38 is the one caller. The title is inferred.

Returns
The map.
Ghidra address:
NTSC-U/C: 0x00254990
Ghidra address:
PAL: 0x0026a058

◆ FindPart()

FreqPartTemplate * MetFreqMakerAssetManager::FindPart ( const HxStr & name)

Report the part template registered under one name.

Runs PollLoad() first and discards its result. The title is inferred.

Parameters
nameThe template name.
Returns
The template, or null when no template has the name.
Ghidra address:
NTSC-U/C: 0x002549b8
Ghidra address:
PAL: 0x0026a080

◆ TemplatesInCategory()

std::list< FreqPartTemplate * > * MetFreqMakerAssetManager::TemplatesInCategory ( int nCategory)

Report the templates of one category.

A category outside 1 through 11 reports the list of category 11. The title is inferred.

Parameters
nCategoryThe category.
Returns
The list.
Ghidra address:
NTSC-U/C: 0x00254ea0
Ghidra address:
PAL: 0x0026a568

◆ StartAssetLoad()

void MetFreqMakerAssetManager::StartAssetLoad ( )

Create and queue the load of the FreQ maker asset file once.

Nothing happens once the load request exists. Otherwise the request for MetaGame/persona/freq_maker_inventory_assets.rnd is created with the index of the zone rndglobal as its priority and enqueued. MetRenderer's and MetNullRenderer's constructors and PollLoad() call it. The title is inferred.

Ghidra address:
NTSC-U/C: 0x0024fce8
Ghidra address:
PAL: 0x00265170

◆ ReleaseParts()

void MetFreqMakerAssetManager::ReleaseParts ( )

Delete every part template and forget them, so the next PollLoad() reloads.

Only the name map is emptied. The identifier vector and the category lists retain their pointers. The image has no caller. The title is inferred.

Ghidra address:
NTSC-U/C: 0x0024fe58
Ghidra address:
PAL: 0x00265320

◆ GetLoadedObjects()

std::list< Rnd::Object * > MetFreqMakerAssetManager::GetLoadedObjects ( )

Report a copy of the objects the asset load produced, once PollLoad() has run and its result is discarded.

The image has no caller, and PollLoad() expands the same copy. The title is inferred.

Returns
The objects.
Ghidra address:
NTSC-U/C: 0x00250540
Ghidra address:
PAL: 0x00265a78

Member Data Documentation

◆ kCategoryCount

int MetFreqMakerAssetManager::kCategoryCount = 11
staticconstexpr

The number of part categories, which count from 1.


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