aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xREADME.md2
-rwxr-xr-xsrc/core/hle/service/audio/audctl.cpp4
-rwxr-xr-xsrc/core/hle/service/glue/time/manager.cpp43
-rwxr-xr-xsrc/core/hle/service/glue/time/static.cpp17
-rwxr-xr-xsrc/core/hle/service/glue/time/worker.cpp2
-rwxr-xr-xsrc/core/hle/service/mii/mii.cpp9
-rwxr-xr-xsrc/core/hle/service/set/setting_formats/system_settings.h4
-rwxr-xr-xsrc/core/hle/service/set/settings_types.h7
-rwxr-xr-xsrc/core/hle/service/set/system_settings_server.cpp1394
-rwxr-xr-xsrc/core/hle/service/set/system_settings_server.h208
-rwxr-xr-xsrc/hid_core/resources/hid_firmware_settings.cpp37
-rwxr-xr-xsrc/hid_core/resources/npad/npad_vibration.cpp6
-rwxr-xr-xsrc/hid_core/resources/touch_screen/touch_screen_resource.cpp2
13 files changed, 686 insertions, 1049 deletions
diff --git a/README.md b/README.md
index 2380e0551..161a5081f 100755
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
1yuzu emulator early access 1yuzu emulator early access
2============= 2=============
3 3
4This is the source code for early-access 4139. 4This is the source code for early-access 4140.
5 5
6## Legal Notice 6## Legal Notice
7 7
diff --git a/src/core/hle/service/audio/audctl.cpp b/src/core/hle/service/audio/audctl.cpp
index ea8e6ca63..8649efdd5 100755
--- a/src/core/hle/service/audio/audctl.cpp
+++ b/src/core/hle/service/audio/audctl.cpp
@@ -106,7 +106,7 @@ void AudCtl::GetAudioOutputMode(HLERequestContext& ctx) {
106 const auto target{rp.PopEnum<Set::AudioOutputModeTarget>()}; 106 const auto target{rp.PopEnum<Set::AudioOutputModeTarget>()};
107 107
108 Set::AudioOutputMode output_mode{}; 108 Set::AudioOutputMode output_mode{};
109 const auto result = m_set_sys->GetAudioOutputMode(output_mode, target); 109 const auto result = m_set_sys->GetAudioOutputMode(&output_mode, target);
110 110
111 LOG_INFO(Service_SET, "called, target={}, output_mode={}", target, output_mode); 111 LOG_INFO(Service_SET, "called, target={}, output_mode={}", target, output_mode);
112 112
@@ -188,7 +188,7 @@ void AudCtl::SetSpeakerAutoMuteEnabled(HLERequestContext& ctx) {
188 188
189void AudCtl::IsSpeakerAutoMuteEnabled(HLERequestContext& ctx) { 189void AudCtl::IsSpeakerAutoMuteEnabled(HLERequestContext& ctx) {
190 bool is_speaker_auto_mute_enabled{}; 190 bool is_speaker_auto_mute_enabled{};
191 const auto result = m_set_sys->GetSpeakerAutoMuteFlag(is_speaker_auto_mute_enabled); 191 const auto result = m_set_sys->GetSpeakerAutoMuteFlag(&is_speaker_auto_mute_enabled);
192 192
193 LOG_WARNING(Audio, "(STUBBED) called, is_speaker_auto_mute_enabled={}", 193 LOG_WARNING(Audio, "(STUBBED) called, is_speaker_auto_mute_enabled={}",
194 is_speaker_auto_mute_enabled); 194 is_speaker_auto_mute_enabled);
diff --git a/src/core/hle/service/glue/time/manager.cpp b/src/core/hle/service/glue/time/manager.cpp
index 0c27e8029..cad755fa7 100755
--- a/src/core/hle/service/glue/time/manager.cpp
+++ b/src/core/hle/service/glue/time/manager.cpp
@@ -21,19 +21,6 @@
21 21
22namespace Service::Glue::Time { 22namespace Service::Glue::Time {
23namespace { 23namespace {
24
25template <typename T>
26T GetSettingsItemValue(std::shared_ptr<Service::Set::ISystemSettingsServer>& set_sys,
27 const char* category, const char* name) {
28 std::vector<u8> interval_buf;
29 auto res = set_sys->GetSettingsItemValue(interval_buf, category, name);
30 ASSERT(res == ResultSuccess);
31
32 T v{};
33 std::memcpy(&v, interval_buf.data(), sizeof(T));
34 return v;
35}
36
37s64 CalendarTimeToEpoch(Service::PSC::Time::CalendarTime calendar) { 24s64 CalendarTimeToEpoch(Service::PSC::Time::CalendarTime calendar) {
38 constexpr auto is_leap = [](s32 year) -> bool { 25 constexpr auto is_leap = [](s32 year) -> bool {
39 return (((year) % 4) == 0 && (((year) % 100) != 0 || ((year) % 400) == 0)); 26 return (((year) % 4) == 0 && (((year) % 100) != 0 || ((year) % 400) == 0));
@@ -65,13 +52,15 @@ s64 CalendarTimeToEpoch(Service::PSC::Time::CalendarTime calendar) {
65 52
66s64 GetEpochTimeFromInitialYear(std::shared_ptr<Service::Set::ISystemSettingsServer>& set_sys) { 53s64 GetEpochTimeFromInitialYear(std::shared_ptr<Service::Set::ISystemSettingsServer>& set_sys) {
67 Service::PSC::Time::CalendarTime calendar{ 54 Service::PSC::Time::CalendarTime calendar{
68 .year = GetSettingsItemValue<s16>(set_sys, "time", "standard_user_clock_initial_year"), 55 .year = 2000,
69 .month = 1, 56 .month = 1,
70 .day = 1, 57 .day = 1,
71 .hour = 0, 58 .hour = 0,
72 .minute = 0, 59 .minute = 0,
73 .second = 0, 60 .second = 0,
74 }; 61 };
62 set_sys->GetSettingsItemValueImpl<s16>(calendar.year, "time",
63 "standard_user_clock_initial_year");
75 return CalendarTimeToEpoch(calendar); 64 return CalendarTimeToEpoch(calendar);
76} 65}
77 66
@@ -124,7 +113,7 @@ TimeManager::TimeManager(Core::System& system)
124 ASSERT(res == ResultSuccess); 113 ASSERT(res == ResultSuccess);
125 114
126 Service::PSC::Time::SystemClockContext user_clock_context{}; 115 Service::PSC::Time::SystemClockContext user_clock_context{};
127 res = m_set_sys->GetUserSystemClockContext(user_clock_context); 116 res = m_set_sys->GetUserSystemClockContext(&user_clock_context);
128 ASSERT(res == ResultSuccess); 117 ASSERT(res == ResultSuccess);
129 118
130 // TODO the local clock should initialise with this epoch time, and be updated somewhere else on 119 // TODO the local clock should initialise with this epoch time, and be updated somewhere else on
@@ -140,11 +129,12 @@ TimeManager::TimeManager(Core::System& system)
140 ASSERT(res == ResultSuccess); 129 ASSERT(res == ResultSuccess);
141 130
142 Service::PSC::Time::SystemClockContext network_clock_context{}; 131 Service::PSC::Time::SystemClockContext network_clock_context{};
143 res = m_set_sys->GetNetworkSystemClockContext(network_clock_context); 132 res = m_set_sys->GetNetworkSystemClockContext(&network_clock_context);
144 ASSERT(res == ResultSuccess); 133 ASSERT(res == ResultSuccess);
145 134
146 auto network_accuracy_m{GetSettingsItemValue<s32>( 135 s32 network_accuracy_m{};
147 m_set_sys, "time", "standard_network_clock_sufficient_accuracy_minutes")}; 136 m_set_sys->GetSettingsItemValueImpl<s32>(network_accuracy_m, "time",
137 "standard_network_clock_sufficient_accuracy_minutes");
148 auto one_minute_ns{ 138 auto one_minute_ns{
149 std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::minutes(1)).count()}; 139 std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::minutes(1)).count()};
150 s64 network_accuracy_ns{network_accuracy_m * one_minute_ns}; 140 s64 network_accuracy_ns{network_accuracy_m * one_minute_ns};
@@ -153,12 +143,12 @@ TimeManager::TimeManager(Core::System& system)
153 ASSERT(res == ResultSuccess); 143 ASSERT(res == ResultSuccess);
154 144
155 bool is_automatic_correction_enabled{}; 145 bool is_automatic_correction_enabled{};
156 res = m_set_sys->IsUserSystemClockAutomaticCorrectionEnabled(is_automatic_correction_enabled); 146 res = m_set_sys->IsUserSystemClockAutomaticCorrectionEnabled(&is_automatic_correction_enabled);
157 ASSERT(res == ResultSuccess); 147 ASSERT(res == ResultSuccess);
158 148
159 Service::PSC::Time::SteadyClockTimePoint automatic_correction_time_point{}; 149 Service::PSC::Time::SteadyClockTimePoint automatic_correction_time_point{};
160 res = m_set_sys->GetUserSystemClockAutomaticCorrectionUpdatedTime( 150 res = m_set_sys->GetUserSystemClockAutomaticCorrectionUpdatedTime(
161 automatic_correction_time_point); 151 &automatic_correction_time_point);
162 ASSERT(res == ResultSuccess); 152 ASSERT(res == ResultSuccess);
163 153
164 res = m_time_m->SetupStandardUserSystemClockCore(is_automatic_correction_enabled, 154 res = m_time_m->SetupStandardUserSystemClockCore(is_automatic_correction_enabled,
@@ -198,11 +188,11 @@ TimeManager::TimeManager(Core::System& system)
198 188
199Result TimeManager::SetupStandardSteadyClockCore() { 189Result TimeManager::SetupStandardSteadyClockCore() {
200 Common::UUID external_clock_source_id{}; 190 Common::UUID external_clock_source_id{};
201 auto res = m_set_sys->GetExternalSteadyClockSourceId(external_clock_source_id); 191 auto res = m_set_sys->GetExternalSteadyClockSourceId(&external_clock_source_id);
202 ASSERT(res == ResultSuccess); 192 ASSERT(res == ResultSuccess);
203 193
204 s64 external_steady_clock_internal_offset_s{}; 194 s64 external_steady_clock_internal_offset_s{};
205 res = m_set_sys->GetExternalSteadyClockInternalOffset(external_steady_clock_internal_offset_s); 195 res = m_set_sys->GetExternalSteadyClockInternalOffset(&external_steady_clock_internal_offset_s);
206 ASSERT(res == ResultSuccess); 196 ASSERT(res == ResultSuccess);
207 197
208 auto one_second_ns{ 198 auto one_second_ns{
@@ -210,8 +200,9 @@ Result TimeManager::SetupStandardSteadyClockCore() {
210 s64 external_steady_clock_internal_offset_ns{external_steady_clock_internal_offset_s * 200 s64 external_steady_clock_internal_offset_ns{external_steady_clock_internal_offset_s *
211 one_second_ns}; 201 one_second_ns};
212 202
213 s32 standard_steady_clock_test_offset_m{ 203 s32 standard_steady_clock_test_offset_m{};
214 GetSettingsItemValue<s32>(m_set_sys, "time", "standard_steady_clock_test_offset_minutes")}; 204 m_set_sys->GetSettingsItemValueImpl<s32>(standard_steady_clock_test_offset_m, "time",
205 "standard_steady_clock_test_offset_minutes");
215 auto one_minute_ns{ 206 auto one_minute_ns{
216 std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::minutes(1)).count()}; 207 std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::minutes(1)).count()};
217 s64 standard_steady_clock_test_offset_ns{standard_steady_clock_test_offset_m * one_minute_ns}; 208 s64 standard_steady_clock_test_offset_ns{standard_steady_clock_test_offset_m * one_minute_ns};
@@ -237,7 +228,7 @@ Result TimeManager::SetupStandardSteadyClockCore() {
237 228
238Result TimeManager::SetupTimeZoneServiceCore() { 229Result TimeManager::SetupTimeZoneServiceCore() {
239 Service::PSC::Time::LocationName name{}; 230 Service::PSC::Time::LocationName name{};
240 auto res = m_set_sys->GetDeviceTimeZoneLocationName(name); 231 auto res = m_set_sys->GetDeviceTimeZoneLocationName(&name);
241 ASSERT(res == ResultSuccess); 232 ASSERT(res == ResultSuccess);
242 233
243 auto configured_zone = GetTimeZoneString(name); 234 auto configured_zone = GetTimeZoneString(name);
@@ -255,7 +246,7 @@ Result TimeManager::SetupTimeZoneServiceCore() {
255 } 246 }
256 247
257 Service::PSC::Time::SteadyClockTimePoint time_point{}; 248 Service::PSC::Time::SteadyClockTimePoint time_point{};
258 res = m_set_sys->GetDeviceTimeZoneLocationUpdatedTime(time_point); 249 res = m_set_sys->GetDeviceTimeZoneLocationUpdatedTime(&time_point);
259 ASSERT(res == ResultSuccess); 250 ASSERT(res == ResultSuccess);
260 251
261 auto location_count = GetTimeZoneCount(); 252 auto location_count = GetTimeZoneCount();
diff --git a/src/core/hle/service/glue/time/static.cpp b/src/core/hle/service/glue/time/static.cpp
index f8c1218f3..ec9b0efb1 100755
--- a/src/core/hle/service/glue/time/static.cpp
+++ b/src/core/hle/service/glue/time/static.cpp
@@ -20,19 +20,6 @@
20#include "core/hle/service/sm/sm.h" 20#include "core/hle/service/sm/sm.h"
21 21
22namespace Service::Glue::Time { 22namespace Service::Glue::Time {
23namespace {
24template <typename T>
25T GetSettingsItemValue(std::shared_ptr<Service::Set::ISystemSettingsServer>& set_sys,
26 const char* category, const char* name) {
27 std::vector<u8> interval_buf;
28 auto res = set_sys->GetSettingsItemValue(interval_buf, category, name);
29 ASSERT(res == ResultSuccess);
30
31 T v{};
32 std::memcpy(&v, interval_buf.data(), sizeof(T));
33 return v;
34}
35} // namespace
36 23
37StaticService::StaticService(Core::System& system_, 24StaticService::StaticService(Core::System& system_,
38 Service::PSC::Time::StaticServiceSetupInfo setup_info, 25 Service::PSC::Time::StaticServiceSetupInfo setup_info,
@@ -181,8 +168,8 @@ Result StaticService::SetStandardUserSystemClockAutomaticCorrectionEnabled(
181Result StaticService::GetStandardUserSystemClockInitialYear(Out<s32> out_year) { 168Result StaticService::GetStandardUserSystemClockInitialYear(Out<s32> out_year) {
182 SCOPE_EXIT({ LOG_DEBUG(Service_Time, "called. out_year={}", *out_year); }); 169 SCOPE_EXIT({ LOG_DEBUG(Service_Time, "called. out_year={}", *out_year); });
183 170
184 *out_year = GetSettingsItemValue<s32>(m_set_sys, "time", "standard_user_clock_initial_year"); 171 R_RETURN(m_set_sys->GetSettingsItemValueImpl<s32>(*out_year, "time",
185 R_SUCCEED(); 172 "standard_user_clock_initial_year"));
186} 173}
187 174
188Result StaticService::IsStandardNetworkSystemClockAccuracySufficient(Out<bool> out_is_sufficient) { 175Result StaticService::IsStandardNetworkSystemClockAccuracySufficient(Out<bool> out_is_sufficient) {
diff --git a/src/core/hle/service/glue/time/worker.cpp b/src/core/hle/service/glue/time/worker.cpp
index 8787f2dcd..b28569b68 100755
--- a/src/core/hle/service/glue/time/worker.cpp
+++ b/src/core/hle/service/glue/time/worker.cpp
@@ -27,7 +27,7 @@ template <typename T>
27T GetSettingsItemValue(std::shared_ptr<Service::Set::ISystemSettingsServer>& set_sys, 27T GetSettingsItemValue(std::shared_ptr<Service::Set::ISystemSettingsServer>& set_sys,
28 const char* category, const char* name) { 28 const char* category, const char* name) {
29 std::vector<u8> interval_buf; 29 std::vector<u8> interval_buf;
30 auto res = set_sys->GetSettingsItemValue(interval_buf, category, name); 30 auto res = set_sys->GetSettingsItemValueImpl(interval_buf, category, name);
31 ASSERT(res == ResultSuccess); 31 ASSERT(res == ResultSuccess);
32 32
33 T v{}; 33 T v{};
diff --git a/src/core/hle/service/mii/mii.cpp b/src/core/hle/service/mii/mii.cpp
index f2b3dce64..e44d7f198 100755
--- a/src/core/hle/service/mii/mii.cpp
+++ b/src/core/hle/service/mii/mii.cpp
@@ -207,7 +207,8 @@ private:
207 207
208 Result DestroyFile() { 208 Result DestroyFile() {
209 bool is_db_test_mode_enabled{}; 209 bool is_db_test_mode_enabled{};
210 m_set_sys->GetSettingsItemValue(is_db_test_mode_enabled, "mii", "is_db_test_mode_enabled"); 210 m_set_sys->GetSettingsItemValueImpl(is_db_test_mode_enabled, "mii",
211 "is_db_test_mode_enabled");
211 212
212 LOG_INFO(Service_Mii, "called is_db_test_mode_enabled={}", is_db_test_mode_enabled); 213 LOG_INFO(Service_Mii, "called is_db_test_mode_enabled={}", is_db_test_mode_enabled);
213 R_UNLESS(is_db_test_mode_enabled, ResultTestModeOnly); 214 R_UNLESS(is_db_test_mode_enabled, ResultTestModeOnly);
@@ -217,7 +218,8 @@ private:
217 218
218 Result DeleteFile() { 219 Result DeleteFile() {
219 bool is_db_test_mode_enabled{}; 220 bool is_db_test_mode_enabled{};
220 m_set_sys->GetSettingsItemValue(is_db_test_mode_enabled, "mii", "is_db_test_mode_enabled"); 221 m_set_sys->GetSettingsItemValueImpl(is_db_test_mode_enabled, "mii",
222 "is_db_test_mode_enabled");
221 223
222 LOG_INFO(Service_Mii, "called is_db_test_mode_enabled={}", is_db_test_mode_enabled); 224 LOG_INFO(Service_Mii, "called is_db_test_mode_enabled={}", is_db_test_mode_enabled);
223 R_UNLESS(is_db_test_mode_enabled, ResultTestModeOnly); 225 R_UNLESS(is_db_test_mode_enabled, ResultTestModeOnly);
@@ -227,7 +229,8 @@ private:
227 229
228 Result Format() { 230 Result Format() {
229 bool is_db_test_mode_enabled{}; 231 bool is_db_test_mode_enabled{};
230 m_set_sys->GetSettingsItemValue(is_db_test_mode_enabled, "mii", "is_db_test_mode_enabled"); 232 m_set_sys->GetSettingsItemValueImpl(is_db_test_mode_enabled, "mii",
233 "is_db_test_mode_enabled");
231 234
232 LOG_INFO(Service_Mii, "called is_db_test_mode_enabled={}", is_db_test_mode_enabled); 235 LOG_INFO(Service_Mii, "called is_db_test_mode_enabled={}", is_db_test_mode_enabled);
233 R_UNLESS(is_db_test_mode_enabled, ResultTestModeOnly); 236 R_UNLESS(is_db_test_mode_enabled, ResultTestModeOnly);
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 40230182a..a5b1552a5 100755
--- a/src/core/hle/service/set/setting_formats/system_settings.h
+++ b/src/core/hle/service/set/setting_formats/system_settings.h
@@ -244,7 +244,7 @@ struct SystemSettings {
244 INSERT_PADDING_BYTES(0x60); // Reserved 244 INSERT_PADDING_BYTES(0x60); // Reserved
245 245
246 // nn::settings::system::AccountNotificationSettings 246 // nn::settings::system::AccountNotificationSettings
247 u32 account_notification_settings_count; 247 s32 account_notification_settings_count;
248 INSERT_PADDING_BYTES(0xC); // Reserved 248 INSERT_PADDING_BYTES(0xC); // Reserved
249 std::array<AccountNotificationSettings, 8> account_notification_settings; 249 std::array<AccountNotificationSettings, 8> account_notification_settings;
250 INSERT_PADDING_BYTES(0x140); // Reserved 250 INSERT_PADDING_BYTES(0x140); // Reserved
@@ -308,7 +308,7 @@ struct SystemSettings {
308 INSERT_PADDING_BYTES(0x34); // Reserved 308 INSERT_PADDING_BYTES(0x34); // Reserved
309 309
310 // nn::settings::system::EulaVersion 310 // nn::settings::system::EulaVersion
311 u32 eula_version_count; 311 s32 eula_version_count;
312 INSERT_PADDING_BYTES(0xC); // Reserved 312 INSERT_PADDING_BYTES(0xC); // Reserved
313 std::array<EulaVersion, 32> eula_versions; 313 std::array<EulaVersion, 32> eula_versions;
314 INSERT_PADDING_BYTES(0x200); // Reserved 314 INSERT_PADDING_BYTES(0x200); // Reserved
diff --git a/src/core/hle/service/set/settings_types.h b/src/core/hle/service/set/settings_types.h
index 83ef6635b..29664e88c 100755
--- a/src/core/hle/service/set/settings_types.h
+++ b/src/core/hle/service/set/settings_types.h
@@ -12,6 +12,7 @@
12#include "core/hle/service/psc/time/common.h" 12#include "core/hle/service/psc/time/common.h"
13 13
14namespace Service::Set { 14namespace Service::Set {
15using SettingItemName = std::array<u8, 0x48>;
15 16
16/// This is nn::settings::system::AudioOutputMode 17/// This is nn::settings::system::AudioOutputMode
17enum class AudioOutputMode : u32 { 18enum class AudioOutputMode : u32 {
@@ -413,16 +414,18 @@ struct FirmwareVersionFormat {
413 u8 major; 414 u8 major;
414 u8 minor; 415 u8 minor;
415 u8 micro; 416 u8 micro;
416 INSERT_PADDING_BYTES(1); 417 INSERT_PADDING_BYTES_NOINIT(1);
417 u8 revision_major; 418 u8 revision_major;
418 u8 revision_minor; 419 u8 revision_minor;
419 INSERT_PADDING_BYTES(2); 420 INSERT_PADDING_BYTES_NOINIT(2);
420 std::array<char, 0x20> platform; 421 std::array<char, 0x20> platform;
421 std::array<u8, 0x40> version_hash; 422 std::array<u8, 0x40> version_hash;
422 std::array<char, 0x18> display_version; 423 std::array<char, 0x18> display_version;
423 std::array<char, 0x80> display_title; 424 std::array<char, 0x80> display_title;
424}; 425};
425static_assert(sizeof(FirmwareVersionFormat) == 0x100, "FirmwareVersionFormat is an invalid size"); 426static_assert(sizeof(FirmwareVersionFormat) == 0x100, "FirmwareVersionFormat is an invalid size");
427static_assert(std::is_trivial_v<FirmwareVersionFormat>,
428 "FirmwareVersionFormat type must be trivially copyable.");
426 429
427/// This is nn::settings::system::HomeMenuScheme 430/// This is nn::settings::system::HomeMenuScheme
428struct HomeMenuScheme { 431struct HomeMenuScheme {
diff --git a/src/core/hle/service/set/system_settings_server.cpp b/src/core/hle/service/set/system_settings_server.cpp
index 7ef4a0ded..93925f783 100755
--- a/src/core/hle/service/set/system_settings_server.cpp
+++ b/src/core/hle/service/set/system_settings_server.cpp
@@ -17,6 +17,7 @@
17#include "core/file_sys/registered_cache.h" 17#include "core/file_sys/registered_cache.h"
18#include "core/file_sys/romfs.h" 18#include "core/file_sys/romfs.h"
19#include "core/file_sys/system_archive/system_archive.h" 19#include "core/file_sys/system_archive/system_archive.h"
20#include "core/hle/service/cmif_serialization.h"
20#include "core/hle/service/filesystem/filesystem.h" 21#include "core/hle/service/filesystem/filesystem.h"
21#include "core/hle/service/ipc_helpers.h" 22#include "core/hle/service/ipc_helpers.h"
22#include "core/hle/service/set/settings_server.h" 23#include "core/hle/service/set/settings_server.h"
@@ -91,83 +92,83 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
91 : ServiceFramework{system_, "set:sys"}, m_system{system} { 92 : ServiceFramework{system_, "set:sys"}, m_system{system} {
92 // clang-format off 93 // clang-format off
93 static const FunctionInfo functions[] = { 94 static const FunctionInfo functions[] = {
94 {0, &ISystemSettingsServer::SetLanguageCode, "SetLanguageCode"}, 95 {0, C<&ISystemSettingsServer::SetLanguageCode>, "SetLanguageCode"},
95 {1, nullptr, "SetNetworkSettings"}, 96 {1, nullptr, "SetNetworkSettings"},
96 {2, nullptr, "GetNetworkSettings"}, 97 {2, nullptr, "GetNetworkSettings"},
97 {3, &ISystemSettingsServer::GetFirmwareVersion, "GetFirmwareVersion"}, 98 {3, C<&ISystemSettingsServer::GetFirmwareVersion>, "GetFirmwareVersion"},
98 {4, &ISystemSettingsServer::GetFirmwareVersion2, "GetFirmwareVersion2"}, 99 {4, C<&ISystemSettingsServer::GetFirmwareVersion2>, "GetFirmwareVersion2"},
99 {5, nullptr, "GetFirmwareVersionDigest"}, 100 {5, nullptr, "GetFirmwareVersionDigest"},
100 {7, &ISystemSettingsServer::GetLockScreenFlag, "GetLockScreenFlag"}, 101 {7, C<&ISystemSettingsServer::GetLockScreenFlag>, "GetLockScreenFlag"},
101 {8, &ISystemSettingsServer::SetLockScreenFlag, "SetLockScreenFlag"}, 102 {8, C<&ISystemSettingsServer::SetLockScreenFlag>, "SetLockScreenFlag"},
102 {9, nullptr, "GetBacklightSettings"}, 103 {9, nullptr, "GetBacklightSettings"},
103 {10, nullptr, "SetBacklightSettings"}, 104 {10, nullptr, "SetBacklightSettings"},
104 {11, nullptr, "SetBluetoothDevicesSettings"}, 105 {11, nullptr, "SetBluetoothDevicesSettings"},
105 {12, nullptr, "GetBluetoothDevicesSettings"}, 106 {12, nullptr, "GetBluetoothDevicesSettings"},
106 {13, &ISystemSettingsServer::GetExternalSteadyClockSourceId, "GetExternalSteadyClockSourceId"}, 107 {13, C<&ISystemSettingsServer::GetExternalSteadyClockSourceId>, "GetExternalSteadyClockSourceId"},
107 {14, &ISystemSettingsServer::SetExternalSteadyClockSourceId, "SetExternalSteadyClockSourceId"}, 108 {14, C<&ISystemSettingsServer::SetExternalSteadyClockSourceId>, "SetExternalSteadyClockSourceId"},
108 {15, &ISystemSettingsServer::GetUserSystemClockContext, "GetUserSystemClockContext"}, 109 {15, C<&ISystemSettingsServer::GetUserSystemClockContext>, "GetUserSystemClockContext"},
109 {16, &ISystemSettingsServer::SetUserSystemClockContext, "SetUserSystemClockContext"}, 110 {16, C<&ISystemSettingsServer::SetUserSystemClockContext>, "SetUserSystemClockContext"},
110 {17, &ISystemSettingsServer::GetAccountSettings, "GetAccountSettings"}, 111 {17, C<&ISystemSettingsServer::GetAccountSettings>, "GetAccountSettings"},
111 {18, &ISystemSettingsServer::SetAccountSettings, "SetAccountSettings"}, 112 {18, C<&ISystemSettingsServer::SetAccountSettings>, "SetAccountSettings"},
112 {19, nullptr, "GetAudioVolume"}, 113 {19, nullptr, "GetAudioVolume"},
113 {20, nullptr, "SetAudioVolume"}, 114 {20, nullptr, "SetAudioVolume"},
114 {21, &ISystemSettingsServer::GetEulaVersions, "GetEulaVersions"}, 115 {21, C<&ISystemSettingsServer::GetEulaVersions>, "GetEulaVersions"},
115 {22, &ISystemSettingsServer::SetEulaVersions, "SetEulaVersions"}, 116 {22, C<&ISystemSettingsServer::SetEulaVersions>, "SetEulaVersions"},
116 {23, &ISystemSettingsServer::GetColorSetId, "GetColorSetId"}, 117 {23, C<&ISystemSettingsServer::GetColorSetId>, "GetColorSetId"},
117 {24, &ISystemSettingsServer::SetColorSetId, "SetColorSetId"}, 118 {24, C<&ISystemSettingsServer::SetColorSetId>, "SetColorSetId"},
118 {25, nullptr, "GetConsoleInformationUploadFlag"}, 119 {25, nullptr, "GetConsoleInformationUploadFlag"},
119 {26, nullptr, "SetConsoleInformationUploadFlag"}, 120 {26, nullptr, "SetConsoleInformationUploadFlag"},
120 {27, nullptr, "GetAutomaticApplicationDownloadFlag"}, 121 {27, nullptr, "GetAutomaticApplicationDownloadFlag"},
121 {28, nullptr, "SetAutomaticApplicationDownloadFlag"}, 122 {28, nullptr, "SetAutomaticApplicationDownloadFlag"},
122 {29, &ISystemSettingsServer::GetNotificationSettings, "GetNotificationSettings"}, 123 {29, C<&ISystemSettingsServer::GetNotificationSettings>, "GetNotificationSettings"},
123 {30, &ISystemSettingsServer::SetNotificationSettings, "SetNotificationSettings"}, 124 {30, C<&ISystemSettingsServer::SetNotificationSettings>, "SetNotificationSettings"},
124 {31, &ISystemSettingsServer::GetAccountNotificationSettings, "GetAccountNotificationSettings"}, 125 {31, C<&ISystemSettingsServer::GetAccountNotificationSettings>, "GetAccountNotificationSettings"},
125 {32, &ISystemSettingsServer::SetAccountNotificationSettings, "SetAccountNotificationSettings"}, 126 {32, C<&ISystemSettingsServer::SetAccountNotificationSettings>, "SetAccountNotificationSettings"},
126 {35, &ISystemSettingsServer::GetVibrationMasterVolume, "GetVibrationMasterVolume"}, 127 {35, C<&ISystemSettingsServer::GetVibrationMasterVolume>, "GetVibrationMasterVolume"},
127 {36, &ISystemSettingsServer::SetVibrationMasterVolume, "SetVibrationMasterVolume"}, 128 {36, C<&ISystemSettingsServer::SetVibrationMasterVolume>, "SetVibrationMasterVolume"},
128 {37, &ISystemSettingsServer::GetSettingsItemValueSize, "GetSettingsItemValueSize"}, 129 {37, C<&ISystemSettingsServer::GetSettingsItemValueSize>, "GetSettingsItemValueSize"},
129 {38, &ISystemSettingsServer::GetSettingsItemValue, "GetSettingsItemValue"}, 130 {38, C<&ISystemSettingsServer::GetSettingsItemValue>, "GetSettingsItemValue"},
130 {39, &ISystemSettingsServer::GetTvSettings, "GetTvSettings"}, 131 {39, C<&ISystemSettingsServer::GetTvSettings>, "GetTvSettings"},
131 {40, &ISystemSettingsServer::SetTvSettings, "SetTvSettings"}, 132 {40, C<&ISystemSettingsServer::SetTvSettings>, "SetTvSettings"},
132 {41, nullptr, "GetEdid"}, 133 {41, nullptr, "GetEdid"},
133 {42, nullptr, "SetEdid"}, 134 {42, nullptr, "SetEdid"},
134 {43, &ISystemSettingsServer::GetAudioOutputMode, "GetAudioOutputMode"}, 135 {43, C<&ISystemSettingsServer::GetAudioOutputMode>, "GetAudioOutputMode"},
135 {44, &ISystemSettingsServer::SetAudioOutputMode, "SetAudioOutputMode"}, 136 {44, C<&ISystemSettingsServer::SetAudioOutputMode>, "SetAudioOutputMode"},
136 {45, &ISystemSettingsServer::GetSpeakerAutoMuteFlag , "GetSpeakerAutoMuteFlag"}, 137 {45, C<&ISystemSettingsServer::GetSpeakerAutoMuteFlag> , "GetSpeakerAutoMuteFlag"},
137 {46, &ISystemSettingsServer::SetSpeakerAutoMuteFlag , "SetSpeakerAutoMuteFlag"}, 138 {46, C<&ISystemSettingsServer::SetSpeakerAutoMuteFlag> , "SetSpeakerAutoMuteFlag"},
138 {47, &ISystemSettingsServer::GetQuestFlag, "GetQuestFlag"}, 139 {47, C<&ISystemSettingsServer::GetQuestFlag>, "GetQuestFlag"},
139 {48, &ISystemSettingsServer::SetQuestFlag, "SetQuestFlag"}, 140 {48, C<&ISystemSettingsServer::SetQuestFlag>, "SetQuestFlag"},
140 {49, nullptr, "GetDataDeletionSettings"}, 141 {49, nullptr, "GetDataDeletionSettings"},
141 {50, nullptr, "SetDataDeletionSettings"}, 142 {50, nullptr, "SetDataDeletionSettings"},
142 {51, nullptr, "GetInitialSystemAppletProgramId"}, 143 {51, nullptr, "GetInitialSystemAppletProgramId"},
143 {52, nullptr, "GetOverlayDispProgramId"}, 144 {52, nullptr, "GetOverlayDispProgramId"},
144 {53, &ISystemSettingsServer::GetDeviceTimeZoneLocationName, "GetDeviceTimeZoneLocationName"}, 145 {53, C<&ISystemSettingsServer::GetDeviceTimeZoneLocationName>, "GetDeviceTimeZoneLocationName"},
145 {54, &ISystemSettingsServer::SetDeviceTimeZoneLocationName, "SetDeviceTimeZoneLocationName"}, 146 {54, C<&ISystemSettingsServer::SetDeviceTimeZoneLocationName>, "SetDeviceTimeZoneLocationName"},
146 {55, nullptr, "GetWirelessCertificationFileSize"}, 147 {55, nullptr, "GetWirelessCertificationFileSize"},
147 {56, nullptr, "GetWirelessCertificationFile"}, 148 {56, nullptr, "GetWirelessCertificationFile"},
148 {57, &ISystemSettingsServer::SetRegionCode, "SetRegionCode"}, 149 {57, C<&ISystemSettingsServer::SetRegionCode>, "SetRegionCode"},
149 {58, &ISystemSettingsServer::GetNetworkSystemClockContext, "GetNetworkSystemClockContext"}, 150 {58, C<&ISystemSettingsServer::GetNetworkSystemClockContext>, "GetNetworkSystemClockContext"},
150 {59, &ISystemSettingsServer::SetNetworkSystemClockContext, "SetNetworkSystemClockContext"}, 151 {59, C<&ISystemSettingsServer::SetNetworkSystemClockContext>, "SetNetworkSystemClockContext"},
151 {60, &ISystemSettingsServer::IsUserSystemClockAutomaticCorrectionEnabled, "IsUserSystemClockAutomaticCorrectionEnabled"}, 152 {60, C<&ISystemSettingsServer::IsUserSystemClockAutomaticCorrectionEnabled>, "IsUserSystemClockAutomaticCorrectionEnabled"},
152 {61, &ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionEnabled, "SetUserSystemClockAutomaticCorrectionEnabled"}, 153 {61, C<&ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionEnabled>, "SetUserSystemClockAutomaticCorrectionEnabled"},
153 {62, &ISystemSettingsServer::GetDebugModeFlag, "GetDebugModeFlag"}, 154 {62, C<&ISystemSettingsServer::GetDebugModeFlag>, "GetDebugModeFlag"},
154 {63, &ISystemSettingsServer::GetPrimaryAlbumStorage, "GetPrimaryAlbumStorage"}, 155 {63, C<&ISystemSettingsServer::GetPrimaryAlbumStorage>, "GetPrimaryAlbumStorage"},
155 {64, &ISystemSettingsServer::SetPrimaryAlbumStorage, "SetPrimaryAlbumStorage"}, 156 {64, C<&ISystemSettingsServer::SetPrimaryAlbumStorage>, "SetPrimaryAlbumStorage"},
156 {65, nullptr, "GetUsb30EnableFlag"}, 157 {65, nullptr, "GetUsb30EnableFlag"},
157 {66, nullptr, "SetUsb30EnableFlag"}, 158 {66, nullptr, "SetUsb30EnableFlag"},
158 {67, &ISystemSettingsServer::GetBatteryLot, "GetBatteryLot"}, 159 {67, C<&ISystemSettingsServer::GetBatteryLot>, "GetBatteryLot"},
159 {68, &ISystemSettingsServer::GetSerialNumber, "GetSerialNumber"}, 160 {68, C<&ISystemSettingsServer::GetSerialNumber>, "GetSerialNumber"},
160 {69, &ISystemSettingsServer::GetNfcEnableFlag, "GetNfcEnableFlag"}, 161 {69, C<&ISystemSettingsServer::GetNfcEnableFlag>, "GetNfcEnableFlag"},
161 {70, &ISystemSettingsServer::SetNfcEnableFlag, "SetNfcEnableFlag"}, 162 {70, C<&ISystemSettingsServer::SetNfcEnableFlag>, "SetNfcEnableFlag"},
162 {71, &ISystemSettingsServer::GetSleepSettings, "GetSleepSettings"}, 163 {71, C<&ISystemSettingsServer::GetSleepSettings>, "GetSleepSettings"},
163 {72, &ISystemSettingsServer::SetSleepSettings, "SetSleepSettings"}, 164 {72, C<&ISystemSettingsServer::SetSleepSettings>, "SetSleepSettings"},
164 {73, &ISystemSettingsServer::GetWirelessLanEnableFlag, "GetWirelessLanEnableFlag"}, 165 {73, C<&ISystemSettingsServer::GetWirelessLanEnableFlag>, "GetWirelessLanEnableFlag"},
165 {74, &ISystemSettingsServer::SetWirelessLanEnableFlag, "SetWirelessLanEnableFlag"}, 166 {74, C<&ISystemSettingsServer::SetWirelessLanEnableFlag>, "SetWirelessLanEnableFlag"},
166 {75, &ISystemSettingsServer::GetInitialLaunchSettings, "GetInitialLaunchSettings"}, 167 {75, C<&ISystemSettingsServer::GetInitialLaunchSettings>, "GetInitialLaunchSettings"},
167 {76, &ISystemSettingsServer::SetInitialLaunchSettings, "SetInitialLaunchSettings"}, 168 {76, C<&ISystemSettingsServer::SetInitialLaunchSettings>, "SetInitialLaunchSettings"},
168 {77, &ISystemSettingsServer::GetDeviceNickName, "GetDeviceNickName"}, 169 {77, C<&ISystemSettingsServer::GetDeviceNickName>, "GetDeviceNickName"},
169 {78, &ISystemSettingsServer::SetDeviceNickName, "SetDeviceNickName"}, 170 {78, C<&ISystemSettingsServer::SetDeviceNickName>, "SetDeviceNickName"},
170 {79, &ISystemSettingsServer::GetProductModel, "GetProductModel"}, 171 {79, C<&ISystemSettingsServer::GetProductModel>, "GetProductModel"},
171 {80, nullptr, "GetLdnChannel"}, 172 {80, nullptr, "GetLdnChannel"},
172 {81, nullptr, "SetLdnChannel"}, 173 {81, nullptr, "SetLdnChannel"},
173 {82, nullptr, "AcquireTelemetryDirtyFlagEventHandle"}, 174 {82, nullptr, "AcquireTelemetryDirtyFlagEventHandle"},
@@ -176,25 +177,25 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
176 {85, nullptr, "SetPtmBatteryLot"}, 177 {85, nullptr, "SetPtmBatteryLot"},
177 {86, nullptr, "GetPtmFuelGaugeParameter"}, 178 {86, nullptr, "GetPtmFuelGaugeParameter"},
178 {87, nullptr, "SetPtmFuelGaugeParameter"}, 179 {87, nullptr, "SetPtmFuelGaugeParameter"},
179 {88, &ISystemSettingsServer::GetBluetoothEnableFlag, "GetBluetoothEnableFlag"}, 180 {88, C<&ISystemSettingsServer::GetBluetoothEnableFlag>, "GetBluetoothEnableFlag"},
180 {89, &ISystemSettingsServer::SetBluetoothEnableFlag, "SetBluetoothEnableFlag"}, 181 {89, C<&ISystemSettingsServer::SetBluetoothEnableFlag>, "SetBluetoothEnableFlag"},
181 {90, &ISystemSettingsServer::GetMiiAuthorId, "GetMiiAuthorId"}, 182 {90, C<&ISystemSettingsServer::GetMiiAuthorId>, "GetMiiAuthorId"},
182 {91, nullptr, "SetShutdownRtcValue"}, 183 {91, nullptr, "SetShutdownRtcValue"},
183 {92, nullptr, "GetShutdownRtcValue"}, 184 {92, nullptr, "GetShutdownRtcValue"},
184 {93, nullptr, "AcquireFatalDirtyFlagEventHandle"}, 185 {93, nullptr, "AcquireFatalDirtyFlagEventHandle"},
185 {94, nullptr, "GetFatalDirtyFlags"}, 186 {94, nullptr, "GetFatalDirtyFlags"},
186 {95, &ISystemSettingsServer::GetAutoUpdateEnableFlag, "GetAutoUpdateEnableFlag"}, 187 {95, C<&ISystemSettingsServer::GetAutoUpdateEnableFlag>, "GetAutoUpdateEnableFlag"},
187 {96, &ISystemSettingsServer::SetAutoUpdateEnableFlag, "SetAutoUpdateEnableFlag"}, 188 {96, C<&ISystemSettingsServer::SetAutoUpdateEnableFlag>, "SetAutoUpdateEnableFlag"},
188 {97, nullptr, "GetNxControllerSettings"}, 189 {97, nullptr, "GetNxControllerSettings"},
189 {98, nullptr, "SetNxControllerSettings"}, 190 {98, nullptr, "SetNxControllerSettings"},
190 {99, &ISystemSettingsServer::GetBatteryPercentageFlag, "GetBatteryPercentageFlag"}, 191 {99, C<&ISystemSettingsServer::GetBatteryPercentageFlag>, "GetBatteryPercentageFlag"},
191 {100, &ISystemSettingsServer::SetBatteryPercentageFlag, "SetBatteryPercentageFlag"}, 192 {100, C<&ISystemSettingsServer::SetBatteryPercentageFlag>, "SetBatteryPercentageFlag"},
192 {101, nullptr, "GetExternalRtcResetFlag"}, 193 {101, nullptr, "GetExternalRtcResetFlag"},
193 {102, nullptr, "SetExternalRtcResetFlag"}, 194 {102, nullptr, "SetExternalRtcResetFlag"},
194 {103, nullptr, "GetUsbFullKeyEnableFlag"}, 195 {103, nullptr, "GetUsbFullKeyEnableFlag"},
195 {104, nullptr, "SetUsbFullKeyEnableFlag"}, 196 {104, nullptr, "SetUsbFullKeyEnableFlag"},
196 {105, &ISystemSettingsServer::SetExternalSteadyClockInternalOffset, "SetExternalSteadyClockInternalOffset"}, 197 {105, C<&ISystemSettingsServer::SetExternalSteadyClockInternalOffset>, "SetExternalSteadyClockInternalOffset"},
197 {106, &ISystemSettingsServer::GetExternalSteadyClockInternalOffset, "GetExternalSteadyClockInternalOffset"}, 198 {106, C<&ISystemSettingsServer::GetExternalSteadyClockInternalOffset>, "GetExternalSteadyClockInternalOffset"},
198 {107, nullptr, "GetBacklightSettingsEx"}, 199 {107, nullptr, "GetBacklightSettingsEx"},
199 {108, nullptr, "SetBacklightSettingsEx"}, 200 {108, nullptr, "SetBacklightSettingsEx"},
200 {109, nullptr, "GetHeadphoneVolumeWarningCount"}, 201 {109, nullptr, "GetHeadphoneVolumeWarningCount"},
@@ -208,14 +209,14 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
208 {117, nullptr, "GetHeadphoneVolumeUpdateFlag"}, 209 {117, nullptr, "GetHeadphoneVolumeUpdateFlag"},
209 {118, nullptr, "SetHeadphoneVolumeUpdateFlag"}, 210 {118, nullptr, "SetHeadphoneVolumeUpdateFlag"},
210 {119, nullptr, "NeedsToUpdateHeadphoneVolume"}, 211 {119, nullptr, "NeedsToUpdateHeadphoneVolume"},
211 {120, &ISystemSettingsServer::GetPushNotificationActivityModeOnSleep, "GetPushNotificationActivityModeOnSleep"}, 212 {120, C<&ISystemSettingsServer::GetPushNotificationActivityModeOnSleep>, "GetPushNotificationActivityModeOnSleep"},
212 {121, &ISystemSettingsServer::SetPushNotificationActivityModeOnSleep, "SetPushNotificationActivityModeOnSleep"}, 213 {121, C<&ISystemSettingsServer::SetPushNotificationActivityModeOnSleep>, "SetPushNotificationActivityModeOnSleep"},
213 {122, nullptr, "GetServiceDiscoveryControlSettings"}, 214 {122, nullptr, "GetServiceDiscoveryControlSettings"},
214 {123, nullptr, "SetServiceDiscoveryControlSettings"}, 215 {123, nullptr, "SetServiceDiscoveryControlSettings"},
215 {124, &ISystemSettingsServer::GetErrorReportSharePermission, "GetErrorReportSharePermission"}, 216 {124, C<&ISystemSettingsServer::GetErrorReportSharePermission>, "GetErrorReportSharePermission"},
216 {125, &ISystemSettingsServer::SetErrorReportSharePermission, "SetErrorReportSharePermission"}, 217 {125, C<&ISystemSettingsServer::SetErrorReportSharePermission>, "SetErrorReportSharePermission"},
217 {126, &ISystemSettingsServer::GetAppletLaunchFlags, "GetAppletLaunchFlags"}, 218 {126, C<&ISystemSettingsServer::GetAppletLaunchFlags>, "GetAppletLaunchFlags"},
218 {127, &ISystemSettingsServer::SetAppletLaunchFlags, "SetAppletLaunchFlags"}, 219 {127, C<&ISystemSettingsServer::SetAppletLaunchFlags>, "SetAppletLaunchFlags"},
219 {128, nullptr, "GetConsoleSixAxisSensorAccelerationBias"}, 220 {128, nullptr, "GetConsoleSixAxisSensorAccelerationBias"},
220 {129, nullptr, "SetConsoleSixAxisSensorAccelerationBias"}, 221 {129, nullptr, "SetConsoleSixAxisSensorAccelerationBias"},
221 {130, nullptr, "GetConsoleSixAxisSensorAngularVelocityBias"}, 222 {130, nullptr, "GetConsoleSixAxisSensorAngularVelocityBias"},
@@ -224,8 +225,8 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
224 {133, nullptr, "SetConsoleSixAxisSensorAccelerationGain"}, 225 {133, nullptr, "SetConsoleSixAxisSensorAccelerationGain"},
225 {134, nullptr, "GetConsoleSixAxisSensorAngularVelocityGain"}, 226 {134, nullptr, "GetConsoleSixAxisSensorAngularVelocityGain"},
226 {135, nullptr, "SetConsoleSixAxisSensorAngularVelocityGain"}, 227 {135, nullptr, "SetConsoleSixAxisSensorAngularVelocityGain"},
227 {136, &ISystemSettingsServer::GetKeyboardLayout, "GetKeyboardLayout"}, 228 {136, C<&ISystemSettingsServer::GetKeyboardLayout>, "GetKeyboardLayout"},
228 {137, &ISystemSettingsServer::SetKeyboardLayout, "SetKeyboardLayout"}, 229 {137, C<&ISystemSettingsServer::SetKeyboardLayout>, "SetKeyboardLayout"},
229 {138, nullptr, "GetWebInspectorFlag"}, 230 {138, nullptr, "GetWebInspectorFlag"},
230 {139, nullptr, "GetAllowedSslHosts"}, 231 {139, nullptr, "GetAllowedSslHosts"},
231 {140, nullptr, "GetHostFsMountPoint"}, 232 {140, nullptr, "GetHostFsMountPoint"},
@@ -238,10 +239,10 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
238 {147, nullptr, "GetConsoleSixAxisSensorAngularAcceleration"}, 239 {147, nullptr, "GetConsoleSixAxisSensorAngularAcceleration"},
239 {148, nullptr, "SetConsoleSixAxisSensorAngularAcceleration"}, 240 {148, nullptr, "SetConsoleSixAxisSensorAngularAcceleration"},
240 {149, nullptr, "GetRebootlessSystemUpdateVersion"}, 241 {149, nullptr, "GetRebootlessSystemUpdateVersion"},
241 {150, &ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime, "GetDeviceTimeZoneLocationUpdatedTime"}, 242 {150, C<&ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime>, "GetDeviceTimeZoneLocationUpdatedTime"},
242 {151, &ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime, "SetDeviceTimeZoneLocationUpdatedTime"}, 243 {151, C<&ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime>, "SetDeviceTimeZoneLocationUpdatedTime"},
243 {152, &ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime, "GetUserSystemClockAutomaticCorrectionUpdatedTime"}, 244 {152, C<&ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime>, "GetUserSystemClockAutomaticCorrectionUpdatedTime"},
244 {153, &ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime, "SetUserSystemClockAutomaticCorrectionUpdatedTime"}, 245 {153, C<&ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime>, "SetUserSystemClockAutomaticCorrectionUpdatedTime"},
245 {154, nullptr, "GetAccountOnlineStorageSettings"}, 246 {154, nullptr, "GetAccountOnlineStorageSettings"},
246 {155, nullptr, "SetAccountOnlineStorageSettings"}, 247 {155, nullptr, "SetAccountOnlineStorageSettings"},
247 {156, nullptr, "GetPctlReadyFlag"}, 248 {156, nullptr, "GetPctlReadyFlag"},
@@ -258,11 +259,11 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
258 {167, nullptr, "SetUsb30DeviceEnableFlag"}, 259 {167, nullptr, "SetUsb30DeviceEnableFlag"},
259 {168, nullptr, "GetThemeId"}, 260 {168, nullptr, "GetThemeId"},
260 {169, nullptr, "SetThemeId"}, 261 {169, nullptr, "SetThemeId"},
261 {170, &ISystemSettingsServer::GetChineseTraditionalInputMethod, "GetChineseTraditionalInputMethod"}, 262 {170, C<&ISystemSettingsServer::GetChineseTraditionalInputMethod>, "GetChineseTraditionalInputMethod"},
262 {171, nullptr, "SetChineseTraditionalInputMethod"}, 263 {171, nullptr, "SetChineseTraditionalInputMethod"},
263 {172, nullptr, "GetPtmCycleCountReliability"}, 264 {172, nullptr, "GetPtmCycleCountReliability"},
264 {173, nullptr, "SetPtmCycleCountReliability"}, 265 {173, nullptr, "SetPtmCycleCountReliability"},
265 {174, &ISystemSettingsServer::GetHomeMenuScheme, "GetHomeMenuScheme"}, 266 {174, C<&ISystemSettingsServer::GetHomeMenuScheme>, "GetHomeMenuScheme"},
266 {175, nullptr, "GetThemeSettings"}, 267 {175, nullptr, "GetThemeSettings"},
267 {176, nullptr, "SetThemeSettings"}, 268 {176, nullptr, "SetThemeSettings"},
268 {177, nullptr, "GetThemeKey"}, 269 {177, nullptr, "GetThemeKey"},
@@ -273,10 +274,10 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
273 {182, nullptr, "SetT"}, 274 {182, nullptr, "SetT"},
274 {183, nullptr, "GetPlatformRegion"}, 275 {183, nullptr, "GetPlatformRegion"},
275 {184, nullptr, "SetPlatformRegion"}, 276 {184, nullptr, "SetPlatformRegion"},
276 {185, &ISystemSettingsServer::GetHomeMenuSchemeModel, "GetHomeMenuSchemeModel"}, 277 {185, C<&ISystemSettingsServer::GetHomeMenuSchemeModel>, "GetHomeMenuSchemeModel"},
277 {186, nullptr, "GetMemoryUsageRateFlag"}, 278 {186, nullptr, "GetMemoryUsageRateFlag"},
278 {187, &ISystemSettingsServer::GetTouchScreenMode, "GetTouchScreenMode"}, 279 {187, C<&ISystemSettingsServer::GetTouchScreenMode>, "GetTouchScreenMode"},
279 {188, &ISystemSettingsServer::SetTouchScreenMode, "SetTouchScreenMode"}, 280 {188, C<&ISystemSettingsServer::SetTouchScreenMode>, "SetTouchScreenMode"},
280 {189, nullptr, "GetButtonConfigSettingsFull"}, 281 {189, nullptr, "GetButtonConfigSettingsFull"},
281 {190, nullptr, "SetButtonConfigSettingsFull"}, 282 {190, nullptr, "SetButtonConfigSettingsFull"},
282 {191, nullptr, "GetButtonConfigSettingsEmbedded"}, 283 {191, nullptr, "GetButtonConfigSettingsEmbedded"},
@@ -289,10 +290,10 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
289 {198, nullptr, "SetButtonConfigRegisteredSettingsEmbedded"}, 290 {198, nullptr, "SetButtonConfigRegisteredSettingsEmbedded"},
290 {199, nullptr, "GetButtonConfigRegisteredSettings"}, 291 {199, nullptr, "GetButtonConfigRegisteredSettings"},
291 {200, nullptr, "SetButtonConfigRegisteredSettings"}, 292 {200, nullptr, "SetButtonConfigRegisteredSettings"},
292 {201, &ISystemSettingsServer::GetFieldTestingFlag, "GetFieldTestingFlag"}, 293 {201, C<&ISystemSettingsServer::GetFieldTestingFlag>, "GetFieldTestingFlag"},
293 {202, nullptr, "SetFieldTestingFlag"}, 294 {202, nullptr, "SetFieldTestingFlag"},
294 {203, &ISystemSettingsServer::GetPanelCrcMode, "GetPanelCrcMode"}, 295 {203, C<&ISystemSettingsServer::GetPanelCrcMode>, "GetPanelCrcMode"},
295 {204, &ISystemSettingsServer::SetPanelCrcMode, "SetPanelCrcMode"}, 296 {204, C<&ISystemSettingsServer::SetPanelCrcMode>, "SetPanelCrcMode"},
296 {205, nullptr, "GetNxControllerSettingsEx"}, 297 {205, nullptr, "GetNxControllerSettingsEx"},
297 {206, nullptr, "SetNxControllerSettingsEx"}, 298 {206, nullptr, "SetNxControllerSettingsEx"},
298 {207, nullptr, "GetHearingProtectionSafeguardFlag"}, 299 {207, nullptr, "GetHearingProtectionSafeguardFlag"},
@@ -422,178 +423,134 @@ bool ISystemSettingsServer::StoreSettingsFile(std::filesystem::path& path, auto&
422 return true; 423 return true;
423} 424}
424 425
425void ISystemSettingsServer::SetLanguageCode(HLERequestContext& ctx) { 426Result ISystemSettingsServer::SetLanguageCode(LanguageCode language_code) {
426 IPC::RequestParser rp{ctx}; 427 LOG_INFO(Service_SET, "called, language_code={}", language_code);
427 m_system_settings.language_code = rp.PopEnum<LanguageCode>();
428 SetSaveNeeded();
429
430 LOG_INFO(Service_SET, "called, language_code={}", m_system_settings.language_code);
431 428
432 IPC::ResponseBuilder rb{ctx, 2}; 429 m_system_settings.language_code = language_code;
433 rb.Push(ResultSuccess); 430 SetSaveNeeded();
431 R_SUCCEED();
434} 432}
435 433
436void ISystemSettingsServer::GetFirmwareVersion(HLERequestContext& ctx) { 434Result ISystemSettingsServer::GetFirmwareVersion(
435 OutLargeData<FirmwareVersionFormat, BufferAttr_HipcPointer> out_firmware_data) {
437 LOG_DEBUG(Service_SET, "called"); 436 LOG_DEBUG(Service_SET, "called");
438 437
439 FirmwareVersionFormat firmware_data{}; 438 R_RETURN(GetFirmwareVersionImpl(*out_firmware_data, system, GetFirmwareVersionType::Version1));
440 const auto result =
441 GetFirmwareVersionImpl(firmware_data, system, GetFirmwareVersionType::Version1);
442
443 if (result.IsSuccess()) {
444 ctx.WriteBuffer(firmware_data);
445 }
446
447 IPC::ResponseBuilder rb{ctx, 2};
448 rb.Push(result);
449} 439}
450 440
451void ISystemSettingsServer::GetFirmwareVersion2(HLERequestContext& ctx) { 441Result ISystemSettingsServer::GetFirmwareVersion2(
442 OutLargeData<FirmwareVersionFormat, BufferAttr_HipcPointer> out_firmware_data) {
452 LOG_DEBUG(Service_SET, "called"); 443 LOG_DEBUG(Service_SET, "called");
453 444
454 FirmwareVersionFormat firmware_data{}; 445 R_RETURN(GetFirmwareVersionImpl(*out_firmware_data, system, GetFirmwareVersionType::Version2));
455 const auto result =
456 GetFirmwareVersionImpl(firmware_data, system, GetFirmwareVersionType::Version2);
457
458 if (result.IsSuccess()) {
459 ctx.WriteBuffer(firmware_data);
460 }
461
462 IPC::ResponseBuilder rb{ctx, 2};
463 rb.Push(result);
464} 446}
465 447
466void ISystemSettingsServer::GetExternalSteadyClockSourceId(HLERequestContext& ctx) { 448Result ISystemSettingsServer::GetLockScreenFlag(Out<bool> out_lock_screen_flag) {
467 LOG_INFO(Service_SET, "called"); 449 LOG_INFO(Service_SET, "called, lock_screen_flag={}", m_system_settings.lock_screen_flag);
468
469 Common::UUID id{};
470 const auto res = GetExternalSteadyClockSourceId(id);
471 450
472 IPC::ResponseBuilder rb{ctx, 2 + sizeof(Common::UUID) / sizeof(u32)}; 451 *out_lock_screen_flag = m_system_settings.lock_screen_flag;
473 rb.Push(res); 452 R_SUCCEED();
474 rb.PushRaw(id);
475} 453}
476 454
477void ISystemSettingsServer::SetExternalSteadyClockSourceId(HLERequestContext& ctx) { 455Result ISystemSettingsServer::SetLockScreenFlag(bool lock_screen_flag) {
478 LOG_INFO(Service_SET, "called"); 456 LOG_INFO(Service_SET, "called, lock_screen_flag={}", lock_screen_flag);
479 457
480 IPC::RequestParser rp{ctx}; 458 m_system_settings.lock_screen_flag = lock_screen_flag;
481 const auto id{rp.PopRaw<Common::UUID>()}; 459 SetSaveNeeded();
460 R_SUCCEED();
461}
482 462
483 const auto res = SetExternalSteadyClockSourceId(id); 463Result ISystemSettingsServer::GetExternalSteadyClockSourceId(
464 Out<Common::UUID> out_clock_source_id) {
465 LOG_INFO(Service_SET, "called, clock_source_id={}",
466 m_private_settings.external_clock_source_id.FormattedString());
484 467
485 IPC::ResponseBuilder rb{ctx, 2}; 468 *out_clock_source_id = m_private_settings.external_clock_source_id;
486 rb.Push(res); 469 R_SUCCEED();
487} 470}
488 471
489void ISystemSettingsServer::GetUserSystemClockContext(HLERequestContext& ctx) { 472Result ISystemSettingsServer::SetExternalSteadyClockSourceId(const Common::UUID& clock_source_id) {
490 LOG_INFO(Service_SET, "called"); 473 LOG_INFO(Service_SET, "called, clock_source_id={}", clock_source_id.FormattedString());
491
492 Service::PSC::Time::SystemClockContext context{};
493 const auto res = GetUserSystemClockContext(context);
494 474
495 IPC::ResponseBuilder rb{ctx, 2 + sizeof(Service::PSC::Time::SystemClockContext) / sizeof(u32)}; 475 m_private_settings.external_clock_source_id = clock_source_id;
496 rb.Push(res); 476 SetSaveNeeded();
497 rb.PushRaw(context); 477 R_SUCCEED();
498} 478}
499 479
500void ISystemSettingsServer::SetUserSystemClockContext(HLERequestContext& ctx) { 480Result ISystemSettingsServer::GetUserSystemClockContext(
481 Out<Service::PSC::Time::SystemClockContext> out_clock_context) {
501 LOG_INFO(Service_SET, "called"); 482 LOG_INFO(Service_SET, "called");
502 483
503 IPC::RequestParser rp{ctx}; 484 *out_clock_context = m_system_settings.user_system_clock_context;
504 const auto context{rp.PopRaw<Service::PSC::Time::SystemClockContext>()}; 485 R_SUCCEED();
505
506 const auto res = SetUserSystemClockContext(context);
507
508 IPC::ResponseBuilder rb{ctx, 2};
509 rb.Push(res);
510} 486}
511 487
512void ISystemSettingsServer::GetLockScreenFlag(HLERequestContext& ctx) { 488Result ISystemSettingsServer::SetUserSystemClockContext(
513 LOG_INFO(Service_SET, "called, lock_screen_flag={}", m_system_settings.lock_screen_flag); 489 const Service::PSC::Time::SystemClockContext& clock_context) {
514 490 LOG_INFO(Service_SET, "called");
515 IPC::ResponseBuilder rb{ctx, 3};
516 rb.Push(ResultSuccess);
517 rb.Push(m_system_settings.lock_screen_flag);
518}
519 491
520void ISystemSettingsServer::SetLockScreenFlag(HLERequestContext& ctx) { 492 m_system_settings.user_system_clock_context = clock_context;
521 IPC::RequestParser rp{ctx};
522 m_system_settings.lock_screen_flag = rp.Pop<bool>();
523 SetSaveNeeded(); 493 SetSaveNeeded();
524 494 R_SUCCEED();
525 LOG_INFO(Service_SET, "called, lock_screen_flag={}", m_system_settings.lock_screen_flag);
526
527 IPC::ResponseBuilder rb{ctx, 2};
528 rb.Push(ResultSuccess);
529} 495}
530 496
531void ISystemSettingsServer::GetAccountSettings(HLERequestContext& ctx) { 497Result ISystemSettingsServer::GetAccountSettings(Out<AccountSettings> out_account_settings) {
532 LOG_INFO(Service_SET, "called"); 498 LOG_INFO(Service_SET, "called, account_settings_flags={}",
499 m_system_settings.account_settings.flags);
533 500
534 IPC::ResponseBuilder rb{ctx, 3}; 501 *out_account_settings = m_system_settings.account_settings;
535 rb.Push(ResultSuccess); 502 R_SUCCEED();
536 rb.PushRaw(m_system_settings.account_settings);
537} 503}
538 504
539void ISystemSettingsServer::SetAccountSettings(HLERequestContext& ctx) { 505Result ISystemSettingsServer::SetAccountSettings(AccountSettings account_settings) {
540 IPC::RequestParser rp{ctx}; 506 LOG_INFO(Service_SET, "called, account_settings_flags={}", account_settings.flags);
541 m_system_settings.account_settings = rp.PopRaw<AccountSettings>();
542 SetSaveNeeded();
543
544 LOG_INFO(Service_SET, "called, account_settings_flags={}",
545 m_system_settings.account_settings.flags);
546 507
547 IPC::ResponseBuilder rb{ctx, 2}; 508 m_system_settings.account_settings = account_settings;
548 rb.Push(ResultSuccess); 509 SetSaveNeeded();
510 R_SUCCEED();
549} 511}
550 512
551void ISystemSettingsServer::GetEulaVersions(HLERequestContext& ctx) { 513Result ISystemSettingsServer::GetEulaVersions(
514 Out<s32> out_count, OutArray<EulaVersion, BufferAttr_HipcMapAlias> out_eula_versions) {
552 LOG_INFO(Service_SET, "called, elements={}", m_system_settings.eula_version_count); 515 LOG_INFO(Service_SET, "called, elements={}", m_system_settings.eula_version_count);
553 516
554 ctx.WriteBuffer(m_system_settings.eula_versions); 517 *out_count =
555 518 std::min(m_system_settings.eula_version_count, static_cast<s32>(out_eula_versions.size()));
556 IPC::ResponseBuilder rb{ctx, 3}; 519 memcpy(out_eula_versions.data(), m_system_settings.eula_versions.data(),
557 rb.Push(ResultSuccess); 520 static_cast<std::size_t>(*out_count) * sizeof(EulaVersion));
558 rb.Push(m_system_settings.eula_version_count); 521 R_SUCCEED();
559} 522}
560 523
561void ISystemSettingsServer::SetEulaVersions(HLERequestContext& ctx) { 524Result ISystemSettingsServer::SetEulaVersions(
562 const auto elements = ctx.GetReadBufferNumElements<EulaVersion>(); 525 InArray<EulaVersion, BufferAttr_HipcMapAlias> eula_versions) {
563 const auto buffer_data = ctx.ReadBuffer(); 526 LOG_INFO(Service_SET, "called, elements={}", eula_versions.size());
564 527
565 LOG_INFO(Service_SET, "called, elements={}", elements); 528 ASSERT(eula_versions.size() <= m_system_settings.eula_versions.size());
566 ASSERT(elements <= m_system_settings.eula_versions.size());
567 529
568 m_system_settings.eula_version_count = static_cast<u32>(elements); 530 m_system_settings.eula_version_count = static_cast<s32>(eula_versions.size());
569 std::memcpy(&m_system_settings.eula_versions, buffer_data.data(), 531 std::memcpy(m_system_settings.eula_versions.data(), eula_versions.data(),
570 sizeof(EulaVersion) * elements); 532 eula_versions.size() * sizeof(EulaVersion));
571 SetSaveNeeded(); 533 SetSaveNeeded();
572 534 R_SUCCEED();
573 IPC::ResponseBuilder rb{ctx, 2};
574 rb.Push(ResultSuccess);
575} 535}
576 536
577void ISystemSettingsServer::GetColorSetId(HLERequestContext& ctx) { 537Result ISystemSettingsServer::GetColorSetId(Out<ColorSet> out_color_set_id) {
578 LOG_DEBUG(Service_SET, "called, color_set=", m_system_settings.color_set_id); 538 LOG_DEBUG(Service_SET, "called, color_set=", m_system_settings.color_set_id);
579 539
580 IPC::ResponseBuilder rb{ctx, 3}; 540 *out_color_set_id = m_system_settings.color_set_id;
581 rb.Push(ResultSuccess); 541 R_SUCCEED();
582 rb.PushEnum(m_system_settings.color_set_id);
583} 542}
584 543
585void ISystemSettingsServer::SetColorSetId(HLERequestContext& ctx) { 544Result ISystemSettingsServer::SetColorSetId(ColorSet color_set_id) {
586 IPC::RequestParser rp{ctx}; 545 LOG_DEBUG(Service_SET, "called, color_set={}", color_set_id);
587 m_system_settings.color_set_id = rp.PopEnum<ColorSet>();
588 SetSaveNeeded();
589
590 LOG_DEBUG(Service_SET, "called, color_set={}", m_system_settings.color_set_id);
591 546
592 IPC::ResponseBuilder rb{ctx, 2}; 547 m_system_settings.color_set_id = color_set_id;
593 rb.Push(ResultSuccess); 548 SetSaveNeeded();
549 R_SUCCEED();
594} 550}
595 551
596void ISystemSettingsServer::GetNotificationSettings(HLERequestContext& ctx) { 552Result ISystemSettingsServer::GetNotificationSettings(
553 Out<NotificationSettings> out_notification_settings) {
597 LOG_INFO(Service_SET, "called, flags={}, volume={}, head_time={}:{}, tailt_time={}:{}", 554 LOG_INFO(Service_SET, "called, flags={}, volume={}, head_time={}:{}, tailt_time={}:{}",
598 m_system_settings.notification_settings.flags.raw, 555 m_system_settings.notification_settings.flags.raw,
599 m_system_settings.notification_settings.volume, 556 m_system_settings.notification_settings.volume,
@@ -602,77 +559,67 @@ void ISystemSettingsServer::GetNotificationSettings(HLERequestContext& ctx) {
602 m_system_settings.notification_settings.stop_time.hour, 559 m_system_settings.notification_settings.stop_time.hour,
603 m_system_settings.notification_settings.stop_time.minute); 560 m_system_settings.notification_settings.stop_time.minute);
604 561
605 IPC::ResponseBuilder rb{ctx, 8}; 562 *out_notification_settings = m_system_settings.notification_settings;
606 rb.Push(ResultSuccess); 563 R_SUCCEED();
607 rb.PushRaw(m_system_settings.notification_settings);
608} 564}
609 565
610void ISystemSettingsServer::SetNotificationSettings(HLERequestContext& ctx) { 566Result ISystemSettingsServer::SetNotificationSettings(
611 IPC::RequestParser rp{ctx}; 567 const NotificationSettings& notification_settings) {
612 m_system_settings.notification_settings = rp.PopRaw<NotificationSettings>();
613 SetSaveNeeded();
614
615 LOG_INFO(Service_SET, "called, flags={}, volume={}, head_time={}:{}, tailt_time={}:{}", 568 LOG_INFO(Service_SET, "called, flags={}, volume={}, head_time={}:{}, tailt_time={}:{}",
616 m_system_settings.notification_settings.flags.raw, 569 notification_settings.flags.raw, notification_settings.volume,
617 m_system_settings.notification_settings.volume, 570 notification_settings.start_time.hour, notification_settings.start_time.minute,
618 m_system_settings.notification_settings.start_time.hour, 571 notification_settings.stop_time.hour, notification_settings.stop_time.minute);
619 m_system_settings.notification_settings.start_time.minute,
620 m_system_settings.notification_settings.stop_time.hour,
621 m_system_settings.notification_settings.stop_time.minute);
622 572
623 IPC::ResponseBuilder rb{ctx, 2}; 573 m_system_settings.notification_settings = notification_settings;
624 rb.Push(ResultSuccess); 574 SetSaveNeeded();
575 R_SUCCEED();
625} 576}
626 577
627void ISystemSettingsServer::GetAccountNotificationSettings(HLERequestContext& ctx) { 578Result ISystemSettingsServer::GetAccountNotificationSettings(
579 Out<s32> out_count, OutArray<AccountNotificationSettings, BufferAttr_HipcMapAlias>
580 out_account_notification_settings) {
628 LOG_INFO(Service_SET, "called, elements={}", 581 LOG_INFO(Service_SET, "called, elements={}",
629 m_system_settings.account_notification_settings_count); 582 m_system_settings.account_notification_settings_count);
630 583
631 ctx.WriteBuffer(m_system_settings.account_notification_settings); 584 *out_count = std::min(m_system_settings.account_notification_settings_count,
585 static_cast<s32>(out_account_notification_settings.size()));
586 memcpy(out_account_notification_settings.data(),
587 m_system_settings.account_notification_settings.data(),
588 static_cast<std::size_t>(*out_count) * sizeof(AccountNotificationSettings));
632 589
633 IPC::ResponseBuilder rb{ctx, 3}; 590 R_SUCCEED();
634 rb.Push(ResultSuccess);
635 rb.Push(m_system_settings.account_notification_settings_count);
636} 591}
637 592
638void ISystemSettingsServer::SetAccountNotificationSettings(HLERequestContext& ctx) { 593Result ISystemSettingsServer::SetAccountNotificationSettings(
639 const auto elements = ctx.GetReadBufferNumElements<AccountNotificationSettings>(); 594 InArray<AccountNotificationSettings, BufferAttr_HipcMapAlias> account_notification_settings) {
640 const auto buffer_data = ctx.ReadBuffer(); 595 LOG_INFO(Service_SET, "called, elements={}", account_notification_settings.size());
641
642 LOG_INFO(Service_SET, "called, elements={}", elements);
643 596
644 ASSERT(elements <= m_system_settings.account_notification_settings.size()); 597 ASSERT(account_notification_settings.size() <=
598 m_system_settings.account_notification_settings.size());
645 599
646 m_system_settings.account_notification_settings_count = static_cast<u32>(elements); 600 m_system_settings.account_notification_settings_count =
647 std::memcpy(&m_system_settings.account_notification_settings, buffer_data.data(), 601 static_cast<s32>(account_notification_settings.size());
648 elements * sizeof(AccountNotificationSettings)); 602 std::memcpy(m_system_settings.account_notification_settings.data(),
603 account_notification_settings.data(),
604 account_notification_settings.size() * sizeof(AccountNotificationSettings));
649 SetSaveNeeded(); 605 SetSaveNeeded();
650 606 R_SUCCEED();
651 IPC::ResponseBuilder rb{ctx, 2};
652 rb.Push(ResultSuccess);
653} 607}
654 608
655void ISystemSettingsServer::GetVibrationMasterVolume(HLERequestContext& ctx) { 609Result ISystemSettingsServer::GetVibrationMasterVolume(Out<f32> vibration_master_volume) {
656 f32 vibration_master_volume = {}; 610 LOG_INFO(Service_SET, "called, vibration_master_volume={}",
657 const auto result = GetVibrationMasterVolume(vibration_master_volume); 611 m_system_settings.vibration_master_volume);
658 612
659 LOG_INFO(Service_SET, "called, master_volume={}", vibration_master_volume); 613 *vibration_master_volume = m_system_settings.vibration_master_volume;
660 614 R_SUCCEED();
661 IPC::ResponseBuilder rb{ctx, 3};
662 rb.Push(result);
663 rb.Push(vibration_master_volume);
664} 615}
665 616
666void ISystemSettingsServer::SetVibrationMasterVolume(HLERequestContext& ctx) { 617Result ISystemSettingsServer::SetVibrationMasterVolume(f32 vibration_master_volume) {
667 IPC::RequestParser rp{ctx}; 618 LOG_INFO(Service_SET, "called, vibration_master_volume={}", vibration_master_volume);
668 const auto vibration_master_volume = rp.PopRaw<f32>();
669
670 LOG_INFO(Service_SET, "called, elements={}", m_system_settings.vibration_master_volume);
671 619
672 const auto result = SetVibrationMasterVolume(vibration_master_volume); 620 m_system_settings.vibration_master_volume = vibration_master_volume;
673 621 SetSaveNeeded();
674 IPC::ResponseBuilder rb{ctx, 2}; 622 R_SUCCEED();
675 rb.Push(result);
676} 623}
677 624
678// FIXME: implement support for the real system_settings.ini 625// FIXME: implement support for the real system_settings.ini
@@ -734,55 +681,38 @@ static Settings GetSettings() {
734 return ret; 681 return ret;
735} 682}
736 683
737void ISystemSettingsServer::GetSettingsItemValueSize(HLERequestContext& ctx) { 684Result ISystemSettingsServer::GetSettingsItemValueSize(
738 LOG_DEBUG(Service_SET, "called"); 685 Out<u64> out_size, InLargeData<SettingItemName, BufferAttr_HipcPointer> setting_category_buffer,
686 InLargeData<SettingItemName, BufferAttr_HipcPointer> setting_name_buffer) {
687 const std::string setting_category{Common::StringFromBuffer(*setting_category_buffer)};
688 const std::string setting_name{Common::StringFromBuffer(*setting_name_buffer)};
739 689
740 // The category of the setting. This corresponds to the top-level keys of 690 LOG_DEBUG(Service_SET, "called, category={}, name={}", setting_category, setting_name);
741 // system_settings.ini.
742 const auto setting_category_buf{ctx.ReadBuffer(0)};
743 const std::string setting_category{Common::StringFromBuffer(setting_category_buf)};
744 691
745 // The name of the setting. This corresponds to the second-level keys of 692 *out_size = 0;
746 // system_settings.ini.
747 const auto setting_name_buf{ctx.ReadBuffer(1)};
748 const std::string setting_name{Common::StringFromBuffer(setting_name_buf)};
749 693
750 auto settings{GetSettings()}; 694 auto settings{GetSettings()};
751 u64 response_size{0};
752
753 if (settings.contains(setting_category) && settings[setting_category].contains(setting_name)) { 695 if (settings.contains(setting_category) && settings[setting_category].contains(setting_name)) {
754 response_size = settings[setting_category][setting_name].size(); 696 *out_size = settings[setting_category][setting_name].size();
755 } 697 }
756 698
757 IPC::ResponseBuilder rb{ctx, 4}; 699 R_UNLESS(*out_size != 0, ResultUnknown);
758 rb.Push(response_size == 0 ? ResultUnknown : ResultSuccess); 700 R_SUCCEED();
759 rb.Push(response_size);
760} 701}
761 702
762void ISystemSettingsServer::GetSettingsItemValue(HLERequestContext& ctx) { 703Result ISystemSettingsServer::GetSettingsItemValue(
763 // The category of the setting. This corresponds to the top-level keys of 704 OutBuffer<BufferAttr_HipcMapAlias> out_data,
764 // system_settings.ini. 705 InLargeData<SettingItemName, BufferAttr_HipcPointer> setting_category_buffer,
765 const auto setting_category_buf{ctx.ReadBuffer(0)}; 706 InLargeData<SettingItemName, BufferAttr_HipcPointer> setting_name_buffer) {
766 const std::string setting_category{Common::StringFromBuffer(setting_category_buf)}; 707 const std::string setting_category{Common::StringFromBuffer(*setting_category_buffer)};
767 708 const std::string setting_name{Common::StringFromBuffer(*setting_name_buffer)};
768 // The name of the setting. This corresponds to the second-level keys of
769 // system_settings.ini.
770 const auto setting_name_buf{ctx.ReadBuffer(1)};
771 const std::string setting_name{Common::StringFromBuffer(setting_name_buf)};
772 709
773 std::vector<u8> value; 710 LOG_INFO(Service_SET, "called, category={}, name={}", setting_category, setting_name);
774 auto response = GetSettingsItemValue(value, setting_category, setting_name);
775 711
776 LOG_INFO(Service_SET, "called. category={}, name={} -- res=0x{:X}", setting_category, 712 R_RETURN(GetSettingsItemValueImpl(out_data, setting_category, setting_name));
777 setting_name, response.raw);
778
779 ctx.WriteBuffer(value.data(), value.size());
780
781 IPC::ResponseBuilder rb{ctx, 2};
782 rb.Push(response);
783} 713}
784 714
785void ISystemSettingsServer::GetTvSettings(HLERequestContext& ctx) { 715Result ISystemSettingsServer::GetTvSettings(Out<TvSettings> out_tv_settings) {
786 LOG_INFO(Service_SET, 716 LOG_INFO(Service_SET,
787 "called, flags={}, cmu_mode={}, contrast_ratio={}, hdmi_content_type={}, " 717 "called, flags={}, cmu_mode={}, contrast_ratio={}, hdmi_content_type={}, "
788 "rgb_range={}, tv_gama={}, tv_resolution={}, tv_underscan={}", 718 "rgb_range={}, tv_gama={}, tv_resolution={}, tv_underscan={}",
@@ -793,371 +723,335 @@ void ISystemSettingsServer::GetTvSettings(HLERequestContext& ctx) {
793 m_system_settings.tv_settings.tv_resolution, 723 m_system_settings.tv_settings.tv_resolution,
794 m_system_settings.tv_settings.tv_underscan); 724 m_system_settings.tv_settings.tv_underscan);
795 725
796 IPC::ResponseBuilder rb{ctx, 10}; 726 *out_tv_settings = m_system_settings.tv_settings;
797 rb.Push(ResultSuccess); 727 R_SUCCEED();
798 rb.PushRaw(m_system_settings.tv_settings);
799} 728}
800 729
801void ISystemSettingsServer::SetTvSettings(HLERequestContext& ctx) { 730Result ISystemSettingsServer::SetTvSettings(TvSettings tv_settings) {
802 IPC::RequestParser rp{ctx};
803 m_system_settings.tv_settings = rp.PopRaw<TvSettings>();
804 SetSaveNeeded();
805 731
806 LOG_INFO(Service_SET, 732 LOG_INFO(Service_SET,
807 "called, flags={}, cmu_mode={}, contrast_ratio={}, hdmi_content_type={}, " 733 "called, flags={}, cmu_mode={}, contrast_ratio={}, hdmi_content_type={}, "
808 "rgb_range={}, tv_gama={}, tv_resolution={}, tv_underscan={}", 734 "rgb_range={}, tv_gama={}, tv_resolution={}, tv_underscan={}",
809 m_system_settings.tv_settings.flags.raw, m_system_settings.tv_settings.cmu_mode, 735 tv_settings.flags.raw, tv_settings.cmu_mode, tv_settings.contrast_ratio,
810 m_system_settings.tv_settings.contrast_ratio, 736 tv_settings.hdmi_content_type, tv_settings.rgb_range, tv_settings.tv_gama,
811 m_system_settings.tv_settings.hdmi_content_type, 737 tv_settings.tv_resolution, tv_settings.tv_underscan);
812 m_system_settings.tv_settings.rgb_range, m_system_settings.tv_settings.tv_gama,
813 m_system_settings.tv_settings.tv_resolution,
814 m_system_settings.tv_settings.tv_underscan);
815 738
816 IPC::ResponseBuilder rb{ctx, 2}; 739 m_system_settings.tv_settings = tv_settings;
817 rb.Push(ResultSuccess); 740 SetSaveNeeded();
741 R_SUCCEED();
818} 742}
819 743
820void ISystemSettingsServer::GetAudioOutputMode(HLERequestContext& ctx) { 744Result ISystemSettingsServer::GetAudioOutputMode(Out<AudioOutputMode> out_output_mode,
821 IPC::RequestParser rp{ctx}; 745 AudioOutputModeTarget target) {
822 const auto target{rp.PopEnum<AudioOutputModeTarget>()}; 746 switch (target) {
823 747 case AudioOutputModeTarget::Hdmi:
824 AudioOutputMode output_mode{}; 748 *out_output_mode = m_system_settings.audio_output_mode_hdmi;
825 const auto result = GetAudioOutputMode(output_mode, target); 749 break;
826 750 case AudioOutputModeTarget::Speaker:
827 LOG_INFO(Service_SET, "called, target={}, output_mode={}", target, output_mode); 751 *out_output_mode = m_system_settings.audio_output_mode_speaker;
752 break;
753 case AudioOutputModeTarget::Headphone:
754 *out_output_mode = m_system_settings.audio_output_mode_headphone;
755 break;
756 case AudioOutputModeTarget::Type3:
757 *out_output_mode = m_system_settings.audio_output_mode_type3;
758 break;
759 case AudioOutputModeTarget::Type4:
760 *out_output_mode = m_system_settings.audio_output_mode_type4;
761 break;
762 default:
763 LOG_ERROR(Service_SET, "Invalid audio output mode target {}", target);
764 }
828 765
829 IPC::ResponseBuilder rb{ctx, 3}; 766 LOG_INFO(Service_SET, "called, target={}, output_mode={}", target, *out_output_mode);
830 rb.Push(result); 767 R_SUCCEED();
831 rb.PushEnum(output_mode);
832} 768}
833 769
834void ISystemSettingsServer::SetAudioOutputMode(HLERequestContext& ctx) { 770Result ISystemSettingsServer::SetAudioOutputMode(AudioOutputModeTarget target,
835 IPC::RequestParser rp{ctx}; 771 AudioOutputMode output_mode) {
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); 772 LOG_INFO(Service_SET, "called, target={}, output_mode={}", target, output_mode);
842 773
843 IPC::ResponseBuilder rb{ctx, 2}; 774 switch (target) {
844 rb.Push(result); 775 case AudioOutputModeTarget::Hdmi:
776 m_system_settings.audio_output_mode_hdmi = output_mode;
777 break;
778 case AudioOutputModeTarget::Speaker:
779 m_system_settings.audio_output_mode_speaker = output_mode;
780 break;
781 case AudioOutputModeTarget::Headphone:
782 m_system_settings.audio_output_mode_headphone = output_mode;
783 break;
784 case AudioOutputModeTarget::Type3:
785 m_system_settings.audio_output_mode_type3 = output_mode;
786 break;
787 case AudioOutputModeTarget::Type4:
788 m_system_settings.audio_output_mode_type4 = output_mode;
789 break;
790 default:
791 LOG_ERROR(Service_SET, "Invalid audio output mode target {}", target);
792 }
793
794 SetSaveNeeded();
795 R_SUCCEED();
845} 796}
846 797
847void ISystemSettingsServer::GetSpeakerAutoMuteFlag(HLERequestContext& ctx) { 798Result ISystemSettingsServer::GetSpeakerAutoMuteFlag(
799 Out<bool> out_force_mute_on_headphone_removed) {
848 LOG_INFO(Service_SET, "called, force_mute_on_headphone_removed={}", 800 LOG_INFO(Service_SET, "called, force_mute_on_headphone_removed={}",
849 m_system_settings.force_mute_on_headphone_removed); 801 m_system_settings.force_mute_on_headphone_removed);
850 802
851 IPC::ResponseBuilder rb{ctx, 3}; 803 *out_force_mute_on_headphone_removed = m_system_settings.force_mute_on_headphone_removed;
852 rb.Push(ResultSuccess); 804 R_SUCCEED();
853 rb.PushRaw(m_system_settings.force_mute_on_headphone_removed);
854} 805}
855 806
856void ISystemSettingsServer::SetSpeakerAutoMuteFlag(HLERequestContext& ctx) { 807Result ISystemSettingsServer::SetSpeakerAutoMuteFlag(bool force_mute_on_headphone_removed) {
857 IPC::RequestParser rp{ctx};
858 m_system_settings.force_mute_on_headphone_removed = rp.PopRaw<bool>();
859 SetSaveNeeded();
860
861 LOG_INFO(Service_SET, "called, force_mute_on_headphone_removed={}", 808 LOG_INFO(Service_SET, "called, force_mute_on_headphone_removed={}",
862 m_system_settings.force_mute_on_headphone_removed); 809 force_mute_on_headphone_removed);
863 810
864 IPC::ResponseBuilder rb{ctx, 2}; 811 m_system_settings.force_mute_on_headphone_removed = force_mute_on_headphone_removed;
865 rb.Push(ResultSuccess); 812 SetSaveNeeded();
813 R_SUCCEED();
866} 814}
867 815
868void ISystemSettingsServer::GetQuestFlag(HLERequestContext& ctx) { 816Result ISystemSettingsServer::GetQuestFlag(Out<QuestFlag> out_quest_flag) {
869 LOG_INFO(Service_SET, "called, quest_flag={}", m_system_settings.quest_flag); 817 LOG_INFO(Service_SET, "called, quest_flag={}", m_system_settings.quest_flag);
870 818
871 IPC::ResponseBuilder rb{ctx, 3}; 819 *out_quest_flag = m_system_settings.quest_flag;
872 rb.Push(ResultSuccess); 820 R_SUCCEED();
873 rb.PushEnum(m_system_settings.quest_flag);
874} 821}
875 822
876void ISystemSettingsServer::SetQuestFlag(HLERequestContext& ctx) { 823Result ISystemSettingsServer::SetQuestFlag(QuestFlag quest_flag) {
877 IPC::RequestParser rp{ctx}; 824 LOG_INFO(Service_SET, "called, quest_flag={}", quest_flag);
878 m_system_settings.quest_flag = rp.PopEnum<QuestFlag>();
879 SetSaveNeeded();
880 825
881 LOG_INFO(Service_SET, "called, quest_flag={}", m_system_settings.quest_flag); 826 m_system_settings.quest_flag = quest_flag;
882 827 SetSaveNeeded();
883 IPC::ResponseBuilder rb{ctx, 2}; 828 R_SUCCEED();
884 rb.Push(ResultSuccess);
885} 829}
886 830
887void ISystemSettingsServer::GetDeviceTimeZoneLocationName(HLERequestContext& ctx) { 831Result ISystemSettingsServer::GetDeviceTimeZoneLocationName(
832 Out<Service::PSC::Time::LocationName> out_name) {
888 LOG_INFO(Service_SET, "called"); 833 LOG_INFO(Service_SET, "called");
889 834
890 Service::PSC::Time::LocationName name{}; 835 *out_name = m_system_settings.device_time_zone_location_name;
891 const auto res = GetDeviceTimeZoneLocationName(name); 836 R_SUCCEED();
892
893 IPC::ResponseBuilder rb{ctx, 2 + sizeof(Service::PSC::Time::LocationName) / sizeof(u32)};
894 rb.Push(res);
895 rb.PushRaw<Service::PSC::Time::LocationName>(name);
896} 837}
897 838
898void ISystemSettingsServer::SetDeviceTimeZoneLocationName(HLERequestContext& ctx) { 839Result ISystemSettingsServer::SetDeviceTimeZoneLocationName(
840 const Service::PSC::Time::LocationName& name) {
899 LOG_INFO(Service_SET, "called"); 841 LOG_INFO(Service_SET, "called");
900 842
901 IPC::RequestParser rp{ctx}; 843 m_system_settings.device_time_zone_location_name = name;
902 auto name{rp.PopRaw<Service::PSC::Time::LocationName>()};
903
904 const auto res = SetDeviceTimeZoneLocationName(name);
905
906 IPC::ResponseBuilder rb{ctx, 2};
907 rb.Push(res);
908}
909
910void ISystemSettingsServer::SetRegionCode(HLERequestContext& ctx) {
911 IPC::RequestParser rp{ctx};
912 m_system_settings.region_code = rp.PopEnum<SystemRegionCode>();
913 SetSaveNeeded(); 844 SetSaveNeeded();
914 845 R_SUCCEED();
915 LOG_INFO(Service_SET, "called, region_code={}", m_system_settings.region_code);
916
917 IPC::ResponseBuilder rb{ctx, 2};
918 rb.Push(ResultSuccess);
919} 846}
920 847
921void ISystemSettingsServer::GetNetworkSystemClockContext(HLERequestContext& ctx) { 848Result ISystemSettingsServer::SetRegionCode(SystemRegionCode region_code) {
922 LOG_INFO(Service_SET, "called"); 849 LOG_INFO(Service_SET, "called, region_code={}", region_code);
923 850
924 Service::PSC::Time::SystemClockContext context{}; 851 m_system_settings.region_code = region_code;
925 const auto res = GetNetworkSystemClockContext(context); 852 SetSaveNeeded();
926 853 R_SUCCEED();
927 IPC::ResponseBuilder rb{ctx, 2 + sizeof(Service::PSC::Time::SystemClockContext) / sizeof(u32)};
928 rb.Push(res);
929 rb.PushRaw(context);
930} 854}
931 855
932void ISystemSettingsServer::SetNetworkSystemClockContext(HLERequestContext& ctx) { 856Result ISystemSettingsServer::GetNetworkSystemClockContext(
857 Out<Service::PSC::Time::SystemClockContext> out_context) {
933 LOG_INFO(Service_SET, "called"); 858 LOG_INFO(Service_SET, "called");
934 859
935 IPC::RequestParser rp{ctx}; 860 *out_context = m_system_settings.network_system_clock_context;
936 const auto context{rp.PopRaw<Service::PSC::Time::SystemClockContext>()}; 861 R_SUCCEED();
937
938 const auto res = SetNetworkSystemClockContext(context);
939
940 IPC::ResponseBuilder rb{ctx, 2};
941 rb.Push(res);
942} 862}
943 863
944void ISystemSettingsServer::IsUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx) { 864Result ISystemSettingsServer::SetNetworkSystemClockContext(
865 const Service::PSC::Time::SystemClockContext& context) {
945 LOG_INFO(Service_SET, "called"); 866 LOG_INFO(Service_SET, "called");
946 867
947 bool enabled{}; 868 m_system_settings.network_system_clock_context = context;
948 const auto res = IsUserSystemClockAutomaticCorrectionEnabled(enabled); 869 SetSaveNeeded();
949 870 R_SUCCEED();
950 IPC::ResponseBuilder rb{ctx, 3};
951 rb.Push(res);
952 rb.PushRaw(enabled);
953} 871}
954 872
955void ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx) { 873Result ISystemSettingsServer::IsUserSystemClockAutomaticCorrectionEnabled(
956 LOG_INFO(Service_SET, "called"); 874 Out<bool> out_automatic_correction_enabled) {
875 LOG_INFO(Service_SET, "called, out_automatic_correction_enabled={}",
876 m_system_settings.user_system_clock_automatic_correction_enabled);
957 877
958 IPC::RequestParser rp{ctx}; 878 *out_automatic_correction_enabled =
959 auto enabled{rp.Pop<bool>()}; 879 m_system_settings.user_system_clock_automatic_correction_enabled;
880 R_SUCCEED();
881}
960 882
961 const auto res = SetUserSystemClockAutomaticCorrectionEnabled(enabled); 883Result ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionEnabled(
884 bool automatic_correction_enabled) {
885 LOG_INFO(Service_SET, "called, out_automatic_correction_enabled={}",
886 automatic_correction_enabled);
962 887
963 IPC::ResponseBuilder rb{ctx, 2}; 888 m_system_settings.user_system_clock_automatic_correction_enabled = automatic_correction_enabled;
964 rb.Push(res); 889 SetSaveNeeded();
890 R_SUCCEED();
965} 891}
966 892
967void ISystemSettingsServer::GetDebugModeFlag(HLERequestContext& ctx) { 893Result ISystemSettingsServer::GetDebugModeFlag(Out<bool> is_debug_mode_enabled) {
968 bool is_debug_mode_enabled = false; 894 const auto result = GetSettingsItemValueImpl<bool>(*is_debug_mode_enabled, "settings_debug",
969 GetSettingsItemValue<bool>(is_debug_mode_enabled, "settings_debug", "is_debug_mode_enabled"); 895 "is_debug_mode_enabled");
970 896
971 LOG_DEBUG(Service_SET, "called, is_debug_mode_enabled={}", is_debug_mode_enabled); 897 LOG_DEBUG(Service_SET, "called, is_debug_mode_enabled={}", *is_debug_mode_enabled);
972 898 R_RETURN(result);
973 IPC::ResponseBuilder rb{ctx, 3};
974 rb.Push(ResultSuccess);
975 rb.Push(is_debug_mode_enabled);
976} 899}
977 900
978void ISystemSettingsServer::GetPrimaryAlbumStorage(HLERequestContext& ctx) { 901Result ISystemSettingsServer::GetPrimaryAlbumStorage(
902 Out<PrimaryAlbumStorage> out_primary_album_storage) {
979 LOG_INFO(Service_SET, "called, primary_album_storage={}", 903 LOG_INFO(Service_SET, "called, primary_album_storage={}",
980 m_system_settings.primary_album_storage); 904 m_system_settings.primary_album_storage);
981 905
982 IPC::ResponseBuilder rb{ctx, 3}; 906 *out_primary_album_storage = m_system_settings.primary_album_storage;
983 rb.Push(ResultSuccess); 907 R_SUCCEED();
984 rb.PushEnum(m_system_settings.primary_album_storage);
985} 908}
986 909
987void ISystemSettingsServer::SetPrimaryAlbumStorage(HLERequestContext& ctx) { 910Result ISystemSettingsServer::SetPrimaryAlbumStorage(PrimaryAlbumStorage primary_album_storage) {
988 IPC::RequestParser rp{ctx}; 911 LOG_INFO(Service_SET, "called, primary_album_storage={}", primary_album_storage);
989 m_system_settings.primary_album_storage = rp.PopEnum<PrimaryAlbumStorage>();
990 SetSaveNeeded();
991 912
992 LOG_INFO(Service_SET, "called, primary_album_storage={}", 913 m_system_settings.primary_album_storage = primary_album_storage;
993 m_system_settings.primary_album_storage); 914 SetSaveNeeded();
994 915 R_SUCCEED();
995 IPC::ResponseBuilder rb{ctx, 2};
996 rb.Push(ResultSuccess);
997} 916}
998 917
999void ISystemSettingsServer::GetBatteryLot(HLERequestContext& ctx) { 918Result ISystemSettingsServer::GetBatteryLot(Out<BatteryLot> out_battery_lot) {
1000 BatteryLot battery_lot = {"YUZUEMULATOR123456789"};
1001
1002 LOG_INFO(Service_SET, "called"); 919 LOG_INFO(Service_SET, "called");
1003 920
1004 IPC::ResponseBuilder rb{ctx, 8}; 921 *out_battery_lot = {"YUZU0EMULATOR14022024"};
1005 rb.Push(ResultSuccess); 922 R_SUCCEED();
1006 rb.PushRaw(battery_lot);
1007} 923}
1008 924
1009void ISystemSettingsServer::GetSerialNumber(HLERequestContext& ctx) { 925Result ISystemSettingsServer::GetSerialNumber(Out<SerialNumber> out_console_serial) {
1010 SerialNumber console_serial = {"YUZ10012345678"};
1011
1012 LOG_INFO(Service_SET, "called"); 926 LOG_INFO(Service_SET, "called");
1013 927
1014 IPC::ResponseBuilder rb{ctx, 8}; 928 *out_console_serial = {"YUZ10000000001"};
1015 rb.Push(ResultSuccess); 929 R_SUCCEED();
1016 rb.PushRaw(console_serial);
1017} 930}
1018 931
1019void ISystemSettingsServer::GetNfcEnableFlag(HLERequestContext& ctx) { 932Result ISystemSettingsServer::GetNfcEnableFlag(Out<bool> out_nfc_enable_flag) {
1020 LOG_INFO(Service_SET, "called, nfc_enable_flag={}", m_system_settings.nfc_enable_flag); 933 LOG_INFO(Service_SET, "called, nfc_enable_flag={}", m_system_settings.nfc_enable_flag);
1021 934
1022 IPC::ResponseBuilder rb{ctx, 3}; 935 *out_nfc_enable_flag = m_system_settings.nfc_enable_flag;
1023 rb.Push(ResultSuccess); 936 R_SUCCEED();
1024 rb.Push<u8>(m_system_settings.nfc_enable_flag);
1025} 937}
1026 938
1027void ISystemSettingsServer::SetNfcEnableFlag(HLERequestContext& ctx) { 939Result ISystemSettingsServer::SetNfcEnableFlag(bool nfc_enable_flag) {
1028 IPC::RequestParser rp{ctx}; 940 LOG_INFO(Service_SET, "called, nfc_enable_flag={}", nfc_enable_flag);
1029 m_system_settings.nfc_enable_flag = rp.Pop<bool>();
1030 SetSaveNeeded();
1031
1032 LOG_INFO(Service_SET, "called, nfc_enable_flag={}", m_system_settings.nfc_enable_flag);
1033 941
1034 IPC::ResponseBuilder rb{ctx, 2}; 942 m_system_settings.nfc_enable_flag = nfc_enable_flag;
1035 rb.Push(ResultSuccess); 943 SetSaveNeeded();
944 R_SUCCEED();
1036} 945}
1037 946
1038void ISystemSettingsServer::GetSleepSettings(HLERequestContext& ctx) { 947Result ISystemSettingsServer::GetSleepSettings(Out<SleepSettings> out_sleep_settings) {
1039 LOG_INFO(Service_SET, "called, flags={}, handheld_sleep_plan={}, console_sleep_plan={}", 948 LOG_INFO(Service_SET, "called, flags={}, handheld_sleep_plan={}, console_sleep_plan={}",
1040 m_system_settings.sleep_settings.flags.raw, 949 m_system_settings.sleep_settings.flags.raw,
1041 m_system_settings.sleep_settings.handheld_sleep_plan, 950 m_system_settings.sleep_settings.handheld_sleep_plan,
1042 m_system_settings.sleep_settings.console_sleep_plan); 951 m_system_settings.sleep_settings.console_sleep_plan);
1043 952
1044 IPC::ResponseBuilder rb{ctx, 5}; 953 *out_sleep_settings = m_system_settings.sleep_settings;
1045 rb.Push(ResultSuccess); 954 R_SUCCEED();
1046 rb.PushRaw(m_system_settings.sleep_settings);
1047} 955}
1048 956
1049void ISystemSettingsServer::SetSleepSettings(HLERequestContext& ctx) { 957Result ISystemSettingsServer::SetSleepSettings(SleepSettings sleep_settings) {
1050 IPC::RequestParser rp{ctx};
1051 m_system_settings.sleep_settings = rp.PopRaw<SleepSettings>();
1052 SetSaveNeeded();
1053
1054 LOG_INFO(Service_SET, "called, flags={}, handheld_sleep_plan={}, console_sleep_plan={}", 958 LOG_INFO(Service_SET, "called, flags={}, handheld_sleep_plan={}, console_sleep_plan={}",
1055 m_system_settings.sleep_settings.flags.raw, 959 sleep_settings.flags.raw, sleep_settings.handheld_sleep_plan,
1056 m_system_settings.sleep_settings.handheld_sleep_plan, 960 sleep_settings.console_sleep_plan);
1057 m_system_settings.sleep_settings.console_sleep_plan);
1058 961
1059 IPC::ResponseBuilder rb{ctx, 2}; 962 m_system_settings.sleep_settings = sleep_settings;
1060 rb.Push(ResultSuccess); 963 SetSaveNeeded();
964 R_SUCCEED();
1061} 965}
1062 966
1063void ISystemSettingsServer::GetWirelessLanEnableFlag(HLERequestContext& ctx) { 967Result ISystemSettingsServer::GetWirelessLanEnableFlag(Out<bool> out_wireless_lan_enable_flag) {
1064 LOG_INFO(Service_SET, "called, wireless_lan_enable_flag={}", 968 LOG_INFO(Service_SET, "called, wireless_lan_enable_flag={}",
1065 m_system_settings.wireless_lan_enable_flag); 969 m_system_settings.wireless_lan_enable_flag);
1066 970
1067 IPC::ResponseBuilder rb{ctx, 3}; 971 *out_wireless_lan_enable_flag = m_system_settings.wireless_lan_enable_flag;
1068 rb.Push(ResultSuccess); 972 R_SUCCEED();
1069 rb.Push(m_system_settings.wireless_lan_enable_flag);
1070} 973}
1071 974
1072void ISystemSettingsServer::SetWirelessLanEnableFlag(HLERequestContext& ctx) { 975Result ISystemSettingsServer::SetWirelessLanEnableFlag(bool wireless_lan_enable_flag) {
1073 IPC::RequestParser rp{ctx}; 976 LOG_INFO(Service_SET, "called, wireless_lan_enable_flag={}", wireless_lan_enable_flag);
1074 m_system_settings.wireless_lan_enable_flag = rp.Pop<bool>();
1075 SetSaveNeeded();
1076
1077 LOG_INFO(Service_SET, "called, wireless_lan_enable_flag={}",
1078 m_system_settings.wireless_lan_enable_flag);
1079 977
1080 IPC::ResponseBuilder rb{ctx, 2}; 978 m_system_settings.wireless_lan_enable_flag = wireless_lan_enable_flag;
1081 rb.Push(ResultSuccess); 979 SetSaveNeeded();
980 R_SUCCEED();
1082} 981}
1083 982
1084void ISystemSettingsServer::GetInitialLaunchSettings(HLERequestContext& ctx) { 983Result ISystemSettingsServer::GetInitialLaunchSettings(
984 Out<InitialLaunchSettings> out_initial_launch_settings) {
1085 LOG_INFO(Service_SET, "called, flags={}, timestamp={}", 985 LOG_INFO(Service_SET, "called, flags={}, timestamp={}",
1086 m_system_settings.initial_launch_settings_packed.flags.raw, 986 m_system_settings.initial_launch_settings_packed.flags.raw,
1087 m_system_settings.initial_launch_settings_packed.timestamp.time_point); 987 m_system_settings.initial_launch_settings_packed.timestamp.time_point);
1088 988
1089 IPC::ResponseBuilder rb{ctx, 10}; 989 *out_initial_launch_settings = {
1090 rb.Push(ResultSuccess); 990 .flags = m_system_settings.initial_launch_settings_packed.flags,
1091 rb.PushRaw(m_system_settings.initial_launch_settings_packed); 991 .timestamp = m_system_settings.initial_launch_settings_packed.timestamp,
992 };
993 R_SUCCEED();
1092} 994}
1093 995
1094void ISystemSettingsServer::SetInitialLaunchSettings(HLERequestContext& ctx) { 996Result ISystemSettingsServer::SetInitialLaunchSettings(
1095 IPC::RequestParser rp{ctx}; 997 InitialLaunchSettings initial_launch_settings) {
1096 auto initial_launch_settings = rp.PopRaw<InitialLaunchSettings>(); 998 LOG_INFO(Service_SET, "called, flags={}, timestamp={}", initial_launch_settings.flags.raw,
999 initial_launch_settings.timestamp.time_point);
1097 1000
1098 m_system_settings.initial_launch_settings_packed.flags = initial_launch_settings.flags; 1001 m_system_settings.initial_launch_settings_packed.flags = initial_launch_settings.flags;
1099 m_system_settings.initial_launch_settings_packed.timestamp = initial_launch_settings.timestamp; 1002 m_system_settings.initial_launch_settings_packed.timestamp = initial_launch_settings.timestamp;
1100 SetSaveNeeded(); 1003 SetSaveNeeded();
1101 1004 R_SUCCEED();
1102 LOG_INFO(Service_SET, "called, flags={}, timestamp={}",
1103 m_system_settings.initial_launch_settings_packed.flags.raw,
1104 m_system_settings.initial_launch_settings_packed.timestamp.time_point);
1105
1106 IPC::ResponseBuilder rb{ctx, 2};
1107 rb.Push(ResultSuccess);
1108} 1005}
1109 1006
1110void ISystemSettingsServer::GetDeviceNickName(HLERequestContext& ctx) { 1007Result ISystemSettingsServer::GetDeviceNickName(
1008 OutLargeData<std::array<u8, 0x80>, BufferAttr_HipcMapAlias> out_device_name) {
1111 LOG_DEBUG(Service_SET, "called"); 1009 LOG_DEBUG(Service_SET, "called");
1112 1010
1113 ctx.WriteBuffer(::Settings::values.device_name.GetValue()); 1011 *out_device_name = {};
1012 const auto device_name_buffer = ::Settings::values.device_name.GetValue().c_str();
1013 memcpy(out_device_name->data(), device_name_buffer,
1014 ::Settings::values.device_name.GetValue().size());
1114 1015
1115 IPC::ResponseBuilder rb{ctx, 2}; 1016 R_SUCCEED();
1116 rb.Push(ResultSuccess);
1117} 1017}
1118 1018
1119void ISystemSettingsServer::SetDeviceNickName(HLERequestContext& ctx) { 1019Result ISystemSettingsServer::SetDeviceNickName(
1120 const std::string device_name = Common::StringFromBuffer(ctx.ReadBuffer()); 1020 InLargeData<std::array<u8, 0x80>, BufferAttr_HipcMapAlias> device_name_buffer) {
1021 const std::string device_name = Common::StringFromBuffer(*device_name_buffer);
1121 1022
1122 LOG_INFO(Service_SET, "called, device_name={}", device_name); 1023 LOG_INFO(Service_SET, "called, device_name={}", device_name);
1123 1024
1124 ::Settings::values.device_name = device_name; 1025 ::Settings::values.device_name = device_name;
1125 1026 R_SUCCEED();
1126 IPC::ResponseBuilder rb{ctx, 2};
1127 rb.Push(ResultSuccess);
1128} 1027}
1129 1028
1130void ISystemSettingsServer::GetProductModel(HLERequestContext& ctx) { 1029Result ISystemSettingsServer::GetProductModel(Out<u32> out_product_model) {
1131 const u32 product_model = 1; 1030 const u32 product_model = 1;
1132 1031
1133 LOG_WARNING(Service_SET, "(STUBBED) called, product_model={}", product_model); 1032 LOG_WARNING(Service_SET, "(STUBBED) called, product_model={}", product_model);
1134 IPC::ResponseBuilder rb{ctx, 3}; 1033
1135 rb.Push(ResultSuccess); 1034 *out_product_model = product_model;
1136 rb.Push(product_model); 1035 R_SUCCEED();
1137} 1036}
1138 1037
1139void ISystemSettingsServer::GetBluetoothEnableFlag(HLERequestContext& ctx) { 1038Result ISystemSettingsServer::GetBluetoothEnableFlag(Out<bool> out_bluetooth_enable_flag) {
1140 LOG_INFO(Service_SET, "called, bluetooth_enable_flag={}", 1039 LOG_INFO(Service_SET, "called, bluetooth_enable_flag={}",
1141 m_system_settings.bluetooth_enable_flag); 1040 m_system_settings.bluetooth_enable_flag);
1142 1041
1143 IPC::ResponseBuilder rb{ctx, 3}; 1042 *out_bluetooth_enable_flag = m_system_settings.bluetooth_enable_flag;
1144 rb.Push(ResultSuccess); 1043 R_SUCCEED();
1145 rb.Push<u8>(m_system_settings.bluetooth_enable_flag);
1146} 1044}
1147 1045
1148void ISystemSettingsServer::SetBluetoothEnableFlag(HLERequestContext& ctx) { 1046Result ISystemSettingsServer::SetBluetoothEnableFlag(bool bluetooth_enable_flag) {
1149 IPC::RequestParser rp{ctx}; 1047 LOG_INFO(Service_SET, "called, bluetooth_enable_flag={}", bluetooth_enable_flag);
1150 m_system_settings.bluetooth_enable_flag = rp.Pop<bool>();
1151 SetSaveNeeded();
1152 1048
1153 LOG_INFO(Service_SET, "called, bluetooth_enable_flag={}", 1049 m_system_settings.bluetooth_enable_flag = bluetooth_enable_flag;
1154 m_system_settings.bluetooth_enable_flag); 1050 SetSaveNeeded();
1155 1051 R_SUCCEED();
1156 IPC::ResponseBuilder rb{ctx, 2};
1157 rb.Push(ResultSuccess);
1158} 1052}
1159 1053
1160void ISystemSettingsServer::GetMiiAuthorId(HLERequestContext& ctx) { 1054Result ISystemSettingsServer::GetMiiAuthorId(Out<Common::UUID> out_mii_author_id) {
1161 if (m_system_settings.mii_author_id.IsInvalid()) { 1055 if (m_system_settings.mii_author_id.IsInvalid()) {
1162 m_system_settings.mii_author_id = Common::UUID::MakeDefault(); 1056 m_system_settings.mii_author_id = Common::UUID::MakeDefault();
1163 SetSaveNeeded(); 1057 SetSaveNeeded();
@@ -1166,282 +1060,224 @@ void ISystemSettingsServer::GetMiiAuthorId(HLERequestContext& ctx) {
1166 LOG_INFO(Service_SET, "called, author_id={}", 1060 LOG_INFO(Service_SET, "called, author_id={}",
1167 m_system_settings.mii_author_id.FormattedString()); 1061 m_system_settings.mii_author_id.FormattedString());
1168 1062
1169 IPC::ResponseBuilder rb{ctx, 6}; 1063 *out_mii_author_id = m_system_settings.mii_author_id;
1170 rb.Push(ResultSuccess); 1064 R_SUCCEED();
1171 rb.PushRaw(m_system_settings.mii_author_id);
1172} 1065}
1173 1066
1174void ISystemSettingsServer::GetAutoUpdateEnableFlag(HLERequestContext& ctx) { 1067Result ISystemSettingsServer::GetAutoUpdateEnableFlag(Out<bool> out_auto_update_enable_flag) {
1175 LOG_INFO(Service_SET, "called, auto_update_flag={}", m_system_settings.auto_update_enable_flag); 1068 LOG_INFO(Service_SET, "called, auto_update_flag={}", m_system_settings.auto_update_enable_flag);
1176 1069
1177 IPC::ResponseBuilder rb{ctx, 3}; 1070 *out_auto_update_enable_flag = m_system_settings.auto_update_enable_flag;
1178 rb.Push(ResultSuccess); 1071 R_SUCCEED();
1179 rb.Push(m_system_settings.auto_update_enable_flag);
1180} 1072}
1181 1073
1182void ISystemSettingsServer::SetAutoUpdateEnableFlag(HLERequestContext& ctx) { 1074Result ISystemSettingsServer::SetAutoUpdateEnableFlag(bool auto_update_enable_flag) {
1183 IPC::RequestParser rp{ctx}; 1075 LOG_INFO(Service_SET, "called, auto_update_flag={}", auto_update_enable_flag);
1184 m_system_settings.auto_update_enable_flag = rp.Pop<bool>();
1185 SetSaveNeeded();
1186 1076
1187 LOG_INFO(Service_SET, "called, auto_update_flag={}", m_system_settings.auto_update_enable_flag); 1077 m_system_settings.auto_update_enable_flag = auto_update_enable_flag;
1188 1078 SetSaveNeeded();
1189 IPC::ResponseBuilder rb{ctx, 2}; 1079 R_SUCCEED();
1190 rb.Push(ResultSuccess);
1191} 1080}
1192 1081
1193void ISystemSettingsServer::GetBatteryPercentageFlag(HLERequestContext& ctx) { 1082Result ISystemSettingsServer::GetBatteryPercentageFlag(Out<bool> out_battery_percentage_flag) {
1194 LOG_DEBUG(Service_SET, "called, battery_percentage_flag={}", 1083 LOG_DEBUG(Service_SET, "called, battery_percentage_flag={}",
1195 m_system_settings.battery_percentage_flag); 1084 m_system_settings.battery_percentage_flag);
1196 1085
1197 IPC::ResponseBuilder rb{ctx, 3}; 1086 *out_battery_percentage_flag = m_system_settings.battery_percentage_flag;
1198 rb.Push(ResultSuccess); 1087 R_SUCCEED();
1199 rb.Push(m_system_settings.battery_percentage_flag);
1200} 1088}
1201 1089
1202void ISystemSettingsServer::SetBatteryPercentageFlag(HLERequestContext& ctx) { 1090Result ISystemSettingsServer::SetBatteryPercentageFlag(bool battery_percentage_flag) {
1203 IPC::RequestParser rp{ctx}; 1091 LOG_INFO(Service_SET, "called, battery_percentage_flag={}", battery_percentage_flag);
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 1092
1210 IPC::ResponseBuilder rb{ctx, 2}; 1093 m_system_settings.battery_percentage_flag = battery_percentage_flag;
1211 rb.Push(ResultSuccess); 1094 SetSaveNeeded();
1095 R_SUCCEED();
1212} 1096}
1213 1097
1214void ISystemSettingsServer::SetExternalSteadyClockInternalOffset(HLERequestContext& ctx) { 1098Result ISystemSettingsServer::SetExternalSteadyClockInternalOffset(s64 offset) {
1215 LOG_DEBUG(Service_SET, "called."); 1099 LOG_DEBUG(Service_SET, "called, external_steady_clock_internal_offset={}", offset);
1216
1217 IPC::RequestParser rp{ctx};
1218 auto offset{rp.Pop<s64>()};
1219
1220 const auto res = SetExternalSteadyClockInternalOffset(offset);
1221 1100
1222 IPC::ResponseBuilder rb{ctx, 2}; 1101 m_private_settings.external_steady_clock_internal_offset = offset;
1223 rb.Push(res); 1102 SetSaveNeeded();
1103 R_SUCCEED();
1224} 1104}
1225 1105
1226void ISystemSettingsServer::GetExternalSteadyClockInternalOffset(HLERequestContext& ctx) { 1106Result ISystemSettingsServer::GetExternalSteadyClockInternalOffset(Out<s64> out_offset) {
1227 LOG_DEBUG(Service_SET, "called."); 1107 LOG_DEBUG(Service_SET, "called, external_steady_clock_internal_offset={}",
1108 m_private_settings.external_steady_clock_internal_offset);
1228 1109
1229 s64 offset{}; 1110 *out_offset = m_private_settings.external_steady_clock_internal_offset;
1230 const auto res = GetExternalSteadyClockInternalOffset(offset); 1111 R_SUCCEED();
1231
1232 IPC::ResponseBuilder rb{ctx, 4};
1233 rb.Push(res);
1234 rb.Push(offset);
1235} 1112}
1236 1113
1237void ISystemSettingsServer::GetPushNotificationActivityModeOnSleep(HLERequestContext& ctx) { 1114Result ISystemSettingsServer::GetPushNotificationActivityModeOnSleep(
1115 Out<s32> out_push_notification_activity_mode_on_sleep) {
1238 LOG_INFO(Service_SET, "called, push_notification_activity_mode_on_sleep={}", 1116 LOG_INFO(Service_SET, "called, push_notification_activity_mode_on_sleep={}",
1239 m_system_settings.push_notification_activity_mode_on_sleep); 1117 m_system_settings.push_notification_activity_mode_on_sleep);
1240 1118
1241 IPC::ResponseBuilder rb{ctx, 3}; 1119 *out_push_notification_activity_mode_on_sleep =
1242 rb.Push(ResultSuccess); 1120 m_system_settings.push_notification_activity_mode_on_sleep;
1243 rb.Push(m_system_settings.push_notification_activity_mode_on_sleep); 1121 R_SUCCEED();
1244} 1122}
1245 1123
1246void ISystemSettingsServer::SetPushNotificationActivityModeOnSleep(HLERequestContext& ctx) { 1124Result ISystemSettingsServer::SetPushNotificationActivityModeOnSleep(
1247 IPC::RequestParser rp{ctx}; 1125 s32 push_notification_activity_mode_on_sleep) {
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={}", 1126 LOG_INFO(Service_SET, "called, push_notification_activity_mode_on_sleep={}",
1252 m_system_settings.push_notification_activity_mode_on_sleep); 1127 push_notification_activity_mode_on_sleep);
1253 1128
1254 IPC::ResponseBuilder rb{ctx, 2}; 1129 m_system_settings.push_notification_activity_mode_on_sleep =
1255 rb.Push(ResultSuccess); 1130 push_notification_activity_mode_on_sleep;
1131 SetSaveNeeded();
1132 R_SUCCEED();
1256} 1133}
1257 1134
1258void ISystemSettingsServer::GetErrorReportSharePermission(HLERequestContext& ctx) { 1135Result ISystemSettingsServer::GetErrorReportSharePermission(
1136 Out<ErrorReportSharePermission> out_error_report_share_permission) {
1259 LOG_INFO(Service_SET, "called, error_report_share_permission={}", 1137 LOG_INFO(Service_SET, "called, error_report_share_permission={}",
1260 m_system_settings.error_report_share_permission); 1138 m_system_settings.error_report_share_permission);
1261 1139
1262 IPC::ResponseBuilder rb{ctx, 3}; 1140 *out_error_report_share_permission = m_system_settings.error_report_share_permission;
1263 rb.Push(ResultSuccess); 1141 R_SUCCEED();
1264 rb.PushEnum(m_system_settings.error_report_share_permission);
1265} 1142}
1266 1143
1267void ISystemSettingsServer::SetErrorReportSharePermission(HLERequestContext& ctx) { 1144Result ISystemSettingsServer::SetErrorReportSharePermission(
1268 IPC::RequestParser rp{ctx}; 1145 ErrorReportSharePermission error_report_share_permission) {
1269 m_system_settings.error_report_share_permission = rp.PopEnum<ErrorReportSharePermission>();
1270 SetSaveNeeded();
1271
1272 LOG_INFO(Service_SET, "called, error_report_share_permission={}", 1146 LOG_INFO(Service_SET, "called, error_report_share_permission={}",
1273 m_system_settings.error_report_share_permission); 1147 error_report_share_permission);
1274 1148
1275 IPC::ResponseBuilder rb{ctx, 2}; 1149 m_system_settings.error_report_share_permission = error_report_share_permission;
1276 rb.Push(ResultSuccess); 1150 SetSaveNeeded();
1151 R_SUCCEED();
1277} 1152}
1278 1153
1279void ISystemSettingsServer::GetAppletLaunchFlags(HLERequestContext& ctx) { 1154Result ISystemSettingsServer::GetAppletLaunchFlags(Out<u32> out_applet_launch_flag) {
1280 LOG_INFO(Service_SET, "called, applet_launch_flag={}", m_system_settings.applet_launch_flag); 1155 LOG_INFO(Service_SET, "called, applet_launch_flag={}", m_system_settings.applet_launch_flag);
1281 1156
1282 IPC::ResponseBuilder rb{ctx, 3}; 1157 *out_applet_launch_flag = m_system_settings.applet_launch_flag;
1283 rb.Push(ResultSuccess); 1158 R_SUCCEED();
1284 rb.Push(m_system_settings.applet_launch_flag);
1285} 1159}
1286 1160
1287void ISystemSettingsServer::SetAppletLaunchFlags(HLERequestContext& ctx) { 1161Result ISystemSettingsServer::SetAppletLaunchFlags(u32 applet_launch_flag) {
1288 IPC::RequestParser rp{ctx}; 1162 LOG_INFO(Service_SET, "called, applet_launch_flag={}", applet_launch_flag);
1289 m_system_settings.applet_launch_flag = rp.Pop<u32>();
1290 SetSaveNeeded();
1291
1292 LOG_INFO(Service_SET, "called, applet_launch_flag={}", m_system_settings.applet_launch_flag);
1293 1163
1294 IPC::ResponseBuilder rb{ctx, 2}; 1164 m_system_settings.applet_launch_flag = applet_launch_flag;
1295 rb.Push(ResultSuccess); 1165 SetSaveNeeded();
1166 R_SUCCEED();
1296} 1167}
1297 1168
1298void ISystemSettingsServer::GetKeyboardLayout(HLERequestContext& ctx) { 1169Result ISystemSettingsServer::GetKeyboardLayout(Out<KeyboardLayout> out_keyboard_layout) {
1299 LOG_INFO(Service_SET, "called, keyboard_layout={}", m_system_settings.keyboard_layout); 1170 LOG_INFO(Service_SET, "called, keyboard_layout={}", m_system_settings.keyboard_layout);
1300 1171
1301 IPC::ResponseBuilder rb{ctx, 3}; 1172 *out_keyboard_layout = m_system_settings.keyboard_layout;
1302 rb.Push(ResultSuccess); 1173 R_SUCCEED();
1303 rb.Push(static_cast<u32>(m_system_settings.keyboard_layout));
1304} 1174}
1305 1175
1306void ISystemSettingsServer::SetKeyboardLayout(HLERequestContext& ctx) { 1176Result ISystemSettingsServer::SetKeyboardLayout(KeyboardLayout keyboard_layout) {
1307 IPC::RequestParser rp{ctx}; 1177 LOG_INFO(Service_SET, "called, keyboard_layout={}", keyboard_layout);
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 1178
1313 IPC::ResponseBuilder rb{ctx, 2}; 1179 m_system_settings.keyboard_layout = keyboard_layout;
1314 rb.Push(ResultSuccess); 1180 R_SUCCEED();
1315} 1181}
1316 1182
1317void ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) { 1183Result ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime(
1184 Out<Service::PSC::Time::SteadyClockTimePoint> out_time_point) {
1318 LOG_INFO(Service_SET, "called"); 1185 LOG_INFO(Service_SET, "called");
1319 1186
1320 Service::PSC::Time::SteadyClockTimePoint time_point{}; 1187 *out_time_point = m_system_settings.device_time_zone_location_updated_time;
1321 const auto res = GetDeviceTimeZoneLocationUpdatedTime(time_point); 1188 R_SUCCEED();
1322
1323 IPC::ResponseBuilder rb{ctx, 4};
1324 rb.Push(res);
1325 rb.PushRaw<Service::PSC::Time::SteadyClockTimePoint>(time_point);
1326} 1189}
1327 1190
1328void ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) { 1191Result ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime(
1192 const Service::PSC::Time::SteadyClockTimePoint& time_point) {
1329 LOG_INFO(Service_SET, "called"); 1193 LOG_INFO(Service_SET, "called");
1330 1194
1331 IPC::RequestParser rp{ctx}; 1195 m_system_settings.device_time_zone_location_updated_time = time_point;
1332 auto time_point{rp.PopRaw<Service::PSC::Time::SteadyClockTimePoint>()}; 1196 SetSaveNeeded();
1333 1197 R_SUCCEED();
1334 const auto res = SetDeviceTimeZoneLocationUpdatedTime(time_point);
1335
1336 IPC::ResponseBuilder rb{ctx, 2};
1337 rb.Push(res);
1338} 1198}
1339 1199
1340void ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime( 1200Result ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime(
1341 HLERequestContext& ctx) { 1201 Out<Service::PSC::Time::SteadyClockTimePoint> out_time_point) {
1342 LOG_INFO(Service_SET, "called"); 1202 LOG_INFO(Service_SET, "called");
1343 1203
1344 Service::PSC::Time::SteadyClockTimePoint time_point{}; 1204 *out_time_point = m_system_settings.user_system_clock_automatic_correction_updated_time_point;
1345 const auto res = GetUserSystemClockAutomaticCorrectionUpdatedTime(time_point); 1205 R_SUCCEED();
1346
1347 IPC::ResponseBuilder rb{ctx, 4};
1348 rb.Push(res);
1349 rb.PushRaw<Service::PSC::Time::SteadyClockTimePoint>(time_point);
1350} 1206}
1351 1207
1352void ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime( 1208Result ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime(
1353 HLERequestContext& ctx) { 1209 const Service::PSC::Time::SteadyClockTimePoint& out_time_point) {
1354 LOG_INFO(Service_SET, "called"); 1210 LOG_INFO(Service_SET, "called");
1355 1211
1356 IPC::RequestParser rp{ctx}; 1212 m_system_settings.user_system_clock_automatic_correction_updated_time_point = out_time_point;
1357 const auto time_point{rp.PopRaw<Service::PSC::Time::SteadyClockTimePoint>()}; 1213 SetSaveNeeded();
1358 1214 R_SUCCEED();
1359 const auto res = SetUserSystemClockAutomaticCorrectionUpdatedTime(time_point);
1360
1361 IPC::ResponseBuilder rb{ctx, 2};
1362 rb.Push(res);
1363} 1215}
1364 1216
1365void ISystemSettingsServer::GetChineseTraditionalInputMethod(HLERequestContext& ctx) { 1217Result ISystemSettingsServer::GetChineseTraditionalInputMethod(
1218 Out<ChineseTraditionalInputMethod> out_chinese_traditional_input_method) {
1366 LOG_INFO(Service_SET, "called, chinese_traditional_input_method={}", 1219 LOG_INFO(Service_SET, "called, chinese_traditional_input_method={}",
1367 m_system_settings.chinese_traditional_input_method); 1220 m_system_settings.chinese_traditional_input_method);
1368 1221
1369 IPC::ResponseBuilder rb{ctx, 3}; 1222 *out_chinese_traditional_input_method = m_system_settings.chinese_traditional_input_method;
1370 rb.Push(ResultSuccess); 1223 R_SUCCEED();
1371 rb.PushEnum(m_system_settings.chinese_traditional_input_method);
1372} 1224}
1373 1225
1374void ISystemSettingsServer::GetHomeMenuScheme(HLERequestContext& ctx) { 1226Result ISystemSettingsServer::GetHomeMenuScheme(Out<HomeMenuScheme> out_home_menu_scheme) {
1375 LOG_DEBUG(Service_SET, "(STUBBED) called"); 1227 LOG_DEBUG(Service_SET, "(STUBBED) called");
1376 1228
1377 const HomeMenuScheme default_color = { 1229 *out_home_menu_scheme = {
1378 .main = 0xFF323232, 1230 .main = 0xFF323232,
1379 .back = 0xFF323232, 1231 .back = 0xFF323232,
1380 .sub = 0xFFFFFFFF, 1232 .sub = 0xFFFFFFFF,
1381 .bezel = 0xFFFFFFFF, 1233 .bezel = 0xFFFFFFFF,
1382 .extra = 0xFF000000, 1234 .extra = 0xFF000000,
1383 }; 1235 };
1384 1236 R_SUCCEED();
1385 IPC::ResponseBuilder rb{ctx, 2 + sizeof(HomeMenuScheme) / sizeof(u32)};
1386 rb.Push(ResultSuccess);
1387 rb.PushRaw(default_color);
1388} 1237}
1389 1238
1390void ISystemSettingsServer::GetHomeMenuSchemeModel(HLERequestContext& ctx) { 1239Result ISystemSettingsServer::GetHomeMenuSchemeModel(Out<u32> out_home_menu_scheme_model) {
1391 LOG_WARNING(Service_SET, "(STUBBED) called"); 1240 LOG_WARNING(Service_SET, "(STUBBED) called");
1392 1241
1393 IPC::ResponseBuilder rb{ctx, 3}; 1242 *out_home_menu_scheme_model = 0;
1394 rb.Push(ResultSuccess); 1243 R_SUCCEED();
1395 rb.Push(0);
1396} 1244}
1397 1245
1398void ISystemSettingsServer::GetTouchScreenMode(HLERequestContext& ctx) { 1246Result ISystemSettingsServer::GetTouchScreenMode(Out<TouchScreenMode> out_touch_screen_mode) {
1399 TouchScreenMode touch_screen_mode{}; 1247 LOG_INFO(Service_SET, "called, touch_screen_mode={}", m_system_settings.touch_screen_mode);
1400 auto res = GetTouchScreenMode(touch_screen_mode);
1401 1248
1402 LOG_INFO(Service_SET, "called, touch_screen_mode={}", touch_screen_mode); 1249 *out_touch_screen_mode = m_system_settings.touch_screen_mode;
1403 1250 R_SUCCEED();
1404 IPC::ResponseBuilder rb{ctx, 3};
1405 rb.Push(res);
1406 rb.PushEnum(touch_screen_mode);
1407} 1251}
1408 1252
1409void ISystemSettingsServer::SetTouchScreenMode(HLERequestContext& ctx) { 1253Result ISystemSettingsServer::SetTouchScreenMode(TouchScreenMode touch_screen_mode) {
1410 IPC::RequestParser rp{ctx};
1411 const auto touch_screen_mode = rp.PopEnum<TouchScreenMode>();
1412 auto res = SetTouchScreenMode(touch_screen_mode);
1413
1414 LOG_INFO(Service_SET, "called, touch_screen_mode={}", touch_screen_mode); 1254 LOG_INFO(Service_SET, "called, touch_screen_mode={}", touch_screen_mode);
1415 1255
1416 IPC::ResponseBuilder rb{ctx, 2}; 1256 m_system_settings.touch_screen_mode = touch_screen_mode;
1417 rb.Push(res); 1257 SetSaveNeeded();
1258 R_SUCCEED();
1418} 1259}
1419 1260
1420void ISystemSettingsServer::GetFieldTestingFlag(HLERequestContext& ctx) { 1261Result ISystemSettingsServer::GetFieldTestingFlag(Out<bool> out_field_testing_flag) {
1421 LOG_INFO(Service_SET, "called, field_testing_flag={}", m_system_settings.field_testing_flag); 1262 LOG_INFO(Service_SET, "called, field_testing_flag={}", m_system_settings.field_testing_flag);
1422 1263
1423 IPC::ResponseBuilder rb{ctx, 3}; 1264 *out_field_testing_flag = m_system_settings.field_testing_flag;
1424 rb.Push(ResultSuccess); 1265 R_SUCCEED();
1425 rb.Push(m_system_settings.field_testing_flag);
1426} 1266}
1427 1267
1428void ISystemSettingsServer::GetPanelCrcMode(HLERequestContext& ctx) { 1268Result ISystemSettingsServer::GetPanelCrcMode(Out<s32> out_panel_crc_mode) {
1429 LOG_INFO(Service_SET, "called, panel_crc_mode={}", m_system_settings.panel_crc_mode); 1269 LOG_INFO(Service_SET, "called, panel_crc_mode={}", m_system_settings.panel_crc_mode);
1430 1270
1431 IPC::ResponseBuilder rb{ctx, 3}; 1271 *out_panel_crc_mode = m_system_settings.panel_crc_mode;
1432 rb.Push(ResultSuccess); 1272 R_SUCCEED();
1433 rb.Push(m_system_settings.panel_crc_mode);
1434} 1273}
1435 1274
1436void ISystemSettingsServer::SetPanelCrcMode(HLERequestContext& ctx) { 1275Result ISystemSettingsServer::SetPanelCrcMode(s32 panel_crc_mode) {
1437 IPC::RequestParser rp{ctx}; 1276 LOG_INFO(Service_SET, "called, panel_crc_mode={}", panel_crc_mode);
1438 m_system_settings.panel_crc_mode = rp.PopRaw<s32>();
1439 SetSaveNeeded();
1440 1277
1441 LOG_INFO(Service_SET, "called, panel_crc_mode={}", m_system_settings.panel_crc_mode); 1278 m_system_settings.panel_crc_mode = panel_crc_mode;
1442 1279 SetSaveNeeded();
1443 IPC::ResponseBuilder rb{ctx, 2}; 1280 R_SUCCEED();
1444 rb.Push(ResultSuccess);
1445} 1281}
1446 1282
1447void ISystemSettingsServer::SetupSettings() { 1283void ISystemSettingsServer::SetupSettings() {
@@ -1513,9 +1349,9 @@ void ISystemSettingsServer::SetSaveNeeded() {
1513 m_save_needed = true; 1349 m_save_needed = true;
1514} 1350}
1515 1351
1516Result ISystemSettingsServer::GetSettingsItemValue(std::vector<u8>& out_value, 1352Result ISystemSettingsServer::GetSettingsItemValueImpl(std::vector<u8>& out_value,
1517 const std::string& category, 1353 const std::string& category,
1518 const std::string& name) { 1354 const std::string& name) {
1519 auto settings{GetSettings()}; 1355 auto settings{GetSettings()};
1520 R_UNLESS(settings.contains(category) && settings[category].contains(name), ResultUnknown); 1356 R_UNLESS(settings.contains(category) && settings[category].contains(name), ResultUnknown);
1521 1357
@@ -1523,184 +1359,4 @@ Result ISystemSettingsServer::GetSettingsItemValue(std::vector<u8>& out_value,
1523 R_SUCCEED(); 1359 R_SUCCEED();
1524} 1360}
1525 1361
1526Result ISystemSettingsServer::GetVibrationMasterVolume(f32& out_volume) const {
1527 out_volume = m_system_settings.vibration_master_volume;
1528 R_SUCCEED();
1529}
1530
1531Result ISystemSettingsServer::SetVibrationMasterVolume(f32 volume) {
1532 m_system_settings.vibration_master_volume = volume;
1533 SetSaveNeeded();
1534 R_SUCCEED();
1535}
1536
1537Result ISystemSettingsServer::GetAudioOutputMode(AudioOutputMode& out_output_mode,
1538 AudioOutputModeTarget target) const {
1539 switch (target) {
1540 case AudioOutputModeTarget::Hdmi:
1541 out_output_mode = m_system_settings.audio_output_mode_hdmi;
1542 break;
1543 case AudioOutputModeTarget::Speaker:
1544 out_output_mode = m_system_settings.audio_output_mode_speaker;
1545 break;
1546 case AudioOutputModeTarget::Headphone:
1547 out_output_mode = m_system_settings.audio_output_mode_headphone;
1548 break;
1549 case AudioOutputModeTarget::Type3:
1550 out_output_mode = m_system_settings.audio_output_mode_type3;
1551 break;
1552 case AudioOutputModeTarget::Type4:
1553 out_output_mode = m_system_settings.audio_output_mode_type4;
1554 break;
1555 default:
1556 LOG_ERROR(Service_SET, "Invalid audio output mode target {}", target);
1557 }
1558 R_SUCCEED();
1559}
1560
1561Result ISystemSettingsServer::SetAudioOutputMode(AudioOutputModeTarget target,
1562 AudioOutputMode output_mode) {
1563 switch (target) {
1564 case AudioOutputModeTarget::Hdmi:
1565 m_system_settings.audio_output_mode_hdmi = output_mode;
1566 break;
1567 case AudioOutputModeTarget::Speaker:
1568 m_system_settings.audio_output_mode_speaker = output_mode;
1569 break;
1570 case AudioOutputModeTarget::Headphone:
1571 m_system_settings.audio_output_mode_headphone = output_mode;
1572 break;
1573 case AudioOutputModeTarget::Type3:
1574 m_system_settings.audio_output_mode_type3 = output_mode;
1575 break;
1576 case AudioOutputModeTarget::Type4:
1577 m_system_settings.audio_output_mode_type4 = output_mode;
1578 break;
1579 default:
1580 LOG_ERROR(Service_SET, "Invalid audio output mode target {}", target);
1581 }
1582 SetSaveNeeded();
1583 R_SUCCEED();
1584}
1585
1586Result ISystemSettingsServer::GetSpeakerAutoMuteFlag(bool& is_auto_mute) const {
1587 is_auto_mute = m_system_settings.force_mute_on_headphone_removed;
1588 R_SUCCEED();
1589}
1590
1591Result ISystemSettingsServer::SetSpeakerAutoMuteFlag(bool is_auto_mute) {
1592 m_system_settings.force_mute_on_headphone_removed = is_auto_mute;
1593 SetSaveNeeded();
1594 R_SUCCEED();
1595}
1596
1597Result ISystemSettingsServer::GetExternalSteadyClockSourceId(Common::UUID& out_id) const {
1598 out_id = m_private_settings.external_clock_source_id;
1599 R_SUCCEED();
1600}
1601
1602Result ISystemSettingsServer::SetExternalSteadyClockSourceId(const Common::UUID& id) {
1603 m_private_settings.external_clock_source_id = id;
1604 SetSaveNeeded();
1605 R_SUCCEED();
1606}
1607
1608Result ISystemSettingsServer::GetUserSystemClockContext(
1609 Service::PSC::Time::SystemClockContext& out_context) const {
1610 out_context = m_system_settings.user_system_clock_context;
1611 R_SUCCEED();
1612}
1613
1614Result ISystemSettingsServer::SetUserSystemClockContext(
1615 const Service::PSC::Time::SystemClockContext& context) {
1616 m_system_settings.user_system_clock_context = context;
1617 SetSaveNeeded();
1618 R_SUCCEED();
1619}
1620
1621Result ISystemSettingsServer::GetDeviceTimeZoneLocationName(
1622 Service::PSC::Time::LocationName& out_name) const {
1623 out_name = m_system_settings.device_time_zone_location_name;
1624 R_SUCCEED();
1625}
1626
1627Result ISystemSettingsServer::SetDeviceTimeZoneLocationName(
1628 const Service::PSC::Time::LocationName& name) {
1629 m_system_settings.device_time_zone_location_name = name;
1630 SetSaveNeeded();
1631 R_SUCCEED();
1632}
1633
1634Result ISystemSettingsServer::GetNetworkSystemClockContext(
1635 Service::PSC::Time::SystemClockContext& out_context) const {
1636 out_context = m_system_settings.network_system_clock_context;
1637 R_SUCCEED();
1638}
1639
1640Result ISystemSettingsServer::SetNetworkSystemClockContext(
1641 const Service::PSC::Time::SystemClockContext& context) {
1642 m_system_settings.network_system_clock_context = context;
1643 SetSaveNeeded();
1644 R_SUCCEED();
1645}
1646
1647Result ISystemSettingsServer::IsUserSystemClockAutomaticCorrectionEnabled(bool& out_enabled) const {
1648 out_enabled = m_system_settings.user_system_clock_automatic_correction_enabled;
1649 R_SUCCEED();
1650}
1651
1652Result ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionEnabled(bool enabled) {
1653 m_system_settings.user_system_clock_automatic_correction_enabled = enabled;
1654 SetSaveNeeded();
1655 R_SUCCEED();
1656}
1657
1658Result ISystemSettingsServer::SetExternalSteadyClockInternalOffset(s64 offset) {
1659 m_private_settings.external_steady_clock_internal_offset = offset;
1660 SetSaveNeeded();
1661 R_SUCCEED();
1662}
1663
1664Result ISystemSettingsServer::GetExternalSteadyClockInternalOffset(s64& out_offset) const {
1665 out_offset = m_private_settings.external_steady_clock_internal_offset;
1666 R_SUCCEED();
1667}
1668
1669Result ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime(
1670 Service::PSC::Time::SteadyClockTimePoint& out_time_point) const {
1671 out_time_point = m_system_settings.device_time_zone_location_updated_time;
1672 R_SUCCEED();
1673}
1674
1675Result ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime(
1676 const Service::PSC::Time::SteadyClockTimePoint& time_point) {
1677 m_system_settings.device_time_zone_location_updated_time = time_point;
1678 SetSaveNeeded();
1679 R_SUCCEED();
1680}
1681
1682Result ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime(
1683 Service::PSC::Time::SteadyClockTimePoint& out_time_point) const {
1684 out_time_point = m_system_settings.user_system_clock_automatic_correction_updated_time_point;
1685 R_SUCCEED();
1686}
1687
1688Result ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime(
1689 const Service::PSC::Time::SteadyClockTimePoint& out_time_point) {
1690 m_system_settings.user_system_clock_automatic_correction_updated_time_point = out_time_point;
1691 SetSaveNeeded();
1692 R_SUCCEED();
1693}
1694
1695Result ISystemSettingsServer::GetTouchScreenMode(TouchScreenMode& touch_screen_mode) const {
1696 touch_screen_mode = m_system_settings.touch_screen_mode;
1697 R_SUCCEED();
1698}
1699
1700Result ISystemSettingsServer::SetTouchScreenMode(TouchScreenMode touch_screen_mode) {
1701 m_system_settings.touch_screen_mode = touch_screen_mode;
1702 SetSaveNeeded();
1703 R_SUCCEED();
1704}
1705
1706} // namespace Service::Set 1362} // namespace Service::Set
diff --git a/src/core/hle/service/set/system_settings_server.h b/src/core/hle/service/set/system_settings_server.h
index 9a3b36f0c..46e06c8ea 100755
--- a/src/core/hle/service/set/system_settings_server.h
+++ b/src/core/hle/service/set/system_settings_server.h
@@ -11,6 +11,7 @@
11#include "common/polyfill_thread.h" 11#include "common/polyfill_thread.h"
12#include "common/uuid.h" 12#include "common/uuid.h"
13#include "core/hle/result.h" 13#include "core/hle/result.h"
14#include "core/hle/service/cmif_types.h"
14#include "core/hle/service/psc/time/common.h" 15#include "core/hle/service/psc/time/common.h"
15#include "core/hle/service/service.h" 16#include "core/hle/service/service.h"
16#include "core/hle/service/set/setting_formats/appln_settings.h" 17#include "core/hle/service/set/setting_formats/appln_settings.h"
@@ -33,13 +34,14 @@ public:
33 explicit ISystemSettingsServer(Core::System& system_); 34 explicit ISystemSettingsServer(Core::System& system_);
34 ~ISystemSettingsServer() override; 35 ~ISystemSettingsServer() override;
35 36
36 Result GetSettingsItemValue(std::vector<u8>& out_value, const std::string& category, 37 Result GetSettingsItemValueImpl(std::vector<u8>& out_value, const std::string& category,
37 const std::string& name); 38 const std::string& name);
38 39
39 template <typename T> 40 template <typename T>
40 Result GetSettingsItemValue(T& value, const std::string& category, const std::string& name) { 41 Result GetSettingsItemValueImpl(T& value, const std::string& category,
42 const std::string& name) {
41 std::vector<u8> data; 43 std::vector<u8> data;
42 const auto result = GetSettingsItemValue(data, category, name); 44 const auto result = GetSettingsItemValueImpl(data, category, name);
43 if (result.IsError()) { 45 if (result.IsError()) {
44 return result; 46 return result;
45 } 47 }
@@ -48,120 +50,114 @@ public:
48 return result; 50 return result;
49 } 51 }
50 52
51 Result GetVibrationMasterVolume(f32& out_volume) const; 53public:
52 Result SetVibrationMasterVolume(f32 volume); 54 Result SetLanguageCode(LanguageCode language_code);
53 Result GetAudioOutputMode(AudioOutputMode& out_output_mode, AudioOutputModeTarget target) const; 55 Result GetFirmwareVersion(
56 OutLargeData<FirmwareVersionFormat, BufferAttr_HipcPointer> out_firmware_data);
57 Result GetFirmwareVersion2(
58 OutLargeData<FirmwareVersionFormat, BufferAttr_HipcPointer> out_firmware_data);
59 Result GetLockScreenFlag(Out<bool> out_lock_screen_flag);
60 Result SetLockScreenFlag(bool lock_screen_flag);
61 Result GetExternalSteadyClockSourceId(Out<Common::UUID> out_clock_source_id);
62 Result SetExternalSteadyClockSourceId(const Common::UUID& clock_source_id);
63 Result GetUserSystemClockContext(Out<Service::PSC::Time::SystemClockContext> out_clock_context);
64 Result SetUserSystemClockContext(const Service::PSC::Time::SystemClockContext& clock_context);
65 Result GetAccountSettings(Out<AccountSettings> out_account_settings);
66 Result SetAccountSettings(AccountSettings account_settings);
67 Result GetEulaVersions(Out<s32> out_count,
68 OutArray<EulaVersion, BufferAttr_HipcMapAlias> out_eula_versions);
69 Result SetEulaVersions(InArray<EulaVersion, BufferAttr_HipcMapAlias> eula_versions);
70 Result GetColorSetId(Out<ColorSet> out_color_set_id);
71 Result SetColorSetId(ColorSet color_set_id);
72 Result GetNotificationSettings(Out<NotificationSettings> out_notification_settings);
73 Result SetNotificationSettings(const NotificationSettings& notification_settings);
74 Result GetAccountNotificationSettings(
75 Out<s32> out_count, OutArray<AccountNotificationSettings, BufferAttr_HipcMapAlias>
76 out_account_notification_settings);
77 Result SetAccountNotificationSettings(
78 InArray<AccountNotificationSettings, BufferAttr_HipcMapAlias>
79 account_notification_settings);
80 Result GetVibrationMasterVolume(Out<f32> vibration_master_volume);
81 Result SetVibrationMasterVolume(f32 vibration_master_volume);
82 Result GetSettingsItemValueSize(
83 Out<u64> out_size,
84 InLargeData<SettingItemName, BufferAttr_HipcPointer> setting_category_buffer,
85 InLargeData<SettingItemName, BufferAttr_HipcPointer> setting_name_buf);
86 Result GetSettingsItemValue(
87 OutBuffer<BufferAttr_HipcMapAlias> out_data,
88 InLargeData<SettingItemName, BufferAttr_HipcPointer> setting_category_buffer,
89 InLargeData<SettingItemName, BufferAttr_HipcPointer> setting_name_buffer);
90 Result GetTvSettings(Out<TvSettings> out_tv_settings);
91 Result SetTvSettings(TvSettings tv_settings);
92 Result GetAudioOutputMode(Out<AudioOutputMode> out_output_mode, AudioOutputModeTarget target);
54 Result SetAudioOutputMode(AudioOutputModeTarget target, AudioOutputMode output_mode); 93 Result SetAudioOutputMode(AudioOutputModeTarget target, AudioOutputMode output_mode);
55 Result GetSpeakerAutoMuteFlag(bool& is_auto_mute) const; 94 Result GetSpeakerAutoMuteFlag(Out<bool> out_force_mute_on_headphone_removed);
56 Result SetSpeakerAutoMuteFlag(bool auto_mute); 95 Result SetSpeakerAutoMuteFlag(bool force_mute_on_headphone_removed);
57 Result GetExternalSteadyClockSourceId(Common::UUID& out_id) const; 96 Result GetQuestFlag(Out<QuestFlag> out_quest_flag);
58 Result SetExternalSteadyClockSourceId(const Common::UUID& id); 97 Result SetQuestFlag(QuestFlag quest_flag);
59 Result GetUserSystemClockContext(Service::PSC::Time::SystemClockContext& out_context) const; 98 Result GetDeviceTimeZoneLocationName(Out<Service::PSC::Time::LocationName> out_name);
60 Result SetUserSystemClockContext(const Service::PSC::Time::SystemClockContext& context);
61 Result GetDeviceTimeZoneLocationName(Service::PSC::Time::LocationName& out_name) const;
62 Result SetDeviceTimeZoneLocationName(const Service::PSC::Time::LocationName& name); 99 Result SetDeviceTimeZoneLocationName(const Service::PSC::Time::LocationName& name);
63 Result GetNetworkSystemClockContext(Service::PSC::Time::SystemClockContext& out_context) const; 100 Result SetRegionCode(SystemRegionCode region_code);
101 Result GetNetworkSystemClockContext(Out<Service::PSC::Time::SystemClockContext> out_context);
64 Result SetNetworkSystemClockContext(const Service::PSC::Time::SystemClockContext& context); 102 Result SetNetworkSystemClockContext(const Service::PSC::Time::SystemClockContext& context);
65 Result IsUserSystemClockAutomaticCorrectionEnabled(bool& out_enabled) const; 103 Result IsUserSystemClockAutomaticCorrectionEnabled(Out<bool> out_automatic_correction_enabled);
66 Result SetUserSystemClockAutomaticCorrectionEnabled(bool enabled); 104 Result SetUserSystemClockAutomaticCorrectionEnabled(bool automatic_correction_enabled);
105 Result GetDebugModeFlag(Out<bool> is_debug_mode_enabled);
106 Result GetPrimaryAlbumStorage(Out<PrimaryAlbumStorage> out_primary_album_storage);
107 Result SetPrimaryAlbumStorage(PrimaryAlbumStorage primary_album_storage);
108 Result GetBatteryLot(Out<BatteryLot> out_battery_lot);
109 Result GetSerialNumber(Out<SerialNumber> out_console_serial);
110 Result GetNfcEnableFlag(Out<bool> out_nfc_enable_flag);
111 Result SetNfcEnableFlag(bool nfc_enable_flag);
112 Result GetSleepSettings(Out<SleepSettings> out_sleep_settings);
113 Result SetSleepSettings(SleepSettings sleep_settings);
114 Result GetWirelessLanEnableFlag(Out<bool> out_wireless_lan_enable_flag);
115 Result SetWirelessLanEnableFlag(bool wireless_lan_enable_flag);
116 Result GetInitialLaunchSettings(Out<InitialLaunchSettings> out_initial_launch_settings);
117 Result SetInitialLaunchSettings(InitialLaunchSettings initial_launch_settings);
118 Result GetDeviceNickName(
119 OutLargeData<std::array<u8, 0x80>, BufferAttr_HipcMapAlias> out_device_name);
120 Result SetDeviceNickName(
121 InLargeData<std::array<u8, 0x80>, BufferAttr_HipcMapAlias> device_name_buffer);
122 Result GetProductModel(Out<u32> out_product_model);
123 Result GetBluetoothEnableFlag(Out<bool> out_bluetooth_enable_flag);
124 Result SetBluetoothEnableFlag(bool bluetooth_enable_flag);
125 Result GetMiiAuthorId(Out<Common::UUID> out_mii_author_id);
126 Result GetAutoUpdateEnableFlag(Out<bool> out_auto_update_enable_flag);
127 Result SetAutoUpdateEnableFlag(bool auto_update_enable_flag);
128 Result GetBatteryPercentageFlag(Out<bool> out_battery_percentage_flag);
129 Result SetBatteryPercentageFlag(bool battery_percentage_flag);
67 Result SetExternalSteadyClockInternalOffset(s64 offset); 130 Result SetExternalSteadyClockInternalOffset(s64 offset);
68 Result GetExternalSteadyClockInternalOffset(s64& out_offset) const; 131 Result GetExternalSteadyClockInternalOffset(Out<s64> out_offset);
132 Result GetPushNotificationActivityModeOnSleep(
133 Out<s32> out_push_notification_activity_mode_on_sleep);
134 Result SetPushNotificationActivityModeOnSleep(s32 push_notification_activity_mode_on_sleep);
135 Result GetErrorReportSharePermission(
136 Out<ErrorReportSharePermission> out_error_report_share_permission);
137 Result SetErrorReportSharePermission(ErrorReportSharePermission error_report_share_permission);
138 Result GetAppletLaunchFlags(Out<u32> out_applet_launch_flag);
139 Result SetAppletLaunchFlags(u32 applet_launch_flag);
140 Result GetKeyboardLayout(Out<KeyboardLayout> out_keyboard_layout);
141 Result SetKeyboardLayout(KeyboardLayout keyboard_layout);
69 Result GetDeviceTimeZoneLocationUpdatedTime( 142 Result GetDeviceTimeZoneLocationUpdatedTime(
70 Service::PSC::Time::SteadyClockTimePoint& out_time_point) const; 143 Out<Service::PSC::Time::SteadyClockTimePoint> out_time_point);
71 Result SetDeviceTimeZoneLocationUpdatedTime( 144 Result SetDeviceTimeZoneLocationUpdatedTime(
72 const Service::PSC::Time::SteadyClockTimePoint& time_point); 145 const Service::PSC::Time::SteadyClockTimePoint& time_point);
73 Result GetUserSystemClockAutomaticCorrectionUpdatedTime( 146 Result GetUserSystemClockAutomaticCorrectionUpdatedTime(
74 Service::PSC::Time::SteadyClockTimePoint& out_time_point) const; 147 Out<Service::PSC::Time::SteadyClockTimePoint> out_time_point);
75 Result SetUserSystemClockAutomaticCorrectionUpdatedTime( 148 Result SetUserSystemClockAutomaticCorrectionUpdatedTime(
76 const Service::PSC::Time::SteadyClockTimePoint& time_point); 149 const Service::PSC::Time::SteadyClockTimePoint& out_time_point);
77 Result GetTouchScreenMode(TouchScreenMode& touch_screen_mode) const; 150 Result GetChineseTraditionalInputMethod(
151 Out<ChineseTraditionalInputMethod> out_chinese_traditional_input_method);
152 Result GetHomeMenuScheme(Out<HomeMenuScheme> out_home_menu_scheme);
153 Result GetHomeMenuSchemeModel(Out<u32> out_home_menu_scheme_model);
154 Result GetTouchScreenMode(Out<TouchScreenMode> out_touch_screen_mode);
78 Result SetTouchScreenMode(TouchScreenMode touch_screen_mode); 155 Result SetTouchScreenMode(TouchScreenMode touch_screen_mode);
156 Result GetFieldTestingFlag(Out<bool> out_field_testing_flag);
157 Result GetPanelCrcMode(Out<s32> out_panel_crc_mode);
158 Result SetPanelCrcMode(s32 panel_crc_mode);
79 159
80private: 160private:
81 void SetLanguageCode(HLERequestContext& ctx);
82 void GetFirmwareVersion(HLERequestContext& ctx);
83 void GetFirmwareVersion2(HLERequestContext& ctx);
84 void GetLockScreenFlag(HLERequestContext& ctx);
85 void SetLockScreenFlag(HLERequestContext& ctx);
86 void GetExternalSteadyClockSourceId(HLERequestContext& ctx);
87 void SetExternalSteadyClockSourceId(HLERequestContext& ctx);
88 void GetUserSystemClockContext(HLERequestContext& ctx);
89 void SetUserSystemClockContext(HLERequestContext& ctx);
90 void GetAccountSettings(HLERequestContext& ctx);
91 void SetAccountSettings(HLERequestContext& ctx);
92 void GetEulaVersions(HLERequestContext& ctx);
93 void SetEulaVersions(HLERequestContext& ctx);
94 void GetColorSetId(HLERequestContext& ctx);
95 void SetColorSetId(HLERequestContext& ctx);
96 void GetNotificationSettings(HLERequestContext& ctx);
97 void SetNotificationSettings(HLERequestContext& ctx);
98 void GetAccountNotificationSettings(HLERequestContext& ctx);
99 void SetAccountNotificationSettings(HLERequestContext& ctx);
100 void GetVibrationMasterVolume(HLERequestContext& ctx);
101 void SetVibrationMasterVolume(HLERequestContext& ctx);
102 void GetSettingsItemValueSize(HLERequestContext& ctx);
103 void GetSettingsItemValue(HLERequestContext& ctx);
104 void GetTvSettings(HLERequestContext& ctx);
105 void SetTvSettings(HLERequestContext& ctx);
106 void GetAudioOutputMode(HLERequestContext& ctx);
107 void SetAudioOutputMode(HLERequestContext& ctx);
108 void GetSpeakerAutoMuteFlag(HLERequestContext& ctx);
109 void SetSpeakerAutoMuteFlag(HLERequestContext& ctx);
110 void GetDebugModeFlag(HLERequestContext& ctx);
111 void GetQuestFlag(HLERequestContext& ctx);
112 void SetQuestFlag(HLERequestContext& ctx);
113 void GetDeviceTimeZoneLocationName(HLERequestContext& ctx);
114 void SetDeviceTimeZoneLocationName(HLERequestContext& ctx);
115 void SetRegionCode(HLERequestContext& ctx);
116 void GetNetworkSystemClockContext(HLERequestContext& ctx);
117 void SetNetworkSystemClockContext(HLERequestContext& ctx);
118 void IsUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx);
119 void SetUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx);
120 void GetPrimaryAlbumStorage(HLERequestContext& ctx);
121 void SetPrimaryAlbumStorage(HLERequestContext& ctx);
122 void GetBatteryLot(HLERequestContext& ctx);
123 void GetSerialNumber(HLERequestContext& ctx);
124 void GetNfcEnableFlag(HLERequestContext& ctx);
125 void SetNfcEnableFlag(HLERequestContext& ctx);
126 void GetSleepSettings(HLERequestContext& ctx);
127 void SetSleepSettings(HLERequestContext& ctx);
128 void GetWirelessLanEnableFlag(HLERequestContext& ctx);
129 void SetWirelessLanEnableFlag(HLERequestContext& ctx);
130 void GetInitialLaunchSettings(HLERequestContext& ctx);
131 void SetInitialLaunchSettings(HLERequestContext& ctx);
132 void GetDeviceNickName(HLERequestContext& ctx);
133 void SetDeviceNickName(HLERequestContext& ctx);
134 void GetProductModel(HLERequestContext& ctx);
135 void GetBluetoothEnableFlag(HLERequestContext& ctx);
136 void SetBluetoothEnableFlag(HLERequestContext& ctx);
137 void GetMiiAuthorId(HLERequestContext& ctx);
138 void GetAutoUpdateEnableFlag(HLERequestContext& ctx);
139 void SetAutoUpdateEnableFlag(HLERequestContext& ctx);
140 void GetBatteryPercentageFlag(HLERequestContext& ctx);
141 void SetBatteryPercentageFlag(HLERequestContext& ctx);
142 void SetExternalSteadyClockInternalOffset(HLERequestContext& ctx);
143 void GetExternalSteadyClockInternalOffset(HLERequestContext& ctx);
144 void GetPushNotificationActivityModeOnSleep(HLERequestContext& ctx);
145 void SetPushNotificationActivityModeOnSleep(HLERequestContext& ctx);
146 void GetErrorReportSharePermission(HLERequestContext& ctx);
147 void SetErrorReportSharePermission(HLERequestContext& ctx);
148 void GetAppletLaunchFlags(HLERequestContext& ctx);
149 void SetAppletLaunchFlags(HLERequestContext& ctx);
150 void GetKeyboardLayout(HLERequestContext& ctx);
151 void SetKeyboardLayout(HLERequestContext& ctx);
152 void GetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx);
153 void SetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx);
154 void GetUserSystemClockAutomaticCorrectionUpdatedTime(HLERequestContext& ctx);
155 void SetUserSystemClockAutomaticCorrectionUpdatedTime(HLERequestContext& ctx);
156 void GetChineseTraditionalInputMethod(HLERequestContext& ctx);
157 void GetHomeMenuScheme(HLERequestContext& ctx);
158 void GetHomeMenuSchemeModel(HLERequestContext& ctx);
159 void GetTouchScreenMode(HLERequestContext& ctx);
160 void SetTouchScreenMode(HLERequestContext& ctx);
161 void GetFieldTestingFlag(HLERequestContext& ctx);
162 void GetPanelCrcMode(HLERequestContext& ctx);
163 void SetPanelCrcMode(HLERequestContext& ctx);
164
165 bool LoadSettingsFile(std::filesystem::path& path, auto&& default_func); 161 bool LoadSettingsFile(std::filesystem::path& path, auto&& default_func);
166 bool StoreSettingsFile(std::filesystem::path& path, auto& settings); 162 bool StoreSettingsFile(std::filesystem::path& path, auto& settings);
167 void SetupSettings(); 163 void SetupSettings();
diff --git a/src/hid_core/resources/hid_firmware_settings.cpp b/src/hid_core/resources/hid_firmware_settings.cpp
index b32c0660a..c0a76d0eb 100755
--- a/src/hid_core/resources/hid_firmware_settings.cpp
+++ b/src/hid_core/resources/hid_firmware_settings.cpp
@@ -22,29 +22,30 @@ void HidFirmwareSettings::LoadSettings(bool reload_config) {
22 return; 22 return;
23 } 23 }
24 24
25 m_set_sys->GetSettingsItemValue<bool>(is_debug_pad_enabled, "hid_debug", "enables_debugpad"); 25 m_set_sys->GetSettingsItemValueImpl<bool>(is_debug_pad_enabled, "hid_debug",
26 m_set_sys->GetSettingsItemValue<bool>(is_device_managed, "hid_debug", "manages_devices"); 26 "enables_debugpad");
27 m_set_sys->GetSettingsItemValue<bool>(is_touch_i2c_managed, "hid_debug", 27 m_set_sys->GetSettingsItemValueImpl<bool>(is_device_managed, "hid_debug", "manages_devices");
28 "manages_touch_ic_i2c"); 28 m_set_sys->GetSettingsItemValueImpl<bool>(is_touch_i2c_managed, "hid_debug",
29 m_set_sys->GetSettingsItemValue<bool>(is_future_devices_emulated, "hid_debug", 29 "manages_touch_ic_i2c");
30 "emulate_future_device"); 30 m_set_sys->GetSettingsItemValueImpl<bool>(is_future_devices_emulated, "hid_debug",
31 m_set_sys->GetSettingsItemValue<bool>(is_mcu_hardware_error_emulated, "hid_debug", 31 "emulate_future_device");
32 "emulate_mcu_hardware_error"); 32 m_set_sys->GetSettingsItemValueImpl<bool>(is_mcu_hardware_error_emulated, "hid_debug",
33 m_set_sys->GetSettingsItemValue<bool>(is_rail_enabled, "hid_debug", "enables_rail"); 33 "emulate_mcu_hardware_error");
34 m_set_sys->GetSettingsItemValue<bool>(is_firmware_update_failure_emulated, "hid_debug", 34 m_set_sys->GetSettingsItemValueImpl<bool>(is_rail_enabled, "hid_debug", "enables_rail");
35 "emulate_firmware_update_failure"); 35 m_set_sys->GetSettingsItemValueImpl<bool>(is_firmware_update_failure_emulated, "hid_debug",
36 "emulate_firmware_update_failure");
36 is_firmware_update_failure = {}; 37 is_firmware_update_failure = {};
37 m_set_sys->GetSettingsItemValue<bool>(is_ble_disabled, "hid_debug", "ble_disabled"); 38 m_set_sys->GetSettingsItemValueImpl<bool>(is_ble_disabled, "hid_debug", "ble_disabled");
38 m_set_sys->GetSettingsItemValue<bool>(is_dscale_disabled, "hid_debug", "dscale_disabled"); 39 m_set_sys->GetSettingsItemValueImpl<bool>(is_dscale_disabled, "hid_debug", "dscale_disabled");
39 m_set_sys->GetSettingsItemValue<bool>(is_handheld_forced, "hid_debug", "force_handheld"); 40 m_set_sys->GetSettingsItemValueImpl<bool>(is_handheld_forced, "hid_debug", "force_handheld");
40 features_per_id_disabled = {}; 41 features_per_id_disabled = {};
41 m_set_sys->GetSettingsItemValue<bool>(is_touch_firmware_auto_update_disabled, "hid_debug", 42 m_set_sys->GetSettingsItemValueImpl<bool>(is_touch_firmware_auto_update_disabled, "hid_debug",
42 "touch_firmware_auto_update_disabled"); 43 "touch_firmware_auto_update_disabled");
43 44
44 bool has_rail_interface{}; 45 bool has_rail_interface{};
45 bool has_sio_mcu{}; 46 bool has_sio_mcu{};
46 m_set_sys->GetSettingsItemValue<bool>(has_rail_interface, "hid", "has_rail_interface"); 47 m_set_sys->GetSettingsItemValueImpl<bool>(has_rail_interface, "hid", "has_rail_interface");
47 m_set_sys->GetSettingsItemValue<bool>(has_sio_mcu, "hid", "has_sio_mcu"); 48 m_set_sys->GetSettingsItemValueImpl<bool>(has_sio_mcu, "hid", "has_sio_mcu");
48 platform_config.has_rail_interface.Assign(has_rail_interface); 49 platform_config.has_rail_interface.Assign(has_rail_interface);
49 platform_config.has_sio_mcu.Assign(has_sio_mcu); 50 platform_config.has_sio_mcu.Assign(has_sio_mcu);
50 51
diff --git a/src/hid_core/resources/npad/npad_vibration.cpp b/src/hid_core/resources/npad/npad_vibration.cpp
index 02b1f0290..4c103889a 100755
--- a/src/hid_core/resources/npad/npad_vibration.cpp
+++ b/src/hid_core/resources/npad/npad_vibration.cpp
@@ -15,7 +15,7 @@ Result NpadVibration::Activate() {
15 std::scoped_lock lock{mutex}; 15 std::scoped_lock lock{mutex};
16 16
17 f32 master_volume = 1.0f; 17 f32 master_volume = 1.0f;
18 m_set_sys->GetVibrationMasterVolume(master_volume); 18 m_set_sys->GetVibrationMasterVolume(&master_volume);
19 if (master_volume < 0.0f || master_volume > 1.0f) { 19 if (master_volume < 0.0f || master_volume > 1.0f) {
20 return ResultVibrationStrengthOutOfRange; 20 return ResultVibrationStrengthOutOfRange;
21 } 21 }
@@ -57,7 +57,7 @@ Result NpadVibration::GetVibrationMasterVolume(f32& out_volume) const {
57 std::scoped_lock lock{mutex}; 57 std::scoped_lock lock{mutex};
58 58
59 f32 master_volume = 1.0f; 59 f32 master_volume = 1.0f;
60 m_set_sys->GetVibrationMasterVolume(master_volume); 60 m_set_sys->GetVibrationMasterVolume(&master_volume);
61 if (master_volume < 0.0f || master_volume > 1.0f) { 61 if (master_volume < 0.0f || master_volume > 1.0f) {
62 return ResultVibrationStrengthOutOfRange; 62 return ResultVibrationStrengthOutOfRange;
63 } 63 }
@@ -77,7 +77,7 @@ Result NpadVibration::EndPermitVibrationSession() {
77 std::scoped_lock lock{mutex}; 77 std::scoped_lock lock{mutex};
78 78
79 f32 master_volume = 1.0f; 79 f32 master_volume = 1.0f;
80 m_set_sys->GetVibrationMasterVolume(master_volume); 80 m_set_sys->GetVibrationMasterVolume(&master_volume);
81 if (master_volume < 0.0f || master_volume > 1.0f) { 81 if (master_volume < 0.0f || master_volume > 1.0f) {
82 return ResultVibrationStrengthOutOfRange; 82 return ResultVibrationStrengthOutOfRange;
83 } 83 }
diff --git a/src/hid_core/resources/touch_screen/touch_screen_resource.cpp b/src/hid_core/resources/touch_screen/touch_screen_resource.cpp
index c39321915..79ddaa4df 100755
--- a/src/hid_core/resources/touch_screen/touch_screen_resource.cpp
+++ b/src/hid_core/resources/touch_screen/touch_screen_resource.cpp
@@ -48,7 +48,7 @@ Result TouchResource::ActivateTouch() {
48 } 48 }
49 49
50 Set::TouchScreenMode touch_mode{Set::TouchScreenMode::Standard}; 50 Set::TouchScreenMode touch_mode{Set::TouchScreenMode::Standard};
51 m_set_sys->GetTouchScreenMode(touch_mode); 51 m_set_sys->GetTouchScreenMode(&touch_mode);
52 default_touch_screen_mode = static_cast<Core::HID::TouchScreenModeForNx>(touch_mode); 52 default_touch_screen_mode = static_cast<Core::HID::TouchScreenModeForNx>(touch_mode);
53 53
54 global_ref_counter++; 54 global_ref_counter++;