diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 8 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.h | 10 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.cpp | 32 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.h | 2 |
4 files changed, 50 insertions, 2 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index e2539ded8..66c4fe60a 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -677,6 +677,14 @@ Controller_NPad::NpadHandheldActivationMode Controller_NPad::GetNpadHandheldActi | |||
| 677 | return handheld_activation_mode; | 677 | return handheld_activation_mode; |
| 678 | } | 678 | } |
| 679 | 679 | ||
| 680 | void Controller_NPad::SetNpadCommunicationMode(NpadCommunicationMode communication_mode_) { | ||
| 681 | communication_mode = communication_mode_; | ||
| 682 | } | ||
| 683 | |||
| 684 | Controller_NPad::NpadCommunicationMode Controller_NPad::GetNpadCommunicationMode() const { | ||
| 685 | return communication_mode; | ||
| 686 | } | ||
| 687 | |||
| 680 | void Controller_NPad::SetNpadMode(u32 npad_id, NpadAssignments assignment_mode) { | 688 | void Controller_NPad::SetNpadMode(u32 npad_id, NpadAssignments assignment_mode) { |
| 681 | const std::size_t npad_index = NPadIdToIndex(npad_id); | 689 | const std::size_t npad_index = NPadIdToIndex(npad_id); |
| 682 | ASSERT(npad_index < shared_memory_entries.size()); | 690 | ASSERT(npad_index < shared_memory_entries.size()); |
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index 160dcbbe3..f1437c941 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h | |||
| @@ -86,6 +86,11 @@ public: | |||
| 86 | None = 2, | 86 | None = 2, |
| 87 | }; | 87 | }; |
| 88 | 88 | ||
| 89 | enum class NpadCommunicationMode : u64 { | ||
| 90 | Unknown0 = 0, | ||
| 91 | Unknown1 = 1, | ||
| 92 | }; | ||
| 93 | |||
| 89 | struct DeviceHandle { | 94 | struct DeviceHandle { |
| 90 | NpadType npad_type{}; | 95 | NpadType npad_type{}; |
| 91 | u8 npad_id{}; | 96 | u8 npad_id{}; |
| @@ -146,6 +151,9 @@ public: | |||
| 146 | void SetNpadHandheldActivationMode(NpadHandheldActivationMode activation_mode); | 151 | void SetNpadHandheldActivationMode(NpadHandheldActivationMode activation_mode); |
| 147 | NpadHandheldActivationMode GetNpadHandheldActivationMode() const; | 152 | NpadHandheldActivationMode GetNpadHandheldActivationMode() const; |
| 148 | 153 | ||
| 154 | void SetNpadCommunicationMode(NpadCommunicationMode communication_mode_); | ||
| 155 | NpadCommunicationMode GetNpadCommunicationMode() const; | ||
| 156 | |||
| 149 | void SetNpadMode(u32 npad_id, NpadAssignments assignment_mode); | 157 | void SetNpadMode(u32 npad_id, NpadAssignments assignment_mode); |
| 150 | 158 | ||
| 151 | bool VibrateControllerAtIndex(std::size_t npad_index, std::size_t device_index, | 159 | bool VibrateControllerAtIndex(std::size_t npad_index, std::size_t device_index, |
| @@ -424,6 +432,8 @@ private: | |||
| 424 | std::vector<u32> supported_npad_id_types{}; | 432 | std::vector<u32> supported_npad_id_types{}; |
| 425 | NpadHoldType hold_type{NpadHoldType::Vertical}; | 433 | NpadHoldType hold_type{NpadHoldType::Vertical}; |
| 426 | NpadHandheldActivationMode handheld_activation_mode{NpadHandheldActivationMode::Dual}; | 434 | NpadHandheldActivationMode handheld_activation_mode{NpadHandheldActivationMode::Dual}; |
| 435 | // NpadCommunicationMode is unknown, default value is 1 | ||
| 436 | NpadCommunicationMode communication_mode{NpadCommunicationMode::Unknown1}; | ||
| 427 | // Each controller should have their own styleset changed event | 437 | // Each controller should have their own styleset changed event |
| 428 | std::array<Kernel::EventPair, 10> styleset_changed_events; | 438 | std::array<Kernel::EventPair, 10> styleset_changed_events; |
| 429 | std::array<std::array<std::chrono::steady_clock::time_point, 2>, 10> last_vibration_timepoints; | 439 | std::array<std::array<std::chrono::steady_clock::time_point, 2>, 10> last_vibration_timepoints; |
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 80804b483..a1d307a41 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -308,8 +308,8 @@ Hid::Hid(Core::System& system_) : ServiceFramework{system_, "hid"} { | |||
| 308 | {527, nullptr, "EnablePalmaBoostMode"}, | 308 | {527, nullptr, "EnablePalmaBoostMode"}, |
| 309 | {528, nullptr, "GetPalmaBluetoothAddress"}, | 309 | {528, nullptr, "GetPalmaBluetoothAddress"}, |
| 310 | {529, nullptr, "SetDisallowedPalmaConnection"}, | 310 | {529, nullptr, "SetDisallowedPalmaConnection"}, |
| 311 | {1000, nullptr, "SetNpadCommunicationMode"}, | 311 | {1000, &Hid::SetNpadCommunicationMode, "SetNpadCommunicationMode"}, |
| 312 | {1001, nullptr, "GetNpadCommunicationMode"}, | 312 | {1001, &Hid::GetNpadCommunicationMode, "GetNpadCommunicationMode"}, |
| 313 | {1002, nullptr, "SetTouchScreenConfiguration"}, | 313 | {1002, nullptr, "SetTouchScreenConfiguration"}, |
| 314 | {1003, nullptr, "IsFirmwareUpdateNeededForNotification"}, | 314 | {1003, nullptr, "IsFirmwareUpdateNeededForNotification"}, |
| 315 | {2000, nullptr, "ActivateDigitizer"}, | 315 | {2000, nullptr, "ActivateDigitizer"}, |
| @@ -1298,6 +1298,34 @@ void Hid::SetPalmaBoostMode(Kernel::HLERequestContext& ctx) { | |||
| 1298 | rb.Push(RESULT_SUCCESS); | 1298 | rb.Push(RESULT_SUCCESS); |
| 1299 | } | 1299 | } |
| 1300 | 1300 | ||
| 1301 | void Hid::SetNpadCommunicationMode(Kernel::HLERequestContext& ctx) { | ||
| 1302 | IPC::RequestParser rp{ctx}; | ||
| 1303 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 1304 | const auto communication_mode{rp.PopEnum<Controller_NPad::NpadCommunicationMode>()}; | ||
| 1305 | |||
| 1306 | applet_resource->GetController<Controller_NPad>(HidController::NPad) | ||
| 1307 | .SetNpadCommunicationMode(communication_mode); | ||
| 1308 | |||
| 1309 | LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}, communication_mode={}", | ||
| 1310 | applet_resource_user_id, communication_mode); | ||
| 1311 | |||
| 1312 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1313 | rb.Push(RESULT_SUCCESS); | ||
| 1314 | } | ||
| 1315 | |||
| 1316 | void Hid::GetNpadCommunicationMode(Kernel::HLERequestContext& ctx) { | ||
| 1317 | IPC::RequestParser rp{ctx}; | ||
| 1318 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 1319 | |||
| 1320 | LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}", | ||
| 1321 | applet_resource_user_id); | ||
| 1322 | |||
| 1323 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 1324 | rb.Push(RESULT_SUCCESS); | ||
| 1325 | rb.PushEnum(applet_resource->GetController<Controller_NPad>(HidController::NPad) | ||
| 1326 | .GetNpadCommunicationMode()); | ||
| 1327 | } | ||
| 1328 | |||
| 1301 | class HidDbg final : public ServiceFramework<HidDbg> { | 1329 | class HidDbg final : public ServiceFramework<HidDbg> { |
| 1302 | public: | 1330 | public: |
| 1303 | explicit HidDbg(Core::System& system_) : ServiceFramework{system_, "hid:dbg"} { | 1331 | explicit HidDbg(Core::System& system_) : ServiceFramework{system_, "hid:dbg"} { |
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index 1a73b8f73..b87bfdde1 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h | |||
| @@ -145,6 +145,8 @@ private: | |||
| 145 | void ResetSevenSixAxisSensorTimestamp(Kernel::HLERequestContext& ctx); | 145 | void ResetSevenSixAxisSensorTimestamp(Kernel::HLERequestContext& ctx); |
| 146 | void SetIsPalmaAllConnectable(Kernel::HLERequestContext& ctx); | 146 | void SetIsPalmaAllConnectable(Kernel::HLERequestContext& ctx); |
| 147 | void SetPalmaBoostMode(Kernel::HLERequestContext& ctx); | 147 | void SetPalmaBoostMode(Kernel::HLERequestContext& ctx); |
| 148 | void SetNpadCommunicationMode(Kernel::HLERequestContext& ctx); | ||
| 149 | void GetNpadCommunicationMode(Kernel::HLERequestContext& ctx); | ||
| 148 | 150 | ||
| 149 | enum class VibrationDeviceType : u32 { | 151 | enum class VibrationDeviceType : u32 { |
| 150 | LinearResonantActuator = 1, | 152 | LinearResonantActuator = 1, |