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

Ring of front-end buttons with one of them selected. More...

#include <metbuttonlist.h>

Collaboration diagram for MetButtonList:

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 under the same tag.
 MetButtonList ()
 Construct an empty list with nothing selected.
virtual ~MetButtonList ()
 Release every button reference and the vector.
virtual void SelectPrevious ()
 Move the selection to the previous enabled button, wrapping from the first to the last.
virtual void SelectNext ()
 Move the selection to the next enabled button, wrapping from the last to the first.
virtual void ChangeButtonSelected (int nPreviousIndex, int nIndex)
 Respond to the selection moving.
void Clear ()
 Release every button reference and empty mButtons.
void Add (const HxStr &objectName, const HxStr &labelText)
 Resolve one button by object name and append it.
void Append (Rnd::Button *pButton, const HxStr &labelText)
 Append one resolved button and apply its label.
void SetSelected (int nIndex)
 Move the selection to one index.
Rnd::Button * GetButton (int nIndex) const
 Resolve one button by index.

Public Attributes

Rnd::Button * mSelectedButton
 The button SetSelected() last stored.
std::vector< Rnd::Button * > mButtons
 The buttons in list order.
int mSelected
 Index of the selected button, or -1 for none.

Detailed Description

Ring of front-end buttons with one of them selected.

Its RTTI descriptor is at 0x0086f5f8. 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 +0x14, and the object is 0x18 bytes. The five-entry vtable is at 0x007e90f8.

The class supplies its own allocation function, which tags every instance with the literal MetButtonList at 0x007e8e10. That is the one place in the foundation where a Met class declares operator new.

Both navigation virtuals walk mButtons in their own direction, wrap at the end, and skip an entry whose field at +0x1c equals 3, which is how a disabled button is passed over. Both stop after visiting every entry, so a list in which every button is disabled retains the mSelected value it had before the call.

The four declared virtuals are the destructor at 0x001fca30, the two navigation routines at 0x001fcc40 and 0x001fcd10, and the selection-change notification at 0x001feed8. The titles of the two navigation routines are inferred from what the bodies do.

The constructor at 0x001fc9f8 is inline. It writes the vptr, zeroes the first word and the vector, and sets mSelected to -1, which is the sentinel for no selection that the selection-change routine tests for.

Constructor & Destructor Documentation

◆ MetButtonList()

MetButtonList::MetButtonList ( )
inline

Construct an empty list with nothing selected.

Inline. MetArenasScreen's constructor calls the out-of-line copy.

Ghidra address:
NTSC-U/C: 0x001fc9f8
Ghidra address:
PAL: 0x00203ea0

◆ ~MetButtonList()

virtual MetButtonList::~MetButtonList ( )
virtual

Release every button reference and the vector.

Ghidra address:
NTSC-U/C: 0x001fca30
Ghidra address:
PAL: 0x00203ed8

Member Function Documentation

◆ operator new()

void * MetButtonList::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: 0x001fecc8
Ghidra address:
PAL: 0x00206198

◆ operator delete()

void MetButtonList::operator delete ( void * pBlock)

Release an instance to the tagged heap under the same tag.

The out-of-line copy has no caller.

Parameters
pBlockThe block.
Ghidra address:
NTSC-U/C: 0x001fece8
Ghidra address:
PAL: 0x002061b8

◆ SelectPrevious()

virtual void MetButtonList::SelectPrevious ( )
virtual

Move the selection to the previous enabled button, wrapping from the first to the last.

Slot 2. The body steps mSelected down by one. MetMainScreen at 0x002c6820 and MetLoadFreqBaseScreen::HandleCommand() route kMetScreenCommandPrevious here.

Ghidra address:
NTSC-U/C: 0x001fcc40
Ghidra address:
PAL: 0x002040e8

◆ SelectNext()

virtual void MetButtonList::SelectNext ( )
virtual

Move the selection to the next enabled button, wrapping from the last to the first.

Slot 3. The body steps mSelected up by one, and the screens route kMetScreenCommandNext here.

Ghidra address:
NTSC-U/C: 0x001fcd10
Ghidra address:
PAL: 0x002041b8

◆ ChangeButtonSelected()

virtual void MetButtonList::ChangeButtonSelected ( int nPreviousIndex,
int nIndex )
virtual

