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

Appearance of a player's avatar. More...

#include <freqappearance.h>

Collaboration diagram for FreqAppearance:

Classes

struct  Record
 Compact form of an appearance that Pack() fills and Unpack() reads. More...

Public Member Functions

 FreqAppearance ()
 Construct the appearance a new player starts with.
 FreqAppearance (const FreqAppearance &other)
 Copy another appearance.
virtual ~FreqAppearance ()
 Release the detail object.
virtual void Save (OBStream &stream) const
 Write the appearance to a stream.
virtual void Load (IBStream &stream)
 Read the appearance back from a stream.
void Print (std::ostream &stream) const
 Write the username and the skill status to a diagnostic stream.
void operator= (const FreqAppearance &other)
 Replace the username and the detail object with another appearance's.
void AttachToBurnSlot (int nSlot)
 Hang this appearance's avatar view in one of the four persona burn slots and show it.
void CopyFrom (const FreqAppearance &other)
 Copy another appearance through operator=().
void Pack (Record *pRecord)
 Fill a compact record from this appearance.
void Unpack (const Record &record)
 Replace this appearance from a compact record.
void SetSkillStatus (int nStatus)
 Record the skill status.
int GetSkillStatus () const
 Report the skill status.

Static Public Member Functions

static void InitBurnSlots ()
 Resolve the four burn cameras and hangpoint views once.
static void RenderBurnTextures ()
 Render each shown burn camera into its slot's persona burn texture.
static Rnd::Tex * FindPersonaBurnTexture (int nIndex)
 Resolve one numbered persona burn texture out of the render manager.
static HxStr EncodeRecord (const Record &record)
 Encode a compact record as a 256-character string with no zero bytes.
static void DecodeRecord (const HxStr &encoded, Record *pRecord)
 Decode a string EncodeRecord() wrote back into a compact record.

Public Attributes

HxStr mUserName
 Player username, starting as the literal initial name.
FreqAppearanceDetail * mDetail
 The avatar, owned, 0xb0 bytes.

Static Public Attributes

static constexpr int kRecordNameLength = 12
 The longest username a Record stores, without its terminator.
static constexpr int kRecordPartCapacity = 16
 The number of packed parts a Record has room for.

Detailed Description

Appearance of a player's avatar.

Its RTTI descriptor is at 0x0086f580. It has no base. The compiler places the vptr after the data at +0x10, and the class is 0x14 bytes. Its vtable at 0x007d98a0 has four entries and a zero terminator at index 4, the type function, the destructor, and the two transfer members.

The purpose of two of the three members is recovered from the diagnostic literals Print() writes. username= precedes the string at +0x00, so that member is the player username, and SkillStatus= precedes the word at +0x0c. The detail object at +0x08 sits behind Freq=. Both literals are display labels rather than identifiers, and they disagree with each other on capitalisation, so neither is treated as an attested member name and both members retain their recovered-purpose-pending spelling.

The layout comes from the copy constructor and the destructor together. The copy constructor takes 0xb0 bytes from the allocator for the detail object and stores the pointer at +0x08, and the destructor releases the detail object and the string buffer. The username and the detail object are public for the readers their documentation lists, and the skill status is private.

PSJoinRequestPacket::saveGuts() and PlayerInfo::Save() both delegate an embedded FreqAppearance to slot 2 of this table, and PSJoinRequestPacket::restoreGuts() and PlayerInfo::Load() delegate it to slot 3, which is what establishes the two slots as the transfer pair rather than inferring the roles from this class alone.

Constructor & Destructor Documentation

◆ FreqAppearance() [1/2]

FreqAppearance::FreqAppearance ( )

Construct the appearance a new player starts with.

The username starts as the literal initial name, a fresh 0xb0-byte detail object is allocated, and the skill status is cleared. PSJoinRequestPacket, SPJoinAcceptPacket, and PlayerInfo reach it through their own constructors.

Ghidra address:
NTSC-U/C: 0x001745b8
Ghidra address:
PAL: 0x00176f90

◆ FreqAppearance() [2/2]

FreqAppearance::FreqAppearance ( const FreqAppearance & other)

Copy another appearance.

