resonance 1.0.1
Loading...
Searching...
No Matches
PlayMap Class Referenceabstract

Traversal order over one playable sequence. More...

#include <playmap.h>

Inheritance diagram for PlayMap:

Public Member Functions

void * operator new (size_t nSize)
 Allocate a map from the tagged heap under the tag PlayMap.
void operator delete (void *pBlock)
 Release a map to the tagged heap under the tag PlayMap.
 PlayMap ()
 Construct an empty map whose first step is at zero.
virtual ~PlayMap ()
 Inline.
virtual void AddStep (int nPosition, HxStr strLabel)
 Slot 2.
virtual void SetBarCount (int nBarCount)
 Slot 3.
virtual void ResetSpans ()
 Slot 4.
virtual int MapBar (int nBar)=0
 Slot 5.
virtual std::vector< int > & FindBarsPlaying (int nStart, int nMin, int nEnd)=0
 Slot 6.
virtual int MapToLinkedStep (int nPosition, int nSet)
 Slot 7.
virtual int GetLength () const
 Slot 8.
virtual int GetEndBar ()
 Slot 9.
virtual int GetNumSections () const
 Slot 10.
virtual int GetPatternSection (int nIndex)
 Slot 11.
virtual int GetPatternIndex (int nBar)
 Slot 12.
virtual int GetAbsoluteSectionIndex (int nBar)
 Slot 13.
virtual int IsLooping (int nBar)
 Slot 14.
virtual void CloseSpan (int nRepeats)
 Slot 15.
virtual int EndLoop (int nBar)
 Slot 16.
virtual int StartLoop (int nBar)
 Slot 17.
virtual int ToggleLoop (int nBar)
 Slot 18.
int FindStepIndex (int nPosition)
 Report the index of the step at or before a position that has already been mapped.
int IsStepStart (int nBar)
 Report whether a bar maps exactly onto a step.
int StepStartBar (int nBar)
 Report the bar at which the step containing a bar began.
int NextStepBar (int nBar)
 Report the bar at which the first step at or after a bar begins.
int FollowingStepBar (int nBar)
 Report the bar at which the first step strictly after a bar begins.

Public Attributes

int mBarCount
 The number of bars SetBarCount() stores.
std::vector< int > mSteps
 Ascending sequence of positions.
std::vector< int > mSectionLengths
 Length of each section, the gap between one step and the previous one.
std::vector< HxStr > mSectionNames
 Label of each section, the one AddStep() receives with the step.

Protected Attributes

int mUnusedValue
std::vector< int > mFoundBars

Detailed Description

Traversal order over one playable sequence.

PlayMap in the RTTI descriptor at 0x0086f5b0, a leaf with no base list. The class is abstract: no data reference to its type function exists anywhere in the image, so no vtable carries it at slot 0 and the class is never instantiated. Three subclasses derive from it, PlayMapLinear, PlayMapRing, and PlayMapRepeatRing, which is what the two pure slots below are for.

The table runs to nineteen entries, slots 0 through 18, and terminates on the all-zero entry after them. This class implements every slot except 5 and 6, which are the only two pointing at the shared pure-virtual stub. Most of what it does implement is inert, one slot being a bare return and four returning zero, so the base reads as an interface with defaults rather than as shared behaviour.

The subclasses fill those two and then extend the table rather than overriding past its end: PlayMapRing adds nothing and keeps nineteen entries, PlayMapRepeatRing adds one for twenty, and PlayMapLinear adds two for twenty-one. None of the three retains a slot pointing at the pure-virtual stub. All three are concrete.

The object is 0x3c bytes with the vptr at +0x38. A leaf class with no base places its vptr after its data members under this toolchain, which is why the pointer is last rather than first. Its four vectors are recovered from the destructor at 0x00127158, which tears them down at +0x2c, +0x1c, +0x10, and +0x04 and so fixes their declaration order as the reverse. Element widths come from the shift each teardown uses to divide the byte span.

The destructor body is empty. Everything the compiled destructor performs is the implicit teardown of those four members, and the release of the object itself sits behind the deleting flag this toolchain passes as a second argument. The declaration is real rather than implicit, because a leaf class with no base acquires a virtual destructor only when one is declared virtual.

The class declares its own allocation pair. The release path of the destructor calls the tagged free with the literal PlayMap at 0x007d0dd0, and a tag names the class that declares the operator.

Each slot below records its table index. The index is part of the class layout, and the method titles are inferred from the bodies of the base and the three subclasses and from their callers.

Constructor & Destructor Documentation

◆ PlayMap()

PlayMap::PlayMap ( )

Construct an empty map whose first step is at zero.

Reserves eight elements in mSteps and appends the zero step, then reserves eight in mSectionLengths. Every subclass constructor runs it first.

