diff options
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/service/hid.cpp | 49 | ||||
| -rw-r--r-- | src/core/hle/svc.cpp | 2 |
2 files changed, 45 insertions, 6 deletions
diff --git a/src/core/hle/service/hid.cpp b/src/core/hle/service/hid.cpp index ab78f47d7..4e470795f 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,55 @@ | |||
| 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 | {0x000B0000, nullptr, "StartAnalogStickCalibration"}, |
| 18 | {0x00130000, nullptr, "EnableGyroscopeLow"}, | 50 | {0x000E0000, nullptr, "GetAnalogStickCalibrateParam"}, |
| 19 | {0x00150000, nullptr, "GetGyroscopeLowRawToDpsCoefficient"}, | 51 | {0x00110000, nullptr, "EnableAccelerometer"}, |
| 20 | {0x00160000, nullptr, "GetGyroscopeLowCalibrateParam"}, | 52 | {0x00120000, nullptr, "DisableAccelerometer"}, |
| 53 | {0x00130000, nullptr, "EnableGyroscopeLow"}, | ||
| 54 | {0x00140000, nullptr, "DisableGyroscopeLow"}, | ||
| 55 | {0x00150000, nullptr, "GetGyroscopeLowRawToDpsCoefficient"}, | ||
| 56 | {0x00160000, nullptr, "GetGyroscopeLowCalibrateParam"}, | ||
| 57 | {0x00170000, nullptr, "GetSoundVolume"}, | ||
| 21 | }; | 58 | }; |
| 22 | 59 | ||
| 23 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 60 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 24 | // Interface class | 61 | // Interface class |
| 25 | 62 | ||
| 26 | Interface::Interface() { | 63 | Interface::Interface() { |
| 64 | g_shared_mem = Kernel::CreateSharedMemory("HID_User:SharedMem"); // Create shared memory object | ||
| 65 | |||
| 27 | Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | 66 | Register(FunctionTable, ARRAY_SIZE(FunctionTable)); |
| 28 | } | 67 | } |
| 29 | 68 | ||
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 328d048bd..19f717bd2 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp | |||
| @@ -56,7 +56,7 @@ Result ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 addr1, u32 siz | |||
| 56 | 56 | ||
| 57 | /// Maps a memory block to specified address | 57 | /// Maps a memory block to specified address |
| 58 | Result MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_permissions) { | 58 | Result MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_permissions) { |
| 59 | DEBUG_LOG(SVC, "called memblock=0x08X, addr=0x%08X, mypermissions=0x%08X, otherpermission=%d", | 59 | DEBUG_LOG(SVC, "called memblock=0x%08X, addr=0x%08X, mypermissions=0x%08X, otherpermission=%d", |
| 60 | handle, addr, permissions, other_permissions); | 60 | handle, addr, permissions, other_permissions); |
| 61 | 61 | ||
| 62 | Kernel::MemoryPermission permissions_type = static_cast<Kernel::MemoryPermission>(permissions); | 62 | Kernel::MemoryPermission permissions_type = static_cast<Kernel::MemoryPermission>(permissions); |