diff options
author | Ameer <aj662@drexel.edu> | 2020-06-22 03:50:58 +0200 |
---|---|---|
committer | Ameer <aj662@drexel.edu> | 2020-06-22 03:50:58 +0200 |
commit | 46b4461fbb0514dd50c096ef896b1752d81079d0 (patch) | |
tree | 31245dd4ff76724295a20202cea9dba72635f3a0 /src/input_common/gcadapter/gc_adapter.h | |
parent | std::arrays where appropriate, clear q in adapter class, other touch ups (diff) | |
download | yuzu-46b4461fbb0514dd50c096ef896b1752d81079d0.tar yuzu-46b4461fbb0514dd50c096ef896b1752d81079d0.tar.gz yuzu-46b4461fbb0514dd50c096ef896b1752d81079d0.tar.bz2 yuzu-46b4461fbb0514dd50c096ef896b1752d81079d0.tar.lz yuzu-46b4461fbb0514dd50c096ef896b1752d81079d0.tar.xz yuzu-46b4461fbb0514dd50c096ef896b1752d81079d0.tar.zst yuzu-46b4461fbb0514dd50c096ef896b1752d81079d0.zip |
Diffstat (limited to '')
-rw-r--r-- | src/input_common/gcadapter/gc_adapter.h | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/src/input_common/gcadapter/gc_adapter.h b/src/input_common/gcadapter/gc_adapter.h index cb0dd0ab1..d7a57e7b7 100644 --- a/src/input_common/gcadapter/gc_adapter.h +++ b/src/input_common/gcadapter/gc_adapter.h @@ -46,17 +46,6 @@ enum class PadAxes : u8 { TriggerRight, Undefined, }; -const struct GCPadConstants { - const u8 MAIN_STICK_CENTER_X = 0x80; - const u8 MAIN_STICK_CENTER_Y = 0x80; - const u8 MAIN_STICK_RADIUS = 0x7f; - const u8 C_STICK_CENTER_X = 0x80; - const u8 C_STICK_CENTER_Y = 0x80; - const u8 C_STICK_RADIUS = 0x7f; - - const u8 TRIGGER_CENTER = 20; - const u8 THRESHOLD = 10; -} pad_constants; struct GCPadStatus { u16 button; // Or-ed PAD_BUTTON_* and PAD_TRIGGER_* bits @@ -67,6 +56,15 @@ struct GCPadStatus { u8 trigger_left; // 0 <= trigger_left <= 255 u8 trigger_right; // 0 <= trigger_right <= 255 + static constexpr u8 MAIN_STICK_CENTER_X = 0x80; + static constexpr u8 MAIN_STICK_CENTER_Y = 0x80; + static constexpr u8 MAIN_STICK_RADIUS = 0x7f; + static constexpr u8 C_STICK_CENTER_X = 0x80; + static constexpr u8 C_STICK_CENTER_Y = 0x80; + static constexpr u8 C_STICK_RADIUS = 0x7f; + static constexpr u8 TRIGGER_CENTER = 20; + static constexpr u8 THRESHOLD = 10; + u8 port; PadAxes axis = PadAxes::Undefined; u8 axis_value = 255; @@ -87,28 +85,22 @@ enum { /// Singleton Adapter class class Adapter { public: - /// For retreiving the singleton instance - static Adapter* GetInstance(); + /// Initialize the GC Adapter capture and read sequence + Adapter(); + /// Close the adapter read thread and release the adapter + ~Adapter(); /// Used for polling void BeginConfiguration(); void EndConfiguration(); std::array<Common::SPSCQueue<GCPadStatus>, 4>& GetPadQueue(); + const std::array<Common::SPSCQueue<GCPadStatus>, 4>& GetPadQueue() const; + std::array<GCState, 4>& GetPadState(); - std::array<Common::SPSCQueue<GCPadStatus>, 4>& GetPadQueue() const; - std::array<GCState, 4>& GetPadState() const; + const std::array<GCState, 4>& GetPadState() const; private: - /// Singleton instance. - static Adapter* adapter_instance; - - /// Initialize the GC Adapter capture and read sequence - Adapter(); - - /// Close the adapter read thread and release the adapter - ~Adapter(); - GCPadStatus CheckStatus(int port, u8 adapter_payload[37]); void PadToState(GCPadStatus pad, GCState& state); |