diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2020-07-18 18:39:48 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-18 18:39:48 -0500 |
| commit | 5c2b6d06267df15b352ad75862575a2c83bf0ffb (patch) | |
| tree | 61e15054afb22df64752d76bc72d89ba59ebd0fd /Source/Core/InputCommon | |
| parent | 0fa4812c2fba7bd4c0ddfe90aad70a243ad15e33 (diff) | |
| parent | 0ede5d1537fbe7d433d1d984ca7acfbe3e7300dc (diff) | |
Merge pull request #7770 from ShFil119/loop
Use range loop (if possible)
Diffstat (limited to 'Source/Core/InputCommon')
| -rw-r--r-- | Source/Core/InputCommon/GCAdapter.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/Source/Core/InputCommon/GCAdapter.cpp b/Source/Core/InputCommon/GCAdapter.cpp index ab9618efdf..dc7c64f6f2 100644 --- a/Source/Core/InputCommon/GCAdapter.cpp +++ b/Source/Core/InputCommon/GCAdapter.cpp @@ -40,10 +40,10 @@ enum // Current adapter status: detected/not detected/in error (holds the error code) static std::atomic<int> s_status = NO_ADAPTER_DETECTED; static libusb_device_handle* s_handle = nullptr; -static u8 s_controller_type[SerialInterface::MAX_SI_CHANNELS] = { +static std::array<u8, SerialInterface::MAX_SI_CHANNELS> s_controller_type = { ControllerTypes::CONTROLLER_NONE, ControllerTypes::CONTROLLER_NONE, ControllerTypes::CONTROLLER_NONE, ControllerTypes::CONTROLLER_NONE}; -static u8 s_controller_rumble[4]; +static std::array<u8, SerialInterface::MAX_SI_CHANNELS> s_controller_rumble{}; static std::mutex s_mutex; static u8 s_controller_payload[37]; @@ -236,11 +236,8 @@ static void Setup() if (s_status < 0) s_status = NO_ADAPTER_DETECTED; - for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; i++) - { - s_controller_type[i] = ControllerTypes::CONTROLLER_NONE; - s_controller_rumble[i] = 0; - } + s_controller_type.fill(ControllerTypes::CONTROLLER_NONE); + s_controller_rumble.fill(0); s_libusb_context.GetDeviceList([](libusb_device* device) { if (CheckDeviceAccess(device)) @@ -395,8 +392,7 @@ static void Reset() s_adapter_output_thread.join(); } - for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; i++) - s_controller_type[i] = ControllerTypes::CONTROLLER_NONE; + s_controller_type.fill(ControllerTypes::CONTROLLER_NONE); s_status = NO_ADAPTER_DETECTED; |
