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

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

#include <forcefeedbackmgr.h>

Classes

struct  Slot
 One controller's motor state. More...
struct  Effect
 One vibration effect, read from the configuration by LoadConfig(). More...

Public Member Functions

 ForceFeedbackMgr ()
 Load the configuration and register the object as the unit's instance.
 ~ForceFeedbackMgr ()
 Clear mEffects and the unit's instance pointer.
void StartMetronome (const Sch::Tick &delay)
 Schedule the metronome's start a delay from the current song position.
void SetPlayerCount (unsigned int nPlayers)
 Size mSlots to the players and suspend everything for three players or more.
void PulseBeat ()
 Pulse the small motor of every idle controller for mPulseLength and schedule the next beat.
void SyncMetronome ()
 Schedule the first beat pulse ahead of the next beat by the motors' latency.
void PlayEffect (int nPlayerSlot, int nEffect)
 Start one vibration effect on a player's controller.
void Suspend (unsigned char nMask)
 Stop every motor and set flags in mFlags.
void SetPaused (int bPaused)
 Stop every motor and set the paused flag, or clear the flag.
void SetJukeboxMode (int bJukebox)
 Stop every motor and set the jukebox flag, or clear the flag.
void SetPlaybackMode (int bPlayback)
 Stop every motor and set the playback flag, or clear the flag.
void SetEnabled (int bEnabled)
 Clear the disabled flag, or stop every motor and set it.
void SetPowerup (unsigned int nPlayerSlot, int bPowerup)
 Set a slot's powerup mark when the slot exists.
void StopAll (Sch::Tick when)
 Stop every motor twice over and set the stopped flag.
void SetBigMotor (int nPlayerSlot, int nLevel)
void SetSmallMotor (int nPlayerSlot, int nState)
void SetBothMotors (int nPlayerSlot, int nSmallState, int nBigLevel)
void ApplyMotors (int nPlayerSlot)
 Pass a slot's motor state to the controller through InputPoller::SetVibration().
void PlayUnusedEffect (Player *pPlayer)
 Play effect 4, configuration 0x4b6, on a player's controller.
void PlayBumpEffect (Player *pPlayer)
 Play the effect a bumper hit produces, effect 1, on the target's controller.
void PlayAutocatchEffect (Player *pPlayer)
 Play the effect an autocatcher produces, effect 0, on a player's controller.
void PlayNeutralizedEffect (Player *pPlayer)
 Play the effect a neutralized track produces, effect 3, on a player's controller.
void PlayCrippleEffect (Player *pPlayer)
 Play the effect a crippler hit produces, effect 2, on a player's controller.

Detailed Description

Driver of the controllers' vibration motors during a song.

The class is not polymorphic and emits no RTTI. The name is inferred from its translation unit. The six file-local scheduler commands beside it record ForceFeedbackMgr.cpp in their anonymous-namespace RTTI names (SteadyFBCmd, StartMetronomeFBCmd, SetPowerupFBCmd, SetSmallMotorCmd, SetLargeMotorCmd, and SetBothMotorsCmd). The object is 0x48 bytes. GrooveWorld builds one, keeps it at +0x34, and deletes it in GrooveWorld::Shutdown(). The constructor also stores the object in the unit's pointer at 0x0067a3f0, which every command's Execute() goes through.

Two kinds of vibration run through it. The metronome pulses the small motor of every player not inside a powerup effect once a beat, and an effect runs one of five configured motor patterns on one player's controller. Any bit set in mFlags suspends both.

The unit's static initialiser at 0x0016ff68 hands six factory functions to the command registrar at 0x00538208 with an identifier of zero, and each factory returns null. All six are the commands' NewCmd() members.

Constructor & Destructor Documentation

◆ ForceFeedbackMgr()

ForceFeedbackMgr::ForceFeedbackMgr ( )

Load the configuration and register the object as the unit's instance.

Ghidra address:
NTSC-U/C: 0x0016dae0
Ghidra address:
PAL: 0x001703f0

◆ ~ForceFeedbackMgr()

ForceFeedbackMgr::~ForceFeedbackMgr ( )

Clear mEffects and the unit's instance pointer.

