From 552287498afa50d755168749caa95095d9d301fa Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 7 Aug 2014 20:27:56 -0400 Subject: HID: Implemented HID_User::GetIPCHandles service function. --- src/core/hle/service/hid.cpp | 44 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/hid.cpp b/src/core/hle/service/hid.cpp index ab78f47d7..3730b117a 100644 --- a/src/core/hle/service/hid.cpp +++ b/src/core/hle/service/hid.cpp @@ -5,6 +5,8 @@ #include "common/log.h" #include "core/hle/hle.h" +#include "core/hle/kernel/event.h" +#include "core/hle/kernel/shared_memory.h" #include "core/hle/service/hid.h" //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -12,18 +14,50 @@ namespace HID_User { +Handle g_shared_mem = 0; ///< Handle to shared memory region designated to HID_User service + +/** + * HID_User::GetIPCHandles service function + * Inputs: + * None + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : Unused + * 3 : Handle to HID_User shared memory + * 4 : Event signaled by HID_User + * 5 : Event signaled by HID_User + * 6 : Event signaled by HID_User + * 7 : Gyroscope event + * 8 : Event signaled by HID_User + */ +void GetIPCHandles(Service::Interface* self) { + u32* cmd_buff = Service::GetCommandBuffer(); + + cmd_buff[1] = 0; // No error + cmd_buff[3] = g_shared_mem; + cmd_buff[4] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventA"); + cmd_buff[5] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventB"); + cmd_buff[6] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventC"); + cmd_buff[7] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventGyroscope"); + cmd_buff[8] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventD"); + + DEBUG_LOG(KERNEL, "called"); +} + const Interface::FunctionInfo FunctionTable[] = { - {0x000A0000, nullptr, "GetIPCHandles"}, - {0x00110000, nullptr, "EnableAccelerometer"}, - {0x00130000, nullptr, "EnableGyroscopeLow"}, - {0x00150000, nullptr, "GetGyroscopeLowRawToDpsCoefficient"}, - {0x00160000, nullptr, "GetGyroscopeLowCalibrateParam"}, + {0x000A0000, GetIPCHandles, "GetIPCHandles"}, + {0x00110000, nullptr, "EnableAccelerometer"}, + {0x00130000, nullptr, "EnableGyroscopeLow"}, + {0x00150000, nullptr, "GetGyroscopeLowRawToDpsCoefficient"}, + {0x00160000, nullptr, "GetGyroscopeLowCalibrateParam"}, }; //////////////////////////////////////////////////////////////////////////////////////////////////// // Interface class Interface::Interface() { + g_shared_mem = Kernel::CreateSharedMemory("HID_User:SharedMem"); // Create shared memory object + Register(FunctionTable, ARRAY_SIZE(FunctionTable)); } -- cgit v1.2.3 From 091f6cf55b43cca5913079d0ab7226ff72515ec7 Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 7 Aug 2014 20:33:59 -0400 Subject: HID: Added new function entries from 3dbrew to FunctionTable. HID: Fix typo with DisableGyroscopeLow command. --- src/core/hle/service/hid.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/hid.cpp b/src/core/hle/service/hid.cpp index 3730b117a..4e470795f 100644 --- a/src/core/hle/service/hid.cpp +++ b/src/core/hle/service/hid.cpp @@ -46,10 +46,15 @@ void GetIPCHandles(Service::Interface* self) { const Interface::FunctionInfo FunctionTable[] = { {0x000A0000, GetIPCHandles, "GetIPCHandles"}, + {0x000B0000, nullptr, "StartAnalogStickCalibration"}, + {0x000E0000, nullptr, "GetAnalogStickCalibrateParam"}, {0x00110000, nullptr, "EnableAccelerometer"}, + {0x00120000, nullptr, "DisableAccelerometer"}, {0x00130000, nullptr, "EnableGyroscopeLow"}, + {0x00140000, nullptr, "DisableGyroscopeLow"}, {0x00150000, nullptr, "GetGyroscopeLowRawToDpsCoefficient"}, {0x00160000, nullptr, "GetGyroscopeLowCalibrateParam"}, + {0x00170000, nullptr, "GetSoundVolume"}, }; //////////////////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3