The three members are initialised first and the assignment below then replaces the string and the detail object. The initial username and the cleared skill status therefore both survive into the copy only for as long as the assignment takes, and because the assignment does not touch the skill status, a copy always reports a skill status of zero.

Parameters
otherThe appearance to copy.
Ghidra address:
NTSC-U/C: 0x00174668
Ghidra address:
PAL: 0x00177050

◆ ~FreqAppearance()

virtual FreqAppearance::~FreqAppearance ( )
virtual

Release the detail object.

Ghidra address:
NTSC-U/C: 0x00174730
Ghidra address:
PAL: 0x00177128

Member Function Documentation

◆ Save()

virtual void FreqAppearance::Save ( OBStream & stream) const
virtual

Write the appearance to a stream.

Slot 2. A version word of 8 precedes the payload.

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

◆ Load()

virtual void FreqAppearance::Load ( IBStream & stream)
virtual

Read the appearance back from a stream.

Slot 3. The version word Save() writes is read and discarded, so no version older than the current one is handled differently.

Parameters
streamThe stream to read from.
Ghidra address:
NTSC-U/C: 0x001747a8
Ghidra address:
PAL: 0x001771b0

◆ Print()

void FreqAppearance::Print ( std::ostream & stream) const

Write the username and the skill status to a diagnostic stream.

The two literals Freq= and SkillStatus= arrive back to back with no value between them, so the detail object is never written.

The member is not virtual and occupies no table slot. PlayerInfo::Print() runs it on its embedded appearance.

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

◆ operator=()

void FreqAppearance::operator= ( const FreqAppearance & other)

Replace the username and the detail object with another appearance's.

Self-assignment is tested first and does nothing. The skill status is not copied, and the routine returns nothing.

Parameters
otherThe appearance to copy.
Ghidra address:
NTSC-U/C: 0x001748e0
Ghidra address:
PAL: 0x001772e8

◆ AttachToBurnSlot()

void FreqAppearance::AttachToBurnSlot ( int nSlot)

Hang this appearance's avatar view in one of the four persona burn slots and show it.

Runs InitBurnSlots() first and records the detail object as the slot's occupant. The slot's hangpoint view (<slot>_freq_hangpoint.view) then loses its draws and transforms, takes the avatar view as its one child for both, recomposes the avatar's world transform under it, and is shown with everything beneath it. The slot's camera (persona_texburn_<slot + 1>.cam) is shown last. MetPersonaData::AttachToBurnSlot() and the routines at 0x003455a8 and 0x0035abf8 call it, and the name is inferred.

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

◆ InitBurnSlots()

void FreqAppearance::InitBurnSlots ( )
static

Resolve the four burn cameras and hangpoint views once.

Does nothing after the first call. Otherwise it polls the FreQ maker asset load once, sizes both lists to four, resolves each camera and hides it, and resolves each hangpoint view and shows it. The name is inferred.

Ghidra address:
NTSC-U/C: 0x00171398
Ghidra address:
PAL: 0x00173cf0

◆ RenderBurnTextures()

void FreqAppearance::RenderBurnTextures ( )
static

Render each shown burn camera into its slot's persona burn texture.

Does nothing before InitBurnSlots() has run. For each slot whose camera is shown, the camera recomposes its world transform and draws twice around a GS path sync, and the camera's render target is read back and quantised into the slot's burn texture with one ramp for each part colour of the avatar hung in that slot. The burn texture's palette is then reset, and the camera is hidden. MetRenderer::DrawFrontEnd() is the one caller, and the name is inferred.

Ghidra address:
NTSC-U/C: 0x001716d0
Ghidra address:
PAL: 0x00174060

◆ FindPersonaBurnTexture()

Rnd::Tex * FreqAppearance::FindPersonaBurnTexture ( int nIndex)
static

Resolve one numbered persona burn texture out of the render manager.

The name is formatted as persona_texburn_texture_d.tex from one past the index, so index zero resolves persona_texburn_texture_1.tex. A name the manager does not recognise produces a null result, as does an object that is not a Rnd::Tex. RenderBurnTextures() expands it inline. The name is inferred.

