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

Driver of the controllers' vibration motors during a song. More...

#include <forcefeedbackmgr.h>

Classes

class  BeatCmd
 Command that runs the beat pulse once a period. More...
class  Controller
 One player's controller, with its beat pulse and its effects. More...
class  MotorEffect
 One vibration pattern of a controller, which runs both motors for a duration. More...

Public Types

enum  Effect { kEffectCripple = 0 , kEffectBump = 1 , kEffectAutocatch = 2 , kEffectCount = 3 }
 The effects of a controller, indices into Controller::mEffects. More...

Public Member Functions

 ForceFeedbackMgr ()
 Construct the manager with no controller and the beat pulse's command.
 ~ForceFeedbackMgr ()
 Delete every controller.
void Start (const float *pTickDuration, int nTicksPerBar)
 Prepare one controller for each player and enable vibration.
void StopAll ()
 Withdraw the beat pulse, cancel every effect, and disable vibration.
void StartMetronome (int nPeriod, int nTick)
 Schedule the beat pulse at the first multiple of a period from a tick that still lies ahead.
void StopMetronome ()
 Withdraw the beat pulse from the song scheduler.
void SetBeatEnabled (int nPad, bool bEnabled)
 Set whether the beat pulse drives one controller.
void SetVibration (int nController, int nSmallMotor, int nBigMotor)
 Record a controller's motor levels and pass them to its port.
void PlayBumpEffect (int nController)
 Play the bumper effect on a controller while vibration is enabled.
void PlayCrippleEffect (int nController)
 Play the crippler effect on a controller while vibration is enabled.
void PlayAutocatchEffect (int nController)
 Play the autocatcher effect on a controller while vibration is enabled.
void PlayEffect (int nController, int nEffect)
 Cancel every effect of a controller and start one.
void Pause ()
 Stop the motors of both ports while the game is paused.
void Resume ()
 Read each controller's vibration option again and restore the motors Pause() stopped.
BeatCmd * GetBeatCmd ()
const std::vector< std::unique_ptr< Controller > > & GetControllers () const
int GetEnabled () const

Static Public Member Functions

static ForceFeedbackMgr * shared ()
 Report the single instance, constructing it on first use.

Static Public Attributes

static constexpr int kMaxPlayers = 2
 The most players Start() prepares controllers for.
static constexpr int kPadCount = 2
 The number of controller ports.

Detailed Description

Driver of the controllers' vibration motors during a song.

The class is not polymorphic and emits no RTTI. The RTTI of the nested BeatCmd, Controller, MotorEffect, and MotorEffect::OffCmd records the name. The one instance is the function-local static of shared(), and TheForceFeedbackMgr addresses it.

Two kinds of vibration run through it. The beat pulse vibrates every enabled controller that plays no effect once a beat, and an effect runs one of three motor patterns on one controller.

Member Enumeration Documentation

◆ Effect

The effects of a controller, indices into Controller::mEffects.

Enumerator
kEffectCripple 

A crippler hit.

kEffectBump 

A bumper hit.

kEffectAutocatch 

An autocatcher or a capture.

kEffectCount 

The number of effects.

Constructor & Destructor Documentation

◆ ForceFeedbackMgr()

ForceFeedbackMgr::ForceFeedbackMgr ( )

Construct the manager with no controller and the beat pulse's command.

Ghidra address:
NTSC-U/C: 0x0010c8e0
Ghidra address:
PAL: 0x0010e018

◆ ~ForceFeedbackMgr()

ForceFeedbackMgr::~ForceFeedbackMgr ( )

Delete every controller.

Ghidra address:
NTSC-U/C: 0x0010c958
Ghidra address:
PAL: 0x0010e090

Member Function Documentation

◆ shared()

ForceFeedbackMgr * ForceFeedbackMgr::shared ( )
static

Report the single instance, constructing it on first use.

Returns
The instance.
Ghidra address:
NTSC-U/C: 0x0010d290
Ghidra address:
PAL: 0x0010e9c8

◆ Start()

void ForceFeedbackMgr::Start ( const float * pTickDuration,
int nTicksPerBar )

Prepare one controller for each player and enable vibration.

Nothing happens when more than kMaxPlayers players take part, while a demo plays, or when the game configuration disables vibration. Every effect is cancelled and both ports are stopped first. The name is inferred.

Parameters
pTickDurationThe duration of one tick on the song clock, which the manager retains.
nTicksPerBarThe song ticks in one bar.
Ghidra address:
NTSC-U/C: 0x0010ca08
Ghidra address:
PAL: 0x0010e140

