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

Saved record of one player persona. More...

#include <metpersonadata.h>

Collaboration diagram for MetPersonaData:

Public Member Functions

void * operator new (size_t nSize)
 Allocate an instance from the tagged heap.
void operator delete (void *pBlock)
 Release an instance to the tagged heap.
 MetPersonaData ()
 Construct an empty record.
virtual ~MetPersonaData ()
MetPersonaData & operator= (const MetPersonaData &other)
 Copy every member from another record.
virtual void Save (OBStream *pStream)
 Write the record to a stream.
virtual void Load (IBStream *pStream)
 Read the record back from a stream.
void UpdateSkillStatus ()
 Record in the appearance the highest skill the campaign has reached.
void AttachToBurnSlot (int nSlot)
 Hang this persona's avatar in one of the four persona burn slots.
int GetSkillStatus ()
 Report the skill status recorded in the appearance.
void SetName (const HxStr &name)
 Replace the username in the embedded appearance.
void Print (std::ostream &stream)
 Write the record to a diagnostic stream.

Static Public Member Functions

static std::vector< MetPersonaData * > * loadList ()
 Resolve the list of records the memory-card path last read.
static std::vector< MetPersonaData * > * savedList ()
 Resolve the list of records the player has saved.
static std::vector< MetPersonaData * > & LoadListStorage ()
 Hold the list loadList() reports.
static std::vector< MetPersonaData * > & SavedListStorage ()
 Hold the list savedList() reports.
static void ClearLoadList ()
 Delete every record in loadList() and empty it.
static void ClearSavedList ()
 Delete every record in savedList() and empty it.
static void CopyList (std::vector< MetPersonaData * > *pDestination, const std::vector< MetPersonaData * > *pSource)
 Replace one list with fresh copies of the records in another.

Public Attributes

CampaignStats mStats
 Campaign progress of this persona.
FreqAppearance mAppearance
 Appearance the front end displays and edits.
HxStr mBirthday
int mIsPrefab
 Set to 1 by MetFreqLoader's parser on every pre-fab persona it reads.
HxStr mSavedName

Detailed Description

Saved record of one player persona.

Its RTTI descriptor is at 0x0086f610. 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, here at +0x168, and the object is 0x16c bytes. The four-entry vtable is at 0x00804bd8.

The class supplies both its own allocation and its own release function, and both tag the block with the literal MetPersonaData at 0x00804a78.

Two of its members are objects with virtuals. The member at offset 0 is a CampaignStats, 0x140 bytes with its vptr at +0x13c, built by CampaignStats::CampaignStats() at 0x00140580 and torn down by its destructor at 0x00140768. The member at +0x140 is a FreqAppearance, 0x14 bytes with its vptr at +0x10, built at 0x001745b8 and torn down by the destructor its vtable slot 1 records at 0x00174730.

Vtable slots 2 and 3, at 0x0032b880 and 0x0032b968, are a matched pair. Slot 2 hands the constant 4-byte value 2 to its argument through the argument's vtable slot 4 and then forwards the same argument to slot 2 of both member objects. Slot 3 takes a 4-byte value back through slot 6 and forwards to slot 3 of both members. The pair is therefore the persist-and-restore pair with a record version of 2.

The two slot numbers identify the argument's class. Slot 4 of OBStream is Write(const void *, int) and slot 6 of IBStream is Read(void *, int). GameManagerImpl calls both slots on both stream classes from its persist-and-restore pair.

Constructor & Destructor Documentation

◆ MetPersonaData()

MetPersonaData::MetPersonaData ( )

Construct an empty record.

The campaign's level list is rebuilt from the configuration, the birthday starts as 0/0/00, 12:00, and the pre-fab flag is clear.

Ghidra address:
NTSC-U/C: 0x0032b760
Ghidra address:
PAL: 0x00353bf0

◆ ~MetPersonaData()

virtual MetPersonaData::~MetPersonaData ( )
virtual
Ghidra address:
NTSC-U/C: 0x0032e278
Ghidra address:
PAL: 0x00356780

Member Function Documentation

◆ operator new()

void * MetPersonaData::operator new ( size_t nSize)

Allocate an instance from the tagged heap.

