diff options
Diffstat (limited to 'src/hid_core')
| -rw-r--r-- | src/hid_core/frontend/emulated_controller.cpp | 1 | ||||
| -rw-r--r-- | src/hid_core/resources/hid_firmware_settings.cpp | 35 | ||||
| -rw-r--r-- | src/hid_core/resources/hid_firmware_settings.h | 12 | ||||
| -rw-r--r-- | src/hid_core/resources/npad/npad.cpp | 7 |
4 files changed, 40 insertions, 15 deletions
diff --git a/src/hid_core/frontend/emulated_controller.cpp b/src/hid_core/frontend/emulated_controller.cpp index b6c48aba8..f2499502d 100644 --- a/src/hid_core/frontend/emulated_controller.cpp +++ b/src/hid_core/frontend/emulated_controller.cpp | |||
| @@ -110,6 +110,7 @@ void EmulatedController::ReloadFromSettings() { | |||
| 110 | original_npad_type = npad_type; | 110 | original_npad_type = npad_type; |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | SetPollingMode(EmulatedDeviceIndex::RightIndex, Common::Input::PollingMode::Active); | ||
| 113 | Disconnect(); | 114 | Disconnect(); |
| 114 | if (player.connected) { | 115 | if (player.connected) { |
| 115 | Connect(); | 116 | Connect(); |
diff --git a/src/hid_core/resources/hid_firmware_settings.cpp b/src/hid_core/resources/hid_firmware_settings.cpp index 9fa0db17e..00ceff7e6 100644 --- a/src/hid_core/resources/hid_firmware_settings.cpp +++ b/src/hid_core/resources/hid_firmware_settings.cpp | |||
| @@ -1,11 +1,14 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | 2 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 3 | 3 | ||
| 4 | #include "core/hle/service/set/system_settings_server.h" | ||
| 5 | #include "core/hle/service/sm/sm.h" | ||
| 4 | #include "hid_core/resources/hid_firmware_settings.h" | 6 | #include "hid_core/resources/hid_firmware_settings.h" |
| 5 | 7 | ||
| 6 | namespace Service::HID { | 8 | namespace Service::HID { |
| 7 | 9 | ||
| 8 | HidFirmwareSettings::HidFirmwareSettings() { | 10 | HidFirmwareSettings::HidFirmwareSettings(Core::System& system) { |
| 11 | m_set_sys = system.ServiceManager().GetService<Service::Set::ISystemSettingsServer>("set:sys"); | ||
| 9 | LoadSettings(true); | 12 | LoadSettings(true); |
| 10 | } | 13 | } |
| 11 | 14 | ||
| @@ -18,21 +21,25 @@ void HidFirmwareSettings::LoadSettings(bool reload_config) { | |||
| 18 | return; | 21 | return; |
| 19 | } | 22 | } |
| 20 | 23 | ||
| 21 | // TODO: Use nn::settings::fwdbg::GetSettingsItemValue to load config values | 24 | m_set_sys->GetSettingsItemValue<bool>(is_debug_pad_enabled, "hid_debug", "enables_debugpad"); |
| 22 | 25 | m_set_sys->GetSettingsItemValue<bool>(is_device_managed, "hid_debug", "manages_devices"); | |
| 23 | is_debug_pad_enabled = true; | 26 | m_set_sys->GetSettingsItemValue<bool>(is_touch_i2c_managed, "hid_debug", |
| 24 | is_device_managed = true; | 27 | "manages_touch_ic_i2c"); |
| 25 | is_touch_i2c_managed = is_device_managed; | 28 | m_set_sys->GetSettingsItemValue<bool>(is_future_devices_emulated, "hid_debug", |
| 26 | is_future_devices_emulated = false; | 29 | "emulate_future_device"); |
| 27 | is_mcu_hardware_error_emulated = false; | 30 | m_set_sys->GetSettingsItemValue<bool>(is_mcu_hardware_error_emulated, "hid_debug", |
| 28 | is_rail_enabled = true; | 31 | "emulate_mcu_hardware_error"); |
| 29 | is_firmware_update_failure_emulated = false; | 32 | m_set_sys->GetSettingsItemValue<bool>(is_rail_enabled, "hid_debug", "enables_rail"); |
| 33 | m_set_sys->GetSettingsItemValue<bool>(is_firmware_update_failure_emulated, "hid_debug", | ||
| 34 | "emulate_firmware_update_failure"); | ||
| 30 | is_firmware_update_failure = {}; | 35 | is_firmware_update_failure = {}; |
| 31 | is_ble_disabled = false; | 36 | m_set_sys->GetSettingsItemValue<bool>(is_ble_disabled, "hid_debug", "ble_disabled"); |
| 32 | is_dscale_disabled = false; | 37 | m_set_sys->GetSettingsItemValue<bool>(is_dscale_disabled, "hid_debug", "dscale_disabled"); |
| 33 | is_handheld_forced = true; | 38 | m_set_sys->GetSettingsItemValue<bool>(is_handheld_forced, "hid_debug", "force_handheld"); |
| 34 | features_per_id_disabled = {}; | 39 | features_per_id_disabled = {}; |
| 35 | is_touch_firmware_auto_update_disabled = false; | 40 | m_set_sys->GetSettingsItemValue<bool>(is_touch_firmware_auto_update_disabled, "hid_debug", |
| 41 | "touch_firmware_auto_update_disabled"); | ||
| 42 | |||
| 36 | is_initialized = true; | 43 | is_initialized = true; |
| 37 | } | 44 | } |
| 38 | 45 | ||
diff --git a/src/hid_core/resources/hid_firmware_settings.h b/src/hid_core/resources/hid_firmware_settings.h index 00201fd94..3694fa9a3 100644 --- a/src/hid_core/resources/hid_firmware_settings.h +++ b/src/hid_core/resources/hid_firmware_settings.h | |||
| @@ -5,6 +5,14 @@ | |||
| 5 | 5 | ||
| 6 | #include "common/common_types.h" | 6 | #include "common/common_types.h" |
| 7 | 7 | ||
| 8 | namespace Core { | ||
| 9 | class System; | ||
| 10 | } | ||
| 11 | |||
| 12 | namespace Service::Set { | ||
| 13 | class ISystemSettingsServer; | ||
| 14 | } | ||
| 15 | |||
| 8 | namespace Service::HID { | 16 | namespace Service::HID { |
| 9 | 17 | ||
| 10 | /// Loads firmware config from nn::settings::fwdbg | 18 | /// Loads firmware config from nn::settings::fwdbg |
| @@ -13,7 +21,7 @@ public: | |||
| 13 | using FirmwareSetting = std::array<u8, 4>; | 21 | using FirmwareSetting = std::array<u8, 4>; |
| 14 | using FeaturesPerId = std::array<bool, 0xA8>; | 22 | using FeaturesPerId = std::array<bool, 0xA8>; |
| 15 | 23 | ||
| 16 | HidFirmwareSettings(); | 24 | HidFirmwareSettings(Core::System& system); |
| 17 | 25 | ||
| 18 | void Reload(); | 26 | void Reload(); |
| 19 | void LoadSettings(bool reload_config); | 27 | void LoadSettings(bool reload_config); |
| @@ -49,6 +57,8 @@ private: | |||
| 49 | bool is_touch_firmware_auto_update_disabled{}; | 57 | bool is_touch_firmware_auto_update_disabled{}; |
| 50 | FirmwareSetting is_firmware_update_failure{}; | 58 | FirmwareSetting is_firmware_update_failure{}; |
| 51 | FeaturesPerId features_per_id_disabled{}; | 59 | FeaturesPerId features_per_id_disabled{}; |
| 60 | |||
| 61 | std::shared_ptr<Service::Set::ISystemSettingsServer> m_set_sys; | ||
| 52 | }; | 62 | }; |
| 53 | 63 | ||
| 54 | } // namespace Service::HID | 64 | } // namespace Service::HID |
diff --git a/src/hid_core/resources/npad/npad.cpp b/src/hid_core/resources/npad/npad.cpp index 310fa8ba7..212f01429 100644 --- a/src/hid_core/resources/npad/npad.cpp +++ b/src/hid_core/resources/npad/npad.cpp | |||
| @@ -1064,6 +1064,13 @@ Result NPad::RegisterAppletResourceUserId(u64 aruid) { | |||
| 1064 | } | 1064 | } |
| 1065 | 1065 | ||
| 1066 | void NPad::UnregisterAppletResourceUserId(u64 aruid) { | 1066 | void NPad::UnregisterAppletResourceUserId(u64 aruid) { |
| 1067 | // TODO: Remove this once abstract pad is emulated properly | ||
| 1068 | const auto aruid_index = npad_resource.GetIndexFromAruid(aruid); | ||
| 1069 | for (auto& controller : controller_data[aruid_index]) { | ||
| 1070 | controller.is_connected = false; | ||
| 1071 | controller.shared_memory = nullptr; | ||
| 1072 | } | ||
| 1073 | |||
| 1067 | npad_resource.UnregisterAppletResourceUserId(aruid); | 1074 | npad_resource.UnregisterAppletResourceUserId(aruid); |
| 1068 | } | 1075 | } |
| 1069 | 1076 | ||