summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar liamwhite2024-01-28 11:57:47 -0500
committerGravatar GitHub2024-01-28 11:57:47 -0500
commit820f1c8a166f4d3e27da4509f4c45706cdaf288e (patch)
treee4fb809322e24bf465f2b4da7b975b5c6071319f
parentMerge pull request #12802 from german77/mii_interface (diff)
parentservice: set: Increase settings version (diff)
downloadyuzu-820f1c8a166f4d3e27da4509f4c45706cdaf288e.tar.gz
yuzu-820f1c8a166f4d3e27da4509f4c45706cdaf288e.tar.xz
yuzu-820f1c8a166f4d3e27da4509f4c45706cdaf288e.zip
Merge pull request #12823 from german77/set-audio
service: set: Implement more Qlaunch Settings
-rw-r--r--src/core/hle/service/audio/audctl.cpp84
-rw-r--r--src/core/hle/service/audio/audctl.h20
-rw-r--r--src/core/hle/service/set/setting_formats/system_settings.cpp12
-rw-r--r--src/core/hle/service/set/setting_formats/system_settings.h12
-rw-r--r--src/core/hle/service/set/settings_types.h15
-rw-r--r--src/core/hle/service/set/system_settings_server.cpp246
-rw-r--r--src/core/hle/service/set/system_settings_server.h20
-rw-r--r--src/hid_core/resource_manager.cpp2
-rw-r--r--src/hid_core/resources/hid_firmware_settings.cpp3
9 files changed, 353 insertions, 61 deletions
diff --git a/src/core/hle/service/audio/audctl.cpp b/src/core/hle/service/audio/audctl.cpp
index 66dd64fd1..3101cf447 100644
--- a/src/core/hle/service/audio/audctl.cpp
+++ b/src/core/hle/service/audio/audctl.cpp
@@ -4,6 +4,8 @@
4#include "common/logging/log.h" 4#include "common/logging/log.h"
5#include "core/hle/service/audio/audctl.h" 5#include "core/hle/service/audio/audctl.h"
6#include "core/hle/service/ipc_helpers.h" 6#include "core/hle/service/ipc_helpers.h"
7#include "core/hle/service/set/system_settings_server.h"
8#include "core/hle/service/sm/sm.h"
7 9
8namespace Service::Audio { 10namespace Service::Audio {
9 11
@@ -19,15 +21,15 @@ AudCtl::AudCtl(Core::System& system_) : ServiceFramework{system_, "audctl"} {
19 {6, nullptr, "IsTargetConnected"}, 21 {6, nullptr, "IsTargetConnected"},
20 {7, nullptr, "SetDefaultTarget"}, 22 {7, nullptr, "SetDefaultTarget"},
21 {8, nullptr, "GetDefaultTarget"}, 23 {8, nullptr, "GetDefaultTarget"},
22 {9, nullptr, "GetAudioOutputMode"}, 24 {9, &AudCtl::GetAudioOutputMode, "GetAudioOutputMode"},
23 {10, nullptr, "SetAudioOutputMode"}, 25 {10, &AudCtl::SetAudioOutputMode, "SetAudioOutputMode"},
24 {11, nullptr, "SetForceMutePolicy"}, 26 {11, nullptr, "SetForceMutePolicy"},
25 {12, &AudCtl::GetForceMutePolicy, "GetForceMutePolicy"}, 27 {12, &AudCtl::GetForceMutePolicy, "GetForceMutePolicy"},
26 {13, &AudCtl::GetOutputModeSetting, "GetOutputModeSetting"}, 28 {13, &AudCtl::GetOutputModeSetting, "GetOutputModeSetting"},
27 {14, nullptr, "SetOutputModeSetting"}, 29 {14, &AudCtl::SetOutputModeSetting, "SetOutputModeSetting"},
28 {15, nullptr, "SetOutputTarget"}, 30 {15, nullptr, "SetOutputTarget"},
29 {16, nullptr, "SetInputTargetForceEnabled"}, 31 {16, nullptr, "SetInputTargetForceEnabled"},
30 {17, nullptr, "SetHeadphoneOutputLevelMode"}, 32 {17, &AudCtl::SetHeadphoneOutputLevelMode, "SetHeadphoneOutputLevelMode"},
31 {18, &AudCtl::GetHeadphoneOutputLevelMode, "GetHeadphoneOutputLevelMode"}, 33 {18, &AudCtl::GetHeadphoneOutputLevelMode, "GetHeadphoneOutputLevelMode"},
32 {19, nullptr, "AcquireAudioVolumeUpdateEventForPlayReport"}, 34 {19, nullptr, "AcquireAudioVolumeUpdateEventForPlayReport"},
33 {20, nullptr, "AcquireAudioOutputDeviceUpdateEventForPlayReport"}, 35 {20, nullptr, "AcquireAudioOutputDeviceUpdateEventForPlayReport"},
@@ -40,7 +42,7 @@ AudCtl::AudCtl(Core::System& system_) : ServiceFramework{system_, "audctl"} {
40 {27, nullptr, "SetVolumeMappingTableForDev"}, 42 {27, nullptr, "SetVolumeMappingTableForDev"},
41 {28, nullptr, "GetAudioOutputChannelCountForPlayReport"}, 43 {28, nullptr, "GetAudioOutputChannelCountForPlayReport"},
42 {29, nullptr, "BindAudioOutputChannelCountUpdateEventForPlayReport"}, 44 {29, nullptr, "BindAudioOutputChannelCountUpdateEventForPlayReport"},
43 {30, nullptr, "SetSpeakerAutoMuteEnabled"}, 45 {30, &AudCtl::SetSpeakerAutoMuteEnabled, "SetSpeakerAutoMuteEnabled"},
44 {31, &AudCtl::IsSpeakerAutoMuteEnabled, "IsSpeakerAutoMuteEnabled"}, 46 {31, &AudCtl::IsSpeakerAutoMuteEnabled, "IsSpeakerAutoMuteEnabled"},
45 {32, nullptr, "GetActiveOutputTarget"}, 47 {32, nullptr, "GetActiveOutputTarget"},
46 {33, nullptr, "GetTargetDeviceInfo"}, 48 {33, nullptr, "GetTargetDeviceInfo"},
@@ -68,6 +70,9 @@ AudCtl::AudCtl(Core::System& system_) : ServiceFramework{system_, "audctl"} {
68 // clang-format on 70 // clang-format on
69 71
70 RegisterHandlers(functions); 72 RegisterHandlers(functions);
73
74 m_set_sys =
75 system.ServiceManager().GetService<Service::Set::ISystemSettingsServer>("set:sys", true);
71} 76}
72 77
73AudCtl::~AudCtl() = default; 78AudCtl::~AudCtl() = default;
@@ -96,6 +101,33 @@ void AudCtl::GetTargetVolumeMax(HLERequestContext& ctx) {
96 rb.Push(target_max_volume); 101 rb.Push(target_max_volume);
97} 102}
98 103
104void AudCtl::GetAudioOutputMode(HLERequestContext& ctx) {
105 IPC::RequestParser rp{ctx};
106 const auto target{rp.PopEnum<Set::AudioOutputModeTarget>()};
107
108 Set::AudioOutputMode output_mode{};
109 const auto result = m_set_sys->GetAudioOutputMode(output_mode, target);
110
111 LOG_INFO(Service_SET, "called, target={}, output_mode={}", target, output_mode);
112
113 IPC::ResponseBuilder rb{ctx, 3};
114 rb.Push(result);
115 rb.PushEnum(output_mode);
116}
117
118void AudCtl::SetAudioOutputMode(HLERequestContext& ctx) {
119 IPC::RequestParser rp{ctx};
120 const auto target{rp.PopEnum<Set::AudioOutputModeTarget>()};
121 const auto output_mode{rp.PopEnum<Set::AudioOutputMode>()};
122
123 const auto result = m_set_sys->SetAudioOutputMode(target, output_mode);
124
125 LOG_INFO(Service_SET, "called, target={}, output_mode={}", target, output_mode);
126
127 IPC::ResponseBuilder rb{ctx, 2};
128 rb.Push(result);
129}
130
99void AudCtl::GetForceMutePolicy(HLERequestContext& ctx) { 131void AudCtl::GetForceMutePolicy(HLERequestContext& ctx) {
100 LOG_WARNING(Audio, "(STUBBED) called"); 132 LOG_WARNING(Audio, "(STUBBED) called");
101 133
@@ -106,13 +138,31 @@ void AudCtl::GetForceMutePolicy(HLERequestContext& ctx) {
106 138
107void AudCtl::GetOutputModeSetting(HLERequestContext& ctx) { 139void AudCtl::GetOutputModeSetting(HLERequestContext& ctx) {
108 IPC::RequestParser rp{ctx}; 140 IPC::RequestParser rp{ctx};
109 const auto value = rp.Pop<u32>(); 141 const auto target{rp.PopEnum<Set::AudioOutputModeTarget>()};
110 142
111 LOG_WARNING(Audio, "(STUBBED) called, value={}", value); 143 LOG_WARNING(Audio, "(STUBBED) called, target={}", target);
112 144
113 IPC::ResponseBuilder rb{ctx, 3}; 145 IPC::ResponseBuilder rb{ctx, 3};
114 rb.Push(ResultSuccess); 146 rb.Push(ResultSuccess);
115 rb.PushEnum(AudioOutputMode::PcmAuto); 147 rb.PushEnum(Set::AudioOutputMode::ch_7_1);
148}
149
150void AudCtl::SetOutputModeSetting(HLERequestContext& ctx) {
151 IPC::RequestParser rp{ctx};
152 const auto target{rp.PopEnum<Set::AudioOutputModeTarget>()};
153 const auto output_mode{rp.PopEnum<Set::AudioOutputMode>()};
154
155 LOG_INFO(Service_SET, "called, target={}, output_mode={}", target, output_mode);
156
157 IPC::ResponseBuilder rb{ctx, 2};
158 rb.Push(ResultSuccess);
159}
160
161void AudCtl::SetHeadphoneOutputLevelMode(HLERequestContext& ctx) {
162 LOG_WARNING(Audio, "(STUBBED) called");
163
164 IPC::ResponseBuilder rb{ctx, 2};
165 rb.Push(ResultSuccess);
116} 166}
117 167
118void AudCtl::GetHeadphoneOutputLevelMode(HLERequestContext& ctx) { 168void AudCtl::GetHeadphoneOutputLevelMode(HLERequestContext& ctx) {
@@ -123,14 +173,28 @@ void AudCtl::GetHeadphoneOutputLevelMode(HLERequestContext& ctx) {
123 rb.PushEnum(HeadphoneOutputLevelMode::Normal); 173 rb.PushEnum(HeadphoneOutputLevelMode::Normal);
124} 174}
125 175
176void AudCtl::SetSpeakerAutoMuteEnabled(HLERequestContext& ctx) {
177 IPC::RequestParser rp{ctx};
178 const auto is_speaker_auto_mute_enabled{rp.Pop<bool>()};
179
180 LOG_WARNING(Audio, "(STUBBED) called, is_speaker_auto_mute_enabled={}",
181 is_speaker_auto_mute_enabled);
182
183 const auto result = m_set_sys->SetSpeakerAutoMuteFlag(is_speaker_auto_mute_enabled);
184
185 IPC::ResponseBuilder rb{ctx, 2};
186 rb.Push(result);
187}
188
126void AudCtl::IsSpeakerAutoMuteEnabled(HLERequestContext& ctx) { 189void AudCtl::IsSpeakerAutoMuteEnabled(HLERequestContext& ctx) {
127 const bool is_speaker_auto_mute_enabled = false; 190 bool is_speaker_auto_mute_enabled{};
191 const auto result = m_set_sys->GetSpeakerAutoMuteFlag(is_speaker_auto_mute_enabled);
128 192
129 LOG_WARNING(Audio, "(STUBBED) called, is_speaker_auto_mute_enabled={}", 193 LOG_WARNING(Audio, "(STUBBED) called, is_speaker_auto_mute_enabled={}",
130 is_speaker_auto_mute_enabled); 194 is_speaker_auto_mute_enabled);
131 195
132 IPC::ResponseBuilder rb{ctx, 3}; 196 IPC::ResponseBuilder rb{ctx, 3};
133 rb.Push(ResultSuccess); 197 rb.Push(result);
134 rb.Push<u8>(is_speaker_auto_mute_enabled); 198 rb.Push<u8>(is_speaker_auto_mute_enabled);
135} 199}
136 200
diff --git a/src/core/hle/service/audio/audctl.h b/src/core/hle/service/audio/audctl.h
index d57abb383..4c90ead70 100644
--- a/src/core/hle/service/audio/audctl.h
+++ b/src/core/hle/service/audio/audctl.h
@@ -9,6 +9,10 @@ namespace Core {
9class System; 9class System;
10} 10}
11 11
12namespace Service::Set {
13class ISystemSettingsServer;
14}
15
12namespace Service::Audio { 16namespace Service::Audio {
13 17
14class AudCtl final : public ServiceFramework<AudCtl> { 18class AudCtl final : public ServiceFramework<AudCtl> {
@@ -17,14 +21,6 @@ public:
17 ~AudCtl() override; 21 ~AudCtl() override;
18 22
19private: 23private:
20 enum class AudioOutputMode {
21 Invalid,
22 Pcm1ch,
23 Pcm2ch,
24 Pcm6ch,
25 PcmAuto,
26 };
27
28 enum class ForceMutePolicy { 24 enum class ForceMutePolicy {
29 Disable, 25 Disable,
30 SpeakerMuteOnHeadphoneUnplugged, 26 SpeakerMuteOnHeadphoneUnplugged,
@@ -37,10 +33,18 @@ private:
37 33
38 void GetTargetVolumeMin(HLERequestContext& ctx); 34 void GetTargetVolumeMin(HLERequestContext& ctx);
39 void GetTargetVolumeMax(HLERequestContext& ctx); 35 void GetTargetVolumeMax(HLERequestContext& ctx);
36 void GetAudioOutputMode(HLERequestContext& ctx);
37 void SetAudioOutputMode(HLERequestContext& ctx);
40 void GetForceMutePolicy(HLERequestContext& ctx); 38 void GetForceMutePolicy(HLERequestContext& ctx);
41 void GetOutputModeSetting(HLERequestContext& ctx); 39 void GetOutputModeSetting(HLERequestContext& ctx);
40 void SetOutputModeSetting(HLERequestContext& ctx);
41 void SetHeadphoneOutputLevelMode(HLERequestContext& ctx);
42 void GetHeadphoneOutputLevelMode(HLERequestContext& ctx); 42 void GetHeadphoneOutputLevelMode(HLERequestContext& ctx);
43 void SetSpeakerAutoMuteEnabled(HLERequestContext& ctx);
43 void IsSpeakerAutoMuteEnabled(HLERequestContext& ctx); 44 void IsSpeakerAutoMuteEnabled(HLERequestContext& ctx);
45 void AcquireTargetNotification(HLERequestContext& ctx);
46
47 std::shared_ptr<Service::Set::ISystemSettingsServer> m_set_sys;
44}; 48};
45 49
46} // namespace Service::Audio 50} // namespace Service::Audio
diff --git a/src/core/hle/service/set/setting_formats/system_settings.cpp b/src/core/hle/service/set/setting_formats/system_settings.cpp
index 88a305f03..16ded43bf 100644
--- a/src/core/hle/service/set/setting_formats/system_settings.cpp
+++ b/src/core/hle/service/set/setting_formats/system_settings.cpp
@@ -1,6 +1,7 @@
1// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project 1// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "common/settings.h"
4#include "core/hle/service/set/setting_formats/system_settings.h" 5#include "core/hle/service/set/setting_formats/system_settings.h"
5 6
6namespace Service::Set { 7namespace Service::Set {
@@ -52,6 +53,17 @@ SystemSettings DefaultSystemSettings() {
52 settings.chinese_traditional_input_method = ChineseTraditionalInputMethod::Unknown0; 53 settings.chinese_traditional_input_method = ChineseTraditionalInputMethod::Unknown0;
53 settings.vibration_master_volume = 1.0f; 54 settings.vibration_master_volume = 1.0f;
54 55
56 const auto language_code =
57 available_language_codes[static_cast<s32>(::Settings::values.language_index.GetValue())];
58 const auto key_code =
59 std::find_if(language_to_layout.cbegin(), language_to_layout.cend(),
60 [=](const auto& element) { return element.first == language_code; });
61
62 settings.keyboard_layout = KeyboardLayout::EnglishUs;
63 if (key_code != language_to_layout.end()) {
64 settings.keyboard_layout = key_code->second;
65 }
66
55 return settings; 67 return settings;
56} 68}
57 69
diff --git a/src/core/hle/service/set/setting_formats/system_settings.h b/src/core/hle/service/set/setting_formats/system_settings.h
index af5929fa9..ebc373da5 100644
--- a/src/core/hle/service/set/setting_formats/system_settings.h
+++ b/src/core/hle/service/set/setting_formats/system_settings.h
@@ -213,10 +213,9 @@ struct SystemSettings {
213 // nn::settings::system::AudioVolume 213 // nn::settings::system::AudioVolume
214 std::array<u8, 0x8> audio_volume_type0; 214 std::array<u8, 0x8> audio_volume_type0;
215 std::array<u8, 0x8> audio_volume_type1; 215 std::array<u8, 0x8> audio_volume_type1;
216 // nn::settings::system::AudioOutputMode 216 AudioOutputMode audio_output_mode_hdmi;
217 s32 audio_output_mode_type0; 217 AudioOutputMode audio_output_mode_speaker;
218 s32 audio_output_mode_type1; 218 AudioOutputMode audio_output_mode_headphone;
219 s32 audio_output_mode_type2;
220 bool force_mute_on_headphone_removed; 219 bool force_mute_on_headphone_removed;
221 INSERT_PADDING_BYTES(0x3); 220 INSERT_PADDING_BYTES(0x3);
222 s32 headphone_volume_warning_count; 221 s32 headphone_volume_warning_count;
@@ -224,9 +223,8 @@ struct SystemSettings {
224 INSERT_PADDING_BYTES(0x3); 223 INSERT_PADDING_BYTES(0x3);
225 // nn::settings::system::AudioVolume 224 // nn::settings::system::AudioVolume
226 std::array<u8, 0x8> audio_volume_type2; 225 std::array<u8, 0x8> audio_volume_type2;
227 // nn::settings::system::AudioOutputMode 226 AudioOutputMode audio_output_mode_type3;
228 s32 audio_output_mode_type3; 227 AudioOutputMode audio_output_mode_type4;
229 s32 audio_output_mode_type4;
230 bool hearing_protection_safeguard_flag; 228 bool hearing_protection_safeguard_flag;
231 INSERT_PADDING_BYTES(0x3); 229 INSERT_PADDING_BYTES(0x3);
232 INSERT_PADDING_BYTES(0x4); // Reserved 230 INSERT_PADDING_BYTES(0x4); // Reserved
diff --git a/src/core/hle/service/set/settings_types.h b/src/core/hle/service/set/settings_types.h
index 968425319..ceb85b82a 100644
--- a/src/core/hle/service/set/settings_types.h
+++ b/src/core/hle/service/set/settings_types.h
@@ -23,9 +23,12 @@ enum class AudioOutputMode : u32 {
23 23
24/// This is nn::settings::system::AudioOutputModeTarget 24/// This is nn::settings::system::AudioOutputModeTarget
25enum class AudioOutputModeTarget : u32 { 25enum class AudioOutputModeTarget : u32 {
26 None,
26 Hdmi, 27 Hdmi,
27 Speaker, 28 Speaker,
28 Headphone, 29 Headphone,
30 Type3,
31 Type4,
29}; 32};
30 33
31/// This is nn::settings::system::AudioVolumeTarget 34/// This is nn::settings::system::AudioVolumeTarget
@@ -367,6 +370,12 @@ struct AccountNotificationSettings {
367static_assert(sizeof(AccountNotificationSettings) == 0x18, 370static_assert(sizeof(AccountNotificationSettings) == 0x18,
368 "AccountNotificationSettings is an invalid size"); 371 "AccountNotificationSettings is an invalid size");
369 372
373/// This is nn::settings::factory::BatteryLot
374struct BatteryLot {
375 std::array<char, 0x18> lot_number;
376};
377static_assert(sizeof(BatteryLot) == 0x18, "BatteryLot is an invalid size");
378
370/// This is nn::settings::system::EulaVersion 379/// This is nn::settings::system::EulaVersion
371struct EulaVersion { 380struct EulaVersion {
372 u32 version; 381 u32 version;
@@ -436,6 +445,12 @@ struct NotificationSettings {
436}; 445};
437static_assert(sizeof(NotificationSettings) == 0x18, "NotificationSettings is an invalid size"); 446static_assert(sizeof(NotificationSettings) == 0x18, "NotificationSettings is an invalid size");
438 447
448/// This is nn::settings::factory::SerialNumber
449struct SerialNumber {
450 std::array<char, 0x18> serial_number;
451};
452static_assert(sizeof(SerialNumber) == 0x18, "SerialNumber is an invalid size");
453
439/// This is nn::settings::system::SleepSettings 454/// This is nn::settings::system::SleepSettings
440struct SleepSettings { 455struct SleepSettings {
441 SleepFlag flags; 456 SleepFlag flags;
diff --git a/src/core/hle/service/set/system_settings_server.cpp b/src/core/hle/service/set/system_settings_server.cpp
index b80655d2f..100cb2db4 100644
--- a/src/core/hle/service/set/system_settings_server.cpp
+++ b/src/core/hle/service/set/system_settings_server.cpp
@@ -25,7 +25,7 @@
25namespace Service::Set { 25namespace Service::Set {
26 26
27namespace { 27namespace {
28constexpr u32 SETTINGS_VERSION{1u}; 28constexpr u32 SETTINGS_VERSION{2u};
29constexpr auto SETTINGS_MAGIC = Common::MakeMagic('y', 'u', 'z', 'u', '_', 's', 'e', 't'); 29constexpr auto SETTINGS_MAGIC = Common::MakeMagic('y', 'u', 'z', 'u', '_', 's', 'e', 't');
30struct SettingsHeader { 30struct SettingsHeader {
31 u64 magic; 31 u64 magic;
@@ -131,10 +131,10 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
131 {40, &ISystemSettingsServer::SetTvSettings, "SetTvSettings"}, 131 {40, &ISystemSettingsServer::SetTvSettings, "SetTvSettings"},
132 {41, nullptr, "GetEdid"}, 132 {41, nullptr, "GetEdid"},
133 {42, nullptr, "SetEdid"}, 133 {42, nullptr, "SetEdid"},
134 {43, nullptr, "GetAudioOutputMode"}, 134 {43, &ISystemSettingsServer::GetAudioOutputMode, "GetAudioOutputMode"},
135 {44, nullptr, "SetAudioOutputMode"}, 135 {44, &ISystemSettingsServer::SetAudioOutputMode, "SetAudioOutputMode"},
136 {45, &ISystemSettingsServer::IsForceMuteOnHeadphoneRemoved, "IsForceMuteOnHeadphoneRemoved"}, 136 {45, &ISystemSettingsServer::GetSpeakerAutoMuteFlag , "GetSpeakerAutoMuteFlag"},
137 {46, &ISystemSettingsServer::SetForceMuteOnHeadphoneRemoved, "SetForceMuteOnHeadphoneRemoved"}, 137 {46, &ISystemSettingsServer::SetSpeakerAutoMuteFlag , "SetSpeakerAutoMuteFlag"},
138 {47, &ISystemSettingsServer::GetQuestFlag, "GetQuestFlag"}, 138 {47, &ISystemSettingsServer::GetQuestFlag, "GetQuestFlag"},
139 {48, &ISystemSettingsServer::SetQuestFlag, "SetQuestFlag"}, 139 {48, &ISystemSettingsServer::SetQuestFlag, "SetQuestFlag"},
140 {49, nullptr, "GetDataDeletionSettings"}, 140 {49, nullptr, "GetDataDeletionSettings"},
@@ -155,8 +155,8 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
155 {64, &ISystemSettingsServer::SetPrimaryAlbumStorage, "SetPrimaryAlbumStorage"}, 155 {64, &ISystemSettingsServer::SetPrimaryAlbumStorage, "SetPrimaryAlbumStorage"},
156 {65, nullptr, "GetUsb30EnableFlag"}, 156 {65, nullptr, "GetUsb30EnableFlag"},
157 {66, nullptr, "SetUsb30EnableFlag"}, 157 {66, nullptr, "SetUsb30EnableFlag"},
158 {67, nullptr, "GetBatteryLot"}, 158 {67, &ISystemSettingsServer::GetBatteryLot, "GetBatteryLot"},
159 {68, nullptr, "GetSerialNumber"}, 159 {68, &ISystemSettingsServer::GetSerialNumber, "GetSerialNumber"},
160 {69, &ISystemSettingsServer::GetNfcEnableFlag, "GetNfcEnableFlag"}, 160 {69, &ISystemSettingsServer::GetNfcEnableFlag, "GetNfcEnableFlag"},
161 {70, &ISystemSettingsServer::SetNfcEnableFlag, "SetNfcEnableFlag"}, 161 {70, &ISystemSettingsServer::SetNfcEnableFlag, "SetNfcEnableFlag"},
162 {71, &ISystemSettingsServer::GetSleepSettings, "GetSleepSettings"}, 162 {71, &ISystemSettingsServer::GetSleepSettings, "GetSleepSettings"},
@@ -184,11 +184,11 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
184 {93, nullptr, "AcquireFatalDirtyFlagEventHandle"}, 184 {93, nullptr, "AcquireFatalDirtyFlagEventHandle"},
185 {94, nullptr, "GetFatalDirtyFlags"}, 185 {94, nullptr, "GetFatalDirtyFlags"},
186 {95, &ISystemSettingsServer::GetAutoUpdateEnableFlag, "GetAutoUpdateEnableFlag"}, 186 {95, &ISystemSettingsServer::GetAutoUpdateEnableFlag, "GetAutoUpdateEnableFlag"},
187 {96, nullptr, "SetAutoUpdateEnableFlag"}, 187 {96, &ISystemSettingsServer::SetAutoUpdateEnableFlag, "SetAutoUpdateEnableFlag"},
188 {97, nullptr, "GetNxControllerSettings"}, 188 {97, nullptr, "GetNxControllerSettings"},
189 {98, nullptr, "SetNxControllerSettings"}, 189 {98, nullptr, "SetNxControllerSettings"},
190 {99, &ISystemSettingsServer::GetBatteryPercentageFlag, "GetBatteryPercentageFlag"}, 190 {99, &ISystemSettingsServer::GetBatteryPercentageFlag, "GetBatteryPercentageFlag"},
191 {100, nullptr, "SetBatteryPercentageFlag"}, 191 {100, &ISystemSettingsServer::SetBatteryPercentageFlag, "SetBatteryPercentageFlag"},
192 {101, nullptr, "GetExternalRtcResetFlag"}, 192 {101, nullptr, "GetExternalRtcResetFlag"},
193 {102, nullptr, "SetExternalRtcResetFlag"}, 193 {102, nullptr, "SetExternalRtcResetFlag"},
194 {103, nullptr, "GetUsbFullKeyEnableFlag"}, 194 {103, nullptr, "GetUsbFullKeyEnableFlag"},
@@ -208,12 +208,12 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
208 {117, nullptr, "GetHeadphoneVolumeUpdateFlag"}, 208 {117, nullptr, "GetHeadphoneVolumeUpdateFlag"},
209 {118, nullptr, "SetHeadphoneVolumeUpdateFlag"}, 209 {118, nullptr, "SetHeadphoneVolumeUpdateFlag"},
210 {119, nullptr, "NeedsToUpdateHeadphoneVolume"}, 210 {119, nullptr, "NeedsToUpdateHeadphoneVolume"},
211 {120, nullptr, "GetPushNotificationActivityModeOnSleep"}, 211 {120, &ISystemSettingsServer::GetPushNotificationActivityModeOnSleep, "GetPushNotificationActivityModeOnSleep"},
212 {121, nullptr, "SetPushNotificationActivityModeOnSleep"}, 212 {121, &ISystemSettingsServer::SetPushNotificationActivityModeOnSleep, "SetPushNotificationActivityModeOnSleep"},
213 {122, nullptr, "GetServiceDiscoveryControlSettings"}, 213 {122, nullptr, "GetServiceDiscoveryControlSettings"},
214 {123, nullptr, "SetServiceDiscoveryControlSettings"}, 214 {123, nullptr, "SetServiceDiscoveryControlSettings"},
215 {124, &ISystemSettingsServer::GetErrorReportSharePermission, "GetErrorReportSharePermission"}, 215 {124, &ISystemSettingsServer::GetErrorReportSharePermission, "GetErrorReportSharePermission"},
216 {125, nullptr, "SetErrorReportSharePermission"}, 216 {125, &ISystemSettingsServer::SetErrorReportSharePermission, "SetErrorReportSharePermission"},
217 {126, &ISystemSettingsServer::GetAppletLaunchFlags, "GetAppletLaunchFlags"}, 217 {126, &ISystemSettingsServer::GetAppletLaunchFlags, "GetAppletLaunchFlags"},
218 {127, &ISystemSettingsServer::SetAppletLaunchFlags, "SetAppletLaunchFlags"}, 218 {127, &ISystemSettingsServer::SetAppletLaunchFlags, "SetAppletLaunchFlags"},
219 {128, nullptr, "GetConsoleSixAxisSensorAccelerationBias"}, 219 {128, nullptr, "GetConsoleSixAxisSensorAccelerationBias"},
@@ -225,7 +225,7 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
225 {134, nullptr, "GetConsoleSixAxisSensorAngularVelocityGain"}, 225 {134, nullptr, "GetConsoleSixAxisSensorAngularVelocityGain"},
226 {135, nullptr, "SetConsoleSixAxisSensorAngularVelocityGain"}, 226 {135, nullptr, "SetConsoleSixAxisSensorAngularVelocityGain"},
227 {136, &ISystemSettingsServer::GetKeyboardLayout, "GetKeyboardLayout"}, 227 {136, &ISystemSettingsServer::GetKeyboardLayout, "GetKeyboardLayout"},
228 {137, nullptr, "SetKeyboardLayout"}, 228 {137, &ISystemSettingsServer::SetKeyboardLayout, "SetKeyboardLayout"},
229 {138, nullptr, "GetWebInspectorFlag"}, 229 {138, nullptr, "GetWebInspectorFlag"},
230 {139, nullptr, "GetAllowedSslHosts"}, 230 {139, nullptr, "GetAllowedSslHosts"},
231 {140, nullptr, "GetHostFsMountPoint"}, 231 {140, nullptr, "GetHostFsMountPoint"},
@@ -291,8 +291,8 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
291 {200, nullptr, "SetButtonConfigRegisteredSettings"}, 291 {200, nullptr, "SetButtonConfigRegisteredSettings"},
292 {201, &ISystemSettingsServer::GetFieldTestingFlag, "GetFieldTestingFlag"}, 292 {201, &ISystemSettingsServer::GetFieldTestingFlag, "GetFieldTestingFlag"},
293 {202, nullptr, "SetFieldTestingFlag"}, 293 {202, nullptr, "SetFieldTestingFlag"},
294 {203, nullptr, "GetPanelCrcMode"}, 294 {203, &ISystemSettingsServer::GetPanelCrcMode, "GetPanelCrcMode"},
295 {204, nullptr, "SetPanelCrcMode"}, 295 {204, &ISystemSettingsServer::SetPanelCrcMode, "SetPanelCrcMode"},
296 {205, nullptr, "GetNxControllerSettingsEx"}, 296 {205, nullptr, "GetNxControllerSettingsEx"},
297 {206, nullptr, "SetNxControllerSettingsEx"}, 297 {206, nullptr, "SetNxControllerSettingsEx"},
298 {207, nullptr, "GetHearingProtectionSafeguardFlag"}, 298 {207, nullptr, "GetHearingProtectionSafeguardFlag"},
@@ -349,7 +349,7 @@ bool ISystemSettingsServer::LoadSettingsFile(std::filesystem::path& path, auto&&
349 } 349 }
350 SettingsHeader hdr{}; 350 SettingsHeader hdr{};
351 file.read(reinterpret_cast<char*>(&hdr), sizeof(hdr)); 351 file.read(reinterpret_cast<char*>(&hdr), sizeof(hdr));
352 return hdr.magic == SETTINGS_MAGIC && hdr.version == SETTINGS_VERSION; 352 return hdr.magic == SETTINGS_MAGIC && hdr.version >= SETTINGS_VERSION;
353 }; 353 };
354 354
355 if (!exists || !file_size_ok) { 355 if (!exists || !file_size_ok) {
@@ -390,7 +390,7 @@ bool ISystemSettingsServer::StoreSettingsFile(std::filesystem::path& path, auto&
390 } 390 }
391 391
392 auto settings_base = path / "settings"; 392 auto settings_base = path / "settings";
393 auto settings_tmp_file = settings_base; 393 std::filesystem::path settings_tmp_file = settings_base;
394 settings_tmp_file = settings_tmp_file.replace_extension("tmp"); 394 settings_tmp_file = settings_tmp_file.replace_extension("tmp");
395 std::ofstream file(settings_tmp_file, std::ios::binary | std::ios::out); 395 std::ofstream file(settings_tmp_file, std::ios::binary | std::ios::out);
396 if (!file.is_open()) { 396 if (!file.is_open()) {
@@ -817,7 +817,34 @@ void ISystemSettingsServer::SetTvSettings(HLERequestContext& ctx) {
817 rb.Push(ResultSuccess); 817 rb.Push(ResultSuccess);
818} 818}
819 819
820void ISystemSettingsServer::IsForceMuteOnHeadphoneRemoved(HLERequestContext& ctx) { 820void ISystemSettingsServer::GetAudioOutputMode(HLERequestContext& ctx) {
821 IPC::RequestParser rp{ctx};
822 const auto target{rp.PopEnum<AudioOutputModeTarget>()};
823
824 AudioOutputMode output_mode{};
825 const auto result = GetAudioOutputMode(output_mode, target);
826
827 LOG_INFO(Service_SET, "called, target={}, output_mode={}", target, output_mode);
828
829 IPC::ResponseBuilder rb{ctx, 3};
830 rb.Push(result);
831 rb.PushEnum(output_mode);
832}
833
834void ISystemSettingsServer::SetAudioOutputMode(HLERequestContext& ctx) {
835 IPC::RequestParser rp{ctx};
836 const auto target{rp.PopEnum<AudioOutputModeTarget>()};
837 const auto output_mode{rp.PopEnum<AudioOutputMode>()};
838
839 const auto result = SetAudioOutputMode(target, output_mode);
840
841 LOG_INFO(Service_SET, "called, target={}, output_mode={}", target, output_mode);
842
843 IPC::ResponseBuilder rb{ctx, 2};
844 rb.Push(result);
845}
846
847void ISystemSettingsServer::GetSpeakerAutoMuteFlag(HLERequestContext& ctx) {
821 LOG_INFO(Service_SET, "called, force_mute_on_headphone_removed={}", 848 LOG_INFO(Service_SET, "called, force_mute_on_headphone_removed={}",
822 m_system_settings.force_mute_on_headphone_removed); 849 m_system_settings.force_mute_on_headphone_removed);
823 850
@@ -826,7 +853,7 @@ void ISystemSettingsServer::IsForceMuteOnHeadphoneRemoved(HLERequestContext& ctx
826 rb.PushRaw(m_system_settings.force_mute_on_headphone_removed); 853 rb.PushRaw(m_system_settings.force_mute_on_headphone_removed);
827} 854}
828 855
829void ISystemSettingsServer::SetForceMuteOnHeadphoneRemoved(HLERequestContext& ctx) { 856void ISystemSettingsServer::SetSpeakerAutoMuteFlag(HLERequestContext& ctx) {
830 IPC::RequestParser rp{ctx}; 857 IPC::RequestParser rp{ctx};
831 m_system_settings.force_mute_on_headphone_removed = rp.PopRaw<bool>(); 858 m_system_settings.force_mute_on_headphone_removed = rp.PopRaw<bool>();
832 SetSaveNeeded(); 859 SetSaveNeeded();
@@ -969,6 +996,26 @@ void ISystemSettingsServer::SetPrimaryAlbumStorage(HLERequestContext& ctx) {
969 rb.Push(ResultSuccess); 996 rb.Push(ResultSuccess);
970} 997}
971 998
999void ISystemSettingsServer::GetBatteryLot(HLERequestContext& ctx) {
1000 BatteryLot battery_lot = {"YUZUEMULATOR123456789"};
1001
1002 LOG_INFO(Service_SET, "called");
1003
1004 IPC::ResponseBuilder rb{ctx, 8};
1005 rb.Push(ResultSuccess);
1006 rb.PushRaw(battery_lot);
1007}
1008
1009void ISystemSettingsServer::GetSerialNumber(HLERequestContext& ctx) {
1010 SerialNumber console_serial = {"YUZ10012345678"};
1011
1012 LOG_INFO(Service_SET, "called");
1013
1014 IPC::ResponseBuilder rb{ctx, 8};
1015 rb.Push(ResultSuccess);
1016 rb.PushRaw(console_serial);
1017}
1018
972void ISystemSettingsServer::GetNfcEnableFlag(HLERequestContext& ctx) { 1019void ISystemSettingsServer::GetNfcEnableFlag(HLERequestContext& ctx) {
973 LOG_INFO(Service_SET, "called, nfc_enable_flag={}", m_system_settings.nfc_enable_flag); 1020 LOG_INFO(Service_SET, "called, nfc_enable_flag={}", m_system_settings.nfc_enable_flag);
974 1021
@@ -1132,6 +1179,17 @@ void ISystemSettingsServer::GetAutoUpdateEnableFlag(HLERequestContext& ctx) {
1132 rb.Push(m_system_settings.auto_update_enable_flag); 1179 rb.Push(m_system_settings.auto_update_enable_flag);
1133} 1180}
1134 1181
1182void ISystemSettingsServer::SetAutoUpdateEnableFlag(HLERequestContext& ctx) {
1183 IPC::RequestParser rp{ctx};
1184 m_system_settings.auto_update_enable_flag = rp.Pop<bool>();
1185 SetSaveNeeded();
1186
1187 LOG_INFO(Service_SET, "called, auto_update_flag={}", m_system_settings.auto_update_enable_flag);
1188
1189 IPC::ResponseBuilder rb{ctx, 2};
1190 rb.Push(ResultSuccess);
1191}
1192
1135void ISystemSettingsServer::GetBatteryPercentageFlag(HLERequestContext& ctx) { 1193void ISystemSettingsServer::GetBatteryPercentageFlag(HLERequestContext& ctx) {
1136 LOG_DEBUG(Service_SET, "called, battery_percentage_flag={}", 1194 LOG_DEBUG(Service_SET, "called, battery_percentage_flag={}",
1137 m_system_settings.battery_percentage_flag); 1195 m_system_settings.battery_percentage_flag);
@@ -1141,6 +1199,18 @@ void ISystemSettingsServer::GetBatteryPercentageFlag(HLERequestContext& ctx) {
1141 rb.Push(m_system_settings.battery_percentage_flag); 1199 rb.Push(m_system_settings.battery_percentage_flag);
1142} 1200}
1143 1201
1202void ISystemSettingsServer::SetBatteryPercentageFlag(HLERequestContext& ctx) {
1203 IPC::RequestParser rp{ctx};
1204 m_system_settings.battery_percentage_flag = rp.Pop<bool>();
1205 SetSaveNeeded();
1206
1207 LOG_INFO(Service_SET, "called, battery_percentage_flag={}",
1208 m_system_settings.battery_percentage_flag);
1209
1210 IPC::ResponseBuilder rb{ctx, 2};
1211 rb.Push(ResultSuccess);
1212}
1213
1144void ISystemSettingsServer::SetExternalSteadyClockInternalOffset(HLERequestContext& ctx) { 1214void ISystemSettingsServer::SetExternalSteadyClockInternalOffset(HLERequestContext& ctx) {
1145 LOG_DEBUG(Service_SET, "called."); 1215 LOG_DEBUG(Service_SET, "called.");
1146 1216
@@ -1164,6 +1234,27 @@ void ISystemSettingsServer::GetExternalSteadyClockInternalOffset(HLERequestConte
1164 rb.Push(offset); 1234 rb.Push(offset);
1165} 1235}
1166 1236
1237void ISystemSettingsServer::GetPushNotificationActivityModeOnSleep(HLERequestContext& ctx) {
1238 LOG_INFO(Service_SET, "called, push_notification_activity_mode_on_sleep={}",
1239 m_system_settings.push_notification_activity_mode_on_sleep);
1240
1241 IPC::ResponseBuilder rb{ctx, 3};
1242 rb.Push(ResultSuccess);
1243 rb.Push(m_system_settings.push_notification_activity_mode_on_sleep);
1244}
1245
1246void ISystemSettingsServer::SetPushNotificationActivityModeOnSleep(HLERequestContext& ctx) {
1247 IPC::RequestParser rp{ctx};
1248 m_system_settings.push_notification_activity_mode_on_sleep = rp.Pop<s32>();
1249 SetSaveNeeded();
1250
1251 LOG_INFO(Service_SET, "called, push_notification_activity_mode_on_sleep={}",
1252 m_system_settings.push_notification_activity_mode_on_sleep);
1253
1254 IPC::ResponseBuilder rb{ctx, 2};
1255 rb.Push(ResultSuccess);
1256}
1257
1167void ISystemSettingsServer::GetErrorReportSharePermission(HLERequestContext& ctx) { 1258void ISystemSettingsServer::GetErrorReportSharePermission(HLERequestContext& ctx) {
1168 LOG_INFO(Service_SET, "called, error_report_share_permission={}", 1259 LOG_INFO(Service_SET, "called, error_report_share_permission={}",
1169 m_system_settings.error_report_share_permission); 1260 m_system_settings.error_report_share_permission);
@@ -1173,6 +1264,18 @@ void ISystemSettingsServer::GetErrorReportSharePermission(HLERequestContext& ctx
1173 rb.PushEnum(m_system_settings.error_report_share_permission); 1264 rb.PushEnum(m_system_settings.error_report_share_permission);
1174} 1265}
1175 1266
1267void ISystemSettingsServer::SetErrorReportSharePermission(HLERequestContext& ctx) {
1268 IPC::RequestParser rp{ctx};
1269 m_system_settings.error_report_share_permission = rp.PopEnum<ErrorReportSharePermission>();
1270 SetSaveNeeded();
1271
1272 LOG_INFO(Service_SET, "called, error_report_share_permission={}",
1273 m_system_settings.error_report_share_permission);
1274
1275 IPC::ResponseBuilder rb{ctx, 2};
1276 rb.Push(ResultSuccess);
1277}
1278
1176void ISystemSettingsServer::GetAppletLaunchFlags(HLERequestContext& ctx) { 1279void ISystemSettingsServer::GetAppletLaunchFlags(HLERequestContext& ctx) {
1177 LOG_INFO(Service_SET, "called, applet_launch_flag={}", m_system_settings.applet_launch_flag); 1280 LOG_INFO(Service_SET, "called, applet_launch_flag={}", m_system_settings.applet_launch_flag);
1178 1281
@@ -1193,22 +1296,22 @@ void ISystemSettingsServer::SetAppletLaunchFlags(HLERequestContext& ctx) {
1193} 1296}
1194 1297
1195void ISystemSettingsServer::GetKeyboardLayout(HLERequestContext& ctx) { 1298void ISystemSettingsServer::GetKeyboardLayout(HLERequestContext& ctx) {
1196 const auto language_code = 1299 LOG_INFO(Service_SET, "called, keyboard_layout={}", m_system_settings.keyboard_layout);
1197 available_language_codes[static_cast<s32>(::Settings::values.language_index.GetValue())];
1198 const auto key_code =
1199 std::find_if(language_to_layout.cbegin(), language_to_layout.cend(),
1200 [=](const auto& element) { return element.first == language_code; });
1201
1202 KeyboardLayout selected_keyboard_layout = KeyboardLayout::EnglishUs;
1203 if (key_code != language_to_layout.end()) {
1204 selected_keyboard_layout = key_code->second;
1205 }
1206
1207 LOG_INFO(Service_SET, "called, selected_keyboard_layout={}", selected_keyboard_layout);
1208 1300
1209 IPC::ResponseBuilder rb{ctx, 3}; 1301 IPC::ResponseBuilder rb{ctx, 3};
1210 rb.Push(ResultSuccess); 1302 rb.Push(ResultSuccess);
1211 rb.Push(static_cast<u32>(selected_keyboard_layout)); 1303 rb.Push(static_cast<u32>(m_system_settings.keyboard_layout));
1304}
1305
1306void ISystemSettingsServer::SetKeyboardLayout(HLERequestContext& ctx) {
1307 IPC::RequestParser rp{ctx};
1308 m_system_settings.keyboard_layout = rp.PopRaw<KeyboardLayout>();
1309 SetSaveNeeded();
1310
1311 LOG_INFO(Service_SET, "called, keyboard_layout={}", m_system_settings.keyboard_layout);
1312
1313 IPC::ResponseBuilder rb{ctx, 2};
1314 rb.Push(ResultSuccess);
1212} 1315}
1213 1316
1214void ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) { 1317void ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) {
@@ -1300,6 +1403,25 @@ void ISystemSettingsServer::GetFieldTestingFlag(HLERequestContext& ctx) {
1300 rb.Push(m_system_settings.field_testing_flag); 1403 rb.Push(m_system_settings.field_testing_flag);
1301} 1404}
1302 1405
1406void ISystemSettingsServer::GetPanelCrcMode(HLERequestContext& ctx) {
1407 LOG_INFO(Service_SET, "called, panel_crc_mode={}", m_system_settings.panel_crc_mode);
1408
1409 IPC::ResponseBuilder rb{ctx, 3};
1410 rb.Push(ResultSuccess);
1411 rb.Push(m_system_settings.panel_crc_mode);
1412}
1413
1414void ISystemSettingsServer::SetPanelCrcMode(HLERequestContext& ctx) {
1415 IPC::RequestParser rp{ctx};
1416 m_system_settings.panel_crc_mode = rp.PopRaw<s32>();
1417 SetSaveNeeded();
1418
1419 LOG_INFO(Service_SET, "called, panel_crc_mode={}", m_system_settings.panel_crc_mode);
1420
1421 IPC::ResponseBuilder rb{ctx, 2};
1422 rb.Push(ResultSuccess);
1423}
1424
1303void ISystemSettingsServer::SetupSettings() { 1425void ISystemSettingsServer::SetupSettings() {
1304 auto system_dir = 1426 auto system_dir =
1305 Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/8000000000000050"; 1427 Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/8000000000000050";
@@ -1390,6 +1512,66 @@ Result ISystemSettingsServer::SetVibrationMasterVolume(f32 volume) {
1390 R_SUCCEED(); 1512 R_SUCCEED();
1391} 1513}
1392 1514
1515Result ISystemSettingsServer::GetAudioOutputMode(AudioOutputMode& out_output_mode,
1516 AudioOutputModeTarget target) const {
1517 switch (target) {
1518 case AudioOutputModeTarget::Hdmi:
1519 out_output_mode = m_system_settings.audio_output_mode_hdmi;
1520 break;
1521 case AudioOutputModeTarget::Speaker:
1522 out_output_mode = m_system_settings.audio_output_mode_speaker;
1523 break;
1524 case AudioOutputModeTarget::Headphone:
1525 out_output_mode = m_system_settings.audio_output_mode_headphone;
1526 break;
1527 case AudioOutputModeTarget::Type3:
1528 out_output_mode = m_system_settings.audio_output_mode_type3;
1529 break;
1530 case AudioOutputModeTarget::Type4:
1531 out_output_mode = m_system_settings.audio_output_mode_type4;
1532 break;
1533 default:
1534 LOG_ERROR(Service_SET, "Invalid audio output mode target {}", target);
1535 }
1536 R_SUCCEED();
1537}
1538
1539Result ISystemSettingsServer::SetAudioOutputMode(AudioOutputModeTarget target,
1540 AudioOutputMode output_mode) {
1541 switch (target) {
1542 case AudioOutputModeTarget::Hdmi:
1543 m_system_settings.audio_output_mode_hdmi = output_mode;
1544 break;
1545 case AudioOutputModeTarget::Speaker:
1546 m_system_settings.audio_output_mode_speaker = output_mode;
1547 break;
1548 case AudioOutputModeTarget::Headphone:
1549 m_system_settings.audio_output_mode_headphone = output_mode;
1550 break;
1551 case AudioOutputModeTarget::Type3:
1552 m_system_settings.audio_output_mode_type3 = output_mode;
1553 break;
1554 case AudioOutputModeTarget::Type4:
1555 m_system_settings.audio_output_mode_type4 = output_mode;
1556 break;
1557 default:
1558 LOG_ERROR(Service_SET, "Invalid audio output mode target {}", target);
1559 }
1560 SetSaveNeeded();
1561 R_SUCCEED();
1562}
1563
1564Result ISystemSettingsServer::GetSpeakerAutoMuteFlag(bool& is_auto_mute) const {
1565 is_auto_mute = m_system_settings.force_mute_on_headphone_removed;
1566 R_SUCCEED();
1567}
1568
1569Result ISystemSettingsServer::SetSpeakerAutoMuteFlag(bool is_auto_mute) {
1570 m_system_settings.force_mute_on_headphone_removed = is_auto_mute;
1571 SetSaveNeeded();
1572 R_SUCCEED();
1573}
1574
1393Result ISystemSettingsServer::GetExternalSteadyClockSourceId(Common::UUID& out_id) const { 1575Result ISystemSettingsServer::GetExternalSteadyClockSourceId(Common::UUID& out_id) const {
1394 out_id = m_private_settings.external_clock_source_id; 1576 out_id = m_private_settings.external_clock_source_id;
1395 R_SUCCEED(); 1577 R_SUCCEED();
diff --git a/src/core/hle/service/set/system_settings_server.h b/src/core/hle/service/set/system_settings_server.h
index acbda8b8c..1982b9723 100644
--- a/src/core/hle/service/set/system_settings_server.h
+++ b/src/core/hle/service/set/system_settings_server.h
@@ -50,6 +50,10 @@ public:
50 50
51 Result GetVibrationMasterVolume(f32& out_volume) const; 51 Result GetVibrationMasterVolume(f32& out_volume) const;
52 Result SetVibrationMasterVolume(f32 volume); 52 Result SetVibrationMasterVolume(f32 volume);
53 Result GetAudioOutputMode(AudioOutputMode& out_output_mode, AudioOutputModeTarget target) const;
54 Result SetAudioOutputMode(AudioOutputModeTarget target, AudioOutputMode output_mode);
55 Result GetSpeakerAutoMuteFlag(bool& is_auto_mute) const;
56 Result SetSpeakerAutoMuteFlag(bool auto_mute);
53 Result GetExternalSteadyClockSourceId(Common::UUID& out_id) const; 57 Result GetExternalSteadyClockSourceId(Common::UUID& out_id) const;
54 Result SetExternalSteadyClockSourceId(const Common::UUID& id); 58 Result SetExternalSteadyClockSourceId(const Common::UUID& id);
55 Result GetUserSystemClockContext(Service::PSC::Time::SystemClockContext& out_context) const; 59 Result GetUserSystemClockContext(Service::PSC::Time::SystemClockContext& out_context) const;
@@ -97,8 +101,10 @@ private:
97 void GetSettingsItemValue(HLERequestContext& ctx); 101 void GetSettingsItemValue(HLERequestContext& ctx);
98 void GetTvSettings(HLERequestContext& ctx); 102 void GetTvSettings(HLERequestContext& ctx);
99 void SetTvSettings(HLERequestContext& ctx); 103 void SetTvSettings(HLERequestContext& ctx);
100 void IsForceMuteOnHeadphoneRemoved(HLERequestContext& ctx); 104 void GetAudioOutputMode(HLERequestContext& ctx);
101 void SetForceMuteOnHeadphoneRemoved(HLERequestContext& ctx); 105 void SetAudioOutputMode(HLERequestContext& ctx);
106 void GetSpeakerAutoMuteFlag(HLERequestContext& ctx);
107 void SetSpeakerAutoMuteFlag(HLERequestContext& ctx);
102 void GetDebugModeFlag(HLERequestContext& ctx); 108 void GetDebugModeFlag(HLERequestContext& ctx);
103 void GetQuestFlag(HLERequestContext& ctx); 109 void GetQuestFlag(HLERequestContext& ctx);
104 void SetQuestFlag(HLERequestContext& ctx); 110 void SetQuestFlag(HLERequestContext& ctx);
@@ -111,6 +117,8 @@ private:
111 void SetUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx); 117 void SetUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx);
112 void GetPrimaryAlbumStorage(HLERequestContext& ctx); 118 void GetPrimaryAlbumStorage(HLERequestContext& ctx);
113 void SetPrimaryAlbumStorage(HLERequestContext& ctx); 119 void SetPrimaryAlbumStorage(HLERequestContext& ctx);
120 void GetBatteryLot(HLERequestContext& ctx);
121 void GetSerialNumber(HLERequestContext& ctx);
114 void GetNfcEnableFlag(HLERequestContext& ctx); 122 void GetNfcEnableFlag(HLERequestContext& ctx);
115 void SetNfcEnableFlag(HLERequestContext& ctx); 123 void SetNfcEnableFlag(HLERequestContext& ctx);
116 void GetSleepSettings(HLERequestContext& ctx); 124 void GetSleepSettings(HLERequestContext& ctx);
@@ -126,13 +134,19 @@ private:
126 void SetBluetoothEnableFlag(HLERequestContext& ctx); 134 void SetBluetoothEnableFlag(HLERequestContext& ctx);
127 void GetMiiAuthorId(HLERequestContext& ctx); 135 void GetMiiAuthorId(HLERequestContext& ctx);
128 void GetAutoUpdateEnableFlag(HLERequestContext& ctx); 136 void GetAutoUpdateEnableFlag(HLERequestContext& ctx);
137 void SetAutoUpdateEnableFlag(HLERequestContext& ctx);
129 void GetBatteryPercentageFlag(HLERequestContext& ctx); 138 void GetBatteryPercentageFlag(HLERequestContext& ctx);
139 void SetBatteryPercentageFlag(HLERequestContext& ctx);
130 void SetExternalSteadyClockInternalOffset(HLERequestContext& ctx); 140 void SetExternalSteadyClockInternalOffset(HLERequestContext& ctx);
131 void GetExternalSteadyClockInternalOffset(HLERequestContext& ctx); 141 void GetExternalSteadyClockInternalOffset(HLERequestContext& ctx);
142 void GetPushNotificationActivityModeOnSleep(HLERequestContext& ctx);
143 void SetPushNotificationActivityModeOnSleep(HLERequestContext& ctx);
132 void GetErrorReportSharePermission(HLERequestContext& ctx); 144 void GetErrorReportSharePermission(HLERequestContext& ctx);
145 void SetErrorReportSharePermission(HLERequestContext& ctx);
133 void GetAppletLaunchFlags(HLERequestContext& ctx); 146 void GetAppletLaunchFlags(HLERequestContext& ctx);
134 void SetAppletLaunchFlags(HLERequestContext& ctx); 147 void SetAppletLaunchFlags(HLERequestContext& ctx);
135 void GetKeyboardLayout(HLERequestContext& ctx); 148 void GetKeyboardLayout(HLERequestContext& ctx);
149 void SetKeyboardLayout(HLERequestContext& ctx);
136 void GetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx); 150 void GetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx);
137 void SetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx); 151 void SetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx);
138 void GetUserSystemClockAutomaticCorrectionUpdatedTime(HLERequestContext& ctx); 152 void GetUserSystemClockAutomaticCorrectionUpdatedTime(HLERequestContext& ctx);
@@ -141,6 +155,8 @@ private:
141 void GetHomeMenuScheme(HLERequestContext& ctx); 155 void GetHomeMenuScheme(HLERequestContext& ctx);
142 void GetHomeMenuSchemeModel(HLERequestContext& ctx); 156 void GetHomeMenuSchemeModel(HLERequestContext& ctx);
143 void GetFieldTestingFlag(HLERequestContext& ctx); 157 void GetFieldTestingFlag(HLERequestContext& ctx);
158 void GetPanelCrcMode(HLERequestContext& ctx);
159 void SetPanelCrcMode(HLERequestContext& ctx);
144 160
145 bool LoadSettingsFile(std::filesystem::path& path, auto&& default_func); 161 bool LoadSettingsFile(std::filesystem::path& path, auto&& default_func);
146 bool StoreSettingsFile(std::filesystem::path& path, auto& settings); 162 bool StoreSettingsFile(std::filesystem::path& path, auto& settings);
diff --git a/src/hid_core/resource_manager.cpp b/src/hid_core/resource_manager.cpp
index a2295219a..e78665d31 100644
--- a/src/hid_core/resource_manager.cpp
+++ b/src/hid_core/resource_manager.cpp
@@ -184,7 +184,7 @@ void ResourceManager::InitializeHidCommonSampler() {
184 keyboard->SetAppletResource(applet_resource, &shared_mutex); 184 keyboard->SetAppletResource(applet_resource, &shared_mutex);
185 185
186 const auto settings = 186 const auto settings =
187 system.ServiceManager().GetService<Service::Set::ISystemSettingsServer>("set:sys"); 187 system.ServiceManager().GetService<Service::Set::ISystemSettingsServer>("set:sys", true);
188 npad->SetNpadExternals(applet_resource, &shared_mutex, handheld_config, settings); 188 npad->SetNpadExternals(applet_resource, &shared_mutex, handheld_config, settings);
189 189
190 six_axis->SetAppletResource(applet_resource, &shared_mutex); 190 six_axis->SetAppletResource(applet_resource, &shared_mutex);
diff --git a/src/hid_core/resources/hid_firmware_settings.cpp b/src/hid_core/resources/hid_firmware_settings.cpp
index 9c9019e8f..b32c0660a 100644
--- a/src/hid_core/resources/hid_firmware_settings.cpp
+++ b/src/hid_core/resources/hid_firmware_settings.cpp
@@ -8,7 +8,8 @@
8namespace Service::HID { 8namespace Service::HID {
9 9
10HidFirmwareSettings::HidFirmwareSettings(Core::System& system) { 10HidFirmwareSettings::HidFirmwareSettings(Core::System& system) {
11 m_set_sys = system.ServiceManager().GetService<Service::Set::ISystemSettingsServer>("set:sys"); 11 m_set_sys =
12 system.ServiceManager().GetService<Service::Set::ISystemSettingsServer>("set:sys", true);
12 LoadSettings(true); 13 LoadSettings(true);
13} 14}
14 15