Parameters
nSizeThe object size, which the compiler supplies.
Returns
The block.
Ghidra address:
NTSC-U/C: 0x0032e1e8
Ghidra address:
PAL: 0x003566f0

◆ operator delete()

void MetPersonaData::operator delete ( void * pBlock)

Release an instance to the tagged heap.

Parameters
pBlockThe block.
Ghidra address:
NTSC-U/C: 0x0032e208
Ghidra address:
PAL: 0x00356710

◆ loadList()

std::vector< MetPersonaData * > * MetPersonaData::loadList ( )
inlinestatic

Resolve the list of records the memory-card path last read.

The list is a function-local static vector at 0x00891ab8 behind the guard flag at 0x00699d78, in LoadListStorage(). ClearLoadList() empties it and eight front-end screens read it, among them MetExpansionPakScreen, MetLoadFreqScreen, MetMemCardLoadScreen, MetPersonaSaverScreen, and MetLocPickCharScreen. The address recorded here is the single out-of-line emission of the inline accessor those eight share.

It is a static member rather than a free function, because it takes no receiver and vends exactly one class. The owning class is an inference from the element type alone, since no descriptor, literal, or file path in the image attributes either address.

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

◆ savedList()

std::vector< MetPersonaData * > * MetPersonaData::savedList ( )
inlinestatic

Resolve the list of records the player has saved.

The list is a function-local static vector at 0x00891aa8 behind the guard flag at 0x00699d74, in SavedListStorage(). MetPersonaSaverScreen appends a copy of a newly saved record that is not a team identity, and MetLoadPreFabScreen, MetLocPickCharScreen, and MetExpansionPakScreen read it. The title is inferred from the saver's use. The address recorded here is the single out-of-line emission of the inline accessor those callers share.

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

◆ LoadListStorage()

std::vector< MetPersonaData * > & MetPersonaData::LoadListStorage ( )
static

Hold the list loadList() reports.

The first call constructs the vector and registers its destructor at 0x00218098 through atexit.

Returns
The list.
Ghidra address:
NTSC-U/C: 0x00215ca0
Ghidra address:
PAL: 0x0021f900

◆ SavedListStorage()

std::vector< MetPersonaData * > & MetPersonaData::SavedListStorage ( )
static

Hold the list savedList() reports.

The first call constructs the vector and registers its destructor at 0x00217ff8 through atexit.

Returns
The list.
Ghidra address:
NTSC-U/C: 0x00215b88
Ghidra address:
PAL: 0x0021f7e8

◆ ClearLoadList()

void MetPersonaData::ClearLoadList ( )
static

Delete every record in loadList() and empty it.

MetRenderer's constructor, MetLocPickCharScreen, MetMemDetectScreen, and MetPersonaSaverScreen call it. The list is resolved afresh for every read.

Ghidra address:
NTSC-U/C: 0x00215cf8
Ghidra address:
PAL: 0x0021f958

◆ ClearSavedList()

void MetPersonaData::ClearSavedList ( )
static

Delete every record in savedList() and empty it.

MetRenderer's constructor is the one caller.

Ghidra address:
NTSC-U/C: 0x00215be0
Ghidra address:
PAL: 0x0021f840

◆ CopyList()

void MetPersonaData::CopyList ( std::vector< MetPersonaData * > * pDestination,
const std::vector< MetPersonaData * > * pSource )
static

Replace one list with fresh copies of the records in another.

Every record in the destination is deleted first. MetLocPickCharScreen's slot 19 is the one caller.

Parameters
pDestinationThe list to replace.
pSourceThe records to copy.
Ghidra address:
NTSC-U/C: 0x002159f8
Ghidra address:
PAL: 0x0021f658

◆ operator=()

MetPersonaData & MetPersonaData::operator= ( const MetPersonaData & other)

Copy every member from another record.

GameManagerImpl::AddPersona() is the one recovered caller. It default-constructs a heap record and then runs this, rather than using a copy constructor, which is what establishes the member as an assignment. The result is discarded there, so the return type is the conventional one rather than a recovered one.

Parameters
otherThe record to copy.
Returns
This record.
Ghidra address:
NTSC-U/C: 0x0032e420
Ghidra address:
PAL: 0x00356950

◆ Save()

virtual void MetPersonaData::Save ( OBStream * pStream)
virtual