Ghidra address:
NTSC-U/C: 0x001263c0
Ghidra address:
PAL: 0x00126a70

◆ ~PlayMap()

virtual PlayMap::~PlayMap ( )
inlinevirtual

Inline.

PlayMapLinear's destructor expands it, and the address is the out-of-line copy the unit emits for the table.

Ghidra address:
NTSC-U/C: 0x00127158
Ghidra address:
PAL: 0x00127860

Member Function Documentation

◆ operator new()

void * PlayMap::operator new ( size_t nSize)

Allocate a map from the tagged heap under the tag PlayMap.

Unlike most classes in this tree the operator has an out-of-line body, which forwards the size the compiler supplies and the tag literal to the tagged allocator.

Parameters
nSizeThe object size the compiler supplies.
Returns
The block.
Ghidra address:
NTSC-U/C: 0x00127118
Ghidra address:
PAL: 0x00127820

◆ operator delete()

void PlayMap::operator delete ( void * pBlock)

Release a map to the tagged heap under the tag PlayMap.

Parameters
pBlockThe block.
Ghidra address:
NTSC-U/C: 0x00127138
Ghidra address:
PAL: 0x00127840

◆ AddStep()

virtual void PlayMap::AddStep ( int nPosition,
HxStr strLabel )
virtual

Slot 2.

Appends one step, its distance from the previous step, and a label.

The body appends nPosition - mSteps.back() to mSectionLengths, then nPosition to mSteps, then the label to mSectionNames. mSectionLengths therefore stores the gap between consecutive steps and is one element behind mSteps until this call completes. Reading mSteps.back() is unconditional, and the first call requires a step to already be present.

The second parameter is passed by value. The body copy-constructs it into mSectionNames through HxStr::HxStr(const HxStr &) at 0x004b7b50 and then releases the parameter's own buffer, which is this toolchain destroying a by-value class parameter in the callee.

Parameters
nPositionThe step position.
strLabelThe label, passed by value.
Ghidra address:
NTSC-U/C: 0x001268b0
Ghidra address:
PAL: 0x00126f70

◆ SetBarCount()

virtual void PlayMap::SetBarCount ( int nBarCount)
virtual

Slot 3.

Stores its argument in mBarCount and does nothing else.

Parameters
nBarCountThe value to store.
Ghidra address:
NTSC-U/C: 0x00127488
Ghidra address:
PAL: 0x00127ba8

Reimplemented in PlayMapRepeatRing.

◆ ResetSpans()

virtual void PlayMap::ResetSpans ( )
virtual

Slot 4.

Empty in this class. PlayMapRepeatRing resets its spans here.

Ghidra address:
NTSC-U/C: 0x00127398
Ghidra address:
PAL: 0x00127ab8

Reimplemented in PlayMapRepeatRing.

◆ MapBar()

virtual int PlayMap::MapBar ( int nBar)
pure virtual

Slot 5.

Maps a bar to its position in the sequence, pure here and overridden by every subclass.

The signature is recovered from both sides. GetPatternIndex() and GetAbsoluteSectionIndex() forward their own argument without touching a1 and then consume the result in v0, and each override reads that argument and returns a value. PlayMapRing at 0x0012e408 returns (nBar + mBarCount) % mSteps.back(), the wrap its name implies.

GetPatternIndex() and GetAbsoluteSectionIndex() take the delta for this dispatch into a0 rather than a1. Using a0 preserves the forwarded argument and is the reason the argument is recoverable at all.

Parameters
nBarThe bar to map.
Returns
The mapped position.

Implemented in PlayMapLinear, PlayMapRepeatRing, and PlayMapRing.

◆ FindBarsPlaying()

virtual std::vector< int > & PlayMap::FindBarsPlaying ( int nStart,
int nMin,
int nEnd )
pure virtual

Slot 6.

Collects the bars that play one position into mFoundBars, pure here.

The signature comes from PlayMapRing at 0x0012dad8. The override clears mFoundBars, walks a value from the first argument upward in steps of mSteps.back() while it remains below the third, appends every value not below the second, and returns the vector itself. The return is the address of the member, which is a reference in the original.

Parameters
nStartThe first position.
nMinThe lowest position to collect.
nEndThe position to stop below.
Returns
mFoundBars.

Implemented in PlayMapLinear, PlayMapRepeatRing, and PlayMapRing.

◆ MapToLinkedStep()

virtual int PlayMap::MapToLinkedStep ( int nPosition,
int nSet )
virtual

Slot 7.

Returns its first argument unchanged.

PlayMapLinear moves the position to the step linked with its own in a step ring. The second parameter is proven by PlayMapLinear::MapToLinkedStep() indexing its per-set table with it, and by PhraseMgr's routine at 0x001c0298 passing its track there.

