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

Settings a game session is started with. More...

#include <gameparams.h>

Collaboration diagram for GameParams:

Public Member Functions

 GameParams ()
 Start with every member clear.
 GameParams (const GameParams &other)=default
 Copy every member in declaration order.
virtual ~GameParams ()
 Release the three strings.
virtual void Save (OBStream *pStream) const
 Write the settings to a stream.
virtual void Load (IBStream *pStream)
 Read the settings back from a stream.
GameParams & operator= (const GameParams &other)
 Copy every member except mUnsavedString from another instance.
bool operator== (const GameParams &other) const
 Compare every member except mUnsavedString with another instance, the set operator=() copies.
void Print (std::ostream &stream) const
 Write the settings to a diagnostic stream on one line, ending it with a newline.

Public Attributes

HxStr mLevelName
 The level the session plays.
HxStr mArenaName
 The arena the session plays in.
int mPlayMode
int mDifficulty
int mNetGame
 Written by GameManagerImpl::SetGameMode() as the test for net, 0 or 1, and labelled netgame= by Print().
int mLoadingGame
 Set while a saved game is loading, labelled loadinggame= by Print().
int mJukeboxMode
 Set for a jukebox session.

Detailed Description

Settings a game session is started with.

Its RTTI descriptor is at 0x0086f628. It has no base. The compiler places the vptr after the data at +0x34, and the class is 0x38 bytes. Its vtable at 0x007db5a0 has four entries and a zero terminator at index 4. The destructor and the two transfer members are the whole set of virtuals.

The layout comes from the constructor, the destructor, and the copy constructor together. The constructor zeroes every word from +0x00 to +0x30 in ascending order, the destructor releases the buffers at +0x18, +0x0c, and +0x04 in reverse declaration order, and the copy constructor at 0x001fc480 copies all ten members in declaration order. The GameManagerImpl destructor corroborates the three strings independently by releasing their buffers at +0x6c, +0x74, and +0x80 of a manager whose settings start at +0x68.

That copy constructor is the compiler-generated one and is therefore not declared here. Two measurements agree. It copies every member in exact declaration order with no logic of its own, and it sits at 0x001fc480 while every hand-written member of the class sits in the 0x00187xxx run, which places it in the translation unit that copies a GameParams rather than in the one that defines the class.

The purpose of most members is not recovered. Three of the ten are public because GameManagerImpl reads and writes them directly with no accessor in the image, and the two names are public because Renderer::LoadLevel() reads them directly, as is the jukebox flag, which Globals::IsJukeboxMode() reads, and the loading flag, which MetStageFinishScreen reads. A friend declaration on this class would fit the image equally well as the promotion. The other three have no traced reader and stay private.

mUnsavedString is the one member that neither Save(), Load(), nor operator=() touches, and the compiler-generated copy constructor is the only routine in the image that copies it.

This class is declared because several network packets embed one.

Constructor & Destructor Documentation

◆ GameParams() [1/2]

GameParams::GameParams ( )

Start with every member clear.

Ghidra address:
NTSC-U/C: 0x00187170
Ghidra address:
PAL: 0x0018c960

◆ GameParams() [2/2]

GameParams::GameParams ( const GameParams & other)
default

Copy every member in declaration order.

Defaulted rather than written, because the routine at 0x001fc480 is the compiler-generated copy constructor, as the class documentation records. Declaring it is what the destructor and the assignment operator below make necessary: a user-declared destructor deprecates an implicit copy constructor, and the three packets that embed a GameParams copy one.

Ghidra address:
NTSC-U/C: 0x001fc480
Ghidra address:
PAL: 0x002038c8

◆ ~GameParams()

virtual GameParams::~GameParams ( )
virtual

Release the three strings.

The declaration is first among the class's virtuals, which is what places it at vtable slot 1. The body is empty, and the three releases are the compiler-generated member destructor calls. The GameManagerImpl destructor inlines the whole sequence.

Ghidra address:
NTSC-U/C: 0x00187940
Ghidra address:
PAL: 0x0018d138

Member Function Documentation

◆ Save()

virtual void GameParams::Save ( OBStream * pStream) const
virtual

Write the settings to a stream.

Slot 2. GameManagerImpl::Save() runs it after writing its own three words.

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

◆ Load()

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

Read the settings back from a stream.

Slot 3. GameManagerImpl::Load() runs it after reading its own three words. The fields come back in the order Save() wrote them.

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

◆ operator=()

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

Copy every member except mUnsavedString from another instance.

Self-assignment is not tested, and the routine returns this instance.

Parameters
otherThe settings to copy.
Returns
This instance.
Ghidra address:
NTSC-U/C: 0x00187be8
Ghidra address:
PAL: 0x0018d470

◆ operator==()

bool GameParams::operator== ( const GameParams & other) const

Compare every member except mUnsavedString with another instance, the set operator=() copies.

The level name and the arena are compared as strings and the other seven words as integers, in declaration order, stopping at the first difference. The shipped program does not call it, and the title is inferred from the shape.

Parameters
otherThe settings to compare with.
Returns
Whether every compared member is equal.
Ghidra address:
NTSC-U/C: 0x00187b20
Ghidra address:
PAL: 0x0018d3a8

◆ Print()

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

Write the settings to a diagnostic stream on one line, ending it with a newline.

Not virtual. The labels are GameParams:, level=, arena=, friends=, then game or jam for a play mode of 1 or anything else, difficulty=, constrain-jam when mConstrainJam is set, and then netgame=, loadinggame=, and jukeboxmode=, each of the last three written with no separating space. SPJoinAcceptPacket, BSLoadLevelPacket, and SCLoadLevelPacket call it from their own Print().

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

Member Data Documentation

◆ mLevelName

HxStr GameParams::mLevelName

The level the session plays.

+0x00

Public because Renderer::LoadLevel() copies it directly to build the level's load path, and the image has no accessor for it.

◆ mArenaName

HxStr GameParams::mArenaName

The arena the session plays in.

+0x08

Public on the same evidence as mLevelName.

◆ mPlayMode

int GameParams::mPlayMode

Driven by GameManagerImpl slots 29 and 31, the play mode. +0x1c

◆ mDifficulty

int GameParams::mDifficulty

Driven by GameManagerImpl slots 28 and 30, the difficulty. +0x20

◆ mNetGame

int GameParams::mNetGame

Written by GameManagerImpl::SetGameMode() as the test for net, 0 or 1, and labelled netgame= by Print().

+0x28

◆ mLoadingGame

int GameParams::mLoadingGame

Set while a saved game is loading, labelled loadinggame= by Print().

+0x2c

Public because MetStageFinishScreen::EnterAndShow() reads it directly, and the image has no GameParams accessor for it.

◆ mJukeboxMode

int GameParams::mJukeboxMode

Set for a jukebox session.

+0x30

Overlay's constructor shows Jukebox Mode while it is set, and HudFreq hides its icon. Public because Globals::IsJukeboxMode() reads it directly, and the image has no GameParams accessor for it.


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