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

Factory for creating ControllerRumbleMapping instances. More...

#include <RumbleMappingFactory.h>

Static Public Member Functions

static std::shared_ptr< ControllerRumbleMappingCreateRumbleMappingFromConfig (uint8_t portIndex, std::string id, std::shared_ptr< ConsoleVariable > consoleVariable, std::shared_ptr< ControlDeck > controlDeck)
 Deserializes a rumble mapping from the configuration string.
 
static std::vector< std::shared_ptr< ControllerRumbleMapping > > CreateDefaultSDLRumbleMappings (PhysicalDeviceType physicalDeviceType, uint8_t portIndex, std::shared_ptr< ConsoleVariable > consoleVariable, std::shared_ptr< ControlDeck > controlDeck)
 Creates default SDL rumble mappings for a specific physical device type.
 
static std::shared_ptr< ControllerRumbleMappingCreateRumbleMappingFromSDLInput (uint8_t portIndex, std::shared_ptr< ConsoleVariable > consoleVariable, std::shared_ptr< ControlDeck > controlDeck)
 Creates a rumble mapping from live SDL input for interactive binding.
 

Detailed Description

Factory for creating ControllerRumbleMapping instances.

RumbleMappingFactory provides static helpers to create ControllerRumbleMapping instances that map game controller rumble/haptic output to physical device rumble motors. It supports deserializing rumble mappings from persisted configuration, generating default SDL rumble mappings for known device types, and creating mappings from live SDL input events during interactive binding.

Rumble mappings enable force feedback (vibration) on physical controllers in response to in-game events, enhancing immersion and providing tactile feedback.

All factory methods require a ConsoleVariable and ControlDeck to track state and configuration.

Typical usage (within ControlDeck or ConfigUI):

portIndex, mappingId, consoleVariable, controlDeck);
static std::shared_ptr< ControllerRumbleMapping > CreateRumbleMappingFromConfig(uint8_t portIndex, std::string id, std::shared_ptr< ConsoleVariable > consoleVariable, std::shared_ptr< ControlDeck > controlDeck)
Deserializes a rumble mapping from the configuration string.

Member Function Documentation

◆ CreateDefaultSDLRumbleMappings()

static std::vector< std::shared_ptr< ControllerRumbleMapping > > Ship::RumbleMappingFactory::CreateDefaultSDLRumbleMappings ( PhysicalDeviceType  physicalDeviceType,
uint8_t  portIndex,
std::shared_ptr< ConsoleVariable consoleVariable,
std::shared_ptr< ControlDeck controlDeck 
)
static

Creates default SDL rumble mappings for a specific physical device type.

Parameters
physicalDeviceTypeThe type of physical device (e.g., SDL2 gamepad, Nintendo controller).
portIndexThe controller port index (0-based).
consoleVariableConsoleVariable for persisting mappings.
controlDeckControlDeck for physical device access.
Returns
Vector of rumble mappings suitable for the device type.

◆ CreateRumbleMappingFromConfig()

static std::shared_ptr< ControllerRumbleMapping > Ship::RumbleMappingFactory::CreateRumbleMappingFromConfig ( uint8_t  portIndex,
std::string  id,
std::shared_ptr< ConsoleVariable consoleVariable,
std::shared_ptr< ControlDeck controlDeck 
)
static

Deserializes a rumble mapping from the configuration string.

Parameters
portIndexThe controller port index (0-based).
idConfiguration string encoding the rumble output target.
consoleVariableConsoleVariable for persisting the mapping.
controlDeckControlDeck for physical device access.
Returns
The deserialized mapping, or nullptr if the configuration string is invalid.

◆ CreateRumbleMappingFromSDLInput()

static std::shared_ptr< ControllerRumbleMapping > Ship::RumbleMappingFactory::CreateRumbleMappingFromSDLInput ( uint8_t  portIndex,
std::shared_ptr< ConsoleVariable consoleVariable,
std::shared_ptr< ControlDeck controlDeck 
)
static

Creates a rumble mapping from live SDL input for interactive binding.

Parameters
portIndexThe controller port index (0-based).
consoleVariableConsoleVariable for persisting the mapping.
controlDeckControlDeck for physical device access.
Returns
The newly created mapping, or nullptr if no rumble device is detected.

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