Parameters
nPositionThe position to map.
nSetThe set PlayMapLinear selects its table with. Not read here.
Returns
nPosition.
Ghidra address:
NTSC-U/C: 0x001273b8
Ghidra address:
PAL: 0x00127ad8

Reimplemented in PlayMapLinear.

◆ GetLength()

virtual int PlayMap::GetLength ( ) const
virtual

Slot 8.

Returns the last element of mSteps, the end of the positions the map has set out.

Ghidra address:
NTSC-U/C: 0x001273c0
Ghidra address:
PAL: 0x00127ae0

Reimplemented in PlayMapLinear, and PlayMapRing.

◆ GetEndBar()

virtual int PlayMap::GetEndBar ( )
virtual

Slot 9.

Forwards to GetLength() through the table rather than calling it directly.

Callers read the result as the last bar of the level.

Ghidra address:
NTSC-U/C: 0x001273d0
Ghidra address:
PAL: 0x00127af0

Reimplemented in PlayMapLinear.

◆ GetNumSections()

virtual int PlayMap::GetNumSections ( ) const
virtual

Slot 10.

Returns the number of sections, one less than the number of elements in mSteps.

Ghidra address:
NTSC-U/C: 0x00127440
Ghidra address:
PAL: 0x00127b60

Reimplemented in PlayMapLinear.

◆ GetPatternSection()

virtual int PlayMap::GetPatternSection ( int nIndex)
virtual

Slot 11.

Returns its argument unchanged.

PlayMapLinear returns the section its recorded pattern plays at the index.

Parameters
nIndexThe index into the pattern.
Returns
nIndex.
Ghidra address:
NTSC-U/C: 0x00127458
Ghidra address:
PAL: 0x00127b78

Reimplemented in PlayMapLinear.

◆ GetPatternIndex()

virtual int PlayMap::GetPatternIndex ( int nBar)
virtual

Slot 12.

Reports the index of the step at or before the position MapBar() returns.

The body forwards its argument to MapBar() through the table, searches mSteps for the value that returns with an upper bound, and reports the distance from the start to the element before the result. MapBar() is pure here. The search key comes from whichever subclass is running.

Parameters
nBarThe bar to map through MapBar().
Returns
The step index.
Ghidra address:
NTSC-U/C: 0x001276a0
Ghidra address:
PAL: 0x00127dc0

Reimplemented in PlayMapLinear.

◆ GetAbsoluteSectionIndex()

virtual int PlayMap::GetAbsoluteSectionIndex ( int nBar)
virtual

Slot 13.

Reports the same step index with a multiple of the last step folded in.

The body performs the search GetPatternIndex() performs, forwarding the same argument to MapBar(), and then adds nTotal * (nBar - nBar % nTotal) to the index, where nTotal is mSteps.back(). Multiplying by nTotal after rounding nBar down to a multiple of nTotal scales the term by nTotal twice. The doubling reads as an error, but the binary computes it.

Parameters
nBarThe bar to map through MapBar() and to fold in.
Returns
The step index plus the folded term.
Ghidra address:
NTSC-U/C: 0x00127700
Ghidra address:
PAL: 0x00127e20

Reimplemented in PlayMapLinear.

◆ IsLooping()

virtual int PlayMap::IsLooping ( int nBar)
virtual

Slot 14.

Returns zero, ignoring its argument.

The parameter is proven by HudPosition's update at 0x0041b060, which passes the current bar in a1, and by PlayMapLinear::IsLooping, an override that reads it.

Parameters
nBarThe bar.
Returns
Zero here.
Ghidra address:
NTSC-U/C: 0x00127460
Ghidra address:
PAL: 0x00127b80

Reimplemented in PlayMapLinear.

◆ CloseSpan()

virtual void PlayMap::CloseSpan ( int nRepeats)
virtual

Slot 15.

Empty in this class, and it takes an argument the empty body cannot reveal.

The body is jr ra and reads no argument register, which is no evidence about the parameter list. PlayMapRepeatRing's override at 0x0012bc48 multiplies a1 by a step gap before storing the result, so the member takes an int.

Parameters
nRepeatsThe multiplier the override applies to a step gap.
Ghidra address:
NTSC-U/C: 0x00127468
Ghidra address:
PAL: 0x00127b88

Reimplemented in PlayMapRepeatRing.

◆ EndLoop()

virtual int PlayMap::EndLoop ( int nBar)
virtual

Slot 16.

Returns zero, ignoring its argument.

PlayMapLinear's override at 0x00128ed8 passes a1 to the routine at 0x00129150, which is what proves the bar parameter. Gamer calls it with the current bar.