Parameters
nIndexZero-based texture index.
Returns
The texture, or null when the manager has no such object.
Ghidra address:
NTSC-U/C: 0x001712c0
Ghidra address:
PAL: 0x00173bf8

◆ CopyFrom()

void FreqAppearance::CopyFrom ( const FreqAppearance & other)

Copy another appearance through operator=().

The image has no caller. The name is inferred.

Parameters
otherThe appearance to copy.
Ghidra address:
NTSC-U/C: 0x00174458
Ghidra address:
PAL: 0x00176e30

◆ Pack()

void FreqAppearance::Pack ( Record * pRecord)

Fill a compact record from this appearance.

The record is marked valid and takes the skill status, the username cut to 12 characters, and the packed parts of the detail object. Only the low byte of the part count survives. The image has no caller, and the name is inferred.

Parameters
pRecordThe record to fill.
Ghidra address:
NTSC-U/C: 0x00174930
Ghidra address:
PAL: 0x00177338

◆ Unpack()

void FreqAppearance::Unpack ( const Record & record)

Replace this appearance from a compact record.

A record that is not marked valid changes nothing. The image has no caller, and the name is inferred.

Parameters
recordThe record to read.
Ghidra address:
NTSC-U/C: 0x001749e8
Ghidra address:
PAL: 0x001773f0

◆ EncodeRecord()

HxStr FreqAppearance::EncodeRecord ( const Record & record)
static

Encode a compact record as a 256-character string with no zero bytes.

The record is split into 32 groups of seven bytes, zero padded, and each group becomes eight bytes through EncodeNonZeroBytes(). The encoded buffer has no terminator, and the last group's fill runs seven bytes past the buffer. The string therefore ends at the next zero byte on the stack. The image has no caller, and the name is inferred.

Parameters
recordThe record to encode.
Returns
The encoded string.
Ghidra address:
NTSC-U/C: 0x00170ca8
Ghidra address:
PAL: 0x001735b8

◆ DecodeRecord()

void FreqAppearance::DecodeRecord ( const HxStr & encoded,
Record * pRecord )
static

Decode a string EncodeRecord() wrote back into a compact record.

The string is copied over 256 bytes of 1 with no length check, and the first seven bytes of each eight-byte group are kept with each 1 turned back into zero. The mask byte is ignored, and a zero EncodeRecord() wrote as 0xff therefore decodes as 0xff. The image has no caller, and the name is inferred.

Parameters
encodedThe encoded string.
pRecordThe record to fill.
Ghidra address:
NTSC-U/C: 0x00170ee0
Ghidra address:
PAL: 0x00173818

◆ SetSkillStatus()

void FreqAppearance::SetSkillStatus ( int nStatus)
inline

Record the skill status.

Defined in the header. The one out-of-line copy is never called, and MetPersonaData::UpdateSkillStatus() expands the store where it is used.

Parameters
nStatusThe status, 0 through 4.
Ghidra address:
NTSC-U/C: 0x00174478
Ghidra address:
PAL: 0x00176e50

◆ GetSkillStatus()

int FreqAppearance::GetSkillStatus ( ) const
inline

Report the skill status.

Defined in the header. The out-of-line copy's one caller is the uncalled MetPersonaData forwarder at 0x0032e258.

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

Member Data Documentation

◆ kRecordNameLength

int FreqAppearance::kRecordNameLength = 12
staticconstexpr

The longest username a Record stores, without its terminator.

◆ kRecordPartCapacity

int FreqAppearance::kRecordPartCapacity = 16
staticconstexpr

The number of packed parts a Record has room for.

◆ mUserName

HxStr FreqAppearance::mUserName

Player username, starting as the literal initial name.

Public rather than private, because MetLoadFreqBaseScreen::UpdateNameLabel() copy-constructs an HxStr straight from +0x00 of the embedded appearance and the image has no accessor to route that read through. A friend declaration fits the image equally well. +0x00

◆ mDetail

FreqAppearanceDetail* FreqAppearance::mDetail

The avatar, owned, 0xb0 bytes.

+0x08

Public because MetFreqMakerCanvasScreen::CommitPersona(), LoadPersona(), and LoadPrefab() copy the avatar in and out of it directly, and the image has no accessor.


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