libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
Ship::ControllerRumble Class Reference

Aggregates rumble output mappings and drives force-feedback hardware. More...

#include <ControllerRumble.h>

Public Member Functions

void SetControlDeck (std::shared_ptr< ControlDeck > controlDeck)
 Injects the owning ControlDeck.
 
 ControllerRumble (uint8_t portIndex, std::shared_ptr< ConsoleVariable > consoleVariable=nullptr, std::shared_ptr< ControlDeck > controlDeck=nullptr)
 Constructs a ControllerRumble for the given port.
 
 ~ControllerRumble ()
 
std::unordered_map< std::string, std::shared_ptr< ControllerRumbleMapping > > GetAllRumbleMappings ()
 Returns a copy of the full id → mapping map.
 
void AddRumbleMapping (std::shared_ptr< ControllerRumbleMapping > mapping)
 Adds a rumble mapping to the collection.
 
void ClearRumbleMappingId (std::string id)
 Removes the mapping ID from Config without destroying the in-memory object.
 
void ClearRumbleMapping (std::string id)
 Removes the mapping with id from both in-memory and Config.
 
void SaveRumbleMappingIdsToConfig ()
 Writes the current set of mapping IDs to Config.
 
void ClearAllMappings ()
 Removes all in-memory rumble mappings.
 
void ClearAllMappingsForDeviceType (PhysicalDeviceType physicalDeviceType)
 Removes all mappings that target the given device type.
 
void AddDefaultMappings (PhysicalDeviceType physicalDeviceType)
 Applies the default rumble mappings for the given device type.
 
void LoadRumbleMappingFromConfig (std::string id)
 Loads the mapping with id from Config and adds it to the collection.
 
void ReloadAllMappingsFromConfig ()
 Clears all in-memory mappings and reloads them from Config.
 
bool AddRumbleMappingFromRawPress ()
 Listens for the next raw physical input and creates a rumble mapping from it.
 
void StartRumble ()
 Activates rumble on all mapped physical devices.
 
void StopRumble ()
 Stops rumble on all mapped physical devices.
 
bool HasMappingsForPhysicalDeviceType (PhysicalDeviceType physicalDeviceType)
 Returns true if any mapping targets the given device type.
 

Detailed Description

Aggregates rumble output mappings and drives force-feedback hardware.

ControllerRumble holds a collection of ControllerRumbleMapping instances (one per physical device output) and fans out StartRumble() / StopRumble() calls to all of them. Multiple mappings allow the same logical rumble request to activate haptics on several devices simultaneously.

Mappings are persisted in Config and applied via the standard load/save helpers.

Constructor & Destructor Documentation

◆ ControllerRumble()

Ship::ControllerRumble::ControllerRumble ( uint8_t  portIndex,
std::shared_ptr< ConsoleVariable consoleVariable = nullptr,
std::shared_ptr< ControlDeck controlDeck = nullptr 
)

Constructs a ControllerRumble for the given port.

Parameters
portIndexZero-based port index.

◆ ~ControllerRumble()

Ship::ControllerRumble::~ControllerRumble ( )

Member Function Documentation

◆ AddDefaultMappings()

void Ship::ControllerRumble::AddDefaultMappings ( PhysicalDeviceType  physicalDeviceType)

Applies the default rumble mappings for the given device type.

Parameters
physicalDeviceTypeDevice type to apply defaults for.

◆ AddRumbleMapping()

void Ship::ControllerRumble::AddRumbleMapping ( std::shared_ptr< ControllerRumbleMapping mapping)

Adds a rumble mapping to the collection.

Parameters
mappingMapping to add. Its ID must be unique.

◆ AddRumbleMappingFromRawPress()

bool Ship::ControllerRumble::AddRumbleMappingFromRawPress ( )

Listens for the next raw physical input and creates a rumble mapping from it.

Returns
true if a mapping was successfully created.

◆ ClearAllMappings()

void Ship::ControllerRumble::ClearAllMappings ( )

Removes all in-memory rumble mappings.

◆ ClearAllMappingsForDeviceType()

void Ship::ControllerRumble::ClearAllMappingsForDeviceType ( PhysicalDeviceType  physicalDeviceType)

Removes all mappings that target the given device type.

Parameters
physicalDeviceTypeDevice type whose mappings should be cleared.

◆ ClearRumbleMapping()

void Ship::ControllerRumble::ClearRumbleMapping ( std::string  id)

Removes the mapping with id from both in-memory and Config.

Parameters
idMapping UUID.

◆ ClearRumbleMappingId()

void Ship::ControllerRumble::ClearRumbleMappingId ( std::string  id)

Removes the mapping ID from Config without destroying the in-memory object.

Parameters
idMapping UUID.

◆ GetAllRumbleMappings()

std::unordered_map< std::string, std::shared_ptr< ControllerRumbleMapping > > Ship::ControllerRumble::GetAllRumbleMappings ( )

Returns a copy of the full id → mapping map.

◆ HasMappingsForPhysicalDeviceType()

bool Ship::ControllerRumble::HasMappingsForPhysicalDeviceType ( PhysicalDeviceType  physicalDeviceType)

Returns true if any mapping targets the given device type.

Parameters
physicalDeviceTypeDevice type to query.

◆ LoadRumbleMappingFromConfig()

void Ship::ControllerRumble::LoadRumbleMappingFromConfig ( std::string  id)

Loads the mapping with id from Config and adds it to the collection.

Parameters
idMapping UUID stored in Config.

◆ ReloadAllMappingsFromConfig()

void Ship::ControllerRumble::ReloadAllMappingsFromConfig ( )

Clears all in-memory mappings and reloads them from Config.

◆ SaveRumbleMappingIdsToConfig()

void Ship::ControllerRumble::SaveRumbleMappingIdsToConfig ( )

Writes the current set of mapping IDs to Config.

◆ SetControlDeck()

void Ship::ControllerRumble::SetControlDeck ( std::shared_ptr< ControlDeck controlDeck)
inline

Injects the owning ControlDeck.

◆ StartRumble()

void Ship::ControllerRumble::StartRumble ( )

Activates rumble on all mapped physical devices.

◆ StopRumble()

void Ship::ControllerRumble::StopRumble ( )

Stops rumble on all mapped physical devices.


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