summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpurpasmart96 <kanzoconfigz@hotmail.com>2015-03-13 22:36:19 +0100
committerpurpasmart96 <kanzoconfigz@hotmail.com>2015-03-17 02:55:58 +0100
commit5b1757d6a519b4c35473da37ad209543590ee036 (patch)
tree8d2a53760070f53c1b2fbfa57543bb52f64a6d8d
parentMerge pull request #642 from bunnei/touchpad (diff)
downloadyuzu-5b1757d6a519b4c35473da37ad209543590ee036.tar
yuzu-5b1757d6a519b4c35473da37ad209543590ee036.tar.gz
yuzu-5b1757d6a519b4c35473da37ad209543590ee036.tar.bz2
yuzu-5b1757d6a519b4c35473da37ad209543590ee036.tar.lz
yuzu-5b1757d6a519b4c35473da37ad209543590ee036.tar.xz
yuzu-5b1757d6a519b4c35473da37ad209543590ee036.tar.zst
yuzu-5b1757d6a519b4c35473da37ad209543590ee036.zip
-rw-r--r--src/core/hle/service/hid/hid.cpp32
-rw-r--r--src/core/hle/service/hid/hid.h30
-rw-r--r--src/core/hle/service/hid/hid_spvr.cpp6
-rw-r--r--src/core/hle/service/hid/hid_user.cpp16
4 files changed, 72 insertions, 12 deletions
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index e7f9bec7e..6a763fd51 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -114,6 +114,7 @@ void GetIPCHandles(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
cmd_buff[1] = 0; // No error
+ cmd_buff[2] = 0x14000000; // IPC Command Structure translate-header
// TODO(yuriks): Return error from SendSyncRequest is this fails (part of IPC marshalling)
cmd_buff[3] = Kernel::g_handle_table.Create(Service::HID::shared_mem).MoveFrom();
cmd_buff[4] = Kernel::g_handle_table.Create(Service::HID::event_pad_or_touch_1).MoveFrom();
@@ -123,6 +124,37 @@ void GetIPCHandles(Service::Interface* self) {
cmd_buff[8] = Kernel::g_handle_table.Create(Service::HID::event_debug_pad).MoveFrom();
}
+void EnableAccelerometer(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ event_accelerometer->Signal();
+
+ cmd_buff[1] = RESULT_SUCCESS.raw;
+
+ LOG_WARNING(Service_HID, "(STUBBED) called");
+}
+
+void EnableGyroscopeLow(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ event_gyroscope->Signal();
+
+ cmd_buff[1] = RESULT_SUCCESS.raw;
+
+ LOG_WARNING(Service_HID, "(STUBBED) called");
+}
+
+void GetSoundVolume(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ const u8 volume = 0x3F; // TODO(purpasmart): Find out if this is the max value for the volume
+
+ cmd_buff[1] = RESULT_SUCCESS.raw;
+ cmd_buff[2] = volume;
+
+ LOG_WARNING(Service_HID, "(STUBBED) called");
+}
+
void HIDInit() {
using namespace Kernel;
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h
index 0946cf660..97462c7f8 100644
--- a/src/core/hle/service/hid/hid.h
+++ b/src/core/hle/service/hid/hid.h
@@ -161,7 +161,7 @@ const PadState PAD_CIRCLE_DOWN = {{1u << 31}};
* None
* Outputs:
* 1 : Result of function, 0 on success, otherwise error code
- * 2 : Unused
+ * 2 : IPC Command Structure translate-header
* 3 : Handle to HID_User shared memory
* 4 : Event signaled by HID_User
* 5 : Event signaled by HID_User
@@ -171,6 +171,34 @@ const PadState PAD_CIRCLE_DOWN = {{1u << 31}};
*/
void GetIPCHandles(Interface* self);
+/**
+ * HID::EnableAccelerometer service function
+ * Inputs:
+ * None
+ * Outputs:
+ * 1 : Result of function, 0 on success, otherwise error code
+ */
+void EnableAccelerometer(Interface* self);
+
+/**
+ * HID::EnableGyroscopeLow service function
+ * Inputs:
+ * None
+ * Outputs:
+ * 1 : Result of function, 0 on success, otherwise error code
+ */
+void EnableGyroscopeLow(Interface* self);
+
+/**
+ * HID::GetSoundVolume service function
+ * Inputs:
+ * None
+ * Outputs:
+ * 1 : Result of function, 0 on success, otherwise error code
+ * 2 : u8 output value
+ */
+void GetSoundVolume(Interface* self);
+
/// Checks for user input updates
void HIDUpdate();
diff --git a/src/core/hle/service/hid/hid_spvr.cpp b/src/core/hle/service/hid/hid_spvr.cpp
index 790dcabbf..f296b076f 100644
--- a/src/core/hle/service/hid/hid_spvr.cpp
+++ b/src/core/hle/service/hid/hid_spvr.cpp
@@ -13,13 +13,13 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x000A0000, GetIPCHandles, "GetIPCHandles"},
{0x000B0000, nullptr, "StartAnalogStickCalibration"},
{0x000E0000, nullptr, "GetAnalogStickCalibrateParam"},
- {0x00110000, nullptr, "EnableAccelerometer"},
+ {0x00110000, EnableAccelerometer, "EnableAccelerometer"},
{0x00120000, nullptr, "DisableAccelerometer"},
- {0x00130000, nullptr, "EnableGyroscopeLow"},
+ {0x00130000, EnableGyroscopeLow, "EnableGyroscopeLow"},
{0x00140000, nullptr, "DisableGyroscopeLow"},
{0x00150000, nullptr, "GetGyroscopeLowRawToDpsCoefficient"},
{0x00160000, nullptr, "GetGyroscopeLowCalibrateParam"},
- {0x00170000, nullptr, "GetSoundVolume"},
+ {0x00170000, GetSoundVolume, "GetSoundVolume"},
};
HID_SPVR_Interface::HID_SPVR_Interface() {
diff --git a/src/core/hle/service/hid/hid_user.cpp b/src/core/hle/service/hid/hid_user.cpp
index c2d5758fb..3682c9416 100644
--- a/src/core/hle/service/hid/hid_user.cpp
+++ b/src/core/hle/service/hid/hid_user.cpp
@@ -10,14 +10,14 @@ namespace Service {
namespace HID {
const Interface::FunctionInfo FunctionTable[] = {
- {0x000A0000, GetIPCHandles, "GetIPCHandles"},
- {0x00110000, nullptr, "EnableAccelerometer"},
- {0x00120000, nullptr, "DisableAccelerometer"},
- {0x00130000, nullptr, "EnableGyroscopeLow"},
- {0x00140000, nullptr, "DisableGyroscopeLow"},
- {0x00150000, nullptr, "GetGyroscopeLowRawToDpsCoefficient"},
- {0x00160000, nullptr, "GetGyroscopeLowCalibrateParam"},
- {0x00170000, nullptr, "GetSoundVolume"},
+ {0x000A0000, GetIPCHandles, "GetIPCHandles"},
+ {0x00110000, EnableAccelerometer, "EnableAccelerometer"},
+ {0x00120000, nullptr, "DisableAccelerometer"},
+ {0x00130000, EnableGyroscopeLow, "EnableGyroscopeLow"},
+ {0x00140000, nullptr, "DisableGyroscopeLow"},
+ {0x00150000, nullptr, "GetGyroscopeLowRawToDpsCoefficient"},
+ {0x00160000, nullptr, "GetGyroscopeLowCalibrateParam"},
+ {0x00170000, GetSoundVolume, "GetSoundVolume"},
};
HID_U_Interface::HID_U_Interface() {