diff options
author | bunnei <bunneidev@gmail.com> | 2020-09-20 21:39:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-20 21:39:20 +0200 |
commit | 754109fd54fccc844a41b8f42de1969b14c55721 (patch) | |
tree | 356b611e59fde4c96d5ca74427cd67f8db718e45 /src/core/hle | |
parent | Merge pull request #4643 from FearlessTobi/decrease-pad-update-interval (diff) | |
parent | hid: Implement Get/SetNpadHandheldActivationMode (diff) | |
download | yuzu-754109fd54fccc844a41b8f42de1969b14c55721.tar yuzu-754109fd54fccc844a41b8f42de1969b14c55721.tar.gz yuzu-754109fd54fccc844a41b8f42de1969b14c55721.tar.bz2 yuzu-754109fd54fccc844a41b8f42de1969b14c55721.tar.lz yuzu-754109fd54fccc844a41b8f42de1969b14c55721.tar.xz yuzu-754109fd54fccc844a41b8f42de1969b14c55721.tar.zst yuzu-754109fd54fccc844a41b8f42de1969b14c55721.zip |
Diffstat (limited to 'src/core/hle')
-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 | 15 |
3 files changed, 28 insertions, 5 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index b65d59373..620386cd1 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -593,6 +593,14 @@ Controller_NPad::NpadHoldType Controller_NPad::GetHoldType() const { return hold_type; } +void Controller_NPad::SetNpadHandheldActivationMode(NpadHandheldActivationMode activation_mode) { + handheld_activation_mode = activation_mode; +} + +Controller_NPad::NpadHandheldActivationMode Controller_NPad::GetNpadHandheldActivationMode() const { + return handheld_activation_mode; +} + void Controller_NPad::SetNpadMode(u32 npad_id, NPadAssignments assignment_mode) { const std::size_t npad_index = NPadIdToIndex(npad_id); 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 78e7c320b..654d97c3f 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h @@ -74,6 +74,12 @@ public: Single = 1, }; + enum class NpadHandheldActivationMode : u64 { + Dual = 0, + Single = 1, + None = 2, + }; + enum class NPadControllerType { None, ProController, @@ -110,6 +116,9 @@ public: void SetHoldType(NpadHoldType joy_hold_type); NpadHoldType GetHoldType() const; + void SetNpadHandheldActivationMode(NpadHandheldActivationMode activation_mode); + NpadHandheldActivationMode GetNpadHandheldActivationMode() const; + void SetNpadMode(u32 npad_id, NPadAssignments assignment_mode); void VibrateController(const std::vector<u32>& controller_ids, @@ -369,6 +378,7 @@ private: MotionArray motions; std::vector<u32> supported_npad_id_types{}; NpadHoldType hold_type{NpadHoldType::Vertical}; + NpadHandheldActivationMode handheld_activation_mode{NpadHandheldActivationMode::Dual}; // Each controller should have their own styleset changed event std::array<Kernel::EventPair, 10> styleset_changed_events; Vibration last_processed_vibration{}; diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 1d96f705f..395e83b3f 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -739,8 +739,11 @@ void Hid::SetNpadHandheldActivationMode(Kernel::HLERequestContext& ctx) { const auto applet_resource_user_id{rp.Pop<u64>()}; const auto mode{rp.Pop<u64>()}; - LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}, mode={}", - applet_resource_user_id, mode); + LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}, mode={}", applet_resource_user_id, + mode); + + applet_resource->GetController<Controller_NPad>(HidController::NPad) + .SetNpadHandheldActivationMode(Controller_NPad::NpadHandheldActivationMode{mode}); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); @@ -750,11 +753,13 @@ void Hid::GetNpadHandheldActivationMode(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto applet_resource_user_id{rp.Pop<u64>()}; - LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}", - applet_resource_user_id); + LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); - IPC::ResponseBuilder rb{ctx, 2}; + IPC::ResponseBuilder rb{ctx, 4}; rb.Push(RESULT_SUCCESS); + rb.Push<u64>( + static_cast<u64>(applet_resource->GetController<Controller_NPad>(HidController::NPad) + .GetNpadHandheldActivationMode())); } void Hid::SwapNpadAssignment(Kernel::HLERequestContext& ctx) { |