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

One controller's mapping from gameplay actions to buttons. More...

#include <controllerconfig.h>

Public Types

enum  Slot {
  kSlotRotateRight = 0 , kSlotRotateLeft = 1 , kSlotAdvance = 2 , kSlotLoop = 3 ,
  kSlotPitchRiffFirst = 4 , kSlotErase = 10 , kSlotAxisFX = 11 , kSlotAxisRegister = 12 ,
  kSlotAxisX = 13 , kSlotAxisY = 14 , kSlotButtonPow = 15 , kSlotPlayback = 16 ,
  kSlotCount = 17
}
 The action slots, in mButtons order. More...

Public Member Functions

 ControllerConfig ()
 Start with the default mapping.
void SetButton (int nRow, int nButtonIndex)
 Assign one button, by index, to the action one configuration row controls.
int ActionCode (int nSlot)
 Report the four-character action code of one slot.
void Load (IBStream &stream)
 Read the mapping back.
int GetButtonIndex (int nRow)
 Report the button index one configuration row is mapped to.
int ButtonCode (int nButtonIndex)
 Translate a button index into its stored button code.
int ButtonIndex (int nCode)
 Translate a stored button code into its button index.
int ActionSlot (int nRow)
 Translate a configuration row into the slot it controls.
int RiffIndex (int nSlot)
 Report which riff a pitch-riff slot belongs to.
void Save (OBStream &stream)
 Write the record version 4, the slot count, and every button code.
ControllerConfig & operator= (const ControllerConfig &other)
 Copy another mapping.

Public Attributes

std::vector< int > mButtons
 The button code of each slot.

Detailed Description

One controller's mapping from gameplay actions to buttons.

The class is not polymorphic and emits no RTTI descriptor. The name is inferred from the labels Controller Config 1 through Controller Config 4 that GlobalSettings::Print() writes for the four instances GlobalSettings embeds. The object is the 12 bytes of its one vector, which the GlobalSettings layout fixes. The destructor is compiler-generated and inline.

mButtons has one entry per action slot. The configuration screen addresses the mapping by row and by button index, and ActionSlot(), ButtonCode(), and ButtonIndex() translate between those and the stored slot and button codes. Codes 100 through 103 are the two analog sticks' axes, and codes 11 and 12 are the two stick presses.

The translation unit also holds three uncalled template library emissions at 0x00164150, 0x001643c8, and 0x001647e8, which are not declared.

Member Enumeration Documentation

◆ Slot

The action slots, in mButtons order.

Enumerator
kSlotRotateRight 

rotR.

kSlotRotateLeft 

rotL.

kSlotAdvance 

advn.

kSlotLoop 

loop.

kSlotPitchRiffFirst 

The first of six rpch slots, two per riff.

kSlotErase 

eras.

kSlotAxisFX 

axfx.

kSlotAxisRegister 

regi.

kSlotAxisX 

powx.

kSlotAxisY 

powy.

kSlotButtonPow 

powb.

kSlotPlayback 

pbck.

kSlotCount 

The number of slots.

Constructor & Destructor Documentation

◆ ControllerConfig()

ControllerConfig::ControllerConfig ( )

Start with the default mapping.

Ghidra address:
NTSC-U/C: 0x00163a88
Ghidra address:
PAL: 0x00165b38

Member Function Documentation

◆ SetButton()

void ControllerConfig::SetButton ( int nRow,
int nButtonIndex )

Assign one button, by index, to the action one configuration row controls.

Button index 8 or 9 selects a stick rather than a button. Choosing one for the effect row or the register row places that stick on the effect and register slots and the other stick on the power axes, with the matching stick press on kSlotButtonPow. Choosing one for either power-axis row does the same with the sticks swapped. A stick chosen for any other row changes nothing.

Parameters
nRowThe configuration row, 0 through 8.
nButtonIndexThe button index, 0 through 9.
Ghidra address:
NTSC-U/C: 0x00163c28
Ghidra address:
PAL: 0x00165cd8

◆ ActionCode()

int ControllerConfig::ActionCode ( int nSlot)

Report the four-character action code of one slot.

InputMap::Rebuild() calls it. The body does not read this object.

Parameters
nSlotThe slot.
Returns
The action code, or zero for a slot out of range.
Ghidra address:
NTSC-U/C: 0x00163d50
Ghidra address:
PAL: 0x00165e00

◆ Load()

void ControllerConfig::Load ( IBStream & stream)

Read the mapping back.

A record older than version 4 is read into a discarded vector, and the mapping keeps its current contents.

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

◆ GetButtonIndex()

int ControllerConfig::GetButtonIndex ( int nRow)

Report the button index one configuration row is mapped to.

Parameters
nRowThe configuration row, 0 through 8.
Returns
The button index, or -1 when the stored code has none.
Ghidra address:
NTSC-U/C: 0x00164b00
Ghidra address:
PAL: 0x00166bb0

◆ ButtonCode()

int ControllerConfig::ButtonCode ( int nButtonIndex)

Translate a button index into its stored button code.

Parameters
nButtonIndexThe button index, 0 through 9.
Returns
The code, 500 or 501 for the two stick choices, or -1 out of range.
Ghidra address:
NTSC-U/C: 0x00164b40
Ghidra address:
PAL: 0x00166bf0

◆ ButtonIndex()

int ControllerConfig::ButtonIndex ( int nCode)

Translate a stored button code into its button index.

Both axes of a stick report that stick's index.

Parameters
nCodeThe code.
Returns
The button index, or -1 for a code with none.
Ghidra address:
NTSC-U/C: 0x00164bc0
Ghidra address:
PAL: 0x00166c70

◆ ActionSlot()

int ControllerConfig::ActionSlot ( int nRow)

Translate a configuration row into the slot it controls.

Parameters
nRowThe configuration row, 0 through 8.
Returns
The slot, or -1 out of range.
Ghidra address:
NTSC-U/C: 0x00164c40
Ghidra address:
PAL: 0x00166cf0

◆ RiffIndex()

int ControllerConfig::RiffIndex ( int nSlot)

Report which riff a pitch-riff slot belongs to.

InputMap::Rebuild() calls it.

Parameters
nSlotThe slot.
Returns
0, 1, or 2 for the three pairs of pitch-riff slots, and 0 for every other slot.
Ghidra address:
NTSC-U/C: 0x00164cb8
Ghidra address:
PAL: 0x00166d68

◆ Save()

void ControllerConfig::Save ( OBStream & stream)

Write the record version 4, the slot count, and every button code.

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

◆ operator=()

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

Copy another mapping.

Parameters
otherThe mapping to copy.
Returns
This mapping.
Ghidra address:
NTSC-U/C: 0x00164dd0
Ghidra address:
PAL: 0x00166e80

Member Data Documentation

◆ mButtons

std::vector<int> ControllerConfig::mButtons

The button code of each slot.

Public because InputMap::Rebuild() walks it. +0x00


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