Ghidra address:
NTSC-U/C: 0x0016dca8
Ghidra address:
PAL: 0x001705b8

Member Function Documentation

◆ StartMetronome()

void ForceFeedbackMgr::StartMetronome ( const Sch::Tick & delay)

Schedule the metronome's start a delay from the current song position.

The stopped flag is cleared first. Nothing is scheduled unless the remaining flags are clear or the paused flag alone is set.

Parameters
delayThe delay, in MIDI ticks.
Ghidra address:
NTSC-U/C: 0x0016e1b8
Ghidra address:
PAL: 0x00170ac8

◆ SetPlayerCount()

void ForceFeedbackMgr::SetPlayerCount ( unsigned int nPlayers)

Size mSlots to the players and suspend everything for three players or more.

Parameters
nPlayersThe player count.
Ghidra address:
NTSC-U/C: 0x0016e2b8
Ghidra address:
PAL: 0x00170bc8

◆ PulseBeat()

void ForceFeedbackMgr::PulseBeat ( )

Pulse the small motor of every idle controller for mPulseLength and schedule the next beat.

The file-local SteadyFBCmd runs it.

Ghidra address:
NTSC-U/C: 0x0016e408
Ghidra address:
PAL: 0x00170d18

◆ SyncMetronome()

void ForceFeedbackMgr::SyncMetronome ( )

Schedule the first beat pulse ahead of the next beat by the motors' latency.

The file-local StartMetronomeFBCmd runs it. The lead is half the pulse length in milliseconds plus 90000000, converted to MIDI ticks through the song clock's tempo map. A beat closer than the lead moves the pulse one beat on.

Ghidra address:
NTSC-U/C: 0x0016e610
Ghidra address:
PAL: 0x00170f20

◆ PlayEffect()

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

Start one vibration effect on a player's controller.

Nothing happens while any flag is set or the slot is -1. The slot is marked as running an effect, each pulse turns both motors on at twice the period times the pulse index and off again, and a closing SetPowerupFBCmd clears the mark after one period.

Parameters
nPlayerSlotThe player's slot, as Player::GetInputSlot() reports it.
nEffectThe effect number, an index into mEffects.
Ghidra address:
NTSC-U/C: 0x0016e848
Ghidra address:
PAL: 0x00171158

◆ Suspend()

void ForceFeedbackMgr::Suspend ( unsigned char nMask)

Stop every motor and set flags in mFlags.

The image has no caller.

Parameters
nMaskThe flags to set.
Ghidra address:
NTSC-U/C: 0x001704c8
Ghidra address:
PAL: 0x00172dd8

◆ SetPaused()

void ForceFeedbackMgr::SetPaused ( int bPaused)

Stop every motor and set the paused flag, or clear the flag.

GameManagerImpl's pause and unpause handlers are the recovered callers.

Parameters
bPausedNon-zero to pause.
Ghidra address:
NTSC-U/C: 0x00170588
Ghidra address:
PAL: 0x00172e98

◆ SetJukeboxMode()

void ForceFeedbackMgr::SetJukeboxMode ( int bJukebox)

Stop every motor and set the jukebox flag, or clear the flag.

GrooveWorld passes Globals::IsJukeboxMode().

Parameters
bJukeboxNon-zero in jukebox mode.
Ghidra address:
NTSC-U/C: 0x00170648
Ghidra address:
PAL: 0x00172f58

◆ SetPlaybackMode()

void ForceFeedbackMgr::SetPlaybackMode ( int bPlayback)

Stop every motor and set the playback flag, or clear the flag.

GrooveWorld passes GrooveWorld::mIsPlayback.

Parameters
bPlaybackNon-zero while a recording plays back.
Ghidra address:
NTSC-U/C: 0x00170708
Ghidra address:
PAL: 0x00173018

◆ SetEnabled()

void ForceFeedbackMgr::SetEnabled ( int bEnabled)

Clear the disabled flag, or stop every motor and set it.

Parameters
bEnabledNon-zero to allow vibration.
Ghidra address:
NTSC-U/C: 0x001707c8
Ghidra address:
PAL: 0x001730d8

◆ SetPowerup()

void ForceFeedbackMgr::SetPowerup ( unsigned int nPlayerSlot,
int bPowerup )

