diff options
Diffstat (limited to 'src/input_common/gcadapter/gc_adapter.h')
| -rw-r--r-- | src/input_common/gcadapter/gc_adapter.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/input_common/gcadapter/gc_adapter.h b/src/input_common/gcadapter/gc_adapter.h index b1c2a1958..e2cdd6255 100644 --- a/src/input_common/gcadapter/gc_adapter.h +++ b/src/input_common/gcadapter/gc_adapter.h | |||
| @@ -8,10 +8,13 @@ | |||
| 8 | #include <mutex> | 8 | #include <mutex> |
| 9 | #include <thread> | 9 | #include <thread> |
| 10 | #include <unordered_map> | 10 | #include <unordered_map> |
| 11 | #include <libusb.h> | ||
| 12 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 13 | #include "common/threadsafe_queue.h" | 12 | #include "common/threadsafe_queue.h" |
| 14 | 13 | ||
| 14 | struct libusb_context; | ||
| 15 | struct libusb_device; | ||
| 16 | struct libusb_device_handle; | ||
| 17 | |||
| 15 | namespace GCAdapter { | 18 | namespace GCAdapter { |
| 16 | 19 | ||
| 17 | enum { | 20 | enum { |
| @@ -97,6 +100,9 @@ public: | |||
| 97 | void BeginConfiguration(); | 100 | void BeginConfiguration(); |
| 98 | void EndConfiguration(); | 101 | void EndConfiguration(); |
| 99 | 102 | ||
| 103 | /// Returns true if there is a device connected to port | ||
| 104 | bool DeviceConnected(std::size_t port); | ||
| 105 | |||
| 100 | std::array<Common::SPSCQueue<GCPadStatus>, 4>& GetPadQueue(); | 106 | std::array<Common::SPSCQueue<GCPadStatus>, 4>& GetPadQueue(); |
| 101 | const std::array<Common::SPSCQueue<GCPadStatus>, 4>& GetPadQueue() const; | 107 | const std::array<Common::SPSCQueue<GCPadStatus>, 4>& GetPadQueue() const; |
| 102 | 108 | ||
| @@ -104,7 +110,7 @@ public: | |||
| 104 | const std::array<GCState, 4>& GetPadState() const; | 110 | const std::array<GCState, 4>& GetPadState() const; |
| 105 | 111 | ||
| 106 | private: | 112 | private: |
| 107 | GCPadStatus GetPadStatus(int port, const std::array<u8, 37>& adapter_payload); | 113 | GCPadStatus GetPadStatus(std::size_t port, const std::array<u8, 37>& adapter_payload); |
| 108 | 114 | ||
| 109 | void PadToState(const GCPadStatus& pad, GCState& state); | 115 | void PadToState(const GCPadStatus& pad, GCState& state); |
| 110 | 116 | ||
| @@ -116,11 +122,8 @@ private: | |||
| 116 | /// Stop scanning for the adapter | 122 | /// Stop scanning for the adapter |
| 117 | void StopScanThread(); | 123 | void StopScanThread(); |
| 118 | 124 | ||
| 119 | /// Returns true if there is a device connected to port | ||
| 120 | bool DeviceConnected(int port); | ||
| 121 | |||
| 122 | /// Resets status of device connected to port | 125 | /// Resets status of device connected to port |
| 123 | void ResetDeviceType(int port); | 126 | void ResetDeviceType(std::size_t port); |
| 124 | 127 | ||
| 125 | /// Returns true if we successfully gain access to GC Adapter | 128 | /// Returns true if we successfully gain access to GC Adapter |
| 126 | bool CheckDeviceAccess(libusb_device* device); | 129 | bool CheckDeviceAccess(libusb_device* device); |