From df9685a21c105962e90dbd95133c5a1bcef7886f Mon Sep 17 00:00:00 2001 From: german77 Date: Wed, 28 Jun 2023 00:20:38 -0600 Subject: input_common: Remove duplicated DriverResult enum --- src/input_common/drivers/joycon.cpp | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'src/input_common/drivers/joycon.cpp') diff --git a/src/input_common/drivers/joycon.cpp b/src/input_common/drivers/joycon.cpp index 52494e0d9..0aca5a3a3 100644 --- a/src/input_common/drivers/joycon.cpp +++ b/src/input_common/drivers/joycon.cpp @@ -102,12 +102,12 @@ bool Joycons::IsDeviceNew(SDL_hid_device_info* device_info) const { Joycon::SerialNumber serial_number{}; const auto result = Joycon::JoyconDriver::GetDeviceType(device_info, type); - if (result != Joycon::DriverResult::Success) { + if (result != Common::Input::DriverResult::Success) { return false; } const auto result2 = Joycon::JoyconDriver::GetSerialNumber(device_info, serial_number); - if (result2 != Joycon::DriverResult::Success) { + if (result2 != Common::Input::DriverResult::Success) { return false; } @@ -171,10 +171,10 @@ void Joycons::RegisterNewDevice(SDL_hid_device_info* device_info) { LOG_WARNING(Input, "No free handles available"); return; } - if (result == Joycon::DriverResult::Success) { + if (result == Common::Input::DriverResult::Success) { result = handle->RequestDeviceAccess(device_info); } - if (result == Joycon::DriverResult::Success) { + if (result == Common::Input::DriverResult::Success) { LOG_WARNING(Input, "Initialize device"); const std::size_t port = handle->GetDevicePort(); @@ -273,8 +273,7 @@ Common::Input::DriverResult Joycons::SetLeds(const PadIdentifier& identifier, led_config += led_status.led_3 ? 4 : 0; led_config += led_status.led_4 ? 8 : 0; - return static_cast( - handle->SetLedConfig(static_cast(led_config))); + return handle->SetLedConfig(static_cast(led_config)); } Common::Input::DriverResult Joycons::SetCameraFormat(const PadIdentifier& identifier, @@ -283,8 +282,8 @@ Common::Input::DriverResult Joycons::SetCameraFormat(const PadIdentifier& identi if (handle == nullptr) { return Common::Input::DriverResult::InvalidHandle; } - return static_cast(handle->SetIrsConfig( - Joycon::IrsMode::ImageTransfer, static_cast(camera_format))); + return handle->SetIrsConfig(Joycon::IrsMode::ImageTransfer, + static_cast(camera_format)); }; Common::Input::NfcState Joycons::SupportsNfc(const PadIdentifier& identifier_) const { @@ -351,7 +350,7 @@ Common::Input::NfcState Joycons::ReadMifareData(const PadIdentifier& identifier, std::vector read_data(read_request.size()); const auto result = handle->ReadMifareData(read_request, read_data); - if (result == Joycon::DriverResult::Success) { + if (result == Common::Input::DriverResult::Success) { for (std::size_t i = 0; i < read_request.size(); i++) { data.data[i] = { .command = static_cast(command), @@ -402,15 +401,15 @@ Common::Input::DriverResult Joycons::SetPollingMode(const PadIdentifier& identif switch (polling_mode) { case Common::Input::PollingMode::Active: - return static_cast(handle->SetActiveMode()); + return handle->SetActiveMode(); case Common::Input::PollingMode::Passive: - return static_cast(handle->SetPassiveMode()); + return handle->SetPassiveMode(); case Common::Input::PollingMode::IR: - return static_cast(handle->SetIrMode()); + return handle->SetIrMode(); case Common::Input::PollingMode::NFC: - return static_cast(handle->SetNfcMode()); + return handle->SetNfcMode(); case Common::Input::PollingMode::Ring: - return static_cast(handle->SetRingConMode()); + return handle->SetRingConMode(); default: return Common::Input::DriverResult::NotSupported; } @@ -828,13 +827,13 @@ std::string Joycons::JoyconName(Joycon::ControllerType type) const { } } -Common::Input::NfcState Joycons::TranslateDriverResult(Joycon::DriverResult result) const { +Common::Input::NfcState Joycons::TranslateDriverResult(Common::Input::DriverResult result) const { switch (result) { - case Joycon::DriverResult::Success: + case Common::Input::DriverResult::Success: return Common::Input::NfcState::Success; - case Joycon::DriverResult::Disabled: + case Common::Input::DriverResult::Disabled: return Common::Input::NfcState::WrongDeviceState; - case Joycon::DriverResult::NotSupported: + case Common::Input::DriverResult::NotSupported: return Common::Input::NfcState::NotSupported; default: return Common::Input::NfcState::Unknown; -- cgit v1.2.3