summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Narr the Reg2024-01-14 21:04:02 -0600
committerGravatar german772024-01-15 23:17:03 -0600
commit7f5adf8982e12b0629b6c3a90b2b783209ef09cc (patch)
tree3d93f74edd8d3a23311e8b240c4e26cfb26a2b17 /src
parentservice: set: Refractor setting service (diff)
downloadyuzu-7f5adf8982e12b0629b6c3a90b2b783209ef09cc.tar.gz
yuzu-7f5adf8982e12b0629b6c3a90b2b783209ef09cc.tar.xz
yuzu-7f5adf8982e12b0629b6c3a90b2b783209ef09cc.zip
service: set: Implement stubbed functions
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/hid/hid.cpp2
-rw-r--r--src/core/hle/service/set/setting_formats/appln_settings.cpp6
-rw-r--r--src/core/hle/service/set/setting_formats/system_settings.cpp6
-rw-r--r--src/core/hle/service/set/settings_types.h2
-rw-r--r--src/core/hle/service/set/system_settings_server.cpp213
-rw-r--r--src/core/hle/service/set/system_settings_server.h20
-rw-r--r--src/hid_core/resources/hid_firmware_settings.cpp35
-rw-r--r--src/hid_core/resources/hid_firmware_settings.h12
8 files changed, 232 insertions, 64 deletions
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 4ce0a9834..03ebdc137 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -20,7 +20,7 @@ void LoopProcess(Core::System& system) {
20 auto server_manager = std::make_unique<ServerManager>(system); 20 auto server_manager = std::make_unique<ServerManager>(system);
21 std::shared_ptr<ResourceManager> resource_manager = std::make_shared<ResourceManager>(system); 21 std::shared_ptr<ResourceManager> resource_manager = std::make_shared<ResourceManager>(system);
22 std::shared_ptr<HidFirmwareSettings> firmware_settings = 22 std::shared_ptr<HidFirmwareSettings> firmware_settings =
23 std::make_shared<HidFirmwareSettings>(); 23 std::make_shared<HidFirmwareSettings>(system);
24 24
25 // TODO: Remove this hack when am is emulated properly. 25 // TODO: Remove this hack when am is emulated properly.
26 resource_manager->Initialize(); 26 resource_manager->Initialize();
diff --git a/src/core/hle/service/set/setting_formats/appln_settings.cpp b/src/core/hle/service/set/setting_formats/appln_settings.cpp
index 566ee1b13..f7c7d5b91 100644
--- a/src/core/hle/service/set/setting_formats/appln_settings.cpp
+++ b/src/core/hle/service/set/setting_formats/appln_settings.cpp
@@ -6,7 +6,11 @@
6namespace Service::Set { 6namespace Service::Set {
7 7
8ApplnSettings DefaultApplnSettings() { 8ApplnSettings DefaultApplnSettings() {
9 return {}; 9 ApplnSettings settings{};
10
11 settings.mii_author_id = Common::UUID::MakeDefault();
12
13 return settings;
10} 14}
11 15
12} // namespace Service::Set 16} // namespace Service::Set
diff --git a/src/core/hle/service/set/setting_formats/system_settings.cpp b/src/core/hle/service/set/setting_formats/system_settings.cpp
index 4e524c0de..66e57651e 100644
--- a/src/core/hle/service/set/setting_formats/system_settings.cpp
+++ b/src/core/hle/service/set/setting_formats/system_settings.cpp
@@ -11,6 +11,8 @@ SystemSettings DefaultSystemSettings() {
11 settings.version = 0x140000; 11 settings.version = 0x140000;
12 settings.flags = 7; 12 settings.flags = 7;
13 13
14 settings.mii_author_id = Common::UUID::MakeDefault();
15
14 settings.color_set_id = ColorSet::BasicWhite; 16 settings.color_set_id = ColorSet::BasicWhite;
15 17
16 settings.notification_settings = { 18 settings.notification_settings = {
@@ -45,6 +47,10 @@ SystemSettings DefaultSystemSettings() {
45 settings.device_time_zone_location_name = {"UTC"}; 47 settings.device_time_zone_location_name = {"UTC"};
46 settings.user_system_clock_automatic_correction_enabled = false; 48 settings.user_system_clock_automatic_correction_enabled = false;
47 49
50 settings.primary_album_storage = PrimaryAlbumStorage::SdCard;
51 settings.battery_percentage_flag = true;
52 settings.chinese_traditional_input_method = ChineseTraditionalInputMethod::Unknown0;
53
48 return settings; 54 return settings;
49} 55}
50 56
diff --git a/src/core/hle/service/set/settings_types.h b/src/core/hle/service/set/settings_types.h
index ae2a884bc..4dee202d7 100644
--- a/src/core/hle/service/set/settings_types.h
+++ b/src/core/hle/service/set/settings_types.h
@@ -342,7 +342,7 @@ struct UserSelectorFlag {
342 u32 raw{}; 342 u32 raw{};
343 343
344 BitField<0, 1, u32> SkipIfSingleUser; 344 BitField<0, 1, u32> SkipIfSingleUser;
345 BitField<31, 1, u32> Uknown; 345 BitField<31, 1, u32> Unknown;
346 }; 346 };
347}; 347};
348static_assert(sizeof(UserSelectorFlag) == 4, "UserSelectorFlag is an invalid size"); 348static_assert(sizeof(UserSelectorFlag) == 4, "UserSelectorFlag is an invalid size");
diff --git a/src/core/hle/service/set/system_settings_server.cpp b/src/core/hle/service/set/system_settings_server.cpp
index 122b915c5..87242ae68 100644
--- a/src/core/hle/service/set/system_settings_server.cpp
+++ b/src/core/hle/service/set/system_settings_server.cpp
@@ -97,8 +97,8 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
97 {3, &ISystemSettingsServer::GetFirmwareVersion, "GetFirmwareVersion"}, 97 {3, &ISystemSettingsServer::GetFirmwareVersion, "GetFirmwareVersion"},
98 {4, &ISystemSettingsServer::GetFirmwareVersion2, "GetFirmwareVersion2"}, 98 {4, &ISystemSettingsServer::GetFirmwareVersion2, "GetFirmwareVersion2"},
99 {5, nullptr, "GetFirmwareVersionDigest"}, 99 {5, nullptr, "GetFirmwareVersionDigest"},
100 {7, nullptr, "GetLockScreenFlag"}, 100 {7, &ISystemSettingsServer::GetLockScreenFlag, "GetLockScreenFlag"},
101 {8, nullptr, "SetLockScreenFlag"}, 101 {8, &ISystemSettingsServer::SetLockScreenFlag, "SetLockScreenFlag"},
102 {9, nullptr, "GetBacklightSettings"}, 102 {9, nullptr, "GetBacklightSettings"},
103 {10, nullptr, "SetBacklightSettings"}, 103 {10, nullptr, "SetBacklightSettings"},
104 {11, nullptr, "SetBluetoothDevicesSettings"}, 104 {11, nullptr, "SetBluetoothDevicesSettings"},
@@ -157,12 +157,12 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
157 {66, nullptr, "SetUsb30EnableFlag"}, 157 {66, nullptr, "SetUsb30EnableFlag"},
158 {67, nullptr, "GetBatteryLot"}, 158 {67, nullptr, "GetBatteryLot"},
159 {68, nullptr, "GetSerialNumber"}, 159 {68, nullptr, "GetSerialNumber"},
160 {69, nullptr, "GetNfcEnableFlag"}, 160 {69, &ISystemSettingsServer::GetNfcEnableFlag, "GetNfcEnableFlag"},
161 {70, nullptr, "SetNfcEnableFlag"}, 161 {70, &ISystemSettingsServer::SetNfcEnableFlag, "SetNfcEnableFlag"},
162 {71, &ISystemSettingsServer::GetSleepSettings, "GetSleepSettings"}, 162 {71, &ISystemSettingsServer::GetSleepSettings, "GetSleepSettings"},
163 {72, &ISystemSettingsServer::SetSleepSettings, "SetSleepSettings"}, 163 {72, &ISystemSettingsServer::SetSleepSettings, "SetSleepSettings"},
164 {73, nullptr, "GetWirelessLanEnableFlag"}, 164 {73, &ISystemSettingsServer::GetWirelessLanEnableFlag, "GetWirelessLanEnableFlag"},
165 {74, nullptr, "SetWirelessLanEnableFlag"}, 165 {74, &ISystemSettingsServer::SetWirelessLanEnableFlag, "SetWirelessLanEnableFlag"},
166 {75, &ISystemSettingsServer::GetInitialLaunchSettings, "GetInitialLaunchSettings"}, 166 {75, &ISystemSettingsServer::GetInitialLaunchSettings, "GetInitialLaunchSettings"},
167 {76, &ISystemSettingsServer::SetInitialLaunchSettings, "SetInitialLaunchSettings"}, 167 {76, &ISystemSettingsServer::SetInitialLaunchSettings, "SetInitialLaunchSettings"},
168 {77, &ISystemSettingsServer::GetDeviceNickName, "GetDeviceNickName"}, 168 {77, &ISystemSettingsServer::GetDeviceNickName, "GetDeviceNickName"},
@@ -176,8 +176,8 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
176 {85, nullptr, "SetPtmBatteryLot"}, 176 {85, nullptr, "SetPtmBatteryLot"},
177 {86, nullptr, "GetPtmFuelGaugeParameter"}, 177 {86, nullptr, "GetPtmFuelGaugeParameter"},
178 {87, nullptr, "SetPtmFuelGaugeParameter"}, 178 {87, nullptr, "SetPtmFuelGaugeParameter"},
179 {88, nullptr, "GetBluetoothEnableFlag"}, 179 {88, &ISystemSettingsServer::GetBluetoothEnableFlag, "GetBluetoothEnableFlag"},
180 {89, nullptr, "SetBluetoothEnableFlag"}, 180 {89, &ISystemSettingsServer::SetBluetoothEnableFlag, "SetBluetoothEnableFlag"},
181 {90, &ISystemSettingsServer::GetMiiAuthorId, "GetMiiAuthorId"}, 181 {90, &ISystemSettingsServer::GetMiiAuthorId, "GetMiiAuthorId"},
182 {91, nullptr, "SetShutdownRtcValue"}, 182 {91, nullptr, "SetShutdownRtcValue"},
183 {92, nullptr, "GetShutdownRtcValue"}, 183 {92, nullptr, "GetShutdownRtcValue"},
@@ -510,6 +510,25 @@ void ISystemSettingsServer::SetUserSystemClockContext(HLERequestContext& ctx) {
510 rb.Push(res); 510 rb.Push(res);
511} 511}
512 512
513void ISystemSettingsServer::GetLockScreenFlag(HLERequestContext& ctx) {
514 LOG_INFO(Service_SET, "called, lock_screen_flag={}", m_system_settings.lock_screen_flag);
515
516 IPC::ResponseBuilder rb{ctx, 3};
517 rb.Push(ResultSuccess);
518 rb.Push(m_system_settings.lock_screen_flag);
519}
520
521void ISystemSettingsServer::SetLockScreenFlag(HLERequestContext& ctx) {
522 IPC::RequestParser rp{ctx};
523 m_system_settings.lock_screen_flag = rp.Pop<bool>();
524 SetSaveNeeded();
525
526 LOG_INFO(Service_SET, "called, lock_screen_flag={}", m_system_settings.lock_screen_flag);
527
528 IPC::ResponseBuilder rb{ctx, 2};
529 rb.Push(ResultSuccess);
530}
531
513void ISystemSettingsServer::GetAccountSettings(HLERequestContext& ctx) { 532void ISystemSettingsServer::GetAccountSettings(HLERequestContext& ctx) {
514 LOG_INFO(Service_SET, "called"); 533 LOG_INFO(Service_SET, "called");
515 534
@@ -531,7 +550,7 @@ void ISystemSettingsServer::SetAccountSettings(HLERequestContext& ctx) {
531} 550}
532 551
533void ISystemSettingsServer::GetEulaVersions(HLERequestContext& ctx) { 552void ISystemSettingsServer::GetEulaVersions(HLERequestContext& ctx) {
534 LOG_INFO(Service_SET, "called"); 553 LOG_INFO(Service_SET, "called, elements={}", m_system_settings.eula_version_count);
535 554
536 ctx.WriteBuffer(m_system_settings.eula_versions); 555 ctx.WriteBuffer(m_system_settings.eula_versions);
537 556
@@ -557,7 +576,7 @@ void ISystemSettingsServer::SetEulaVersions(HLERequestContext& ctx) {
557} 576}
558 577
559void ISystemSettingsServer::GetColorSetId(HLERequestContext& ctx) { 578void ISystemSettingsServer::GetColorSetId(HLERequestContext& ctx) {
560 LOG_DEBUG(Service_SET, "called"); 579 LOG_DEBUG(Service_SET, "called, color_set=", m_system_settings.color_set_id);
561 580
562 IPC::ResponseBuilder rb{ctx, 3}; 581 IPC::ResponseBuilder rb{ctx, 3};
563 rb.Push(ResultSuccess); 582 rb.Push(ResultSuccess);
@@ -576,7 +595,13 @@ void ISystemSettingsServer::SetColorSetId(HLERequestContext& ctx) {
576} 595}
577 596
578void ISystemSettingsServer::GetNotificationSettings(HLERequestContext& ctx) { 597void ISystemSettingsServer::GetNotificationSettings(HLERequestContext& ctx) {
579 LOG_INFO(Service_SET, "called"); 598 LOG_INFO(Service_SET, "called, flags={}, volume={}, head_time={}:{}, tailt_time={}:{}",
599 m_system_settings.notification_settings.flags.raw,
600 m_system_settings.notification_settings.volume,
601 m_system_settings.notification_settings.start_time.hour,
602 m_system_settings.notification_settings.start_time.minute,
603 m_system_settings.notification_settings.stop_time.hour,
604 m_system_settings.notification_settings.stop_time.minute);
580 605
581 IPC::ResponseBuilder rb{ctx, 8}; 606 IPC::ResponseBuilder rb{ctx, 8};
582 rb.Push(ResultSuccess); 607 rb.Push(ResultSuccess);
@@ -601,7 +626,8 @@ void ISystemSettingsServer::SetNotificationSettings(HLERequestContext& ctx) {
601} 626}
602 627
603void ISystemSettingsServer::GetAccountNotificationSettings(HLERequestContext& ctx) { 628void ISystemSettingsServer::GetAccountNotificationSettings(HLERequestContext& ctx) {
604 LOG_INFO(Service_SET, "called"); 629 LOG_INFO(Service_SET, "called, elements={}",
630 m_system_settings.account_notification_settings_count);
605 631
606 ctx.WriteBuffer(m_system_settings.account_notification_settings); 632 ctx.WriteBuffer(m_system_settings.account_notification_settings);
607 633
@@ -645,6 +671,7 @@ using Settings =
645static Settings GetSettings() { 671static Settings GetSettings() {
646 Settings ret; 672 Settings ret;
647 673
674 // AM
648 ret["hbloader"]["applet_heap_size"] = ToBytes(u64{0x0}); 675 ret["hbloader"]["applet_heap_size"] = ToBytes(u64{0x0});
649 ret["hbloader"]["applet_heap_reservation_size"] = ToBytes(u64{0x8600000}); 676 ret["hbloader"]["applet_heap_reservation_size"] = ToBytes(u64{0x8600000});
650 677
@@ -656,6 +683,24 @@ static Settings GetSettings() {
656 ret["time"]["standard_steady_clock_test_offset_minutes"] = ToBytes(s32{0}); 683 ret["time"]["standard_steady_clock_test_offset_minutes"] = ToBytes(s32{0});
657 ret["time"]["standard_user_clock_initial_year"] = ToBytes(s32{2023}); 684 ret["time"]["standard_user_clock_initial_year"] = ToBytes(s32{2023});
658 685
686 // HID
687 ret["hid_debug"]["enables_debugpad"] = ToBytes(bool{true});
688 ret["hid_debug"]["manages_devices"] = ToBytes(bool{true});
689 ret["hid_debug"]["manages_touch_ic_i2c"] = ToBytes(bool{true});
690 ret["hid_debug"]["emulate_future_device"] = ToBytes(bool{false});
691 ret["hid_debug"]["emulate_mcu_hardware_error"] = ToBytes(bool{false});
692 ret["hid_debug"]["enables_rail"] = ToBytes(bool{true});
693 ret["hid_debug"]["emulate_firmware_update_failure"] = ToBytes(bool{false});
694 ret["hid_debug"]["failure_firmware_update"] = ToBytes(s32{0});
695 ret["hid_debug"]["ble_disabled"] = ToBytes(bool{false});
696 ret["hid_debug"]["dscale_disabled"] = ToBytes(bool{false});
697 ret["hid_debug"]["force_handheld"] = ToBytes(bool{true});
698 ret["hid_debug"]["disabled_features_per_id"] = std::vector<u8>(0xa8);
699 ret["hid_debug"]["touch_firmware_auto_update_disabled"] = ToBytes(bool{false});
700
701 // Settings
702 ret["settings_debug"]["is_debug_mode_enabled"] = ToBytes(bool{false});
703
659 return ret; 704 return ret;
660} 705}
661 706
@@ -708,7 +753,15 @@ void ISystemSettingsServer::GetSettingsItemValue(HLERequestContext& ctx) {
708} 753}
709 754
710void ISystemSettingsServer::GetTvSettings(HLERequestContext& ctx) { 755void ISystemSettingsServer::GetTvSettings(HLERequestContext& ctx) {
711 LOG_INFO(Service_SET, "called"); 756 LOG_INFO(Service_SET,
757 "called, flags={}, cmu_mode={}, contrast_ratio={}, hdmi_content_type={}, "
758 "rgb_range={}, tv_gama={}, tv_resolution={}, tv_underscan={}",
759 m_system_settings.tv_settings.flags.raw, m_system_settings.tv_settings.cmu_mode,
760 m_system_settings.tv_settings.contrast_ratio,
761 m_system_settings.tv_settings.hdmi_content_type,
762 m_system_settings.tv_settings.rgb_range, m_system_settings.tv_settings.tv_gama,
763 m_system_settings.tv_settings.tv_resolution,
764 m_system_settings.tv_settings.tv_underscan);
712 765
713 IPC::ResponseBuilder rb{ctx, 10}; 766 IPC::ResponseBuilder rb{ctx, 10};
714 rb.Push(ResultSuccess); 767 rb.Push(ResultSuccess);
@@ -735,23 +788,26 @@ void ISystemSettingsServer::SetTvSettings(HLERequestContext& ctx) {
735} 788}
736 789
737void ISystemSettingsServer::GetDebugModeFlag(HLERequestContext& ctx) { 790void ISystemSettingsServer::GetDebugModeFlag(HLERequestContext& ctx) {
738 LOG_DEBUG(Service_SET, "called"); 791 bool is_debug_mode_enabled = false;
792 GetSettingsItemValue<bool>(is_debug_mode_enabled, "settings_debug", "is_debug_mode_enabled");
793
794 LOG_DEBUG(Service_SET, "called, is_debug_mode_enabled={}", is_debug_mode_enabled);
739 795
740 IPC::ResponseBuilder rb{ctx, 3}; 796 IPC::ResponseBuilder rb{ctx, 3};
741 rb.Push(ResultSuccess); 797 rb.Push(ResultSuccess);
742 rb.Push<u32>(0); 798 rb.Push(is_debug_mode_enabled);
743} 799}
744 800
745void ISystemSettingsServer::GetQuestFlag(HLERequestContext& ctx) { 801void ISystemSettingsServer::GetQuestFlag(HLERequestContext& ctx) {
746 LOG_WARNING(Service_SET, "(STUBBED) called"); 802 LOG_INFO(Service_SET, "called, quest_flag={}", m_system_settings.quest_flag);
747 803
748 IPC::ResponseBuilder rb{ctx, 3}; 804 IPC::ResponseBuilder rb{ctx, 3};
749 rb.Push(ResultSuccess); 805 rb.Push(ResultSuccess);
750 rb.PushEnum(QuestFlag::Retail); 806 rb.PushEnum(m_system_settings.quest_flag);
751} 807}
752 808
753void ISystemSettingsServer::GetDeviceTimeZoneLocationName(HLERequestContext& ctx) { 809void ISystemSettingsServer::GetDeviceTimeZoneLocationName(HLERequestContext& ctx) {
754 LOG_WARNING(Service_SET, "called"); 810 LOG_INFO(Service_SET, "called");
755 811
756 Service::Time::TimeZone::LocationName name{}; 812 Service::Time::TimeZone::LocationName name{};
757 auto res = GetDeviceTimeZoneLocationName(name); 813 auto res = GetDeviceTimeZoneLocationName(name);
@@ -762,7 +818,7 @@ void ISystemSettingsServer::GetDeviceTimeZoneLocationName(HLERequestContext& ctx
762} 818}
763 819
764void ISystemSettingsServer::SetDeviceTimeZoneLocationName(HLERequestContext& ctx) { 820void ISystemSettingsServer::SetDeviceTimeZoneLocationName(HLERequestContext& ctx) {
765 LOG_WARNING(Service_SET, "called"); 821 LOG_INFO(Service_SET, "called");
766 822
767 IPC::RequestParser rp{ctx}; 823 IPC::RequestParser rp{ctx};
768 auto name{rp.PopRaw<Service::Time::TimeZone::LocationName>()}; 824 auto name{rp.PopRaw<Service::Time::TimeZone::LocationName>()};
@@ -832,15 +888,38 @@ void ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionEnabled(HLERequ
832} 888}
833 889
834void ISystemSettingsServer::GetPrimaryAlbumStorage(HLERequestContext& ctx) { 890void ISystemSettingsServer::GetPrimaryAlbumStorage(HLERequestContext& ctx) {
835 LOG_WARNING(Service_SET, "(STUBBED) called"); 891 LOG_INFO(Service_SET, "called, primary_album_storage={}",
892 m_system_settings.primary_album_storage);
893
894 IPC::ResponseBuilder rb{ctx, 3};
895 rb.Push(ResultSuccess);
896 rb.PushEnum(m_system_settings.primary_album_storage);
897}
898
899void ISystemSettingsServer::GetNfcEnableFlag(HLERequestContext& ctx) {
900 LOG_INFO(Service_SET, "called, nfc_enable_flag={}", m_system_settings.nfc_enable_flag);
836 901
837 IPC::ResponseBuilder rb{ctx, 3}; 902 IPC::ResponseBuilder rb{ctx, 3};
838 rb.Push(ResultSuccess); 903 rb.Push(ResultSuccess);
839 rb.PushEnum(PrimaryAlbumStorage::SdCard); 904 rb.Push<u8>(m_system_settings.nfc_enable_flag);
905}
906
907void ISystemSettingsServer::SetNfcEnableFlag(HLERequestContext& ctx) {
908 IPC::RequestParser rp{ctx};
909 m_system_settings.nfc_enable_flag = rp.Pop<bool>();
910 SetSaveNeeded();
911
912 LOG_INFO(Service_SET, "called, nfc_enable_flag={}", m_system_settings.nfc_enable_flag);
913
914 IPC::ResponseBuilder rb{ctx, 2};
915 rb.Push(ResultSuccess);
840} 916}
841 917
842void ISystemSettingsServer::GetSleepSettings(HLERequestContext& ctx) { 918void ISystemSettingsServer::GetSleepSettings(HLERequestContext& ctx) {
843 LOG_INFO(Service_SET, "called"); 919 LOG_INFO(Service_SET, "called, flags={}, handheld_sleep_plan={}, console_sleep_plan={}",
920 m_system_settings.sleep_settings.flags.raw,
921 m_system_settings.sleep_settings.handheld_sleep_plan,
922 m_system_settings.sleep_settings.console_sleep_plan);
844 923
845 IPC::ResponseBuilder rb{ctx, 5}; 924 IPC::ResponseBuilder rb{ctx, 5};
846 rb.Push(ResultSuccess); 925 rb.Push(ResultSuccess);
@@ -861,8 +940,32 @@ void ISystemSettingsServer::SetSleepSettings(HLERequestContext& ctx) {
861 rb.Push(ResultSuccess); 940 rb.Push(ResultSuccess);
862} 941}
863 942
943void ISystemSettingsServer::GetWirelessLanEnableFlag(HLERequestContext& ctx) {
944 LOG_INFO(Service_SET, "called, wireless_lan_enable_flag={}",
945 m_system_settings.wireless_lan_enable_flag);
946
947 IPC::ResponseBuilder rb{ctx, 3};
948 rb.Push(ResultSuccess);
949 rb.Push(m_system_settings.wireless_lan_enable_flag);
950}
951
952void ISystemSettingsServer::SetWirelessLanEnableFlag(HLERequestContext& ctx) {
953 IPC::RequestParser rp{ctx};
954 m_system_settings.wireless_lan_enable_flag = rp.Pop<bool>();
955 SetSaveNeeded();
956
957 LOG_INFO(Service_SET, "called, wireless_lan_enable_flag={}",
958 m_system_settings.wireless_lan_enable_flag);
959
960 IPC::ResponseBuilder rb{ctx, 2};
961 rb.Push(ResultSuccess);
962}
963
864void ISystemSettingsServer::GetInitialLaunchSettings(HLERequestContext& ctx) { 964void ISystemSettingsServer::GetInitialLaunchSettings(HLERequestContext& ctx) {
865 LOG_INFO(Service_SET, "called"); 965 LOG_INFO(Service_SET, "called, flags={}, timestamp={}",
966 m_system_settings.initial_launch_settings_packed.flags.raw,
967 m_system_settings.initial_launch_settings_packed.timestamp.time_point);
968
866 IPC::ResponseBuilder rb{ctx, 10}; 969 IPC::ResponseBuilder rb{ctx, 10};
867 rb.Push(ResultSuccess); 970 rb.Push(ResultSuccess);
868 rb.PushRaw(m_system_settings.initial_launch_settings_packed); 971 rb.PushRaw(m_system_settings.initial_launch_settings_packed);
@@ -913,35 +1016,51 @@ void ISystemSettingsServer::GetProductModel(HLERequestContext& ctx) {
913 rb.Push(product_model); 1016 rb.Push(product_model);
914} 1017}
915 1018
916void ISystemSettingsServer::GetMiiAuthorId(HLERequestContext& ctx) { 1019void ISystemSettingsServer::GetBluetoothEnableFlag(HLERequestContext& ctx) {
917 const auto author_id = Common::UUID::MakeDefault(); 1020 LOG_INFO(Service_SET, "called, bluetooth_enable_flag={}",
1021 m_system_settings.bluetooth_enable_flag);
918 1022
919 LOG_WARNING(Service_SET, "(STUBBED) called, author_id={}", author_id.FormattedString()); 1023 IPC::ResponseBuilder rb{ctx, 3};
1024 rb.Push(ResultSuccess);
1025 rb.Push<u8>(m_system_settings.bluetooth_enable_flag);
1026}
1027
1028void ISystemSettingsServer::SetBluetoothEnableFlag(HLERequestContext& ctx) {
1029 IPC::RequestParser rp{ctx};
1030 m_system_settings.bluetooth_enable_flag = rp.Pop<bool>();
1031 SetSaveNeeded();
1032
1033 LOG_INFO(Service_SET, "called, bluetooth_enable_flag={}",
1034 m_system_settings.bluetooth_enable_flag);
1035
1036 IPC::ResponseBuilder rb{ctx, 2};
1037 rb.Push(ResultSuccess);
1038}
1039
1040void ISystemSettingsServer::GetMiiAuthorId(HLERequestContext& ctx) {
1041 LOG_INFO(Service_SET, "called, author_id={}",
1042 m_system_settings.mii_author_id.FormattedString());
920 1043
921 IPC::ResponseBuilder rb{ctx, 6}; 1044 IPC::ResponseBuilder rb{ctx, 6};
922 rb.Push(ResultSuccess); 1045 rb.Push(ResultSuccess);
923 rb.PushRaw(author_id); 1046 rb.PushRaw(m_system_settings.mii_author_id);
924} 1047}
925 1048
926void ISystemSettingsServer::GetAutoUpdateEnableFlag(HLERequestContext& ctx) { 1049void ISystemSettingsServer::GetAutoUpdateEnableFlag(HLERequestContext& ctx) {
927 u8 auto_update_flag{}; 1050 LOG_INFO(Service_SET, "called, auto_update_flag={}", m_system_settings.auto_update_enable_flag);
928
929 LOG_WARNING(Service_SET, "(STUBBED) called, auto_update_flag={}", auto_update_flag);
930 1051
931 IPC::ResponseBuilder rb{ctx, 3}; 1052 IPC::ResponseBuilder rb{ctx, 3};
932 rb.Push(ResultSuccess); 1053 rb.Push(ResultSuccess);
933 rb.Push(auto_update_flag); 1054 rb.Push(m_system_settings.auto_update_enable_flag);
934} 1055}
935 1056
936void ISystemSettingsServer::GetBatteryPercentageFlag(HLERequestContext& ctx) { 1057void ISystemSettingsServer::GetBatteryPercentageFlag(HLERequestContext& ctx) {
937 u8 battery_percentage_flag{1}; 1058 LOG_DEBUG(Service_SET, "called, battery_percentage_flag={}",
938 1059 m_system_settings.battery_percentage_flag);
939 LOG_WARNING(Service_SET, "(STUBBED) called, battery_percentage_flag={}",
940 battery_percentage_flag);
941 1060
942 IPC::ResponseBuilder rb{ctx, 3}; 1061 IPC::ResponseBuilder rb{ctx, 3};
943 rb.Push(ResultSuccess); 1062 rb.Push(ResultSuccess);
944 rb.Push(battery_percentage_flag); 1063 rb.Push(m_system_settings.battery_percentage_flag);
945} 1064}
946 1065
947void ISystemSettingsServer::SetExternalSteadyClockInternalOffset(HLERequestContext& ctx) { 1066void ISystemSettingsServer::SetExternalSteadyClockInternalOffset(HLERequestContext& ctx) {
@@ -968,11 +1087,12 @@ void ISystemSettingsServer::GetExternalSteadyClockInternalOffset(HLERequestConte
968} 1087}
969 1088
970void ISystemSettingsServer::GetErrorReportSharePermission(HLERequestContext& ctx) { 1089void ISystemSettingsServer::GetErrorReportSharePermission(HLERequestContext& ctx) {
971 LOG_WARNING(Service_SET, "(STUBBED) called"); 1090 LOG_INFO(Service_SET, "called, error_report_share_permission={}",
1091 m_system_settings.error_report_share_permission);
972 1092
973 IPC::ResponseBuilder rb{ctx, 3}; 1093 IPC::ResponseBuilder rb{ctx, 3};
974 rb.Push(ResultSuccess); 1094 rb.Push(ResultSuccess);
975 rb.PushEnum(ErrorReportSharePermission::Denied); 1095 rb.PushEnum(m_system_settings.error_report_share_permission);
976} 1096}
977 1097
978void ISystemSettingsServer::GetAppletLaunchFlags(HLERequestContext& ctx) { 1098void ISystemSettingsServer::GetAppletLaunchFlags(HLERequestContext& ctx) {
@@ -1014,7 +1134,7 @@ void ISystemSettingsServer::GetKeyboardLayout(HLERequestContext& ctx) {
1014} 1134}
1015 1135
1016void ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) { 1136void ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) {
1017 LOG_WARNING(Service_SET, "called."); 1137 LOG_INFO(Service_SET, "called");
1018 1138
1019 Service::Time::Clock::SteadyClockTimePoint time_point{}; 1139 Service::Time::Clock::SteadyClockTimePoint time_point{};
1020 auto res = GetDeviceTimeZoneLocationUpdatedTime(time_point); 1140 auto res = GetDeviceTimeZoneLocationUpdatedTime(time_point);
@@ -1025,7 +1145,7 @@ void ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime(HLERequestConte
1025} 1145}
1026 1146
1027void ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) { 1147void ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) {
1028 LOG_WARNING(Service_SET, "called."); 1148 LOG_INFO(Service_SET, "called");
1029 1149
1030 IPC::RequestParser rp{ctx}; 1150 IPC::RequestParser rp{ctx};
1031 auto time_point{rp.PopRaw<Service::Time::Clock::SteadyClockTimePoint>()}; 1151 auto time_point{rp.PopRaw<Service::Time::Clock::SteadyClockTimePoint>()};
@@ -1038,7 +1158,7 @@ void ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime(HLERequestConte
1038 1158
1039void ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime( 1159void ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime(
1040 HLERequestContext& ctx) { 1160 HLERequestContext& ctx) {
1041 LOG_WARNING(Service_SET, "called."); 1161 LOG_INFO(Service_SET, "called");
1042 1162
1043 Service::Time::Clock::SteadyClockTimePoint time_point{}; 1163 Service::Time::Clock::SteadyClockTimePoint time_point{};
1044 auto res = GetUserSystemClockAutomaticCorrectionUpdatedTime(time_point); 1164 auto res = GetUserSystemClockAutomaticCorrectionUpdatedTime(time_point);
@@ -1050,7 +1170,7 @@ void ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime(
1050 1170
1051void ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime( 1171void ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime(
1052 HLERequestContext& ctx) { 1172 HLERequestContext& ctx) {
1053 LOG_WARNING(Service_SET, "called."); 1173 LOG_INFO(Service_SET, "called");
1054 1174
1055 IPC::RequestParser rp{ctx}; 1175 IPC::RequestParser rp{ctx};
1056 auto time_point{rp.PopRaw<Service::Time::Clock::SteadyClockTimePoint>()}; 1176 auto time_point{rp.PopRaw<Service::Time::Clock::SteadyClockTimePoint>()};
@@ -1062,11 +1182,12 @@ void ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime(
1062} 1182}
1063 1183
1064void ISystemSettingsServer::GetChineseTraditionalInputMethod(HLERequestContext& ctx) { 1184void ISystemSettingsServer::GetChineseTraditionalInputMethod(HLERequestContext& ctx) {
1065 LOG_WARNING(Service_SET, "(STUBBED) called"); 1185 LOG_INFO(Service_SET, "called, chinese_traditional_input_method={}",
1186 m_system_settings.chinese_traditional_input_method);
1066 1187
1067 IPC::ResponseBuilder rb{ctx, 3}; 1188 IPC::ResponseBuilder rb{ctx, 3};
1068 rb.Push(ResultSuccess); 1189 rb.Push(ResultSuccess);
1069 rb.PushEnum(ChineseTraditionalInputMethod::Unknown0); 1190 rb.PushEnum(m_system_settings.chinese_traditional_input_method);
1070} 1191}
1071 1192
1072void ISystemSettingsServer::GetHomeMenuScheme(HLERequestContext& ctx) { 1193void ISystemSettingsServer::GetHomeMenuScheme(HLERequestContext& ctx) {
@@ -1094,11 +1215,11 @@ void ISystemSettingsServer::GetHomeMenuSchemeModel(HLERequestContext& ctx) {
1094} 1215}
1095 1216
1096void ISystemSettingsServer::GetFieldTestingFlag(HLERequestContext& ctx) { 1217void ISystemSettingsServer::GetFieldTestingFlag(HLERequestContext& ctx) {
1097 LOG_WARNING(Service_SET, "(STUBBED) called"); 1218 LOG_INFO(Service_SET, "called, field_testing_flag={}", m_system_settings.field_testing_flag);
1098 1219
1099 IPC::ResponseBuilder rb{ctx, 3}; 1220 IPC::ResponseBuilder rb{ctx, 3};
1100 rb.Push(ResultSuccess); 1221 rb.Push(ResultSuccess);
1101 rb.Push<u8>(false); 1222 rb.Push(m_system_settings.field_testing_flag);
1102} 1223}
1103 1224
1104void ISystemSettingsServer::SetupSettings() { 1225void ISystemSettingsServer::SetupSettings() {
diff --git a/src/core/hle/service/set/system_settings_server.h b/src/core/hle/service/set/system_settings_server.h
index bab913615..32716f567 100644
--- a/src/core/hle/service/set/system_settings_server.h
+++ b/src/core/hle/service/set/system_settings_server.h
@@ -37,6 +37,18 @@ public:
37 Result GetSettingsItemValue(std::vector<u8>& out_value, const std::string& category, 37 Result GetSettingsItemValue(std::vector<u8>& out_value, const std::string& category,
38 const std::string& name); 38 const std::string& name);
39 39
40 template <typename T>
41 Result GetSettingsItemValue(T& value, const std::string& category, const std::string& name) {
42 std::vector<u8> data;
43 const auto result = GetSettingsItemValue(data, category, name);
44 if (result.IsError()) {
45 return result;
46 }
47 ASSERT(data.size() >= sizeof(T));
48 std::memcpy(&value, data.data(), sizeof(T));
49 return result;
50 }
51
40 Result GetExternalSteadyClockSourceId(Common::UUID& out_id); 52 Result GetExternalSteadyClockSourceId(Common::UUID& out_id);
41 Result SetExternalSteadyClockSourceId(Common::UUID id); 53 Result SetExternalSteadyClockSourceId(Common::UUID id);
42 Result GetUserSystemClockContext(Service::Time::Clock::SystemClockContext& out_context); 54 Result GetUserSystemClockContext(Service::Time::Clock::SystemClockContext& out_context);
@@ -62,6 +74,8 @@ private:
62 void SetLanguageCode(HLERequestContext& ctx); 74 void SetLanguageCode(HLERequestContext& ctx);
63 void GetFirmwareVersion(HLERequestContext& ctx); 75 void GetFirmwareVersion(HLERequestContext& ctx);
64 void GetFirmwareVersion2(HLERequestContext& ctx); 76 void GetFirmwareVersion2(HLERequestContext& ctx);
77 void GetLockScreenFlag(HLERequestContext& ctx);
78 void SetLockScreenFlag(HLERequestContext& ctx);
65 void GetExternalSteadyClockSourceId(HLERequestContext& ctx); 79 void GetExternalSteadyClockSourceId(HLERequestContext& ctx);
66 void SetExternalSteadyClockSourceId(HLERequestContext& ctx); 80 void SetExternalSteadyClockSourceId(HLERequestContext& ctx);
67 void GetUserSystemClockContext(HLERequestContext& ctx); 81 void GetUserSystemClockContext(HLERequestContext& ctx);
@@ -90,13 +104,19 @@ private:
90 void IsUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx); 104 void IsUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx);
91 void SetUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx); 105 void SetUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx);
92 void GetPrimaryAlbumStorage(HLERequestContext& ctx); 106 void GetPrimaryAlbumStorage(HLERequestContext& ctx);
107 void GetNfcEnableFlag(HLERequestContext& ctx);
108 void SetNfcEnableFlag(HLERequestContext& ctx);
93 void GetSleepSettings(HLERequestContext& ctx); 109 void GetSleepSettings(HLERequestContext& ctx);
94 void SetSleepSettings(HLERequestContext& ctx); 110 void SetSleepSettings(HLERequestContext& ctx);
111 void GetWirelessLanEnableFlag(HLERequestContext& ctx);
112 void SetWirelessLanEnableFlag(HLERequestContext& ctx);
95 void GetInitialLaunchSettings(HLERequestContext& ctx); 113 void GetInitialLaunchSettings(HLERequestContext& ctx);
96 void SetInitialLaunchSettings(HLERequestContext& ctx); 114 void SetInitialLaunchSettings(HLERequestContext& ctx);
97 void GetDeviceNickName(HLERequestContext& ctx); 115 void GetDeviceNickName(HLERequestContext& ctx);
98 void SetDeviceNickName(HLERequestContext& ctx); 116 void SetDeviceNickName(HLERequestContext& ctx);
99 void GetProductModel(HLERequestContext& ctx); 117 void GetProductModel(HLERequestContext& ctx);
118 void GetBluetoothEnableFlag(HLERequestContext& ctx);
119 void SetBluetoothEnableFlag(HLERequestContext& ctx);
100 void GetMiiAuthorId(HLERequestContext& ctx); 120 void GetMiiAuthorId(HLERequestContext& ctx);
101 void GetAutoUpdateEnableFlag(HLERequestContext& ctx); 121 void GetAutoUpdateEnableFlag(HLERequestContext& ctx);
102 void GetBatteryPercentageFlag(HLERequestContext& ctx); 122 void GetBatteryPercentageFlag(HLERequestContext& ctx);
diff --git a/src/hid_core/resources/hid_firmware_settings.cpp b/src/hid_core/resources/hid_firmware_settings.cpp
index 9fa0db17e..00ceff7e6 100644
--- a/src/hid_core/resources/hid_firmware_settings.cpp
+++ b/src/hid_core/resources/hid_firmware_settings.cpp
@@ -1,11 +1,14 @@
1// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project 1// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-3.0-or-later 2// SPDX-License-Identifier: GPL-3.0-or-later
3 3
4#include "core/hle/service/set/system_settings_server.h"
5#include "core/hle/service/sm/sm.h"
4#include "hid_core/resources/hid_firmware_settings.h" 6#include "hid_core/resources/hid_firmware_settings.h"
5 7
6namespace Service::HID { 8namespace Service::HID {
7 9
8HidFirmwareSettings::HidFirmwareSettings() { 10HidFirmwareSettings::HidFirmwareSettings(Core::System& system) {
11 m_set_sys = system.ServiceManager().GetService<Service::Set::ISystemSettingsServer>("set:sys");
9 LoadSettings(true); 12 LoadSettings(true);
10} 13}
11 14
@@ -18,21 +21,25 @@ void HidFirmwareSettings::LoadSettings(bool reload_config) {
18 return; 21 return;
19 } 22 }
20 23
21 // TODO: Use nn::settings::fwdbg::GetSettingsItemValue to load config values 24 m_set_sys->GetSettingsItemValue<bool>(is_debug_pad_enabled, "hid_debug", "enables_debugpad");
22 25 m_set_sys->GetSettingsItemValue<bool>(is_device_managed, "hid_debug", "manages_devices");
23 is_debug_pad_enabled = true; 26 m_set_sys->GetSettingsItemValue<bool>(is_touch_i2c_managed, "hid_debug",
24 is_device_managed = true; 27 "manages_touch_ic_i2c");
25 is_touch_i2c_managed = is_device_managed; 28 m_set_sys->GetSettingsItemValue<bool>(is_future_devices_emulated, "hid_debug",
26 is_future_devices_emulated = false; 29 "emulate_future_device");
27 is_mcu_hardware_error_emulated = false; 30 m_set_sys->GetSettingsItemValue<bool>(is_mcu_hardware_error_emulated, "hid_debug",
28 is_rail_enabled = true; 31 "emulate_mcu_hardware_error");
29 is_firmware_update_failure_emulated = false; 32 m_set_sys->GetSettingsItemValue<bool>(is_rail_enabled, "hid_debug", "enables_rail");
33 m_set_sys->GetSettingsItemValue<bool>(is_firmware_update_failure_emulated, "hid_debug",
34 "emulate_firmware_update_failure");
30 is_firmware_update_failure = {}; 35 is_firmware_update_failure = {};
31 is_ble_disabled = false; 36 m_set_sys->GetSettingsItemValue<bool>(is_ble_disabled, "hid_debug", "ble_disabled");
32 is_dscale_disabled = false; 37 m_set_sys->GetSettingsItemValue<bool>(is_dscale_disabled, "hid_debug", "dscale_disabled");
33 is_handheld_forced = true; 38 m_set_sys->GetSettingsItemValue<bool>(is_handheld_forced, "hid_debug", "force_handheld");
34 features_per_id_disabled = {}; 39 features_per_id_disabled = {};
35 is_touch_firmware_auto_update_disabled = false; 40 m_set_sys->GetSettingsItemValue<bool>(is_touch_firmware_auto_update_disabled, "hid_debug",
41 "touch_firmware_auto_update_disabled");
42
36 is_initialized = true; 43 is_initialized = true;
37} 44}
38 45
diff --git a/src/hid_core/resources/hid_firmware_settings.h b/src/hid_core/resources/hid_firmware_settings.h
index 00201fd94..3694fa9a3 100644
--- a/src/hid_core/resources/hid_firmware_settings.h
+++ b/src/hid_core/resources/hid_firmware_settings.h
@@ -5,6 +5,14 @@
5 5
6#include "common/common_types.h" 6#include "common/common_types.h"
7 7
8namespace Core {
9class System;
10}
11
12namespace Service::Set {
13class ISystemSettingsServer;
14}
15
8namespace Service::HID { 16namespace Service::HID {
9 17
10/// Loads firmware config from nn::settings::fwdbg 18/// Loads firmware config from nn::settings::fwdbg
@@ -13,7 +21,7 @@ public:
13 using FirmwareSetting = std::array<u8, 4>; 21 using FirmwareSetting = std::array<u8, 4>;
14 using FeaturesPerId = std::array<bool, 0xA8>; 22 using FeaturesPerId = std::array<bool, 0xA8>;
15 23
16 HidFirmwareSettings(); 24 HidFirmwareSettings(Core::System& system);
17 25
18 void Reload(); 26 void Reload();
19 void LoadSettings(bool reload_config); 27 void LoadSettings(bool reload_config);
@@ -49,6 +57,8 @@ private:
49 bool is_touch_firmware_auto_update_disabled{}; 57 bool is_touch_firmware_auto_update_disabled{};
50 FirmwareSetting is_firmware_update_failure{}; 58 FirmwareSetting is_firmware_update_failure{};
51 FeaturesPerId features_per_id_disabled{}; 59 FeaturesPerId features_per_id_disabled{};
60
61 std::shared_ptr<Service::Set::ISystemSettingsServer> m_set_sys;
52}; 62};
53 63
54} // namespace Service::HID 64} // namespace Service::HID