◆ StopAll()

void ForceFeedbackMgr::StopAll ( )

Withdraw the beat pulse, cancel every effect, and disable vibration.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x0010cd58
Ghidra address:
PAL: 0x0010e490

◆ StartMetronome()

void ForceFeedbackMgr::StartMetronome ( int nPeriod,
int nTick )

Schedule the beat pulse at the first multiple of a period from a tick that still lies ahead.

The pulse leads the beat by the configured lead, and every controller is enabled. Nothing happens while vibration is disabled. The name is inferred.

Parameters
nPeriodThe ticks between two pulses.
nTickThe tick the pulse starts from.
Ghidra address:
NTSC-U/C: 0x0010cde8
Ghidra address:
PAL: 0x0010e520

◆ StopMetronome()

void ForceFeedbackMgr::StopMetronome ( )

Withdraw the beat pulse from the song scheduler.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x0010cf58
Ghidra address:
PAL: 0x0010e690

◆ SetBeatEnabled()

void ForceFeedbackMgr::SetBeatEnabled ( int nPad,
bool bEnabled )

Set whether the beat pulse drives one controller.

Nothing happens while vibration is disabled. The name is inferred.

Parameters
nPadThe controller.
bEnabledWhether the controller follows the beat pulse.
Ghidra address:
NTSC-U/C: 0x0010cf90
Ghidra address:
PAL: 0x0010e6c8

◆ SetVibration()

void ForceFeedbackMgr::SetVibration ( int nController,
int nSmallMotor,
int nBigMotor )

Record a controller's motor levels and pass them to its port.

The port receives the levels only while the manager is not suspended and the controller's vibration option is on. The name is inferred.

Parameters
nControllerThe controller.
nSmallMotorThe small motor's state, 0 or 1.
nBigMotorThe big motor's level.
Ghidra address:
NTSC-U/C: 0x0010cfb8
Ghidra address:
PAL: 0x0010e6f0

◆ PlayBumpEffect()

void ForceFeedbackMgr::PlayBumpEffect ( int nController)

Play the bumper effect on a controller while vibration is enabled.

Parameters
nControllerThe controller.
Ghidra address:
NTSC-U/C: 0x0010d010
Ghidra address:
PAL: 0x0010e748

◆ PlayCrippleEffect()

void ForceFeedbackMgr::PlayCrippleEffect ( int nController)

Play the crippler effect on a controller while vibration is enabled.

Parameters
nControllerThe controller.
Ghidra address:
NTSC-U/C: 0x0010d038
Ghidra address:
PAL: 0x0010e770

◆ PlayAutocatchEffect()

void ForceFeedbackMgr::PlayAutocatchEffect ( int nController)

Play the autocatcher effect on a controller while vibration is enabled.

Parameters
nControllerThe controller.
Ghidra address:
NTSC-U/C: 0x0010d060
Ghidra address:
PAL: 0x0010e798

◆ PlayEffect()

void ForceFeedbackMgr::PlayEffect ( int nController,
int nEffect )

Cancel every effect of a controller and start one.

The name is inferred.

Parameters
nControllerThe controller.
nEffectOne of Effect.
Ghidra address:
NTSC-U/C: 0x0010d088
Ghidra address:
PAL: 0x0010e7c0

◆ Pause()

void ForceFeedbackMgr::Pause ( )

Stop the motors of both ports while the game is paused.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x0010d130
Ghidra address:
PAL: 0x0010e868

◆ Resume()

void ForceFeedbackMgr::Resume ( )

Read each controller's vibration option again and restore the motors Pause() stopped.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x0010d198
Ghidra address:
PAL: 0x0010e8d0

◆ GetBeatCmd()

BeatCmd * ForceFeedbackMgr::GetBeatCmd ( )
inline
Returns
The command of the beat pulse.

◆ GetControllers()

const std::vector< std::unique_ptr< Controller > > & ForceFeedbackMgr::GetControllers ( ) const
inline
Returns
The controllers, one for each player, deleted with the manager.

◆ GetEnabled()

int ForceFeedbackMgr::GetEnabled ( ) const
inline
Returns
Whether vibration runs, set by Start().

Member Data Documentation

◆ kMaxPlayers

int ForceFeedbackMgr::kMaxPlayers = 2
staticconstexpr

The most players Start() prepares controllers for.

◆ kPadCount

int ForceFeedbackMgr::kPadCount = 2
staticconstexpr

The number of controller ports.


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