diff options
Diffstat (limited to 'src/input_common/drivers')
| -rw-r--r-- | src/input_common/drivers/gc_adapter.cpp | 2 | ||||
| -rw-r--r-- | src/input_common/drivers/joycon.h | 2 | ||||
| -rw-r--r-- | src/input_common/drivers/keyboard.cpp | 2 | ||||
| -rw-r--r-- | src/input_common/drivers/mouse.cpp | 4 | ||||
| -rw-r--r-- | src/input_common/drivers/sdl_driver.cpp | 21 | ||||
| -rw-r--r-- | src/input_common/drivers/virtual_amiibo.cpp | 2 | 
6 files changed, 24 insertions, 9 deletions
| diff --git a/src/input_common/drivers/gc_adapter.cpp b/src/input_common/drivers/gc_adapter.cpp index d09ff178b..3ad34884d 100644 --- a/src/input_common/drivers/gc_adapter.cpp +++ b/src/input_common/drivers/gc_adapter.cpp @@ -344,7 +344,7 @@ bool GCAdapter::IsVibrationEnabled([[maybe_unused]] const PadIdentifier& identif  void GCAdapter::UpdateVibrations() {      // Use 8 states to keep the switching between on/off fast enough for -    // a human to feel different vibration strenght +    // a human to feel different vibration strength      // More states == more rumble strengths == slower update time      constexpr u8 vibration_states = 8; diff --git a/src/input_common/drivers/joycon.h b/src/input_common/drivers/joycon.h index 473ba1b9e..5b40817e2 100644 --- a/src/input_common/drivers/joycon.h +++ b/src/input_common/drivers/joycon.h @@ -62,7 +62,7 @@ private:      /// Registers controllers, clears all data and starts the scan thread      void Setup(); -    /// Actively searchs for new devices +    /// Actively searches for new devices      void ScanThread(std::stop_token stop_token);      /// Returns true if device is valid and not registered diff --git a/src/input_common/drivers/keyboard.cpp b/src/input_common/drivers/keyboard.cpp index 71e612fbf..2567df9af 100644 --- a/src/input_common/drivers/keyboard.cpp +++ b/src/input_common/drivers/keyboard.cpp @@ -24,7 +24,7 @@ constexpr PadIdentifier keyboard_modifier_identifier = {  };  Keyboard::Keyboard(std::string input_engine_) : InputEngine(std::move(input_engine_)) { -    // Keyboard is broken into 3 diferent sets: +    // Keyboard is broken into 3 different sets:      // key: Unfiltered intended for controllers.      // keyboard_key: Allows only Settings::NativeKeyboard::Keys intended for keyboard emulation.      // keyboard_modifier: Allows only Settings::NativeKeyboard::Modifiers intended for keyboard diff --git a/src/input_common/drivers/mouse.cpp b/src/input_common/drivers/mouse.cpp index 94e92c37d..4fb2a6cfa 100644 --- a/src/input_common/drivers/mouse.cpp +++ b/src/input_common/drivers/mouse.cpp @@ -142,7 +142,7 @@ void Mouse::Move(int x, int y, int center_x, int center_y) {              return;          } -        // Make slow movements at least 3 units on lenght +        // Make slow movements at least 3 units on length          if (move_distance < 3.0f) {              // Normalize value              mouse_change /= move_distance; @@ -154,7 +154,7 @@ void Mouse::Move(int x, int y, int center_x, int center_y) {          const auto last_move_distance = last_mouse_change.Length(); -        // Make fast movements clamp to 8 units on lenght +        // Make fast movements clamp to 8 units on length          if (last_move_distance > 8.0f) {              // Normalize value              last_mouse_change /= last_move_distance; diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp index 5c20b3426..7f9e8dbb9 100644 --- a/src/input_common/drivers/sdl_driver.cpp +++ b/src/input_common/drivers/sdl_driver.cpp @@ -652,12 +652,27 @@ bool SDLDriver::IsVibrationEnabled(const PadIdentifier& identifier) {  }  void SDLDriver::SendVibrations() { +    std::vector<VibrationRequest> filtered_vibrations{};      while (!vibration_queue.Empty()) {          VibrationRequest request;          vibration_queue.Pop(request);          const auto joystick = GetSDLJoystickByGUID(request.identifier.guid.RawString(),                                                     static_cast<int>(request.identifier.port)); -        joystick->RumblePlay(request.vibration); +        const auto it = std::find_if(filtered_vibrations.begin(), filtered_vibrations.end(), +                                     [request](VibrationRequest vibration) { +                                         return vibration.identifier == request.identifier; +                                     }); +        if (it == filtered_vibrations.end()) { +            filtered_vibrations.push_back(std::move(request)); +            continue; +        } +        *it = request; +    } + +    for (const auto& vibration : filtered_vibrations) { +        const auto joystick = GetSDLJoystickByGUID(vibration.identifier.guid.RawString(), +                                                   static_cast<int>(vibration.identifier.port)); +        joystick->RumblePlay(vibration.vibration);      }  } @@ -748,7 +763,7 @@ ButtonMapping SDLDriver::GetButtonMappingForDevice(const Common::ParamPackage& p      // This list is missing ZL/ZR since those are not considered buttons in SDL GameController.      // We will add those afterwards -    // This list also excludes Screenshot since theres not really a mapping for that +    // This list also excludes Screenshot since there's not really a mapping for that      ButtonBindings switch_to_sdl_button;      if (SDL_GameControllerGetType(controller) == SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO) { @@ -1007,7 +1022,7 @@ MotionMapping SDLDriver::GetMotionMappingForDevice(const Common::ParamPackage& p  Common::Input::ButtonNames SDLDriver::GetUIName(const Common::ParamPackage& params) const {      if (params.Has("button")) { -        // TODO(German77): Find how to substitue the values for real button names +        // TODO(German77): Find how to substitute the values for real button names          return Common::Input::ButtonNames::Value;      }      if (params.Has("hat")) { diff --git a/src/input_common/drivers/virtual_amiibo.cpp b/src/input_common/drivers/virtual_amiibo.cpp index 4a0268a4d..304f4c70b 100644 --- a/src/input_common/drivers/virtual_amiibo.cpp +++ b/src/input_common/drivers/virtual_amiibo.cpp @@ -57,7 +57,7 @@ Common::Input::NfcState VirtualAmiibo::WriteNfcData(      }      if (!nfc_file.Write(data)) { -        LOG_ERROR(Service_NFP, "Error writting to file"); +        LOG_ERROR(Service_NFP, "Error writing to file");          return Common::Input::NfcState::WriteFailed;      } | 
