wavelength 1.0.0
Loading...
Searching...
No Matches
InputMap Class Reference

The actions a player's controller buttons and analogue sticks are bound to. More...

#include <inputmap.h>

Public Member Functions

 InputMap ()
 Build a map with every button and stick binding cleared.
 InputMap (const InputMap &other)
 Construct a copy of another map.
 ~InputMap ()
InputMap & operator= (const InputMap &other)
 Copy the button and stick bindings of another map.
int GetButtonAction (int nButton)
 Report the action a controller button is bound to.
void SetButtonAction (int nButton, int nAction)
 Bind a controller button to an action.
void SetStickAction (int nStick, int nAction)
 Bind an analogue stick to an action.
int GetStickAction (int nStick)
 Report the action an analogue stick is bound to.
int FindStick (int nAction)
 Find the analogue stick bound to an action.
void Load (const DataArray *pConfig)
 Load the bindings a configuration array lists.
void LoadDefaults ()
 Load the bindings the "input_map" entry of the "db" configuration section lists.
void Save (BinStream &stream) const
 Write the number of buttons, the button bindings, the number of sticks, and the stick bindings.
void Load (BinStream &stream)
 Read the bindings Save() wrote.

Static Public Attributes

static constexpr int kButtonCount = 24
 The number of controller buttons the map binds.
static constexpr int kStickCount = 2
 The number of analogue sticks the map binds.

Detailed Description

The actions a player's controller buttons and analogue sticks are bound to.

The class is not polymorphic and has no RTTI. The name comes from the "input_map" configuration entry LoadDefaults() reads. Each Campaign has one, and InputMgr reads the bindings of every pad.

Constructor & Destructor Documentation

◆ InputMap() [1/2]

InputMap::InputMap ( )

Build a map with every button and stick binding cleared.

Ghidra address:
NTSC-U/C: 0x0027d5c0
Ghidra address:
PAL: 0x00286ed8

◆ InputMap() [2/2]

InputMap::InputMap ( const InputMap & other)

Construct a copy of another map.

Parameters
otherThe map to copy.
Ghidra address:
NTSC-U/C: 0x0027d700
Ghidra address:
PAL: 0x00287018

◆ ~InputMap()

InputMap::~InputMap ( )
Ghidra address:
NTSC-U/C: 0x0027d908
Ghidra address:
PAL: 0x00287220

Member Function Documentation

◆ operator=()

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

Copy the button and stick bindings of another map.

Parameters
otherThe map to copy.
Returns
The map.
Ghidra address:
NTSC-U/C: 0x0027d9f0
Ghidra address:
PAL: 0x00287308

◆ GetButtonAction()

int InputMap::GetButtonAction ( int nButton)

Report the action a controller button is bound to.

Parameters
nButtonThe button.
Returns
The action.
Ghidra address:
NTSC-U/C: 0x0027dad0
Ghidra address:
PAL: 0x002873e8

◆ SetButtonAction()

void InputMap::SetButtonAction ( int nButton,
int nAction )

Bind a controller button to an action.

Parameters
nButtonThe button.
nActionThe action, or 0 to clear the binding.
Ghidra address:
NTSC-U/C: 0x0027dab8
Ghidra address:
PAL: 0x002873d0

◆ SetStickAction()

void InputMap::SetStickAction ( int nStick,
int nAction )

Bind an analogue stick to an action.

Parameters
nStickThe stick.
nActionThe action.
Ghidra address:
NTSC-U/C: 0x0027dae8
Ghidra address:
PAL: 0x00287400

◆ GetStickAction()

int InputMap::GetStickAction ( int nStick)

Report the action an analogue stick is bound to.

Parameters
nStickThe stick.
Returns
The action.
Ghidra address:
NTSC-U/C: 0x0027db00
Ghidra address:
PAL: 0x00287418

◆ FindStick()

int InputMap::FindStick ( int nAction)

Find the analogue stick bound to an action.

Parameters
nActionThe action.
Returns
The stick, or the number of sticks when no stick is bound to the action.
Ghidra address:
NTSC-U/C: 0x0027db18
Ghidra address:
PAL: 0x00287430

◆ Load() [1/2]

void InputMap::Load ( const DataArray * pConfig)

Load the bindings a configuration array lists.

Each node after the tag of the "buttons" and "sticks" child arrays is a pair of a button or stick and the action bound to it. The title is inferred.

Parameters
pConfigThe configuration array.
Ghidra address:
NTSC-U/C: 0x0027db58
Ghidra address:
PAL: 0x00287470

◆ LoadDefaults()

void InputMap::LoadDefaults ( )

Load the bindings the "input_map" entry of the "db" configuration section lists.

Ghidra address:
NTSC-U/C: 0x0027dc78
Ghidra address:
PAL: 0x00287590

◆ Save()

void InputMap::Save ( BinStream & stream) const

Write the number of buttons, the button bindings, the number of sticks, and the stick bindings.

Parameters
streamThe stream.
Ghidra address:
NTSC-U/C: 0x0027dcd0
Ghidra address:
PAL: 0x002875e8

◆ Load() [2/2]

void InputMap::Load ( BinStream & stream)

Read the bindings Save() wrote.

The stick bindings are written to the stream rather than read from it, and the sticks keep their bindings.

Parameters
streamThe stream.
Ghidra address:
NTSC-U/C: 0x0027de38
Ghidra address:
PAL: 0x00287750

Member Data Documentation

◆ kButtonCount

int InputMap::kButtonCount = 24
staticconstexpr

The number of controller buttons the map binds.

◆ kStickCount

int InputMap::kStickCount = 2
staticconstexpr

The number of analogue sticks the map binds.


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