summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar wwylele2016-03-25 11:39:59 +0300
committerGravatar wwylele2016-03-25 12:22:02 +0300
commit1d2070d0d30448f79d8e39c614db4375d23b58c4 (patch)
tree87899f4934fabc002b010f68c9d0996507b4f664
parentimplement accel and gyro backend (diff)
downloadyuzu-1d2070d0d30448f79d8e39c614db4375d23b58c4.tar.gz
yuzu-1d2070d0d30448f79d8e39c614db4375d23b58c4.tar.xz
yuzu-1d2070d0d30448f79d8e39c614db4375d23b58c4.zip
implement GyroscopeCalibrateParam
-rw-r--r--src/core/hle/service/hid/hid.cpp15
-rw-r--r--src/core/hle/service/hid/hid.h14
2 files changed, 20 insertions, 9 deletions
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 56bf89fa8..b27ab6d9b 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -251,14 +251,13 @@ void GetGyroscopeLowCalibrateParam(Service::Interface* self) {
251 251
252 cmd_buff[1] = RESULT_SUCCESS.raw; 252 cmd_buff[1] = RESULT_SUCCESS.raw;
253 253
254 // currently don't understand the meaning of return value, 254 const s16 param_unit = 6700; // an approximate value taken from hw
255 // so stubbed these with value from a real console. 255 GyroscopeCalibrateParam param = {
256 // TODO(wwylele): implement this correctly 256 { 0, param_unit, -param_unit },
257 cmd_buff[2] = 0x19DDFFDC; 257 { 0, param_unit, -param_unit },
258 cmd_buff[3] = 0x0002E5DA; 258 { 0, param_unit, -param_unit },
259 cmd_buff[4] = 0xE5CE1A2D; 259 };
260 cmd_buff[5] = 0x19C6FFF3; 260 memcpy(&cmd_buff[2], &param, sizeof(param));
261 cmd_buff[6] = 0x001CE61E;
262 261
263 LOG_WARNING(Service_HID, "(STUBBED) called"); 262 LOG_WARNING(Service_HID, "(STUBBED) called");
264} 263}
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h
index ebe137525..170d19ea8 100644
--- a/src/core/hle/service/hid/hid.h
+++ b/src/core/hle/service/hid/hid.h
@@ -160,6 +160,18 @@ struct SharedMem {
160 } gyroscope; 160 } gyroscope;
161}; 161};
162 162
163/**
164 * Structure of calibrate params that GetGyroscopeLowCalibrateParam returns
165 */
166struct GyroscopeCalibrateParam {
167 struct {
168 // TODO (wwylele): figure out the exact meaning of these params
169 s16 zero_point;
170 s16 positive_unit_point;
171 s16 negative_unit_point;
172 } x, y, z;
173};
174
163// TODO: MSVC does not support using offsetof() on non-static data members even though this 175// TODO: MSVC does not support using offsetof() on non-static data members even though this
164// is technically allowed since C++11. This macro should be enabled once MSVC adds 176// is technically allowed since C++11. This macro should be enabled once MSVC adds
165// support for that. 177// support for that.
@@ -284,7 +296,7 @@ void GetGyroscopeLowRawToDpsCoefficient(Service::Interface* self);
284 * None 296 * None
285 * Outputs: 297 * Outputs:
286 * 1 : Result of function, 0 on success, otherwise error code 298 * 1 : Result of function, 0 on success, otherwise error code
287 * 2~6 : CalibrateParam? 299 * 2~6 (18 bytes) : struct GyroscopeCalibrateParam
288 */ 300 */
289void GetGyroscopeLowCalibrateParam(Service::Interface* self); 301void GetGyroscopeLowCalibrateParam(Service::Interface* self);
290 302