Respond to the selection moving.

Slot 4. SetSelected() and both navigation slots call it with the index that was selected and the index that is now selected, in that order. The body puts the previous button back into state 0 and the new one into state 1.

Parameters
nPreviousIndexThe index the selection had.
nIndexThe index the selection now has.
Ghidra address:
NTSC-U/C: 0x001feed8
Ghidra address:
PAL: 0x002063a8

◆ Clear()

void MetButtonList::Clear ( )

Release every button reference and empty mButtons.

The body is the vector clear over mButtons, reached as this + 4, with the per-element release at 0x00520be0. Every class with a vector of four-byte elements shares this body.

Ghidra address:
NTSC-U/C: 0x001fedb0
Ghidra address:
PAL: 0x00206280

◆ Add()

void MetButtonList::Add ( const HxStr & objectName,
const HxStr & labelText )

Resolve one button by object name and append it.

The object is resolved through Rnd::Manager::Find() on Rnd::TheManager and cast to Rnd::Button. A name that resolves to nothing reports through 0x0053dde0 and the null is appended regardless, which is why every reader tests an entry before using it. A label of length zero is not applied, and every MetLoadFreqBaseScreen call site passes the empty literal so that the label is set later by MetLoadFreqBaseScreen::UpdateNameLabel() instead.

Parameters
objectNameThe button object as written in the .rnd file.
labelTextThe text for the button's label child, or the empty string for none.
Ghidra address:
NTSC-U/C: 0x001fcb28
Ghidra address:
PAL: 0x00203fd0

◆ Append()

void MetButtonList::Append ( Rnd::Button * pButton,
const HxStr & labelText )
inline

Append one resolved button and apply its label.

Inline. Add() expands it after resolving the button, and the out-of-line copy has no caller. A label of length zero is not applied. The title is inferred.

Parameters
pButtonThe button, or null.
labelTextThe text for the button's label child, or the empty string for none.
Ghidra address:
NTSC-U/C: 0x001fed30
Ghidra address:
PAL: 0x00206200

◆ SetSelected()

void MetButtonList::SetSelected ( int nIndex)

Move the selection to one index.

A call on an empty list does nothing, and so does a call with the index already selected. The sentinel -1 puts the previously selected button back into state 0 and selects nothing. Any other index runs the selection-change notification in vtable slot 4.

The routine then stores mButtons[nIndex] into mSelectedButton on every path, including the sentinel path, where the index is -1 and the read is one element below the first. That is what the binary does.

Parameters
nIndexThe index to select, or -1 for none.
Ghidra address:
NTSC-U/C: 0x001fee08
Ghidra address:
PAL: 0x002062d8

◆ GetButton()

Rnd::Button * MetButtonList::GetButton ( int nIndex) const

Resolve one button by index.

Parameters
nIndexThe index, or -1.
Returns
The button, or null for the -1 sentinel. An index past the end is not checked.
Ghidra address:
NTSC-U/C: 0x001fef40
Ghidra address:
PAL: 0x00206410

Member Data Documentation

◆ mSelectedButton

Rnd::Button* MetButtonList::mSelectedButton

The button SetSelected() last stored.

SetSelected() writes mButtons[nIndex] here on every path, including the path that takes the -1 sentinel, where the read is one element below the first.

Public rather than private, because MetLoadFreqBaseScreen::HandleCommand() passes it straight to MetScreen::StartRepeatingSound() and the image has no accessor to route that read through. A friend declaration fits the image equally well. +0x00

◆ mButtons

std::vector<Rnd::Button *> MetButtonList::mButtons

The buttons in list order.

The element is Rnd::Button rather than Rnd::Object. Add() appends the result of a dynamic_cast to Rnd::Button, and both navigation virtuals read Rnd::Button::mState at +0x1c to pass over a disabled entry.

Public rather than private, because MetMsgScreen::Refresh() at 0x002ecd10 reads its size directly and the image has no accessor to route that read through. +0x04

◆ mSelected

int MetButtonList::mSelected

Index of the selected button, or -1 for none.

Public rather than private, because MetLoadFreqBaseScreen reads it directly and the image has no accessor to route that read through. A friend declaration fits the image equally well. +0x10


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