summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/CMakeLists.txt2
-rw-r--r--src/core/frontend/applets/web_browser.cpp4
-rw-r--r--src/core/frontend/applets/web_browser.h9
-rw-r--r--src/core/frontend/input.h12
-rw-r--r--src/core/hle/kernel/transfer_memory.cpp4
-rw-r--r--src/core/hle/kernel/transfer_memory.h3
-rw-r--r--src/core/hle/service/hid/controllers/console_sixaxis.cpp90
-rw-r--r--src/core/hle/service/hid/controllers/console_sixaxis.h80
-rw-r--r--src/core/hle/service/hid/controllers/gesture.cpp2
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp4
-rw-r--r--src/core/hle/service/hid/controllers/npad.h2
-rw-r--r--src/core/hle/service/hid/controllers/touchscreen.cpp2
-rw-r--r--src/core/hle/service/hid/hid.cpp30
-rw-r--r--src/input_common/gcadapter/gc_adapter.cpp8
-rw-r--r--src/input_common/gcadapter/gc_adapter.h1
-rw-r--r--src/input_common/motion_input.cpp10
-rw-r--r--src/yuzu/applets/web_browser.cpp19
-rw-r--r--src/yuzu/applets/web_browser.h11
-rw-r--r--src/yuzu/configuration/config.cpp3
-rw-r--r--src/yuzu/main.cpp8
-rw-r--r--src/yuzu/main.h2
21 files changed, 258 insertions, 48 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 04cf3f5b9..c28abc24c 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -393,6 +393,8 @@ add_library(core STATIC
393 hle/service/hid/xcd.cpp 393 hle/service/hid/xcd.cpp
394 hle/service/hid/xcd.h 394 hle/service/hid/xcd.h
395 hle/service/hid/errors.h 395 hle/service/hid/errors.h
396 hle/service/hid/controllers/console_sixaxis.cpp
397 hle/service/hid/controllers/console_sixaxis.h
396 hle/service/hid/controllers/controller_base.cpp 398 hle/service/hid/controllers/controller_base.cpp
397 hle/service/hid/controllers/controller_base.h 399 hle/service/hid/controllers/controller_base.h
398 hle/service/hid/controllers/debug_pad.cpp 400 hle/service/hid/controllers/debug_pad.cpp
diff --git a/src/core/frontend/applets/web_browser.cpp b/src/core/frontend/applets/web_browser.cpp
index 50db6a654..be4736f47 100644
--- a/src/core/frontend/applets/web_browser.cpp
+++ b/src/core/frontend/applets/web_browser.cpp
@@ -12,7 +12,7 @@ WebBrowserApplet::~WebBrowserApplet() = default;
12DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default; 12DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default;
13 13
14void DefaultWebBrowserApplet::OpenLocalWebPage( 14void DefaultWebBrowserApplet::OpenLocalWebPage(
15 std::string_view local_url, std::function<void()> extract_romfs_callback, 15 const std::string& local_url, std::function<void()> extract_romfs_callback,
16 std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const { 16 std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const {
17 LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open local web page at {}", 17 LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open local web page at {}",
18 local_url); 18 local_url);
@@ -21,7 +21,7 @@ void DefaultWebBrowserApplet::OpenLocalWebPage(
21} 21}
22 22
23void DefaultWebBrowserApplet::OpenExternalWebPage( 23void DefaultWebBrowserApplet::OpenExternalWebPage(
24 std::string_view external_url, 24 const std::string& external_url,
25 std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const { 25 std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const {
26 LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open external web page at {}", 26 LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open external web page at {}",
27 external_url); 27 external_url);
diff --git a/src/core/frontend/applets/web_browser.h b/src/core/frontend/applets/web_browser.h
index 1c5ef19a9..d7bd44c27 100644
--- a/src/core/frontend/applets/web_browser.h
+++ b/src/core/frontend/applets/web_browser.h
@@ -16,11 +16,11 @@ public:
16 virtual ~WebBrowserApplet(); 16 virtual ~WebBrowserApplet();
17 17
18 virtual void OpenLocalWebPage( 18 virtual void OpenLocalWebPage(
19 std::string_view local_url, std::function<void()> extract_romfs_callback, 19 const std::string& local_url, std::function<void()> extract_romfs_callback,
20 std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0; 20 std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0;
21 21
22 virtual void OpenExternalWebPage( 22 virtual void OpenExternalWebPage(
23 std::string_view external_url, 23 const std::string& external_url,
24 std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0; 24 std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0;
25}; 25};
26 26
@@ -28,11 +28,12 @@ class DefaultWebBrowserApplet final : public WebBrowserApplet {
28public: 28public:
29 ~DefaultWebBrowserApplet() override; 29 ~DefaultWebBrowserApplet() override;
30 30
31 void OpenLocalWebPage(std::string_view local_url, std::function<void()> extract_romfs_callback, 31 void OpenLocalWebPage(const std::string& local_url,
32 std::function<void()> extract_romfs_callback,
32 std::function<void(Service::AM::Applets::WebExitReason, std::string)> 33 std::function<void(Service::AM::Applets::WebExitReason, std::string)>
33 callback) const override; 34 callback) const override;
34 35
35 void OpenExternalWebPage(std::string_view external_url, 36 void OpenExternalWebPage(const std::string& external_url,
36 std::function<void(Service::AM::Applets::WebExitReason, std::string)> 37 std::function<void(Service::AM::Applets::WebExitReason, std::string)>
37 callback) const override; 38 callback) const override;
38}; 39};
diff --git a/src/core/frontend/input.h b/src/core/frontend/input.h
index 88ebc6497..0c5d2b3b0 100644
--- a/src/core/frontend/input.h
+++ b/src/core/frontend/input.h
@@ -11,6 +11,7 @@
11#include <utility> 11#include <utility>
12#include "common/logging/log.h" 12#include "common/logging/log.h"
13#include "common/param_package.h" 13#include "common/param_package.h"
14#include "common/quaternion.h"
14#include "common/vector_math.h" 15#include "common/vector_math.h"
15 16
16namespace Input { 17namespace Input {
@@ -143,9 +144,10 @@ using VibrationDevice = InputDevice<u8>;
143 144
144/** 145/**
145 * A motion status is an object that returns a tuple of accelerometer state vector, 146 * A motion status is an object that returns a tuple of accelerometer state vector,
146 * gyroscope state vector, rotation state vector and orientation state matrix. 147 * gyroscope state vector, rotation state vector, orientation state matrix and quaterion state
148 * vector.
147 * 149 *
148 * For both vectors: 150 * For both 3D vectors:
149 * x+ is the same direction as RIGHT on D-pad. 151 * x+ is the same direction as RIGHT on D-pad.
150 * y+ is normal to the touch screen, pointing outward. 152 * y+ is normal to the touch screen, pointing outward.
151 * z+ is the same direction as UP on D-pad. 153 * z+ is the same direction as UP on D-pad.
@@ -164,9 +166,13 @@ using VibrationDevice = InputDevice<u8>;
164 * x vector 166 * x vector
165 * y vector 167 * y vector
166 * z vector 168 * z vector
169 *
170 * For quaternion state vector
171 * xyz vector
172 * w float
167 */ 173 */
168using MotionStatus = std::tuple<Common::Vec3<float>, Common::Vec3<float>, Common::Vec3<float>, 174using MotionStatus = std::tuple<Common::Vec3<float>, Common::Vec3<float>, Common::Vec3<float>,
169 std::array<Common::Vec3f, 3>>; 175 std::array<Common::Vec3f, 3>, Common::Quaternion<f32>>;
170 176
171/** 177/**
172 * A motion device is an input device that returns a motion status object 178 * A motion device is an input device that returns a motion status object
diff --git a/src/core/hle/kernel/transfer_memory.cpp b/src/core/hle/kernel/transfer_memory.cpp
index cad063e4d..1dd65468d 100644
--- a/src/core/hle/kernel/transfer_memory.cpp
+++ b/src/core/hle/kernel/transfer_memory.cpp
@@ -36,6 +36,10 @@ std::shared_ptr<TransferMemory> TransferMemory::Create(KernelCore& kernel,
36 return transfer_memory; 36 return transfer_memory;
37} 37}
38 38
39u8* TransferMemory::GetPointer() {
40 return memory.GetPointer(base_address);
41}
42
39const u8* TransferMemory::GetPointer() const { 43const u8* TransferMemory::GetPointer() const {
40 return memory.GetPointer(base_address); 44 return memory.GetPointer(base_address);
41} 45}
diff --git a/src/core/hle/kernel/transfer_memory.h b/src/core/hle/kernel/transfer_memory.h
index 521951424..59328c0fe 100644
--- a/src/core/hle/kernel/transfer_memory.h
+++ b/src/core/hle/kernel/transfer_memory.h
@@ -57,6 +57,9 @@ public:
57 } 57 }
58 58
59 /// Gets a pointer to the backing block of this instance. 59 /// Gets a pointer to the backing block of this instance.
60 u8* GetPointer();
61
62 /// Gets a pointer to the backing block of this instance.
60 const u8* GetPointer() const; 63 const u8* GetPointer() const;
61 64
62 /// Gets the size of the memory backing this instance in bytes. 65 /// Gets the size of the memory backing this instance in bytes.
diff --git a/src/core/hle/service/hid/controllers/console_sixaxis.cpp b/src/core/hle/service/hid/controllers/console_sixaxis.cpp
new file mode 100644
index 000000000..913768fab
--- /dev/null
+++ b/src/core/hle/service/hid/controllers/console_sixaxis.cpp
@@ -0,0 +1,90 @@
1// Copyright 2021 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "common/settings.h"
6#include "core/core_timing.h"
7#include "core/hle/service/hid/controllers/console_sixaxis.h"
8
9namespace Service::HID {
10constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3C200;
11
12Controller_ConsoleSixAxis::Controller_ConsoleSixAxis(Core::System& system)
13 : ControllerBase(system) {}
14Controller_ConsoleSixAxis::~Controller_ConsoleSixAxis() = default;
15
16void Controller_ConsoleSixAxis::OnInit() {}
17
18void Controller_ConsoleSixAxis::OnRelease() {}
19
20void Controller_ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data,
21 std::size_t size) {
22 seven_six_axis.header.timestamp = core_timing.GetCPUTicks();
23 seven_six_axis.header.total_entry_count = 17;
24
25 if (!IsControllerActivated() || !is_transfer_memory_set) {
26 seven_six_axis.header.entry_count = 0;
27 seven_six_axis.header.last_entry_index = 0;
28 return;
29 }
30 seven_six_axis.header.entry_count = 16;
31
32 const auto& last_entry =
33 seven_six_axis.sevensixaxis_states[seven_six_axis.header.last_entry_index];
34 seven_six_axis.header.last_entry_index = (seven_six_axis.header.last_entry_index + 1) % 17;
35 auto& cur_entry = seven_six_axis.sevensixaxis_states[seven_six_axis.header.last_entry_index];
36
37 cur_entry.sampling_number = last_entry.sampling_number + 1;
38 cur_entry.sampling_number2 = cur_entry.sampling_number;
39
40 // Try to read sixaxis sensor states
41 MotionDevice motion_device{};
42 const auto& device = motions[0];
43 if (device) {
44 std::tie(motion_device.accel, motion_device.gyro, motion_device.rotation,
45 motion_device.orientation, motion_device.quaternion) = device->GetStatus();
46 console_six_axis.is_seven_six_axis_sensor_at_rest = motion_device.gyro.Length2() < 0.0001f;
47 }
48
49 cur_entry.accel = motion_device.accel;
50 // Zero gyro values as they just mess up with the camera
51 // Note: Probably a correct sensivity setting must be set
52 cur_entry.gyro = {};
53 cur_entry.quaternion = {
54 {
55 motion_device.quaternion.xyz.y,
56 motion_device.quaternion.xyz.x,
57 -motion_device.quaternion.w,
58 },
59 -motion_device.quaternion.xyz.z,
60 };
61
62 console_six_axis.sampling_number++;
63 // TODO(German77): Find the purpose of those values
64 console_six_axis.verticalization_error = 0.0f;
65 console_six_axis.gyro_bias = {0.0f, 0.0f, 0.0f};
66
67 // Update console six axis shared memory
68 std::memcpy(data + SHARED_MEMORY_OFFSET, &console_six_axis, sizeof(console_six_axis));
69 // Update seven six axis transfer memory
70 std::memcpy(transfer_memory, &seven_six_axis, sizeof(seven_six_axis));
71}
72
73void Controller_ConsoleSixAxis::OnLoadInputDevices() {
74 const auto player = Settings::values.players.GetValue()[0];
75 std::transform(player.motions.begin() + Settings::NativeMotion::MOTION_HID_BEGIN,
76 player.motions.begin() + Settings::NativeMotion::MOTION_HID_END, motions.begin(),
77 Input::CreateDevice<Input::MotionDevice>);
78}
79
80void Controller_ConsoleSixAxis::SetTransferMemoryPointer(u8* t_mem) {
81 is_transfer_memory_set = true;
82 transfer_memory = t_mem;
83}
84
85void Controller_ConsoleSixAxis::ResetTimestamp() {
86 auto& cur_entry = seven_six_axis.sevensixaxis_states[seven_six_axis.header.last_entry_index];
87 cur_entry.sampling_number = 0;
88 cur_entry.sampling_number2 = 0;
89}
90} // namespace Service::HID
diff --git a/src/core/hle/service/hid/controllers/console_sixaxis.h b/src/core/hle/service/hid/controllers/console_sixaxis.h
new file mode 100644
index 000000000..1fae98e94
--- /dev/null
+++ b/src/core/hle/service/hid/controllers/console_sixaxis.h
@@ -0,0 +1,80 @@
1// Copyright 2021 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <array>
8#include "common/bit_field.h"
9#include "common/common_types.h"
10#include "common/quaternion.h"
11#include "core/frontend/input.h"
12#include "core/hle/service/hid/controllers/controller_base.h"
13
14namespace Service::HID {
15class Controller_ConsoleSixAxis final : public ControllerBase {
16public:
17 explicit Controller_ConsoleSixAxis(Core::System& system);
18 ~Controller_ConsoleSixAxis() override;
19
20 // Called when the controller is initialized
21 void OnInit() override;
22
23 // When the controller is released
24 void OnRelease() override;
25
26 // When the controller is requesting an update for the shared memory
27 void OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, size_t size) override;
28
29 // Called when input devices should be loaded
30 void OnLoadInputDevices() override;
31
32 // Called on InitializeSevenSixAxisSensor
33 void SetTransferMemoryPointer(u8* t_mem);
34
35 // Called on ResetSevenSixAxisSensorTimestamp
36 void ResetTimestamp();
37
38private:
39 struct SevenSixAxisState {
40 INSERT_PADDING_WORDS(4); // unused
41 s64_le sampling_number{};
42 s64_le sampling_number2{};
43 u64 unknown{};
44 Common::Vec3f accel{};
45 Common::Vec3f gyro{};
46 Common::Quaternion<f32> quaternion{};
47 };
48 static_assert(sizeof(SevenSixAxisState) == 0x50, "SevenSixAxisState is an invalid size");
49
50 struct SevenSixAxisMemory {
51 CommonHeader header{};
52 std::array<SevenSixAxisState, 0x21> sevensixaxis_states{};
53 };
54 static_assert(sizeof(SevenSixAxisMemory) == 0xA70, "SevenSixAxisMemory is an invalid size");
55
56 struct ConsoleSharedMemory {
57 u64_le sampling_number{};
58 bool is_seven_six_axis_sensor_at_rest{};
59 f32 verticalization_error{};
60 Common::Vec3f gyro_bias{};
61 };
62 static_assert(sizeof(ConsoleSharedMemory) == 0x20, "ConsoleSharedMemory is an invalid size");
63
64 struct MotionDevice {
65 Common::Vec3f accel;
66 Common::Vec3f gyro;
67 Common::Vec3f rotation;
68 std::array<Common::Vec3f, 3> orientation;
69 Common::Quaternion<f32> quaternion;
70 };
71
72 using MotionArray =
73 std::array<std::unique_ptr<Input::MotionDevice>, Settings::NativeMotion::NUM_MOTIONS_HID>;
74 MotionArray motions;
75 u8* transfer_memory = nullptr;
76 bool is_transfer_memory_set = false;
77 ConsoleSharedMemory console_six_axis{};
78 SevenSixAxisMemory seven_six_axis{};
79};
80} // namespace Service::HID
diff --git a/src/core/hle/service/hid/controllers/gesture.cpp b/src/core/hle/service/hid/controllers/gesture.cpp
index 155808f6a..71545bf1f 100644
--- a/src/core/hle/service/hid/controllers/gesture.cpp
+++ b/src/core/hle/service/hid/controllers/gesture.cpp
@@ -33,7 +33,7 @@ void Controller_Gesture::OnUpdate(const Core::Timing::CoreTiming& core_timing, u
33 shared_memory.header.timestamp = core_timing.GetCPUTicks(); 33 shared_memory.header.timestamp = core_timing.GetCPUTicks();
34 shared_memory.header.total_entry_count = 17; 34 shared_memory.header.total_entry_count = 17;
35 35
36 if (!IsControllerActivated()) { 36 if (!IsControllerActivated() || !Settings::values.touchscreen.enabled) {
37 shared_memory.header.entry_count = 0; 37 shared_memory.header.entry_count = 0;
38 shared_memory.header.last_entry_index = 0; 38 shared_memory.header.last_entry_index = 0;
39 return; 39 return;
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index 113a41254..249c300f6 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -654,8 +654,8 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
654 const auto& device = motions[i][e]; 654 const auto& device = motions[i][e];
655 if (device) { 655 if (device) {
656 std::tie(motion_devices[e].accel, motion_devices[e].gyro, 656 std::tie(motion_devices[e].accel, motion_devices[e].gyro,
657 motion_devices[e].rotation, motion_devices[e].orientation) = 657 motion_devices[e].rotation, motion_devices[e].orientation,
658 device->GetStatus(); 658 motion_devices[e].quaternion) = device->GetStatus();
659 sixaxis_at_rest = sixaxis_at_rest && motion_devices[e].gyro.Length2() < 0.0001f; 659 sixaxis_at_rest = sixaxis_at_rest && motion_devices[e].gyro.Length2() < 0.0001f;
660 } 660 }
661 } 661 }
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h
index c3b07bd41..085f42c48 100644
--- a/src/core/hle/service/hid/controllers/npad.h
+++ b/src/core/hle/service/hid/controllers/npad.h
@@ -8,6 +8,7 @@
8#include <atomic> 8#include <atomic>
9#include "common/bit_field.h" 9#include "common/bit_field.h"
10#include "common/common_types.h" 10#include "common/common_types.h"
11#include "common/quaternion.h"
11#include "common/settings.h" 12#include "common/settings.h"
12#include "core/frontend/input.h" 13#include "core/frontend/input.h"
13#include "core/hle/kernel/object.h" 14#include "core/hle/kernel/object.h"
@@ -467,6 +468,7 @@ private:
467 Common::Vec3f gyro; 468 Common::Vec3f gyro;
468 Common::Vec3f rotation; 469 Common::Vec3f rotation;
469 std::array<Common::Vec3f, 3> orientation; 470 std::array<Common::Vec3f, 3> orientation;
471 Common::Quaternion<f32> quaternion;
470 }; 472 };
471 473
472 struct NfcXcdHandle { 474 struct NfcXcdHandle {
diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp
index b5f8077be..8f56a0255 100644
--- a/src/core/hle/service/hid/controllers/touchscreen.cpp
+++ b/src/core/hle/service/hid/controllers/touchscreen.cpp
@@ -33,7 +33,7 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin
33 shared_memory.header.timestamp = core_timing.GetCPUTicks(); 33 shared_memory.header.timestamp = core_timing.GetCPUTicks();
34 shared_memory.header.total_entry_count = 17; 34 shared_memory.header.total_entry_count = 17;
35 35
36 if (!IsControllerActivated()) { 36 if (!IsControllerActivated() || !Settings::values.touchscreen.enabled) {
37 shared_memory.header.entry_count = 0; 37 shared_memory.header.entry_count = 0;
38 shared_memory.header.last_entry_index = 0; 38 shared_memory.header.last_entry_index = 0;
39 return; 39 return;
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 2aa1942cb..9c4bf6d16 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -26,6 +26,7 @@
26#include "core/hle/service/hid/xcd.h" 26#include "core/hle/service/hid/xcd.h"
27#include "core/hle/service/service.h" 27#include "core/hle/service/service.h"
28 28
29#include "core/hle/service/hid/controllers/console_sixaxis.h"
29#include "core/hle/service/hid/controllers/controller_base.h" 30#include "core/hle/service/hid/controllers/controller_base.h"
30#include "core/hle/service/hid/controllers/debug_pad.h" 31#include "core/hle/service/hid/controllers/debug_pad.h"
31#include "core/hle/service/hid/controllers/gesture.h" 32#include "core/hle/service/hid/controllers/gesture.h"
@@ -67,7 +68,7 @@ IAppletResource::IAppletResource(Core::System& system_)
67 MakeController<Controller_Stubbed>(HidController::UniquePad); 68 MakeController<Controller_Stubbed>(HidController::UniquePad);
68 MakeController<Controller_NPad>(HidController::NPad); 69 MakeController<Controller_NPad>(HidController::NPad);
69 MakeController<Controller_Gesture>(HidController::Gesture); 70 MakeController<Controller_Gesture>(HidController::Gesture);
70 MakeController<Controller_Stubbed>(HidController::ConsoleSixAxisSensor); 71 MakeController<Controller_ConsoleSixAxis>(HidController::ConsoleSixAxisSensor);
71 72
72 // Homebrew doesn't try to activate some controllers, so we activate them by default 73 // Homebrew doesn't try to activate some controllers, so we activate them by default
73 GetController<Controller_NPad>(HidController::NPad).ActivateController(); 74 GetController<Controller_NPad>(HidController::NPad).ActivateController();
@@ -78,8 +79,6 @@ IAppletResource::IAppletResource(Core::System& system_)
78 GetController<Controller_Stubbed>(HidController::CaptureButton).SetCommonHeaderOffset(0x5000); 79 GetController<Controller_Stubbed>(HidController::CaptureButton).SetCommonHeaderOffset(0x5000);
79 GetController<Controller_Stubbed>(HidController::InputDetector).SetCommonHeaderOffset(0x5200); 80 GetController<Controller_Stubbed>(HidController::InputDetector).SetCommonHeaderOffset(0x5200);
80 GetController<Controller_Stubbed>(HidController::UniquePad).SetCommonHeaderOffset(0x5A00); 81 GetController<Controller_Stubbed>(HidController::UniquePad).SetCommonHeaderOffset(0x5A00);
81 GetController<Controller_Stubbed>(HidController::ConsoleSixAxisSensor)
82 .SetCommonHeaderOffset(0x3C200);
83 82
84 // Register update callbacks 83 // Register update callbacks
85 pad_update_event = Core::Timing::CreateEvent( 84 pad_update_event = Core::Timing::CreateEvent(
@@ -1404,8 +1403,9 @@ void Hid::ActivateConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) {
1404 IPC::RequestParser rp{ctx}; 1403 IPC::RequestParser rp{ctx};
1405 const auto applet_resource_user_id{rp.Pop<u64>()}; 1404 const auto applet_resource_user_id{rp.Pop<u64>()};
1406 1405
1407 LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}", 1406 applet_resource->ActivateController(HidController::ConsoleSixAxisSensor);
1408 applet_resource_user_id); 1407
1408 LOG_WARNING(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
1409 1409
1410 IPC::ResponseBuilder rb{ctx, 2}; 1410 IPC::ResponseBuilder rb{ctx, 2};
1411 rb.Push(RESULT_SUCCESS); 1411 rb.Push(RESULT_SUCCESS);
@@ -1455,8 +1455,9 @@ void Hid::ActivateSevenSixAxisSensor(Kernel::HLERequestContext& ctx) {
1455 IPC::RequestParser rp{ctx}; 1455 IPC::RequestParser rp{ctx};
1456 const auto applet_resource_user_id{rp.Pop<u64>()}; 1456 const auto applet_resource_user_id{rp.Pop<u64>()};
1457 1457
1458 LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}", 1458 applet_resource->ActivateController(HidController::ConsoleSixAxisSensor);
1459 applet_resource_user_id); 1459
1460 LOG_WARNING(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
1460 1461
1461 IPC::ResponseBuilder rb{ctx, 2}; 1462 IPC::ResponseBuilder rb{ctx, 2};
1462 rb.Push(RESULT_SUCCESS); 1463 rb.Push(RESULT_SUCCESS);
@@ -1518,8 +1519,15 @@ void Hid::InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) {
1518 ASSERT_MSG(t_mem_1->GetSize() == 0x1000, "t_mem_1 has incorrect size"); 1519 ASSERT_MSG(t_mem_1->GetSize() == 0x1000, "t_mem_1 has incorrect size");
1519 ASSERT_MSG(t_mem_2->GetSize() == 0x7F000, "t_mem_2 has incorrect size"); 1520 ASSERT_MSG(t_mem_2->GetSize() == 0x7F000, "t_mem_2 has incorrect size");
1520 1521
1522 // Activate console six axis controller
1523 applet_resource->GetController<Controller_ConsoleSixAxis>(HidController::ConsoleSixAxisSensor)
1524 .ActivateController();
1525
1526 applet_resource->GetController<Controller_ConsoleSixAxis>(HidController::ConsoleSixAxisSensor)
1527 .SetTransferMemoryPointer(t_mem_1->GetPointer());
1528
1521 LOG_WARNING(Service_HID, 1529 LOG_WARNING(Service_HID,
1522 "(STUBBED) called, t_mem_1_handle=0x{:08X}, t_mem_2_handle=0x{:08X}, " 1530 "called, t_mem_1_handle=0x{:08X}, t_mem_2_handle=0x{:08X}, "
1523 "applet_resource_user_id={}", 1531 "applet_resource_user_id={}",
1524 t_mem_1_handle, t_mem_2_handle, applet_resource_user_id); 1532 t_mem_1_handle, t_mem_2_handle, applet_resource_user_id);
1525 1533
@@ -1542,8 +1550,10 @@ void Hid::ResetSevenSixAxisSensorTimestamp(Kernel::HLERequestContext& ctx) {
1542 IPC::RequestParser rp{ctx}; 1550 IPC::RequestParser rp{ctx};
1543 const auto applet_resource_user_id{rp.Pop<u64>()}; 1551 const auto applet_resource_user_id{rp.Pop<u64>()};
1544 1552
1545 LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}", 1553 applet_resource->GetController<Controller_ConsoleSixAxis>(HidController::ConsoleSixAxisSensor)
1546 applet_resource_user_id); 1554 .ResetTimestamp();
1555
1556 LOG_WARNING(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
1547 1557
1548 IPC::ResponseBuilder rb{ctx, 2}; 1558 IPC::ResponseBuilder rb{ctx, 2};
1549 rb.Push(RESULT_SUCCESS); 1559 rb.Push(RESULT_SUCCESS);
diff --git a/src/input_common/gcadapter/gc_adapter.cpp b/src/input_common/gcadapter/gc_adapter.cpp
index ec3167bea..320f51ee6 100644
--- a/src/input_common/gcadapter/gc_adapter.cpp
+++ b/src/input_common/gcadapter/gc_adapter.cpp
@@ -155,8 +155,12 @@ void Adapter::UpdateStateAxes(std::size_t port, const AdapterPayload& adapter_pa
155 for (const PadAxes axis : axes) { 155 for (const PadAxes axis : axes) {
156 const auto index = static_cast<std::size_t>(axis); 156 const auto index = static_cast<std::size_t>(axis);
157 const u8 axis_value = adapter_payload[offset + 3 + index]; 157 const u8 axis_value = adapter_payload[offset + 3 + index];
158 if (pads[port].axis_origin[index] == 255) { 158 if (pads[port].reset_origin_counter <= 18) {
159 if (pads[port].axis_origin[index] != axis_value) {
160 pads[port].reset_origin_counter = 0;
161 }
159 pads[port].axis_origin[index] = axis_value; 162 pads[port].axis_origin[index] = axis_value;
163 pads[port].reset_origin_counter++;
160 } 164 }
161 pads[port].axis_values[index] = 165 pads[port].axis_values[index] =
162 static_cast<s16>(axis_value - pads[port].axis_origin[index]); 166 static_cast<s16>(axis_value - pads[port].axis_origin[index]);
@@ -375,7 +379,7 @@ void Adapter::ResetDevice(std::size_t port) {
375 pads[port].buttons = 0; 379 pads[port].buttons = 0;
376 pads[port].last_button = PadButton::Undefined; 380 pads[port].last_button = PadButton::Undefined;
377 pads[port].axis_values.fill(0); 381 pads[port].axis_values.fill(0);
378 pads[port].axis_origin.fill(255); 382 pads[port].reset_origin_counter = 0;
379} 383}
380 384
381void Adapter::Reset() { 385void Adapter::Reset() {
diff --git a/src/input_common/gcadapter/gc_adapter.h b/src/input_common/gcadapter/gc_adapter.h
index 7a6c545bd..e5de5e94f 100644
--- a/src/input_common/gcadapter/gc_adapter.h
+++ b/src/input_common/gcadapter/gc_adapter.h
@@ -70,6 +70,7 @@ struct GCController {
70 PadButton last_button{}; 70 PadButton last_button{};
71 std::array<s16, 6> axis_values{}; 71 std::array<s16, 6> axis_values{};
72 std::array<u8, 6> axis_origin{}; 72 std::array<u8, 6> axis_origin{};
73 u8 reset_origin_counter{};
73}; 74};
74 75
75class Adapter { 76class Adapter {
diff --git a/src/input_common/motion_input.cpp b/src/input_common/motion_input.cpp
index 6a65f175e..1c9d561c0 100644
--- a/src/input_common/motion_input.cpp
+++ b/src/input_common/motion_input.cpp
@@ -195,7 +195,8 @@ Input::MotionStatus MotionInput::GetMotion() const {
195 const Common::Vec3f accelerometer = GetAcceleration(); 195 const Common::Vec3f accelerometer = GetAcceleration();
196 const Common::Vec3f rotation = GetRotations(); 196 const Common::Vec3f rotation = GetRotations();
197 const std::array<Common::Vec3f, 3> orientation = GetOrientation(); 197 const std::array<Common::Vec3f, 3> orientation = GetOrientation();
198 return {accelerometer, gyroscope, rotation, orientation}; 198 const Common::Quaternion<f32> quaternion = GetQuaternion();
199 return {accelerometer, gyroscope, rotation, orientation, quaternion};
199} 200}
200 201
201Input::MotionStatus MotionInput::GetRandomMotion(int accel_magnitude, int gyro_magnitude) const { 202Input::MotionStatus MotionInput::GetRandomMotion(int accel_magnitude, int gyro_magnitude) const {
@@ -218,7 +219,12 @@ Input::MotionStatus MotionInput::GetRandomMotion(int accel_magnitude, int gyro_m
218 Common::Vec3f{0.0f, 1.0f, 0.0f}, 219 Common::Vec3f{0.0f, 1.0f, 0.0f},
219 Common::Vec3f{0.0f, 0.0f, 1.0f}, 220 Common::Vec3f{0.0f, 0.0f, 1.0f},
220 }; 221 };
221 return {accelerometer * accel_magnitude, gyroscope * gyro_magnitude, rotation, orientation}; 222 constexpr Common::Quaternion<f32> quaternion{
223 {0.0f, 0.0f, 0.0f},
224 1.0f,
225 };
226 return {accelerometer * accel_magnitude, gyroscope * gyro_magnitude, rotation, orientation,
227 quaternion};
222} 228}
223 229
224void MotionInput::ResetOrientation() { 230void MotionInput::ResetOrientation() {
diff --git a/src/yuzu/applets/web_browser.cpp b/src/yuzu/applets/web_browser.cpp
index e482ba029..93e3a4f6f 100644
--- a/src/yuzu/applets/web_browser.cpp
+++ b/src/yuzu/applets/web_browser.cpp
@@ -102,8 +102,8 @@ QtNXWebEngineView::~QtNXWebEngineView() {
102 StopInputThread(); 102 StopInputThread();
103} 103}
104 104
105void QtNXWebEngineView::LoadLocalWebPage(std::string_view main_url, 105void QtNXWebEngineView::LoadLocalWebPage(const std::string& main_url,
106 std::string_view additional_args) { 106 const std::string& additional_args) {
107 is_local = true; 107 is_local = true;
108 108
109 LoadExtractedFonts(); 109 LoadExtractedFonts();
@@ -113,12 +113,12 @@ void QtNXWebEngineView::LoadLocalWebPage(std::string_view main_url,
113 SetLastURL("http://localhost/"); 113 SetLastURL("http://localhost/");
114 StartInputThread(); 114 StartInputThread();
115 115
116 load(QUrl(QUrl::fromLocalFile(QString::fromStdString(std::string(main_url))).toString() + 116 load(QUrl(QUrl::fromLocalFile(QString::fromStdString(main_url)).toString() +
117 QString::fromStdString(std::string(additional_args)))); 117 QString::fromStdString(additional_args)));
118} 118}
119 119
120void QtNXWebEngineView::LoadExternalWebPage(std::string_view main_url, 120void QtNXWebEngineView::LoadExternalWebPage(const std::string& main_url,
121 std::string_view additional_args) { 121 const std::string& additional_args) {
122 is_local = false; 122 is_local = false;
123 123
124 SetUserAgent(UserAgent::WebApplet); 124 SetUserAgent(UserAgent::WebApplet);
@@ -127,8 +127,7 @@ void QtNXWebEngineView::LoadExternalWebPage(std::string_view main_url,
127 SetLastURL("http://localhost/"); 127 SetLastURL("http://localhost/");
128 StartInputThread(); 128 StartInputThread();
129 129
130 load(QUrl(QString::fromStdString(std::string(main_url)) + 130 load(QUrl(QString::fromStdString(main_url) + QString::fromStdString(additional_args)));
131 QString::fromStdString(std::string(additional_args))));
132} 131}
133 132
134void QtNXWebEngineView::SetUserAgent(UserAgent user_agent) { 133void QtNXWebEngineView::SetUserAgent(UserAgent user_agent) {
@@ -375,7 +374,7 @@ QtWebBrowser::QtWebBrowser(GMainWindow& main_window) {
375QtWebBrowser::~QtWebBrowser() = default; 374QtWebBrowser::~QtWebBrowser() = default;
376 375
377void QtWebBrowser::OpenLocalWebPage( 376void QtWebBrowser::OpenLocalWebPage(
378 std::string_view local_url, std::function<void()> extract_romfs_callback_, 377 const std::string& local_url, std::function<void()> extract_romfs_callback_,
379 std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback_) const { 378 std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback_) const {
380 extract_romfs_callback = std::move(extract_romfs_callback_); 379 extract_romfs_callback = std::move(extract_romfs_callback_);
381 callback = std::move(callback_); 380 callback = std::move(callback_);
@@ -390,7 +389,7 @@ void QtWebBrowser::OpenLocalWebPage(
390} 389}
391 390
392void QtWebBrowser::OpenExternalWebPage( 391void QtWebBrowser::OpenExternalWebPage(
393 std::string_view external_url, 392 const std::string& external_url,
394 std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback_) const { 393 std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback_) const {
395 callback = std::move(callback_); 394 callback = std::move(callback_);
396 395
diff --git a/src/yuzu/applets/web_browser.h b/src/yuzu/applets/web_browser.h
index 47f960d69..7ad07409f 100644
--- a/src/yuzu/applets/web_browser.h
+++ b/src/yuzu/applets/web_browser.h
@@ -58,7 +58,7 @@ public:
58 * @param main_url The url to the file. 58 * @param main_url The url to the file.
59 * @param additional_args Additional arguments appended to the main url. 59 * @param additional_args Additional arguments appended to the main url.
60 */ 60 */
61 void LoadLocalWebPage(std::string_view main_url, std::string_view additional_args); 61 void LoadLocalWebPage(const std::string& main_url, const std::string& additional_args);
62 62
63 /** 63 /**
64 * Loads an external website. Cannot be used to load local urls. 64 * Loads an external website. Cannot be used to load local urls.
@@ -66,7 +66,7 @@ public:
66 * @param main_url The url to the website. 66 * @param main_url The url to the website.
67 * @param additional_args Additional arguments appended to the main url. 67 * @param additional_args Additional arguments appended to the main url.
68 */ 68 */
69 void LoadExternalWebPage(std::string_view main_url, std::string_view additional_args); 69 void LoadExternalWebPage(const std::string& main_url, const std::string& additional_args);
70 70
71 /** 71 /**
72 * Sets the background color of the web page. 72 * Sets the background color of the web page.
@@ -193,16 +193,17 @@ public:
193 explicit QtWebBrowser(GMainWindow& parent); 193 explicit QtWebBrowser(GMainWindow& parent);
194 ~QtWebBrowser() override; 194 ~QtWebBrowser() override;
195 195
196 void OpenLocalWebPage(std::string_view local_url, std::function<void()> extract_romfs_callback_, 196 void OpenLocalWebPage(const std::string& local_url,
197 std::function<void()> extract_romfs_callback_,
197 std::function<void(Service::AM::Applets::WebExitReason, std::string)> 198 std::function<void(Service::AM::Applets::WebExitReason, std::string)>
198 callback_) const override; 199 callback_) const override;
199 200
200 void OpenExternalWebPage(std::string_view external_url, 201 void OpenExternalWebPage(const std::string& external_url,
201 std::function<void(Service::AM::Applets::WebExitReason, std::string)> 202 std::function<void(Service::AM::Applets::WebExitReason, std::string)>
202 callback_) const override; 203 callback_) const override;
203 204
204signals: 205signals:
205 void MainWindowOpenWebPage(std::string_view main_url, std::string_view additional_args, 206 void MainWindowOpenWebPage(const std::string& main_url, const std::string& additional_args,
206 bool is_local) const; 207 bool is_local) const;
207 208
208private: 209private:
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index d1b8c4fc9..e80a3df77 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -863,8 +863,7 @@ void Config::ReadSystemValues() {
863 Settings::values.rng_seed.SetGlobal(rng_seed_global); 863 Settings::values.rng_seed.SetGlobal(rng_seed_global);
864 if (global || !rng_seed_global) { 864 if (global || !rng_seed_global) {
865 if (rng_seed_enabled) { 865 if (rng_seed_enabled) {
866 Settings::values.rng_seed.SetValue( 866 Settings::values.rng_seed.SetValue(ReadSetting(QStringLiteral("rng_seed"), 0).toUInt());
867 ReadSetting(QStringLiteral("rng_seed"), 0).toULongLong());
868 } else { 867 } else {
869 Settings::values.rng_seed.SetValue(std::nullopt); 868 Settings::values.rng_seed.SetValue(std::nullopt);
870 } 869 }
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 39bdf186d..00d4cfe67 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -574,8 +574,8 @@ void GMainWindow::SoftwareKeyboardExit() {
574 software_keyboard = nullptr; 574 software_keyboard = nullptr;
575} 575}
576 576
577void GMainWindow::WebBrowserOpenWebPage(std::string_view main_url, std::string_view additional_args, 577void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
578 bool is_local) { 578 const std::string& additional_args, bool is_local) {
579#ifdef YUZU_USE_QT_WEB_ENGINE 579#ifdef YUZU_USE_QT_WEB_ENGINE
580 580
581 if (disable_web_applet) { 581 if (disable_web_applet) {
@@ -596,13 +596,15 @@ void GMainWindow::WebBrowserOpenWebPage(std::string_view main_url, std::string_v
596 loading_progress.setRange(0, 3); 596 loading_progress.setRange(0, 3);
597 loading_progress.setValue(0); 597 loading_progress.setValue(0);
598 598
599 if (is_local && !Common::FS::Exists(std::string(main_url))) { 599 if (is_local && !Common::FS::Exists(main_url)) {
600 loading_progress.show(); 600 loading_progress.show();
601 601
602 auto future = QtConcurrent::run([this] { emit WebBrowserExtractOfflineRomFS(); }); 602 auto future = QtConcurrent::run([this] { emit WebBrowserExtractOfflineRomFS(); });
603 603
604 while (!future.isFinished()) { 604 while (!future.isFinished()) {
605 QCoreApplication::processEvents(); 605 QCoreApplication::processEvents();
606
607 std::this_thread::sleep_for(std::chrono::milliseconds(1));
606 } 608 }
607 } 609 }
608 610
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index 7f1e50a5b..98a608fce 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -159,7 +159,7 @@ public slots:
159 void SoftwareKeyboardExit(); 159 void SoftwareKeyboardExit();
160 void ErrorDisplayDisplayError(QString error_code, QString error_text); 160 void ErrorDisplayDisplayError(QString error_code, QString error_text);
161 void ProfileSelectorSelectProfile(); 161 void ProfileSelectorSelectProfile();
162 void WebBrowserOpenWebPage(std::string_view main_url, std::string_view additional_args, 162 void WebBrowserOpenWebPage(const std::string& main_url, const std::string& additional_args,
163 bool is_local); 163 bool is_local);
164 void OnAppFocusStateChanged(Qt::ApplicationState state); 164 void OnAppFocusStateChanged(Qt::ApplicationState state);
165 165