libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
ConnectedPhysicalDeviceManager.h
Go to the documentation of this file.
1#pragma once
2
3#include <unordered_map>
4#include <unordered_set>
5#include <vector>
6#include <string>
7#include <SDL2/SDL.h>
8
9namespace Ship {
10
20 public:
24
33 std::unordered_map<int32_t, SDL_GameController*> GetConnectedSDLGamepadsForPort(uint8_t portIndex);
34
39 std::unordered_map<int32_t, std::string> GetConnectedSDLGamepadNames();
40
46 std::unordered_set<int32_t> GetIgnoredInstanceIdsForPort(uint8_t portIndex);
47
54 bool PortIsIgnoringInstanceId(uint8_t portIndex, int32_t instanceId);
55
61 void IgnoreInstanceIdForPort(uint8_t portIndex, int32_t instanceId);
62
68 void UnignoreInstanceIdForPort(uint8_t portIndex, int32_t instanceId);
69
74 void HandlePhysicalDeviceConnect(int32_t sdlDeviceIndex);
75
80 void HandlePhysicalDeviceDisconnect(int32_t sdlJoystickInstanceId);
81
84
85 private:
86 std::unordered_map<int32_t, SDL_GameController*> mConnectedSDLGamepads;
87 std::unordered_map<int32_t, std::string> mConnectedSDLGamepadNames;
88 std::unordered_map<uint8_t, std::unordered_set<int32_t>> mIgnoredInstanceIds;
89};
90} // namespace Ship
Tracks connected SDL game controllers and manages per-port ignore lists.
Definition ConnectedPhysicalDeviceManager.h:19
void HandlePhysicalDeviceConnect(int32_t sdlDeviceIndex)
Handles an SDL device-added event by opening the new controller.
void HandlePhysicalDeviceDisconnect(int32_t sdlJoystickInstanceId)
Handles an SDL device-removed event by closing the controller.
std::unordered_set< int32_t > GetIgnoredInstanceIdsForPort(uint8_t portIndex)
Returns the set of SDL joystick instance IDs ignored for a port.
void UnignoreInstanceIdForPort(uint8_t portIndex, int32_t instanceId)
Removes a joystick instance from a port's ignore list.
std::unordered_map< int32_t, std::string > GetConnectedSDLGamepadNames()
Returns the display names of all connected SDL gamepads.
void RefreshConnectedSDLGamepads()
Re-scans all connected SDL gamepads and rebuilds the internal maps.
ConnectedPhysicalDeviceManager()
Constructs the manager and performs an initial scan of connected gamepads.
void IgnoreInstanceIdForPort(uint8_t portIndex, int32_t instanceId)
Adds a joystick instance to a port's ignore list.
bool PortIsIgnoringInstanceId(uint8_t portIndex, int32_t instanceId)
Checks whether a specific joystick instance is being ignored on a port.
std::unordered_map< int32_t, SDL_GameController * > GetConnectedSDLGamepadsForPort(uint8_t portIndex)
Returns the connected SDL gamepads available for the given port.
Core namespace for the libultraship engine framework.
Definition gfx_direct3d_common.h:14