summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/hid/controllers/console_sixaxis.cpp
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2021-09-21 03:36:05 +0200
committerNarr the Reg <juangerman-13@hotmail.com>2021-11-25 03:30:24 +0100
commita2ad5762e61f5d63d9a8c8a409f32c24409df67f (patch)
treebb344f907bde5a1049ec31ccfc488c6c637a62fe /src/core/hle/service/hid/controllers/console_sixaxis.cpp
parentservice/hid: Update mouse and keyboard to use ring lifo and the emulated device (diff)
downloadyuzu-a2ad5762e61f5d63d9a8c8a409f32c24409df67f.tar
yuzu-a2ad5762e61f5d63d9a8c8a409f32c24409df67f.tar.gz
yuzu-a2ad5762e61f5d63d9a8c8a409f32c24409df67f.tar.bz2
yuzu-a2ad5762e61f5d63d9a8c8a409f32c24409df67f.tar.lz
yuzu-a2ad5762e61f5d63d9a8c8a409f32c24409df67f.tar.xz
yuzu-a2ad5762e61f5d63d9a8c8a409f32c24409df67f.tar.zst
yuzu-a2ad5762e61f5d63d9a8c8a409f32c24409df67f.zip
Diffstat (limited to 'src/core/hle/service/hid/controllers/console_sixaxis.cpp')
-rw-r--r--src/core/hle/service/hid/controllers/console_sixaxis.cpp33
1 files changed, 13 insertions, 20 deletions
diff --git a/src/core/hle/service/hid/controllers/console_sixaxis.cpp b/src/core/hle/service/hid/controllers/console_sixaxis.cpp
index bda6e2557..1d351fde0 100644
--- a/src/core/hle/service/hid/controllers/console_sixaxis.cpp
+++ b/src/core/hle/service/hid/controllers/console_sixaxis.cpp
@@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include "common/settings.h"
+#include "core/core.h"
#include "core/core_timing.h"
#include "core/hle/service/hid/controllers/console_sixaxis.h"
@@ -10,7 +11,10 @@ namespace Service::HID {
constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3C200;
Controller_ConsoleSixAxis::Controller_ConsoleSixAxis(Core::System& system_)
- : ControllerBase{system_} {}
+ : ControllerBase{system_} {
+ console = system.HIDCore().GetEmulatedConsole();
+}
+
Controller_ConsoleSixAxis::~Controller_ConsoleSixAxis() = default;
void Controller_ConsoleSixAxis::OnInit() {}
@@ -38,25 +42,21 @@ void Controller_ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_ti
cur_entry.sampling_number2 = cur_entry.sampling_number;
// Try to read sixaxis sensor states
- MotionDevice motion_device{};
- const auto& device = motions[0];
- if (device) {
- std::tie(motion_device.accel, motion_device.gyro, motion_device.rotation,
- motion_device.orientation, motion_device.quaternion) = device->GetStatus();
- console_six_axis.is_seven_six_axis_sensor_at_rest = motion_device.gyro.Length2() < 0.0001f;
- }
+ const auto motion_status = console->GetMotion();
- cur_entry.accel = motion_device.accel;
+ console_six_axis.is_seven_six_axis_sensor_at_rest = motion_status.is_at_rest;
+
+ cur_entry.accel = motion_status.accel;
// Zero gyro values as they just mess up with the camera
// Note: Probably a correct sensivity setting must be set
cur_entry.gyro = {};
cur_entry.quaternion = {
{
- motion_device.quaternion.xyz.y,
- motion_device.quaternion.xyz.x,
- -motion_device.quaternion.w,
+ motion_status.quaternion.xyz.y,
+ motion_status.quaternion.xyz.x,
+ -motion_status.quaternion.w,
},
- -motion_device.quaternion.xyz.z,
+ -motion_status.quaternion.xyz.z,
};
console_six_axis.sampling_number++;
@@ -70,13 +70,6 @@ void Controller_ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_ti
std::memcpy(transfer_memory, &seven_six_axis, sizeof(seven_six_axis));
}
-void Controller_ConsoleSixAxis::OnLoadInputDevices() {
- const auto player = Settings::values.players.GetValue()[0];
- std::transform(player.motions.begin() + Settings::NativeMotion::MOTION_HID_BEGIN,
- player.motions.begin() + Settings::NativeMotion::MOTION_HID_END, motions.begin(),
- Input::CreateDevice<Input::MotionDevice>);
-}
-
void Controller_ConsoleSixAxis::SetTransferMemoryPointer(u8* t_mem) {
is_transfer_memory_set = true;
transfer_memory = t_mem;