diff options
Diffstat (limited to 'src')
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() { log_setting("Debugging_GDBStub", values.use_gdbstub.GetValue()); log_setting("Input_EnableMotion", values.motion_enabled.GetValue()); log_setting("Input_EnableVibration", values.vibration_enabled.GetValue()); + log_setting("Input_EnableTouch", values.touchscreen.enabled); + log_setting("Input_EnableMouse", values.mouse_enabled.GetValue()); + log_setting("Input_EnableKeyboard", values.keyboard_enabled.GetValue()); + log_setting("Input_EnableRingController", values.enable_ring_controller.GetValue()); + log_setting("Input_EnableIrSensor", values.enable_ir_sensor.GetValue()); + log_setting("Input_EnableCustomJoycon", values.enable_joycon_driver.GetValue()); + log_setting("Input_EnableCustomProController", values.enable_procon_driver.GetValue()); log_setting("Input_EnableRawInput", values.enable_raw_input.GetValue()); } 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 { SwitchableSetting<s32, true> sound_index{1, 0, 2, "sound_index"}; // Controls - InputSetting<std::array<PlayerInput, 10>> players; + InputSetting<std::array<PlayerInput, 8>> players; SwitchableSetting<bool> use_docked_mode{true, "use_docked_mode"}; 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 } void EmulatedController::ReloadFromSettings() { - const auto player_index = NpadIdTypeToIndex(npad_id_type); + if (npad_id_type == NpadIdType::Other) { + ReloadDebugPadFromSettings(); + return; + } + + const auto player_index = NpadIdTypeToConfigIndex(npad_id_type); const auto& player = Settings::values.players.GetValue()[player_index]; for (std::size_t index = 0; index < player.buttons.size(); ++index) { @@ -111,13 +116,21 @@ void EmulatedController::ReloadFromSettings() { ring_params[0] = Common::ParamPackage(Settings::values.ringcon_analogs); - // Other or debug controller should always be a pro controller - if (npad_id_type != NpadIdType::Other) { - SetNpadStyleIndex(MapSettingsTypeToNPad(player.controller_type)); - original_npad_type = npad_type; - } else { - SetNpadStyleIndex(NpadStyleIndex::ProController); - original_npad_type = npad_type; + SetNpadStyleIndex(MapSettingsTypeToNPad(player.controller_type)); + original_npad_type = npad_type; + + // Player 1 shares config with handheld. Disable controller when handheld is selected + if (npad_id_type == NpadIdType::Player1 && npad_type == NpadStyleIndex::Handheld) { + Disconnect(); + ReloadInput(); + return; + } + + // Handheld shares config with player 1. Disable controller when handheld isn't selected + if (npad_id_type == NpadIdType::Handheld && npad_type != NpadStyleIndex::Handheld) { + Disconnect(); + ReloadInput(); + return; } Disconnect(); @@ -128,6 +141,33 @@ void EmulatedController::ReloadFromSettings() { ReloadInput(); } +void EmulatedController::ReloadDebugPadFromSettings() { + for (std::size_t index = 0; index < Settings::values.debug_pad_buttons.size(); ++index) { + button_params[index] = Common::ParamPackage(Settings::values.debug_pad_buttons[index]); + } + for (std::size_t index = 0; index < Settings::values.debug_pad_analogs.size(); ++index) { + stick_params[index] = Common::ParamPackage(Settings::values.debug_pad_analogs[index]); + } + for (std::size_t index = 0; index < motion_params.size(); ++index) { + motion_params[index] = {}; + } + + controller.color_values = {}; + controller.colors_state.fullkey = {}; + controller.colors_state.left = {}; + controller.colors_state.right = {}; + ring_params[0] = {}; + SetNpadStyleIndex(NpadStyleIndex::ProController); + original_npad_type = npad_type; + + Disconnect(); + if (Settings::values.debug_pad_enabled) { + Connect(); + } + + ReloadInput(); +} + void EmulatedController::LoadDevices() { // TODO(german77): Use more buttons to detect the correct device const auto left_joycon = button_params[Settings::NativeButton::DRight]; @@ -363,7 +403,17 @@ void EmulatedController::ReloadInput() { SetMotion(callback, index); }, }); - motion_devices[index]->ForceUpdate(); + + // Restore motion state + auto& emulated_motion = controller.motion_values[index].emulated; + auto& motion = controller.motion_state[index]; + emulated_motion.ResetRotations(); + emulated_motion.ResetQuaternion(); + motion.accel = emulated_motion.GetAcceleration(); + motion.gyro = emulated_motion.GetGyroscope(); + motion.rotation = emulated_motion.GetRotations(); + motion.orientation = emulated_motion.GetOrientation(); + motion.is_at_rest = !emulated_motion.IsMoving(motion_sensitivity); } for (std::size_t index = 0; index < camera_devices.size(); ++index) { @@ -550,9 +600,23 @@ bool EmulatedController::IsConfiguring() const { } void EmulatedController::SaveCurrentConfig() { - const auto player_index = NpadIdTypeToIndex(npad_id_type); + // Other can't alter the config from here + if (npad_id_type == NpadIdType::Other) { + return; + } + + const auto player_index = NpadIdTypeToConfigIndex(npad_id_type); auto& player = Settings::values.players.GetValue()[player_index]; - player.connected = is_connected; + + // Only save the connected status when handheld is connected + if (npad_id_type == NpadIdType::Handheld && npad_type == NpadStyleIndex::Handheld) { + player.connected = is_connected; + } + + if (npad_id_type != NpadIdType::Handheld && npad_type != NpadStyleIndex::Handheld) { + player.connected = is_connected; + } + player.controller_type = MapNPadToSettingsType(npad_type); for (std::size_t index = 0; index < player.buttons.size(); ++index) { player.buttons[index] = button_params[index].Serialize(); @@ -1142,7 +1206,7 @@ bool EmulatedController::SetVibration(std::size_t device_index, VibrationValue v if (!output_devices[device_index]) { return false; } - const auto player_index = NpadIdTypeToIndex(npad_id_type); + const auto player_index = NpadIdTypeToConfigIndex(npad_id_type); const auto& player = Settings::values.players.GetValue()[player_index]; const f32 strength = static_cast<f32>(player.vibration_strength) / 100.0f; @@ -1168,7 +1232,7 @@ bool EmulatedController::SetVibration(std::size_t device_index, VibrationValue v } bool EmulatedController::IsVibrationEnabled(std::size_t device_index) { - const auto player_index = NpadIdTypeToIndex(npad_id_type); + const auto player_index = NpadIdTypeToConfigIndex(npad_id_type); const auto& player = Settings::values.players.GetValue()[player_index]; 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: /// Reload all input devices void ReloadInput(); - /// Overrides current mapped devices with the stored configuration and reloads all input devices + /// Overrides current mapped devices with the stored configuration and reloads all input + /// callbacks void ReloadFromSettings(); + /// Overrides current mapped debug pad with the stored configuration and reloads all input + /// callbacks + void ReloadDebugPadFromSettings(); + /// Saves the current mapped configuration void SaveCurrentConfig(); 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() { void EmulatedDevices::ReloadInput() { // If you load any device here add the equivalent to the UnloadInput() function + + // Native Mouse is mapped on port 1, pad 0 + const Common::ParamPackage mouse_params{"engine:mouse,port:1,pad:0"}; + + // Keyboard keys is mapped on port 1, pad 0 for normal keys, pad 1 for moddifier keys + const Common::ParamPackage keyboard_params{"engine:keyboard,port:1"}; + std::size_t key_index = 0; for (auto& mouse_device : mouse_button_devices) { - Common::ParamPackage mouse_params; - mouse_params.Set("engine", "mouse"); - mouse_params.Set("button", static_cast<int>(key_index)); - mouse_device = Common::Input::CreateInputDevice(mouse_params); + Common::ParamPackage mouse_button_params = mouse_params; + mouse_button_params.Set("button", static_cast<int>(key_index)); + mouse_device = Common::Input::CreateInputDevice(mouse_button_params); key_index++; } - mouse_stick_device = - Common::Input::CreateInputDeviceFromString("engine:mouse,axis_x:0,axis_y:1"); + Common::ParamPackage mouse_position_params = mouse_params; + mouse_position_params.Set("axis_x", 0); + mouse_position_params.Set("axis_y", 1); + mouse_position_params.Set("deadzone", 0.0f); + mouse_position_params.Set("range", 1.0f); + mouse_position_params.Set("threshold", 0.0f); + mouse_stick_device = Common::Input::CreateInputDevice(mouse_position_params); // First two axis are reserved for mouse position key_index = 2; - for (auto& mouse_device : mouse_analog_devices) { - // Mouse axis are only mapped on port 1, pad 0 - Common::ParamPackage mouse_params; - mouse_params.Set("engine", "mouse"); - mouse_params.Set("axis", static_cast<int>(key_index)); - mouse_params.Set("port", 1); - mouse_params.Set("pad", 0); - mouse_device = Common::Input::CreateInputDevice(mouse_params); + for (auto& mouse_device : mouse_wheel_devices) { + Common::ParamPackage mouse_wheel_params = mouse_params; + mouse_wheel_params.Set("axis", static_cast<int>(key_index)); + mouse_device = Common::Input::CreateInputDevice(mouse_wheel_params); key_index++; } key_index = 0; for (auto& keyboard_device : keyboard_devices) { - // Keyboard keys are only mapped on port 1, pad 0 - Common::ParamPackage keyboard_params; - keyboard_params.Set("engine", "keyboard"); - keyboard_params.Set("button", static_cast<int>(key_index)); - keyboard_params.Set("port", 1); - keyboard_params.Set("pad", 0); - keyboard_device = Common::Input::CreateInputDevice(keyboard_params); + Common::ParamPackage keyboard_key_params = keyboard_params; + keyboard_key_params.Set("button", static_cast<int>(key_index)); + keyboard_key_params.Set("pad", 0); + keyboard_device = Common::Input::CreateInputDevice(keyboard_key_params); key_index++; } key_index = 0; for (auto& keyboard_device : keyboard_modifier_devices) { - // Keyboard moddifiers are only mapped on port 1, pad 1 - Common::ParamPackage keyboard_params; - keyboard_params.Set("engine", "keyboard"); - keyboard_params.Set("button", static_cast<int>(key_index)); - keyboard_params.Set("port", 1); - keyboard_params.Set("pad", 1); - keyboard_device = Common::Input::CreateInputDevice(keyboard_params); + Common::ParamPackage keyboard_moddifier_params = keyboard_params; + keyboard_moddifier_params.Set("button", static_cast<int>(key_index)); + keyboard_moddifier_params.Set("pad", 1); + keyboard_device = Common::Input::CreateInputDevice(keyboard_moddifier_params); key_index++; } @@ -80,14 +81,14 @@ void EmulatedDevices::ReloadInput() { }); } - for (std::size_t index = 0; index < mouse_analog_devices.size(); ++index) { - if (!mouse_analog_devices[index]) { + for (std::size_t index = 0; index < mouse_wheel_devices.size(); ++index) { + if (!mouse_wheel_devices[index]) { continue; } - mouse_analog_devices[index]->SetCallback({ + mouse_wheel_devices[index]->SetCallback({ .on_change = [this, index](const Common::Input::CallbackStatus& callback) { - SetMouseAnalog(callback, index); + SetMouseWheel(callback, index); }, }); } @@ -95,7 +96,9 @@ void EmulatedDevices::ReloadInput() { if (mouse_stick_device) { mouse_stick_device->SetCallback({ .on_change = - [this](const Common::Input::CallbackStatus& callback) { SetMouseStick(callback); }, + [this](const Common::Input::CallbackStatus& callback) { + SetMousePosition(callback); + }, }); } @@ -128,7 +131,7 @@ void EmulatedDevices::UnloadInput() { for (auto& button : mouse_button_devices) { button.reset(); } - for (auto& analog : mouse_analog_devices) { + for (auto& analog : mouse_wheel_devices) { analog.reset(); } mouse_stick_device.reset(); @@ -362,18 +365,18 @@ void EmulatedDevices::SetMouseButton(const Common::Input::CallbackStatus& callba TriggerOnChange(DeviceTriggerType::Mouse); } -void EmulatedDevices::SetMouseAnalog(const Common::Input::CallbackStatus& callback, - std::size_t index) { - if (index >= device_status.mouse_analog_values.size()) { +void EmulatedDevices::SetMouseWheel(const Common::Input::CallbackStatus& callback, + std::size_t index) { + if (index >= device_status.mouse_wheel_values.size()) { return; } std::unique_lock lock{mutex}; const auto analog_value = TransformToAnalog(callback); - device_status.mouse_analog_values[index] = analog_value; + device_status.mouse_wheel_values[index] = analog_value; if (is_configuring) { - device_status.mouse_position_state = {}; + device_status.mouse_wheel_state = {}; lock.unlock(); TriggerOnChange(DeviceTriggerType::Mouse); return; @@ -392,7 +395,7 @@ void EmulatedDevices::SetMouseAnalog(const Common::Input::CallbackStatus& callba TriggerOnChange(DeviceTriggerType::Mouse); } -void EmulatedDevices::SetMouseStick(const Common::Input::CallbackStatus& callback) { +void EmulatedDevices::SetMousePosition(const Common::Input::CallbackStatus& callback) { std::unique_lock lock{mutex}; const auto touch_value = TransformToTouch(callback); 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 Settings::NativeKeyboard::NumKeyboardMods>; using MouseButtonDevices = std::array<std::unique_ptr<Common::Input::InputDevice>, Settings::NativeMouseButton::NumMouseButtons>; -using MouseAnalogDevices = std::array<std::unique_ptr<Common::Input::InputDevice>, - Settings::NativeMouseWheel::NumMouseWheels>; +using MouseWheelDevices = std::array<std::unique_ptr<Common::Input::InputDevice>, + Settings::NativeMouseWheel::NumMouseWheels>; using MouseStickDevice = std::unique_ptr<Common::Input::InputDevice>; using MouseButtonParams = @@ -36,7 +36,7 @@ using KeyboardModifierValues = std::array<Common::Input::ButtonStatus, Settings::NativeKeyboard::NumKeyboardMods>; using MouseButtonValues = std::array<Common::Input::ButtonStatus, Settings::NativeMouseButton::NumMouseButtons>; -using MouseAnalogValues = +using MouseWheelValues = std::array<Common::Input::AnalogStatus, Settings::NativeMouseWheel::NumMouseWheels>; using MouseStickValue = Common::Input::TouchStatus; @@ -50,7 +50,7 @@ struct DeviceStatus { KeyboardValues keyboard_values{}; KeyboardModifierValues keyboard_moddifier_values{}; MouseButtonValues mouse_button_values{}; - MouseAnalogValues mouse_analog_values{}; + MouseWheelValues mouse_wheel_values{}; MouseStickValue mouse_stick_value{}; // Data for HID serices @@ -111,15 +111,6 @@ public: /// Reverts any mapped changes made that weren't saved void RestoreConfig(); - // Returns the current mapped ring device - Common::ParamPackage GetRingParam() const; - - /** - * Updates the current mapped ring device - * @param param ParamPackage with ring sensor data to be mapped - */ - void SetRingParam(Common::ParamPackage param); - /// Returns the latest status of button input from the keyboard with parameters KeyboardValues GetKeyboardValues() const; @@ -187,19 +178,13 @@ private: * @param callback A CallbackStatus containing the wheel status * @param index wheel ID to be updated */ - void SetMouseAnalog(const Common::Input::CallbackStatus& callback, std::size_t index); + void SetMouseWheel(const Common::Input::CallbackStatus& callback, std::size_t index); /** * Updates the mouse position status of the mouse device * @param callback A CallbackStatus containing the position status */ - void SetMouseStick(const Common::Input::CallbackStatus& callback); - - /** - * Updates the ring analog sensor status of the ring controller - * @param callback A CallbackStatus containing the force status - */ - void SetRingAnalog(const Common::Input::CallbackStatus& callback); + void SetMousePosition(const Common::Input::CallbackStatus& callback); /** * Triggers a callback that something has changed on the device status @@ -212,7 +197,7 @@ private: KeyboardDevices keyboard_devices; KeyboardModifierDevices keyboard_modifier_devices; MouseButtonDevices mouse_button_devices; - MouseAnalogDevices mouse_analog_devices; + MouseWheelDevices mouse_wheel_devices; MouseStickDevice mouse_stick_device; 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) { } } +/// Converts a NpadIdType to a config array index. +constexpr size_t NpadIdTypeToConfigIndex(NpadIdType npad_id_type) { + switch (npad_id_type) { + case NpadIdType::Player1: + return 0; + case NpadIdType::Player2: + return 1; + case NpadIdType::Player3: + return 2; + case NpadIdType::Player4: + return 3; + case NpadIdType::Player5: + return 4; + case NpadIdType::Player6: + return 5; + case NpadIdType::Player7: + return 6; + case NpadIdType::Player8: + return 7; + case NpadIdType::Other: + case NpadIdType::Handheld: + default: + return 0; + } +} + /// Converts an array index to a NpadIdType constexpr NpadIdType IndexToNpadIdType(size_t index) { 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() { // Initialize PID constants with default values SetPID(0.3f, 0.005f, 0.0f); SetGyroThreshold(ThresholdStandard); + ResetQuaternion(); + ResetRotations(); } void 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) { void MotionInput::SetAcceleration(const Common::Vec3f& acceleration) { accel = acceleration; + + accel.x = std::clamp(accel.x, -AccelMaxValue, AccelMaxValue); + accel.y = std::clamp(accel.y, -AccelMaxValue, AccelMaxValue); + accel.z = std::clamp(accel.z, -AccelMaxValue, AccelMaxValue); } void MotionInput::SetGyroscope(const Common::Vec3f& gyroscope) { gyro = gyroscope - gyro_bias; + gyro.x = std::clamp(gyro.x, -GyroMaxValue, GyroMaxValue); + gyro.y = std::clamp(gyro.y, -GyroMaxValue, GyroMaxValue); + gyro.z = std::clamp(gyro.z, -GyroMaxValue, GyroMaxValue); + // Auto adjust drift to minimize drift if (!IsMoving(IsAtRestRelaxed)) { gyro_bias = (gyro_bias * 0.9999f) + (gyroscope * 0.0001f); @@ -61,6 +71,10 @@ void MotionInput::ResetRotations() { rotations = {}; } +void MotionInput::ResetQuaternion() { + quat = {{0.0f, 0.0f, -1.0f}, 0.0f}; +} + bool MotionInput::IsMoving(f32 sensitivity) const { return gyro.Length() >= sensitivity || accel.Length() <= 0.9f || accel.Length() >= 1.1f; } 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: static constexpr float IsAtRestStandard = 0.01f; static constexpr float IsAtRestThight = 0.005f; + static constexpr float GyroMaxValue = 5.0f; + static constexpr float AccelMaxValue = 7.0f; + explicit MotionInput(); MotionInput(const MotionInput&) = default; @@ -40,6 +43,7 @@ public: void EnableReset(bool reset); void ResetRotations(); + void ResetQuaternion(); void UpdateRotation(u64 elapsed_time); void UpdateOrientation(u64 elapsed_time); @@ -69,7 +73,7 @@ private: Common::Vec3f derivative_error; // Quaternion containing the device orientation - Common::Quaternion<f32> quat{{0.0f, 0.0f, -1.0f}, 0.0f}; + Common::Quaternion<f32> quat; // Number of full rotations in each axis 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: {141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+ {142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+ {150, nullptr, "CreateAuthorizationRequest"}, + {160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"}, + {161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"}, }; // clang-format on @@ -136,7 +138,10 @@ public: {140, nullptr, "GetNetworkServiceLicenseCache"}, // 5.0.0+ {141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+ {142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+ + {143, nullptr, "GetNetworkServiceLicenseCacheEx"}, {150, nullptr, "CreateAuthorizationRequest"}, + {160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"}, + {161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"}, {200, nullptr, "IsRegistered"}, {201, nullptr, "RegisterAsync"}, {202, nullptr, "UnregisterAsync"}, @@ -242,6 +247,7 @@ public: {100, nullptr, "GetRequestWithTheme"}, {101, nullptr, "IsNetworkServiceAccountReplaced"}, {199, nullptr, "GetUrlForIntroductionOfExtraMembership"}, // 2.0.0 - 5.1.0 + {200, nullptr, "ApplyAsyncWithAuthorizedToken"}, }; // clang-format on @@ -647,9 +653,11 @@ public: {0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, {1, nullptr, "LoadAuthenticationTokenCache"}, {2, nullptr, "InvalidateAuthenticationTokenCache"}, + {3, nullptr, "IsDeviceAuthenticationTokenCacheAvailable"}, {10, nullptr, "EnsureEdgeTokenCacheAsync"}, {11, nullptr, "LoadEdgeTokenCache"}, {12, nullptr, "InvalidateEdgeTokenCache"}, + {13, nullptr, "IsEdgeTokenCacheAvailable"}, {20, nullptr, "EnsureApplicationAuthenticationCacheAsync"}, {21, nullptr, "LoadApplicationAuthenticationTokenCache"}, {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> {290, nullptr, "ProxyProcedureForGuestLoginWithNintendoAccount"}, {291, nullptr, "ProxyProcedureForFloatingRegistrationWithNintendoAccount"}, {299, nullptr, "SuspendBackgroundDaemon"}, + {900, nullptr, "SetUserUnqualifiedForDebug"}, + {901, nullptr, "UnsetUserUnqualifiedForDebug"}, + {902, nullptr, "ListUsersUnqualifiedForDebug"}, + {910, nullptr, "RefreshFirmwareSettingsForDebug"}, {997, nullptr, "DebugInvalidateTokenCacheForUser"}, {998, nullptr, "DebugSetUserStateClose"}, {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_) {30, nullptr, "RequestLaunchApplicationWithUserAndArgumentForDebug"}, {31, nullptr, "RequestLaunchApplicationByApplicationLaunchInfoForDebug"}, {40, nullptr, "GetAppletResourceUsageInfo"}, + {50, nullptr, "AddSystemProgramIdAndAppletIdForDebug"}, + {51, nullptr, "AddOperationConfirmedLibraryAppletIdForDebug"}, {100, nullptr, "SetCpuBoostModeForApplet"}, {101, nullptr, "CancelCpuBoostModeForApplet"}, {110, nullptr, "PushToAppletBoundChannelForDebug"}, @@ -237,6 +239,8 @@ IDebugFunctions::IDebugFunctions(Core::System& system_) {131, nullptr, "FriendInvitationClearApplicationParameter"}, {132, nullptr, "FriendInvitationPushApplicationParameter"}, {140, nullptr, "RestrictPowerOperationForSecureLaunchModeForDebug"}, + {200, nullptr, "CreateFloatingLibraryAppletAccepterForDebug"}, + {300, nullptr, "TerminateAllRunningApplicationsForDebug"}, {900, nullptr, "GetGrcProcessLaunchedSystemEvent"}, }; // clang-format on @@ -1855,6 +1859,8 @@ IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_) {31, nullptr, "GetWriterLockAccessorEx"}, {40, nullptr, "IsSleepEnabled"}, {41, nullptr, "IsRebootEnabled"}, + {50, nullptr, "LaunchSystemApplet"}, + {51, nullptr, "LaunchStarter"}, {100, nullptr, "PopRequestLaunchApplicationForDebug"}, {110, nullptr, "IsForceTerminateApplicationDisabledForDebug"}, {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_) {101, &AOC_U::CreatePermanentEcPurchasedEventManager, "CreatePermanentEcPurchasedEventManager"}, {110, nullptr, "CreateContentsServiceManager"}, {200, nullptr, "SetRequiredAddOnContentsOnContentsAvailabilityTransition"}, + {300, nullptr, "SetupHostAddOnContent"}, + {301, nullptr, "GetRegisteredAddOnContentPath"}, + {302, nullptr, "UpdateCachedList"}, }; // clang-format on 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"} { {5, &HwOpus::GetWorkBufferSizeEx, "GetWorkBufferSizeEx"}, {6, nullptr, "OpenHardwareOpusDecoderForMultiStreamEx"}, {7, &HwOpus::GetWorkBufferSizeForMultiStreamEx, "GetWorkBufferSizeForMultiStreamEx"}, + {8, nullptr, "GetWorkBufferSizeExEx"}, + {9, nullptr, "GetWorkBufferSizeForMultiStreamExEx"}, }; RegisterHandlers(functions); } 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) { } void Controller_Gesture::ReadTouchInput() { + if (!Settings::values.touchscreen.enabled) { + fingers = {}; + return; + } + const auto touch_status = console->GetTouch(); for (std::size_t id = 0; id < fingers.size(); ++id) { 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) { return; } + next_state = {}; + const auto& last_entry = shared_memory->mouse_lifo.ReadCurrentEntry().state; next_state.sampling_number = last_entry.sampling_number + 1; - next_state.attribute.raw = 0; if (Settings::values.mouse_enabled) { const auto& mouse_button_state = emulated_devices->GetMouseButtons(); 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 } if (!finger.pressed && current_touch.pressed) { + // Ignore all touch fingers if disabled + if (!Settings::values.touchscreen.enabled) { + continue; + } + finger.attribute.start_touch.Assign(1); finger.pressed = true; 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_, MakeControllerWithServiceContext<Controller_NPad>(HidController::NPad, shared_memory); MakeController<Controller_Gesture>(HidController::Gesture, shared_memory); MakeController<Controller_ConsoleSixAxis>(HidController::ConsoleSixAxisSensor, shared_memory); + MakeController<Controller_Stubbed>(HidController::DebugMouse, shared_memory); MakeControllerWithServiceContext<Controller_Palma>(HidController::Palma, shared_memory); // Homebrew doesn't try to activate some controllers, so we activate them by default @@ -74,6 +75,7 @@ IAppletResource::IAppletResource(Core::System& system_, GetController<Controller_Stubbed>(HidController::CaptureButton).SetCommonHeaderOffset(0x5000); GetController<Controller_Stubbed>(HidController::InputDetector).SetCommonHeaderOffset(0x5200); GetController<Controller_Stubbed>(HidController::UniquePad).SetCommonHeaderOffset(0x5A00); + GetController<Controller_Stubbed>(HidController::DebugMouse).SetCommonHeaderOffset(0x3DC00); // Register update callbacks npad_update_event = Core::Timing::CreateEvent( @@ -236,6 +238,7 @@ Hid::Hid(Core::System& system_) {1, &Hid::ActivateDebugPad, "ActivateDebugPad"}, {11, &Hid::ActivateTouchScreen, "ActivateTouchScreen"}, {21, &Hid::ActivateMouse, "ActivateMouse"}, + {26, nullptr, "ActivateDebugMouse"}, {31, &Hid::ActivateKeyboard, "ActivateKeyboard"}, {32, &Hid::SendKeyboardLockKeyEvent, "SendKeyboardLockKeyEvent"}, {40, nullptr, "AcquireXpadIdEventHandle"}, @@ -2380,6 +2383,8 @@ public: {20, nullptr, "DeactivateMouse"}, {21, nullptr, "SetMouseAutoPilotState"}, {22, nullptr, "UnsetMouseAutoPilotState"}, + {25, nullptr, "SetDebugMouseAutoPilotState"}, + {26, nullptr, "UnsetDebugMouseAutoPilotState"}, {30, nullptr, "DeactivateKeyboard"}, {31, nullptr, "SetKeyboardAutoPilotState"}, {32, nullptr, "UnsetKeyboardAutoPilotState"}, @@ -2495,6 +2500,7 @@ public: {2000, nullptr, "DeactivateDigitizer"}, {2001, nullptr, "SetDigitizerAutoPilotState"}, {2002, nullptr, "UnsetDigitizerAutoPilotState"}, + {2002, nullptr, "ReloadFirmwareDebugSettings"}, }; // clang-format on 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 { NPad, Gesture, ConsoleSixAxisSensor, + DebugMouse, Palma, 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 if (handle.abstracted_pad_id == device_handle.abstracted_pad_id && handle.internal_index == device_handle.internal_index && handle.player_number == device_handle.player_number && - handle.bus_type == device_handle.bus_type && + handle.bus_type_id == device_handle.bus_type_id && handle.is_valid == device_handle.is_valid) { return i; } @@ -123,7 +123,7 @@ void HidBus::GetBusHandle(Kernel::HLERequestContext& ctx) { continue; } if (static_cast<Core::HID::NpadIdType>(handle.player_number) == parameters.npad_id && - handle.bus_type == parameters.bus_type) { + handle.bus_type_id == static_cast<u8>(parameters.bus_type)) { is_handle_found = true; handle_index = i; break; @@ -140,7 +140,7 @@ void HidBus::GetBusHandle(Kernel::HLERequestContext& ctx) { .abstracted_pad_id = static_cast<u8>(i), .internal_index = static_cast<u8>(i), .player_number = static_cast<u8>(parameters.npad_id), - .bus_type = parameters.bus_type, + .bus_type_id = static_cast<u8>(parameters.bus_type), .is_valid = true, }; handle_index = i; @@ -172,7 +172,7 @@ void HidBus::IsExternalDeviceConnected(Kernel::HLERequestContext& ctx) { LOG_INFO(Service_HID, "Called, abstracted_pad_id={}, bus_type={}, internal_index={}, " "player_number={}, is_valid={}", - bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, + bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid); const auto device_index = GetDeviceIndexFromHandle(bus_handle_); @@ -201,7 +201,7 @@ void HidBus::Initialize(Kernel::HLERequestContext& ctx) { LOG_INFO(Service_HID, "called, abstracted_pad_id={} bus_type={} internal_index={} " "player_number={} is_valid={}, applet_resource_user_id={}", - bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, + bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid, applet_resource_user_id); is_hidbus_enabled = true; @@ -253,7 +253,7 @@ void HidBus::Finalize(Kernel::HLERequestContext& ctx) { LOG_INFO(Service_HID, "called, abstracted_pad_id={}, bus_type={}, internal_index={}, " "player_number={}, is_valid={}, applet_resource_user_id={}", - bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, + bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid, applet_resource_user_id); const auto device_index = GetDeviceIndexFromHandle(bus_handle_); @@ -301,7 +301,7 @@ void HidBus::EnableExternalDevice(Kernel::HLERequestContext& ctx) { "called, enable={}, abstracted_pad_id={}, bus_type={}, internal_index={}, " "player_number={}, is_valid={}, inval={}, applet_resource_user_id{}", parameters.enable, parameters.bus_handle.abstracted_pad_id, - parameters.bus_handle.bus_type, parameters.bus_handle.internal_index, + parameters.bus_handle.bus_type_id, parameters.bus_handle.internal_index, parameters.bus_handle.player_number, parameters.bus_handle.is_valid, parameters.inval, parameters.applet_resource_user_id); @@ -329,7 +329,7 @@ void HidBus::GetExternalDeviceId(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, " "is_valid={}", - bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, + bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid); const auto device_index = GetDeviceIndexFromHandle(bus_handle_); @@ -357,7 +357,7 @@ void HidBus::SendCommandAsync(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called, data_size={}, abstracted_pad_id={}, bus_type={}, internal_index={}, " "player_number={}, is_valid={}", - data.size(), bus_handle_.abstracted_pad_id, bus_handle_.bus_type, + data.size(), bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid); const auto device_index = GetDeviceIndexFromHandle(bus_handle_); @@ -384,7 +384,7 @@ void HidBus::GetSendCommandAsynceResult(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, " "is_valid={}", - bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, + bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid); const auto device_index = GetDeviceIndexFromHandle(bus_handle_); @@ -413,7 +413,7 @@ void HidBus::SetEventForSendCommandAsycResult(Kernel::HLERequestContext& ctx) { LOG_INFO(Service_HID, "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, " "is_valid={}", - bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, + bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid); const auto device_index = GetDeviceIndexFromHandle(bus_handle_); @@ -464,7 +464,7 @@ void HidBus::EnableJoyPollingReceiveMode(Kernel::HLERequestContext& ctx) { LOG_INFO(Service_HID, "called, t_mem_handle=0x{:08X}, polling_mode={}, abstracted_pad_id={}, bus_type={}, " "internal_index={}, player_number={}, is_valid={}", - t_mem_handle, polling_mode_, bus_handle_.abstracted_pad_id, bus_handle_.bus_type, + t_mem_handle, polling_mode_, bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid); const auto device_index = GetDeviceIndexFromHandle(bus_handle_); @@ -492,7 +492,7 @@ void HidBus::DisableJoyPollingReceiveMode(Kernel::HLERequestContext& ctx) { LOG_INFO(Service_HID, "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, " "is_valid={}", - bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, + bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid); 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: }; // This is nn::hidbus::BusType - enum class BusType : u8 { + enum class BusType : u32 { LeftJoyRail, RightJoyRail, InternalBus, // Lark microphone @@ -54,7 +54,7 @@ private: u32 abstracted_pad_id; u8 internal_index; u8 player_number; - BusType bus_type; + u8 bus_type_id; bool is_valid; }; 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: {12, nullptr, "InactivateContentMetaDatabase"}, {13, nullptr, "InvalidateRightsIdCache"}, {14, nullptr, "GetMemoryReport"}, + {15, nullptr, "ActivateFsContentStorage"}, }; // clang-format on 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_ {606, nullptr, "GetContentMetaStorage"}, {607, nullptr, "ListAvailableAddOnContent"}, {609, nullptr, "ListAvailabilityAssuredAddOnContent"}, + {610, nullptr, "GetInstalledContentMetaStorage"}, + {611, nullptr, "PrepareAddOnContent"}, {700, nullptr, "PushDownloadTaskList"}, {701, nullptr, "ClearTaskStatusList"}, {702, nullptr, "RequestDownloadTaskList"}, @@ -228,6 +230,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ {1900, nullptr, "IsActiveAccount"}, {1901, nullptr, "RequestDownloadApplicationPrepurchasedRights"}, {1902, nullptr, "GetApplicationTicketInfo"}, + {1903, nullptr, "RequestDownloadApplicationPrepurchasedRightsForAccount"}, {2000, nullptr, "GetSystemDeliveryInfo"}, {2001, nullptr, "SelectLatestSystemDeliveryInfo"}, {2002, nullptr, "VerifyDeliveryProtocolVersion"}, @@ -276,8 +279,11 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ {2352, nullptr, "RequestResolveNoDownloadRightsError"}, {2353, nullptr, "GetApplicationDownloadTaskInfo"}, {2354, nullptr, "PrioritizeApplicationBackgroundTask"}, - {2355, nullptr, "Unknown2355"}, - {2356, nullptr, "Unknown2356"}, + {2355, nullptr, "PreferStorageEfficientUpdate"}, + {2356, nullptr, "RequestStorageEfficientUpdatePreferable"}, + {2357, nullptr, "EnableMultiCoreDownload"}, + {2358, nullptr, "DisableMultiCoreDownload"}, + {2359, nullptr, "IsMultiCoreDownloadEnabled"}, {2400, nullptr, "GetPromotionInfo"}, {2401, nullptr, "CountPromotionInfo"}, {2402, nullptr, "ListPromotionInfo"}, @@ -295,6 +301,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ {2519, nullptr, "IsQualificationTransitionSupported"}, {2520, nullptr, "IsQualificationTransitionSupportedByProcessId"}, {2521, nullptr, "GetRightsUserChangedEvent"}, + {2522, nullptr, "IsRomRedirectionAvailable"}, {2800, nullptr, "GetApplicationIdOfPreomia"}, {3000, nullptr, "RegisterDeviceLockKey"}, {3001, nullptr, "UnregisterDeviceLockKey"}, @@ -311,6 +318,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ {3012, nullptr, "IsApplicationTitleHidden"}, {3013, nullptr, "IsGameCardEnabled"}, {3014, nullptr, "IsLocalContentShareEnabled"}, + {3050, nullptr, "ListAssignELicenseTaskResult"}, {9999, nullptr, "GetApplicationCertificate"}, }; // 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"} { {10, nullptr, "ClearArpEntries"}, {11, nullptr, "ClearArpEntries2"}, {12, nullptr, "PrintArpEntries"}, + {13, nullptr, "Unknown13"}, + {14, nullptr, "Unknown14"}, + {15, nullptr, "Unknown15"}, }; // clang-format on 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: {25, nullptr, "GetCipherInfo"}, {26, nullptr, "SetNextAlpnProto"}, {27, nullptr, "GetNextAlpnProto"}, + {28, nullptr, "SetDtlsSocketDescriptor"}, + {29, nullptr, "GetDtlsHandshakeTimeout"}, + {30, nullptr, "SetPrivateOption"}, + {31, nullptr, "SetSrtpCiphers"}, + {32, nullptr, "GetSrtpCipher"}, + {33, nullptr, "ExportKeyingMaterial"}, + {34, nullptr, "SetIoTimeout"}, + {35, nullptr, "GetIoTimeout"}, }; // clang-format on @@ -69,6 +77,8 @@ public: {9, nullptr, "AddPolicyOid"}, {10, nullptr, "ImportCrl"}, {11, nullptr, "RemoveCrl"}, + {12, nullptr, "ImportClientCertKeyPki"}, + {13, nullptr, "GeneratePrivateKeyAndCert"}, }; RegisterHandlers(functions); } 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: {2053, nullptr, "DestroyIndirectProducerEndPoint"}, {2054, nullptr, "CreateIndirectConsumerEndPoint"}, {2055, nullptr, "DestroyIndirectConsumerEndPoint"}, + {2060, nullptr, "CreateWatermarkCompositor"}, + {2062, nullptr, "SetWatermarkText"}, + {2063, nullptr, "SetWatermarkLayerStacks"}, {2300, nullptr, "AcquireLayerTexturePresentingEvent"}, {2301, nullptr, "ReleaseLayerTexturePresentingEvent"}, {2302, nullptr, "GetDisplayHotplugEvent"}, @@ -279,6 +282,8 @@ public: {6011, nullptr, "EnableLayerAutoClearTransitionBuffer"}, {6012, nullptr, "DisableLayerAutoClearTransitionBuffer"}, {6013, nullptr, "SetLayerOpacity"}, + {6014, nullptr, "AttachLayerWatermarkCompositor"}, + {6015, nullptr, "DetachLayerWatermarkCompositor"}, {7000, nullptr, "SetContentVisibility"}, {8000, nullptr, "SetConductorLayer"}, {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_, static const FunctionInfo functions[] = { {2, &VI_M::GetDisplayService, "GetDisplayService"}, {3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, + {100, nullptr, "PrepareFatal"}, + {101, nullptr, "ShowFatal"}, + {102, nullptr, "DrawFatalRectangle"}, + {103, nullptr, "DrawFatalText32"}, }; RegisterHandlers(functions); } 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 @@ #include "input_common/drivers/mouse.h" namespace InputCommon { +constexpr int update_time = 10; +constexpr float default_stick_sensitivity = 0.022f; +constexpr float default_motion_sensitivity = 0.008f; constexpr int mouse_axis_x = 0; constexpr int mouse_axis_y = 1; constexpr int wheel_axis_x = 2; constexpr int wheel_axis_y = 3; -constexpr int motion_wheel_y = 4; constexpr PadIdentifier identifier = { .guid = Common::UUID{}, .port = 0, .pad = 0, }; +constexpr PadIdentifier motion_identifier = { + .guid = Common::UUID{}, + .port = 0, + .pad = 1, +}; + constexpr PadIdentifier real_mouse_identifier = { .guid = Common::UUID{}, .port = 1, @@ -37,47 +45,87 @@ Mouse::Mouse(std::string input_engine_) : InputEngine(std::move(input_engine_)) PreSetController(identifier); PreSetController(real_mouse_identifier); PreSetController(touch_identifier); + PreSetController(motion_identifier); // Initialize all mouse axis PreSetAxis(identifier, mouse_axis_x); PreSetAxis(identifier, mouse_axis_y); PreSetAxis(identifier, wheel_axis_x); PreSetAxis(identifier, wheel_axis_y); - PreSetAxis(identifier, motion_wheel_y); PreSetAxis(real_mouse_identifier, mouse_axis_x); PreSetAxis(real_mouse_identifier, mouse_axis_y); PreSetAxis(touch_identifier, mouse_axis_x); PreSetAxis(touch_identifier, mouse_axis_y); + + // Initialize variables + mouse_origin = {}; + last_mouse_position = {}; + wheel_position = {}; + last_mouse_change = {}; + last_motion_change = {}; + update_thread = std::jthread([this](std::stop_token stop_token) { UpdateThread(stop_token); }); } void Mouse::UpdateThread(std::stop_token stop_token) { Common::SetCurrentThreadName("Mouse"); - constexpr int update_time = 10; - while (!stop_token.stop_requested()) { - if (Settings::values.mouse_panning) { - // Slow movement by 4% - last_mouse_change *= 0.96f; - const float sensitivity = - Settings::values.mouse_panning_sensitivity.GetValue() * 0.022f; - SetAxis(identifier, mouse_axis_x, last_mouse_change.x * sensitivity); - SetAxis(identifier, mouse_axis_y, -last_mouse_change.y * sensitivity); - } - SetAxis(identifier, motion_wheel_y, 0.0f); + while (!stop_token.stop_requested()) { + UpdateStickInput(); + UpdateMotionInput(); - if (mouse_panning_timout++ > 20) { + if (mouse_panning_timeout++ > 20) { StopPanning(); } std::this_thread::sleep_for(std::chrono::milliseconds(update_time)); } } +void Mouse::UpdateStickInput() { + if (!Settings::values.mouse_panning) { + return; + } + + const float sensitivity = + Settings::values.mouse_panning_sensitivity.GetValue() * default_stick_sensitivity; + + // Slow movement by 4% + last_mouse_change *= 0.96f; + SetAxis(identifier, mouse_axis_x, last_mouse_change.x * sensitivity); + SetAxis(identifier, mouse_axis_y, -last_mouse_change.y * sensitivity); +} + +void Mouse::UpdateMotionInput() { + const float sensitivity = + Settings::values.mouse_panning_sensitivity.GetValue() * default_motion_sensitivity; + + // Slow movement by 7% + if (Settings::values.mouse_panning) { + last_motion_change *= 0.93f; + } else { + last_motion_change.z *= 0.93f; + } + + const BasicMotion motion_data{ + .gyro_x = last_motion_change.x * sensitivity, + .gyro_y = last_motion_change.y * sensitivity, + .gyro_z = last_motion_change.z * sensitivity, + .accel_x = 0, + .accel_y = 0, + .accel_z = 0, + .delta_timestamp = update_time * 1000, + }; + + SetMotion(motion_identifier, 0, motion_data); +} + void Mouse::Move(int x, int y, int center_x, int center_y) { if (Settings::values.mouse_panning) { + mouse_panning_timeout = 0; + auto mouse_change = (Common::MakeVec(x, y) - Common::MakeVec(center_x, center_y)).Cast<float>(); - mouse_panning_timout = 0; + Common::Vec3<float> motion_change{-mouse_change.y, -mouse_change.x, last_motion_change.z}; const auto move_distance = mouse_change.Length(); if (move_distance == 0) { @@ -93,6 +141,7 @@ void Mouse::Move(int x, int y, int center_x, int center_y) { // Average mouse movements last_mouse_change = (last_mouse_change * 0.91f) + (mouse_change * 0.09f); + last_motion_change = (last_motion_change * 0.69f) + (motion_change * 0.31f); const auto last_move_distance = last_mouse_change.Length(); @@ -116,6 +165,12 @@ void Mouse::Move(int x, int y, int center_x, int center_y) { const float sensitivity = Settings::values.mouse_panning_sensitivity.GetValue() * 0.0012f; SetAxis(identifier, mouse_axis_x, static_cast<float>(mouse_move.x) * sensitivity); SetAxis(identifier, mouse_axis_y, static_cast<float>(-mouse_move.y) * sensitivity); + + last_motion_change = { + static_cast<float>(-mouse_move.y) / 50.0f, + static_cast<float>(-mouse_move.x) / 50.0f, + last_motion_change.z, + }; } } @@ -157,15 +212,19 @@ void Mouse::ReleaseButton(MouseButton button) { SetAxis(identifier, mouse_axis_x, 0); SetAxis(identifier, mouse_axis_y, 0); } + + last_motion_change.x = 0; + last_motion_change.y = 0; + button_pressed = false; } void Mouse::MouseWheelChange(int x, int y) { wheel_position.x += x; wheel_position.y += y; + last_motion_change.z += static_cast<f32>(y) / 100.0f; SetAxis(identifier, wheel_axis_x, static_cast<f32>(wheel_position.x)); SetAxis(identifier, wheel_axis_y, static_cast<f32>(wheel_position.y)); - SetAxis(identifier, motion_wheel_y, static_cast<f32>(y) / 100.0f); } void Mouse::ReleaseAllButtons() { @@ -234,6 +293,9 @@ Common::Input::ButtonNames Mouse::GetUIName(const Common::ParamPackage& params) if (params.Has("axis_x") && params.Has("axis_y") && params.Has("axis_z")) { return Common::Input::ButtonNames::Engine; } + if (params.Has("motion")) { + return Common::Input::ButtonNames::Engine; + } return Common::Input::ButtonNames::Invalid; } 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: private: void UpdateThread(std::stop_token stop_token); + void UpdateStickInput(); + void UpdateMotionInput(); void StopPanning(); Common::Input::ButtonNames GetUIButtonName(const Common::ParamPackage& params) const; @@ -103,9 +105,10 @@ private: Common::Vec2<int> mouse_origin; Common::Vec2<int> last_mouse_position; Common::Vec2<float> last_mouse_change; + Common::Vec3<float> last_motion_change; Common::Vec2<int> wheel_position; bool button_pressed; - int mouse_panning_timout{}; + int mouse_panning_timeout{}; std::jthread update_thread; }; 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) { new_input.Set("port", static_cast<int>(data.pad.port)); new_input.Set("pad", static_cast<int>(data.pad.pad)); - // If engine is mouse map the mouse position as 3 axis motion + // If engine is mouse map it automatically to mouse motion if (data.engine == "mouse") { - new_input.Set("axis_x", 1); - new_input.Set("invert_x", "-"); - new_input.Set("axis_y", 0); - new_input.Set("axis_z", 4); - new_input.Set("range", 1.0f); - new_input.Set("deadzone", 0.0f); + new_input.Set("motion", 0); + new_input.Set("pad", 1); input_queue.Push(new_input); return; } 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) const auto player_connected = player_groupboxes[player_index]->isChecked() && controller_type != Core::HID::NpadStyleIndex::Handheld; - if (controller->GetNpadStyleIndex(true) == controller_type && - controller->IsConnected(true) == player_connected) { - return; - } - // Disconnect the controller first. UpdateController(controller, controller_type, false); // Handheld if (player_index == 0) { + auto* handheld = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld); + UpdateController(handheld, controller_type, false); if (controller_type == Core::HID::NpadStyleIndex::Handheld) { - auto* handheld = - system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld); UpdateController(handheld, Core::HID::NpadStyleIndex::Handheld, player_groupboxes[player_index]->isChecked()); } 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) { } if (player_prefix.isEmpty() && Settings::IsConfiguringGlobal()) { - const auto controller = static_cast<Settings::ControllerType>( + player.controller_type = static_cast<Settings::ControllerType>( qt_config ->value(QStringLiteral("%1type").arg(player_prefix), static_cast<u8>(Settings::ControllerType::ProController)) .toUInt()); - - if (controller == Settings::ControllerType::LeftJoycon || - controller == Settings::ControllerType::RightJoycon) { - player.controller_type = controller; - } } else { player.connected = ReadSetting(QStringLiteral("%1connected").arg(player_prefix), player_index == 0) @@ -1313,9 +1308,7 @@ void Config::SaveRendererValues() { static_cast<u32>(Settings::values.renderer_backend.GetValue(global)), static_cast<u32>(Settings::values.renderer_backend.GetDefault()), Settings::values.renderer_backend.UsingGlobal()); - WriteSetting(QString::fromStdString(Settings::values.renderer_force_max_clock.GetLabel()), - static_cast<u32>(Settings::values.renderer_force_max_clock.GetValue(global)), - static_cast<u32>(Settings::values.renderer_force_max_clock.GetDefault())); + WriteGlobalSetting(Settings::values.renderer_force_max_clock); WriteGlobalSetting(Settings::values.vulkan_device); WriteSetting(QString::fromStdString(Settings::values.fullscreen_mode.GetLabel()), 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() { &Settings::values.max_anisotropy); ConfigurationShared::SetHighlight(ui->label_gpu_accuracy, !Settings::values.gpu_accuracy.UsingGlobal()); - ConfigurationShared::SetHighlight(ui->renderer_force_max_clock, - !Settings::values.renderer_force_max_clock.UsingGlobal()); ConfigurationShared::SetHighlight(ui->af_label, !Settings::values.max_anisotropy.UsingGlobal()); } 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() { } void ConfigureInputPerGame::LoadConfiguration() { - static constexpr size_t HANDHELD_INDEX = 8; + static constexpr size_t HANDHELD_INDEX = 0; auto& hid_core = system.HIDCore(); for (size_t player_index = 0; player_index < profile_comboboxes.size(); ++player_index) { @@ -69,9 +69,6 @@ void ConfigureInputPerGame::LoadConfiguration() { const auto selection_index = player_combobox->currentIndex(); if (selection_index == 0) { Settings::values.players.GetValue()[player_index].profile_name = ""; - if (player_index == 0) { - Settings::values.players.GetValue()[HANDHELD_INDEX] = {}; - } Settings::values.players.SetGlobal(true); emulated_controller->ReloadFromSettings(); 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() { } void ConfigureInputPlayer::SaveProfile() { - static constexpr size_t HANDHELD_INDEX = 8; const QString profile_name = ui->comboProfiles->itemText(ui->comboProfiles->currentIndex()); if (profile_name.isEmpty()) { @@ -1598,12 +1597,7 @@ void ConfigureInputPlayer::SaveProfile() { ApplyConfiguration(); - // When we're in handheld mode, only the handheld emulated controller bindings are updated - const bool is_handheld = player_index == 0 && emulated_controller->GetNpadIdType() == - Core::HID::NpadIdType::Handheld; - const auto profile_player_index = is_handheld ? HANDHELD_INDEX : player_index; - - if (!profiles->SaveProfile(profile_name.toStdString(), profile_player_index)) { + if (!profiles->SaveProfile(profile_name.toStdString(), player_index)) { QMessageBox::critical(this, tr("Save Input Profile"), tr("Failed to save the input profile \"%1\"").arg(profile_name)); UpdateInputProfiles(); |