summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/CMakeLists.txt16
-rw-r--r--src/core/file_sys/patch_manager.cpp2
-rw-r--r--src/core/hle/service/hid/hid_server.cpp22
-rw-r--r--src/core/hle/service/hid/hid_system_server.cpp68
-rw-r--r--src/core/hle/service/hid/hid_system_server.h3
-rw-r--r--src/core/hle/service/ns/language.cpp2
-rw-r--r--src/core/hle/service/ns/ns.cpp2
-rw-r--r--src/core/hle/service/set/factory_settings_server.cpp (renamed from src/core/hle/service/set/set_cal.cpp)7
-rw-r--r--src/core/hle/service/set/factory_settings_server.h (renamed from src/core/hle/service/set/set_fd.h)6
-rw-r--r--src/core/hle/service/set/firmware_debug_settings_server.cpp (renamed from src/core/hle/service/set/set_fd.cpp)7
-rw-r--r--src/core/hle/service/set/firmware_debug_settings_server.h (renamed from src/core/hle/service/set/set_cal.h)6
-rw-r--r--src/core/hle/service/set/settings.cpp19
-rw-r--r--src/core/hle/service/set/settings_server.cpp (renamed from src/core/hle/service/set/set.cpp)70
-rw-r--r--src/core/hle/service/set/settings_server.h (renamed from src/core/hle/service/set/set.h)6
-rw-r--r--src/core/hle/service/set/system_settings_server.cpp (renamed from src/core/hle/service/set/set_sys.cpp)623
-rw-r--r--src/core/hle/service/set/system_settings_server.h (renamed from src/core/hle/service/set/set_sys.h)6
-rw-r--r--src/hid_core/resources/applet_resource.cpp1
-rw-r--r--src/hid_core/resources/npad/npad.cpp45
-rw-r--r--src/hid_core/resources/npad/npad.h12
-rw-r--r--src/yuzu/main.cpp2
20 files changed, 524 insertions, 401 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index adcc23c18..753f55ebe 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -708,24 +708,24 @@ add_library(core STATIC
708 hle/service/server_manager.h 708 hle/service/server_manager.h
709 hle/service/service.cpp 709 hle/service/service.cpp
710 hle/service/service.h 710 hle/service/service.h
711 hle/service/set/set.cpp
712 hle/service/set/set.h
713 hle/service/set/appln_settings.cpp 711 hle/service/set/appln_settings.cpp
714 hle/service/set/appln_settings.h 712 hle/service/set/appln_settings.h
715 hle/service/set/device_settings.cpp 713 hle/service/set/device_settings.cpp
716 hle/service/set/device_settings.h 714 hle/service/set/device_settings.h
715 hle/service/set/factory_settings_server.cpp
716 hle/service/set/factory_settings_server.h
717 hle/service/set/firmware_debug_settings_server.cpp
718 hle/service/set/firmware_debug_settings_server.h
717 hle/service/set/private_settings.cpp 719 hle/service/set/private_settings.cpp
718 hle/service/set/private_settings.h 720 hle/service/set/private_settings.h
719 hle/service/set/set_cal.cpp
720 hle/service/set/set_cal.h
721 hle/service/set/set_fd.cpp
722 hle/service/set/set_fd.h
723 hle/service/set/set_sys.cpp
724 hle/service/set/set_sys.h
725 hle/service/set/settings.cpp 721 hle/service/set/settings.cpp
726 hle/service/set/settings.h 722 hle/service/set/settings.h
723 hle/service/set/settings_server.cpp
724 hle/service/set/settings_server.h
727 hle/service/set/system_settings.cpp 725 hle/service/set/system_settings.cpp
728 hle/service/set/system_settings.h 726 hle/service/set/system_settings.h
727 hle/service/set/system_settings_server.cpp
728 hle/service/set/system_settings_server.h
729 hle/service/sm/sm.cpp 729 hle/service/sm/sm.cpp
730 hle/service/sm/sm.h 730 hle/service/sm/sm.h
731 hle/service/sm/sm_controller.cpp 731 hle/service/sm/sm_controller.cpp
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp
index cc7af2ea3..4a3dbc6a3 100644
--- a/src/core/file_sys/patch_manager.cpp
+++ b/src/core/file_sys/patch_manager.cpp
@@ -26,7 +26,7 @@
26#include "core/file_sys/vfs_vector.h" 26#include "core/file_sys/vfs_vector.h"
27#include "core/hle/service/filesystem/filesystem.h" 27#include "core/hle/service/filesystem/filesystem.h"
28#include "core/hle/service/ns/language.h" 28#include "core/hle/service/ns/language.h"
29#include "core/hle/service/set/set.h" 29#include "core/hle/service/set/settings_server.h"
30#include "core/loader/loader.h" 30#include "core/loader/loader.h"
31#include "core/loader/nso.h" 31#include "core/loader/nso.h"
32#include "core/memory/cheat_engine.h" 32#include "core/memory/cheat_engine.h"
diff --git a/src/core/hle/service/hid/hid_server.cpp b/src/core/hle/service/hid/hid_server.cpp
index 2ff00d30d..74898888a 100644
--- a/src/core/hle/service/hid/hid_server.cpp
+++ b/src/core/hle/service/hid/hid_server.cpp
@@ -1444,8 +1444,8 @@ void IHidServer::SetNpadAnalogStickUseCenterClamp(HLERequestContext& ctx) {
1444 1444
1445 const auto parameters{rp.PopRaw<Parameters>()}; 1445 const auto parameters{rp.PopRaw<Parameters>()};
1446 1446
1447 LOG_WARNING(Service_HID, "(STUBBED) called, use_center_clamp={}, applet_resource_user_id={}", 1447 LOG_INFO(Service_HID, "called, use_center_clamp={}, applet_resource_user_id={}",
1448 parameters.use_center_clamp, parameters.applet_resource_user_id); 1448 parameters.use_center_clamp, parameters.applet_resource_user_id);
1449 1449
1450 GetResourceManager()->GetNpad()->SetNpadAnalogStickUseCenterClamp( 1450 GetResourceManager()->GetNpad()->SetNpadAnalogStickUseCenterClamp(
1451 parameters.applet_resource_user_id, parameters.use_center_clamp); 1451 parameters.applet_resource_user_id, parameters.use_center_clamp);
@@ -1466,23 +1466,27 @@ void IHidServer::SetNpadCaptureButtonAssignment(HLERequestContext& ctx) {
1466 1466
1467 const auto parameters{rp.PopRaw<Parameters>()}; 1467 const auto parameters{rp.PopRaw<Parameters>()};
1468 1468
1469 LOG_WARNING(Service_HID, 1469 LOG_INFO(Service_HID, "called, npad_styleset={}, applet_resource_user_id={}, button={}",
1470 "(STUBBED) called, npad_styleset={}, applet_resource_user_id={}, button={}", 1470 parameters.npad_styleset, parameters.applet_resource_user_id, parameters.button);
1471 parameters.npad_styleset, parameters.applet_resource_user_id, parameters.button); 1471
1472 const auto result = GetResourceManager()->GetNpad()->SetNpadCaptureButtonAssignment(
1473 parameters.applet_resource_user_id, parameters.npad_styleset, parameters.button);
1472 1474
1473 IPC::ResponseBuilder rb{ctx, 2}; 1475 IPC::ResponseBuilder rb{ctx, 2};
1474 rb.Push(ResultSuccess); 1476 rb.Push(result);
1475} 1477}
1476 1478
1477void IHidServer::ClearNpadCaptureButtonAssignment(HLERequestContext& ctx) { 1479void IHidServer::ClearNpadCaptureButtonAssignment(HLERequestContext& ctx) {
1478 IPC::RequestParser rp{ctx}; 1480 IPC::RequestParser rp{ctx};
1479 const auto applet_resource_user_id{rp.Pop<u64>()}; 1481 const auto applet_resource_user_id{rp.Pop<u64>()};
1480 1482
1481 LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}", 1483 LOG_INFO(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
1482 applet_resource_user_id); 1484
1485 const auto result =
1486 GetResourceManager()->GetNpad()->ClearNpadCaptureButtonAssignment(applet_resource_user_id);
1483 1487
1484 IPC::ResponseBuilder rb{ctx, 2}; 1488 IPC::ResponseBuilder rb{ctx, 2};
1485 rb.Push(ResultSuccess); 1489 rb.Push(result);
1486} 1490}
1487 1491
1488void IHidServer::GetVibrationDeviceInfo(HLERequestContext& ctx) { 1492void IHidServer::GetVibrationDeviceInfo(HLERequestContext& ctx) {
diff --git a/src/core/hle/service/hid/hid_system_server.cpp b/src/core/hle/service/hid/hid_system_server.cpp
index 2a65615e8..3a0cb3cb1 100644
--- a/src/core/hle/service/hid/hid_system_server.cpp
+++ b/src/core/hle/service/hid/hid_system_server.cpp
@@ -46,7 +46,7 @@ IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptr<Resour
46 {310, &IHidSystemServer::GetMaskedSupportedNpadStyleSet, "GetMaskedSupportedNpadStyleSet"}, 46 {310, &IHidSystemServer::GetMaskedSupportedNpadStyleSet, "GetMaskedSupportedNpadStyleSet"},
47 {311, nullptr, "SetNpadPlayerLedBlinkingDevice"}, 47 {311, nullptr, "SetNpadPlayerLedBlinkingDevice"},
48 {312, &IHidSystemServer::SetSupportedNpadStyleSetAll, "SetSupportedNpadStyleSetAll"}, 48 {312, &IHidSystemServer::SetSupportedNpadStyleSetAll, "SetSupportedNpadStyleSetAll"},
49 {313, nullptr, "GetNpadCaptureButtonAssignment"}, 49 {313, &IHidSystemServer::GetNpadCaptureButtonAssignment, "GetNpadCaptureButtonAssignment"},
50 {314, nullptr, "GetAppletFooterUiType"}, 50 {314, nullptr, "GetAppletFooterUiType"},
51 {315, &IHidSystemServer::GetAppletDetailedUiType, "GetAppletDetailedUiType"}, 51 {315, &IHidSystemServer::GetAppletDetailedUiType, "GetAppletDetailedUiType"},
52 {316, &IHidSystemServer::GetNpadInterfaceType, "GetNpadInterfaceType"}, 52 {316, &IHidSystemServer::GetNpadInterfaceType, "GetNpadInterfaceType"},
@@ -54,8 +54,8 @@ IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptr<Resour
54 {318, &IHidSystemServer::HasBattery, "HasBattery"}, 54 {318, &IHidSystemServer::HasBattery, "HasBattery"},
55 {319, &IHidSystemServer::HasLeftRightBattery, "HasLeftRightBattery"}, 55 {319, &IHidSystemServer::HasLeftRightBattery, "HasLeftRightBattery"},
56 {321, &IHidSystemServer::GetUniquePadsFromNpad, "GetUniquePadsFromNpad"}, 56 {321, &IHidSystemServer::GetUniquePadsFromNpad, "GetUniquePadsFromNpad"},
57 {322, &IHidSystemServer::GetIrSensorState, "GetIrSensorState"}, 57 {322, &IHidSystemServer::SetNpadSystemExtStateEnabled, "SetNpadSystemExtStateEnabled"},
58 {323, nullptr, "GetXcdHandleForNpadWithIrSensor"}, 58 {323, nullptr, "GetLastActiveUniquePad"},
59 {324, nullptr, "GetUniquePadButtonSet"}, 59 {324, nullptr, "GetUniquePadButtonSet"},
60 {325, nullptr, "GetUniquePadColor"}, 60 {325, nullptr, "GetUniquePadColor"},
61 {326, nullptr, "GetUniquePadAppletDetailedUiType"}, 61 {326, nullptr, "GetUniquePadAppletDetailedUiType"},
@@ -251,25 +251,38 @@ void IHidSystemServer::ApplyNpadSystemCommonPolicy(HLERequestContext& ctx) {
251} 251}
252 252
253void IHidSystemServer::EnableAssigningSingleOnSlSrPress(HLERequestContext& ctx) { 253void IHidSystemServer::EnableAssigningSingleOnSlSrPress(HLERequestContext& ctx) {
254 LOG_WARNING(Service_HID, "(STUBBED) called"); 254 IPC::RequestParser rp{ctx};
255 const auto applet_resource_user_id{rp.Pop<u64>()};
256
257 LOG_INFO(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
258
259 GetResourceManager()->GetNpad()->AssigningSingleOnSlSrPress(applet_resource_user_id, true);
255 260
256 IPC::ResponseBuilder rb{ctx, 2}; 261 IPC::ResponseBuilder rb{ctx, 2};
257 rb.Push(ResultSuccess); 262 rb.Push(ResultSuccess);
258} 263}
259 264
260void IHidSystemServer::DisableAssigningSingleOnSlSrPress(HLERequestContext& ctx) { 265void IHidSystemServer::DisableAssigningSingleOnSlSrPress(HLERequestContext& ctx) {
261 LOG_WARNING(Service_HID, "(STUBBED) called"); 266 IPC::RequestParser rp{ctx};
267 const auto applet_resource_user_id{rp.Pop<u64>()};
268
269 LOG_INFO(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
270
271 GetResourceManager()->GetNpad()->AssigningSingleOnSlSrPress(applet_resource_user_id, false);
262 272
263 IPC::ResponseBuilder rb{ctx, 2}; 273 IPC::ResponseBuilder rb{ctx, 2};
264 rb.Push(ResultSuccess); 274 rb.Push(ResultSuccess);
265} 275}
266 276
267void IHidSystemServer::GetLastActiveNpad(HLERequestContext& ctx) { 277void IHidSystemServer::GetLastActiveNpad(HLERequestContext& ctx) {
268 LOG_DEBUG(Service_HID, "(STUBBED) called"); // Spams a lot when controller applet is running 278 Core::HID::NpadIdType npad_id{};
279 const Result result = GetResourceManager()->GetNpad()->GetLastActiveNpad(npad_id);
280
281 LOG_DEBUG(Service_HID, "called, npad_id={}", npad_id);
269 282
270 IPC::ResponseBuilder rb{ctx, 3}; 283 IPC::ResponseBuilder rb{ctx, 3};
271 rb.Push(ResultSuccess); 284 rb.Push(result);
272 rb.Push(0); // Dont forget to fix this 285 rb.PushEnum(npad_id);
273} 286}
274 287
275void IHidSystemServer::ApplyNpadSystemCommonPolicyFull(HLERequestContext& ctx) { 288void IHidSystemServer::ApplyNpadSystemCommonPolicyFull(HLERequestContext& ctx) {
@@ -331,6 +344,27 @@ void IHidSystemServer::SetSupportedNpadStyleSetAll(HLERequestContext& ctx) {
331 rb.Push(result); 344 rb.Push(result);
332} 345}
333 346
347void IHidSystemServer::GetNpadCaptureButtonAssignment(HLERequestContext& ctx) {
348 IPC::RequestParser rp{ctx};
349 const auto applet_resource_user_id{rp.Pop<u64>()};
350 const auto capture_button_list_size{ctx.GetWriteBufferNumElements<Core::HID::NpadButton>()};
351
352 LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
353
354 std::vector<Core::HID::NpadButton> capture_button_list(capture_button_list_size);
355 const auto& npad = GetResourceManager()->GetNpad();
356 const u64 list_size =
357 npad->GetNpadCaptureButtonAssignment(capture_button_list, applet_resource_user_id);
358
359 if (list_size != 0) {
360 ctx.WriteBuffer(capture_button_list);
361 }
362
363 IPC::ResponseBuilder rb{ctx, 4};
364 rb.Push(ResultSuccess);
365 rb.Push(list_size);
366}
367
334void IHidSystemServer::GetAppletDetailedUiType(HLERequestContext& ctx) { 368void IHidSystemServer::GetAppletDetailedUiType(HLERequestContext& ctx) {
335 IPC::RequestParser rp{ctx}; 369 IPC::RequestParser rp{ctx};
336 const auto npad_id_type{rp.PopEnum<Core::HID::NpadIdType>()}; 370 const auto npad_id_type{rp.PopEnum<Core::HID::NpadIdType>()};
@@ -423,13 +457,25 @@ void IHidSystemServer::GetUniquePadsFromNpad(HLERequestContext& ctx) {
423 rb.Push(static_cast<u32>(unique_pads.size())); 457 rb.Push(static_cast<u32>(unique_pads.size()));
424} 458}
425 459
426void IHidSystemServer::GetIrSensorState(HLERequestContext& ctx) { 460void IHidSystemServer::SetNpadSystemExtStateEnabled(HLERequestContext& ctx) {
427 IPC::RequestParser rp{ctx}; 461 IPC::RequestParser rp{ctx};
462 struct Parameters {
463 bool is_enabled;
464 INSERT_PADDING_BYTES_NOINIT(7);
465 u64 applet_resource_user_id;
466 };
467 static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size.");
428 468
429 LOG_WARNING(Service_HID, "(STUBBED) called"); 469 const auto parameters{rp.PopRaw<Parameters>()};
470
471 LOG_INFO(Service_HID, "called, is_enabled={}, applet_resource_user_id={}",
472 parameters.is_enabled, parameters.applet_resource_user_id);
473
474 const auto result = GetResourceManager()->GetNpad()->SetNpadSystemExtStateEnabled(
475 parameters.applet_resource_user_id, parameters.is_enabled);
430 476
431 IPC::ResponseBuilder rb{ctx, 2}; 477 IPC::ResponseBuilder rb{ctx, 2};
432 rb.Push(ResultSuccess); 478 rb.Push(result);
433} 479}
434void IHidSystemServer::RegisterAppletResourceUserId(HLERequestContext& ctx) { 480void IHidSystemServer::RegisterAppletResourceUserId(HLERequestContext& ctx) {
435 IPC::RequestParser rp{ctx}; 481 IPC::RequestParser rp{ctx};
diff --git a/src/core/hle/service/hid/hid_system_server.h b/src/core/hle/service/hid/hid_system_server.h
index f467e2aa8..0c2634e3f 100644
--- a/src/core/hle/service/hid/hid_system_server.h
+++ b/src/core/hle/service/hid/hid_system_server.h
@@ -31,13 +31,14 @@ private:
31 void GetNpadFullKeyGripColor(HLERequestContext& ctx); 31 void GetNpadFullKeyGripColor(HLERequestContext& ctx);
32 void GetMaskedSupportedNpadStyleSet(HLERequestContext& ctx); 32 void GetMaskedSupportedNpadStyleSet(HLERequestContext& ctx);
33 void SetSupportedNpadStyleSetAll(HLERequestContext& ctx); 33 void SetSupportedNpadStyleSetAll(HLERequestContext& ctx);
34 void GetNpadCaptureButtonAssignment(HLERequestContext& ctx);
34 void GetAppletDetailedUiType(HLERequestContext& ctx); 35 void GetAppletDetailedUiType(HLERequestContext& ctx);
35 void GetNpadInterfaceType(HLERequestContext& ctx); 36 void GetNpadInterfaceType(HLERequestContext& ctx);
36 void GetNpadLeftRightInterfaceType(HLERequestContext& ctx); 37 void GetNpadLeftRightInterfaceType(HLERequestContext& ctx);
37 void HasBattery(HLERequestContext& ctx); 38 void HasBattery(HLERequestContext& ctx);
38 void HasLeftRightBattery(HLERequestContext& ctx); 39 void HasLeftRightBattery(HLERequestContext& ctx);
39 void GetUniquePadsFromNpad(HLERequestContext& ctx); 40 void GetUniquePadsFromNpad(HLERequestContext& ctx);
40 void GetIrSensorState(HLERequestContext& ctx); 41 void SetNpadSystemExtStateEnabled(HLERequestContext& ctx);
41 void RegisterAppletResourceUserId(HLERequestContext& ctx); 42 void RegisterAppletResourceUserId(HLERequestContext& ctx);
42 void UnregisterAppletResourceUserId(HLERequestContext& ctx); 43 void UnregisterAppletResourceUserId(HLERequestContext& ctx);
43 void EnableAppletToGetInput(HLERequestContext& ctx); 44 void EnableAppletToGetInput(HLERequestContext& ctx);
diff --git a/src/core/hle/service/ns/language.cpp b/src/core/hle/service/ns/language.cpp
index 036a1e9b7..b1a7686ff 100644
--- a/src/core/hle/service/ns/language.cpp
+++ b/src/core/hle/service/ns/language.cpp
@@ -2,7 +2,7 @@
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "core/hle/service/ns/language.h" 4#include "core/hle/service/ns/language.h"
5#include "core/hle/service/set/set.h" 5#include "core/hle/service/set/settings_server.h"
6 6
7namespace Service::NS { 7namespace Service::NS {
8 8
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp
index f9e0e272d..a25b79513 100644
--- a/src/core/hle/service/ns/ns.cpp
+++ b/src/core/hle/service/ns/ns.cpp
@@ -16,7 +16,7 @@
16#include "core/hle/service/ns/ns.h" 16#include "core/hle/service/ns/ns.h"
17#include "core/hle/service/ns/pdm_qry.h" 17#include "core/hle/service/ns/pdm_qry.h"
18#include "core/hle/service/server_manager.h" 18#include "core/hle/service/server_manager.h"
19#include "core/hle/service/set/set.h" 19#include "core/hle/service/set/settings_server.h"
20 20
21namespace Service::NS { 21namespace Service::NS {
22 22
diff --git a/src/core/hle/service/set/set_cal.cpp b/src/core/hle/service/set/factory_settings_server.cpp
index d2c0d536f..a8e307ae2 100644
--- a/src/core/hle/service/set/set_cal.cpp
+++ b/src/core/hle/service/set/factory_settings_server.cpp
@@ -1,11 +1,12 @@
1// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project 1// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "core/hle/service/set/set_cal.h" 4#include "core/hle/service/set/factory_settings_server.h"
5 5
6namespace Service::Set { 6namespace Service::Set {
7 7
8SET_CAL::SET_CAL(Core::System& system_) : ServiceFramework{system_, "set:cal"} { 8IFactorySettingsServer::IFactorySettingsServer(Core::System& system_)
9 : ServiceFramework{system_, "set:cal"} {
9 // clang-format off 10 // clang-format off
10 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
11 {0, nullptr, "GetBluetoothBdAddress"}, 12 {0, nullptr, "GetBluetoothBdAddress"},
@@ -57,6 +58,6 @@ SET_CAL::SET_CAL(Core::System& system_) : ServiceFramework{system_, "set:cal"} {
57 RegisterHandlers(functions); 58 RegisterHandlers(functions);
58} 59}
59 60
60SET_CAL::~SET_CAL() = default; 61IFactorySettingsServer::~IFactorySettingsServer() = default;
61 62
62} // namespace Service::Set 63} // namespace Service::Set
diff --git a/src/core/hle/service/set/set_fd.h b/src/core/hle/service/set/factory_settings_server.h
index 150a7cbce..e64cd1380 100644
--- a/src/core/hle/service/set/set_fd.h
+++ b/src/core/hle/service/set/factory_settings_server.h
@@ -11,10 +11,10 @@ class System;
11 11
12namespace Service::Set { 12namespace Service::Set {
13 13
14class SET_FD final : public ServiceFramework<SET_FD> { 14class IFactorySettingsServer final : public ServiceFramework<IFactorySettingsServer> {
15public: 15public:
16 explicit SET_FD(Core::System& system_); 16 explicit IFactorySettingsServer(Core::System& system_);
17 ~SET_FD() override; 17 ~IFactorySettingsServer() override;
18}; 18};
19 19
20} // namespace Service::Set 20} // namespace Service::Set
diff --git a/src/core/hle/service/set/set_fd.cpp b/src/core/hle/service/set/firmware_debug_settings_server.cpp
index 278ef32e1..b3a5e623b 100644
--- a/src/core/hle/service/set/set_fd.cpp
+++ b/src/core/hle/service/set/firmware_debug_settings_server.cpp
@@ -1,11 +1,12 @@
1// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project 1// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "core/hle/service/set/set_fd.h" 4#include "core/hle/service/set/firmware_debug_settings_server.h"
5 5
6namespace Service::Set { 6namespace Service::Set {
7 7
8SET_FD::SET_FD(Core::System& system_) : ServiceFramework{system_, "set:fd"} { 8IFirmwareDebugSettingsServer::IFirmwareDebugSettingsServer(Core::System& system_)
9 : ServiceFramework{system_, "set:fd"} {
9 // clang-format off 10 // clang-format off
10 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
11 {2, nullptr, "SetSettingsItemValue"}, 12 {2, nullptr, "SetSettingsItemValue"},
@@ -23,6 +24,6 @@ SET_FD::SET_FD(Core::System& system_) : ServiceFramework{system_, "set:fd"} {
23 RegisterHandlers(functions); 24 RegisterHandlers(functions);
24} 25}
25 26
26SET_FD::~SET_FD() = default; 27IFirmwareDebugSettingsServer::~IFirmwareDebugSettingsServer() = default;
27 28
28} // namespace Service::Set 29} // namespace Service::Set
diff --git a/src/core/hle/service/set/set_cal.h b/src/core/hle/service/set/firmware_debug_settings_server.h
index 8f50278ed..5dae2263e 100644
--- a/src/core/hle/service/set/set_cal.h
+++ b/src/core/hle/service/set/firmware_debug_settings_server.h
@@ -11,10 +11,10 @@ class System;
11 11
12namespace Service::Set { 12namespace Service::Set {
13 13
14class SET_CAL final : public ServiceFramework<SET_CAL> { 14class IFirmwareDebugSettingsServer final : public ServiceFramework<IFirmwareDebugSettingsServer> {
15public: 15public:
16 explicit SET_CAL(Core::System& system_); 16 explicit IFirmwareDebugSettingsServer(Core::System& system_);
17 ~SET_CAL() override; 17 ~IFirmwareDebugSettingsServer() override;
18}; 18};
19 19
20} // namespace Service::Set 20} // namespace Service::Set
diff --git a/src/core/hle/service/set/settings.cpp b/src/core/hle/service/set/settings.cpp
index c48844f77..73d021ff4 100644
--- a/src/core/hle/service/set/settings.cpp
+++ b/src/core/hle/service/set/settings.cpp
@@ -2,21 +2,24 @@
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "core/hle/service/server_manager.h" 4#include "core/hle/service/server_manager.h"
5#include "core/hle/service/set/set.h" 5#include "core/hle/service/set/factory_settings_server.h"
6#include "core/hle/service/set/set_cal.h" 6#include "core/hle/service/set/firmware_debug_settings_server.h"
7#include "core/hle/service/set/set_fd.h"
8#include "core/hle/service/set/set_sys.h"
9#include "core/hle/service/set/settings.h" 7#include "core/hle/service/set/settings.h"
8#include "core/hle/service/set/settings_server.h"
9#include "core/hle/service/set/system_settings_server.h"
10 10
11namespace Service::Set { 11namespace Service::Set {
12 12
13void LoopProcess(Core::System& system) { 13void LoopProcess(Core::System& system) {
14 auto server_manager = std::make_unique<ServerManager>(system); 14 auto server_manager = std::make_unique<ServerManager>(system);
15 15
16 server_manager->RegisterNamedService("set", std::make_shared<SET>(system)); 16 server_manager->RegisterNamedService("set", std::make_shared<ISettingsServer>(system));
17 server_manager->RegisterNamedService("set:cal", std::make_shared<SET_CAL>(system)); 17 server_manager->RegisterNamedService("set:cal",
18 server_manager->RegisterNamedService("set:fd", std::make_shared<SET_FD>(system)); 18 std::make_shared<IFactorySettingsServer>(system));
19 server_manager->RegisterNamedService("set:sys", std::make_shared<SET_SYS>(system)); 19 server_manager->RegisterNamedService("set:fd",
20 std::make_shared<IFirmwareDebugSettingsServer>(system));
21 server_manager->RegisterNamedService("set:sys",
22 std::make_shared<ISystemSettingsServer>(system));
20 ServerManager::RunServer(std::move(server_manager)); 23 ServerManager::RunServer(std::move(server_manager));
21} 24}
22 25
diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/settings_server.cpp
index 2082b8ef7..b2caa00ff 100644
--- a/src/core/hle/service/set/set.cpp
+++ b/src/core/hle/service/set/settings_server.cpp
@@ -7,7 +7,7 @@
7#include "common/logging/log.h" 7#include "common/logging/log.h"
8#include "common/settings.h" 8#include "common/settings.h"
9#include "core/hle/service/ipc_helpers.h" 9#include "core/hle/service/ipc_helpers.h"
10#include "core/hle/service/set/set.h" 10#include "core/hle/service/set/settings_server.h"
11 11
12namespace Service::Set { 12namespace Service::Set {
13namespace { 13namespace {
@@ -58,13 +58,36 @@ LanguageCode GetLanguageCodeFromIndex(std::size_t index) {
58 return available_language_codes.at(index); 58 return available_language_codes.at(index);
59} 59}
60 60
61void SET::GetAvailableLanguageCodes(HLERequestContext& ctx) { 61ISettingsServer::ISettingsServer(Core::System& system_) : ServiceFramework{system_, "set"} {
62 // clang-format off
63 static const FunctionInfo functions[] = {
64 {0, &ISettingsServer::GetLanguageCode, "GetLanguageCode"},
65 {1, &ISettingsServer::GetAvailableLanguageCodes, "GetAvailableLanguageCodes"},
66 {2, &ISettingsServer::MakeLanguageCode, "MakeLanguageCode"},
67 {3, &ISettingsServer::GetAvailableLanguageCodeCount, "GetAvailableLanguageCodeCount"},
68 {4, &ISettingsServer::GetRegionCode, "GetRegionCode"},
69 {5, &ISettingsServer::GetAvailableLanguageCodes2, "GetAvailableLanguageCodes2"},
70 {6, &ISettingsServer::GetAvailableLanguageCodeCount2, "GetAvailableLanguageCodeCount2"},
71 {7, &ISettingsServer::GetKeyCodeMap, "GetKeyCodeMap"},
72 {8, &ISettingsServer::GetQuestFlag, "GetQuestFlag"},
73 {9, &ISettingsServer::GetKeyCodeMap2, "GetKeyCodeMap2"},
74 {10, nullptr, "GetFirmwareVersionForDebug"},
75 {11, &ISettingsServer::GetDeviceNickName, "GetDeviceNickName"},
76 };
77 // clang-format on
78
79 RegisterHandlers(functions);
80}
81
82ISettingsServer::~ISettingsServer() = default;
83
84void ISettingsServer::GetAvailableLanguageCodes(HLERequestContext& ctx) {
62 LOG_DEBUG(Service_SET, "called"); 85 LOG_DEBUG(Service_SET, "called");
63 86
64 GetAvailableLanguageCodesImpl(ctx, PRE_4_0_0_MAX_ENTRIES); 87 GetAvailableLanguageCodesImpl(ctx, PRE_4_0_0_MAX_ENTRIES);
65} 88}
66 89
67void SET::MakeLanguageCode(HLERequestContext& ctx) { 90void ISettingsServer::MakeLanguageCode(HLERequestContext& ctx) {
68 IPC::RequestParser rp{ctx}; 91 IPC::RequestParser rp{ctx};
69 const auto index = rp.Pop<u32>(); 92 const auto index = rp.Pop<u32>();
70 93
@@ -80,25 +103,25 @@ void SET::MakeLanguageCode(HLERequestContext& ctx) {
80 rb.PushEnum(available_language_codes[index]); 103 rb.PushEnum(available_language_codes[index]);
81} 104}
82 105
83void SET::GetAvailableLanguageCodes2(HLERequestContext& ctx) { 106void ISettingsServer::GetAvailableLanguageCodes2(HLERequestContext& ctx) {
84 LOG_DEBUG(Service_SET, "called"); 107 LOG_DEBUG(Service_SET, "called");
85 108
86 GetAvailableLanguageCodesImpl(ctx, POST_4_0_0_MAX_ENTRIES); 109 GetAvailableLanguageCodesImpl(ctx, POST_4_0_0_MAX_ENTRIES);
87} 110}
88 111
89void SET::GetAvailableLanguageCodeCount(HLERequestContext& ctx) { 112void ISettingsServer::GetAvailableLanguageCodeCount(HLERequestContext& ctx) {
90 LOG_DEBUG(Service_SET, "called"); 113 LOG_DEBUG(Service_SET, "called");
91 114
92 PushResponseLanguageCode(ctx, PRE_4_0_0_MAX_ENTRIES); 115 PushResponseLanguageCode(ctx, PRE_4_0_0_MAX_ENTRIES);
93} 116}
94 117
95void SET::GetAvailableLanguageCodeCount2(HLERequestContext& ctx) { 118void ISettingsServer::GetAvailableLanguageCodeCount2(HLERequestContext& ctx) {
96 LOG_DEBUG(Service_SET, "called"); 119 LOG_DEBUG(Service_SET, "called");
97 120
98 PushResponseLanguageCode(ctx, POST_4_0_0_MAX_ENTRIES); 121 PushResponseLanguageCode(ctx, POST_4_0_0_MAX_ENTRIES);
99} 122}
100 123
101void SET::GetQuestFlag(HLERequestContext& ctx) { 124void ISettingsServer::GetQuestFlag(HLERequestContext& ctx) {
102 LOG_DEBUG(Service_SET, "called"); 125 LOG_DEBUG(Service_SET, "called");
103 126
104 IPC::ResponseBuilder rb{ctx, 3}; 127 IPC::ResponseBuilder rb{ctx, 3};
@@ -106,7 +129,7 @@ void SET::GetQuestFlag(HLERequestContext& ctx) {
106 rb.Push(static_cast<s32>(Settings::values.quest_flag.GetValue())); 129 rb.Push(static_cast<s32>(Settings::values.quest_flag.GetValue()));
107} 130}
108 131
109void SET::GetLanguageCode(HLERequestContext& ctx) { 132void ISettingsServer::GetLanguageCode(HLERequestContext& ctx) {
110 LOG_DEBUG(Service_SET, "called {}", Settings::values.language_index.GetValue()); 133 LOG_DEBUG(Service_SET, "called {}", Settings::values.language_index.GetValue());
111 134
112 IPC::ResponseBuilder rb{ctx, 4}; 135 IPC::ResponseBuilder rb{ctx, 4};
@@ -115,7 +138,7 @@ void SET::GetLanguageCode(HLERequestContext& ctx) {
115 available_language_codes[static_cast<s32>(Settings::values.language_index.GetValue())]); 138 available_language_codes[static_cast<s32>(Settings::values.language_index.GetValue())]);
116} 139}
117 140
118void SET::GetRegionCode(HLERequestContext& ctx) { 141void ISettingsServer::GetRegionCode(HLERequestContext& ctx) {
119 LOG_DEBUG(Service_SET, "called"); 142 LOG_DEBUG(Service_SET, "called");
120 143
121 IPC::ResponseBuilder rb{ctx, 3}; 144 IPC::ResponseBuilder rb{ctx, 3};
@@ -123,44 +146,21 @@ void SET::GetRegionCode(HLERequestContext& ctx) {
123 rb.Push(static_cast<u32>(Settings::values.region_index.GetValue())); 146 rb.Push(static_cast<u32>(Settings::values.region_index.GetValue()));
124} 147}
125 148
126void SET::GetKeyCodeMap(HLERequestContext& ctx) { 149void ISettingsServer::GetKeyCodeMap(HLERequestContext& ctx) {
127 LOG_DEBUG(Service_SET, "Called {}", ctx.Description()); 150 LOG_DEBUG(Service_SET, "Called {}", ctx.Description());
128 GetKeyCodeMapImpl(ctx); 151 GetKeyCodeMapImpl(ctx);
129} 152}
130 153
131void SET::GetKeyCodeMap2(HLERequestContext& ctx) { 154void ISettingsServer::GetKeyCodeMap2(HLERequestContext& ctx) {
132 LOG_DEBUG(Service_SET, "Called {}", ctx.Description()); 155 LOG_DEBUG(Service_SET, "Called {}", ctx.Description());
133 GetKeyCodeMapImpl(ctx); 156 GetKeyCodeMapImpl(ctx);
134} 157}
135 158
136void SET::GetDeviceNickName(HLERequestContext& ctx) { 159void ISettingsServer::GetDeviceNickName(HLERequestContext& ctx) {
137 LOG_DEBUG(Service_SET, "called"); 160 LOG_DEBUG(Service_SET, "called");
138 IPC::ResponseBuilder rb{ctx, 2}; 161 IPC::ResponseBuilder rb{ctx, 2};
139 rb.Push(ResultSuccess); 162 rb.Push(ResultSuccess);
140 ctx.WriteBuffer(Settings::values.device_name.GetValue()); 163 ctx.WriteBuffer(Settings::values.device_name.GetValue());
141} 164}
142 165
143SET::SET(Core::System& system_) : ServiceFramework{system_, "set"} {
144 // clang-format off
145 static const FunctionInfo functions[] = {
146 {0, &SET::GetLanguageCode, "GetLanguageCode"},
147 {1, &SET::GetAvailableLanguageCodes, "GetAvailableLanguageCodes"},
148 {2, &SET::MakeLanguageCode, "MakeLanguageCode"},
149 {3, &SET::GetAvailableLanguageCodeCount, "GetAvailableLanguageCodeCount"},
150 {4, &SET::GetRegionCode, "GetRegionCode"},
151 {5, &SET::GetAvailableLanguageCodes2, "GetAvailableLanguageCodes2"},
152 {6, &SET::GetAvailableLanguageCodeCount2, "GetAvailableLanguageCodeCount2"},
153 {7, &SET::GetKeyCodeMap, "GetKeyCodeMap"},
154 {8, &SET::GetQuestFlag, "GetQuestFlag"},
155 {9, &SET::GetKeyCodeMap2, "GetKeyCodeMap2"},
156 {10, nullptr, "GetFirmwareVersionForDebug"},
157 {11, &SET::GetDeviceNickName, "GetDeviceNickName"},
158 };
159 // clang-format on
160
161 RegisterHandlers(functions);
162}
163
164SET::~SET() = default;
165
166} // namespace Service::Set 166} // namespace Service::Set
diff --git a/src/core/hle/service/set/set.h b/src/core/hle/service/set/settings_server.h
index 6ef3da410..a4e78db6c 100644
--- a/src/core/hle/service/set/set.h
+++ b/src/core/hle/service/set/settings_server.h
@@ -73,10 +73,10 @@ static constexpr std::array<std::pair<LanguageCode, KeyboardLayout>, 18> languag
73 73
74LanguageCode GetLanguageCodeFromIndex(std::size_t idx); 74LanguageCode GetLanguageCodeFromIndex(std::size_t idx);
75 75
76class SET final : public ServiceFramework<SET> { 76class ISettingsServer final : public ServiceFramework<ISettingsServer> {
77public: 77public:
78 explicit SET(Core::System& system_); 78 explicit ISettingsServer(Core::System& system_);
79 ~SET() override; 79 ~ISettingsServer() override;
80 80
81private: 81private:
82 void GetLanguageCode(HLERequestContext& ctx); 82 void GetLanguageCode(HLERequestContext& ctx);
diff --git a/src/core/hle/service/set/set_sys.cpp b/src/core/hle/service/set/system_settings_server.cpp
index 8e637f963..f7ad6193e 100644
--- a/src/core/hle/service/set/set_sys.cpp
+++ b/src/core/hle/service/set/system_settings_server.cpp
@@ -19,8 +19,8 @@
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/filesystem/filesystem.h" 20#include "core/hle/service/filesystem/filesystem.h"
21#include "core/hle/service/ipc_helpers.h" 21#include "core/hle/service/ipc_helpers.h"
22#include "core/hle/service/set/set.h" 22#include "core/hle/service/set/settings_server.h"
23#include "core/hle/service/set/set_sys.h" 23#include "core/hle/service/set/system_settings_server.h"
24 24
25namespace Service::Set { 25namespace Service::Set {
26 26
@@ -87,7 +87,234 @@ Result GetFirmwareVersionImpl(FirmwareVersionFormat& out_firmware, Core::System&
87 return ResultSuccess; 87 return ResultSuccess;
88} 88}
89 89
90bool SET_SYS::LoadSettingsFile(std::filesystem::path& path, auto&& default_func) { 90ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
91 : ServiceFramework{system_, "set:sys"}, m_system{system} {
92 // clang-format off
93 static const FunctionInfo functions[] = {
94 {0, &ISystemSettingsServer::SetLanguageCode, "SetLanguageCode"},
95 {1, nullptr, "SetNetworkSettings"},
96 {2, nullptr, "GetNetworkSettings"},
97 {3, &ISystemSettingsServer::GetFirmwareVersion, "GetFirmwareVersion"},
98 {4, &ISystemSettingsServer::GetFirmwareVersion2, "GetFirmwareVersion2"},
99 {5, nullptr, "GetFirmwareVersionDigest"},
100 {7, nullptr, "GetLockScreenFlag"},
101 {8, nullptr, "SetLockScreenFlag"},
102 {9, nullptr, "GetBacklightSettings"},
103 {10, nullptr, "SetBacklightSettings"},
104 {11, nullptr, "SetBluetoothDevicesSettings"},
105 {12, nullptr, "GetBluetoothDevicesSettings"},
106 {13, &ISystemSettingsServer::GetExternalSteadyClockSourceId, "GetExternalSteadyClockSourceId"},
107 {14, &ISystemSettingsServer::SetExternalSteadyClockSourceId, "SetExternalSteadyClockSourceId"},
108 {15, &ISystemSettingsServer::GetUserSystemClockContext, "GetUserSystemClockContext"},
109 {16, &ISystemSettingsServer::SetUserSystemClockContext, "SetUserSystemClockContext"},
110 {17, &ISystemSettingsServer::GetAccountSettings, "GetAccountSettings"},
111 {18, &ISystemSettingsServer::SetAccountSettings, "SetAccountSettings"},
112 {19, nullptr, "GetAudioVolume"},
113 {20, nullptr, "SetAudioVolume"},
114 {21, &ISystemSettingsServer::GetEulaVersions, "GetEulaVersions"},
115 {22, &ISystemSettingsServer::SetEulaVersions, "SetEulaVersions"},
116 {23, &ISystemSettingsServer::GetColorSetId, "GetColorSetId"},
117 {24, &ISystemSettingsServer::SetColorSetId, "SetColorSetId"},
118 {25, nullptr, "GetConsoleInformationUploadFlag"},
119 {26, nullptr, "SetConsoleInformationUploadFlag"},
120 {27, nullptr, "GetAutomaticApplicationDownloadFlag"},
121 {28, nullptr, "SetAutomaticApplicationDownloadFlag"},
122 {29, &ISystemSettingsServer::GetNotificationSettings, "GetNotificationSettings"},
123 {30, &ISystemSettingsServer::SetNotificationSettings, "SetNotificationSettings"},
124 {31, &ISystemSettingsServer::GetAccountNotificationSettings, "GetAccountNotificationSettings"},
125 {32, &ISystemSettingsServer::SetAccountNotificationSettings, "SetAccountNotificationSettings"},
126 {35, nullptr, "GetVibrationMasterVolume"},
127 {36, nullptr, "SetVibrationMasterVolume"},
128 {37, &ISystemSettingsServer::GetSettingsItemValueSize, "GetSettingsItemValueSize"},
129 {38, &ISystemSettingsServer::GetSettingsItemValue, "GetSettingsItemValue"},
130 {39, &ISystemSettingsServer::GetTvSettings, "GetTvSettings"},
131 {40, &ISystemSettingsServer::SetTvSettings, "SetTvSettings"},
132 {41, nullptr, "GetEdid"},
133 {42, nullptr, "SetEdid"},
134 {43, nullptr, "GetAudioOutputMode"},
135 {44, nullptr, "SetAudioOutputMode"},
136 {45, nullptr, "IsForceMuteOnHeadphoneRemoved"},
137 {46, nullptr, "SetForceMuteOnHeadphoneRemoved"},
138 {47, &ISystemSettingsServer::GetQuestFlag, "GetQuestFlag"},
139 {48, nullptr, "SetQuestFlag"},
140 {49, nullptr, "GetDataDeletionSettings"},
141 {50, nullptr, "SetDataDeletionSettings"},
142 {51, nullptr, "GetInitialSystemAppletProgramId"},
143 {52, nullptr, "GetOverlayDispProgramId"},
144 {53, &ISystemSettingsServer::GetDeviceTimeZoneLocationName, "GetDeviceTimeZoneLocationName"},
145 {54, &ISystemSettingsServer::SetDeviceTimeZoneLocationName, "SetDeviceTimeZoneLocationName"},
146 {55, nullptr, "GetWirelessCertificationFileSize"},
147 {56, nullptr, "GetWirelessCertificationFile"},
148 {57, &ISystemSettingsServer::SetRegionCode, "SetRegionCode"},
149 {58, &ISystemSettingsServer::GetNetworkSystemClockContext, "GetNetworkSystemClockContext"},
150 {59, &ISystemSettingsServer::SetNetworkSystemClockContext, "SetNetworkSystemClockContext"},
151 {60, &ISystemSettingsServer::IsUserSystemClockAutomaticCorrectionEnabled, "IsUserSystemClockAutomaticCorrectionEnabled"},
152 {61, &ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionEnabled, "SetUserSystemClockAutomaticCorrectionEnabled"},
153 {62, &ISystemSettingsServer::GetDebugModeFlag, "GetDebugModeFlag"},
154 {63, &ISystemSettingsServer::GetPrimaryAlbumStorage, "GetPrimaryAlbumStorage"},
155 {64, nullptr, "SetPrimaryAlbumStorage"},
156 {65, nullptr, "GetUsb30EnableFlag"},
157 {66, nullptr, "SetUsb30EnableFlag"},
158 {67, nullptr, "GetBatteryLot"},
159 {68, nullptr, "GetSerialNumber"},
160 {69, nullptr, "GetNfcEnableFlag"},
161 {70, nullptr, "SetNfcEnableFlag"},
162 {71, &ISystemSettingsServer::GetSleepSettings, "GetSleepSettings"},
163 {72, &ISystemSettingsServer::SetSleepSettings, "SetSleepSettings"},
164 {73, nullptr, "GetWirelessLanEnableFlag"},
165 {74, nullptr, "SetWirelessLanEnableFlag"},
166 {75, &ISystemSettingsServer::GetInitialLaunchSettings, "GetInitialLaunchSettings"},
167 {76, &ISystemSettingsServer::SetInitialLaunchSettings, "SetInitialLaunchSettings"},
168 {77, &ISystemSettingsServer::GetDeviceNickName, "GetDeviceNickName"},
169 {78, &ISystemSettingsServer::SetDeviceNickName, "SetDeviceNickName"},
170 {79, &ISystemSettingsServer::GetProductModel, "GetProductModel"},
171 {80, nullptr, "GetLdnChannel"},
172 {81, nullptr, "SetLdnChannel"},
173 {82, nullptr, "AcquireTelemetryDirtyFlagEventHandle"},
174 {83, nullptr, "GetTelemetryDirtyFlags"},
175 {84, nullptr, "GetPtmBatteryLot"},
176 {85, nullptr, "SetPtmBatteryLot"},
177 {86, nullptr, "GetPtmFuelGaugeParameter"},
178 {87, nullptr, "SetPtmFuelGaugeParameter"},
179 {88, nullptr, "GetBluetoothEnableFlag"},
180 {89, nullptr, "SetBluetoothEnableFlag"},
181 {90, &ISystemSettingsServer::GetMiiAuthorId, "GetMiiAuthorId"},
182 {91, nullptr, "SetShutdownRtcValue"},
183 {92, nullptr, "GetShutdownRtcValue"},
184 {93, nullptr, "AcquireFatalDirtyFlagEventHandle"},
185 {94, nullptr, "GetFatalDirtyFlags"},
186 {95, &ISystemSettingsServer::GetAutoUpdateEnableFlag, "GetAutoUpdateEnableFlag"},
187 {96, nullptr, "SetAutoUpdateEnableFlag"},
188 {97, nullptr, "GetNxControllerSettings"},
189 {98, nullptr, "SetNxControllerSettings"},
190 {99, &ISystemSettingsServer::GetBatteryPercentageFlag, "GetBatteryPercentageFlag"},
191 {100, nullptr, "SetBatteryPercentageFlag"},
192 {101, nullptr, "GetExternalRtcResetFlag"},
193 {102, nullptr, "SetExternalRtcResetFlag"},
194 {103, nullptr, "GetUsbFullKeyEnableFlag"},
195 {104, nullptr, "SetUsbFullKeyEnableFlag"},
196 {105, &ISystemSettingsServer::SetExternalSteadyClockInternalOffset, "SetExternalSteadyClockInternalOffset"},
197 {106, &ISystemSettingsServer::GetExternalSteadyClockInternalOffset, "GetExternalSteadyClockInternalOffset"},
198 {107, nullptr, "GetBacklightSettingsEx"},
199 {108, nullptr, "SetBacklightSettingsEx"},
200 {109, nullptr, "GetHeadphoneVolumeWarningCount"},
201 {110, nullptr, "SetHeadphoneVolumeWarningCount"},
202 {111, nullptr, "GetBluetoothAfhEnableFlag"},
203 {112, nullptr, "SetBluetoothAfhEnableFlag"},
204 {113, nullptr, "GetBluetoothBoostEnableFlag"},
205 {114, nullptr, "SetBluetoothBoostEnableFlag"},
206 {115, nullptr, "GetInRepairProcessEnableFlag"},
207 {116, nullptr, "SetInRepairProcessEnableFlag"},
208 {117, nullptr, "GetHeadphoneVolumeUpdateFlag"},
209 {118, nullptr, "SetHeadphoneVolumeUpdateFlag"},
210 {119, nullptr, "NeedsToUpdateHeadphoneVolume"},
211 {120, nullptr, "GetPushNotificationActivityModeOnSleep"},
212 {121, nullptr, "SetPushNotificationActivityModeOnSleep"},
213 {122, nullptr, "GetServiceDiscoveryControlSettings"},
214 {123, nullptr, "SetServiceDiscoveryControlSettings"},
215 {124, &ISystemSettingsServer::GetErrorReportSharePermission, "GetErrorReportSharePermission"},
216 {125, nullptr, "SetErrorReportSharePermission"},
217 {126, &ISystemSettingsServer::GetAppletLaunchFlags, "GetAppletLaunchFlags"},
218 {127, &ISystemSettingsServer::SetAppletLaunchFlags, "SetAppletLaunchFlags"},
219 {128, nullptr, "GetConsoleSixAxisSensorAccelerationBias"},
220 {129, nullptr, "SetConsoleSixAxisSensorAccelerationBias"},
221 {130, nullptr, "GetConsoleSixAxisSensorAngularVelocityBias"},
222 {131, nullptr, "SetConsoleSixAxisSensorAngularVelocityBias"},
223 {132, nullptr, "GetConsoleSixAxisSensorAccelerationGain"},
224 {133, nullptr, "SetConsoleSixAxisSensorAccelerationGain"},
225 {134, nullptr, "GetConsoleSixAxisSensorAngularVelocityGain"},
226 {135, nullptr, "SetConsoleSixAxisSensorAngularVelocityGain"},
227 {136, &ISystemSettingsServer::GetKeyboardLayout, "GetKeyboardLayout"},
228 {137, nullptr, "SetKeyboardLayout"},
229 {138, nullptr, "GetWebInspectorFlag"},
230 {139, nullptr, "GetAllowedSslHosts"},
231 {140, nullptr, "GetHostFsMountPoint"},
232 {141, nullptr, "GetRequiresRunRepairTimeReviser"},
233 {142, nullptr, "SetRequiresRunRepairTimeReviser"},
234 {143, nullptr, "SetBlePairingSettings"},
235 {144, nullptr, "GetBlePairingSettings"},
236 {145, nullptr, "GetConsoleSixAxisSensorAngularVelocityTimeBias"},
237 {146, nullptr, "SetConsoleSixAxisSensorAngularVelocityTimeBias"},
238 {147, nullptr, "GetConsoleSixAxisSensorAngularAcceleration"},
239 {148, nullptr, "SetConsoleSixAxisSensorAngularAcceleration"},
240 {149, nullptr, "GetRebootlessSystemUpdateVersion"},
241 {150, &ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime, "GetDeviceTimeZoneLocationUpdatedTime"},
242 {151, &ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime, "SetDeviceTimeZoneLocationUpdatedTime"},
243 {152, &ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime, "GetUserSystemClockAutomaticCorrectionUpdatedTime"},
244 {153, &ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime, "SetUserSystemClockAutomaticCorrectionUpdatedTime"},
245 {154, nullptr, "GetAccountOnlineStorageSettings"},
246 {155, nullptr, "SetAccountOnlineStorageSettings"},
247 {156, nullptr, "GetPctlReadyFlag"},
248 {157, nullptr, "SetPctlReadyFlag"},
249 {158, nullptr, "GetAnalogStickUserCalibrationL"},
250 {159, nullptr, "SetAnalogStickUserCalibrationL"},
251 {160, nullptr, "GetAnalogStickUserCalibrationR"},
252 {161, nullptr, "SetAnalogStickUserCalibrationR"},
253 {162, nullptr, "GetPtmBatteryVersion"},
254 {163, nullptr, "SetPtmBatteryVersion"},
255 {164, nullptr, "GetUsb30HostEnableFlag"},
256 {165, nullptr, "SetUsb30HostEnableFlag"},
257 {166, nullptr, "GetUsb30DeviceEnableFlag"},
258 {167, nullptr, "SetUsb30DeviceEnableFlag"},
259 {168, nullptr, "GetThemeId"},
260 {169, nullptr, "SetThemeId"},
261 {170, &ISystemSettingsServer::GetChineseTraditionalInputMethod, "GetChineseTraditionalInputMethod"},
262 {171, nullptr, "SetChineseTraditionalInputMethod"},
263 {172, nullptr, "GetPtmCycleCountReliability"},
264 {173, nullptr, "SetPtmCycleCountReliability"},
265 {174, &ISystemSettingsServer::GetHomeMenuScheme, "GetHomeMenuScheme"},
266 {175, nullptr, "GetThemeSettings"},
267 {176, nullptr, "SetThemeSettings"},
268 {177, nullptr, "GetThemeKey"},
269 {178, nullptr, "SetThemeKey"},
270 {179, nullptr, "GetZoomFlag"},
271 {180, nullptr, "SetZoomFlag"},
272 {181, nullptr, "GetT"},
273 {182, nullptr, "SetT"},
274 {183, nullptr, "GetPlatformRegion"},
275 {184, nullptr, "SetPlatformRegion"},
276 {185, &ISystemSettingsServer::GetHomeMenuSchemeModel, "GetHomeMenuSchemeModel"},
277 {186, nullptr, "GetMemoryUsageRateFlag"},
278 {187, nullptr, "GetTouchScreenMode"},
279 {188, nullptr, "SetTouchScreenMode"},
280 {189, nullptr, "GetButtonConfigSettingsFull"},
281 {190, nullptr, "SetButtonConfigSettingsFull"},
282 {191, nullptr, "GetButtonConfigSettingsEmbedded"},
283 {192, nullptr, "SetButtonConfigSettingsEmbedded"},
284 {193, nullptr, "GetButtonConfigSettingsLeft"},
285 {194, nullptr, "SetButtonConfigSettingsLeft"},
286 {195, nullptr, "GetButtonConfigSettingsRight"},
287 {196, nullptr, "SetButtonConfigSettingsRight"},
288 {197, nullptr, "GetButtonConfigRegisteredSettingsEmbedded"},
289 {198, nullptr, "SetButtonConfigRegisteredSettingsEmbedded"},
290 {199, nullptr, "GetButtonConfigRegisteredSettings"},
291 {200, nullptr, "SetButtonConfigRegisteredSettings"},
292 {201, &ISystemSettingsServer::GetFieldTestingFlag, "GetFieldTestingFlag"},
293 {202, nullptr, "SetFieldTestingFlag"},
294 {203, nullptr, "GetPanelCrcMode"},
295 {204, nullptr, "SetPanelCrcMode"},
296 {205, nullptr, "GetNxControllerSettingsEx"},
297 {206, nullptr, "SetNxControllerSettingsEx"},
298 {207, nullptr, "GetHearingProtectionSafeguardFlag"},
299 {208, nullptr, "SetHearingProtectionSafeguardFlag"},
300 {209, nullptr, "GetHearingProtectionSafeguardRemainingTime"},
301 {210, nullptr, "SetHearingProtectionSafeguardRemainingTime"},
302 };
303 // clang-format on
304
305 RegisterHandlers(functions);
306
307 SetupSettings();
308 m_save_thread =
309 std::jthread([this](std::stop_token stop_token) { StoreSettingsThreadFunc(stop_token); });
310}
311
312ISystemSettingsServer::~ISystemSettingsServer() {
313 SetSaveNeeded();
314 m_save_thread.request_stop();
315}
316
317bool ISystemSettingsServer::LoadSettingsFile(std::filesystem::path& path, auto&& default_func) {
91 using settings_type = decltype(default_func()); 318 using settings_type = decltype(default_func());
92 319
93 if (!Common::FS::CreateDirs(path)) { 320 if (!Common::FS::CreateDirs(path)) {
@@ -155,7 +382,7 @@ bool SET_SYS::LoadSettingsFile(std::filesystem::path& path, auto&& default_func)
155 return true; 382 return true;
156} 383}
157 384
158bool SET_SYS::StoreSettingsFile(std::filesystem::path& path, auto& settings) { 385bool ISystemSettingsServer::StoreSettingsFile(std::filesystem::path& path, auto& settings) {
159 using settings_type = std::decay_t<decltype(settings)>; 386 using settings_type = std::decay_t<decltype(settings)>;
160 387
161 if (!Common::FS::IsDir(path)) { 388 if (!Common::FS::IsDir(path)) {
@@ -195,7 +422,7 @@ bool SET_SYS::StoreSettingsFile(std::filesystem::path& path, auto& settings) {
195 return true; 422 return true;
196} 423}
197 424
198void SET_SYS::SetLanguageCode(HLERequestContext& ctx) { 425void ISystemSettingsServer::SetLanguageCode(HLERequestContext& ctx) {
199 IPC::RequestParser rp{ctx}; 426 IPC::RequestParser rp{ctx};
200 m_system_settings.language_code = rp.PopEnum<LanguageCode>(); 427 m_system_settings.language_code = rp.PopEnum<LanguageCode>();
201 SetSaveNeeded(); 428 SetSaveNeeded();
@@ -206,7 +433,7 @@ void SET_SYS::SetLanguageCode(HLERequestContext& ctx) {
206 rb.Push(ResultSuccess); 433 rb.Push(ResultSuccess);
207} 434}
208 435
209void SET_SYS::GetFirmwareVersion(HLERequestContext& ctx) { 436void ISystemSettingsServer::GetFirmwareVersion(HLERequestContext& ctx) {
210 LOG_DEBUG(Service_SET, "called"); 437 LOG_DEBUG(Service_SET, "called");
211 438
212 FirmwareVersionFormat firmware_data{}; 439 FirmwareVersionFormat firmware_data{};
@@ -221,7 +448,7 @@ void SET_SYS::GetFirmwareVersion(HLERequestContext& ctx) {
221 rb.Push(result); 448 rb.Push(result);
222} 449}
223 450
224void SET_SYS::GetFirmwareVersion2(HLERequestContext& ctx) { 451void ISystemSettingsServer::GetFirmwareVersion2(HLERequestContext& ctx) {
225 LOG_DEBUG(Service_SET, "called"); 452 LOG_DEBUG(Service_SET, "called");
226 453
227 FirmwareVersionFormat firmware_data{}; 454 FirmwareVersionFormat firmware_data{};
@@ -236,7 +463,7 @@ void SET_SYS::GetFirmwareVersion2(HLERequestContext& ctx) {
236 rb.Push(result); 463 rb.Push(result);
237} 464}
238 465
239void SET_SYS::GetExternalSteadyClockSourceId(HLERequestContext& ctx) { 466void ISystemSettingsServer::GetExternalSteadyClockSourceId(HLERequestContext& ctx) {
240 LOG_INFO(Service_SET, "called"); 467 LOG_INFO(Service_SET, "called");
241 468
242 Common::UUID id{}; 469 Common::UUID id{};
@@ -247,7 +474,7 @@ void SET_SYS::GetExternalSteadyClockSourceId(HLERequestContext& ctx) {
247 rb.PushRaw(id); 474 rb.PushRaw(id);
248} 475}
249 476
250void SET_SYS::SetExternalSteadyClockSourceId(HLERequestContext& ctx) { 477void ISystemSettingsServer::SetExternalSteadyClockSourceId(HLERequestContext& ctx) {
251 LOG_INFO(Service_SET, "called"); 478 LOG_INFO(Service_SET, "called");
252 479
253 IPC::RequestParser rp{ctx}; 480 IPC::RequestParser rp{ctx};
@@ -259,7 +486,7 @@ void SET_SYS::SetExternalSteadyClockSourceId(HLERequestContext& ctx) {
259 rb.Push(res); 486 rb.Push(res);
260} 487}
261 488
262void SET_SYS::GetUserSystemClockContext(HLERequestContext& ctx) { 489void ISystemSettingsServer::GetUserSystemClockContext(HLERequestContext& ctx) {
263 LOG_INFO(Service_SET, "called"); 490 LOG_INFO(Service_SET, "called");
264 491
265 Service::Time::Clock::SystemClockContext context{}; 492 Service::Time::Clock::SystemClockContext context{};
@@ -271,7 +498,7 @@ void SET_SYS::GetUserSystemClockContext(HLERequestContext& ctx) {
271 rb.PushRaw(context); 498 rb.PushRaw(context);
272} 499}
273 500
274void SET_SYS::SetUserSystemClockContext(HLERequestContext& ctx) { 501void ISystemSettingsServer::SetUserSystemClockContext(HLERequestContext& ctx) {
275 LOG_INFO(Service_SET, "called"); 502 LOG_INFO(Service_SET, "called");
276 503
277 IPC::RequestParser rp{ctx}; 504 IPC::RequestParser rp{ctx};
@@ -283,7 +510,7 @@ void SET_SYS::SetUserSystemClockContext(HLERequestContext& ctx) {
283 rb.Push(res); 510 rb.Push(res);
284} 511}
285 512
286void SET_SYS::GetAccountSettings(HLERequestContext& ctx) { 513void ISystemSettingsServer::GetAccountSettings(HLERequestContext& ctx) {
287 LOG_INFO(Service_SET, "called"); 514 LOG_INFO(Service_SET, "called");
288 515
289 IPC::ResponseBuilder rb{ctx, 3}; 516 IPC::ResponseBuilder rb{ctx, 3};
@@ -291,7 +518,7 @@ void SET_SYS::GetAccountSettings(HLERequestContext& ctx) {
291 rb.PushRaw(m_system_settings.account_settings); 518 rb.PushRaw(m_system_settings.account_settings);
292} 519}
293 520
294void SET_SYS::SetAccountSettings(HLERequestContext& ctx) { 521void ISystemSettingsServer::SetAccountSettings(HLERequestContext& ctx) {
295 IPC::RequestParser rp{ctx}; 522 IPC::RequestParser rp{ctx};
296 m_system_settings.account_settings = rp.PopRaw<AccountSettings>(); 523 m_system_settings.account_settings = rp.PopRaw<AccountSettings>();
297 SetSaveNeeded(); 524 SetSaveNeeded();
@@ -303,7 +530,7 @@ void SET_SYS::SetAccountSettings(HLERequestContext& ctx) {
303 rb.Push(ResultSuccess); 530 rb.Push(ResultSuccess);
304} 531}
305 532
306void SET_SYS::GetEulaVersions(HLERequestContext& ctx) { 533void ISystemSettingsServer::GetEulaVersions(HLERequestContext& ctx) {
307 LOG_INFO(Service_SET, "called"); 534 LOG_INFO(Service_SET, "called");
308 535
309 ctx.WriteBuffer(m_system_settings.eula_versions); 536 ctx.WriteBuffer(m_system_settings.eula_versions);
@@ -313,7 +540,7 @@ void SET_SYS::GetEulaVersions(HLERequestContext& ctx) {
313 rb.Push(m_system_settings.eula_version_count); 540 rb.Push(m_system_settings.eula_version_count);
314} 541}
315 542
316void SET_SYS::SetEulaVersions(HLERequestContext& ctx) { 543void ISystemSettingsServer::SetEulaVersions(HLERequestContext& ctx) {
317 const auto elements = ctx.GetReadBufferNumElements<EulaVersion>(); 544 const auto elements = ctx.GetReadBufferNumElements<EulaVersion>();
318 const auto buffer_data = ctx.ReadBuffer(); 545 const auto buffer_data = ctx.ReadBuffer();
319 546
@@ -329,7 +556,7 @@ void SET_SYS::SetEulaVersions(HLERequestContext& ctx) {
329 rb.Push(ResultSuccess); 556 rb.Push(ResultSuccess);
330} 557}
331 558
332void SET_SYS::GetColorSetId(HLERequestContext& ctx) { 559void ISystemSettingsServer::GetColorSetId(HLERequestContext& ctx) {
333 LOG_DEBUG(Service_SET, "called"); 560 LOG_DEBUG(Service_SET, "called");
334 561
335 IPC::ResponseBuilder rb{ctx, 3}; 562 IPC::ResponseBuilder rb{ctx, 3};
@@ -337,7 +564,7 @@ void SET_SYS::GetColorSetId(HLERequestContext& ctx) {
337 rb.PushEnum(m_system_settings.color_set_id); 564 rb.PushEnum(m_system_settings.color_set_id);
338} 565}
339 566
340void SET_SYS::SetColorSetId(HLERequestContext& ctx) { 567void ISystemSettingsServer::SetColorSetId(HLERequestContext& ctx) {
341 IPC::RequestParser rp{ctx}; 568 IPC::RequestParser rp{ctx};
342 m_system_settings.color_set_id = rp.PopEnum<ColorSet>(); 569 m_system_settings.color_set_id = rp.PopEnum<ColorSet>();
343 SetSaveNeeded(); 570 SetSaveNeeded();
@@ -348,7 +575,7 @@ void SET_SYS::SetColorSetId(HLERequestContext& ctx) {
348 rb.Push(ResultSuccess); 575 rb.Push(ResultSuccess);
349} 576}
350 577
351void SET_SYS::GetNotificationSettings(HLERequestContext& ctx) { 578void ISystemSettingsServer::GetNotificationSettings(HLERequestContext& ctx) {
352 LOG_INFO(Service_SET, "called"); 579 LOG_INFO(Service_SET, "called");
353 580
354 IPC::ResponseBuilder rb{ctx, 8}; 581 IPC::ResponseBuilder rb{ctx, 8};
@@ -356,7 +583,7 @@ void SET_SYS::GetNotificationSettings(HLERequestContext& ctx) {
356 rb.PushRaw(m_system_settings.notification_settings); 583 rb.PushRaw(m_system_settings.notification_settings);
357} 584}
358 585
359void SET_SYS::SetNotificationSettings(HLERequestContext& ctx) { 586void ISystemSettingsServer::SetNotificationSettings(HLERequestContext& ctx) {
360 IPC::RequestParser rp{ctx}; 587 IPC::RequestParser rp{ctx};
361 m_system_settings.notification_settings = rp.PopRaw<NotificationSettings>(); 588 m_system_settings.notification_settings = rp.PopRaw<NotificationSettings>();
362 SetSaveNeeded(); 589 SetSaveNeeded();
@@ -373,7 +600,7 @@ void SET_SYS::SetNotificationSettings(HLERequestContext& ctx) {
373 rb.Push(ResultSuccess); 600 rb.Push(ResultSuccess);
374} 601}
375 602
376void SET_SYS::GetAccountNotificationSettings(HLERequestContext& ctx) { 603void ISystemSettingsServer::GetAccountNotificationSettings(HLERequestContext& ctx) {
377 LOG_INFO(Service_SET, "called"); 604 LOG_INFO(Service_SET, "called");
378 605
379 ctx.WriteBuffer(m_system_settings.account_notification_settings); 606 ctx.WriteBuffer(m_system_settings.account_notification_settings);
@@ -383,7 +610,7 @@ void SET_SYS::GetAccountNotificationSettings(HLERequestContext& ctx) {
383 rb.Push(m_system_settings.account_notification_settings_count); 610 rb.Push(m_system_settings.account_notification_settings_count);
384} 611}
385 612
386void SET_SYS::SetAccountNotificationSettings(HLERequestContext& ctx) { 613void ISystemSettingsServer::SetAccountNotificationSettings(HLERequestContext& ctx) {
387 const auto elements = ctx.GetReadBufferNumElements<AccountNotificationSettings>(); 614 const auto elements = ctx.GetReadBufferNumElements<AccountNotificationSettings>();
388 const auto buffer_data = ctx.ReadBuffer(); 615 const auto buffer_data = ctx.ReadBuffer();
389 616
@@ -432,7 +659,7 @@ static Settings GetSettings() {
432 return ret; 659 return ret;
433} 660}
434 661
435void SET_SYS::GetSettingsItemValueSize(HLERequestContext& ctx) { 662void ISystemSettingsServer::GetSettingsItemValueSize(HLERequestContext& ctx) {
436 LOG_DEBUG(Service_SET, "called"); 663 LOG_DEBUG(Service_SET, "called");
437 664
438 // The category of the setting. This corresponds to the top-level keys of 665 // The category of the setting. This corresponds to the top-level keys of
@@ -457,7 +684,7 @@ void SET_SYS::GetSettingsItemValueSize(HLERequestContext& ctx) {
457 rb.Push(response_size); 684 rb.Push(response_size);
458} 685}
459 686
460void SET_SYS::GetSettingsItemValue(HLERequestContext& ctx) { 687void ISystemSettingsServer::GetSettingsItemValue(HLERequestContext& ctx) {
461 // The category of the setting. This corresponds to the top-level keys of 688 // The category of the setting. This corresponds to the top-level keys of
462 // system_settings.ini. 689 // system_settings.ini.
463 const auto setting_category_buf{ctx.ReadBuffer(0)}; 690 const auto setting_category_buf{ctx.ReadBuffer(0)};
@@ -480,7 +707,7 @@ void SET_SYS::GetSettingsItemValue(HLERequestContext& ctx) {
480 rb.Push(response); 707 rb.Push(response);
481} 708}
482 709
483void SET_SYS::GetTvSettings(HLERequestContext& ctx) { 710void ISystemSettingsServer::GetTvSettings(HLERequestContext& ctx) {
484 LOG_INFO(Service_SET, "called"); 711 LOG_INFO(Service_SET, "called");
485 712
486 IPC::ResponseBuilder rb{ctx, 10}; 713 IPC::ResponseBuilder rb{ctx, 10};
@@ -488,7 +715,7 @@ void SET_SYS::GetTvSettings(HLERequestContext& ctx) {
488 rb.PushRaw(m_system_settings.tv_settings); 715 rb.PushRaw(m_system_settings.tv_settings);
489} 716}
490 717
491void SET_SYS::SetTvSettings(HLERequestContext& ctx) { 718void ISystemSettingsServer::SetTvSettings(HLERequestContext& ctx) {
492 IPC::RequestParser rp{ctx}; 719 IPC::RequestParser rp{ctx};
493 m_system_settings.tv_settings = rp.PopRaw<TvSettings>(); 720 m_system_settings.tv_settings = rp.PopRaw<TvSettings>();
494 SetSaveNeeded(); 721 SetSaveNeeded();
@@ -507,7 +734,7 @@ void SET_SYS::SetTvSettings(HLERequestContext& ctx) {
507 rb.Push(ResultSuccess); 734 rb.Push(ResultSuccess);
508} 735}
509 736
510void SET_SYS::GetDebugModeFlag(HLERequestContext& ctx) { 737void ISystemSettingsServer::GetDebugModeFlag(HLERequestContext& ctx) {
511 LOG_DEBUG(Service_SET, "called"); 738 LOG_DEBUG(Service_SET, "called");
512 739
513 IPC::ResponseBuilder rb{ctx, 3}; 740 IPC::ResponseBuilder rb{ctx, 3};
@@ -515,7 +742,7 @@ void SET_SYS::GetDebugModeFlag(HLERequestContext& ctx) {
515 rb.Push<u32>(0); 742 rb.Push<u32>(0);
516} 743}
517 744
518void SET_SYS::GetQuestFlag(HLERequestContext& ctx) { 745void ISystemSettingsServer::GetQuestFlag(HLERequestContext& ctx) {
519 LOG_WARNING(Service_SET, "(STUBBED) called"); 746 LOG_WARNING(Service_SET, "(STUBBED) called");
520 747
521 IPC::ResponseBuilder rb{ctx, 3}; 748 IPC::ResponseBuilder rb{ctx, 3};
@@ -523,7 +750,7 @@ void SET_SYS::GetQuestFlag(HLERequestContext& ctx) {
523 rb.PushEnum(QuestFlag::Retail); 750 rb.PushEnum(QuestFlag::Retail);
524} 751}
525 752
526void SET_SYS::GetDeviceTimeZoneLocationName(HLERequestContext& ctx) { 753void ISystemSettingsServer::GetDeviceTimeZoneLocationName(HLERequestContext& ctx) {
527 LOG_WARNING(Service_SET, "called"); 754 LOG_WARNING(Service_SET, "called");
528 755
529 Service::Time::TimeZone::LocationName name{}; 756 Service::Time::TimeZone::LocationName name{};
@@ -534,7 +761,7 @@ void SET_SYS::GetDeviceTimeZoneLocationName(HLERequestContext& ctx) {
534 rb.PushRaw<Service::Time::TimeZone::LocationName>(name); 761 rb.PushRaw<Service::Time::TimeZone::LocationName>(name);
535} 762}
536 763
537void SET_SYS::SetDeviceTimeZoneLocationName(HLERequestContext& ctx) { 764void ISystemSettingsServer::SetDeviceTimeZoneLocationName(HLERequestContext& ctx) {
538 LOG_WARNING(Service_SET, "called"); 765 LOG_WARNING(Service_SET, "called");
539 766
540 IPC::RequestParser rp{ctx}; 767 IPC::RequestParser rp{ctx};
@@ -546,7 +773,7 @@ void SET_SYS::SetDeviceTimeZoneLocationName(HLERequestContext& ctx) {
546 rb.Push(res); 773 rb.Push(res);
547} 774}
548 775
549void SET_SYS::SetRegionCode(HLERequestContext& ctx) { 776void ISystemSettingsServer::SetRegionCode(HLERequestContext& ctx) {
550 IPC::RequestParser rp{ctx}; 777 IPC::RequestParser rp{ctx};
551 m_system_settings.region_code = rp.PopEnum<RegionCode>(); 778 m_system_settings.region_code = rp.PopEnum<RegionCode>();
552 SetSaveNeeded(); 779 SetSaveNeeded();
@@ -557,7 +784,7 @@ void SET_SYS::SetRegionCode(HLERequestContext& ctx) {
557 rb.Push(ResultSuccess); 784 rb.Push(ResultSuccess);
558} 785}
559 786
560void SET_SYS::GetNetworkSystemClockContext(HLERequestContext& ctx) { 787void ISystemSettingsServer::GetNetworkSystemClockContext(HLERequestContext& ctx) {
561 LOG_INFO(Service_SET, "called"); 788 LOG_INFO(Service_SET, "called");
562 789
563 Service::Time::Clock::SystemClockContext context{}; 790 Service::Time::Clock::SystemClockContext context{};
@@ -569,7 +796,7 @@ void SET_SYS::GetNetworkSystemClockContext(HLERequestContext& ctx) {
569 rb.PushRaw(context); 796 rb.PushRaw(context);
570} 797}
571 798
572void SET_SYS::SetNetworkSystemClockContext(HLERequestContext& ctx) { 799void ISystemSettingsServer::SetNetworkSystemClockContext(HLERequestContext& ctx) {
573 LOG_INFO(Service_SET, "called"); 800 LOG_INFO(Service_SET, "called");
574 801
575 IPC::RequestParser rp{ctx}; 802 IPC::RequestParser rp{ctx};
@@ -581,7 +808,7 @@ void SET_SYS::SetNetworkSystemClockContext(HLERequestContext& ctx) {
581 rb.Push(res); 808 rb.Push(res);
582} 809}
583 810
584void SET_SYS::IsUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx) { 811void ISystemSettingsServer::IsUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx) {
585 LOG_INFO(Service_SET, "called"); 812 LOG_INFO(Service_SET, "called");
586 813
587 bool enabled{}; 814 bool enabled{};
@@ -592,7 +819,7 @@ void SET_SYS::IsUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx
592 rb.PushRaw(enabled); 819 rb.PushRaw(enabled);
593} 820}
594 821
595void SET_SYS::SetUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx) { 822void ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx) {
596 LOG_INFO(Service_SET, "called"); 823 LOG_INFO(Service_SET, "called");
597 824
598 IPC::RequestParser rp{ctx}; 825 IPC::RequestParser rp{ctx};
@@ -604,7 +831,7 @@ void SET_SYS::SetUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ct
604 rb.Push(res); 831 rb.Push(res);
605} 832}
606 833
607void SET_SYS::GetPrimaryAlbumStorage(HLERequestContext& ctx) { 834void ISystemSettingsServer::GetPrimaryAlbumStorage(HLERequestContext& ctx) {
608 LOG_WARNING(Service_SET, "(STUBBED) called"); 835 LOG_WARNING(Service_SET, "(STUBBED) called");
609 836
610 IPC::ResponseBuilder rb{ctx, 3}; 837 IPC::ResponseBuilder rb{ctx, 3};
@@ -612,7 +839,7 @@ void SET_SYS::GetPrimaryAlbumStorage(HLERequestContext& ctx) {
612 rb.PushEnum(PrimaryAlbumStorage::SdCard); 839 rb.PushEnum(PrimaryAlbumStorage::SdCard);
613} 840}
614 841
615void SET_SYS::GetSleepSettings(HLERequestContext& ctx) { 842void ISystemSettingsServer::GetSleepSettings(HLERequestContext& ctx) {
616 LOG_INFO(Service_SET, "called"); 843 LOG_INFO(Service_SET, "called");
617 844
618 IPC::ResponseBuilder rb{ctx, 5}; 845 IPC::ResponseBuilder rb{ctx, 5};
@@ -620,7 +847,7 @@ void SET_SYS::GetSleepSettings(HLERequestContext& ctx) {
620 rb.PushRaw(m_system_settings.sleep_settings); 847 rb.PushRaw(m_system_settings.sleep_settings);
621} 848}
622 849
623void SET_SYS::SetSleepSettings(HLERequestContext& ctx) { 850void ISystemSettingsServer::SetSleepSettings(HLERequestContext& ctx) {
624 IPC::RequestParser rp{ctx}; 851 IPC::RequestParser rp{ctx};
625 m_system_settings.sleep_settings = rp.PopRaw<SleepSettings>(); 852 m_system_settings.sleep_settings = rp.PopRaw<SleepSettings>();
626 SetSaveNeeded(); 853 SetSaveNeeded();
@@ -634,14 +861,14 @@ void SET_SYS::SetSleepSettings(HLERequestContext& ctx) {
634 rb.Push(ResultSuccess); 861 rb.Push(ResultSuccess);
635} 862}
636 863
637void SET_SYS::GetInitialLaunchSettings(HLERequestContext& ctx) { 864void ISystemSettingsServer::GetInitialLaunchSettings(HLERequestContext& ctx) {
638 LOG_INFO(Service_SET, "called"); 865 LOG_INFO(Service_SET, "called");
639 IPC::ResponseBuilder rb{ctx, 10}; 866 IPC::ResponseBuilder rb{ctx, 10};
640 rb.Push(ResultSuccess); 867 rb.Push(ResultSuccess);
641 rb.PushRaw(m_system_settings.initial_launch_settings_packed); 868 rb.PushRaw(m_system_settings.initial_launch_settings_packed);
642} 869}
643 870
644void SET_SYS::SetInitialLaunchSettings(HLERequestContext& ctx) { 871void ISystemSettingsServer::SetInitialLaunchSettings(HLERequestContext& ctx) {
645 IPC::RequestParser rp{ctx}; 872 IPC::RequestParser rp{ctx};
646 auto inital_launch_settings = rp.PopRaw<InitialLaunchSettings>(); 873 auto inital_launch_settings = rp.PopRaw<InitialLaunchSettings>();
647 874
@@ -657,7 +884,7 @@ void SET_SYS::SetInitialLaunchSettings(HLERequestContext& ctx) {
657 rb.Push(ResultSuccess); 884 rb.Push(ResultSuccess);
658} 885}
659 886
660void SET_SYS::GetDeviceNickName(HLERequestContext& ctx) { 887void ISystemSettingsServer::GetDeviceNickName(HLERequestContext& ctx) {
661 LOG_DEBUG(Service_SET, "called"); 888 LOG_DEBUG(Service_SET, "called");
662 889
663 ctx.WriteBuffer(::Settings::values.device_name.GetValue()); 890 ctx.WriteBuffer(::Settings::values.device_name.GetValue());
@@ -666,7 +893,7 @@ void SET_SYS::GetDeviceNickName(HLERequestContext& ctx) {
666 rb.Push(ResultSuccess); 893 rb.Push(ResultSuccess);
667} 894}
668 895
669void SET_SYS::SetDeviceNickName(HLERequestContext& ctx) { 896void ISystemSettingsServer::SetDeviceNickName(HLERequestContext& ctx) {
670 const std::string device_name = Common::StringFromBuffer(ctx.ReadBuffer()); 897 const std::string device_name = Common::StringFromBuffer(ctx.ReadBuffer());
671 898
672 LOG_INFO(Service_SET, "called, device_name={}", device_name); 899 LOG_INFO(Service_SET, "called, device_name={}", device_name);
@@ -677,7 +904,7 @@ void SET_SYS::SetDeviceNickName(HLERequestContext& ctx) {
677 rb.Push(ResultSuccess); 904 rb.Push(ResultSuccess);
678} 905}
679 906
680void SET_SYS::GetProductModel(HLERequestContext& ctx) { 907void ISystemSettingsServer::GetProductModel(HLERequestContext& ctx) {
681 const u32 product_model = 1; 908 const u32 product_model = 1;
682 909
683 LOG_WARNING(Service_SET, "(STUBBED) called, product_model={}", product_model); 910 LOG_WARNING(Service_SET, "(STUBBED) called, product_model={}", product_model);
@@ -686,7 +913,7 @@ void SET_SYS::GetProductModel(HLERequestContext& ctx) {
686 rb.Push(product_model); 913 rb.Push(product_model);
687} 914}
688 915
689void SET_SYS::GetMiiAuthorId(HLERequestContext& ctx) { 916void ISystemSettingsServer::GetMiiAuthorId(HLERequestContext& ctx) {
690 const auto author_id = Common::UUID::MakeDefault(); 917 const auto author_id = Common::UUID::MakeDefault();
691 918
692 LOG_WARNING(Service_SET, "(STUBBED) called, author_id={}", author_id.FormattedString()); 919 LOG_WARNING(Service_SET, "(STUBBED) called, author_id={}", author_id.FormattedString());
@@ -696,7 +923,7 @@ void SET_SYS::GetMiiAuthorId(HLERequestContext& ctx) {
696 rb.PushRaw(author_id); 923 rb.PushRaw(author_id);
697} 924}
698 925
699void SET_SYS::GetAutoUpdateEnableFlag(HLERequestContext& ctx) { 926void ISystemSettingsServer::GetAutoUpdateEnableFlag(HLERequestContext& ctx) {
700 u8 auto_update_flag{}; 927 u8 auto_update_flag{};
701 928
702 LOG_WARNING(Service_SET, "(STUBBED) called, auto_update_flag={}", auto_update_flag); 929 LOG_WARNING(Service_SET, "(STUBBED) called, auto_update_flag={}", auto_update_flag);
@@ -706,7 +933,7 @@ void SET_SYS::GetAutoUpdateEnableFlag(HLERequestContext& ctx) {
706 rb.Push(auto_update_flag); 933 rb.Push(auto_update_flag);
707} 934}
708 935
709void SET_SYS::GetBatteryPercentageFlag(HLERequestContext& ctx) { 936void ISystemSettingsServer::GetBatteryPercentageFlag(HLERequestContext& ctx) {
710 u8 battery_percentage_flag{1}; 937 u8 battery_percentage_flag{1};
711 938
712 LOG_WARNING(Service_SET, "(STUBBED) called, battery_percentage_flag={}", 939 LOG_WARNING(Service_SET, "(STUBBED) called, battery_percentage_flag={}",
@@ -717,7 +944,7 @@ void SET_SYS::GetBatteryPercentageFlag(HLERequestContext& ctx) {
717 rb.Push(battery_percentage_flag); 944 rb.Push(battery_percentage_flag);
718} 945}
719 946
720void SET_SYS::SetExternalSteadyClockInternalOffset(HLERequestContext& ctx) { 947void ISystemSettingsServer::SetExternalSteadyClockInternalOffset(HLERequestContext& ctx) {
721 LOG_DEBUG(Service_SET, "called."); 948 LOG_DEBUG(Service_SET, "called.");
722 949
723 IPC::RequestParser rp{ctx}; 950 IPC::RequestParser rp{ctx};
@@ -729,7 +956,7 @@ void SET_SYS::SetExternalSteadyClockInternalOffset(HLERequestContext& ctx) {
729 rb.Push(res); 956 rb.Push(res);
730} 957}
731 958
732void SET_SYS::GetExternalSteadyClockInternalOffset(HLERequestContext& ctx) { 959void ISystemSettingsServer::GetExternalSteadyClockInternalOffset(HLERequestContext& ctx) {
733 LOG_DEBUG(Service_SET, "called."); 960 LOG_DEBUG(Service_SET, "called.");
734 961
735 s64 offset{}; 962 s64 offset{};
@@ -740,7 +967,7 @@ void SET_SYS::GetExternalSteadyClockInternalOffset(HLERequestContext& ctx) {
740 rb.Push(offset); 967 rb.Push(offset);
741} 968}
742 969
743void SET_SYS::GetErrorReportSharePermission(HLERequestContext& ctx) { 970void ISystemSettingsServer::GetErrorReportSharePermission(HLERequestContext& ctx) {
744 LOG_WARNING(Service_SET, "(STUBBED) called"); 971 LOG_WARNING(Service_SET, "(STUBBED) called");
745 972
746 IPC::ResponseBuilder rb{ctx, 3}; 973 IPC::ResponseBuilder rb{ctx, 3};
@@ -748,7 +975,7 @@ void SET_SYS::GetErrorReportSharePermission(HLERequestContext& ctx) {
748 rb.PushEnum(ErrorReportSharePermission::Denied); 975 rb.PushEnum(ErrorReportSharePermission::Denied);
749} 976}
750 977
751void SET_SYS::GetAppletLaunchFlags(HLERequestContext& ctx) { 978void ISystemSettingsServer::GetAppletLaunchFlags(HLERequestContext& ctx) {
752 LOG_INFO(Service_SET, "called, applet_launch_flag={}", m_system_settings.applet_launch_flag); 979 LOG_INFO(Service_SET, "called, applet_launch_flag={}", m_system_settings.applet_launch_flag);
753 980
754 IPC::ResponseBuilder rb{ctx, 3}; 981 IPC::ResponseBuilder rb{ctx, 3};
@@ -756,7 +983,7 @@ void SET_SYS::GetAppletLaunchFlags(HLERequestContext& ctx) {
756 rb.Push(m_system_settings.applet_launch_flag); 983 rb.Push(m_system_settings.applet_launch_flag);
757} 984}
758 985
759void SET_SYS::SetAppletLaunchFlags(HLERequestContext& ctx) { 986void ISystemSettingsServer::SetAppletLaunchFlags(HLERequestContext& ctx) {
760 IPC::RequestParser rp{ctx}; 987 IPC::RequestParser rp{ctx};
761 m_system_settings.applet_launch_flag = rp.Pop<u32>(); 988 m_system_settings.applet_launch_flag = rp.Pop<u32>();
762 SetSaveNeeded(); 989 SetSaveNeeded();
@@ -767,7 +994,7 @@ void SET_SYS::SetAppletLaunchFlags(HLERequestContext& ctx) {
767 rb.Push(ResultSuccess); 994 rb.Push(ResultSuccess);
768} 995}
769 996
770void SET_SYS::GetKeyboardLayout(HLERequestContext& ctx) { 997void ISystemSettingsServer::GetKeyboardLayout(HLERequestContext& ctx) {
771 const auto language_code = 998 const auto language_code =
772 available_language_codes[static_cast<s32>(::Settings::values.language_index.GetValue())]; 999 available_language_codes[static_cast<s32>(::Settings::values.language_index.GetValue())];
773 const auto key_code = 1000 const auto key_code =
@@ -786,7 +1013,7 @@ void SET_SYS::GetKeyboardLayout(HLERequestContext& ctx) {
786 rb.Push(static_cast<u32>(selected_keyboard_layout)); 1013 rb.Push(static_cast<u32>(selected_keyboard_layout));
787} 1014}
788 1015
789void SET_SYS::GetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) { 1016void ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) {
790 LOG_WARNING(Service_SET, "called."); 1017 LOG_WARNING(Service_SET, "called.");
791 1018
792 Service::Time::Clock::SteadyClockTimePoint time_point{}; 1019 Service::Time::Clock::SteadyClockTimePoint time_point{};
@@ -797,7 +1024,7 @@ void SET_SYS::GetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) {
797 rb.PushRaw<Service::Time::Clock::SteadyClockTimePoint>(time_point); 1024 rb.PushRaw<Service::Time::Clock::SteadyClockTimePoint>(time_point);
798} 1025}
799 1026
800void SET_SYS::SetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) { 1027void ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) {
801 LOG_WARNING(Service_SET, "called."); 1028 LOG_WARNING(Service_SET, "called.");
802 1029
803 IPC::RequestParser rp{ctx}; 1030 IPC::RequestParser rp{ctx};
@@ -809,7 +1036,8 @@ void SET_SYS::SetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) {
809 rb.Push(res); 1036 rb.Push(res);
810} 1037}
811 1038
812void SET_SYS::GetUserSystemClockAutomaticCorrectionUpdatedTime(HLERequestContext& ctx) { 1039void ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime(
1040 HLERequestContext& ctx) {
813 LOG_WARNING(Service_SET, "called."); 1041 LOG_WARNING(Service_SET, "called.");
814 1042
815 Service::Time::Clock::SteadyClockTimePoint time_point{}; 1043 Service::Time::Clock::SteadyClockTimePoint time_point{};
@@ -820,7 +1048,8 @@ void SET_SYS::GetUserSystemClockAutomaticCorrectionUpdatedTime(HLERequestContext
820 rb.PushRaw<Service::Time::Clock::SteadyClockTimePoint>(time_point); 1048 rb.PushRaw<Service::Time::Clock::SteadyClockTimePoint>(time_point);
821} 1049}
822 1050
823void SET_SYS::SetUserSystemClockAutomaticCorrectionUpdatedTime(HLERequestContext& ctx) { 1051void ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime(
1052 HLERequestContext& ctx) {
824 LOG_WARNING(Service_SET, "called."); 1053 LOG_WARNING(Service_SET, "called.");
825 1054
826 IPC::RequestParser rp{ctx}; 1055 IPC::RequestParser rp{ctx};
@@ -832,7 +1061,7 @@ void SET_SYS::SetUserSystemClockAutomaticCorrectionUpdatedTime(HLERequestContext
832 rb.Push(res); 1061 rb.Push(res);
833} 1062}
834 1063
835void SET_SYS::GetChineseTraditionalInputMethod(HLERequestContext& ctx) { 1064void ISystemSettingsServer::GetChineseTraditionalInputMethod(HLERequestContext& ctx) {
836 LOG_WARNING(Service_SET, "(STUBBED) called"); 1065 LOG_WARNING(Service_SET, "(STUBBED) called");
837 1066
838 IPC::ResponseBuilder rb{ctx, 3}; 1067 IPC::ResponseBuilder rb{ctx, 3};
@@ -840,7 +1069,7 @@ void SET_SYS::GetChineseTraditionalInputMethod(HLERequestContext& ctx) {
840 rb.PushEnum(ChineseTraditionalInputMethod::Unknown0); 1069 rb.PushEnum(ChineseTraditionalInputMethod::Unknown0);
841} 1070}
842 1071
843void SET_SYS::GetHomeMenuScheme(HLERequestContext& ctx) { 1072void ISystemSettingsServer::GetHomeMenuScheme(HLERequestContext& ctx) {
844 LOG_DEBUG(Service_SET, "(STUBBED) called"); 1073 LOG_DEBUG(Service_SET, "(STUBBED) called");
845 1074
846 const HomeMenuScheme default_color = { 1075 const HomeMenuScheme default_color = {
@@ -856,7 +1085,7 @@ void SET_SYS::GetHomeMenuScheme(HLERequestContext& ctx) {
856 rb.PushRaw(default_color); 1085 rb.PushRaw(default_color);
857} 1086}
858 1087
859void SET_SYS::GetHomeMenuSchemeModel(HLERequestContext& ctx) { 1088void ISystemSettingsServer::GetHomeMenuSchemeModel(HLERequestContext& ctx) {
860 LOG_WARNING(Service_SET, "(STUBBED) called"); 1089 LOG_WARNING(Service_SET, "(STUBBED) called");
861 1090
862 IPC::ResponseBuilder rb{ctx, 3}; 1091 IPC::ResponseBuilder rb{ctx, 3};
@@ -864,7 +1093,7 @@ void SET_SYS::GetHomeMenuSchemeModel(HLERequestContext& ctx) {
864 rb.Push(0); 1093 rb.Push(0);
865} 1094}
866 1095
867void SET_SYS::GetFieldTestingFlag(HLERequestContext& ctx) { 1096void ISystemSettingsServer::GetFieldTestingFlag(HLERequestContext& ctx) {
868 LOG_WARNING(Service_SET, "(STUBBED) called"); 1097 LOG_WARNING(Service_SET, "(STUBBED) called");
869 1098
870 IPC::ResponseBuilder rb{ctx, 3}; 1099 IPC::ResponseBuilder rb{ctx, 3};
@@ -872,233 +1101,7 @@ void SET_SYS::GetFieldTestingFlag(HLERequestContext& ctx) {
872 rb.Push<u8>(false); 1101 rb.Push<u8>(false);
873} 1102}
874 1103
875SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"}, m_system{system} { 1104void ISystemSettingsServer::SetupSettings() {
876 // clang-format off
877 static const FunctionInfo functions[] = {
878 {0, &SET_SYS::SetLanguageCode, "SetLanguageCode"},
879 {1, nullptr, "SetNetworkSettings"},
880 {2, nullptr, "GetNetworkSettings"},
881 {3, &SET_SYS::GetFirmwareVersion, "GetFirmwareVersion"},
882 {4, &SET_SYS::GetFirmwareVersion2, "GetFirmwareVersion2"},
883 {5, nullptr, "GetFirmwareVersionDigest"},
884 {7, nullptr, "GetLockScreenFlag"},
885 {8, nullptr, "SetLockScreenFlag"},
886 {9, nullptr, "GetBacklightSettings"},
887 {10, nullptr, "SetBacklightSettings"},
888 {11, nullptr, "SetBluetoothDevicesSettings"},
889 {12, nullptr, "GetBluetoothDevicesSettings"},
890 {13, &SET_SYS::GetExternalSteadyClockSourceId, "GetExternalSteadyClockSourceId"},
891 {14, &SET_SYS::SetExternalSteadyClockSourceId, "SetExternalSteadyClockSourceId"},
892 {15, &SET_SYS::GetUserSystemClockContext, "GetUserSystemClockContext"},
893 {16, &SET_SYS::SetUserSystemClockContext, "SetUserSystemClockContext"},
894 {17, &SET_SYS::GetAccountSettings, "GetAccountSettings"},
895 {18, &SET_SYS::SetAccountSettings, "SetAccountSettings"},
896 {19, nullptr, "GetAudioVolume"},
897 {20, nullptr, "SetAudioVolume"},
898 {21, &SET_SYS::GetEulaVersions, "GetEulaVersions"},
899 {22, &SET_SYS::SetEulaVersions, "SetEulaVersions"},
900 {23, &SET_SYS::GetColorSetId, "GetColorSetId"},
901 {24, &SET_SYS::SetColorSetId, "SetColorSetId"},
902 {25, nullptr, "GetConsoleInformationUploadFlag"},
903 {26, nullptr, "SetConsoleInformationUploadFlag"},
904 {27, nullptr, "GetAutomaticApplicationDownloadFlag"},
905 {28, nullptr, "SetAutomaticApplicationDownloadFlag"},
906 {29, &SET_SYS::GetNotificationSettings, "GetNotificationSettings"},
907 {30, &SET_SYS::SetNotificationSettings, "SetNotificationSettings"},
908 {31, &SET_SYS::GetAccountNotificationSettings, "GetAccountNotificationSettings"},
909 {32, &SET_SYS::SetAccountNotificationSettings, "SetAccountNotificationSettings"},
910 {35, nullptr, "GetVibrationMasterVolume"},
911 {36, nullptr, "SetVibrationMasterVolume"},
912 {37, &SET_SYS::GetSettingsItemValueSize, "GetSettingsItemValueSize"},
913 {38, &SET_SYS::GetSettingsItemValue, "GetSettingsItemValue"},
914 {39, &SET_SYS::GetTvSettings, "GetTvSettings"},
915 {40, &SET_SYS::SetTvSettings, "SetTvSettings"},
916 {41, nullptr, "GetEdid"},
917 {42, nullptr, "SetEdid"},
918 {43, nullptr, "GetAudioOutputMode"},
919 {44, nullptr, "SetAudioOutputMode"},
920 {45, nullptr, "IsForceMuteOnHeadphoneRemoved"},
921 {46, nullptr, "SetForceMuteOnHeadphoneRemoved"},
922 {47, &SET_SYS::GetQuestFlag, "GetQuestFlag"},
923 {48, nullptr, "SetQuestFlag"},
924 {49, nullptr, "GetDataDeletionSettings"},
925 {50, nullptr, "SetDataDeletionSettings"},
926 {51, nullptr, "GetInitialSystemAppletProgramId"},
927 {52, nullptr, "GetOverlayDispProgramId"},
928 {53, &SET_SYS::GetDeviceTimeZoneLocationName, "GetDeviceTimeZoneLocationName"},
929 {54, &SET_SYS::SetDeviceTimeZoneLocationName, "SetDeviceTimeZoneLocationName"},
930 {55, nullptr, "GetWirelessCertificationFileSize"},
931 {56, nullptr, "GetWirelessCertificationFile"},
932 {57, &SET_SYS::SetRegionCode, "SetRegionCode"},
933 {58, &SET_SYS::GetNetworkSystemClockContext, "GetNetworkSystemClockContext"},
934 {59, &SET_SYS::SetNetworkSystemClockContext, "SetNetworkSystemClockContext"},
935 {60, &SET_SYS::IsUserSystemClockAutomaticCorrectionEnabled, "IsUserSystemClockAutomaticCorrectionEnabled"},
936 {61, &SET_SYS::SetUserSystemClockAutomaticCorrectionEnabled, "SetUserSystemClockAutomaticCorrectionEnabled"},
937 {62, &SET_SYS::GetDebugModeFlag, "GetDebugModeFlag"},
938 {63, &SET_SYS::GetPrimaryAlbumStorage, "GetPrimaryAlbumStorage"},
939 {64, nullptr, "SetPrimaryAlbumStorage"},
940 {65, nullptr, "GetUsb30EnableFlag"},
941 {66, nullptr, "SetUsb30EnableFlag"},
942 {67, nullptr, "GetBatteryLot"},
943 {68, nullptr, "GetSerialNumber"},
944 {69, nullptr, "GetNfcEnableFlag"},
945 {70, nullptr, "SetNfcEnableFlag"},
946 {71, &SET_SYS::GetSleepSettings, "GetSleepSettings"},
947 {72, &SET_SYS::SetSleepSettings, "SetSleepSettings"},
948 {73, nullptr, "GetWirelessLanEnableFlag"},
949 {74, nullptr, "SetWirelessLanEnableFlag"},
950 {75, &SET_SYS::GetInitialLaunchSettings, "GetInitialLaunchSettings"},
951 {76, &SET_SYS::SetInitialLaunchSettings, "SetInitialLaunchSettings"},
952 {77, &SET_SYS::GetDeviceNickName, "GetDeviceNickName"},
953 {78, &SET_SYS::SetDeviceNickName, "SetDeviceNickName"},
954 {79, &SET_SYS::GetProductModel, "GetProductModel"},
955 {80, nullptr, "GetLdnChannel"},
956 {81, nullptr, "SetLdnChannel"},
957 {82, nullptr, "AcquireTelemetryDirtyFlagEventHandle"},
958 {83, nullptr, "GetTelemetryDirtyFlags"},
959 {84, nullptr, "GetPtmBatteryLot"},
960 {85, nullptr, "SetPtmBatteryLot"},
961 {86, nullptr, "GetPtmFuelGaugeParameter"},
962 {87, nullptr, "SetPtmFuelGaugeParameter"},
963 {88, nullptr, "GetBluetoothEnableFlag"},
964 {89, nullptr, "SetBluetoothEnableFlag"},
965 {90, &SET_SYS::GetMiiAuthorId, "GetMiiAuthorId"},
966 {91, nullptr, "SetShutdownRtcValue"},
967 {92, nullptr, "GetShutdownRtcValue"},
968 {93, nullptr, "AcquireFatalDirtyFlagEventHandle"},
969 {94, nullptr, "GetFatalDirtyFlags"},
970 {95, &SET_SYS::GetAutoUpdateEnableFlag, "GetAutoUpdateEnableFlag"},
971 {96, nullptr, "SetAutoUpdateEnableFlag"},
972 {97, nullptr, "GetNxControllerSettings"},
973 {98, nullptr, "SetNxControllerSettings"},
974 {99, &SET_SYS::GetBatteryPercentageFlag, "GetBatteryPercentageFlag"},
975 {100, nullptr, "SetBatteryPercentageFlag"},
976 {101, nullptr, "GetExternalRtcResetFlag"},
977 {102, nullptr, "SetExternalRtcResetFlag"},
978 {103, nullptr, "GetUsbFullKeyEnableFlag"},
979 {104, nullptr, "SetUsbFullKeyEnableFlag"},
980 {105, &SET_SYS::SetExternalSteadyClockInternalOffset, "SetExternalSteadyClockInternalOffset"},
981 {106, &SET_SYS::GetExternalSteadyClockInternalOffset, "GetExternalSteadyClockInternalOffset"},
982 {107, nullptr, "GetBacklightSettingsEx"},
983 {108, nullptr, "SetBacklightSettingsEx"},
984 {109, nullptr, "GetHeadphoneVolumeWarningCount"},
985 {110, nullptr, "SetHeadphoneVolumeWarningCount"},
986 {111, nullptr, "GetBluetoothAfhEnableFlag"},
987 {112, nullptr, "SetBluetoothAfhEnableFlag"},
988 {113, nullptr, "GetBluetoothBoostEnableFlag"},
989 {114, nullptr, "SetBluetoothBoostEnableFlag"},
990 {115, nullptr, "GetInRepairProcessEnableFlag"},
991 {116, nullptr, "SetInRepairProcessEnableFlag"},
992 {117, nullptr, "GetHeadphoneVolumeUpdateFlag"},
993 {118, nullptr, "SetHeadphoneVolumeUpdateFlag"},
994 {119, nullptr, "NeedsToUpdateHeadphoneVolume"},
995 {120, nullptr, "GetPushNotificationActivityModeOnSleep"},
996 {121, nullptr, "SetPushNotificationActivityModeOnSleep"},
997 {122, nullptr, "GetServiceDiscoveryControlSettings"},
998 {123, nullptr, "SetServiceDiscoveryControlSettings"},
999 {124, &SET_SYS::GetErrorReportSharePermission, "GetErrorReportSharePermission"},
1000 {125, nullptr, "SetErrorReportSharePermission"},
1001 {126, &SET_SYS::GetAppletLaunchFlags, "GetAppletLaunchFlags"},
1002 {127, &SET_SYS::SetAppletLaunchFlags, "SetAppletLaunchFlags"},
1003 {128, nullptr, "GetConsoleSixAxisSensorAccelerationBias"},
1004 {129, nullptr, "SetConsoleSixAxisSensorAccelerationBias"},
1005 {130, nullptr, "GetConsoleSixAxisSensorAngularVelocityBias"},
1006 {131, nullptr, "SetConsoleSixAxisSensorAngularVelocityBias"},
1007 {132, nullptr, "GetConsoleSixAxisSensorAccelerationGain"},
1008 {133, nullptr, "SetConsoleSixAxisSensorAccelerationGain"},
1009 {134, nullptr, "GetConsoleSixAxisSensorAngularVelocityGain"},
1010 {135, nullptr, "SetConsoleSixAxisSensorAngularVelocityGain"},
1011 {136, &SET_SYS::GetKeyboardLayout, "GetKeyboardLayout"},
1012 {137, nullptr, "SetKeyboardLayout"},
1013 {138, nullptr, "GetWebInspectorFlag"},
1014 {139, nullptr, "GetAllowedSslHosts"},
1015 {140, nullptr, "GetHostFsMountPoint"},
1016 {141, nullptr, "GetRequiresRunRepairTimeReviser"},
1017 {142, nullptr, "SetRequiresRunRepairTimeReviser"},
1018 {143, nullptr, "SetBlePairingSettings"},
1019 {144, nullptr, "GetBlePairingSettings"},
1020 {145, nullptr, "GetConsoleSixAxisSensorAngularVelocityTimeBias"},
1021 {146, nullptr, "SetConsoleSixAxisSensorAngularVelocityTimeBias"},
1022 {147, nullptr, "GetConsoleSixAxisSensorAngularAcceleration"},
1023 {148, nullptr, "SetConsoleSixAxisSensorAngularAcceleration"},
1024 {149, nullptr, "GetRebootlessSystemUpdateVersion"},
1025 {150, &SET_SYS::GetDeviceTimeZoneLocationUpdatedTime, "GetDeviceTimeZoneLocationUpdatedTime"},
1026 {151, &SET_SYS::SetDeviceTimeZoneLocationUpdatedTime, "SetDeviceTimeZoneLocationUpdatedTime"},
1027 {152, &SET_SYS::GetUserSystemClockAutomaticCorrectionUpdatedTime, "GetUserSystemClockAutomaticCorrectionUpdatedTime"},
1028 {153, &SET_SYS::SetUserSystemClockAutomaticCorrectionUpdatedTime, "SetUserSystemClockAutomaticCorrectionUpdatedTime"},
1029 {154, nullptr, "GetAccountOnlineStorageSettings"},
1030 {155, nullptr, "SetAccountOnlineStorageSettings"},
1031 {156, nullptr, "GetPctlReadyFlag"},
1032 {157, nullptr, "SetPctlReadyFlag"},
1033 {158, nullptr, "GetAnalogStickUserCalibrationL"},
1034 {159, nullptr, "SetAnalogStickUserCalibrationL"},
1035 {160, nullptr, "GetAnalogStickUserCalibrationR"},
1036 {161, nullptr, "SetAnalogStickUserCalibrationR"},
1037 {162, nullptr, "GetPtmBatteryVersion"},
1038 {163, nullptr, "SetPtmBatteryVersion"},
1039 {164, nullptr, "GetUsb30HostEnableFlag"},
1040 {165, nullptr, "SetUsb30HostEnableFlag"},
1041 {166, nullptr, "GetUsb30DeviceEnableFlag"},
1042 {167, nullptr, "SetUsb30DeviceEnableFlag"},
1043 {168, nullptr, "GetThemeId"},
1044 {169, nullptr, "SetThemeId"},
1045 {170, &SET_SYS::GetChineseTraditionalInputMethod, "GetChineseTraditionalInputMethod"},
1046 {171, nullptr, "SetChineseTraditionalInputMethod"},
1047 {172, nullptr, "GetPtmCycleCountReliability"},
1048 {173, nullptr, "SetPtmCycleCountReliability"},
1049 {174, &SET_SYS::GetHomeMenuScheme, "GetHomeMenuScheme"},
1050 {175, nullptr, "GetThemeSettings"},
1051 {176, nullptr, "SetThemeSettings"},
1052 {177, nullptr, "GetThemeKey"},
1053 {178, nullptr, "SetThemeKey"},
1054 {179, nullptr, "GetZoomFlag"},
1055 {180, nullptr, "SetZoomFlag"},
1056 {181, nullptr, "GetT"},
1057 {182, nullptr, "SetT"},
1058 {183, nullptr, "GetPlatformRegion"},
1059 {184, nullptr, "SetPlatformRegion"},
1060 {185, &SET_SYS::GetHomeMenuSchemeModel, "GetHomeMenuSchemeModel"},
1061 {186, nullptr, "GetMemoryUsageRateFlag"},
1062 {187, nullptr, "GetTouchScreenMode"},
1063 {188, nullptr, "SetTouchScreenMode"},
1064 {189, nullptr, "GetButtonConfigSettingsFull"},
1065 {190, nullptr, "SetButtonConfigSettingsFull"},
1066 {191, nullptr, "GetButtonConfigSettingsEmbedded"},
1067 {192, nullptr, "SetButtonConfigSettingsEmbedded"},
1068 {193, nullptr, "GetButtonConfigSettingsLeft"},
1069 {194, nullptr, "SetButtonConfigSettingsLeft"},
1070 {195, nullptr, "GetButtonConfigSettingsRight"},
1071 {196, nullptr, "SetButtonConfigSettingsRight"},
1072 {197, nullptr, "GetButtonConfigRegisteredSettingsEmbedded"},
1073 {198, nullptr, "SetButtonConfigRegisteredSettingsEmbedded"},
1074 {199, nullptr, "GetButtonConfigRegisteredSettings"},
1075 {200, nullptr, "SetButtonConfigRegisteredSettings"},
1076 {201, &SET_SYS::GetFieldTestingFlag, "GetFieldTestingFlag"},
1077 {202, nullptr, "SetFieldTestingFlag"},
1078 {203, nullptr, "GetPanelCrcMode"},
1079 {204, nullptr, "SetPanelCrcMode"},
1080 {205, nullptr, "GetNxControllerSettingsEx"},
1081 {206, nullptr, "SetNxControllerSettingsEx"},
1082 {207, nullptr, "GetHearingProtectionSafeguardFlag"},
1083 {208, nullptr, "SetHearingProtectionSafeguardFlag"},
1084 {209, nullptr, "GetHearingProtectionSafeguardRemainingTime"},
1085 {210, nullptr, "SetHearingProtectionSafeguardRemainingTime"},
1086 };
1087 // clang-format on
1088
1089 RegisterHandlers(functions);
1090
1091 SetupSettings();
1092 m_save_thread =
1093 std::jthread([this](std::stop_token stop_token) { StoreSettingsThreadFunc(stop_token); });
1094}
1095
1096SET_SYS::~SET_SYS() {
1097 SetSaveNeeded();
1098 m_save_thread.request_stop();
1099}
1100
1101void SET_SYS::SetupSettings() {
1102 auto system_dir = 1105 auto system_dir =
1103 Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/8000000000000050"; 1106 Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/8000000000000050";
1104 if (!LoadSettingsFile(system_dir, []() { return DefaultSystemSettings(); })) { 1107 if (!LoadSettingsFile(system_dir, []() { return DefaultSystemSettings(); })) {
@@ -1124,7 +1127,7 @@ void SET_SYS::SetupSettings() {
1124 } 1127 }
1125} 1128}
1126 1129
1127void SET_SYS::StoreSettings() { 1130void ISystemSettingsServer::StoreSettings() {
1128 auto system_dir = 1131 auto system_dir =
1129 Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/8000000000000050"; 1132 Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/8000000000000050";
1130 if (!StoreSettingsFile(system_dir, m_system_settings)) { 1133 if (!StoreSettingsFile(system_dir, m_system_settings)) {
@@ -1150,7 +1153,7 @@ void SET_SYS::StoreSettings() {
1150 } 1153 }
1151} 1154}
1152 1155
1153void SET_SYS::StoreSettingsThreadFunc(std::stop_token stop_token) { 1156void ISystemSettingsServer::StoreSettingsThreadFunc(std::stop_token stop_token) {
1154 Common::SetCurrentThreadName("SettingsStore"); 1157 Common::SetCurrentThreadName("SettingsStore");
1155 1158
1156 while (Common::StoppableTimedWait(stop_token, std::chrono::minutes(1))) { 1159 while (Common::StoppableTimedWait(stop_token, std::chrono::minutes(1))) {
@@ -1162,13 +1165,14 @@ void SET_SYS::StoreSettingsThreadFunc(std::stop_token stop_token) {
1162 } 1165 }
1163} 1166}
1164 1167
1165void SET_SYS::SetSaveNeeded() { 1168void ISystemSettingsServer::SetSaveNeeded() {
1166 std::scoped_lock l{m_save_needed_mutex}; 1169 std::scoped_lock l{m_save_needed_mutex};
1167 m_save_needed = true; 1170 m_save_needed = true;
1168} 1171}
1169 1172
1170Result SET_SYS::GetSettingsItemValue(std::vector<u8>& out_value, const std::string& category, 1173Result ISystemSettingsServer::GetSettingsItemValue(std::vector<u8>& out_value,
1171 const std::string& name) { 1174 const std::string& category,
1175 const std::string& name) {
1172 auto settings{GetSettings()}; 1176 auto settings{GetSettings()};
1173 R_UNLESS(settings.contains(category) && settings[category].contains(name), ResultUnknown); 1177 R_UNLESS(settings.contains(category) && settings[category].contains(name), ResultUnknown);
1174 1178
@@ -1176,93 +1180,98 @@ Result SET_SYS::GetSettingsItemValue(std::vector<u8>& out_value, const std::stri
1176 R_SUCCEED(); 1180 R_SUCCEED();
1177} 1181}
1178 1182
1179Result SET_SYS::GetExternalSteadyClockSourceId(Common::UUID& out_id) { 1183Result ISystemSettingsServer::GetExternalSteadyClockSourceId(Common::UUID& out_id) {
1180 out_id = m_private_settings.external_clock_source_id; 1184 out_id = m_private_settings.external_clock_source_id;
1181 R_SUCCEED(); 1185 R_SUCCEED();
1182} 1186}
1183 1187
1184Result SET_SYS::SetExternalSteadyClockSourceId(Common::UUID id) { 1188Result ISystemSettingsServer::SetExternalSteadyClockSourceId(Common::UUID id) {
1185 m_private_settings.external_clock_source_id = id; 1189 m_private_settings.external_clock_source_id = id;
1186 SetSaveNeeded(); 1190 SetSaveNeeded();
1187 R_SUCCEED(); 1191 R_SUCCEED();
1188} 1192}
1189 1193
1190Result SET_SYS::GetUserSystemClockContext(Service::Time::Clock::SystemClockContext& out_context) { 1194Result ISystemSettingsServer::GetUserSystemClockContext(
1195 Service::Time::Clock::SystemClockContext& out_context) {
1191 out_context = m_system_settings.user_system_clock_context; 1196 out_context = m_system_settings.user_system_clock_context;
1192 R_SUCCEED(); 1197 R_SUCCEED();
1193} 1198}
1194 1199
1195Result SET_SYS::SetUserSystemClockContext(Service::Time::Clock::SystemClockContext& context) { 1200Result ISystemSettingsServer::SetUserSystemClockContext(
1201 Service::Time::Clock::SystemClockContext& context) {
1196 m_system_settings.user_system_clock_context = context; 1202 m_system_settings.user_system_clock_context = context;
1197 SetSaveNeeded(); 1203 SetSaveNeeded();
1198 R_SUCCEED(); 1204 R_SUCCEED();
1199} 1205}
1200 1206
1201Result SET_SYS::GetDeviceTimeZoneLocationName(Service::Time::TimeZone::LocationName& out_name) { 1207Result ISystemSettingsServer::GetDeviceTimeZoneLocationName(
1208 Service::Time::TimeZone::LocationName& out_name) {
1202 out_name = m_system_settings.device_time_zone_location_name; 1209 out_name = m_system_settings.device_time_zone_location_name;
1203 R_SUCCEED(); 1210 R_SUCCEED();
1204} 1211}
1205 1212
1206Result SET_SYS::SetDeviceTimeZoneLocationName(Service::Time::TimeZone::LocationName& name) { 1213Result ISystemSettingsServer::SetDeviceTimeZoneLocationName(
1214 Service::Time::TimeZone::LocationName& name) {
1207 m_system_settings.device_time_zone_location_name = name; 1215 m_system_settings.device_time_zone_location_name = name;
1208 SetSaveNeeded(); 1216 SetSaveNeeded();
1209 R_SUCCEED(); 1217 R_SUCCEED();
1210} 1218}
1211 1219
1212Result SET_SYS::GetNetworkSystemClockContext( 1220Result ISystemSettingsServer::GetNetworkSystemClockContext(
1213 Service::Time::Clock::SystemClockContext& out_context) { 1221 Service::Time::Clock::SystemClockContext& out_context) {
1214 out_context = m_system_settings.network_system_clock_context; 1222 out_context = m_system_settings.network_system_clock_context;
1215 R_SUCCEED(); 1223 R_SUCCEED();
1216} 1224}
1217 1225
1218Result SET_SYS::SetNetworkSystemClockContext(Service::Time::Clock::SystemClockContext& context) { 1226Result ISystemSettingsServer::SetNetworkSystemClockContext(
1227 Service::Time::Clock::SystemClockContext& context) {
1219 m_system_settings.network_system_clock_context = context; 1228 m_system_settings.network_system_clock_context = context;
1220 SetSaveNeeded(); 1229 SetSaveNeeded();
1221 R_SUCCEED(); 1230 R_SUCCEED();
1222} 1231}
1223 1232
1224Result SET_SYS::IsUserSystemClockAutomaticCorrectionEnabled(bool& out_enabled) { 1233Result ISystemSettingsServer::IsUserSystemClockAutomaticCorrectionEnabled(bool& out_enabled) {
1225 out_enabled = m_system_settings.user_system_clock_automatic_correction_enabled; 1234 out_enabled = m_system_settings.user_system_clock_automatic_correction_enabled;
1226 R_SUCCEED(); 1235 R_SUCCEED();
1227} 1236}
1228 1237
1229Result SET_SYS::SetUserSystemClockAutomaticCorrectionEnabled(bool enabled) { 1238Result ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionEnabled(bool enabled) {
1230 m_system_settings.user_system_clock_automatic_correction_enabled = enabled; 1239 m_system_settings.user_system_clock_automatic_correction_enabled = enabled;
1231 SetSaveNeeded(); 1240 SetSaveNeeded();
1232 R_SUCCEED(); 1241 R_SUCCEED();
1233} 1242}
1234 1243
1235Result SET_SYS::SetExternalSteadyClockInternalOffset(s64 offset) { 1244Result ISystemSettingsServer::SetExternalSteadyClockInternalOffset(s64 offset) {
1236 m_private_settings.external_steady_clock_internal_offset = offset; 1245 m_private_settings.external_steady_clock_internal_offset = offset;
1237 SetSaveNeeded(); 1246 SetSaveNeeded();
1238 R_SUCCEED(); 1247 R_SUCCEED();
1239} 1248}
1240 1249
1241Result SET_SYS::GetExternalSteadyClockInternalOffset(s64& out_offset) { 1250Result ISystemSettingsServer::GetExternalSteadyClockInternalOffset(s64& out_offset) {
1242 out_offset = m_private_settings.external_steady_clock_internal_offset; 1251 out_offset = m_private_settings.external_steady_clock_internal_offset;
1243 R_SUCCEED(); 1252 R_SUCCEED();
1244} 1253}
1245 1254
1246Result SET_SYS::GetDeviceTimeZoneLocationUpdatedTime( 1255Result ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime(
1247 Service::Time::Clock::SteadyClockTimePoint& out_time_point) { 1256 Service::Time::Clock::SteadyClockTimePoint& out_time_point) {
1248 out_time_point = m_system_settings.device_time_zone_location_updated_time; 1257 out_time_point = m_system_settings.device_time_zone_location_updated_time;
1249 R_SUCCEED(); 1258 R_SUCCEED();
1250} 1259}
1251 1260
1252Result SET_SYS::SetDeviceTimeZoneLocationUpdatedTime( 1261Result ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime(
1253 Service::Time::Clock::SteadyClockTimePoint& time_point) { 1262 Service::Time::Clock::SteadyClockTimePoint& time_point) {
1254 m_system_settings.device_time_zone_location_updated_time = time_point; 1263 m_system_settings.device_time_zone_location_updated_time = time_point;
1255 SetSaveNeeded(); 1264 SetSaveNeeded();
1256 R_SUCCEED(); 1265 R_SUCCEED();
1257} 1266}
1258 1267
1259Result SET_SYS::GetUserSystemClockAutomaticCorrectionUpdatedTime( 1268Result ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime(
1260 Service::Time::Clock::SteadyClockTimePoint& out_time_point) { 1269 Service::Time::Clock::SteadyClockTimePoint& out_time_point) {
1261 out_time_point = m_system_settings.user_system_clock_automatic_correction_updated_time_point; 1270 out_time_point = m_system_settings.user_system_clock_automatic_correction_updated_time_point;
1262 R_SUCCEED(); 1271 R_SUCCEED();
1263} 1272}
1264 1273
1265Result SET_SYS::SetUserSystemClockAutomaticCorrectionUpdatedTime( 1274Result ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime(
1266 Service::Time::Clock::SteadyClockTimePoint out_time_point) { 1275 Service::Time::Clock::SteadyClockTimePoint out_time_point) {
1267 m_system_settings.user_system_clock_automatic_correction_updated_time_point = out_time_point; 1276 m_system_settings.user_system_clock_automatic_correction_updated_time_point = out_time_point;
1268 SetSaveNeeded(); 1277 SetSaveNeeded();
diff --git a/src/core/hle/service/set/set_sys.h b/src/core/hle/service/set/system_settings_server.h
index 853f76fce..6f587e0b3 100644
--- a/src/core/hle/service/set/set_sys.h
+++ b/src/core/hle/service/set/system_settings_server.h
@@ -47,10 +47,10 @@ static_assert(sizeof(FirmwareVersionFormat) == 0x100, "FirmwareVersionFormat is
47Result GetFirmwareVersionImpl(FirmwareVersionFormat& out_firmware, Core::System& system, 47Result GetFirmwareVersionImpl(FirmwareVersionFormat& out_firmware, Core::System& system,
48 GetFirmwareVersionType type); 48 GetFirmwareVersionType type);
49 49
50class SET_SYS final : public ServiceFramework<SET_SYS> { 50class ISystemSettingsServer final : public ServiceFramework<ISystemSettingsServer> {
51public: 51public:
52 explicit SET_SYS(Core::System& system_); 52 explicit ISystemSettingsServer(Core::System& system_);
53 ~SET_SYS() override; 53 ~ISystemSettingsServer() override;
54 54
55 Result GetSettingsItemValue(std::vector<u8>& out_value, const std::string& category, 55 Result GetSettingsItemValue(std::vector<u8>& out_value, const std::string& category,
56 const std::string& name); 56 const std::string& name);
diff --git a/src/hid_core/resources/applet_resource.cpp b/src/hid_core/resources/applet_resource.cpp
index d09a525c6..a84826050 100644
--- a/src/hid_core/resources/applet_resource.cpp
+++ b/src/hid_core/resources/applet_resource.cpp
@@ -130,6 +130,7 @@ void AppletResource::FreeAppletResourceId(u64 aruid) {
130 if (aruid_data.flag.is_assigned) { 130 if (aruid_data.flag.is_assigned) {
131 aruid_data.shared_memory_format = nullptr; 131 aruid_data.shared_memory_format = nullptr;
132 aruid_data.flag.is_assigned.Assign(false); 132 aruid_data.flag.is_assigned.Assign(false);
133 shared_memory_holder[index].Finalize();
133 } 134 }
134} 135}
135 136
diff --git a/src/hid_core/resources/npad/npad.cpp b/src/hid_core/resources/npad/npad.cpp
index 97f31d26e..1f8a0f8ab 100644
--- a/src/hid_core/resources/npad/npad.cpp
+++ b/src/hid_core/resources/npad/npad.cpp
@@ -1344,4 +1344,49 @@ AppletDetailedUiType NPad::GetAppletDetailedUiType(Core::HID::NpadIdType npad_id
1344 }; 1344 };
1345} 1345}
1346 1346
1347Result NPad::SetNpadCaptureButtonAssignment(u64 aruid, Core::HID::NpadStyleSet npad_style_set,
1348 Core::HID::NpadButton button_assignment) {
1349 std::scoped_lock lock{mutex};
1350 return npad_resource.SetNpadCaptureButtonAssignment(aruid, npad_style_set, button_assignment);
1351}
1352
1353Result NPad::ClearNpadCaptureButtonAssignment(u64 aruid) {
1354 std::scoped_lock lock{mutex};
1355 return npad_resource.ClearNpadCaptureButtonAssignment(aruid);
1356}
1357
1358std::size_t NPad::GetNpadCaptureButtonAssignment(std::span<Core::HID::NpadButton> out_list,
1359 u64 aruid) const {
1360 std::scoped_lock lock{mutex};
1361 return npad_resource.GetNpadCaptureButtonAssignment(out_list, aruid);
1362}
1363
1364Result NPad::SetNpadSystemExtStateEnabled(u64 aruid, bool is_enabled) {
1365 std::scoped_lock lock{mutex};
1366 const auto result = npad_resource.SetNpadSystemExtStateEnabled(aruid, is_enabled);
1367
1368 if (result.IsSuccess()) {
1369 std::scoped_lock shared_lock{*applet_resource_holder.shared_mutex};
1370 // TODO: abstracted_pad->EnableAppletToGetInput(aruid);
1371 }
1372
1373 return result;
1374}
1375
1376Result NPad::AssigningSingleOnSlSrPress(u64 aruid, bool is_enabled) {
1377 std::scoped_lock lock{mutex};
1378 bool is_currently_enabled{};
1379 Result result = npad_resource.IsAssigningSingleOnSlSrPressEnabled(is_currently_enabled, aruid);
1380 if (result.IsSuccess() && is_enabled != is_currently_enabled) {
1381 result = npad_resource.SetAssigningSingleOnSlSrPress(aruid, is_enabled);
1382 }
1383 return result;
1384}
1385
1386Result NPad::GetLastActiveNpad(Core::HID::NpadIdType& out_npad_id) const {
1387 std::scoped_lock lock{mutex};
1388 out_npad_id = hid_core.GetLastActiveController();
1389 return ResultSuccess;
1390}
1391
1347} // namespace Service::HID 1392} // namespace Service::HID
diff --git a/src/hid_core/resources/npad/npad.h b/src/hid_core/resources/npad/npad.h
index 58f8c7acf..01f3dabb1 100644
--- a/src/hid_core/resources/npad/npad.h
+++ b/src/hid_core/resources/npad/npad.h
@@ -149,6 +149,18 @@ public:
149 149
150 AppletDetailedUiType GetAppletDetailedUiType(Core::HID::NpadIdType npad_id); 150 AppletDetailedUiType GetAppletDetailedUiType(Core::HID::NpadIdType npad_id);
151 151
152 Result SetNpadCaptureButtonAssignment(u64 aruid, Core::HID::NpadStyleSet npad_style_set,
153 Core::HID::NpadButton button_assignment);
154 Result ClearNpadCaptureButtonAssignment(u64 aruid);
155 std::size_t GetNpadCaptureButtonAssignment(std::span<Core::HID::NpadButton> out_list,
156 u64 aruid) const;
157
158 Result SetNpadSystemExtStateEnabled(u64 aruid, bool is_enabled);
159
160 Result AssigningSingleOnSlSrPress(u64 aruid, bool is_enabled);
161
162 Result GetLastActiveNpad(Core::HID::NpadIdType& out_npad_id) const;
163
152private: 164private:
153 struct VibrationData { 165 struct VibrationData {
154 bool device_mounted{}; 166 bool device_mounted{};
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 2a83486f9..4f4c75f5c 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -46,7 +46,7 @@
46#include "core/hle/service/am/applet_ae.h" 46#include "core/hle/service/am/applet_ae.h"
47#include "core/hle/service/am/applet_oe.h" 47#include "core/hle/service/am/applet_oe.h"
48#include "core/hle/service/am/applets/applets.h" 48#include "core/hle/service/am/applets/applets.h"
49#include "core/hle/service/set/set_sys.h" 49#include "core/hle/service/set/system_settings_server.h"
50#include "hid_core/frontend/emulated_controller.h" 50#include "hid_core/frontend/emulated_controller.h"
51#include "hid_core/hid_core.h" 51#include "hid_core/hid_core.h"
52#include "yuzu/multiplayer/state.h" 52#include "yuzu/multiplayer/state.h"