summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/frontend/input.h22
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp106
-rw-r--r--src/core/hle/service/hid/controllers/npad.h54
-rw-r--r--src/core/hle/service/hid/hid.cpp37
-rw-r--r--src/core/hle/service/hid/hid.h2
-rw-r--r--src/core/settings.h1
6 files changed, 203 insertions, 19 deletions
diff --git a/src/core/frontend/input.h b/src/core/frontend/input.h
index 2b098b7c6..9da0d2829 100644
--- a/src/core/frontend/input.h
+++ b/src/core/frontend/input.h
@@ -119,11 +119,11 @@ using ButtonDevice = InputDevice<bool>;
119using AnalogDevice = InputDevice<std::tuple<float, float>>; 119using AnalogDevice = InputDevice<std::tuple<float, float>>;
120 120
121/** 121/**
122 * A motion device is an input device that returns a tuple of accelerometer state vector and 122 * A motion status is an object that returns a tuple of accelerometer state vector,
123 * gyroscope state vector. 123 * gyroscope state vector, rotation state vector and orientation state matrix.
124 * 124 *
125 * For both vectors: 125 * For both vectors:
126 * x+ is the same direction as LEFT on D-pad. 126 * x+ is the same direction as RIGHT on D-pad.
127 * y+ is normal to the touch screen, pointing outward. 127 * y+ is normal to the touch screen, pointing outward.
128 * z+ is the same direction as UP on D-pad. 128 * z+ is the same direction as UP on D-pad.
129 * 129 *
@@ -133,8 +133,22 @@ using AnalogDevice = InputDevice<std::tuple<float, float>>;
133 * For gyroscope state vector: 133 * For gyroscope state vector:
134 * Orientation is determined by right-hand rule. 134 * Orientation is determined by right-hand rule.
135 * Units: deg/sec 135 * Units: deg/sec
136 *
137 * For rotation state vector
138 * Units: rotations
139 *
140 * For orientation state matrix
141 * x vector
142 * y vector
143 * z vector
144 */
145using MotionStatus = std::tuple<Common::Vec3<float>, Common::Vec3<float>, Common::Vec3<float>,
146 std::array<Common::Vec3f, 3>>;
147
148/**
149 * A motion device is an input device that returns a motion status object
136 */ 150 */
137using MotionDevice = InputDevice<std::tuple<Common::Vec3<float>, Common::Vec3<float>>>; 151using MotionDevice = InputDevice<MotionStatus>;
138 152
139/** 153/**
140 * A touch device is an input device that returns a tuple of two floats and a bool. The floats are 154 * A touch device is an input device that returns a tuple of two floats and a bool. The floats are
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index 7818c098f..b65d59373 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -250,6 +250,9 @@ void Controller_NPad::OnLoadInputDevices() {
250 std::transform(players[i].analogs.begin() + Settings::NativeAnalog::STICK_HID_BEGIN, 250 std::transform(players[i].analogs.begin() + Settings::NativeAnalog::STICK_HID_BEGIN,
251 players[i].analogs.begin() + Settings::NativeAnalog::STICK_HID_END, 251 players[i].analogs.begin() + Settings::NativeAnalog::STICK_HID_END,
252 sticks[i].begin(), Input::CreateDevice<Input::AnalogDevice>); 252 sticks[i].begin(), Input::CreateDevice<Input::AnalogDevice>);
253 std::transform(players[i].motions.begin() + Settings::NativeMotion::MOTION_HID_BEGIN,
254 players[i].motions.begin() + Settings::NativeMotion::MOTION_HID_END,
255 motions[i].begin(), Input::CreateDevice<Input::MotionDevice>);
253 } 256 }
254} 257}
255 258
@@ -266,6 +269,7 @@ void Controller_NPad::RequestPadStateUpdate(u32 npad_id) {
266 auto& rstick_entry = npad_pad_states[controller_idx].r_stick; 269 auto& rstick_entry = npad_pad_states[controller_idx].r_stick;
267 const auto& button_state = buttons[controller_idx]; 270 const auto& button_state = buttons[controller_idx];
268 const auto& analog_state = sticks[controller_idx]; 271 const auto& analog_state = sticks[controller_idx];
272 const auto& motion_state = motions[controller_idx];
269 const auto [stick_l_x_f, stick_l_y_f] = 273 const auto [stick_l_x_f, stick_l_y_f] =
270 analog_state[static_cast<std::size_t>(JoystickId::Joystick_Left)]->GetStatus(); 274 analog_state[static_cast<std::size_t>(JoystickId::Joystick_Left)]->GetStatus();
271 const auto [stick_r_x_f, stick_r_y_f] = 275 const auto [stick_r_x_f, stick_r_y_f] =
@@ -360,6 +364,45 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
360 continue; 364 continue;
361 } 365 }
362 const u32 npad_index = static_cast<u32>(i); 366 const u32 npad_index = static_cast<u32>(i);
367
368 const std::array<SixAxisGeneric*, 6> controller_sixaxes{
369 &npad.sixaxis_full, &npad.sixaxis_handheld, &npad.sixaxis_dual_left,
370 &npad.sixaxis_dual_right, &npad.sixaxis_left, &npad.sixaxis_right,
371 };
372
373 for (auto* sixaxis_sensor : controller_sixaxes) {
374 sixaxis_sensor->common.entry_count = 16;
375 sixaxis_sensor->common.total_entry_count = 17;
376
377 const auto& last_entry =
378 sixaxis_sensor->sixaxis[sixaxis_sensor->common.last_entry_index];
379
380 sixaxis_sensor->common.timestamp = core_timing.GetCPUTicks();
381 sixaxis_sensor->common.last_entry_index =
382 (sixaxis_sensor->common.last_entry_index + 1) % 17;
383
384 auto& cur_entry = sixaxis_sensor->sixaxis[sixaxis_sensor->common.last_entry_index];
385
386 cur_entry.timestamp = last_entry.timestamp + 1;
387 cur_entry.timestamp2 = cur_entry.timestamp;
388 }
389
390 // Try to read sixaxis sensor states
391 std::array<MotionDevice, 2> motion_devices;
392
393 if (sixaxis_sensors_enabled && Settings::values.motion_enabled) {
394 sixaxis_at_rest = true;
395 for (std::size_t e = 0; e < motion_devices.size(); ++e) {
396 const auto& device = motions[i][e];
397 if (device) {
398 std::tie(motion_devices[e].accel, motion_devices[e].gyro,
399 motion_devices[e].rotation, motion_devices[e].orientation) =
400 device->GetStatus();
401 sixaxis_at_rest = sixaxis_at_rest && motion_devices[e].gyro.Length2() < 0.0001f;
402 }
403 }
404 }
405
363 RequestPadStateUpdate(npad_index); 406 RequestPadStateUpdate(npad_index);
364 auto& pad_state = npad_pad_states[npad_index]; 407 auto& pad_state = npad_pad_states[npad_index];
365 408
@@ -377,6 +420,18 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
377 420
378 libnx_entry.connection_status.raw = 0; 421 libnx_entry.connection_status.raw = 0;
379 libnx_entry.connection_status.IsConnected.Assign(1); 422 libnx_entry.connection_status.IsConnected.Assign(1);
423 auto& full_sixaxis_entry =
424 npad.sixaxis_full.sixaxis[npad.sixaxis_full.common.last_entry_index];
425 auto& handheld_sixaxis_entry =
426 npad.sixaxis_handheld.sixaxis[npad.sixaxis_handheld.common.last_entry_index];
427 auto& dual_left_sixaxis_entry =
428 npad.sixaxis_dual_left.sixaxis[npad.sixaxis_dual_left.common.last_entry_index];
429 auto& dual_right_sixaxis_entry =
430 npad.sixaxis_dual_right.sixaxis[npad.sixaxis_dual_right.common.last_entry_index];
431 auto& left_sixaxis_entry =
432 npad.sixaxis_left.sixaxis[npad.sixaxis_left.common.last_entry_index];
433 auto& right_sixaxis_entry =
434 npad.sixaxis_right.sixaxis[npad.sixaxis_right.common.last_entry_index];
380 435
381 switch (controller_type) { 436 switch (controller_type) {
382 case NPadControllerType::None: 437 case NPadControllerType::None:
@@ -391,6 +446,13 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
391 main_controller.pad.r_stick = pad_state.r_stick; 446 main_controller.pad.r_stick = pad_state.r_stick;
392 447
393 libnx_entry.connection_status.IsWired.Assign(1); 448 libnx_entry.connection_status.IsWired.Assign(1);
449
450 if (sixaxis_sensors_enabled && motions[i][0]) {
451 full_sixaxis_entry.accel = motion_devices[0].accel;
452 full_sixaxis_entry.gyro = motion_devices[0].gyro;
453 full_sixaxis_entry.rotation = motion_devices[0].rotation;
454 full_sixaxis_entry.orientation = motion_devices[0].orientation;
455 }
394 break; 456 break;
395 case NPadControllerType::Handheld: 457 case NPadControllerType::Handheld:
396 handheld_entry.connection_status.raw = 0; 458 handheld_entry.connection_status.raw = 0;
@@ -409,6 +471,13 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
409 libnx_entry.connection_status.IsRightJoyConnected.Assign(1); 471 libnx_entry.connection_status.IsRightJoyConnected.Assign(1);
410 libnx_entry.connection_status.IsLeftJoyWired.Assign(1); 472 libnx_entry.connection_status.IsLeftJoyWired.Assign(1);
411 libnx_entry.connection_status.IsRightJoyWired.Assign(1); 473 libnx_entry.connection_status.IsRightJoyWired.Assign(1);
474
475 if (sixaxis_sensors_enabled && motions[i][0]) {
476 handheld_sixaxis_entry.accel = motion_devices[0].accel;
477 handheld_sixaxis_entry.gyro = motion_devices[0].gyro;
478 handheld_sixaxis_entry.rotation = motion_devices[0].rotation;
479 handheld_sixaxis_entry.orientation = motion_devices[0].orientation;
480 }
412 break; 481 break;
413 case NPadControllerType::JoyDual: 482 case NPadControllerType::JoyDual:
414 dual_entry.connection_status.raw = 0; 483 dual_entry.connection_status.raw = 0;
@@ -421,6 +490,21 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
421 490
422 libnx_entry.connection_status.IsLeftJoyConnected.Assign(1); 491 libnx_entry.connection_status.IsLeftJoyConnected.Assign(1);
423 libnx_entry.connection_status.IsRightJoyConnected.Assign(1); 492 libnx_entry.connection_status.IsRightJoyConnected.Assign(1);
493
494 if (sixaxis_sensors_enabled && motions[i][0]) {
495 // Set motion for the left joycon
496 dual_left_sixaxis_entry.accel = motion_devices[0].accel;
497 dual_left_sixaxis_entry.gyro = motion_devices[0].gyro;
498 dual_left_sixaxis_entry.rotation = motion_devices[0].rotation;
499 dual_left_sixaxis_entry.orientation = motion_devices[0].orientation;
500 }
501 if (sixaxis_sensors_enabled && motions[i][1]) {
502 // Set motion for the right joycon
503 dual_right_sixaxis_entry.accel = motion_devices[1].accel;
504 dual_right_sixaxis_entry.gyro = motion_devices[1].gyro;
505 dual_right_sixaxis_entry.rotation = motion_devices[1].rotation;
506 dual_right_sixaxis_entry.orientation = motion_devices[1].orientation;
507 }
424 break; 508 break;
425 case NPadControllerType::JoyLeft: 509 case NPadControllerType::JoyLeft:
426 left_entry.connection_status.raw = 0; 510 left_entry.connection_status.raw = 0;
@@ -431,6 +515,13 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
431 left_entry.pad.r_stick = pad_state.r_stick; 515 left_entry.pad.r_stick = pad_state.r_stick;
432 516
433 libnx_entry.connection_status.IsLeftJoyConnected.Assign(1); 517 libnx_entry.connection_status.IsLeftJoyConnected.Assign(1);
518
519 if (sixaxis_sensors_enabled && motions[i][0]) {
520 left_sixaxis_entry.accel = motion_devices[0].accel;
521 left_sixaxis_entry.gyro = motion_devices[0].gyro;
522 left_sixaxis_entry.rotation = motion_devices[0].rotation;
523 left_sixaxis_entry.orientation = motion_devices[0].orientation;
524 }
434 break; 525 break;
435 case NPadControllerType::JoyRight: 526 case NPadControllerType::JoyRight:
436 right_entry.connection_status.raw = 0; 527 right_entry.connection_status.raw = 0;
@@ -441,6 +532,13 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
441 right_entry.pad.r_stick = pad_state.r_stick; 532 right_entry.pad.r_stick = pad_state.r_stick;
442 533
443 libnx_entry.connection_status.IsRightJoyConnected.Assign(1); 534 libnx_entry.connection_status.IsRightJoyConnected.Assign(1);
535
536 if (sixaxis_sensors_enabled && motions[i][1]) {
537 right_sixaxis_entry.accel = motion_devices[1].accel;
538 right_sixaxis_entry.gyro = motion_devices[1].gyro;
539 right_sixaxis_entry.rotation = motion_devices[1].rotation;
540 right_sixaxis_entry.orientation = motion_devices[1].orientation;
541 }
444 break; 542 break;
445 case NPadControllerType::Pokeball: 543 case NPadControllerType::Pokeball:
446 pokeball_entry.connection_status.raw = 0; 544 pokeball_entry.connection_status.raw = 0;
@@ -582,6 +680,14 @@ Controller_NPad::GyroscopeZeroDriftMode Controller_NPad::GetGyroscopeZeroDriftMo
582 return gyroscope_zero_drift_mode; 680 return gyroscope_zero_drift_mode;
583} 681}
584 682
683bool Controller_NPad::IsSixAxisSensorAtRest() const {
684 return sixaxis_at_rest;
685}
686
687void Controller_NPad::SetSixAxisEnabled(bool six_axis_status) {
688 sixaxis_sensors_enabled = six_axis_status;
689}
690
585void Controller_NPad::MergeSingleJoyAsDualJoy(u32 npad_id_1, u32 npad_id_2) { 691void Controller_NPad::MergeSingleJoyAsDualJoy(u32 npad_id_1, u32 npad_id_2) {
586 const auto npad_index_1 = NPadIdToIndex(npad_id_1); 692 const auto npad_index_1 = NPadIdToIndex(npad_id_1);
587 const auto npad_index_2 = NPadIdToIndex(npad_id_2); 693 const auto npad_index_2 = NPadIdToIndex(npad_id_2);
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h
index e9788da8d..78e7c320b 100644
--- a/src/core/hle/service/hid/controllers/npad.h
+++ b/src/core/hle/service/hid/controllers/npad.h
@@ -130,6 +130,8 @@ public:
130 130
131 void SetGyroscopeZeroDriftMode(GyroscopeZeroDriftMode drift_mode); 131 void SetGyroscopeZeroDriftMode(GyroscopeZeroDriftMode drift_mode);
132 GyroscopeZeroDriftMode GetGyroscopeZeroDriftMode() const; 132 GyroscopeZeroDriftMode GetGyroscopeZeroDriftMode() const;
133 bool IsSixAxisSensorAtRest() const;
134 void SetSixAxisEnabled(bool six_axis_status);
133 LedPattern GetLedPattern(u32 npad_id); 135 LedPattern GetLedPattern(u32 npad_id);
134 void SetVibrationEnabled(bool can_vibrate); 136 void SetVibrationEnabled(bool can_vibrate);
135 bool IsVibrationEnabled() const; 137 bool IsVibrationEnabled() const;
@@ -252,6 +254,24 @@ private:
252 }; 254 };
253 static_assert(sizeof(NPadGeneric) == 0x350, "NPadGeneric is an invalid size"); 255 static_assert(sizeof(NPadGeneric) == 0x350, "NPadGeneric is an invalid size");
254 256
257 struct SixAxisStates {
258 s64_le timestamp{};
259 INSERT_PADDING_WORDS(2);
260 s64_le timestamp2{};
261 Common::Vec3f accel{};
262 Common::Vec3f gyro{};
263 Common::Vec3f rotation{};
264 std::array<Common::Vec3f, 3> orientation{};
265 s64_le always_one{1};
266 };
267 static_assert(sizeof(SixAxisStates) == 0x68, "SixAxisStates is an invalid size");
268
269 struct SixAxisGeneric {
270 CommonHeader common{};
271 std::array<SixAxisStates, 17> sixaxis{};
272 };
273 static_assert(sizeof(SixAxisGeneric) == 0x708, "SixAxisGeneric is an invalid size");
274
255 enum class ColorReadError : u32_le { 275 enum class ColorReadError : u32_le {
256 ReadOk = 0, 276 ReadOk = 0,
257 ColorDoesntExist = 1, 277 ColorDoesntExist = 1,
@@ -281,6 +301,13 @@ private:
281 }; 301 };
282 }; 302 };
283 303
304 struct MotionDevice {
305 Common::Vec3f accel;
306 Common::Vec3f gyro;
307 Common::Vec3f rotation;
308 std::array<Common::Vec3f, 3> orientation;
309 };
310
284 struct NPadEntry { 311 struct NPadEntry {
285 NPadType joy_styles; 312 NPadType joy_styles;
286 NPadAssignments pad_assignment; 313 NPadAssignments pad_assignment;
@@ -300,9 +327,12 @@ private:
300 NPadGeneric pokeball_states; 327 NPadGeneric pokeball_states;
301 NPadGeneric libnx; // TODO(ogniK): Find out what this actually is, libnx seems to only be 328 NPadGeneric libnx; // TODO(ogniK): Find out what this actually is, libnx seems to only be
302 // relying on this for the time being 329 // relying on this for the time being
303 INSERT_PADDING_BYTES( 330 SixAxisGeneric sixaxis_full;
304 0x708 * 331 SixAxisGeneric sixaxis_handheld;
305 6); // TODO(ogniK): SixAxis states, require more information before implementation 332 SixAxisGeneric sixaxis_dual_left;
333 SixAxisGeneric sixaxis_dual_right;
334 SixAxisGeneric sixaxis_left;
335 SixAxisGeneric sixaxis_right;
306 NPadDevice device_type; 336 NPadDevice device_type;
307 NPadProperties properties; 337 NPadProperties properties;
308 INSERT_PADDING_WORDS(1); 338 INSERT_PADDING_WORDS(1);
@@ -325,14 +355,18 @@ private:
325 355
326 NPadType style{}; 356 NPadType style{};
327 std::array<NPadEntry, 10> shared_memory_entries{}; 357 std::array<NPadEntry, 10> shared_memory_entries{};
328 std::array< 358 using ButtonArray = std::array<
329 std::array<std::unique_ptr<Input::ButtonDevice>, Settings::NativeButton::NUM_BUTTONS_HID>, 359 std::array<std::unique_ptr<Input::ButtonDevice>, Settings::NativeButton::NUM_BUTTONS_HID>,
330 10> 360 10>;
331 buttons; 361 using StickArray = std::array<
332 std::array<
333 std::array<std::unique_ptr<Input::AnalogDevice>, Settings::NativeAnalog::NUM_STICKS_HID>, 362 std::array<std::unique_ptr<Input::AnalogDevice>, Settings::NativeAnalog::NUM_STICKS_HID>,
334 10> 363 10>;
335 sticks; 364 using MotionArray = std::array<
365 std::array<std::unique_ptr<Input::MotionDevice>, Settings::NativeMotion::NUM_MOTION_HID>,
366 10>;
367 ButtonArray buttons;
368 StickArray sticks;
369 MotionArray motions;
336 std::vector<u32> supported_npad_id_types{}; 370 std::vector<u32> supported_npad_id_types{};
337 NpadHoldType hold_type{NpadHoldType::Vertical}; 371 NpadHoldType hold_type{NpadHoldType::Vertical};
338 // Each controller should have their own styleset changed event 372 // Each controller should have their own styleset changed event
@@ -341,6 +375,8 @@ private:
341 std::array<ControllerHolder, 10> connected_controllers{}; 375 std::array<ControllerHolder, 10> connected_controllers{};
342 GyroscopeZeroDriftMode gyroscope_zero_drift_mode{GyroscopeZeroDriftMode::Standard}; 376 GyroscopeZeroDriftMode gyroscope_zero_drift_mode{GyroscopeZeroDriftMode::Standard};
343 bool can_controllers_vibrate{true}; 377 bool can_controllers_vibrate{true};
378 bool sixaxis_sensors_enabled{true};
379 bool sixaxis_at_rest{true};
344 std::array<ControllerPad, 10> npad_pad_states{}; 380 std::array<ControllerPad, 10> npad_pad_states{};
345 bool is_in_lr_assignment_mode{false}; 381 bool is_in_lr_assignment_mode{false};
346 Core::System& system; 382 Core::System& system;
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index bd3c2f26b..302a25540 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -164,8 +164,8 @@ Hid::Hid(Core::System& system) : ServiceFramework("hid"), system(system) {
164 {56, nullptr, "ActivateJoyXpad"}, 164 {56, nullptr, "ActivateJoyXpad"},
165 {58, nullptr, "GetJoyXpadLifoHandle"}, 165 {58, nullptr, "GetJoyXpadLifoHandle"},
166 {59, nullptr, "GetJoyXpadIds"}, 166 {59, nullptr, "GetJoyXpadIds"},
167 {60, nullptr, "ActivateSixAxisSensor"}, 167 {60, &Hid::ActivateSixAxisSensor, "ActivateSixAxisSensor"},
168 {61, nullptr, "DeactivateSixAxisSensor"}, 168 {61, &Hid::DeactivateSixAxisSensor, "DeactivateSixAxisSensor"},
169 {62, nullptr, "GetSixAxisSensorLifoHandle"}, 169 {62, nullptr, "GetSixAxisSensorLifoHandle"},
170 {63, nullptr, "ActivateJoySixAxisSensor"}, 170 {63, nullptr, "ActivateJoySixAxisSensor"},
171 {64, nullptr, "DeactivateJoySixAxisSensor"}, 171 {64, nullptr, "DeactivateJoySixAxisSensor"},
@@ -329,6 +329,31 @@ void Hid::GetXpadIDs(Kernel::HLERequestContext& ctx) {
329 rb.Push(0); 329 rb.Push(0);
330} 330}
331 331
332void Hid::ActivateSixAxisSensor(Kernel::HLERequestContext& ctx) {
333 IPC::RequestParser rp{ctx};
334 const auto handle{rp.Pop<u32>()};
335 const auto applet_resource_user_id{rp.Pop<u64>()};
336 applet_resource->GetController<Controller_NPad>(HidController::NPad).SetSixAxisEnabled(true);
337 LOG_DEBUG(Service_HID, "called, handle={}, applet_resource_user_id={}", handle,
338 applet_resource_user_id);
339
340 IPC::ResponseBuilder rb{ctx, 2};
341 rb.Push(RESULT_SUCCESS);
342}
343
344void Hid::DeactivateSixAxisSensor(Kernel::HLERequestContext& ctx) {
345 IPC::RequestParser rp{ctx};
346 const auto handle{rp.Pop<u32>()};
347 const auto applet_resource_user_id{rp.Pop<u64>()};
348 applet_resource->GetController<Controller_NPad>(HidController::NPad).SetSixAxisEnabled(false);
349
350 LOG_DEBUG(Service_HID, "called, handle={}, applet_resource_user_id={}", handle,
351 applet_resource_user_id);
352
353 IPC::ResponseBuilder rb{ctx, 2};
354 rb.Push(RESULT_SUCCESS);
355}
356
332void Hid::ActivateDebugPad(Kernel::HLERequestContext& ctx) { 357void Hid::ActivateDebugPad(Kernel::HLERequestContext& ctx) {
333 IPC::RequestParser rp{ctx}; 358 IPC::RequestParser rp{ctx};
334 const auto applet_resource_user_id{rp.Pop<u64>()}; 359 const auto applet_resource_user_id{rp.Pop<u64>()};
@@ -484,13 +509,13 @@ void Hid::IsSixAxisSensorAtRest(Kernel::HLERequestContext& ctx) {
484 const auto handle{rp.Pop<u32>()}; 509 const auto handle{rp.Pop<u32>()};
485 const auto applet_resource_user_id{rp.Pop<u64>()}; 510 const auto applet_resource_user_id{rp.Pop<u64>()};
486 511
487 LOG_WARNING(Service_HID, "(STUBBED) called, handle={}, applet_resource_user_id={}", handle, 512 LOG_DEBUG(Service_HID, "called, handle={}, applet_resource_user_id={}", handle,
488 applet_resource_user_id); 513 applet_resource_user_id);
489 514
490 IPC::ResponseBuilder rb{ctx, 3}; 515 IPC::ResponseBuilder rb{ctx, 3};
491 rb.Push(RESULT_SUCCESS); 516 rb.Push(RESULT_SUCCESS);
492 // TODO (Hexagon12): Properly implement reading gyroscope values from controllers. 517 rb.Push(applet_resource->GetController<Controller_NPad>(HidController::NPad)
493 rb.Push(true); 518 .IsSixAxisSensorAtRest());
494} 519}
495 520
496void Hid::SetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx) { 521void Hid::SetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx) {
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h
index efb07547f..e04aaf1e9 100644
--- a/src/core/hle/service/hid/hid.h
+++ b/src/core/hle/service/hid/hid.h
@@ -86,6 +86,8 @@ private:
86 void CreateAppletResource(Kernel::HLERequestContext& ctx); 86 void CreateAppletResource(Kernel::HLERequestContext& ctx);
87 void ActivateXpad(Kernel::HLERequestContext& ctx); 87 void ActivateXpad(Kernel::HLERequestContext& ctx);
88 void GetXpadIDs(Kernel::HLERequestContext& ctx); 88 void GetXpadIDs(Kernel::HLERequestContext& ctx);
89 void ActivateSixAxisSensor(Kernel::HLERequestContext& ctx);
90 void DeactivateSixAxisSensor(Kernel::HLERequestContext& ctx);
89 void ActivateDebugPad(Kernel::HLERequestContext& ctx); 91 void ActivateDebugPad(Kernel::HLERequestContext& ctx);
90 void ActivateTouchScreen(Kernel::HLERequestContext& ctx); 92 void ActivateTouchScreen(Kernel::HLERequestContext& ctx);
91 void ActivateMouse(Kernel::HLERequestContext& ctx); 93 void ActivateMouse(Kernel::HLERequestContext& ctx);
diff --git a/src/core/settings.h b/src/core/settings.h
index 80f0d95a7..9834f44bb 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -152,6 +152,7 @@ struct Values {
152 152
153 bool vibration_enabled; 153 bool vibration_enabled;
154 154
155 bool motion_enabled;
155 std::string motion_device; 156 std::string motion_device;
156 std::string touch_device; 157 std::string touch_device;
157 TouchscreenInput touchscreen; 158 TouchscreenInput touchscreen;