diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/hid.cpp | 44 |
1 files changed, 39 insertions, 5 deletions
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 @@ | |||
| 5 | #include "common/log.h" | 5 | #include "common/log.h" |
| 6 | 6 | ||
| 7 | #include "core/hle/hle.h" | 7 | #include "core/hle/hle.h" |
| 8 | #include "core/hle/kernel/event.h" | ||
| 9 | #include "core/hle/kernel/shared_memory.h" | ||
| 8 | #include "core/hle/service/hid.h" | 10 | #include "core/hle/service/hid.h" |
| 9 | 11 | ||
| 10 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 12 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| @@ -12,18 +14,50 @@ | |||
| 12 | 14 | ||
| 13 | namespace HID_User { | 15 | namespace HID_User { |
| 14 | 16 | ||
| 17 | Handle g_shared_mem = 0; ///< Handle to shared memory region designated to HID_User service | ||
| 18 | |||
| 19 | /** | ||
| 20 | * HID_User::GetIPCHandles service function | ||
| 21 | * Inputs: | ||
| 22 | * None | ||
| 23 | * Outputs: | ||
| 24 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 25 | * 2 : Unused | ||
| 26 | * 3 : Handle to HID_User shared memory | ||
| 27 | * 4 : Event signaled by HID_User | ||
| 28 | * 5 : Event signaled by HID_User | ||
| 29 | * 6 : Event signaled by HID_User | ||
| 30 | * 7 : Gyroscope event | ||
| 31 | * 8 : Event signaled by HID_User | ||
| 32 | */ | ||
| 33 | void GetIPCHandles(Service::Interface* self) { | ||
| 34 | u32* cmd_buff = Service::GetCommandBuffer(); | ||
| 35 | |||
| 36 | cmd_buff[1] = 0; // No error | ||
| 37 | cmd_buff[3] = g_shared_mem; | ||
| 38 | cmd_buff[4] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventA"); | ||
| 39 | cmd_buff[5] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventB"); | ||
| 40 | cmd_buff[6] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventC"); | ||
| 41 | cmd_buff[7] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventGyroscope"); | ||
| 42 | cmd_buff[8] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventD"); | ||
| 43 | |||
| 44 | DEBUG_LOG(KERNEL, "called"); | ||
| 45 | } | ||
| 46 | |||
| 15 | const Interface::FunctionInfo FunctionTable[] = { | 47 | const Interface::FunctionInfo FunctionTable[] = { |
| 16 | {0x000A0000, nullptr, "GetIPCHandles"}, | 48 | {0x000A0000, GetIPCHandles, "GetIPCHandles"}, |
| 17 | {0x00110000, nullptr, "EnableAccelerometer"}, | 49 | {0x00110000, nullptr, "EnableAccelerometer"}, |
| 18 | {0x00130000, nullptr, "EnableGyroscopeLow"}, | 50 | {0x00130000, nullptr, "EnableGyroscopeLow"}, |
| 19 | {0x00150000, nullptr, "GetGyroscopeLowRawToDpsCoefficient"}, | 51 | {0x00150000, nullptr, "GetGyroscopeLowRawToDpsCoefficient"}, |
| 20 | {0x00160000, nullptr, "GetGyroscopeLowCalibrateParam"}, | 52 | {0x00160000, nullptr, "GetGyroscopeLowCalibrateParam"}, |
| 21 | }; | 53 | }; |
| 22 | 54 | ||
| 23 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 55 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 24 | // Interface class | 56 | // Interface class |
| 25 | 57 | ||
| 26 | Interface::Interface() { | 58 | Interface::Interface() { |
| 59 | g_shared_mem = Kernel::CreateSharedMemory("HID_User:SharedMem"); // Create shared memory object | ||
| 60 | |||
| 27 | Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | 61 | Register(FunctionTable, ARRAY_SIZE(FunctionTable)); |
| 28 | } | 62 | } |
| 29 | 63 | ||