summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar german2020-11-26 21:15:48 -0600
committerGravatar german2020-11-26 21:35:11 -0600
commit3898d8f0d7fc51c7337eae4aa174b9545d52157e (patch)
treea8fc2c2014a1b22e09db350a5b162a8b5e72d94b
parentMerge pull request #5016 from comex/xx-push (diff)
downloadyuzu-3898d8f0d7fc51c7337eae4aa174b9545d52157e.tar.gz
yuzu-3898d8f0d7fc51c7337eae4aa174b9545d52157e.tar.xz
yuzu-3898d8f0d7fc51c7337eae4aa174b9545d52157e.zip
Stub set and get NpadCommunicationMode
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp8
-rw-r--r--src/core/hle/service/hid/controllers/npad.h10
-rw-r--r--src/core/hle/service/hid/hid.cpp32
-rw-r--r--src/core/hle/service/hid/hid.h2
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
680void Controller_NPad::SetNpadCommunicationMode(NpadCommunicationMode communication_mode_) {
681 communication_mode = communication_mode_;
682}
683
684Controller_NPad::NpadCommunicationMode Controller_NPad::GetNpadCommunicationMode() const {
685 return communication_mode;
686}
687
680void Controller_NPad::SetNpadMode(u32 npad_id, NpadAssignments assignment_mode) { 688void 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 902516b29..224000def 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -306,8 +306,8 @@ Hid::Hid(Core::System& system) : ServiceFramework("hid"), system(system) {
306 {527, nullptr, "EnablePalmaBoostMode"}, 306 {527, nullptr, "EnablePalmaBoostMode"},
307 {528, nullptr, "GetPalmaBluetoothAddress"}, 307 {528, nullptr, "GetPalmaBluetoothAddress"},
308 {529, nullptr, "SetDisallowedPalmaConnection"}, 308 {529, nullptr, "SetDisallowedPalmaConnection"},
309 {1000, nullptr, "SetNpadCommunicationMode"}, 309 {1000, &Hid::SetNpadCommunicationMode, "SetNpadCommunicationMode"},
310 {1001, nullptr, "GetNpadCommunicationMode"}, 310 {1001, &Hid::GetNpadCommunicationMode, "GetNpadCommunicationMode"},
311 {1002, nullptr, "SetTouchScreenConfiguration"}, 311 {1002, nullptr, "SetTouchScreenConfiguration"},
312 {1003, nullptr, "IsFirmwareUpdateNeededForNotification"}, 312 {1003, nullptr, "IsFirmwareUpdateNeededForNotification"},
313 {2000, nullptr, "ActivateDigitizer"}, 313 {2000, nullptr, "ActivateDigitizer"},
@@ -1296,6 +1296,34 @@ void Hid::SetPalmaBoostMode(Kernel::HLERequestContext& ctx) {
1296 rb.Push(RESULT_SUCCESS); 1296 rb.Push(RESULT_SUCCESS);
1297} 1297}
1298 1298
1299void Hid::SetNpadCommunicationMode(Kernel::HLERequestContext& ctx) {
1300 IPC::RequestParser rp{ctx};
1301 const auto applet_resource_user_id{rp.Pop<u64>()};
1302 const auto communication_mode{rp.PopEnum<Controller_NPad::NpadCommunicationMode>()};
1303
1304 applet_resource->GetController<Controller_NPad>(HidController::NPad)
1305 .SetNpadCommunicationMode(communication_mode);
1306
1307 LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}, communication_mode={}",
1308 applet_resource_user_id, communication_mode);
1309
1310 IPC::ResponseBuilder rb{ctx, 2};
1311 rb.Push(RESULT_SUCCESS);
1312}
1313
1314void Hid::GetNpadCommunicationMode(Kernel::HLERequestContext& ctx) {
1315 IPC::RequestParser rp{ctx};
1316 const auto applet_resource_user_id{rp.Pop<u64>()};
1317
1318 LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}",
1319 applet_resource_user_id);
1320
1321 IPC::ResponseBuilder rb{ctx, 4};
1322 rb.Push(RESULT_SUCCESS);
1323 rb.PushEnum(applet_resource->GetController<Controller_NPad>(HidController::NPad)
1324 .GetNpadCommunicationMode());
1325}
1326
1299class HidDbg final : public ServiceFramework<HidDbg> { 1327class HidDbg final : public ServiceFramework<HidDbg> {
1300public: 1328public:
1301 explicit HidDbg() : ServiceFramework{"hid:dbg"} { 1329 explicit HidDbg() : ServiceFramework{"hid:dbg"} {
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h
index c8e4a4b55..c529aaac9 100644
--- a/src/core/hle/service/hid/hid.h
+++ b/src/core/hle/service/hid/hid.h
@@ -146,6 +146,8 @@ private:
146 void ResetSevenSixAxisSensorTimestamp(Kernel::HLERequestContext& ctx); 146 void ResetSevenSixAxisSensorTimestamp(Kernel::HLERequestContext& ctx);
147 void SetIsPalmaAllConnectable(Kernel::HLERequestContext& ctx); 147 void SetIsPalmaAllConnectable(Kernel::HLERequestContext& ctx);
148 void SetPalmaBoostMode(Kernel::HLERequestContext& ctx); 148 void SetPalmaBoostMode(Kernel::HLERequestContext& ctx);
149 void SetNpadCommunicationMode(Kernel::HLERequestContext& ctx);
150 void GetNpadCommunicationMode(Kernel::HLERequestContext& ctx);
149 151
150 enum class VibrationDeviceType : u32 { 152 enum class VibrationDeviceType : u32 {
151 LinearResonantActuator = 1, 153 LinearResonantActuator = 1,