summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2020-10-06 11:08:52 +0200
committerMorph <39850852+Morph1984@users.noreply.github.com>2020-11-16 05:33:20 +0100
commitb92bf51ae1a08eca22bf0ce98b234692b9d59207 (patch)
tree9b7347d407509503d91d3987cb037bc0bcab679e /src
parenthid: Stub InitializeVibrationDevice (diff)
downloadyuzu-b92bf51ae1a08eca22bf0ce98b234692b9d59207.tar
yuzu-b92bf51ae1a08eca22bf0ce98b234692b9d59207.tar.gz
yuzu-b92bf51ae1a08eca22bf0ce98b234692b9d59207.tar.bz2
yuzu-b92bf51ae1a08eca22bf0ce98b234692b9d59207.tar.lz
yuzu-b92bf51ae1a08eca22bf0ce98b234692b9d59207.tar.xz
yuzu-b92bf51ae1a08eca22bf0ce98b234692b9d59207.tar.zst
yuzu-b92bf51ae1a08eca22bf0ce98b234692b9d59207.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/hid/hid.cpp26
-rw-r--r--src/core/hle/service/hid/hid.h16
2 files changed, 39 insertions, 3 deletions
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 86b83dcc6..993738f36 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -924,12 +924,32 @@ void Hid::GetActualVibrationValue(Kernel::HLERequestContext& ctx) {
}
void Hid::GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_HID, "called");
+ IPC::RequestParser rp{ctx};
+ const auto vibration_device_handle{rp.PopRaw<Controller_NPad::DeviceHandle>()};
+
+ VibrationDeviceInfo vibration_device_info;
+
+ vibration_device_info.type = VibrationDeviceType::LinearResonantActuator;
+
+ switch (vibration_device_handle.device_index) {
+ case Controller_NPad::DeviceIndex::Left:
+ vibration_device_info.position = VibrationDevicePosition::Left;
+ break;
+ case Controller_NPad::DeviceIndex::Right:
+ vibration_device_info.position = VibrationDevicePosition::Right;
+ break;
+ case Controller_NPad::DeviceIndex::None:
+ default:
+ vibration_device_info.position = VibrationDevicePosition::None;
+ break;
+ }
+
+ LOG_DEBUG(Service_HID, "called, vibration_device_type={}, vibration_device_position={}",
+ vibration_device_info.type, vibration_device_info.position);
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS);
- rb.Push<u32>(1);
- rb.Push<u32>(0);
+ rb.PushRaw<VibrationDeviceInfo>(vibration_device_info);
}
void Hid::CreateActiveVibrationDeviceList(Kernel::HLERequestContext& ctx) {
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h
index fd0372b18..2f7483170 100644
--- a/src/core/hle/service/hid/hid.h
+++ b/src/core/hle/service/hid/hid.h
@@ -146,6 +146,22 @@ private:
void SetIsPalmaAllConnectable(Kernel::HLERequestContext& ctx);
void SetPalmaBoostMode(Kernel::HLERequestContext& ctx);
+ enum class VibrationDeviceType : u32 {
+ LinearResonantActuator = 1,
+ };
+
+ enum class VibrationDevicePosition : u32 {
+ None = 0,
+ Left = 1,
+ Right = 2,
+ };
+
+ struct VibrationDeviceInfo {
+ VibrationDeviceType type{};
+ VibrationDevicePosition position{};
+ };
+ static_assert(sizeof(VibrationDeviceInfo) == 0x8, "VibrationDeviceInfo has incorrect size.");
+
std::shared_ptr<IAppletResource> applet_resource;
Core::System& system;
};