Set a slot's powerup mark when the slot exists.

SetPowerupFBCmd runs it.

Parameters
nPlayerSlotThe slot.
bPowerupThe mark.
Ghidra address:
NTSC-U/C: 0x00170890
Ghidra address:
PAL: 0x001731a0

◆ StopAll()

void ForceFeedbackMgr::StopAll ( Sch::Tick when)

Stop every motor twice over and set the stopped flag.

GrooveWorld::Exit() is the one caller, and it passes a song position of zero that the body does not read.

Parameters
whenThe song position, which the body does not read.
Ghidra address:
NTSC-U/C: 0x001708d0
Ghidra address:
PAL: 0x001731e0

◆ SetBigMotor()

void ForceFeedbackMgr::SetBigMotor ( int nPlayerSlot,
int nLevel )
Parameters
nPlayerSlotThe slot.
nLevelThe big motor's level.
Ghidra address:
NTSC-U/C: 0x001709f8
Ghidra address:
PAL: 0x00173308

◆ SetSmallMotor()

void ForceFeedbackMgr::SetSmallMotor ( int nPlayerSlot,
int nState )
Parameters
nPlayerSlotThe slot.
nStateThe small motor's state.
Ghidra address:
NTSC-U/C: 0x00170a30
Ghidra address:
PAL: 0x00173340

◆ SetBothMotors()

void ForceFeedbackMgr::SetBothMotors ( int nPlayerSlot,
int nSmallState,
int nBigLevel )
Parameters
nPlayerSlotThe slot.
nSmallStateThe small motor's state.
nBigLevelThe big motor's level.
Ghidra address:
NTSC-U/C: 0x00170a68
Ghidra address:
PAL: 0x00173378

◆ ApplyMotors()

void ForceFeedbackMgr::ApplyMotors ( int nPlayerSlot)

Pass a slot's motor state to the controller through InputPoller::SetVibration().

Parameters
nPlayerSlotThe slot. The controller's port is one more.
Ghidra address:
NTSC-U/C: 0x00170ab0
Ghidra address:
PAL: 0x001733c0

◆ PlayUnusedEffect()

void ForceFeedbackMgr::PlayUnusedEffect ( Player * pPlayer)

Play effect 4, configuration 0x4b6, on a player's controller.

The image has no caller.

Parameters
pPlayerThe player.
Ghidra address:
NTSC-U/C: 0x00170b20
Ghidra address:
PAL: 0x00173430

◆ PlayBumpEffect()

void ForceFeedbackMgr::PlayBumpEffect ( Player * pPlayer)

Play the effect a bumper hit produces, effect 1, on the target's controller.

AppTunnel's powerup routine at 0x00448d58 calls it for a bumper.

Parameters
pPlayerThe player that was bumped.
Ghidra address:
NTSC-U/C: 0x00170b68
Ghidra address:
PAL: 0x00173478

◆ PlayAutocatchEffect()

void ForceFeedbackMgr::PlayAutocatchEffect ( Player * pPlayer)

Play the effect an autocatcher produces, effect 0, on a player's controller.

AppTunnel's powerup routine at 0x00448d58 calls it for an autocatcher.

Parameters
pPlayerThe player that used the autocatcher.
Ghidra address:
NTSC-U/C: 0x00170bb0
Ghidra address:
PAL: 0x001734c0

◆ PlayNeutralizedEffect()

void ForceFeedbackMgr::PlayNeutralizedEffect ( Player * pPlayer)

Play the effect a neutralized track produces, effect 3, on a player's controller.

AppTunnel's handler of PlayersTrackNeutralizedMsg calls it.

Parameters
pPlayerThe player whose track was neutralized.
Ghidra address:
NTSC-U/C: 0x00170bf8
Ghidra address:
PAL: 0x00173508

◆ PlayCrippleEffect()

void ForceFeedbackMgr::PlayCrippleEffect ( Player * pPlayer)

Play the effect a crippler hit produces, effect 2, on a player's controller.

TnlCrippleFX's frame routine at 0x0043e500 is the recovered caller.

Parameters
pPlayerThe player that was hit.
Ghidra address:
NTSC-U/C: 0x00170c40
Ghidra address:
PAL: 0x00173550

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