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

Auto-repeat state for the front end, one record per controller. More...

#include <metcommandrepeater.h>

Public Member Functions

 MetCommandRepeater ()
 Build four empty records.
 ~MetCommandRepeater ()
 Release the vector.
void Reset ()
 Disarm every record.
void Arm (const MetScreenCommand *pCommand, int nButton, int nPadIndex)
 Arm one record from a command that has just been delivered.
void Update (MetScreen *pPanel, const long long *pNowNanoseconds)
 Re-deliver every armed command whose interval has elapsed.

Detailed Description

Auto-repeat state for the front end, one record per controller.

The class emits no RTTI and declares no allocation operator, for the same reasons recorded on MetCommandMap, and it shares that translation unit. The name here is inferred from what the class does and is not attested anywhere in the image.

The object is twelve bytes and its one member is a std::vector of four twenty-four-byte records, one per controller from pad 1 to pad 4. A held navigation command arms its controller's record, which then waits an initial three seconds before re-delivering the command at the interval the active panel's MetScreen::mRepeatScale sets.

Constructor & Destructor Documentation

◆ MetCommandRepeater()

MetCommandRepeater::MetCommandRepeater ( )

Build four empty records.

Ghidra address:
NTSC-U/C: 0x002e54b0
Ghidra address:
PAL: 0x00308470

◆ ~MetCommandRepeater()

MetCommandRepeater::~MetCommandRepeater ( )

Release the vector.

Ghidra address:
NTSC-U/C: 0x002e71c0
Ghidra address:
PAL: 0x0030a1f0

Member Function Documentation

◆ Reset()

void MetCommandRepeater::Reset ( )

Disarm every record.

Writes zero to the command of all four records and nothing else, which is a four-iteration loop with no bound read from the vector. The count is therefore the literal four rather than the vector's size.

Ghidra address:
NTSC-U/C: 0x002e7298
Ghidra address:
PAL: 0x0030a2c8

◆ Arm()

void MetCommandRepeater::Arm ( const MetScreenCommand * pCommand,
int nButton,
int nPadIndex )

Arm one record from a command that has just been delivered.

The record of pad nPadIndex is rearmed when the command is not 0 or when the record already belongs to nButton. It then takes the button and the command, starts the three-second initial delay, and records the current time. MetRenderer::DispatchPriv() is the one caller, and it runs the routine only for a joy reading whose command is one of 0, 1, 2, 3, 4, 0x10, 0x11, 0x12, or 0x13.

Parameters
pCommandThe command that was delivered.
nButtonThe reading's mButton.
nPadIndexThe reading's mPadIndex, counted from one.
Ghidra address:
NTSC-U/C: 0x002e5790
Ghidra address:
PAL: 0x00308750

◆ Update()

void MetCommandRepeater::Update ( MetScreen * pPanel,
const long long * pNowNanoseconds )

Re-deliver every armed command whose interval has elapsed.

The interval is MetScreen::mRepeatScale multiplied by 50, in milliseconds, read from the panel the routine is given rather than stored per record. A record whose initial delay is still positive has the milliseconds since it was last serviced subtracted from it instead of firing. A null panel is rejected at once.

Parameters
pPanelThe screen the repeated commands are delivered to.
pNowNanosecondsThe current time, which the caller has already computed.
Ghidra address:
NTSC-U/C: 0x002e55b0
Ghidra address:
PAL: 0x00308570

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