diff options
| author | 2021-10-11 00:43:11 -0500 | |
|---|---|---|
| committer | 2021-11-24 20:30:24 -0600 | |
| commit | 06a5ef5874144a70e30e577a83ba68d1dad79e78 (patch) | |
| tree | 867fa1153c7285c858cdb5bd7f60f08266532a88 /src/core/hle | |
| parent | core: Update input interpreter (diff) | |
| download | yuzu-06a5ef5874144a70e30e577a83ba68d1dad79e78.tar.gz yuzu-06a5ef5874144a70e30e577a83ba68d1dad79e78.tar.xz yuzu-06a5ef5874144a70e30e577a83ba68d1dad79e78.zip | |
core/hid: Add output devices
Diffstat (limited to 'src/core/hle')
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 27 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.h | 18 |
2 files changed, 5 insertions, 40 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 03cbd42f4..a2e9ddf4d 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -796,7 +796,7 @@ void Controller_NPad::InitializeVibrationDeviceAtIndex(std::size_t npad_index, | |||
| 796 | } | 796 | } |
| 797 | 797 | ||
| 798 | controller.vibration[device_index].device_mounted = | 798 | controller.vibration[device_index].device_mounted = |
| 799 | controller.device->TestVibration(device_index) == 1; | 799 | controller.device->TestVibration(device_index); |
| 800 | } | 800 | } |
| 801 | 801 | ||
| 802 | void Controller_NPad::SetPermitVibrationSession(bool permit_vibration_session) { | 802 | void Controller_NPad::SetPermitVibrationSession(bool permit_vibration_session) { |
| @@ -954,31 +954,12 @@ bool Controller_NPad::SwapNpadAssignment(u32 npad_id_1, u32 npad_id_2) { | |||
| 954 | return true; | 954 | return true; |
| 955 | } | 955 | } |
| 956 | 956 | ||
| 957 | Controller_NPad::LedPattern Controller_NPad::GetLedPattern(u32 npad_id) { | 957 | Core::HID::LedPattern Controller_NPad::GetLedPattern(u32 npad_id) { |
| 958 | if (npad_id == npad_id_list.back() || npad_id == npad_id_list[npad_id_list.size() - 2]) { | 958 | if (npad_id == npad_id_list.back() || npad_id == npad_id_list[npad_id_list.size() - 2]) { |
| 959 | // These are controllers without led patterns | 959 | // These are controllers without led patterns |
| 960 | return LedPattern{0, 0, 0, 0}; | 960 | return Core::HID::LedPattern{0, 0, 0, 0}; |
| 961 | } | ||
| 962 | switch (npad_id) { | ||
| 963 | case 0: | ||
| 964 | return LedPattern{1, 0, 0, 0}; | ||
| 965 | case 1: | ||
| 966 | return LedPattern{1, 1, 0, 0}; | ||
| 967 | case 2: | ||
| 968 | return LedPattern{1, 1, 1, 0}; | ||
| 969 | case 3: | ||
| 970 | return LedPattern{1, 1, 1, 1}; | ||
| 971 | case 4: | ||
| 972 | return LedPattern{1, 0, 0, 1}; | ||
| 973 | case 5: | ||
| 974 | return LedPattern{1, 0, 1, 0}; | ||
| 975 | case 6: | ||
| 976 | return LedPattern{1, 0, 1, 1}; | ||
| 977 | case 7: | ||
| 978 | return LedPattern{0, 1, 1, 0}; | ||
| 979 | default: | ||
| 980 | return LedPattern{0, 0, 0, 0}; | ||
| 981 | } | 961 | } |
| 962 | return controller_data[npad_id].device->GetLedPattern(); | ||
| 982 | } | 963 | } |
| 983 | 964 | ||
| 984 | bool Controller_NPad::IsUnintendedHomeButtonInputProtectionEnabled(u32 npad_id) const { | 965 | bool Controller_NPad::IsUnintendedHomeButtonInputProtectionEnabled(u32 npad_id) const { |
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index 483cae5b6..b0e2f8430 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h | |||
| @@ -115,22 +115,6 @@ public: | |||
| 115 | .freq_high = 320.0f, | 115 | .freq_high = 320.0f, |
| 116 | }; | 116 | }; |
| 117 | 117 | ||
| 118 | struct LedPattern { | ||
| 119 | explicit LedPattern(u64 light1, u64 light2, u64 light3, u64 light4) { | ||
| 120 | position1.Assign(light1); | ||
| 121 | position2.Assign(light2); | ||
| 122 | position3.Assign(light3); | ||
| 123 | position4.Assign(light4); | ||
| 124 | } | ||
| 125 | union { | ||
| 126 | u64 raw{}; | ||
| 127 | BitField<0, 1, u64> position1; | ||
| 128 | BitField<1, 1, u64> position2; | ||
| 129 | BitField<2, 1, u64> position3; | ||
| 130 | BitField<3, 1, u64> position4; | ||
| 131 | }; | ||
| 132 | }; | ||
| 133 | |||
| 134 | void SetSupportedStyleSet(Core::HID::NpadStyleTag style_set); | 118 | void SetSupportedStyleSet(Core::HID::NpadStyleTag style_set); |
| 135 | Core::HID::NpadStyleTag GetSupportedStyleSet() const; | 119 | Core::HID::NpadStyleTag GetSupportedStyleSet() const; |
| 136 | 120 | ||
| @@ -186,7 +170,7 @@ public: | |||
| 186 | void SetSixAxisFusionParameters(f32 parameter1, f32 parameter2); | 170 | void SetSixAxisFusionParameters(f32 parameter1, f32 parameter2); |
| 187 | std::pair<f32, f32> GetSixAxisFusionParameters(); | 171 | std::pair<f32, f32> GetSixAxisFusionParameters(); |
| 188 | void ResetSixAxisFusionParameters(); | 172 | void ResetSixAxisFusionParameters(); |
| 189 | LedPattern GetLedPattern(u32 npad_id); | 173 | Core::HID::LedPattern GetLedPattern(u32 npad_id); |
| 190 | bool IsUnintendedHomeButtonInputProtectionEnabled(u32 npad_id) const; | 174 | bool IsUnintendedHomeButtonInputProtectionEnabled(u32 npad_id) const; |
| 191 | void SetUnintendedHomeButtonInputProtectionEnabled(bool is_protection_enabled, u32 npad_id); | 175 | void SetUnintendedHomeButtonInputProtectionEnabled(bool is_protection_enabled, u32 npad_id); |
| 192 | void SetAnalogStickUseCenterClamp(bool use_center_clamp); | 176 | void SetAnalogStickUseCenterClamp(bool use_center_clamp); |