Write the record to a stream.

Slot 2. The record version 2 goes out first, then both member objects write themselves through their own slot 2.

The stream class was recorded as unidentified when this class first landed. It is OBStream, which the slot the routine calls settles. Slot 4 of OBStream is Write(const void *, int), and GameManagerImpl::Save() calls the same slot on the same class.

Parameters
pStreamThe stream to write to.
Ghidra address:
NTSC-U/C: 0x0032b880
Ghidra address:
PAL: 0x00353d40

◆ Load()

virtual void MetPersonaData::Load ( IBStream * pStream)
virtual

Read the record back from a stream.

Slot 3. The counterpart of Save(), reaching slot 6 of IBStream, which is Read(void *, int). mSavedName takes the username just read. A record of version 0 or below then has a button list, a GameOptions record, and a list of numbered strings, all read and discarded, and a record of version 2 or above has the birthday. The skill status is recomputed last through UpdateSkillStatus(), expanded in place.

Parameters
pStreamThe stream to read from.
Ghidra address:
NTSC-U/C: 0x0032b968
Ghidra address:
PAL: 0x00353e28

◆ UpdateSkillStatus()

void MetPersonaData::UpdateSkillStatus ( )

Record in the appearance the highest skill the campaign has reached.

The status is 4 when stage 5 is complete on expert and the secret stage is unlocked, 3 when only that stage is complete, 2 when stage 4 is complete on normal, 1 when stage 3 is complete on easy, and 0 otherwise. MetStageFinishScreen slot 5 is the caller.

Ghidra address:
NTSC-U/C: 0x0032e308
Ghidra address:
PAL: 0x00356838

◆ AttachToBurnSlot()

void MetPersonaData::AttachToBurnSlot ( int nSlot)

Hang this persona's avatar in one of the four persona burn slots.

Forwards to FreqAppearance::AttachToBurnSlot() on the embedded appearance. MetTutorialScreen::OnExitFinished() is a caller.

Parameters
nSlotThe burn slot, 0 through 3.
Ghidra address:
NTSC-U/C: 0x0032e488
Ghidra address:
PAL: 0x003569b8

◆ GetSkillStatus()

int MetPersonaData::GetSkillStatus ( )

Report the skill status recorded in the appearance.

Forwards to FreqAppearance::GetSkillStatus() on the embedded appearance. The image has no caller.

Returns
The status, 0 through 4.
Ghidra address:
NTSC-U/C: 0x0032e258
Ghidra address:
PAL: 0x00356760

◆ SetName()

void MetPersonaData::SetName ( const HxStr & name)

Replace the username in the embedded appearance.

The image has no caller, so this is the out-of-line copy of an inline member. The name is inferred.

Parameters
nameThe new username.
Ghidra address:
NTSC-U/C: 0x0032e230
Ghidra address:
PAL: 0x00356738

◆ Print()

void MetPersonaData::Print ( std::ostream & stream)

Write the record to a diagnostic stream.

The campaign levels, the appearance, the birthday, and the pre-fab flag follow the labels CampaignStats=, FreqAppearance=, Birthday=, and IsPrefab=. The image has no caller.

Parameters
streamThe stream to write to.
Ghidra address:
NTSC-U/C: 0x0032e380
Ghidra address:
PAL: 0x003568b0

Member Data Documentation

◆ mStats

CampaignStats MetPersonaData::mStats

Campaign progress of this persona.

+0x00

Public because MetStageFinishScreen slot 5 records and queries the finished stage through it directly, and the image has no accessor. The member sits at offset 0, which is why callers pass the persona where a CampaignStats is expected.

◆ mAppearance

FreqAppearance MetPersonaData::mAppearance

Appearance the front end displays and edits.

Public rather than private, because MetLoadFreqBaseScreen::UpdateNameLabel() reads the username out of it directly and the image has no accessor to route that read through. A friend declaration fits the image equally well. +0x140

◆ mBirthday

HxStr MetPersonaData::mBirthday

◆ mIsPrefab

int MetPersonaData::mIsPrefab

Set to 1 by MetFreqLoader's parser on every pre-fab persona it reads.

+0x15c

Public because that parser writes it directly, and the image has no accessor.

◆ mSavedName

HxStr MetPersonaData::mSavedName

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