diff options
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.h | 1 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.cpp | 25 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.h | 2 |
4 files changed, 32 insertions, 2 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 1e81f776f..e47fe8188 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -636,10 +636,15 @@ Controller_NPad::LedPattern Controller_NPad::GetLedPattern(u32 npad_id) { | |||
| 636 | return LedPattern{0, 0, 0, 0}; | 636 | return LedPattern{0, 0, 0, 0}; |
| 637 | }; | 637 | }; |
| 638 | } | 638 | } |
| 639 | |||
| 639 | void Controller_NPad::SetVibrationEnabled(bool can_vibrate) { | 640 | void Controller_NPad::SetVibrationEnabled(bool can_vibrate) { |
| 640 | can_controllers_vibrate = can_vibrate; | 641 | can_controllers_vibrate = can_vibrate; |
| 641 | } | 642 | } |
| 642 | 643 | ||
| 644 | bool Controller_NPad::IsVibrationEnabled() const { | ||
| 645 | return can_controllers_vibrate; | ||
| 646 | } | ||
| 647 | |||
| 643 | void Controller_NPad::ClearAllConnectedControllers() { | 648 | void Controller_NPad::ClearAllConnectedControllers() { |
| 644 | for (auto& controller : connected_controllers) { | 649 | for (auto& controller : connected_controllers) { |
| 645 | if (controller.is_connected && controller.type != NPadControllerType::None) { | 650 | if (controller.is_connected && controller.type != NPadControllerType::None) { |
| @@ -648,6 +653,7 @@ void Controller_NPad::ClearAllConnectedControllers() { | |||
| 648 | } | 653 | } |
| 649 | } | 654 | } |
| 650 | } | 655 | } |
| 656 | |||
| 651 | void Controller_NPad::DisconnectAllConnectedControllers() { | 657 | void Controller_NPad::DisconnectAllConnectedControllers() { |
| 652 | std::for_each(connected_controllers.begin(), connected_controllers.end(), | 658 | std::for_each(connected_controllers.begin(), connected_controllers.end(), |
| 653 | [](ControllerHolder& controller) { controller.is_connected = false; }); | 659 | [](ControllerHolder& controller) { controller.is_connected = false; }); |
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index 4b6c1083f..f28b36806 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h | |||
| @@ -119,6 +119,7 @@ public: | |||
| 119 | void DisconnectNPad(u32 npad_id); | 119 | void DisconnectNPad(u32 npad_id); |
| 120 | LedPattern GetLedPattern(u32 npad_id); | 120 | LedPattern GetLedPattern(u32 npad_id); |
| 121 | void SetVibrationEnabled(bool can_vibrate); | 121 | void SetVibrationEnabled(bool can_vibrate); |
| 122 | bool IsVibrationEnabled() const; | ||
| 122 | void ClearAllConnectedControllers(); | 123 | void ClearAllConnectedControllers(); |
| 123 | void DisconnectAllConnectedControllers(); | 124 | void DisconnectAllConnectedControllers(); |
| 124 | void ConnectAllDisconnectedControllers(); | 125 | void ConnectAllDisconnectedControllers(); |
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 0bd24b8eb..f8b1ca816 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -216,8 +216,8 @@ Hid::Hid() : ServiceFramework("hid") { | |||
| 216 | {201, &Hid::SendVibrationValue, "SendVibrationValue"}, | 216 | {201, &Hid::SendVibrationValue, "SendVibrationValue"}, |
| 217 | {202, &Hid::GetActualVibrationValue, "GetActualVibrationValue"}, | 217 | {202, &Hid::GetActualVibrationValue, "GetActualVibrationValue"}, |
| 218 | {203, &Hid::CreateActiveVibrationDeviceList, "CreateActiveVibrationDeviceList"}, | 218 | {203, &Hid::CreateActiveVibrationDeviceList, "CreateActiveVibrationDeviceList"}, |
| 219 | {204, nullptr, "PermitVibration"}, | 219 | {204, &Hid::PermitVibration, "PermitVibration"}, |
| 220 | {205, nullptr, "IsVibrationPermitted"}, | 220 | {205, &Hid::IsVibrationPermitted, "IsVibrationPermitted"}, |
| 221 | {206, &Hid::SendVibrationValues, "SendVibrationValues"}, | 221 | {206, &Hid::SendVibrationValues, "SendVibrationValues"}, |
| 222 | {207, nullptr, "SendVibrationGcErmCommand"}, | 222 | {207, nullptr, "SendVibrationGcErmCommand"}, |
| 223 | {208, nullptr, "GetActualVibrationGcErmCommand"}, | 223 | {208, nullptr, "GetActualVibrationGcErmCommand"}, |
| @@ -679,6 +679,27 @@ void Hid::CreateActiveVibrationDeviceList(Kernel::HLERequestContext& ctx) { | |||
| 679 | rb.PushIpcInterface<IActiveVibrationDeviceList>(); | 679 | rb.PushIpcInterface<IActiveVibrationDeviceList>(); |
| 680 | } | 680 | } |
| 681 | 681 | ||
| 682 | void Hid::PermitVibration(Kernel::HLERequestContext& ctx) { | ||
| 683 | IPC::RequestParser rp{ctx}; | ||
| 684 | const auto can_vibrate{rp.Pop<bool>()}; | ||
| 685 | applet_resource->GetController<Controller_NPad>(HidController::NPad) | ||
| 686 | .SetVibrationEnabled(can_vibrate); | ||
| 687 | |||
| 688 | LOG_DEBUG(Service_HID, "called, can_vibrate={}", can_vibrate); | ||
| 689 | |||
| 690 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 691 | rb.Push(RESULT_SUCCESS); | ||
| 692 | } | ||
| 693 | |||
| 694 | void Hid::IsVibrationPermitted(Kernel::HLERequestContext& ctx) { | ||
| 695 | LOG_DEBUG(Service_HID, "called"); | ||
| 696 | |||
| 697 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 698 | rb.Push(RESULT_SUCCESS); | ||
| 699 | rb.Push( | ||
| 700 | applet_resource->GetController<Controller_NPad>(HidController::NPad).IsVibrationEnabled()); | ||
| 701 | } | ||
| 702 | |||
| 682 | void Hid::ActivateConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) { | 703 | void Hid::ActivateConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) { |
| 683 | IPC::RequestParser rp{ctx}; | 704 | IPC::RequestParser rp{ctx}; |
| 684 | const auto applet_resource_user_id{rp.Pop<u64>()}; | 705 | const auto applet_resource_user_id{rp.Pop<u64>()}; |
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index 28260ef1b..2fd6d9fc7 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h | |||
| @@ -114,6 +114,8 @@ private: | |||
| 114 | void SetNpadHandheldActivationMode(Kernel::HLERequestContext& ctx); | 114 | void SetNpadHandheldActivationMode(Kernel::HLERequestContext& ctx); |
| 115 | void GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx); | 115 | void GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx); |
| 116 | void CreateActiveVibrationDeviceList(Kernel::HLERequestContext& ctx); | 116 | void CreateActiveVibrationDeviceList(Kernel::HLERequestContext& ctx); |
| 117 | void PermitVibration(Kernel::HLERequestContext& ctx); | ||
| 118 | void IsVibrationPermitted(Kernel::HLERequestContext& ctx); | ||
| 117 | void ActivateConsoleSixAxisSensor(Kernel::HLERequestContext& ctx); | 119 | void ActivateConsoleSixAxisSensor(Kernel::HLERequestContext& ctx); |
| 118 | void StartConsoleSixAxisSensor(Kernel::HLERequestContext& ctx); | 120 | void StartConsoleSixAxisSensor(Kernel::HLERequestContext& ctx); |
| 119 | void StopSixAxisSensor(Kernel::HLERequestContext& ctx); | 121 | void StopSixAxisSensor(Kernel::HLERequestContext& ctx); |