Parameters
nBarThe bar.
Ghidra address:
NTSC-U/C: 0x00127470
Ghidra address:
PAL: 0x00127b90

Reimplemented in PlayMapLinear, and PlayMapRepeatRing.

◆ StartLoop()

virtual int PlayMap::StartLoop ( int nBar)
virtual

Slot 17.

Returns zero, ignoring its argument.

PlayMapRepeatRing's override at 0x0012bdd8 stores a1 as the search key it passes to the routine at 0x00105de8.

Parameters
nBarThe bar.
Ghidra address:
NTSC-U/C: 0x00127478
Ghidra address:
PAL: 0x00127b98

Reimplemented in PlayMapLinear, and PlayMapRepeatRing.

◆ ToggleLoop()

virtual int PlayMap::ToggleLoop ( int nBar)
virtual

Slot 18.

Returns zero, ignoring its argument.

Both overrides forward a1 to EndLoop() and StartLoop().

Parameters
nBarThe bar.
Ghidra address:
NTSC-U/C: 0x00127480
Ghidra address:
PAL: 0x00127ba0

Reimplemented in PlayMapLinear, and PlayMapRepeatRing.

◆ FindStepIndex()

int PlayMap::FindStepIndex ( int nPosition)

Report the index of the step at or before a position that has already been mapped.

GetPatternIndex() performs the same search on the result of MapBar(). This routine receives the mapped position directly. PhraseDatabase::GetStepValue() is the recovered caller.

Parameters
nPositionThe mapped position.
Returns
The index of the last step at or before nPosition, or -1 when every step follows it.
Ghidra address:
NTSC-U/C: 0x00127490
Ghidra address:
PAL: 0x00127bb0

◆ IsStepStart()

int PlayMap::IsStepStart ( int nBar)

Report whether a bar maps exactly onto a step.

Parameters
nBarThe bar.
Returns
Non-zero when MapBar() of the bar is an element of mSteps. A negative bar reports zero.
Ghidra address:
NTSC-U/C: 0x001274d8
Ghidra address:
PAL: 0x00127bf8

◆ StepStartBar()

int PlayMap::StepStartBar ( int nBar)

Report the bar at which the step containing a bar began.

Parameters
nBarThe bar.
Returns
nBar less its distance past the last step at or before its mapped position.
Ghidra address:
NTSC-U/C: 0x00127548
Ghidra address:
PAL: 0x00127c68

◆ NextStepBar()

int PlayMap::NextStepBar ( int nBar)

Report the bar at which the first step at or after a bar begins.

Parameters
nBarThe bar.
Returns
nBar plus its distance to the lower bound of its mapped position in mSteps. A negative bar reports zero.
Ghidra address:
NTSC-U/C: 0x001275b0
Ghidra address:
PAL: 0x00127cd0

◆ FollowingStepBar()

int PlayMap::FollowingStepBar ( int nBar)

Report the bar at which the first step strictly after a bar begins.

Parameters
nBarThe bar.
Returns
nBar plus its distance to the upper bound of its mapped position in mSteps. A negative bar reports zero.
Ghidra address:
NTSC-U/C: 0x00127628
Ghidra address:
PAL: 0x00127d48

Member Data Documentation

◆ mBarCount

int PlayMap::mBarCount

The number of bars SetBarCount() stores.

Public because BGTrackGraph::BuildSequencer() reads it directly at 0x0013fc7c as the bound of its walk over the track's bars, and the image has no accessor. PlayMapRing adds it to a position as the offset its ring starts at. +0x00

◆ mSteps

std::vector<int> PlayMap::mSteps

Ascending sequence of positions.

GetLength(), GetNumSections(), GetPatternIndex(), and GetAbsoluteSectionIndex() read the last element, the count, and an upper bound over this vector, and AddStep() appends to it. The element type is int, from the four-byte stride of every access. Public because the PhraseDatabase constructor at 0x001b72d8 reads its last element and its count directly and the image exposes no accessor. A friend declaration fits the image equally well. +0x04

◆ mSectionLengths

std::vector<int> PlayMap::mSectionLengths

Length of each section, the gap between one step and the previous one.

+0x10

AddStep() appends to it. Public because HudPosition's constructor at 0x00419f88 reads it directly, indexed by GetPatternSection(), to size each section of the position display, and the image has no accessor for it.

◆ mSectionNames

std::vector<HxStr> PlayMap::mSectionNames

Label of each section, the one AddStep() receives with the step.

+0x1c

Public because HudPosition's constructor reads it directly, indexed by GetPatternSection(), for the section labels of the position display, and the image has no accessor for it.

◆ mUnusedValue

int PlayMap::mUnusedValue
protected

◆ mFoundBars

std::vector<int> PlayMap::mFoundBars
protected

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