summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/settings.cpp7
-rw-r--r--src/common/settings.h2
-rw-r--r--src/core/hid/emulated_controller.cpp90
-rw-r--r--src/core/hid/emulated_controller.h7
-rw-r--r--src/core/hid/emulated_devices.cpp83
-rw-r--r--src/core/hid/emulated_devices.h29
-rw-r--r--src/core/hid/hid_types.h26
-rw-r--r--src/core/hid/motion_input.cpp14
-rw-r--r--src/core/hid/motion_input.h6
-rw-r--r--src/core/hle/service/acc/acc.cpp8
-rw-r--r--src/core/hle/service/acc/acc_su.cpp4
-rw-r--r--src/core/hle/service/am/am.cpp6
-rw-r--r--src/core/hle/service/aoc/aoc_u.cpp3
-rw-r--r--src/core/hle/service/audio/hwopus.cpp2
-rw-r--r--src/core/hle/service/hid/controllers/gesture.cpp5
-rw-r--r--src/core/hle/service/hid/controllers/mouse.cpp3
-rw-r--r--src/core/hle/service/hid/controllers/touchscreen.cpp5
-rw-r--r--src/core/hle/service/hid/hid.cpp6
-rw-r--r--src/core/hle/service/hid/hid.h1
-rw-r--r--src/core/hle/service/hid/hidbus.cpp26
-rw-r--r--src/core/hle/service/hid/hidbus.h4
-rw-r--r--src/core/hle/service/ncm/ncm.cpp1
-rw-r--r--src/core/hle/service/ns/ns.cpp12
-rw-r--r--src/core/hle/service/sockets/bsd.cpp3
-rw-r--r--src/core/hle/service/ssl/ssl.cpp10
-rw-r--r--src/core/hle/service/vi/vi.cpp5
-rw-r--r--src/core/hle/service/vi/vi_m.cpp4
-rw-r--r--src/input_common/drivers/mouse.cpp94
-rw-r--r--src/input_common/drivers/mouse.h5
-rw-r--r--src/input_common/input_mapping.cpp10
-rw-r--r--src/yuzu/applets/qt_controller.cpp9
-rw-r--r--src/yuzu/configuration/config.cpp11
-rw-r--r--src/yuzu/configuration/configure_graphics_advanced.cpp2
-rw-r--r--src/yuzu/configuration/configure_input_per_game.cpp5
-rw-r--r--src/yuzu/configuration/configure_input_player.cpp8
35 files changed, 367 insertions, 149 deletions
diff --git a/src/common/settings.cpp b/src/common/settings.cpp
index 70b02146b..84955030b 100644
--- a/src/common/settings.cpp
+++ b/src/common/settings.cpp
@@ -77,6 +77,13 @@ void LogSettings() {
77 log_setting("Debugging_GDBStub", values.use_gdbstub.GetValue()); 77 log_setting("Debugging_GDBStub", values.use_gdbstub.GetValue());
78 log_setting("Input_EnableMotion", values.motion_enabled.GetValue()); 78 log_setting("Input_EnableMotion", values.motion_enabled.GetValue());
79 log_setting("Input_EnableVibration", values.vibration_enabled.GetValue()); 79 log_setting("Input_EnableVibration", values.vibration_enabled.GetValue());
80 log_setting("Input_EnableTouch", values.touchscreen.enabled);
81 log_setting("Input_EnableMouse", values.mouse_enabled.GetValue());
82 log_setting("Input_EnableKeyboard", values.keyboard_enabled.GetValue());
83 log_setting("Input_EnableRingController", values.enable_ring_controller.GetValue());
84 log_setting("Input_EnableIrSensor", values.enable_ir_sensor.GetValue());
85 log_setting("Input_EnableCustomJoycon", values.enable_joycon_driver.GetValue());
86 log_setting("Input_EnableCustomProController", values.enable_procon_driver.GetValue());
80 log_setting("Input_EnableRawInput", values.enable_raw_input.GetValue()); 87 log_setting("Input_EnableRawInput", values.enable_raw_input.GetValue());
81} 88}
82 89
diff --git a/src/common/settings.h b/src/common/settings.h
index 512ecff69..4d0694b7d 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -482,7 +482,7 @@ struct Values {
482 SwitchableSetting<s32, true> sound_index{1, 0, 2, "sound_index"}; 482 SwitchableSetting<s32, true> sound_index{1, 0, 2, "sound_index"};
483 483
484 // Controls 484 // Controls
485 InputSetting<std::array<PlayerInput, 10>> players; 485 InputSetting<std::array<PlayerInput, 8>> players;
486 486
487 SwitchableSetting<bool> use_docked_mode{true, "use_docked_mode"}; 487 SwitchableSetting<bool> use_docked_mode{true, "use_docked_mode"};
488 488
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index 6d5a3dead..9f0ceca49 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -82,7 +82,12 @@ Settings::ControllerType EmulatedController::MapNPadToSettingsType(NpadStyleInde
82} 82}
83 83
84void EmulatedController::ReloadFromSettings() { 84void EmulatedController::ReloadFromSettings() {
85 const auto player_index = NpadIdTypeToIndex(npad_id_type); 85 if (npad_id_type == NpadIdType::Other) {
86 ReloadDebugPadFromSettings();
87 return;
88 }
89
90 const auto player_index = NpadIdTypeToConfigIndex(npad_id_type);
86 const auto& player = Settings::values.players.GetValue()[player_index]; 91 const auto& player = Settings::values.players.GetValue()[player_index];
87 92
88 for (std::size_t index = 0; index < player.buttons.size(); ++index) { 93 for (std::size_t index = 0; index < player.buttons.size(); ++index) {
@@ -111,13 +116,21 @@ void EmulatedController::ReloadFromSettings() {
111 116
112 ring_params[0] = Common::ParamPackage(Settings::values.ringcon_analogs); 117 ring_params[0] = Common::ParamPackage(Settings::values.ringcon_analogs);
113 118
114 // Other or debug controller should always be a pro controller 119 SetNpadStyleIndex(MapSettingsTypeToNPad(player.controller_type));
115 if (npad_id_type != NpadIdType::Other) { 120 original_npad_type = npad_type;
116 SetNpadStyleIndex(MapSettingsTypeToNPad(player.controller_type)); 121
117 original_npad_type = npad_type; 122 // Player 1 shares config with handheld. Disable controller when handheld is selected
118 } else { 123 if (npad_id_type == NpadIdType::Player1 && npad_type == NpadStyleIndex::Handheld) {
119 SetNpadStyleIndex(NpadStyleIndex::ProController); 124 Disconnect();
120 original_npad_type = npad_type; 125 ReloadInput();
126 return;
127 }
128
129 // Handheld shares config with player 1. Disable controller when handheld isn't selected
130 if (npad_id_type == NpadIdType::Handheld && npad_type != NpadStyleIndex::Handheld) {
131 Disconnect();
132 ReloadInput();
133 return;
121 } 134 }
122 135
123 Disconnect(); 136 Disconnect();
@@ -128,6 +141,33 @@ void EmulatedController::ReloadFromSettings() {
128 ReloadInput(); 141 ReloadInput();
129} 142}
130 143
144void EmulatedController::ReloadDebugPadFromSettings() {
145 for (std::size_t index = 0; index < Settings::values.debug_pad_buttons.size(); ++index) {
146 button_params[index] = Common::ParamPackage(Settings::values.debug_pad_buttons[index]);
147 }
148 for (std::size_t index = 0; index < Settings::values.debug_pad_analogs.size(); ++index) {
149 stick_params[index] = Common::ParamPackage(Settings::values.debug_pad_analogs[index]);
150 }
151 for (std::size_t index = 0; index < motion_params.size(); ++index) {
152 motion_params[index] = {};
153 }
154
155 controller.color_values = {};
156 controller.colors_state.fullkey = {};
157 controller.colors_state.left = {};
158 controller.colors_state.right = {};
159 ring_params[0] = {};
160 SetNpadStyleIndex(NpadStyleIndex::ProController);
161 original_npad_type = npad_type;
162
163 Disconnect();
164 if (Settings::values.debug_pad_enabled) {
165 Connect();
166 }
167
168 ReloadInput();
169}
170
131void EmulatedController::LoadDevices() { 171void EmulatedController::LoadDevices() {
132 // TODO(german77): Use more buttons to detect the correct device 172 // TODO(german77): Use more buttons to detect the correct device
133 const auto left_joycon = button_params[Settings::NativeButton::DRight]; 173 const auto left_joycon = button_params[Settings::NativeButton::DRight];
@@ -363,7 +403,17 @@ void EmulatedController::ReloadInput() {
363 SetMotion(callback, index); 403 SetMotion(callback, index);
364 }, 404 },
365 }); 405 });
366 motion_devices[index]->ForceUpdate(); 406
407 // Restore motion state
408 auto& emulated_motion = controller.motion_values[index].emulated;
409 auto& motion = controller.motion_state[index];
410 emulated_motion.ResetRotations();
411 emulated_motion.ResetQuaternion();
412 motion.accel = emulated_motion.GetAcceleration();
413 motion.gyro = emulated_motion.GetGyroscope();
414 motion.rotation = emulated_motion.GetRotations();
415 motion.orientation = emulated_motion.GetOrientation();
416 motion.is_at_rest = !emulated_motion.IsMoving(motion_sensitivity);
367 } 417 }
368 418
369 for (std::size_t index = 0; index < camera_devices.size(); ++index) { 419 for (std::size_t index = 0; index < camera_devices.size(); ++index) {
@@ -550,9 +600,23 @@ bool EmulatedController::IsConfiguring() const {
550} 600}
551 601
552void EmulatedController::SaveCurrentConfig() { 602void EmulatedController::SaveCurrentConfig() {
553 const auto player_index = NpadIdTypeToIndex(npad_id_type); 603 // Other can't alter the config from here
604 if (npad_id_type == NpadIdType::Other) {
605 return;
606 }
607
608 const auto player_index = NpadIdTypeToConfigIndex(npad_id_type);
554 auto& player = Settings::values.players.GetValue()[player_index]; 609 auto& player = Settings::values.players.GetValue()[player_index];
555 player.connected = is_connected; 610
611 // Only save the connected status when handheld is connected
612 if (npad_id_type == NpadIdType::Handheld && npad_type == NpadStyleIndex::Handheld) {
613 player.connected = is_connected;
614 }
615
616 if (npad_id_type != NpadIdType::Handheld && npad_type != NpadStyleIndex::Handheld) {
617 player.connected = is_connected;
618 }
619
556 player.controller_type = MapNPadToSettingsType(npad_type); 620 player.controller_type = MapNPadToSettingsType(npad_type);
557 for (std::size_t index = 0; index < player.buttons.size(); ++index) { 621 for (std::size_t index = 0; index < player.buttons.size(); ++index) {
558 player.buttons[index] = button_params[index].Serialize(); 622 player.buttons[index] = button_params[index].Serialize();
@@ -1142,7 +1206,7 @@ bool EmulatedController::SetVibration(std::size_t device_index, VibrationValue v
1142 if (!output_devices[device_index]) { 1206 if (!output_devices[device_index]) {
1143 return false; 1207 return false;
1144 } 1208 }
1145 const auto player_index = NpadIdTypeToIndex(npad_id_type); 1209 const auto player_index = NpadIdTypeToConfigIndex(npad_id_type);
1146 const auto& player = Settings::values.players.GetValue()[player_index]; 1210 const auto& player = Settings::values.players.GetValue()[player_index];
1147 const f32 strength = static_cast<f32>(player.vibration_strength) / 100.0f; 1211 const f32 strength = static_cast<f32>(player.vibration_strength) / 100.0f;
1148 1212
@@ -1168,7 +1232,7 @@ bool EmulatedController::SetVibration(std::size_t device_index, VibrationValue v
1168} 1232}
1169 1233
1170bool EmulatedController::IsVibrationEnabled(std::size_t device_index) { 1234bool EmulatedController::IsVibrationEnabled(std::size_t device_index) {
1171 const auto player_index = NpadIdTypeToIndex(npad_id_type); 1235 const auto player_index = NpadIdTypeToConfigIndex(npad_id_type);
1172 const auto& player = Settings::values.players.GetValue()[player_index]; 1236 const auto& player = Settings::values.players.GetValue()[player_index];
1173 1237
1174 if (!player.vibration_enabled) { 1238 if (!player.vibration_enabled) {
diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h
index a9da465a2..99572b3bd 100644
--- a/src/core/hid/emulated_controller.h
+++ b/src/core/hid/emulated_controller.h
@@ -250,9 +250,14 @@ public:
250 /// Reload all input devices 250 /// Reload all input devices
251 void ReloadInput(); 251 void ReloadInput();
252 252
253 /// Overrides current mapped devices with the stored configuration and reloads all input devices 253 /// Overrides current mapped devices with the stored configuration and reloads all input
254 /// callbacks
254 void ReloadFromSettings(); 255 void ReloadFromSettings();
255 256
257 /// Overrides current mapped debug pad with the stored configuration and reloads all input
258 /// callbacks
259 void ReloadDebugPadFromSettings();
260
256 /// Saves the current mapped configuration 261 /// Saves the current mapped configuration
257 void SaveCurrentConfig(); 262 void SaveCurrentConfig();
258 263
diff --git a/src/core/hid/emulated_devices.cpp b/src/core/hid/emulated_devices.cpp
index 578a6ff61..8e165dded 100644
--- a/src/core/hid/emulated_devices.cpp
+++ b/src/core/hid/emulated_devices.cpp
@@ -19,52 +19,53 @@ void EmulatedDevices::ReloadFromSettings() {
19 19
20void EmulatedDevices::ReloadInput() { 20void EmulatedDevices::ReloadInput() {
21 // If you load any device here add the equivalent to the UnloadInput() function 21 // If you load any device here add the equivalent to the UnloadInput() function
22
23 // Native Mouse is mapped on port 1, pad 0
24 const Common::ParamPackage mouse_params{"engine:mouse,port:1,pad:0"};
25
26 // Keyboard keys is mapped on port 1, pad 0 for normal keys, pad 1 for moddifier keys
27 const Common::ParamPackage keyboard_params{"engine:keyboard,port:1"};
28
22 std::size_t key_index = 0; 29 std::size_t key_index = 0;
23 for (auto& mouse_device : mouse_button_devices) { 30 for (auto& mouse_device : mouse_button_devices) {
24 Common::ParamPackage mouse_params; 31 Common::ParamPackage mouse_button_params = mouse_params;
25 mouse_params.Set("engine", "mouse"); 32 mouse_button_params.Set("button", static_cast<int>(key_index));
26 mouse_params.Set("button", static_cast<int>(key_index)); 33 mouse_device = Common::Input::CreateInputDevice(mouse_button_params);
27 mouse_device = Common::Input::CreateInputDevice(mouse_params);
28 key_index++; 34 key_index++;
29 } 35 }
30 36
31 mouse_stick_device = 37 Common::ParamPackage mouse_position_params = mouse_params;
32 Common::Input::CreateInputDeviceFromString("engine:mouse,axis_x:0,axis_y:1"); 38 mouse_position_params.Set("axis_x", 0);
39 mouse_position_params.Set("axis_y", 1);
40 mouse_position_params.Set("deadzone", 0.0f);
41 mouse_position_params.Set("range", 1.0f);
42 mouse_position_params.Set("threshold", 0.0f);
43 mouse_stick_device = Common::Input::CreateInputDevice(mouse_position_params);
33 44
34 // First two axis are reserved for mouse position 45 // First two axis are reserved for mouse position
35 key_index = 2; 46 key_index = 2;
36 for (auto& mouse_device : mouse_analog_devices) { 47 for (auto& mouse_device : mouse_wheel_devices) {
37 // Mouse axis are only mapped on port 1, pad 0 48 Common::ParamPackage mouse_wheel_params = mouse_params;
38 Common::ParamPackage mouse_params; 49 mouse_wheel_params.Set("axis", static_cast<int>(key_index));
39 mouse_params.Set("engine", "mouse"); 50 mouse_device = Common::Input::CreateInputDevice(mouse_wheel_params);
40 mouse_params.Set("axis", static_cast<int>(key_index));
41 mouse_params.Set("port", 1);
42 mouse_params.Set("pad", 0);
43 mouse_device = Common::Input::CreateInputDevice(mouse_params);
44 key_index++; 51 key_index++;
45 } 52 }
46 53
47 key_index = 0; 54 key_index = 0;
48 for (auto& keyboard_device : keyboard_devices) { 55 for (auto& keyboard_device : keyboard_devices) {
49 // Keyboard keys are only mapped on port 1, pad 0 56 Common::ParamPackage keyboard_key_params = keyboard_params;
50 Common::ParamPackage keyboard_params; 57 keyboard_key_params.Set("button", static_cast<int>(key_index));
51 keyboard_params.Set("engine", "keyboard"); 58 keyboard_key_params.Set("pad", 0);
52 keyboard_params.Set("button", static_cast<int>(key_index)); 59 keyboard_device = Common::Input::CreateInputDevice(keyboard_key_params);
53 keyboard_params.Set("port", 1);
54 keyboard_params.Set("pad", 0);
55 keyboard_device = Common::Input::CreateInputDevice(keyboard_params);
56 key_index++; 60 key_index++;
57 } 61 }
58 62
59 key_index = 0; 63 key_index = 0;
60 for (auto& keyboard_device : keyboard_modifier_devices) { 64 for (auto& keyboard_device : keyboard_modifier_devices) {
61 // Keyboard moddifiers are only mapped on port 1, pad 1 65 Common::ParamPackage keyboard_moddifier_params = keyboard_params;
62 Common::ParamPackage keyboard_params; 66 keyboard_moddifier_params.Set("button", static_cast<int>(key_index));
63 keyboard_params.Set("engine", "keyboard"); 67 keyboard_moddifier_params.Set("pad", 1);
64 keyboard_params.Set("button", static_cast<int>(key_index)); 68 keyboard_device = Common::Input::CreateInputDevice(keyboard_moddifier_params);
65 keyboard_params.Set("port", 1);
66 keyboard_params.Set("pad", 1);
67 keyboard_device = Common::Input::CreateInputDevice(keyboard_params);
68 key_index++; 69 key_index++;
69 } 70 }
70 71
@@ -80,14 +81,14 @@ void EmulatedDevices::ReloadInput() {
80 }); 81 });
81 } 82 }
82 83
83 for (std::size_t index = 0; index < mouse_analog_devices.size(); ++index) { 84 for (std::size_t index = 0; index < mouse_wheel_devices.size(); ++index) {
84 if (!mouse_analog_devices[index]) { 85 if (!mouse_wheel_devices[index]) {
85 continue; 86 continue;
86 } 87 }
87 mouse_analog_devices[index]->SetCallback({ 88 mouse_wheel_devices[index]->SetCallback({
88 .on_change = 89 .on_change =
89 [this, index](const Common::Input::CallbackStatus& callback) { 90 [this, index](const Common::Input::CallbackStatus& callback) {
90 SetMouseAnalog(callback, index); 91 SetMouseWheel(callback, index);
91 }, 92 },
92 }); 93 });
93 } 94 }
@@ -95,7 +96,9 @@ void EmulatedDevices::ReloadInput() {
95 if (mouse_stick_device) { 96 if (mouse_stick_device) {
96 mouse_stick_device->SetCallback({ 97 mouse_stick_device->SetCallback({
97 .on_change = 98 .on_change =
98 [this](const Common::Input::CallbackStatus& callback) { SetMouseStick(callback); }, 99 [this](const Common::Input::CallbackStatus& callback) {
100 SetMousePosition(callback);
101 },
99 }); 102 });
100 } 103 }
101 104
@@ -128,7 +131,7 @@ void EmulatedDevices::UnloadInput() {
128 for (auto& button : mouse_button_devices) { 131 for (auto& button : mouse_button_devices) {
129 button.reset(); 132 button.reset();
130 } 133 }
131 for (auto& analog : mouse_analog_devices) { 134 for (auto& analog : mouse_wheel_devices) {
132 analog.reset(); 135 analog.reset();
133 } 136 }
134 mouse_stick_device.reset(); 137 mouse_stick_device.reset();
@@ -362,18 +365,18 @@ void EmulatedDevices::SetMouseButton(const Common::Input::CallbackStatus& callba
362 TriggerOnChange(DeviceTriggerType::Mouse); 365 TriggerOnChange(DeviceTriggerType::Mouse);
363} 366}
364 367
365void EmulatedDevices::SetMouseAnalog(const Common::Input::CallbackStatus& callback, 368void EmulatedDevices::SetMouseWheel(const Common::Input::CallbackStatus& callback,
366 std::size_t index) { 369 std::size_t index) {
367 if (index >= device_status.mouse_analog_values.size()) { 370 if (index >= device_status.mouse_wheel_values.size()) {
368 return; 371 return;
369 } 372 }
370 std::unique_lock lock{mutex}; 373 std::unique_lock lock{mutex};
371 const auto analog_value = TransformToAnalog(callback); 374 const auto analog_value = TransformToAnalog(callback);
372 375
373 device_status.mouse_analog_values[index] = analog_value; 376 device_status.mouse_wheel_values[index] = analog_value;
374 377
375 if (is_configuring) { 378 if (is_configuring) {
376 device_status.mouse_position_state = {}; 379 device_status.mouse_wheel_state = {};
377 lock.unlock(); 380 lock.unlock();
378 TriggerOnChange(DeviceTriggerType::Mouse); 381 TriggerOnChange(DeviceTriggerType::Mouse);
379 return; 382 return;
@@ -392,7 +395,7 @@ void EmulatedDevices::SetMouseAnalog(const Common::Input::CallbackStatus& callba
392 TriggerOnChange(DeviceTriggerType::Mouse); 395 TriggerOnChange(DeviceTriggerType::Mouse);
393} 396}
394 397
395void EmulatedDevices::SetMouseStick(const Common::Input::CallbackStatus& callback) { 398void EmulatedDevices::SetMousePosition(const Common::Input::CallbackStatus& callback) {
396 std::unique_lock lock{mutex}; 399 std::unique_lock lock{mutex};
397 const auto touch_value = TransformToTouch(callback); 400 const auto touch_value = TransformToTouch(callback);
398 401
diff --git a/src/core/hid/emulated_devices.h b/src/core/hid/emulated_devices.h
index 76f9150df..caf2ca659 100644
--- a/src/core/hid/emulated_devices.h
+++ b/src/core/hid/emulated_devices.h
@@ -23,8 +23,8 @@ using KeyboardModifierDevices = std::array<std::unique_ptr<Common::Input::InputD
23 Settings::NativeKeyboard::NumKeyboardMods>; 23 Settings::NativeKeyboard::NumKeyboardMods>;
24using MouseButtonDevices = std::array<std::unique_ptr<Common::Input::InputDevice>, 24using MouseButtonDevices = std::array<std::unique_ptr<Common::Input::InputDevice>,
25 Settings::NativeMouseButton::NumMouseButtons>; 25 Settings::NativeMouseButton::NumMouseButtons>;
26using MouseAnalogDevices = std::array<std::unique_ptr<Common::Input::InputDevice>, 26using MouseWheelDevices = std::array<std::unique_ptr<Common::Input::InputDevice>,
27 Settings::NativeMouseWheel::NumMouseWheels>; 27 Settings::NativeMouseWheel::NumMouseWheels>;
28using MouseStickDevice = std::unique_ptr<Common::Input::InputDevice>; 28using MouseStickDevice = std::unique_ptr<Common::Input::InputDevice>;
29 29
30using MouseButtonParams = 30using MouseButtonParams =
@@ -36,7 +36,7 @@ using KeyboardModifierValues =
36 std::array<Common::Input::ButtonStatus, Settings::NativeKeyboard::NumKeyboardMods>; 36 std::array<Common::Input::ButtonStatus, Settings::NativeKeyboard::NumKeyboardMods>;
37using MouseButtonValues = 37using MouseButtonValues =
38 std::array<Common::Input::ButtonStatus, Settings::NativeMouseButton::NumMouseButtons>; 38 std::array<Common::Input::ButtonStatus, Settings::NativeMouseButton::NumMouseButtons>;
39using MouseAnalogValues = 39using MouseWheelValues =
40 std::array<Common::Input::AnalogStatus, Settings::NativeMouseWheel::NumMouseWheels>; 40 std::array<Common::Input::AnalogStatus, Settings::NativeMouseWheel::NumMouseWheels>;
41using MouseStickValue = Common::Input::TouchStatus; 41using MouseStickValue = Common::Input::TouchStatus;
42 42
@@ -50,7 +50,7 @@ struct DeviceStatus {
50 KeyboardValues keyboard_values{}; 50 KeyboardValues keyboard_values{};
51 KeyboardModifierValues keyboard_moddifier_values{}; 51 KeyboardModifierValues keyboard_moddifier_values{};
52 MouseButtonValues mouse_button_values{}; 52 MouseButtonValues mouse_button_values{};
53 MouseAnalogValues mouse_analog_values{}; 53 MouseWheelValues mouse_wheel_values{};
54 MouseStickValue mouse_stick_value{}; 54 MouseStickValue mouse_stick_value{};
55 55
56 // Data for HID serices 56 // Data for HID serices
@@ -111,15 +111,6 @@ public:
111 /// Reverts any mapped changes made that weren't saved 111 /// Reverts any mapped changes made that weren't saved
112 void RestoreConfig(); 112 void RestoreConfig();
113 113
114 // Returns the current mapped ring device
115 Common::ParamPackage GetRingParam() const;
116
117 /**
118 * Updates the current mapped ring device
119 * @param param ParamPackage with ring sensor data to be mapped
120 */
121 void SetRingParam(Common::ParamPackage param);
122
123 /// Returns the latest status of button input from the keyboard with parameters 114 /// Returns the latest status of button input from the keyboard with parameters
124 KeyboardValues GetKeyboardValues() const; 115 KeyboardValues GetKeyboardValues() const;
125 116
@@ -187,19 +178,13 @@ private:
187 * @param callback A CallbackStatus containing the wheel status 178 * @param callback A CallbackStatus containing the wheel status
188 * @param index wheel ID to be updated 179 * @param index wheel ID to be updated
189 */ 180 */
190 void SetMouseAnalog(const Common::Input::CallbackStatus& callback, std::size_t index); 181 void SetMouseWheel(const Common::Input::CallbackStatus& callback, std::size_t index);
191 182
192 /** 183 /**
193 * Updates the mouse position status of the mouse device 184 * Updates the mouse position status of the mouse device
194 * @param callback A CallbackStatus containing the position status 185 * @param callback A CallbackStatus containing the position status
195 */ 186 */
196 void SetMouseStick(const Common::Input::CallbackStatus& callback); 187 void SetMousePosition(const Common::Input::CallbackStatus& callback);
197
198 /**
199 * Updates the ring analog sensor status of the ring controller
200 * @param callback A CallbackStatus containing the force status
201 */
202 void SetRingAnalog(const Common::Input::CallbackStatus& callback);
203 188
204 /** 189 /**
205 * Triggers a callback that something has changed on the device status 190 * Triggers a callback that something has changed on the device status
@@ -212,7 +197,7 @@ private:
212 KeyboardDevices keyboard_devices; 197 KeyboardDevices keyboard_devices;
213 KeyboardModifierDevices keyboard_modifier_devices; 198 KeyboardModifierDevices keyboard_modifier_devices;
214 MouseButtonDevices mouse_button_devices; 199 MouseButtonDevices mouse_button_devices;
215 MouseAnalogDevices mouse_analog_devices; 200 MouseWheelDevices mouse_wheel_devices;
216 MouseStickDevice mouse_stick_device; 201 MouseStickDevice mouse_stick_device;
217 202
218 mutable std::mutex mutex; 203 mutable std::mutex mutex;
diff --git a/src/core/hid/hid_types.h b/src/core/hid/hid_types.h
index 6b35f448c..983f0addd 100644
--- a/src/core/hid/hid_types.h
+++ b/src/core/hid/hid_types.h
@@ -690,6 +690,32 @@ constexpr size_t NpadIdTypeToIndex(NpadIdType npad_id_type) {
690 } 690 }
691} 691}
692 692
693/// Converts a NpadIdType to a config array index.
694constexpr size_t NpadIdTypeToConfigIndex(NpadIdType npad_id_type) {
695 switch (npad_id_type) {
696 case NpadIdType::Player1:
697 return 0;
698 case NpadIdType::Player2:
699 return 1;
700 case NpadIdType::Player3:
701 return 2;
702 case NpadIdType::Player4:
703 return 3;
704 case NpadIdType::Player5:
705 return 4;
706 case NpadIdType::Player6:
707 return 5;
708 case NpadIdType::Player7:
709 return 6;
710 case NpadIdType::Player8:
711 return 7;
712 case NpadIdType::Other:
713 case NpadIdType::Handheld:
714 default:
715 return 0;
716 }
717}
718
693/// Converts an array index to a NpadIdType 719/// Converts an array index to a NpadIdType
694constexpr NpadIdType IndexToNpadIdType(size_t index) { 720constexpr NpadIdType IndexToNpadIdType(size_t index) {
695 switch (index) { 721 switch (index) {
diff --git a/src/core/hid/motion_input.cpp b/src/core/hid/motion_input.cpp
index eef6edf4b..0dd66c1cc 100644
--- a/src/core/hid/motion_input.cpp
+++ b/src/core/hid/motion_input.cpp
@@ -10,6 +10,8 @@ MotionInput::MotionInput() {
10 // Initialize PID constants with default values 10 // Initialize PID constants with default values
11 SetPID(0.3f, 0.005f, 0.0f); 11 SetPID(0.3f, 0.005f, 0.0f);
12 SetGyroThreshold(ThresholdStandard); 12 SetGyroThreshold(ThresholdStandard);
13 ResetQuaternion();
14 ResetRotations();
13} 15}
14 16
15void MotionInput::SetPID(f32 new_kp, f32 new_ki, f32 new_kd) { 17void MotionInput::SetPID(f32 new_kp, f32 new_ki, f32 new_kd) {
@@ -20,11 +22,19 @@ void MotionInput::SetPID(f32 new_kp, f32 new_ki, f32 new_kd) {
20 22
21void MotionInput::SetAcceleration(const Common::Vec3f& acceleration) { 23void MotionInput::SetAcceleration(const Common::Vec3f& acceleration) {
22 accel = acceleration; 24 accel = acceleration;
25
26 accel.x = std::clamp(accel.x, -AccelMaxValue, AccelMaxValue);
27 accel.y = std::clamp(accel.y, -AccelMaxValue, AccelMaxValue);
28 accel.z = std::clamp(accel.z, -AccelMaxValue, AccelMaxValue);
23} 29}
24 30
25void MotionInput::SetGyroscope(const Common::Vec3f& gyroscope) { 31void MotionInput::SetGyroscope(const Common::Vec3f& gyroscope) {
26 gyro = gyroscope - gyro_bias; 32 gyro = gyroscope - gyro_bias;
27 33
34 gyro.x = std::clamp(gyro.x, -GyroMaxValue, GyroMaxValue);
35 gyro.y = std::clamp(gyro.y, -GyroMaxValue, GyroMaxValue);
36 gyro.z = std::clamp(gyro.z, -GyroMaxValue, GyroMaxValue);
37
28 // Auto adjust drift to minimize drift 38 // Auto adjust drift to minimize drift
29 if (!IsMoving(IsAtRestRelaxed)) { 39 if (!IsMoving(IsAtRestRelaxed)) {
30 gyro_bias = (gyro_bias * 0.9999f) + (gyroscope * 0.0001f); 40 gyro_bias = (gyro_bias * 0.9999f) + (gyroscope * 0.0001f);
@@ -61,6 +71,10 @@ void MotionInput::ResetRotations() {
61 rotations = {}; 71 rotations = {};
62} 72}
63 73
74void MotionInput::ResetQuaternion() {
75 quat = {{0.0f, 0.0f, -1.0f}, 0.0f};
76}
77
64bool MotionInput::IsMoving(f32 sensitivity) const { 78bool MotionInput::IsMoving(f32 sensitivity) const {
65 return gyro.Length() >= sensitivity || accel.Length() <= 0.9f || accel.Length() >= 1.1f; 79 return gyro.Length() >= sensitivity || accel.Length() <= 0.9f || accel.Length() >= 1.1f;
66} 80}
diff --git a/src/core/hid/motion_input.h b/src/core/hid/motion_input.h
index 9180bb9aa..e2c1bbf95 100644
--- a/src/core/hid/motion_input.h
+++ b/src/core/hid/motion_input.h
@@ -20,6 +20,9 @@ public:
20 static constexpr float IsAtRestStandard = 0.01f; 20 static constexpr float IsAtRestStandard = 0.01f;
21 static constexpr float IsAtRestThight = 0.005f; 21 static constexpr float IsAtRestThight = 0.005f;
22 22
23 static constexpr float GyroMaxValue = 5.0f;
24 static constexpr float AccelMaxValue = 7.0f;
25
23 explicit MotionInput(); 26 explicit MotionInput();
24 27
25 MotionInput(const MotionInput&) = default; 28 MotionInput(const MotionInput&) = default;
@@ -40,6 +43,7 @@ public:
40 43
41 void EnableReset(bool reset); 44 void EnableReset(bool reset);
42 void ResetRotations(); 45 void ResetRotations();
46 void ResetQuaternion();
43 47
44 void UpdateRotation(u64 elapsed_time); 48 void UpdateRotation(u64 elapsed_time);
45 void UpdateOrientation(u64 elapsed_time); 49 void UpdateOrientation(u64 elapsed_time);
@@ -69,7 +73,7 @@ private:
69 Common::Vec3f derivative_error; 73 Common::Vec3f derivative_error;
70 74
71 // Quaternion containing the device orientation 75 // Quaternion containing the device orientation
72 Common::Quaternion<f32> quat{{0.0f, 0.0f, -1.0f}, 0.0f}; 76 Common::Quaternion<f32> quat;
73 77
74 // Number of full rotations in each axis 78 // Number of full rotations in each axis
75 Common::Vec3f rotations; 79 Common::Vec3f rotations;
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp
index 1495d64de..1241fcdff 100644
--- a/src/core/hle/service/acc/acc.cpp
+++ b/src/core/hle/service/acc/acc.cpp
@@ -76,6 +76,8 @@ public:
76 {141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+ 76 {141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+
77 {142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+ 77 {142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+
78 {150, nullptr, "CreateAuthorizationRequest"}, 78 {150, nullptr, "CreateAuthorizationRequest"},
79 {160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"},
80 {161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"},
79 }; 81 };
80 // clang-format on 82 // clang-format on
81 83
@@ -136,7 +138,10 @@ public:
136 {140, nullptr, "GetNetworkServiceLicenseCache"}, // 5.0.0+ 138 {140, nullptr, "GetNetworkServiceLicenseCache"}, // 5.0.0+
137 {141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+ 139 {141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+
138 {142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+ 140 {142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+
141 {143, nullptr, "GetNetworkServiceLicenseCacheEx"},
139 {150, nullptr, "CreateAuthorizationRequest"}, 142 {150, nullptr, "CreateAuthorizationRequest"},
143 {160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"},
144 {161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"},
140 {200, nullptr, "IsRegistered"}, 145 {200, nullptr, "IsRegistered"},
141 {201, nullptr, "RegisterAsync"}, 146 {201, nullptr, "RegisterAsync"},
142 {202, nullptr, "UnregisterAsync"}, 147 {202, nullptr, "UnregisterAsync"},
@@ -242,6 +247,7 @@ public:
242 {100, nullptr, "GetRequestWithTheme"}, 247 {100, nullptr, "GetRequestWithTheme"},
243 {101, nullptr, "IsNetworkServiceAccountReplaced"}, 248 {101, nullptr, "IsNetworkServiceAccountReplaced"},
244 {199, nullptr, "GetUrlForIntroductionOfExtraMembership"}, // 2.0.0 - 5.1.0 249 {199, nullptr, "GetUrlForIntroductionOfExtraMembership"}, // 2.0.0 - 5.1.0
250 {200, nullptr, "ApplyAsyncWithAuthorizedToken"},
245 }; 251 };
246 // clang-format on 252 // clang-format on
247 253
@@ -647,9 +653,11 @@ public:
647 {0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, 653 {0, nullptr, "EnsureAuthenticationTokenCacheAsync"},
648 {1, nullptr, "LoadAuthenticationTokenCache"}, 654 {1, nullptr, "LoadAuthenticationTokenCache"},
649 {2, nullptr, "InvalidateAuthenticationTokenCache"}, 655 {2, nullptr, "InvalidateAuthenticationTokenCache"},
656 {3, nullptr, "IsDeviceAuthenticationTokenCacheAvailable"},
650 {10, nullptr, "EnsureEdgeTokenCacheAsync"}, 657 {10, nullptr, "EnsureEdgeTokenCacheAsync"},
651 {11, nullptr, "LoadEdgeTokenCache"}, 658 {11, nullptr, "LoadEdgeTokenCache"},
652 {12, nullptr, "InvalidateEdgeTokenCache"}, 659 {12, nullptr, "InvalidateEdgeTokenCache"},
660 {13, nullptr, "IsEdgeTokenCacheAvailable"},
653 {20, nullptr, "EnsureApplicationAuthenticationCacheAsync"}, 661 {20, nullptr, "EnsureApplicationAuthenticationCacheAsync"},
654 {21, nullptr, "LoadApplicationAuthenticationTokenCache"}, 662 {21, nullptr, "LoadApplicationAuthenticationTokenCache"},
655 {22, nullptr, "LoadApplicationNetworkServiceClientConfigCache"}, 663 {22, nullptr, "LoadApplicationNetworkServiceClientConfigCache"},
diff --git a/src/core/hle/service/acc/acc_su.cpp b/src/core/hle/service/acc/acc_su.cpp
index b6bfd6155..d9882ecd3 100644
--- a/src/core/hle/service/acc/acc_su.cpp
+++ b/src/core/hle/service/acc/acc_su.cpp
@@ -55,6 +55,10 @@ ACC_SU::ACC_SU(std::shared_ptr<Module> module_, std::shared_ptr<ProfileManager>
55 {290, nullptr, "ProxyProcedureForGuestLoginWithNintendoAccount"}, 55 {290, nullptr, "ProxyProcedureForGuestLoginWithNintendoAccount"},
56 {291, nullptr, "ProxyProcedureForFloatingRegistrationWithNintendoAccount"}, 56 {291, nullptr, "ProxyProcedureForFloatingRegistrationWithNintendoAccount"},
57 {299, nullptr, "SuspendBackgroundDaemon"}, 57 {299, nullptr, "SuspendBackgroundDaemon"},
58 {900, nullptr, "SetUserUnqualifiedForDebug"},
59 {901, nullptr, "UnsetUserUnqualifiedForDebug"},
60 {902, nullptr, "ListUsersUnqualifiedForDebug"},
61 {910, nullptr, "RefreshFirmwareSettingsForDebug"},
58 {997, nullptr, "DebugInvalidateTokenCacheForUser"}, 62 {997, nullptr, "DebugInvalidateTokenCacheForUser"},
59 {998, nullptr, "DebugSetUserStateClose"}, 63 {998, nullptr, "DebugSetUserStateClose"},
60 {999, nullptr, "DebugSetUserStateOpen"}, 64 {999, nullptr, "DebugSetUserStateOpen"},
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index beb2da06e..26af499d2 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -226,6 +226,8 @@ IDebugFunctions::IDebugFunctions(Core::System& system_)
226 {30, nullptr, "RequestLaunchApplicationWithUserAndArgumentForDebug"}, 226 {30, nullptr, "RequestLaunchApplicationWithUserAndArgumentForDebug"},
227 {31, nullptr, "RequestLaunchApplicationByApplicationLaunchInfoForDebug"}, 227 {31, nullptr, "RequestLaunchApplicationByApplicationLaunchInfoForDebug"},
228 {40, nullptr, "GetAppletResourceUsageInfo"}, 228 {40, nullptr, "GetAppletResourceUsageInfo"},
229 {50, nullptr, "AddSystemProgramIdAndAppletIdForDebug"},
230 {51, nullptr, "AddOperationConfirmedLibraryAppletIdForDebug"},
229 {100, nullptr, "SetCpuBoostModeForApplet"}, 231 {100, nullptr, "SetCpuBoostModeForApplet"},
230 {101, nullptr, "CancelCpuBoostModeForApplet"}, 232 {101, nullptr, "CancelCpuBoostModeForApplet"},
231 {110, nullptr, "PushToAppletBoundChannelForDebug"}, 233 {110, nullptr, "PushToAppletBoundChannelForDebug"},
@@ -237,6 +239,8 @@ IDebugFunctions::IDebugFunctions(Core::System& system_)
237 {131, nullptr, "FriendInvitationClearApplicationParameter"}, 239 {131, nullptr, "FriendInvitationClearApplicationParameter"},
238 {132, nullptr, "FriendInvitationPushApplicationParameter"}, 240 {132, nullptr, "FriendInvitationPushApplicationParameter"},
239 {140, nullptr, "RestrictPowerOperationForSecureLaunchModeForDebug"}, 241 {140, nullptr, "RestrictPowerOperationForSecureLaunchModeForDebug"},
242 {200, nullptr, "CreateFloatingLibraryAppletAccepterForDebug"},
243 {300, nullptr, "TerminateAllRunningApplicationsForDebug"},
240 {900, nullptr, "GetGrcProcessLaunchedSystemEvent"}, 244 {900, nullptr, "GetGrcProcessLaunchedSystemEvent"},
241 }; 245 };
242 // clang-format on 246 // clang-format on
@@ -1855,6 +1859,8 @@ IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_)
1855 {31, nullptr, "GetWriterLockAccessorEx"}, 1859 {31, nullptr, "GetWriterLockAccessorEx"},
1856 {40, nullptr, "IsSleepEnabled"}, 1860 {40, nullptr, "IsSleepEnabled"},
1857 {41, nullptr, "IsRebootEnabled"}, 1861 {41, nullptr, "IsRebootEnabled"},
1862 {50, nullptr, "LaunchSystemApplet"},
1863 {51, nullptr, "LaunchStarter"},
1858 {100, nullptr, "PopRequestLaunchApplicationForDebug"}, 1864 {100, nullptr, "PopRequestLaunchApplicationForDebug"},
1859 {110, nullptr, "IsForceTerminateApplicationDisabledForDebug"}, 1865 {110, nullptr, "IsForceTerminateApplicationDisabledForDebug"},
1860 {200, nullptr, "LaunchDevMenu"}, 1866 {200, nullptr, "LaunchDevMenu"},
diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp
index 7264f23f9..1bbf057cb 100644
--- a/src/core/hle/service/aoc/aoc_u.cpp
+++ b/src/core/hle/service/aoc/aoc_u.cpp
@@ -129,6 +129,9 @@ AOC_U::AOC_U(Core::System& system_)
129 {101, &AOC_U::CreatePermanentEcPurchasedEventManager, "CreatePermanentEcPurchasedEventManager"}, 129 {101, &AOC_U::CreatePermanentEcPurchasedEventManager, "CreatePermanentEcPurchasedEventManager"},
130 {110, nullptr, "CreateContentsServiceManager"}, 130 {110, nullptr, "CreateContentsServiceManager"},
131 {200, nullptr, "SetRequiredAddOnContentsOnContentsAvailabilityTransition"}, 131 {200, nullptr, "SetRequiredAddOnContentsOnContentsAvailabilityTransition"},
132 {300, nullptr, "SetupHostAddOnContent"},
133 {301, nullptr, "GetRegisteredAddOnContentPath"},
134 {302, nullptr, "UpdateCachedList"},
132 }; 135 };
133 // clang-format on 136 // clang-format on
134 137
diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp
index e01f87356..3db3fe188 100644
--- a/src/core/hle/service/audio/hwopus.cpp
+++ b/src/core/hle/service/audio/hwopus.cpp
@@ -362,6 +362,8 @@ HwOpus::HwOpus(Core::System& system_) : ServiceFramework{system_, "hwopus"} {
362 {5, &HwOpus::GetWorkBufferSizeEx, "GetWorkBufferSizeEx"}, 362 {5, &HwOpus::GetWorkBufferSizeEx, "GetWorkBufferSizeEx"},
363 {6, nullptr, "OpenHardwareOpusDecoderForMultiStreamEx"}, 363 {6, nullptr, "OpenHardwareOpusDecoderForMultiStreamEx"},
364 {7, &HwOpus::GetWorkBufferSizeForMultiStreamEx, "GetWorkBufferSizeForMultiStreamEx"}, 364 {7, &HwOpus::GetWorkBufferSizeForMultiStreamEx, "GetWorkBufferSizeForMultiStreamEx"},
365 {8, nullptr, "GetWorkBufferSizeExEx"},
366 {9, nullptr, "GetWorkBufferSizeForMultiStreamExEx"},
365 }; 367 };
366 RegisterHandlers(functions); 368 RegisterHandlers(functions);
367} 369}
diff --git a/src/core/hle/service/hid/controllers/gesture.cpp b/src/core/hle/service/hid/controllers/gesture.cpp
index 32e0708ba..de0090cc5 100644
--- a/src/core/hle/service/hid/controllers/gesture.cpp
+++ b/src/core/hle/service/hid/controllers/gesture.cpp
@@ -65,6 +65,11 @@ void Controller_Gesture::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
65} 65}
66 66
67void Controller_Gesture::ReadTouchInput() { 67void Controller_Gesture::ReadTouchInput() {
68 if (!Settings::values.touchscreen.enabled) {
69 fingers = {};
70 return;
71 }
72
68 const auto touch_status = console->GetTouch(); 73 const auto touch_status = console->GetTouch();
69 for (std::size_t id = 0; id < fingers.size(); ++id) { 74 for (std::size_t id = 0; id < fingers.size(); ++id) {
70 fingers[id] = touch_status[id]; 75 fingers[id] = touch_status[id];
diff --git a/src/core/hle/service/hid/controllers/mouse.cpp b/src/core/hle/service/hid/controllers/mouse.cpp
index b11cb438d..0afc66681 100644
--- a/src/core/hle/service/hid/controllers/mouse.cpp
+++ b/src/core/hle/service/hid/controllers/mouse.cpp
@@ -33,10 +33,11 @@ void Controller_Mouse::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
33 return; 33 return;
34 } 34 }
35 35
36 next_state = {};
37
36 const auto& last_entry = shared_memory->mouse_lifo.ReadCurrentEntry().state; 38 const auto& last_entry = shared_memory->mouse_lifo.ReadCurrentEntry().state;
37 next_state.sampling_number = last_entry.sampling_number + 1; 39 next_state.sampling_number = last_entry.sampling_number + 1;
38 40
39 next_state.attribute.raw = 0;
40 if (Settings::values.mouse_enabled) { 41 if (Settings::values.mouse_enabled) {
41 const auto& mouse_button_state = emulated_devices->GetMouseButtons(); 42 const auto& mouse_button_state = emulated_devices->GetMouseButtons();
42 const auto& mouse_position_state = emulated_devices->GetMousePosition(); 43 const auto& mouse_position_state = emulated_devices->GetMousePosition();
diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp
index 1da8d3eb0..d90a4e732 100644
--- a/src/core/hle/service/hid/controllers/touchscreen.cpp
+++ b/src/core/hle/service/hid/controllers/touchscreen.cpp
@@ -58,6 +58,11 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin
58 } 58 }
59 59
60 if (!finger.pressed && current_touch.pressed) { 60 if (!finger.pressed && current_touch.pressed) {
61 // Ignore all touch fingers if disabled
62 if (!Settings::values.touchscreen.enabled) {
63 continue;
64 }
65
61 finger.attribute.start_touch.Assign(1); 66 finger.attribute.start_touch.Assign(1);
62 finger.pressed = true; 67 finger.pressed = true;
63 finger.position = current_touch.position; 68 finger.position = current_touch.position;
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index eb3c45a58..8c99cec06 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -63,6 +63,7 @@ IAppletResource::IAppletResource(Core::System& system_,
63 MakeControllerWithServiceContext<Controller_NPad>(HidController::NPad, shared_memory); 63 MakeControllerWithServiceContext<Controller_NPad>(HidController::NPad, shared_memory);
64 MakeController<Controller_Gesture>(HidController::Gesture, shared_memory); 64 MakeController<Controller_Gesture>(HidController::Gesture, shared_memory);
65 MakeController<Controller_ConsoleSixAxis>(HidController::ConsoleSixAxisSensor, shared_memory); 65 MakeController<Controller_ConsoleSixAxis>(HidController::ConsoleSixAxisSensor, shared_memory);
66 MakeController<Controller_Stubbed>(HidController::DebugMouse, shared_memory);
66 MakeControllerWithServiceContext<Controller_Palma>(HidController::Palma, shared_memory); 67 MakeControllerWithServiceContext<Controller_Palma>(HidController::Palma, shared_memory);
67 68
68 // Homebrew doesn't try to activate some controllers, so we activate them by default 69 // Homebrew doesn't try to activate some controllers, so we activate them by default
@@ -74,6 +75,7 @@ IAppletResource::IAppletResource(Core::System& system_,
74 GetController<Controller_Stubbed>(HidController::CaptureButton).SetCommonHeaderOffset(0x5000); 75 GetController<Controller_Stubbed>(HidController::CaptureButton).SetCommonHeaderOffset(0x5000);
75 GetController<Controller_Stubbed>(HidController::InputDetector).SetCommonHeaderOffset(0x5200); 76 GetController<Controller_Stubbed>(HidController::InputDetector).SetCommonHeaderOffset(0x5200);
76 GetController<Controller_Stubbed>(HidController::UniquePad).SetCommonHeaderOffset(0x5A00); 77 GetController<Controller_Stubbed>(HidController::UniquePad).SetCommonHeaderOffset(0x5A00);
78 GetController<Controller_Stubbed>(HidController::DebugMouse).SetCommonHeaderOffset(0x3DC00);
77 79
78 // Register update callbacks 80 // Register update callbacks
79 npad_update_event = Core::Timing::CreateEvent( 81 npad_update_event = Core::Timing::CreateEvent(
@@ -236,6 +238,7 @@ Hid::Hid(Core::System& system_)
236 {1, &Hid::ActivateDebugPad, "ActivateDebugPad"}, 238 {1, &Hid::ActivateDebugPad, "ActivateDebugPad"},
237 {11, &Hid::ActivateTouchScreen, "ActivateTouchScreen"}, 239 {11, &Hid::ActivateTouchScreen, "ActivateTouchScreen"},
238 {21, &Hid::ActivateMouse, "ActivateMouse"}, 240 {21, &Hid::ActivateMouse, "ActivateMouse"},
241 {26, nullptr, "ActivateDebugMouse"},
239 {31, &Hid::ActivateKeyboard, "ActivateKeyboard"}, 242 {31, &Hid::ActivateKeyboard, "ActivateKeyboard"},
240 {32, &Hid::SendKeyboardLockKeyEvent, "SendKeyboardLockKeyEvent"}, 243 {32, &Hid::SendKeyboardLockKeyEvent, "SendKeyboardLockKeyEvent"},
241 {40, nullptr, "AcquireXpadIdEventHandle"}, 244 {40, nullptr, "AcquireXpadIdEventHandle"},
@@ -2380,6 +2383,8 @@ public:
2380 {20, nullptr, "DeactivateMouse"}, 2383 {20, nullptr, "DeactivateMouse"},
2381 {21, nullptr, "SetMouseAutoPilotState"}, 2384 {21, nullptr, "SetMouseAutoPilotState"},
2382 {22, nullptr, "UnsetMouseAutoPilotState"}, 2385 {22, nullptr, "UnsetMouseAutoPilotState"},
2386 {25, nullptr, "SetDebugMouseAutoPilotState"},
2387 {26, nullptr, "UnsetDebugMouseAutoPilotState"},
2383 {30, nullptr, "DeactivateKeyboard"}, 2388 {30, nullptr, "DeactivateKeyboard"},
2384 {31, nullptr, "SetKeyboardAutoPilotState"}, 2389 {31, nullptr, "SetKeyboardAutoPilotState"},
2385 {32, nullptr, "UnsetKeyboardAutoPilotState"}, 2390 {32, nullptr, "UnsetKeyboardAutoPilotState"},
@@ -2495,6 +2500,7 @@ public:
2495 {2000, nullptr, "DeactivateDigitizer"}, 2500 {2000, nullptr, "DeactivateDigitizer"},
2496 {2001, nullptr, "SetDigitizerAutoPilotState"}, 2501 {2001, nullptr, "SetDigitizerAutoPilotState"},
2497 {2002, nullptr, "UnsetDigitizerAutoPilotState"}, 2502 {2002, nullptr, "UnsetDigitizerAutoPilotState"},
2503 {2002, nullptr, "ReloadFirmwareDebugSettings"},
2498 }; 2504 };
2499 // clang-format on 2505 // clang-format on
2500 2506
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h
index b7c2a23ef..8fc9ed88a 100644
--- a/src/core/hle/service/hid/hid.h
+++ b/src/core/hle/service/hid/hid.h
@@ -33,6 +33,7 @@ enum class HidController : std::size_t {
33 NPad, 33 NPad,
34 Gesture, 34 Gesture,
35 ConsoleSixAxisSensor, 35 ConsoleSixAxisSensor,
36 DebugMouse,
36 Palma, 37 Palma,
37 38
38 MaxControllers, 39 MaxControllers,
diff --git a/src/core/hle/service/hid/hidbus.cpp b/src/core/hle/service/hid/hidbus.cpp
index bd94e8f3d..8dbb2cf50 100644
--- a/src/core/hle/service/hid/hidbus.cpp
+++ b/src/core/hle/service/hid/hidbus.cpp
@@ -91,7 +91,7 @@ std::optional<std::size_t> HidBus::GetDeviceIndexFromHandle(BusHandle handle) co
91 if (handle.abstracted_pad_id == device_handle.abstracted_pad_id && 91 if (handle.abstracted_pad_id == device_handle.abstracted_pad_id &&
92 handle.internal_index == device_handle.internal_index && 92 handle.internal_index == device_handle.internal_index &&
93 handle.player_number == device_handle.player_number && 93 handle.player_number == device_handle.player_number &&
94 handle.bus_type == device_handle.bus_type && 94 handle.bus_type_id == device_handle.bus_type_id &&
95 handle.is_valid == device_handle.is_valid) { 95 handle.is_valid == device_handle.is_valid) {
96 return i; 96 return i;
97 } 97 }
@@ -123,7 +123,7 @@ void HidBus::GetBusHandle(Kernel::HLERequestContext& ctx) {
123 continue; 123 continue;
124 } 124 }
125 if (static_cast<Core::HID::NpadIdType>(handle.player_number) == parameters.npad_id && 125 if (static_cast<Core::HID::NpadIdType>(handle.player_number) == parameters.npad_id &&
126 handle.bus_type == parameters.bus_type) { 126 handle.bus_type_id == static_cast<u8>(parameters.bus_type)) {
127 is_handle_found = true; 127 is_handle_found = true;
128 handle_index = i; 128 handle_index = i;
129 break; 129 break;
@@ -140,7 +140,7 @@ void HidBus::GetBusHandle(Kernel::HLERequestContext& ctx) {
140 .abstracted_pad_id = static_cast<u8>(i), 140 .abstracted_pad_id = static_cast<u8>(i),
141 .internal_index = static_cast<u8>(i), 141 .internal_index = static_cast<u8>(i),
142 .player_number = static_cast<u8>(parameters.npad_id), 142 .player_number = static_cast<u8>(parameters.npad_id),
143 .bus_type = parameters.bus_type, 143 .bus_type_id = static_cast<u8>(parameters.bus_type),
144 .is_valid = true, 144 .is_valid = true,
145 }; 145 };
146 handle_index = i; 146 handle_index = i;
@@ -172,7 +172,7 @@ void HidBus::IsExternalDeviceConnected(Kernel::HLERequestContext& ctx) {
172 LOG_INFO(Service_HID, 172 LOG_INFO(Service_HID,
173 "Called, abstracted_pad_id={}, bus_type={}, internal_index={}, " 173 "Called, abstracted_pad_id={}, bus_type={}, internal_index={}, "
174 "player_number={}, is_valid={}", 174 "player_number={}, is_valid={}",
175 bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, 175 bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index,
176 bus_handle_.player_number, bus_handle_.is_valid); 176 bus_handle_.player_number, bus_handle_.is_valid);
177 177
178 const auto device_index = GetDeviceIndexFromHandle(bus_handle_); 178 const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
@@ -201,7 +201,7 @@ void HidBus::Initialize(Kernel::HLERequestContext& ctx) {
201 LOG_INFO(Service_HID, 201 LOG_INFO(Service_HID,
202 "called, abstracted_pad_id={} bus_type={} internal_index={} " 202 "called, abstracted_pad_id={} bus_type={} internal_index={} "
203 "player_number={} is_valid={}, applet_resource_user_id={}", 203 "player_number={} is_valid={}, applet_resource_user_id={}",
204 bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, 204 bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index,
205 bus_handle_.player_number, bus_handle_.is_valid, applet_resource_user_id); 205 bus_handle_.player_number, bus_handle_.is_valid, applet_resource_user_id);
206 206
207 is_hidbus_enabled = true; 207 is_hidbus_enabled = true;
@@ -253,7 +253,7 @@ void HidBus::Finalize(Kernel::HLERequestContext& ctx) {
253 LOG_INFO(Service_HID, 253 LOG_INFO(Service_HID,
254 "called, abstracted_pad_id={}, bus_type={}, internal_index={}, " 254 "called, abstracted_pad_id={}, bus_type={}, internal_index={}, "
255 "player_number={}, is_valid={}, applet_resource_user_id={}", 255 "player_number={}, is_valid={}, applet_resource_user_id={}",
256 bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, 256 bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index,
257 bus_handle_.player_number, bus_handle_.is_valid, applet_resource_user_id); 257 bus_handle_.player_number, bus_handle_.is_valid, applet_resource_user_id);
258 258
259 const auto device_index = GetDeviceIndexFromHandle(bus_handle_); 259 const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
@@ -301,7 +301,7 @@ void HidBus::EnableExternalDevice(Kernel::HLERequestContext& ctx) {
301 "called, enable={}, abstracted_pad_id={}, bus_type={}, internal_index={}, " 301 "called, enable={}, abstracted_pad_id={}, bus_type={}, internal_index={}, "
302 "player_number={}, is_valid={}, inval={}, applet_resource_user_id{}", 302 "player_number={}, is_valid={}, inval={}, applet_resource_user_id{}",
303 parameters.enable, parameters.bus_handle.abstracted_pad_id, 303 parameters.enable, parameters.bus_handle.abstracted_pad_id,
304 parameters.bus_handle.bus_type, parameters.bus_handle.internal_index, 304 parameters.bus_handle.bus_type_id, parameters.bus_handle.internal_index,
305 parameters.bus_handle.player_number, parameters.bus_handle.is_valid, parameters.inval, 305 parameters.bus_handle.player_number, parameters.bus_handle.is_valid, parameters.inval,
306 parameters.applet_resource_user_id); 306 parameters.applet_resource_user_id);
307 307
@@ -329,7 +329,7 @@ void HidBus::GetExternalDeviceId(Kernel::HLERequestContext& ctx) {
329 LOG_DEBUG(Service_HID, 329 LOG_DEBUG(Service_HID,
330 "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, " 330 "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, "
331 "is_valid={}", 331 "is_valid={}",
332 bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, 332 bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index,
333 bus_handle_.player_number, bus_handle_.is_valid); 333 bus_handle_.player_number, bus_handle_.is_valid);
334 334
335 const auto device_index = GetDeviceIndexFromHandle(bus_handle_); 335 const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
@@ -357,7 +357,7 @@ void HidBus::SendCommandAsync(Kernel::HLERequestContext& ctx) {
357 LOG_DEBUG(Service_HID, 357 LOG_DEBUG(Service_HID,
358 "called, data_size={}, abstracted_pad_id={}, bus_type={}, internal_index={}, " 358 "called, data_size={}, abstracted_pad_id={}, bus_type={}, internal_index={}, "
359 "player_number={}, is_valid={}", 359 "player_number={}, is_valid={}",
360 data.size(), bus_handle_.abstracted_pad_id, bus_handle_.bus_type, 360 data.size(), bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id,
361 bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid); 361 bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid);
362 362
363 const auto device_index = GetDeviceIndexFromHandle(bus_handle_); 363 const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
@@ -384,7 +384,7 @@ void HidBus::GetSendCommandAsynceResult(Kernel::HLERequestContext& ctx) {
384 LOG_DEBUG(Service_HID, 384 LOG_DEBUG(Service_HID,
385 "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, " 385 "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, "
386 "is_valid={}", 386 "is_valid={}",
387 bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, 387 bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index,
388 bus_handle_.player_number, bus_handle_.is_valid); 388 bus_handle_.player_number, bus_handle_.is_valid);
389 389
390 const auto device_index = GetDeviceIndexFromHandle(bus_handle_); 390 const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
@@ -413,7 +413,7 @@ void HidBus::SetEventForSendCommandAsycResult(Kernel::HLERequestContext& ctx) {
413 LOG_INFO(Service_HID, 413 LOG_INFO(Service_HID,
414 "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, " 414 "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, "
415 "is_valid={}", 415 "is_valid={}",
416 bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, 416 bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index,
417 bus_handle_.player_number, bus_handle_.is_valid); 417 bus_handle_.player_number, bus_handle_.is_valid);
418 418
419 const auto device_index = GetDeviceIndexFromHandle(bus_handle_); 419 const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
@@ -464,7 +464,7 @@ void HidBus::EnableJoyPollingReceiveMode(Kernel::HLERequestContext& ctx) {
464 LOG_INFO(Service_HID, 464 LOG_INFO(Service_HID,
465 "called, t_mem_handle=0x{:08X}, polling_mode={}, abstracted_pad_id={}, bus_type={}, " 465 "called, t_mem_handle=0x{:08X}, polling_mode={}, abstracted_pad_id={}, bus_type={}, "
466 "internal_index={}, player_number={}, is_valid={}", 466 "internal_index={}, player_number={}, is_valid={}",
467 t_mem_handle, polling_mode_, bus_handle_.abstracted_pad_id, bus_handle_.bus_type, 467 t_mem_handle, polling_mode_, bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id,
468 bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid); 468 bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid);
469 469
470 const auto device_index = GetDeviceIndexFromHandle(bus_handle_); 470 const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
@@ -492,7 +492,7 @@ void HidBus::DisableJoyPollingReceiveMode(Kernel::HLERequestContext& ctx) {
492 LOG_INFO(Service_HID, 492 LOG_INFO(Service_HID,
493 "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, " 493 "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, "
494 "is_valid={}", 494 "is_valid={}",
495 bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, 495 bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index,
496 bus_handle_.player_number, bus_handle_.is_valid); 496 bus_handle_.player_number, bus_handle_.is_valid);
497 497
498 const auto device_index = GetDeviceIndexFromHandle(bus_handle_); 498 const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
diff --git a/src/core/hle/service/hid/hidbus.h b/src/core/hle/service/hid/hidbus.h
index 8c687f678..91c99b01f 100644
--- a/src/core/hle/service/hid/hidbus.h
+++ b/src/core/hle/service/hid/hidbus.h
@@ -41,7 +41,7 @@ private:
41 }; 41 };
42 42
43 // This is nn::hidbus::BusType 43 // This is nn::hidbus::BusType
44 enum class BusType : u8 { 44 enum class BusType : u32 {
45 LeftJoyRail, 45 LeftJoyRail,
46 RightJoyRail, 46 RightJoyRail,
47 InternalBus, // Lark microphone 47 InternalBus, // Lark microphone
@@ -54,7 +54,7 @@ private:
54 u32 abstracted_pad_id; 54 u32 abstracted_pad_id;
55 u8 internal_index; 55 u8 internal_index;
56 u8 player_number; 56 u8 player_number;
57 BusType bus_type; 57 u8 bus_type_id;
58 bool is_valid; 58 bool is_valid;
59 }; 59 };
60 static_assert(sizeof(BusHandle) == 0x8, "BusHandle is an invalid size"); 60 static_assert(sizeof(BusHandle) == 0x8, "BusHandle is an invalid size");
diff --git a/src/core/hle/service/ncm/ncm.cpp b/src/core/hle/service/ncm/ncm.cpp
index 68210a108..4c66cfeba 100644
--- a/src/core/hle/service/ncm/ncm.cpp
+++ b/src/core/hle/service/ncm/ncm.cpp
@@ -124,6 +124,7 @@ public:
124 {12, nullptr, "InactivateContentMetaDatabase"}, 124 {12, nullptr, "InactivateContentMetaDatabase"},
125 {13, nullptr, "InvalidateRightsIdCache"}, 125 {13, nullptr, "InvalidateRightsIdCache"},
126 {14, nullptr, "GetMemoryReport"}, 126 {14, nullptr, "GetMemoryReport"},
127 {15, nullptr, "ActivateFsContentStorage"},
127 }; 128 };
128 // clang-format on 129 // clang-format on
129 130
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp
index f59a1a63d..e53bdde52 100644
--- a/src/core/hle/service/ns/ns.cpp
+++ b/src/core/hle/service/ns/ns.cpp
@@ -159,6 +159,8 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
159 {606, nullptr, "GetContentMetaStorage"}, 159 {606, nullptr, "GetContentMetaStorage"},
160 {607, nullptr, "ListAvailableAddOnContent"}, 160 {607, nullptr, "ListAvailableAddOnContent"},
161 {609, nullptr, "ListAvailabilityAssuredAddOnContent"}, 161 {609, nullptr, "ListAvailabilityAssuredAddOnContent"},
162 {610, nullptr, "GetInstalledContentMetaStorage"},
163 {611, nullptr, "PrepareAddOnContent"},
162 {700, nullptr, "PushDownloadTaskList"}, 164 {700, nullptr, "PushDownloadTaskList"},
163 {701, nullptr, "ClearTaskStatusList"}, 165 {701, nullptr, "ClearTaskStatusList"},
164 {702, nullptr, "RequestDownloadTaskList"}, 166 {702, nullptr, "RequestDownloadTaskList"},
@@ -228,6 +230,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
228 {1900, nullptr, "IsActiveAccount"}, 230 {1900, nullptr, "IsActiveAccount"},
229 {1901, nullptr, "RequestDownloadApplicationPrepurchasedRights"}, 231 {1901, nullptr, "RequestDownloadApplicationPrepurchasedRights"},
230 {1902, nullptr, "GetApplicationTicketInfo"}, 232 {1902, nullptr, "GetApplicationTicketInfo"},
233 {1903, nullptr, "RequestDownloadApplicationPrepurchasedRightsForAccount"},
231 {2000, nullptr, "GetSystemDeliveryInfo"}, 234 {2000, nullptr, "GetSystemDeliveryInfo"},
232 {2001, nullptr, "SelectLatestSystemDeliveryInfo"}, 235 {2001, nullptr, "SelectLatestSystemDeliveryInfo"},
233 {2002, nullptr, "VerifyDeliveryProtocolVersion"}, 236 {2002, nullptr, "VerifyDeliveryProtocolVersion"},
@@ -276,8 +279,11 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
276 {2352, nullptr, "RequestResolveNoDownloadRightsError"}, 279 {2352, nullptr, "RequestResolveNoDownloadRightsError"},
277 {2353, nullptr, "GetApplicationDownloadTaskInfo"}, 280 {2353, nullptr, "GetApplicationDownloadTaskInfo"},
278 {2354, nullptr, "PrioritizeApplicationBackgroundTask"}, 281 {2354, nullptr, "PrioritizeApplicationBackgroundTask"},
279 {2355, nullptr, "Unknown2355"}, 282 {2355, nullptr, "PreferStorageEfficientUpdate"},
280 {2356, nullptr, "Unknown2356"}, 283 {2356, nullptr, "RequestStorageEfficientUpdatePreferable"},
284 {2357, nullptr, "EnableMultiCoreDownload"},
285 {2358, nullptr, "DisableMultiCoreDownload"},
286 {2359, nullptr, "IsMultiCoreDownloadEnabled"},
281 {2400, nullptr, "GetPromotionInfo"}, 287 {2400, nullptr, "GetPromotionInfo"},
282 {2401, nullptr, "CountPromotionInfo"}, 288 {2401, nullptr, "CountPromotionInfo"},
283 {2402, nullptr, "ListPromotionInfo"}, 289 {2402, nullptr, "ListPromotionInfo"},
@@ -295,6 +301,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
295 {2519, nullptr, "IsQualificationTransitionSupported"}, 301 {2519, nullptr, "IsQualificationTransitionSupported"},
296 {2520, nullptr, "IsQualificationTransitionSupportedByProcessId"}, 302 {2520, nullptr, "IsQualificationTransitionSupportedByProcessId"},
297 {2521, nullptr, "GetRightsUserChangedEvent"}, 303 {2521, nullptr, "GetRightsUserChangedEvent"},
304 {2522, nullptr, "IsRomRedirectionAvailable"},
298 {2800, nullptr, "GetApplicationIdOfPreomia"}, 305 {2800, nullptr, "GetApplicationIdOfPreomia"},
299 {3000, nullptr, "RegisterDeviceLockKey"}, 306 {3000, nullptr, "RegisterDeviceLockKey"},
300 {3001, nullptr, "UnregisterDeviceLockKey"}, 307 {3001, nullptr, "UnregisterDeviceLockKey"},
@@ -311,6 +318,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
311 {3012, nullptr, "IsApplicationTitleHidden"}, 318 {3012, nullptr, "IsApplicationTitleHidden"},
312 {3013, nullptr, "IsGameCardEnabled"}, 319 {3013, nullptr, "IsGameCardEnabled"},
313 {3014, nullptr, "IsLocalContentShareEnabled"}, 320 {3014, nullptr, "IsLocalContentShareEnabled"},
321 {3050, nullptr, "ListAssignELicenseTaskResult"},
314 {9999, nullptr, "GetApplicationCertificate"}, 322 {9999, nullptr, "GetApplicationCertificate"},
315 }; 323 };
316 // clang-format on 324 // clang-format on
diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp
index bdb499268..330a66409 100644
--- a/src/core/hle/service/sockets/bsd.cpp
+++ b/src/core/hle/service/sockets/bsd.cpp
@@ -954,6 +954,9 @@ BSDCFG::BSDCFG(Core::System& system_) : ServiceFramework{system_, "bsdcfg"} {
954 {10, nullptr, "ClearArpEntries"}, 954 {10, nullptr, "ClearArpEntries"},
955 {11, nullptr, "ClearArpEntries2"}, 955 {11, nullptr, "ClearArpEntries2"},
956 {12, nullptr, "PrintArpEntries"}, 956 {12, nullptr, "PrintArpEntries"},
957 {13, nullptr, "Unknown13"},
958 {14, nullptr, "Unknown14"},
959 {15, nullptr, "Unknown15"},
957 }; 960 };
958 // clang-format on 961 // clang-format on
959 962
diff --git a/src/core/hle/service/ssl/ssl.cpp b/src/core/hle/service/ssl/ssl.cpp
index dcf47083f..015208593 100644
--- a/src/core/hle/service/ssl/ssl.cpp
+++ b/src/core/hle/service/ssl/ssl.cpp
@@ -46,6 +46,14 @@ public:
46 {25, nullptr, "GetCipherInfo"}, 46 {25, nullptr, "GetCipherInfo"},
47 {26, nullptr, "SetNextAlpnProto"}, 47 {26, nullptr, "SetNextAlpnProto"},
48 {27, nullptr, "GetNextAlpnProto"}, 48 {27, nullptr, "GetNextAlpnProto"},
49 {28, nullptr, "SetDtlsSocketDescriptor"},
50 {29, nullptr, "GetDtlsHandshakeTimeout"},
51 {30, nullptr, "SetPrivateOption"},
52 {31, nullptr, "SetSrtpCiphers"},
53 {32, nullptr, "GetSrtpCipher"},
54 {33, nullptr, "ExportKeyingMaterial"},
55 {34, nullptr, "SetIoTimeout"},
56 {35, nullptr, "GetIoTimeout"},
49 }; 57 };
50 // clang-format on 58 // clang-format on
51 59
@@ -69,6 +77,8 @@ public:
69 {9, nullptr, "AddPolicyOid"}, 77 {9, nullptr, "AddPolicyOid"},
70 {10, nullptr, "ImportCrl"}, 78 {10, nullptr, "ImportCrl"},
71 {11, nullptr, "RemoveCrl"}, 79 {11, nullptr, "RemoveCrl"},
80 {12, nullptr, "ImportClientCertKeyPki"},
81 {13, nullptr, "GeneratePrivateKeyAndCert"},
72 }; 82 };
73 RegisterHandlers(functions); 83 RegisterHandlers(functions);
74 } 84 }
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index 2fb631183..0915785d2 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -249,6 +249,9 @@ public:
249 {2053, nullptr, "DestroyIndirectProducerEndPoint"}, 249 {2053, nullptr, "DestroyIndirectProducerEndPoint"},
250 {2054, nullptr, "CreateIndirectConsumerEndPoint"}, 250 {2054, nullptr, "CreateIndirectConsumerEndPoint"},
251 {2055, nullptr, "DestroyIndirectConsumerEndPoint"}, 251 {2055, nullptr, "DestroyIndirectConsumerEndPoint"},
252 {2060, nullptr, "CreateWatermarkCompositor"},
253 {2062, nullptr, "SetWatermarkText"},
254 {2063, nullptr, "SetWatermarkLayerStacks"},
252 {2300, nullptr, "AcquireLayerTexturePresentingEvent"}, 255 {2300, nullptr, "AcquireLayerTexturePresentingEvent"},
253 {2301, nullptr, "ReleaseLayerTexturePresentingEvent"}, 256 {2301, nullptr, "ReleaseLayerTexturePresentingEvent"},
254 {2302, nullptr, "GetDisplayHotplugEvent"}, 257 {2302, nullptr, "GetDisplayHotplugEvent"},
@@ -279,6 +282,8 @@ public:
279 {6011, nullptr, "EnableLayerAutoClearTransitionBuffer"}, 282 {6011, nullptr, "EnableLayerAutoClearTransitionBuffer"},
280 {6012, nullptr, "DisableLayerAutoClearTransitionBuffer"}, 283 {6012, nullptr, "DisableLayerAutoClearTransitionBuffer"},
281 {6013, nullptr, "SetLayerOpacity"}, 284 {6013, nullptr, "SetLayerOpacity"},
285 {6014, nullptr, "AttachLayerWatermarkCompositor"},
286 {6015, nullptr, "DetachLayerWatermarkCompositor"},
282 {7000, nullptr, "SetContentVisibility"}, 287 {7000, nullptr, "SetContentVisibility"},
283 {8000, nullptr, "SetConductorLayer"}, 288 {8000, nullptr, "SetConductorLayer"},
284 {8001, nullptr, "SetTimestampTracking"}, 289 {8001, nullptr, "SetTimestampTracking"},
diff --git a/src/core/hle/service/vi/vi_m.cpp b/src/core/hle/service/vi/vi_m.cpp
index 1ab7fe4ab..7ca44354b 100644
--- a/src/core/hle/service/vi/vi_m.cpp
+++ b/src/core/hle/service/vi/vi_m.cpp
@@ -14,6 +14,10 @@ VI_M::VI_M(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_,
14 static const FunctionInfo functions[] = { 14 static const FunctionInfo functions[] = {
15 {2, &VI_M::GetDisplayService, "GetDisplayService"}, 15 {2, &VI_M::GetDisplayService, "GetDisplayService"},
16 {3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, 16 {3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
17 {100, nullptr, "PrepareFatal"},
18 {101, nullptr, "ShowFatal"},
19 {102, nullptr, "DrawFatalRectangle"},
20 {103, nullptr, "DrawFatalText32"},
17 }; 21 };
18 RegisterHandlers(functions); 22 RegisterHandlers(functions);
19} 23}
diff --git a/src/input_common/drivers/mouse.cpp b/src/input_common/drivers/mouse.cpp
index da50e0a24..8b7f9aee9 100644
--- a/src/input_common/drivers/mouse.cpp
+++ b/src/input_common/drivers/mouse.cpp
@@ -10,17 +10,25 @@
10#include "input_common/drivers/mouse.h" 10#include "input_common/drivers/mouse.h"
11 11
12namespace InputCommon { 12namespace InputCommon {
13constexpr int update_time = 10;
14constexpr float default_stick_sensitivity = 0.022f;
15constexpr float default_motion_sensitivity = 0.008f;
13constexpr int mouse_axis_x = 0; 16constexpr int mouse_axis_x = 0;
14constexpr int mouse_axis_y = 1; 17constexpr int mouse_axis_y = 1;
15constexpr int wheel_axis_x = 2; 18constexpr int wheel_axis_x = 2;
16constexpr int wheel_axis_y = 3; 19constexpr int wheel_axis_y = 3;
17constexpr int motion_wheel_y = 4;
18constexpr PadIdentifier identifier = { 20constexpr PadIdentifier identifier = {
19 .guid = Common::UUID{}, 21 .guid = Common::UUID{},
20 .port = 0, 22 .port = 0,
21 .pad = 0, 23 .pad = 0,
22}; 24};
23 25
26constexpr PadIdentifier motion_identifier = {
27 .guid = Common::UUID{},
28 .port = 0,
29 .pad = 1,
30};
31
24constexpr PadIdentifier real_mouse_identifier = { 32constexpr PadIdentifier real_mouse_identifier = {
25 .guid = Common::UUID{}, 33 .guid = Common::UUID{},
26 .port = 1, 34 .port = 1,
@@ -37,47 +45,87 @@ Mouse::Mouse(std::string input_engine_) : InputEngine(std::move(input_engine_))
37 PreSetController(identifier); 45 PreSetController(identifier);
38 PreSetController(real_mouse_identifier); 46 PreSetController(real_mouse_identifier);
39 PreSetController(touch_identifier); 47 PreSetController(touch_identifier);
48 PreSetController(motion_identifier);
40 49
41 // Initialize all mouse axis 50 // Initialize all mouse axis
42 PreSetAxis(identifier, mouse_axis_x); 51 PreSetAxis(identifier, mouse_axis_x);
43 PreSetAxis(identifier, mouse_axis_y); 52 PreSetAxis(identifier, mouse_axis_y);
44 PreSetAxis(identifier, wheel_axis_x); 53 PreSetAxis(identifier, wheel_axis_x);
45 PreSetAxis(identifier, wheel_axis_y); 54 PreSetAxis(identifier, wheel_axis_y);
46 PreSetAxis(identifier, motion_wheel_y);
47 PreSetAxis(real_mouse_identifier, mouse_axis_x); 55 PreSetAxis(real_mouse_identifier, mouse_axis_x);
48 PreSetAxis(real_mouse_identifier, mouse_axis_y); 56 PreSetAxis(real_mouse_identifier, mouse_axis_y);
49 PreSetAxis(touch_identifier, mouse_axis_x); 57 PreSetAxis(touch_identifier, mouse_axis_x);
50 PreSetAxis(touch_identifier, mouse_axis_y); 58 PreSetAxis(touch_identifier, mouse_axis_y);
59
60 // Initialize variables
61 mouse_origin = {};
62 last_mouse_position = {};
63 wheel_position = {};
64 last_mouse_change = {};
65 last_motion_change = {};
66
51 update_thread = std::jthread([this](std::stop_token stop_token) { UpdateThread(stop_token); }); 67 update_thread = std::jthread([this](std::stop_token stop_token) { UpdateThread(stop_token); });
52} 68}
53 69
54void Mouse::UpdateThread(std::stop_token stop_token) { 70void Mouse::UpdateThread(std::stop_token stop_token) {
55 Common::SetCurrentThreadName("Mouse"); 71 Common::SetCurrentThreadName("Mouse");
56 constexpr int update_time = 10;
57 while (!stop_token.stop_requested()) {
58 if (Settings::values.mouse_panning) {
59 // Slow movement by 4%
60 last_mouse_change *= 0.96f;
61 const float sensitivity =
62 Settings::values.mouse_panning_sensitivity.GetValue() * 0.022f;
63 SetAxis(identifier, mouse_axis_x, last_mouse_change.x * sensitivity);
64 SetAxis(identifier, mouse_axis_y, -last_mouse_change.y * sensitivity);
65 }
66 72
67 SetAxis(identifier, motion_wheel_y, 0.0f); 73 while (!stop_token.stop_requested()) {
74 UpdateStickInput();
75 UpdateMotionInput();
68 76
69 if (mouse_panning_timout++ > 20) { 77 if (mouse_panning_timeout++ > 20) {
70 StopPanning(); 78 StopPanning();
71 } 79 }
72 std::this_thread::sleep_for(std::chrono::milliseconds(update_time)); 80 std::this_thread::sleep_for(std::chrono::milliseconds(update_time));
73 } 81 }
74} 82}
75 83
84void Mouse::UpdateStickInput() {
85 if (!Settings::values.mouse_panning) {
86 return;
87 }
88
89 const float sensitivity =
90 Settings::values.mouse_panning_sensitivity.GetValue() * default_stick_sensitivity;
91
92 // Slow movement by 4%
93 last_mouse_change *= 0.96f;
94 SetAxis(identifier, mouse_axis_x, last_mouse_change.x * sensitivity);
95 SetAxis(identifier, mouse_axis_y, -last_mouse_change.y * sensitivity);
96}
97
98void Mouse::UpdateMotionInput() {
99 const float sensitivity =
100 Settings::values.mouse_panning_sensitivity.GetValue() * default_motion_sensitivity;
101
102 // Slow movement by 7%
103 if (Settings::values.mouse_panning) {
104 last_motion_change *= 0.93f;
105 } else {
106 last_motion_change.z *= 0.93f;
107 }
108
109 const BasicMotion motion_data{
110 .gyro_x = last_motion_change.x * sensitivity,
111 .gyro_y = last_motion_change.y * sensitivity,
112 .gyro_z = last_motion_change.z * sensitivity,
113 .accel_x = 0,
114 .accel_y = 0,
115 .accel_z = 0,
116 .delta_timestamp = update_time * 1000,
117 };
118
119 SetMotion(motion_identifier, 0, motion_data);
120}
121
76void Mouse::Move(int x, int y, int center_x, int center_y) { 122void Mouse::Move(int x, int y, int center_x, int center_y) {
77 if (Settings::values.mouse_panning) { 123 if (Settings::values.mouse_panning) {
124 mouse_panning_timeout = 0;
125
78 auto mouse_change = 126 auto mouse_change =
79 (Common::MakeVec(x, y) - Common::MakeVec(center_x, center_y)).Cast<float>(); 127 (Common::MakeVec(x, y) - Common::MakeVec(center_x, center_y)).Cast<float>();
80 mouse_panning_timout = 0; 128 Common::Vec3<float> motion_change{-mouse_change.y, -mouse_change.x, last_motion_change.z};
81 129
82 const auto move_distance = mouse_change.Length(); 130 const auto move_distance = mouse_change.Length();
83 if (move_distance == 0) { 131 if (move_distance == 0) {
@@ -93,6 +141,7 @@ void Mouse::Move(int x, int y, int center_x, int center_y) {
93 141
94 // Average mouse movements 142 // Average mouse movements
95 last_mouse_change = (last_mouse_change * 0.91f) + (mouse_change * 0.09f); 143 last_mouse_change = (last_mouse_change * 0.91f) + (mouse_change * 0.09f);
144 last_motion_change = (last_motion_change * 0.69f) + (motion_change * 0.31f);
96 145
97 const auto last_move_distance = last_mouse_change.Length(); 146 const auto last_move_distance = last_mouse_change.Length();
98 147
@@ -116,6 +165,12 @@ void Mouse::Move(int x, int y, int center_x, int center_y) {
116 const float sensitivity = Settings::values.mouse_panning_sensitivity.GetValue() * 0.0012f; 165 const float sensitivity = Settings::values.mouse_panning_sensitivity.GetValue() * 0.0012f;
117 SetAxis(identifier, mouse_axis_x, static_cast<float>(mouse_move.x) * sensitivity); 166 SetAxis(identifier, mouse_axis_x, static_cast<float>(mouse_move.x) * sensitivity);
118 SetAxis(identifier, mouse_axis_y, static_cast<float>(-mouse_move.y) * sensitivity); 167 SetAxis(identifier, mouse_axis_y, static_cast<float>(-mouse_move.y) * sensitivity);
168
169 last_motion_change = {
170 static_cast<float>(-mouse_move.y) / 50.0f,
171 static_cast<float>(-mouse_move.x) / 50.0f,
172 last_motion_change.z,
173 };
119 } 174 }
120} 175}
121 176
@@ -157,15 +212,19 @@ void Mouse::ReleaseButton(MouseButton button) {
157 SetAxis(identifier, mouse_axis_x, 0); 212 SetAxis(identifier, mouse_axis_x, 0);
158 SetAxis(identifier, mouse_axis_y, 0); 213 SetAxis(identifier, mouse_axis_y, 0);
159 } 214 }
215
216 last_motion_change.x = 0;
217 last_motion_change.y = 0;
218
160 button_pressed = false; 219 button_pressed = false;
161} 220}
162 221
163void Mouse::MouseWheelChange(int x, int y) { 222void Mouse::MouseWheelChange(int x, int y) {
164 wheel_position.x += x; 223 wheel_position.x += x;
165 wheel_position.y += y; 224 wheel_position.y += y;
225 last_motion_change.z += static_cast<f32>(y) / 100.0f;
166 SetAxis(identifier, wheel_axis_x, static_cast<f32>(wheel_position.x)); 226 SetAxis(identifier, wheel_axis_x, static_cast<f32>(wheel_position.x));
167 SetAxis(identifier, wheel_axis_y, static_cast<f32>(wheel_position.y)); 227 SetAxis(identifier, wheel_axis_y, static_cast<f32>(wheel_position.y));
168 SetAxis(identifier, motion_wheel_y, static_cast<f32>(y) / 100.0f);
169} 228}
170 229
171void Mouse::ReleaseAllButtons() { 230void Mouse::ReleaseAllButtons() {
@@ -234,6 +293,9 @@ Common::Input::ButtonNames Mouse::GetUIName(const Common::ParamPackage& params)
234 if (params.Has("axis_x") && params.Has("axis_y") && params.Has("axis_z")) { 293 if (params.Has("axis_x") && params.Has("axis_y") && params.Has("axis_z")) {
235 return Common::Input::ButtonNames::Engine; 294 return Common::Input::ButtonNames::Engine;
236 } 295 }
296 if (params.Has("motion")) {
297 return Common::Input::ButtonNames::Engine;
298 }
237 299
238 return Common::Input::ButtonNames::Invalid; 300 return Common::Input::ButtonNames::Invalid;
239} 301}
diff --git a/src/input_common/drivers/mouse.h b/src/input_common/drivers/mouse.h
index f3b65bdd1..b872c7a0f 100644
--- a/src/input_common/drivers/mouse.h
+++ b/src/input_common/drivers/mouse.h
@@ -96,6 +96,8 @@ public:
96 96
97private: 97private:
98 void UpdateThread(std::stop_token stop_token); 98 void UpdateThread(std::stop_token stop_token);
99 void UpdateStickInput();
100 void UpdateMotionInput();
99 void StopPanning(); 101 void StopPanning();
100 102
101 Common::Input::ButtonNames GetUIButtonName(const Common::ParamPackage& params) const; 103 Common::Input::ButtonNames GetUIButtonName(const Common::ParamPackage& params) const;
@@ -103,9 +105,10 @@ private:
103 Common::Vec2<int> mouse_origin; 105 Common::Vec2<int> mouse_origin;
104 Common::Vec2<int> last_mouse_position; 106 Common::Vec2<int> last_mouse_position;
105 Common::Vec2<float> last_mouse_change; 107 Common::Vec2<float> last_mouse_change;
108 Common::Vec3<float> last_motion_change;
106 Common::Vec2<int> wheel_position; 109 Common::Vec2<int> wheel_position;
107 bool button_pressed; 110 bool button_pressed;
108 int mouse_panning_timout{}; 111 int mouse_panning_timeout{};
109 std::jthread update_thread; 112 std::jthread update_thread;
110}; 113};
111 114
diff --git a/src/input_common/input_mapping.cpp b/src/input_common/input_mapping.cpp
index 6990a86b9..2ff480ff9 100644
--- a/src/input_common/input_mapping.cpp
+++ b/src/input_common/input_mapping.cpp
@@ -142,14 +142,10 @@ void MappingFactory::RegisterMotion(const MappingData& data) {
142 new_input.Set("port", static_cast<int>(data.pad.port)); 142 new_input.Set("port", static_cast<int>(data.pad.port));
143 new_input.Set("pad", static_cast<int>(data.pad.pad)); 143 new_input.Set("pad", static_cast<int>(data.pad.pad));
144 144
145 // If engine is mouse map the mouse position as 3 axis motion 145 // If engine is mouse map it automatically to mouse motion
146 if (data.engine == "mouse") { 146 if (data.engine == "mouse") {
147 new_input.Set("axis_x", 1); 147 new_input.Set("motion", 0);
148 new_input.Set("invert_x", "-"); 148 new_input.Set("pad", 1);
149 new_input.Set("axis_y", 0);
150 new_input.Set("axis_z", 4);
151 new_input.Set("range", 1.0f);
152 new_input.Set("deadzone", 0.0f);
153 input_queue.Push(new_input); 149 input_queue.Push(new_input);
154 return; 150 return;
155 } 151 }
diff --git a/src/yuzu/applets/qt_controller.cpp b/src/yuzu/applets/qt_controller.cpp
index c30b54499..d22db9f6b 100644
--- a/src/yuzu/applets/qt_controller.cpp
+++ b/src/yuzu/applets/qt_controller.cpp
@@ -542,19 +542,14 @@ void QtControllerSelectorDialog::UpdateControllerState(std::size_t player_index)
542 const auto player_connected = player_groupboxes[player_index]->isChecked() && 542 const auto player_connected = player_groupboxes[player_index]->isChecked() &&
543 controller_type != Core::HID::NpadStyleIndex::Handheld; 543 controller_type != Core::HID::NpadStyleIndex::Handheld;
544 544
545 if (controller->GetNpadStyleIndex(true) == controller_type &&
546 controller->IsConnected(true) == player_connected) {
547 return;
548 }
549
550 // Disconnect the controller first. 545 // Disconnect the controller first.
551 UpdateController(controller, controller_type, false); 546 UpdateController(controller, controller_type, false);
552 547
553 // Handheld 548 // Handheld
554 if (player_index == 0) { 549 if (player_index == 0) {
550 auto* handheld = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
551 UpdateController(handheld, controller_type, false);
555 if (controller_type == Core::HID::NpadStyleIndex::Handheld) { 552 if (controller_type == Core::HID::NpadStyleIndex::Handheld) {
556 auto* handheld =
557 system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
558 UpdateController(handheld, Core::HID::NpadStyleIndex::Handheld, 553 UpdateController(handheld, Core::HID::NpadStyleIndex::Handheld,
559 player_groupboxes[player_index]->isChecked()); 554 player_groupboxes[player_index]->isChecked());
560 } 555 }
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index dd1c1e94a..4dad83b75 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -212,16 +212,11 @@ void Config::ReadPlayerValue(std::size_t player_index) {
212 } 212 }
213 213
214 if (player_prefix.isEmpty() && Settings::IsConfiguringGlobal()) { 214 if (player_prefix.isEmpty() && Settings::IsConfiguringGlobal()) {
215 const auto controller = static_cast<Settings::ControllerType>( 215 player.controller_type = static_cast<Settings::ControllerType>(
216 qt_config 216 qt_config
217 ->value(QStringLiteral("%1type").arg(player_prefix), 217 ->value(QStringLiteral("%1type").arg(player_prefix),
218 static_cast<u8>(Settings::ControllerType::ProController)) 218 static_cast<u8>(Settings::ControllerType::ProController))
219 .toUInt()); 219 .toUInt());
220
221 if (controller == Settings::ControllerType::LeftJoycon ||
222 controller == Settings::ControllerType::RightJoycon) {
223 player.controller_type = controller;
224 }
225 } else { 220 } else {
226 player.connected = 221 player.connected =
227 ReadSetting(QStringLiteral("%1connected").arg(player_prefix), player_index == 0) 222 ReadSetting(QStringLiteral("%1connected").arg(player_prefix), player_index == 0)
@@ -1313,9 +1308,7 @@ void Config::SaveRendererValues() {
1313 static_cast<u32>(Settings::values.renderer_backend.GetValue(global)), 1308 static_cast<u32>(Settings::values.renderer_backend.GetValue(global)),
1314 static_cast<u32>(Settings::values.renderer_backend.GetDefault()), 1309 static_cast<u32>(Settings::values.renderer_backend.GetDefault()),
1315 Settings::values.renderer_backend.UsingGlobal()); 1310 Settings::values.renderer_backend.UsingGlobal());
1316 WriteSetting(QString::fromStdString(Settings::values.renderer_force_max_clock.GetLabel()), 1311 WriteGlobalSetting(Settings::values.renderer_force_max_clock);
1317 static_cast<u32>(Settings::values.renderer_force_max_clock.GetValue(global)),
1318 static_cast<u32>(Settings::values.renderer_force_max_clock.GetDefault()));
1319 WriteGlobalSetting(Settings::values.vulkan_device); 1312 WriteGlobalSetting(Settings::values.vulkan_device);
1320 WriteSetting(QString::fromStdString(Settings::values.fullscreen_mode.GetLabel()), 1313 WriteSetting(QString::fromStdString(Settings::values.fullscreen_mode.GetLabel()),
1321 static_cast<u32>(Settings::values.fullscreen_mode.GetValue(global)), 1314 static_cast<u32>(Settings::values.fullscreen_mode.GetValue(global)),
diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp
index bbc363322..59fb1b334 100644
--- a/src/yuzu/configuration/configure_graphics_advanced.cpp
+++ b/src/yuzu/configuration/configure_graphics_advanced.cpp
@@ -47,8 +47,6 @@ void ConfigureGraphicsAdvanced::SetConfiguration() {
47 &Settings::values.max_anisotropy); 47 &Settings::values.max_anisotropy);
48 ConfigurationShared::SetHighlight(ui->label_gpu_accuracy, 48 ConfigurationShared::SetHighlight(ui->label_gpu_accuracy,
49 !Settings::values.gpu_accuracy.UsingGlobal()); 49 !Settings::values.gpu_accuracy.UsingGlobal());
50 ConfigurationShared::SetHighlight(ui->renderer_force_max_clock,
51 !Settings::values.renderer_force_max_clock.UsingGlobal());
52 ConfigurationShared::SetHighlight(ui->af_label, 50 ConfigurationShared::SetHighlight(ui->af_label,
53 !Settings::values.max_anisotropy.UsingGlobal()); 51 !Settings::values.max_anisotropy.UsingGlobal());
54 } 52 }
diff --git a/src/yuzu/configuration/configure_input_per_game.cpp b/src/yuzu/configuration/configure_input_per_game.cpp
index 78e65d468..4e77fe00b 100644
--- a/src/yuzu/configuration/configure_input_per_game.cpp
+++ b/src/yuzu/configuration/configure_input_per_game.cpp
@@ -57,7 +57,7 @@ void ConfigureInputPerGame::ApplyConfiguration() {
57} 57}
58 58
59void ConfigureInputPerGame::LoadConfiguration() { 59void ConfigureInputPerGame::LoadConfiguration() {
60 static constexpr size_t HANDHELD_INDEX = 8; 60 static constexpr size_t HANDHELD_INDEX = 0;
61 61
62 auto& hid_core = system.HIDCore(); 62 auto& hid_core = system.HIDCore();
63 for (size_t player_index = 0; player_index < profile_comboboxes.size(); ++player_index) { 63 for (size_t player_index = 0; player_index < profile_comboboxes.size(); ++player_index) {
@@ -69,9 +69,6 @@ void ConfigureInputPerGame::LoadConfiguration() {
69 const auto selection_index = player_combobox->currentIndex(); 69 const auto selection_index = player_combobox->currentIndex();
70 if (selection_index == 0) { 70 if (selection_index == 0) {
71 Settings::values.players.GetValue()[player_index].profile_name = ""; 71 Settings::values.players.GetValue()[player_index].profile_name = "";
72 if (player_index == 0) {
73 Settings::values.players.GetValue()[HANDHELD_INDEX] = {};
74 }
75 Settings::values.players.SetGlobal(true); 72 Settings::values.players.SetGlobal(true);
76 emulated_controller->ReloadFromSettings(); 73 emulated_controller->ReloadFromSettings();
77 continue; 74 continue;
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp
index 50b62293e..93eb10ceb 100644
--- a/src/yuzu/configuration/configure_input_player.cpp
+++ b/src/yuzu/configuration/configure_input_player.cpp
@@ -1589,7 +1589,6 @@ void ConfigureInputPlayer::LoadProfile() {
1589} 1589}
1590 1590
1591void ConfigureInputPlayer::SaveProfile() { 1591void ConfigureInputPlayer::SaveProfile() {
1592 static constexpr size_t HANDHELD_INDEX = 8;
1593 const QString profile_name = ui->comboProfiles->itemText(ui->comboProfiles->currentIndex()); 1592 const QString profile_name = ui->comboProfiles->itemText(ui->comboProfiles->currentIndex());
1594 1593
1595 if (profile_name.isEmpty()) { 1594 if (profile_name.isEmpty()) {
@@ -1598,12 +1597,7 @@ void ConfigureInputPlayer::SaveProfile() {
1598 1597
1599 ApplyConfiguration(); 1598 ApplyConfiguration();
1600 1599
1601 // When we're in handheld mode, only the handheld emulated controller bindings are updated 1600 if (!profiles->SaveProfile(profile_name.toStdString(), player_index)) {
1602 const bool is_handheld = player_index == 0 && emulated_controller->GetNpadIdType() ==
1603 Core::HID::NpadIdType::Handheld;
1604 const auto profile_player_index = is_handheld ? HANDHELD_INDEX : player_index;
1605
1606 if (!profiles->SaveProfile(profile_name.toStdString(), profile_player_index)) {
1607 QMessageBox::critical(this, tr("Save Input Profile"), 1601 QMessageBox::critical(this, tr("Save Input Profile"),
1608 tr("Failed to save the input profile \"%1\"").arg(profile_name)); 1602 tr("Failed to save the input profile \"%1\"").arg(profile_name));
1609 UpdateInputProfiles(); 1603 UpdateInputProfiles();