diff options
| author | 2023-06-28 00:20:38 -0600 | |
|---|---|---|
| committer | 2023-06-28 09:49:47 -0600 | |
| commit | df9685a21c105962e90dbd95133c5a1bcef7886f (patch) | |
| tree | acfd98ca20286dca669077b165943f6c4af711a6 /src/input_common/drivers/joycon.cpp | |
| parent | Merge pull request #10933 from merryhime/dunno (diff) | |
| download | yuzu-df9685a21c105962e90dbd95133c5a1bcef7886f.tar.gz yuzu-df9685a21c105962e90dbd95133c5a1bcef7886f.tar.xz yuzu-df9685a21c105962e90dbd95133c5a1bcef7886f.zip | |
input_common: Remove duplicated DriverResult enum
Diffstat (limited to 'src/input_common/drivers/joycon.cpp')
| -rw-r--r-- | src/input_common/drivers/joycon.cpp | 35 |
1 files changed, 17 insertions, 18 deletions
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 { | |||
| 102 | Joycon::SerialNumber serial_number{}; | 102 | Joycon::SerialNumber serial_number{}; |
| 103 | 103 | ||
| 104 | const auto result = Joycon::JoyconDriver::GetDeviceType(device_info, type); | 104 | const auto result = Joycon::JoyconDriver::GetDeviceType(device_info, type); |
| 105 | if (result != Joycon::DriverResult::Success) { | 105 | if (result != Common::Input::DriverResult::Success) { |
| 106 | return false; | 106 | return false; |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | const auto result2 = Joycon::JoyconDriver::GetSerialNumber(device_info, serial_number); | 109 | const auto result2 = Joycon::JoyconDriver::GetSerialNumber(device_info, serial_number); |
| 110 | if (result2 != Joycon::DriverResult::Success) { | 110 | if (result2 != Common::Input::DriverResult::Success) { |
| 111 | return false; | 111 | return false; |
| 112 | } | 112 | } |
| 113 | 113 | ||
| @@ -171,10 +171,10 @@ void Joycons::RegisterNewDevice(SDL_hid_device_info* device_info) { | |||
| 171 | LOG_WARNING(Input, "No free handles available"); | 171 | LOG_WARNING(Input, "No free handles available"); |
| 172 | return; | 172 | return; |
| 173 | } | 173 | } |
| 174 | if (result == Joycon::DriverResult::Success) { | 174 | if (result == Common::Input::DriverResult::Success) { |
| 175 | result = handle->RequestDeviceAccess(device_info); | 175 | result = handle->RequestDeviceAccess(device_info); |
| 176 | } | 176 | } |
| 177 | if (result == Joycon::DriverResult::Success) { | 177 | if (result == Common::Input::DriverResult::Success) { |
| 178 | LOG_WARNING(Input, "Initialize device"); | 178 | LOG_WARNING(Input, "Initialize device"); |
| 179 | 179 | ||
| 180 | const std::size_t port = handle->GetDevicePort(); | 180 | const std::size_t port = handle->GetDevicePort(); |
| @@ -273,8 +273,7 @@ Common::Input::DriverResult Joycons::SetLeds(const PadIdentifier& identifier, | |||
| 273 | led_config += led_status.led_3 ? 4 : 0; | 273 | led_config += led_status.led_3 ? 4 : 0; |
| 274 | led_config += led_status.led_4 ? 8 : 0; | 274 | led_config += led_status.led_4 ? 8 : 0; |
| 275 | 275 | ||
| 276 | return static_cast<Common::Input::DriverResult>( | 276 | return handle->SetLedConfig(static_cast<u8>(led_config)); |
| 277 | handle->SetLedConfig(static_cast<u8>(led_config))); | ||
| 278 | } | 277 | } |
| 279 | 278 | ||
| 280 | Common::Input::DriverResult Joycons::SetCameraFormat(const PadIdentifier& identifier, | 279 | Common::Input::DriverResult Joycons::SetCameraFormat(const PadIdentifier& identifier, |
| @@ -283,8 +282,8 @@ Common::Input::DriverResult Joycons::SetCameraFormat(const PadIdentifier& identi | |||
| 283 | if (handle == nullptr) { | 282 | if (handle == nullptr) { |
| 284 | return Common::Input::DriverResult::InvalidHandle; | 283 | return Common::Input::DriverResult::InvalidHandle; |
| 285 | } | 284 | } |
| 286 | return static_cast<Common::Input::DriverResult>(handle->SetIrsConfig( | 285 | return handle->SetIrsConfig(Joycon::IrsMode::ImageTransfer, |
| 287 | Joycon::IrsMode::ImageTransfer, static_cast<Joycon::IrsResolution>(camera_format))); | 286 | static_cast<Joycon::IrsResolution>(camera_format)); |
| 288 | }; | 287 | }; |
| 289 | 288 | ||
| 290 | Common::Input::NfcState Joycons::SupportsNfc(const PadIdentifier& identifier_) const { | 289 | Common::Input::NfcState Joycons::SupportsNfc(const PadIdentifier& identifier_) const { |
| @@ -351,7 +350,7 @@ Common::Input::NfcState Joycons::ReadMifareData(const PadIdentifier& identifier, | |||
| 351 | 350 | ||
| 352 | std::vector<Joycon::MifareReadData> read_data(read_request.size()); | 351 | std::vector<Joycon::MifareReadData> read_data(read_request.size()); |
| 353 | const auto result = handle->ReadMifareData(read_request, read_data); | 352 | const auto result = handle->ReadMifareData(read_request, read_data); |
| 354 | if (result == Joycon::DriverResult::Success) { | 353 | if (result == Common::Input::DriverResult::Success) { |
| 355 | for (std::size_t i = 0; i < read_request.size(); i++) { | 354 | for (std::size_t i = 0; i < read_request.size(); i++) { |
| 356 | data.data[i] = { | 355 | data.data[i] = { |
| 357 | .command = static_cast<u8>(command), | 356 | .command = static_cast<u8>(command), |
| @@ -402,15 +401,15 @@ Common::Input::DriverResult Joycons::SetPollingMode(const PadIdentifier& identif | |||
| 402 | 401 | ||
| 403 | switch (polling_mode) { | 402 | switch (polling_mode) { |
| 404 | case Common::Input::PollingMode::Active: | 403 | case Common::Input::PollingMode::Active: |
| 405 | return static_cast<Common::Input::DriverResult>(handle->SetActiveMode()); | 404 | return handle->SetActiveMode(); |
| 406 | case Common::Input::PollingMode::Passive: | 405 | case Common::Input::PollingMode::Passive: |
| 407 | return static_cast<Common::Input::DriverResult>(handle->SetPassiveMode()); | 406 | return handle->SetPassiveMode(); |
| 408 | case Common::Input::PollingMode::IR: | 407 | case Common::Input::PollingMode::IR: |
| 409 | return static_cast<Common::Input::DriverResult>(handle->SetIrMode()); | 408 | return handle->SetIrMode(); |
| 410 | case Common::Input::PollingMode::NFC: | 409 | case Common::Input::PollingMode::NFC: |
| 411 | return static_cast<Common::Input::DriverResult>(handle->SetNfcMode()); | 410 | return handle->SetNfcMode(); |
| 412 | case Common::Input::PollingMode::Ring: | 411 | case Common::Input::PollingMode::Ring: |
| 413 | return static_cast<Common::Input::DriverResult>(handle->SetRingConMode()); | 412 | return handle->SetRingConMode(); |
| 414 | default: | 413 | default: |
| 415 | return Common::Input::DriverResult::NotSupported; | 414 | return Common::Input::DriverResult::NotSupported; |
| 416 | } | 415 | } |
| @@ -828,13 +827,13 @@ std::string Joycons::JoyconName(Joycon::ControllerType type) const { | |||
| 828 | } | 827 | } |
| 829 | } | 828 | } |
| 830 | 829 | ||
| 831 | Common::Input::NfcState Joycons::TranslateDriverResult(Joycon::DriverResult result) const { | 830 | Common::Input::NfcState Joycons::TranslateDriverResult(Common::Input::DriverResult result) const { |
| 832 | switch (result) { | 831 | switch (result) { |
| 833 | case Joycon::DriverResult::Success: | 832 | case Common::Input::DriverResult::Success: |
| 834 | return Common::Input::NfcState::Success; | 833 | return Common::Input::NfcState::Success; |
| 835 | case Joycon::DriverResult::Disabled: | 834 | case Common::Input::DriverResult::Disabled: |
| 836 | return Common::Input::NfcState::WrongDeviceState; | 835 | return Common::Input::NfcState::WrongDeviceState; |
| 837 | case Joycon::DriverResult::NotSupported: | 836 | case Common::Input::DriverResult::NotSupported: |
| 838 | return Common::Input::NfcState::NotSupported; | 837 | return Common::Input::NfcState::NotSupported; |
| 839 | default: | 838 | default: |
| 840 | return Common::Input::NfcState::Unknown; | 839 | return Common::Input::NfcState::Unknown; |