diff options
| author | 2015-03-17 10:19:59 -0400 | |
|---|---|---|
| committer | 2015-03-17 10:19:59 -0400 | |
| commit | 0bb4b77b784dfb1e405c71033bfa9988ac024a2d (patch) | |
| tree | 26263ca5db60c6ad51be2a5bfb0be135fdb91a45 /src | |
| parent | Merge pull request #660 from purpasmart96/ncch_updates (diff) | |
| parent | HID: Proper Signal Interrupts for EnableAccelerometer & EnableGyroscopeLow along (diff) | |
| download | yuzu-0bb4b77b784dfb1e405c71033bfa9988ac024a2d.tar.gz yuzu-0bb4b77b784dfb1e405c71033bfa9988ac024a2d.tar.xz yuzu-0bb4b77b784dfb1e405c71033bfa9988ac024a2d.zip | |
Merge pull request #655 from purpasmart96/hid_fixes
HID: Proper Signal Interrupts for EnableAccelerometer & EnableGyroscopeLow along with a stub for GetSoundVolume
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/hid/hid.cpp | 32 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.h | 30 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid_spvr.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid_user.cpp | 16 |
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 8adb03f2e..138603d9b 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) { | |||
| 114 | u32* cmd_buff = Kernel::GetCommandBuffer(); | 114 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 115 | 115 | ||
| 116 | cmd_buff[1] = 0; // No error | 116 | cmd_buff[1] = 0; // No error |
| 117 | cmd_buff[2] = 0x14000000; // IPC Command Structure translate-header | ||
| 117 | // TODO(yuriks): Return error from SendSyncRequest is this fails (part of IPC marshalling) | 118 | // TODO(yuriks): Return error from SendSyncRequest is this fails (part of IPC marshalling) |
| 118 | cmd_buff[3] = Kernel::g_handle_table.Create(Service::HID::shared_mem).MoveFrom(); | 119 | cmd_buff[3] = Kernel::g_handle_table.Create(Service::HID::shared_mem).MoveFrom(); |
| 119 | cmd_buff[4] = Kernel::g_handle_table.Create(Service::HID::event_pad_or_touch_1).MoveFrom(); | 120 | 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) { | |||
| 123 | cmd_buff[8] = Kernel::g_handle_table.Create(Service::HID::event_debug_pad).MoveFrom(); | 124 | cmd_buff[8] = Kernel::g_handle_table.Create(Service::HID::event_debug_pad).MoveFrom(); |
| 124 | } | 125 | } |
| 125 | 126 | ||
| 127 | void EnableAccelerometer(Service::Interface* self) { | ||
| 128 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 129 | |||
| 130 | event_accelerometer->Signal(); | ||
| 131 | |||
| 132 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 133 | |||
| 134 | LOG_WARNING(Service_HID, "(STUBBED) called"); | ||
| 135 | } | ||
| 136 | |||
| 137 | void EnableGyroscopeLow(Service::Interface* self) { | ||
| 138 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 139 | |||
| 140 | event_gyroscope->Signal(); | ||
| 141 | |||
| 142 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 143 | |||
| 144 | LOG_WARNING(Service_HID, "(STUBBED) called"); | ||
| 145 | } | ||
| 146 | |||
| 147 | void GetSoundVolume(Service::Interface* self) { | ||
| 148 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 149 | |||
| 150 | const u8 volume = 0x3F; // TODO(purpasmart): Find out if this is the max value for the volume | ||
| 151 | |||
| 152 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 153 | cmd_buff[2] = volume; | ||
| 154 | |||
| 155 | LOG_WARNING(Service_HID, "(STUBBED) called"); | ||
| 156 | } | ||
| 157 | |||
| 126 | void HIDInit() { | 158 | void HIDInit() { |
| 127 | using namespace Kernel; | 159 | using namespace Kernel; |
| 128 | 160 | ||
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}}; | |||
| 161 | * None | 161 | * None |
| 162 | * Outputs: | 162 | * Outputs: |
| 163 | * 1 : Result of function, 0 on success, otherwise error code | 163 | * 1 : Result of function, 0 on success, otherwise error code |
| 164 | * 2 : Unused | 164 | * 2 : IPC Command Structure translate-header |
| 165 | * 3 : Handle to HID_User shared memory | 165 | * 3 : Handle to HID_User shared memory |
| 166 | * 4 : Event signaled by HID_User | 166 | * 4 : Event signaled by HID_User |
| 167 | * 5 : Event signaled by HID_User | 167 | * 5 : Event signaled by HID_User |
| @@ -171,6 +171,34 @@ const PadState PAD_CIRCLE_DOWN = {{1u << 31}}; | |||
| 171 | */ | 171 | */ |
| 172 | void GetIPCHandles(Interface* self); | 172 | void GetIPCHandles(Interface* self); |
| 173 | 173 | ||
| 174 | /** | ||
| 175 | * HID::EnableAccelerometer service function | ||
| 176 | * Inputs: | ||
| 177 | * None | ||
| 178 | * Outputs: | ||
| 179 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 180 | */ | ||
| 181 | void EnableAccelerometer(Interface* self); | ||
| 182 | |||
| 183 | /** | ||
| 184 | * HID::EnableGyroscopeLow service function | ||
| 185 | * Inputs: | ||
| 186 | * None | ||
| 187 | * Outputs: | ||
| 188 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 189 | */ | ||
| 190 | void EnableGyroscopeLow(Interface* self); | ||
| 191 | |||
| 192 | /** | ||
| 193 | * HID::GetSoundVolume service function | ||
| 194 | * Inputs: | ||
| 195 | * None | ||
| 196 | * Outputs: | ||
| 197 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 198 | * 2 : u8 output value | ||
| 199 | */ | ||
| 200 | void GetSoundVolume(Interface* self); | ||
| 201 | |||
| 174 | /// Checks for user input updates | 202 | /// Checks for user input updates |
| 175 | void HIDUpdate(); | 203 | void HIDUpdate(); |
| 176 | 204 | ||
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[] = { | |||
| 13 | {0x000A0000, GetIPCHandles, "GetIPCHandles"}, | 13 | {0x000A0000, GetIPCHandles, "GetIPCHandles"}, |
| 14 | {0x000B0000, nullptr, "StartAnalogStickCalibration"}, | 14 | {0x000B0000, nullptr, "StartAnalogStickCalibration"}, |
| 15 | {0x000E0000, nullptr, "GetAnalogStickCalibrateParam"}, | 15 | {0x000E0000, nullptr, "GetAnalogStickCalibrateParam"}, |
| 16 | {0x00110000, nullptr, "EnableAccelerometer"}, | 16 | {0x00110000, EnableAccelerometer, "EnableAccelerometer"}, |
| 17 | {0x00120000, nullptr, "DisableAccelerometer"}, | 17 | {0x00120000, nullptr, "DisableAccelerometer"}, |
| 18 | {0x00130000, nullptr, "EnableGyroscopeLow"}, | 18 | {0x00130000, EnableGyroscopeLow, "EnableGyroscopeLow"}, |
| 19 | {0x00140000, nullptr, "DisableGyroscopeLow"}, | 19 | {0x00140000, nullptr, "DisableGyroscopeLow"}, |
| 20 | {0x00150000, nullptr, "GetGyroscopeLowRawToDpsCoefficient"}, | 20 | {0x00150000, nullptr, "GetGyroscopeLowRawToDpsCoefficient"}, |
| 21 | {0x00160000, nullptr, "GetGyroscopeLowCalibrateParam"}, | 21 | {0x00160000, nullptr, "GetGyroscopeLowCalibrateParam"}, |
| 22 | {0x00170000, nullptr, "GetSoundVolume"}, | 22 | {0x00170000, GetSoundVolume, "GetSoundVolume"}, |
| 23 | }; | 23 | }; |
| 24 | 24 | ||
| 25 | HID_SPVR_Interface::HID_SPVR_Interface() { | 25 | 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 { | |||
| 10 | namespace HID { | 10 | namespace HID { |
| 11 | 11 | ||
| 12 | const Interface::FunctionInfo FunctionTable[] = { | 12 | const Interface::FunctionInfo FunctionTable[] = { |
| 13 | {0x000A0000, GetIPCHandles, "GetIPCHandles"}, | 13 | {0x000A0000, GetIPCHandles, "GetIPCHandles"}, |
| 14 | {0x00110000, nullptr, "EnableAccelerometer"}, | 14 | {0x00110000, EnableAccelerometer, "EnableAccelerometer"}, |
| 15 | {0x00120000, nullptr, "DisableAccelerometer"}, | 15 | {0x00120000, nullptr, "DisableAccelerometer"}, |
| 16 | {0x00130000, nullptr, "EnableGyroscopeLow"}, | 16 | {0x00130000, EnableGyroscopeLow, "EnableGyroscopeLow"}, |
| 17 | {0x00140000, nullptr, "DisableGyroscopeLow"}, | 17 | {0x00140000, nullptr, "DisableGyroscopeLow"}, |
| 18 | {0x00150000, nullptr, "GetGyroscopeLowRawToDpsCoefficient"}, | 18 | {0x00150000, nullptr, "GetGyroscopeLowRawToDpsCoefficient"}, |
| 19 | {0x00160000, nullptr, "GetGyroscopeLowCalibrateParam"}, | 19 | {0x00160000, nullptr, "GetGyroscopeLowCalibrateParam"}, |
| 20 | {0x00170000, nullptr, "GetSoundVolume"}, | 20 | {0x00170000, GetSoundVolume, "GetSoundVolume"}, |
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | HID_U_Interface::HID_U_Interface() { | 23 | HID_U_Interface::HID_U_Interface() { |