|
libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
|
Ship's N64-compatible Controller implementation. More...
#include <Controller.h>
Public Member Functions | |
| Controller (uint8_t portIndex, std::vector< CONTROLLERBUTTONS_T > bitmasks, std::shared_ptr< Ship::ConsoleVariable > consoleVariable=nullptr, std::shared_ptr< Ship::ControlDeck > controlDeck=nullptr, std::shared_ptr< Ship::Window > window=nullptr) | |
| Constructs a Controller for the given port with the specified button bitmasks. | |
| void | ReadToPad (void *pad) override |
| Reads the current Ship::Controller state and writes it to the game's pad structure. | |
Public Member Functions inherited from Ship::Controller | |
| void | SetControlDeck (std::shared_ptr< ControlDeck > controlDeck) |
| Injects the owning ControlDeck into this controller and all of its subsystems. | |
| Controller (uint8_t portIndex, std::vector< CONTROLLERBUTTONS_T > bitmasks, std::shared_ptr< ConsoleVariable > consoleVariable=nullptr, std::shared_ptr< ControlDeck > controlDeck=nullptr, std::shared_ptr< Window > window=nullptr) | |
| Constructs a Controller for the given port with a set of button bitmasks. | |
| ~Controller () | |
| Destroys the Controller and releases all mapping resources. | |
| void | ReloadAllMappingsFromConfig () |
| Discards all in-memory mappings and reloads them from Config. | |
| bool | IsConnected () const |
| Returns true if at least one physical device mapping is active for any button. | |
| void | Connect () |
| Marks the controller as "connected" (used by the mapping layer). | |
| void | Disconnect () |
| Marks the controller as "disconnected" and clears transient state. | |
| void | ClearAllMappings () |
| Removes all mappings for all buttons, sticks, rumble, LED, and gyro. | |
| void | ClearAllMappingsForDeviceType (PhysicalDeviceType physicalDeviceType) |
| Removes all mappings that target the given physical device type. | |
| void | AddDefaultMappings (PhysicalDeviceType physicalDeviceType) |
| Applies the default mappings for the given physical device type. | |
| std::unordered_map< CONTROLLERBUTTONS_T, std::shared_ptr< ControllerButton > > | GetAllButtons () |
| Returns the full bitmask→ControllerButton map. | |
| std::shared_ptr< ControllerButton > | GetButtonByBitmask (CONTROLLERBUTTONS_T bitmask) |
| Returns the ControllerButton for the given bitmask, or nullptr if not found. | |
| std::shared_ptr< ControllerButton > | GetButton (CONTROLLERBUTTONS_T bitmask) |
| Alias of GetButtonByBitmask(). | |
| std::shared_ptr< ControllerStick > | GetLeftStick () |
| Returns the left analog stick input aggregator. | |
| std::shared_ptr< ControllerStick > | GetRightStick () |
| Returns the right analog stick input aggregator. | |
| std::shared_ptr< ControllerGyro > | GetGyro () |
| Returns the gyroscope input aggregator. | |
| std::shared_ptr< ControllerRumble > | GetRumble () |
| Returns the rumble output aggregator. | |
| std::shared_ptr< ControllerLED > | GetLED () |
| Returns the LED output aggregator. | |
| bool | HasConfig () |
| Returns true if any Config key exists for this controller's mappings. | |
| uint8_t | GetPortIndex () |
| Returns the zero-based port index this controller is bound to. | |
| std::vector< std::shared_ptr< ControllerMapping > > | GetAllMappings () |
| Returns a flat list of all ControllerMapping instances across all subsystems. | |
| bool | ProcessKeyboardEvent (KbEventType eventType, KbScancode scancode) |
| Forwards a keyboard event to all button and stick mappings. | |
| bool | ProcessMouseButtonEvent (bool isPressed, MouseBtn button) |
| Forwards a mouse-button event to all button and stick mappings. | |
| bool | HasMappingsForPhysicalDeviceType (PhysicalDeviceType physicalDeviceType) |
| Returns true if any mapping for this controller targets the given physical device type. | |
Public Member Functions inherited from Ship::ControlDevice | |
| ControlDevice (uint8_t portIndex) | |
| Constructs a ControlDevice bound to the given port. | |
| virtual | ~ControlDevice () |
Additional Inherited Members | |
Protected Attributes inherited from Ship::Controller | |
| std::unordered_map< CONTROLLERBUTTONS_T, std::shared_ptr< ControllerButton > > | mButtons |
| Button subsystems keyed by bitmask. | |
| std::shared_ptr< ConsoleVariable > | mConsoleVariable |
| Cached ConsoleVariable component. | |
| std::shared_ptr< ControlDeck > | mControlDeck |
| std::shared_ptr< Window > | mWindow |
Protected Attributes inherited from Ship::ControlDevice | |
| uint8_t | mPortIndex |
| Zero-based port index this device is connected to. | |
Ship's N64-compatible Controller implementation.
LUS::Controller is the concrete Controller subclass used by libultraship. It stores a rolling buffer of OSContPad states and implements ReadToPad() to convert the aggregated Ship::Controller input state into a single OSContPad entry.
The pad buffer allows the game to read back previous frames of input if needed (e.g. for input prediction or replay).
Instances are created automatically by LUS::ControlDeck when a port is configured; access them via ControlDeck::GetControllerByPort().
| LUS::Controller::Controller | ( | uint8_t | portIndex, |
| std::vector< CONTROLLERBUTTONS_T > | bitmasks, | ||
| std::shared_ptr< Ship::ConsoleVariable > | consoleVariable = nullptr, |
||
| std::shared_ptr< Ship::ControlDeck > | controlDeck = nullptr, |
||
| std::shared_ptr< Ship::Window > | window = nullptr |
||
| ) |
Constructs a Controller for the given port with the specified button bitmasks.
| portIndex | Zero-based port index (0 = port 1). |
| bitmasks | All button bitmasks this controller should track. |
|
overridevirtual |
Reads the current Ship::Controller state and writes it to the game's pad structure.
pad must point to the OSContPad entry for this port within the deck's pad buffer.
| pad | Pointer to the OSContPad entry to fill. |
Implements Ship::Controller.