diff options
| author | 2023-10-29 13:50:55 +0000 | |
|---|---|---|
| committer | 2024-01-24 04:26:55 +0000 | |
| commit | e4915fb7d2077584a11a15141bc81d28ed2b0125 (patch) | |
| tree | 1783055dc2e98eaf9099e8e7b194b55f8f607747 /src/core/hle/service/set | |
| parent | Merge pull request #12678 from german77/settings_impl (diff) | |
| download | yuzu-e4915fb7d2077584a11a15141bc81d28ed2b0125.tar.gz yuzu-e4915fb7d2077584a11a15141bc81d28ed2b0125.tar.xz yuzu-e4915fb7d2077584a11a15141bc81d28ed2b0125.zip | |
Rework time service to fix time passing offline.
Diffstat (limited to 'src/core/hle/service/set')
7 files changed, 129 insertions, 57 deletions
diff --git a/src/core/hle/service/set/private_settings.h b/src/core/hle/service/set/private_settings.h new file mode 100644 index 000000000..b02291ce7 --- /dev/null +++ b/src/core/hle/service/set/private_settings.h | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include <array> | ||
| 7 | |||
| 8 | #include "common/bit_field.h" | ||
| 9 | #include "common/common_funcs.h" | ||
| 10 | #include "common/common_types.h" | ||
| 11 | #include "common/uuid.h" | ||
| 12 | #include "core/hle/service/psc/time/common.h" | ||
| 13 | |||
| 14 | namespace Service::Set { | ||
| 15 | |||
| 16 | /// This is nn::settings::system::InitialLaunchFlag | ||
| 17 | struct InitialLaunchFlag { | ||
| 18 | union { | ||
| 19 | u32 raw{}; | ||
| 20 | |||
| 21 | BitField<0, 1, u32> InitialLaunchCompletionFlag; | ||
| 22 | BitField<8, 1, u32> InitialLaunchUserAdditionFlag; | ||
| 23 | BitField<16, 1, u32> InitialLaunchTimestampFlag; | ||
| 24 | }; | ||
| 25 | }; | ||
| 26 | static_assert(sizeof(InitialLaunchFlag) == 4, "InitialLaunchFlag is an invalid size"); | ||
| 27 | |||
| 28 | /// This is nn::settings::system::InitialLaunchSettings | ||
| 29 | struct InitialLaunchSettings { | ||
| 30 | InitialLaunchFlag flags; | ||
| 31 | INSERT_PADDING_BYTES(0x4); | ||
| 32 | Service::PSC::Time::SteadyClockTimePoint timestamp; | ||
| 33 | }; | ||
| 34 | static_assert(sizeof(InitialLaunchSettings) == 0x20, "InitialLaunchSettings is incorrect size"); | ||
| 35 | |||
| 36 | #pragma pack(push, 4) | ||
| 37 | struct InitialLaunchSettingsPacked { | ||
| 38 | InitialLaunchFlag flags; | ||
| 39 | Service::PSC::Time::SteadyClockTimePoint timestamp; | ||
| 40 | }; | ||
| 41 | #pragma pack(pop) | ||
| 42 | static_assert(sizeof(InitialLaunchSettingsPacked) == 0x1C, | ||
| 43 | "InitialLaunchSettingsPacked is incorrect size"); | ||
| 44 | |||
| 45 | struct PrivateSettings { | ||
| 46 | std::array<u8, 0x10> reserved_00; | ||
| 47 | |||
| 48 | // nn::settings::system::InitialLaunchSettings | ||
| 49 | InitialLaunchSettings initial_launch_settings; | ||
| 50 | |||
| 51 | std::array<u8, 0x20> reserved_30; | ||
| 52 | |||
| 53 | Common::UUID external_clock_source_id; | ||
| 54 | s64 shutdown_rtc_value; | ||
| 55 | s64 external_steady_clock_internal_offset; | ||
| 56 | |||
| 57 | std::array<u8, 0x60> reserved_70; | ||
| 58 | |||
| 59 | // nn::settings::system::PlatformRegion | ||
| 60 | std::array<u8, 0x4> platform_region; | ||
| 61 | |||
| 62 | std::array<u8, 0x4> reserved_D4; | ||
| 63 | }; | ||
| 64 | static_assert(offsetof(PrivateSettings, initial_launch_settings) == 0x10); | ||
| 65 | static_assert(offsetof(PrivateSettings, external_clock_source_id) == 0x50); | ||
| 66 | static_assert(offsetof(PrivateSettings, reserved_70) == 0x70); | ||
| 67 | static_assert(offsetof(PrivateSettings, platform_region) == 0xD0); | ||
| 68 | static_assert(sizeof(PrivateSettings) == 0xD8, "PrivateSettings has the wrong size!"); | ||
| 69 | |||
| 70 | PrivateSettings DefaultPrivateSettings(); | ||
| 71 | |||
| 72 | } // namespace Service::Set | ||
diff --git a/src/core/hle/service/set/setting_formats/private_settings.h b/src/core/hle/service/set/setting_formats/private_settings.h index 6c40f62e1..6579e95e0 100644 --- a/src/core/hle/service/set/setting_formats/private_settings.h +++ b/src/core/hle/service/set/setting_formats/private_settings.h | |||
| @@ -8,7 +8,6 @@ | |||
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "common/uuid.h" | 9 | #include "common/uuid.h" |
| 10 | #include "core/hle/service/set/settings_types.h" | 10 | #include "core/hle/service/set/settings_types.h" |
| 11 | #include "core/hle/service/time/clock_types.h" | ||
| 12 | 11 | ||
| 13 | namespace Service::Set { | 12 | namespace Service::Set { |
| 14 | 13 | ||
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 66e57651e..ec00b90a6 100644 --- a/src/core/hle/service/set/setting_formats/system_settings.cpp +++ b/src/core/hle/service/set/setting_formats/system_settings.cpp | |||
| @@ -45,7 +45,7 @@ SystemSettings DefaultSystemSettings() { | |||
| 45 | }; | 45 | }; |
| 46 | 46 | ||
| 47 | settings.device_time_zone_location_name = {"UTC"}; | 47 | settings.device_time_zone_location_name = {"UTC"}; |
| 48 | settings.user_system_clock_automatic_correction_enabled = false; | 48 | settings.user_system_clock_automatic_correction_enabled = true; |
| 49 | 49 | ||
| 50 | settings.primary_album_storage = PrimaryAlbumStorage::SdCard; | 50 | settings.primary_album_storage = PrimaryAlbumStorage::SdCard; |
| 51 | settings.battery_percentage_flag = true; | 51 | settings.battery_percentage_flag = true; |
diff --git a/src/core/hle/service/set/setting_formats/system_settings.h b/src/core/hle/service/set/setting_formats/system_settings.h index 14654f8b1..af5929fa9 100644 --- a/src/core/hle/service/set/setting_formats/system_settings.h +++ b/src/core/hle/service/set/setting_formats/system_settings.h | |||
| @@ -12,7 +12,6 @@ | |||
| 12 | #include "common/vector_math.h" | 12 | #include "common/vector_math.h" |
| 13 | #include "core/hle/service/set/setting_formats/private_settings.h" | 13 | #include "core/hle/service/set/setting_formats/private_settings.h" |
| 14 | #include "core/hle/service/set/settings_types.h" | 14 | #include "core/hle/service/set/settings_types.h" |
| 15 | #include "core/hle/service/time/clock_types.h" | ||
| 16 | 15 | ||
| 17 | namespace Service::Set { | 16 | namespace Service::Set { |
| 18 | 17 | ||
| @@ -197,12 +196,14 @@ struct SystemSettings { | |||
| 197 | std::array<u8, 0x2C> backlight_settings_mixed_up; | 196 | std::array<u8, 0x2C> backlight_settings_mixed_up; |
| 198 | INSERT_PADDING_BYTES(0x64); // Reserved | 197 | INSERT_PADDING_BYTES(0x64); // Reserved |
| 199 | 198 | ||
| 200 | Service::Time::Clock::SystemClockContext user_system_clock_context; | 199 | // nn::time::SystemClockContext |
| 201 | Service::Time::Clock::SystemClockContext network_system_clock_context; | 200 | Service::PSC::Time::SystemClockContext user_system_clock_context; |
| 201 | Service::PSC::Time::SystemClockContext network_system_clock_context; | ||
| 202 | bool user_system_clock_automatic_correction_enabled; | 202 | bool user_system_clock_automatic_correction_enabled; |
| 203 | INSERT_PADDING_BYTES(0x3); | 203 | INSERT_PADDING_BYTES(0x3); |
| 204 | INSERT_PADDING_BYTES(0x4); // Reserved | 204 | INSERT_PADDING_BYTES(0x4); // Reserved |
| 205 | Service::Time::Clock::SteadyClockTimePoint | 205 | // nn::time::SteadyClockTimePoint |
| 206 | Service::PSC::Time::SteadyClockTimePoint | ||
| 206 | user_system_clock_automatic_correction_updated_time_point; | 207 | user_system_clock_automatic_correction_updated_time_point; |
| 207 | INSERT_PADDING_BYTES(0x10); // Reserved | 208 | INSERT_PADDING_BYTES(0x10); // Reserved |
| 208 | 209 | ||
| @@ -280,9 +281,12 @@ struct SystemSettings { | |||
| 280 | bool requires_run_repair_time_reviser; | 281 | bool requires_run_repair_time_reviser; |
| 281 | INSERT_PADDING_BYTES(0x6B); // Reserved | 282 | INSERT_PADDING_BYTES(0x6B); // Reserved |
| 282 | 283 | ||
| 283 | Service::Time::TimeZone::LocationName device_time_zone_location_name; | 284 | // nn::time::LocationName |
| 285 | Service::PSC::Time::LocationName device_time_zone_location_name; | ||
| 284 | INSERT_PADDING_BYTES(0x4); // Reserved | 286 | INSERT_PADDING_BYTES(0x4); // Reserved |
| 285 | Service::Time::Clock::SteadyClockTimePoint device_time_zone_location_updated_time; | 287 | // nn::time::SteadyClockTimePoint |
| 288 | Service::PSC::Time::SteadyClockTimePoint device_time_zone_location_updated_time; | ||
| 289 | |||
| 286 | INSERT_PADDING_BYTES(0xC0); // Reserved | 290 | INSERT_PADDING_BYTES(0xC0); // Reserved |
| 287 | 291 | ||
| 288 | // nn::settings::system::PrimaryAlbumStorage | 292 | // nn::settings::system::PrimaryAlbumStorage |
diff --git a/src/core/hle/service/set/settings_types.h b/src/core/hle/service/set/settings_types.h index 4dee202d7..f6f227fde 100644 --- a/src/core/hle/service/set/settings_types.h +++ b/src/core/hle/service/set/settings_types.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "common/common_funcs.h" | 9 | #include "common/common_funcs.h" |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | #include "common/uuid.h" | 11 | #include "common/uuid.h" |
| 12 | #include "core/hle/service/time/clock_types.h" | 12 | #include "core/hle/service/psc/time/common.h" |
| 13 | 13 | ||
| 14 | namespace Service::Set { | 14 | namespace Service::Set { |
| 15 | 15 | ||
| @@ -365,7 +365,7 @@ struct EulaVersion { | |||
| 365 | EulaVersionClockType clock_type; | 365 | EulaVersionClockType clock_type; |
| 366 | INSERT_PADDING_BYTES(0x4); | 366 | INSERT_PADDING_BYTES(0x4); |
| 367 | s64 posix_time; | 367 | s64 posix_time; |
| 368 | Time::Clock::SteadyClockTimePoint timestamp; | 368 | Service::PSC::Time::SteadyClockTimePoint timestamp; |
| 369 | }; | 369 | }; |
| 370 | static_assert(sizeof(EulaVersion) == 0x30, "EulaVersion is incorrect size"); | 370 | static_assert(sizeof(EulaVersion) == 0x30, "EulaVersion is incorrect size"); |
| 371 | 371 | ||
| @@ -398,14 +398,14 @@ static_assert(sizeof(HomeMenuScheme) == 0x14, "HomeMenuScheme is incorrect size" | |||
| 398 | struct InitialLaunchSettings { | 398 | struct InitialLaunchSettings { |
| 399 | InitialLaunchFlag flags; | 399 | InitialLaunchFlag flags; |
| 400 | INSERT_PADDING_BYTES(0x4); | 400 | INSERT_PADDING_BYTES(0x4); |
| 401 | Service::Time::Clock::SteadyClockTimePoint timestamp; | 401 | Service::PSC::Time::SteadyClockTimePoint timestamp; |
| 402 | }; | 402 | }; |
| 403 | static_assert(sizeof(InitialLaunchSettings) == 0x20, "InitialLaunchSettings is incorrect size"); | 403 | static_assert(sizeof(InitialLaunchSettings) == 0x20, "InitialLaunchSettings is incorrect size"); |
| 404 | 404 | ||
| 405 | #pragma pack(push, 4) | 405 | #pragma pack(push, 4) |
| 406 | struct InitialLaunchSettingsPacked { | 406 | struct InitialLaunchSettingsPacked { |
| 407 | InitialLaunchFlag flags; | 407 | InitialLaunchFlag flags; |
| 408 | Service::Time::Clock::SteadyClockTimePoint timestamp; | 408 | Service::PSC::Time::SteadyClockTimePoint timestamp; |
| 409 | }; | 409 | }; |
| 410 | #pragma pack(pop) | 410 | #pragma pack(pop) |
| 411 | static_assert(sizeof(InitialLaunchSettingsPacked) == 0x1C, | 411 | static_assert(sizeof(InitialLaunchSettingsPacked) == 0x1C, |
diff --git a/src/core/hle/service/set/system_settings_server.cpp b/src/core/hle/service/set/system_settings_server.cpp index 87242ae68..688c54b58 100644 --- a/src/core/hle/service/set/system_settings_server.cpp +++ b/src/core/hle/service/set/system_settings_server.cpp | |||
| @@ -489,11 +489,10 @@ void ISystemSettingsServer::SetExternalSteadyClockSourceId(HLERequestContext& ct | |||
| 489 | void ISystemSettingsServer::GetUserSystemClockContext(HLERequestContext& ctx) { | 489 | void ISystemSettingsServer::GetUserSystemClockContext(HLERequestContext& ctx) { |
| 490 | LOG_INFO(Service_SET, "called"); | 490 | LOG_INFO(Service_SET, "called"); |
| 491 | 491 | ||
| 492 | Service::Time::Clock::SystemClockContext context{}; | 492 | Service::PSC::Time::SystemClockContext context{}; |
| 493 | auto res = GetUserSystemClockContext(context); | 493 | auto res = GetUserSystemClockContext(context); |
| 494 | 494 | ||
| 495 | IPC::ResponseBuilder rb{ctx, | 495 | IPC::ResponseBuilder rb{ctx, 2 + sizeof(Service::PSC::Time::SystemClockContext) / sizeof(u32)}; |
| 496 | 2 + sizeof(Service::Time::Clock::SystemClockContext) / sizeof(u32)}; | ||
| 497 | rb.Push(res); | 496 | rb.Push(res); |
| 498 | rb.PushRaw(context); | 497 | rb.PushRaw(context); |
| 499 | } | 498 | } |
| @@ -502,7 +501,7 @@ void ISystemSettingsServer::SetUserSystemClockContext(HLERequestContext& ctx) { | |||
| 502 | LOG_INFO(Service_SET, "called"); | 501 | LOG_INFO(Service_SET, "called"); |
| 503 | 502 | ||
| 504 | IPC::RequestParser rp{ctx}; | 503 | IPC::RequestParser rp{ctx}; |
| 505 | auto context{rp.PopRaw<Service::Time::Clock::SystemClockContext>()}; | 504 | auto context{rp.PopRaw<Service::PSC::Time::SystemClockContext>()}; |
| 506 | 505 | ||
| 507 | auto res = SetUserSystemClockContext(context); | 506 | auto res = SetUserSystemClockContext(context); |
| 508 | 507 | ||
| @@ -809,19 +808,19 @@ void ISystemSettingsServer::GetQuestFlag(HLERequestContext& ctx) { | |||
| 809 | void ISystemSettingsServer::GetDeviceTimeZoneLocationName(HLERequestContext& ctx) { | 808 | void ISystemSettingsServer::GetDeviceTimeZoneLocationName(HLERequestContext& ctx) { |
| 810 | LOG_INFO(Service_SET, "called"); | 809 | LOG_INFO(Service_SET, "called"); |
| 811 | 810 | ||
| 812 | Service::Time::TimeZone::LocationName name{}; | 811 | Service::PSC::Time::LocationName name{}; |
| 813 | auto res = GetDeviceTimeZoneLocationName(name); | 812 | auto res = GetDeviceTimeZoneLocationName(name); |
| 814 | 813 | ||
| 815 | IPC::ResponseBuilder rb{ctx, 2 + sizeof(Service::Time::TimeZone::LocationName) / sizeof(u32)}; | 814 | IPC::ResponseBuilder rb{ctx, 2 + sizeof(Service::PSC::Time::LocationName) / sizeof(u32)}; |
| 816 | rb.Push(res); | 815 | rb.Push(res); |
| 817 | rb.PushRaw<Service::Time::TimeZone::LocationName>(name); | 816 | rb.PushRaw<Service::PSC::Time::LocationName>(name); |
| 818 | } | 817 | } |
| 819 | 818 | ||
| 820 | void ISystemSettingsServer::SetDeviceTimeZoneLocationName(HLERequestContext& ctx) { | 819 | void ISystemSettingsServer::SetDeviceTimeZoneLocationName(HLERequestContext& ctx) { |
| 821 | LOG_INFO(Service_SET, "called"); | 820 | LOG_INFO(Service_SET, "called"); |
| 822 | 821 | ||
| 823 | IPC::RequestParser rp{ctx}; | 822 | IPC::RequestParser rp{ctx}; |
| 824 | auto name{rp.PopRaw<Service::Time::TimeZone::LocationName>()}; | 823 | auto name{rp.PopRaw<Service::PSC::Time::LocationName>()}; |
| 825 | 824 | ||
| 826 | auto res = SetDeviceTimeZoneLocationName(name); | 825 | auto res = SetDeviceTimeZoneLocationName(name); |
| 827 | 826 | ||
| @@ -843,11 +842,10 @@ void ISystemSettingsServer::SetRegionCode(HLERequestContext& ctx) { | |||
| 843 | void ISystemSettingsServer::GetNetworkSystemClockContext(HLERequestContext& ctx) { | 842 | void ISystemSettingsServer::GetNetworkSystemClockContext(HLERequestContext& ctx) { |
| 844 | LOG_INFO(Service_SET, "called"); | 843 | LOG_INFO(Service_SET, "called"); |
| 845 | 844 | ||
| 846 | Service::Time::Clock::SystemClockContext context{}; | 845 | Service::PSC::Time::SystemClockContext context{}; |
| 847 | auto res = GetNetworkSystemClockContext(context); | 846 | auto res = GetNetworkSystemClockContext(context); |
| 848 | 847 | ||
| 849 | IPC::ResponseBuilder rb{ctx, | 848 | IPC::ResponseBuilder rb{ctx, 2 + sizeof(Service::PSC::Time::SystemClockContext) / sizeof(u32)}; |
| 850 | 2 + sizeof(Service::Time::Clock::SystemClockContext) / sizeof(u32)}; | ||
| 851 | rb.Push(res); | 849 | rb.Push(res); |
| 852 | rb.PushRaw(context); | 850 | rb.PushRaw(context); |
| 853 | } | 851 | } |
| @@ -856,7 +854,7 @@ void ISystemSettingsServer::SetNetworkSystemClockContext(HLERequestContext& ctx) | |||
| 856 | LOG_INFO(Service_SET, "called"); | 854 | LOG_INFO(Service_SET, "called"); |
| 857 | 855 | ||
| 858 | IPC::RequestParser rp{ctx}; | 856 | IPC::RequestParser rp{ctx}; |
| 859 | auto context{rp.PopRaw<Service::Time::Clock::SystemClockContext>()}; | 857 | auto context{rp.PopRaw<Service::PSC::Time::SystemClockContext>()}; |
| 860 | 858 | ||
| 861 | auto res = SetNetworkSystemClockContext(context); | 859 | auto res = SetNetworkSystemClockContext(context); |
| 862 | 860 | ||
| @@ -1136,19 +1134,19 @@ void ISystemSettingsServer::GetKeyboardLayout(HLERequestContext& ctx) { | |||
| 1136 | void ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) { | 1134 | void ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) { |
| 1137 | LOG_INFO(Service_SET, "called"); | 1135 | LOG_INFO(Service_SET, "called"); |
| 1138 | 1136 | ||
| 1139 | Service::Time::Clock::SteadyClockTimePoint time_point{}; | 1137 | Service::PSC::Time::SteadyClockTimePoint time_point{}; |
| 1140 | auto res = GetDeviceTimeZoneLocationUpdatedTime(time_point); | 1138 | auto res = GetDeviceTimeZoneLocationUpdatedTime(time_point); |
| 1141 | 1139 | ||
| 1142 | IPC::ResponseBuilder rb{ctx, 4}; | 1140 | IPC::ResponseBuilder rb{ctx, 4}; |
| 1143 | rb.Push(res); | 1141 | rb.Push(res); |
| 1144 | rb.PushRaw<Service::Time::Clock::SteadyClockTimePoint>(time_point); | 1142 | rb.PushRaw<Service::PSC::Time::SteadyClockTimePoint>(time_point); |
| 1145 | } | 1143 | } |
| 1146 | 1144 | ||
| 1147 | void ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) { | 1145 | void ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) { |
| 1148 | LOG_INFO(Service_SET, "called"); | 1146 | LOG_INFO(Service_SET, "called"); |
| 1149 | 1147 | ||
| 1150 | IPC::RequestParser rp{ctx}; | 1148 | IPC::RequestParser rp{ctx}; |
| 1151 | auto time_point{rp.PopRaw<Service::Time::Clock::SteadyClockTimePoint>()}; | 1149 | auto time_point{rp.PopRaw<Service::PSC::Time::SteadyClockTimePoint>()}; |
| 1152 | 1150 | ||
| 1153 | auto res = SetDeviceTimeZoneLocationUpdatedTime(time_point); | 1151 | auto res = SetDeviceTimeZoneLocationUpdatedTime(time_point); |
| 1154 | 1152 | ||
| @@ -1160,12 +1158,12 @@ void ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime( | |||
| 1160 | HLERequestContext& ctx) { | 1158 | HLERequestContext& ctx) { |
| 1161 | LOG_INFO(Service_SET, "called"); | 1159 | LOG_INFO(Service_SET, "called"); |
| 1162 | 1160 | ||
| 1163 | Service::Time::Clock::SteadyClockTimePoint time_point{}; | 1161 | Service::PSC::Time::SteadyClockTimePoint time_point{}; |
| 1164 | auto res = GetUserSystemClockAutomaticCorrectionUpdatedTime(time_point); | 1162 | auto res = GetUserSystemClockAutomaticCorrectionUpdatedTime(time_point); |
| 1165 | 1163 | ||
| 1166 | IPC::ResponseBuilder rb{ctx, 4}; | 1164 | IPC::ResponseBuilder rb{ctx, 4}; |
| 1167 | rb.Push(res); | 1165 | rb.Push(res); |
| 1168 | rb.PushRaw<Service::Time::Clock::SteadyClockTimePoint>(time_point); | 1166 | rb.PushRaw<Service::PSC::Time::SteadyClockTimePoint>(time_point); |
| 1169 | } | 1167 | } |
| 1170 | 1168 | ||
| 1171 | void ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime( | 1169 | void ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime( |
| @@ -1173,7 +1171,7 @@ void ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime( | |||
| 1173 | LOG_INFO(Service_SET, "called"); | 1171 | LOG_INFO(Service_SET, "called"); |
| 1174 | 1172 | ||
| 1175 | IPC::RequestParser rp{ctx}; | 1173 | IPC::RequestParser rp{ctx}; |
| 1176 | auto time_point{rp.PopRaw<Service::Time::Clock::SteadyClockTimePoint>()}; | 1174 | auto time_point{rp.PopRaw<Service::PSC::Time::SteadyClockTimePoint>()}; |
| 1177 | 1175 | ||
| 1178 | auto res = SetUserSystemClockAutomaticCorrectionUpdatedTime(time_point); | 1176 | auto res = SetUserSystemClockAutomaticCorrectionUpdatedTime(time_point); |
| 1179 | 1177 | ||
| @@ -1252,25 +1250,25 @@ void ISystemSettingsServer::StoreSettings() { | |||
| 1252 | auto system_dir = | 1250 | auto system_dir = |
| 1253 | Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/8000000000000050"; | 1251 | Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/8000000000000050"; |
| 1254 | if (!StoreSettingsFile(system_dir, m_system_settings)) { | 1252 | if (!StoreSettingsFile(system_dir, m_system_settings)) { |
| 1255 | LOG_ERROR(HW_GPU, "Failed to store System settings"); | 1253 | LOG_ERROR(Service_SET, "Failed to store System settings"); |
| 1256 | } | 1254 | } |
| 1257 | 1255 | ||
| 1258 | auto private_dir = | 1256 | auto private_dir = |
| 1259 | Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/8000000000000052"; | 1257 | Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/8000000000000052"; |
| 1260 | if (!StoreSettingsFile(private_dir, m_private_settings)) { | 1258 | if (!StoreSettingsFile(private_dir, m_private_settings)) { |
| 1261 | LOG_ERROR(HW_GPU, "Failed to store Private settings"); | 1259 | LOG_ERROR(Service_SET, "Failed to store Private settings"); |
| 1262 | } | 1260 | } |
| 1263 | 1261 | ||
| 1264 | auto device_dir = | 1262 | auto device_dir = |
| 1265 | Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/8000000000000053"; | 1263 | Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/8000000000000053"; |
| 1266 | if (!StoreSettingsFile(device_dir, m_device_settings)) { | 1264 | if (!StoreSettingsFile(device_dir, m_device_settings)) { |
| 1267 | LOG_ERROR(HW_GPU, "Failed to store Device settings"); | 1265 | LOG_ERROR(Service_SET, "Failed to store Device settings"); |
| 1268 | } | 1266 | } |
| 1269 | 1267 | ||
| 1270 | auto appln_dir = | 1268 | auto appln_dir = |
| 1271 | Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/8000000000000054"; | 1269 | Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/8000000000000054"; |
| 1272 | if (!StoreSettingsFile(appln_dir, m_appln_settings)) { | 1270 | if (!StoreSettingsFile(appln_dir, m_appln_settings)) { |
| 1273 | LOG_ERROR(HW_GPU, "Failed to store ApplLn settings"); | 1271 | LOG_ERROR(Service_SET, "Failed to store ApplLn settings"); |
| 1274 | } | 1272 | } |
| 1275 | } | 1273 | } |
| 1276 | 1274 | ||
| @@ -1313,39 +1311,39 @@ Result ISystemSettingsServer::SetExternalSteadyClockSourceId(Common::UUID id) { | |||
| 1313 | } | 1311 | } |
| 1314 | 1312 | ||
| 1315 | Result ISystemSettingsServer::GetUserSystemClockContext( | 1313 | Result ISystemSettingsServer::GetUserSystemClockContext( |
| 1316 | Service::Time::Clock::SystemClockContext& out_context) { | 1314 | Service::PSC::Time::SystemClockContext& out_context) { |
| 1317 | out_context = m_system_settings.user_system_clock_context; | 1315 | out_context = m_system_settings.user_system_clock_context; |
| 1318 | R_SUCCEED(); | 1316 | R_SUCCEED(); |
| 1319 | } | 1317 | } |
| 1320 | 1318 | ||
| 1321 | Result ISystemSettingsServer::SetUserSystemClockContext( | 1319 | Result ISystemSettingsServer::SetUserSystemClockContext( |
| 1322 | Service::Time::Clock::SystemClockContext& context) { | 1320 | Service::PSC::Time::SystemClockContext& context) { |
| 1323 | m_system_settings.user_system_clock_context = context; | 1321 | m_system_settings.user_system_clock_context = context; |
| 1324 | SetSaveNeeded(); | 1322 | SetSaveNeeded(); |
| 1325 | R_SUCCEED(); | 1323 | R_SUCCEED(); |
| 1326 | } | 1324 | } |
| 1327 | 1325 | ||
| 1328 | Result ISystemSettingsServer::GetDeviceTimeZoneLocationName( | 1326 | Result ISystemSettingsServer::GetDeviceTimeZoneLocationName( |
| 1329 | Service::Time::TimeZone::LocationName& out_name) { | 1327 | Service::PSC::Time::LocationName& out_name) { |
| 1330 | out_name = m_system_settings.device_time_zone_location_name; | 1328 | out_name = m_system_settings.device_time_zone_location_name; |
| 1331 | R_SUCCEED(); | 1329 | R_SUCCEED(); |
| 1332 | } | 1330 | } |
| 1333 | 1331 | ||
| 1334 | Result ISystemSettingsServer::SetDeviceTimeZoneLocationName( | 1332 | Result ISystemSettingsServer::SetDeviceTimeZoneLocationName( |
| 1335 | Service::Time::TimeZone::LocationName& name) { | 1333 | Service::PSC::Time::LocationName& name) { |
| 1336 | m_system_settings.device_time_zone_location_name = name; | 1334 | m_system_settings.device_time_zone_location_name = name; |
| 1337 | SetSaveNeeded(); | 1335 | SetSaveNeeded(); |
| 1338 | R_SUCCEED(); | 1336 | R_SUCCEED(); |
| 1339 | } | 1337 | } |
| 1340 | 1338 | ||
| 1341 | Result ISystemSettingsServer::GetNetworkSystemClockContext( | 1339 | Result ISystemSettingsServer::GetNetworkSystemClockContext( |
| 1342 | Service::Time::Clock::SystemClockContext& out_context) { | 1340 | Service::PSC::Time::SystemClockContext& out_context) { |
| 1343 | out_context = m_system_settings.network_system_clock_context; | 1341 | out_context = m_system_settings.network_system_clock_context; |
| 1344 | R_SUCCEED(); | 1342 | R_SUCCEED(); |
| 1345 | } | 1343 | } |
| 1346 | 1344 | ||
| 1347 | Result ISystemSettingsServer::SetNetworkSystemClockContext( | 1345 | Result ISystemSettingsServer::SetNetworkSystemClockContext( |
| 1348 | Service::Time::Clock::SystemClockContext& context) { | 1346 | Service::PSC::Time::SystemClockContext& context) { |
| 1349 | m_system_settings.network_system_clock_context = context; | 1347 | m_system_settings.network_system_clock_context = context; |
| 1350 | SetSaveNeeded(); | 1348 | SetSaveNeeded(); |
| 1351 | R_SUCCEED(); | 1349 | R_SUCCEED(); |
| @@ -1374,26 +1372,26 @@ Result ISystemSettingsServer::GetExternalSteadyClockInternalOffset(s64& out_offs | |||
| 1374 | } | 1372 | } |
| 1375 | 1373 | ||
| 1376 | Result ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime( | 1374 | Result ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime( |
| 1377 | Service::Time::Clock::SteadyClockTimePoint& out_time_point) { | 1375 | Service::PSC::Time::SteadyClockTimePoint& out_time_point) { |
| 1378 | out_time_point = m_system_settings.device_time_zone_location_updated_time; | 1376 | out_time_point = m_system_settings.device_time_zone_location_updated_time; |
| 1379 | R_SUCCEED(); | 1377 | R_SUCCEED(); |
| 1380 | } | 1378 | } |
| 1381 | 1379 | ||
| 1382 | Result ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime( | 1380 | Result ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime( |
| 1383 | Service::Time::Clock::SteadyClockTimePoint& time_point) { | 1381 | Service::PSC::Time::SteadyClockTimePoint& time_point) { |
| 1384 | m_system_settings.device_time_zone_location_updated_time = time_point; | 1382 | m_system_settings.device_time_zone_location_updated_time = time_point; |
| 1385 | SetSaveNeeded(); | 1383 | SetSaveNeeded(); |
| 1386 | R_SUCCEED(); | 1384 | R_SUCCEED(); |
| 1387 | } | 1385 | } |
| 1388 | 1386 | ||
| 1389 | Result ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime( | 1387 | Result ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime( |
| 1390 | Service::Time::Clock::SteadyClockTimePoint& out_time_point) { | 1388 | Service::PSC::Time::SteadyClockTimePoint& out_time_point) { |
| 1391 | out_time_point = m_system_settings.user_system_clock_automatic_correction_updated_time_point; | 1389 | out_time_point = m_system_settings.user_system_clock_automatic_correction_updated_time_point; |
| 1392 | R_SUCCEED(); | 1390 | R_SUCCEED(); |
| 1393 | } | 1391 | } |
| 1394 | 1392 | ||
| 1395 | Result ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime( | 1393 | Result ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime( |
| 1396 | Service::Time::Clock::SteadyClockTimePoint out_time_point) { | 1394 | Service::PSC::Time::SteadyClockTimePoint out_time_point) { |
| 1397 | m_system_settings.user_system_clock_automatic_correction_updated_time_point = out_time_point; | 1395 | m_system_settings.user_system_clock_automatic_correction_updated_time_point = out_time_point; |
| 1398 | SetSaveNeeded(); | 1396 | SetSaveNeeded(); |
| 1399 | R_SUCCEED(); | 1397 | R_SUCCEED(); |
diff --git a/src/core/hle/service/set/system_settings_server.h b/src/core/hle/service/set/system_settings_server.h index 32716f567..a2258d16d 100644 --- a/src/core/hle/service/set/system_settings_server.h +++ b/src/core/hle/service/set/system_settings_server.h | |||
| @@ -11,14 +11,13 @@ | |||
| 11 | #include "common/polyfill_thread.h" | 11 | #include "common/polyfill_thread.h" |
| 12 | #include "common/uuid.h" | 12 | #include "common/uuid.h" |
| 13 | #include "core/hle/result.h" | 13 | #include "core/hle/result.h" |
| 14 | #include "core/hle/service/psc/time/common.h" | ||
| 14 | #include "core/hle/service/service.h" | 15 | #include "core/hle/service/service.h" |
| 15 | #include "core/hle/service/set/setting_formats/appln_settings.h" | 16 | #include "core/hle/service/set/setting_formats/appln_settings.h" |
| 16 | #include "core/hle/service/set/setting_formats/device_settings.h" | 17 | #include "core/hle/service/set/setting_formats/device_settings.h" |
| 17 | #include "core/hle/service/set/setting_formats/private_settings.h" | 18 | #include "core/hle/service/set/setting_formats/private_settings.h" |
| 18 | #include "core/hle/service/set/setting_formats/system_settings.h" | 19 | #include "core/hle/service/set/setting_formats/system_settings.h" |
| 19 | #include "core/hle/service/set/settings_types.h" | 20 | #include "core/hle/service/set/settings_types.h" |
| 20 | #include "core/hle/service/time/clock_types.h" | ||
| 21 | #include "core/hle/service/time/time_zone_types.h" | ||
| 22 | 21 | ||
| 23 | namespace Core { | 22 | namespace Core { |
| 24 | class System; | 23 | class System; |
| @@ -51,24 +50,24 @@ public: | |||
| 51 | 50 | ||
| 52 | Result GetExternalSteadyClockSourceId(Common::UUID& out_id); | 51 | Result GetExternalSteadyClockSourceId(Common::UUID& out_id); |
| 53 | Result SetExternalSteadyClockSourceId(Common::UUID id); | 52 | Result SetExternalSteadyClockSourceId(Common::UUID id); |
| 54 | Result GetUserSystemClockContext(Service::Time::Clock::SystemClockContext& out_context); | 53 | Result GetUserSystemClockContext(Service::PSC::Time::SystemClockContext& out_context); |
| 55 | Result SetUserSystemClockContext(Service::Time::Clock::SystemClockContext& context); | 54 | Result SetUserSystemClockContext(Service::PSC::Time::SystemClockContext& context); |
| 56 | Result GetDeviceTimeZoneLocationName(Service::Time::TimeZone::LocationName& out_name); | 55 | Result GetDeviceTimeZoneLocationName(Service::PSC::Time::LocationName& out_name); |
| 57 | Result SetDeviceTimeZoneLocationName(Service::Time::TimeZone::LocationName& name); | 56 | Result SetDeviceTimeZoneLocationName(Service::PSC::Time::LocationName& name); |
| 58 | Result GetNetworkSystemClockContext(Service::Time::Clock::SystemClockContext& out_context); | 57 | Result GetNetworkSystemClockContext(Service::PSC::Time::SystemClockContext& out_context); |
| 59 | Result SetNetworkSystemClockContext(Service::Time::Clock::SystemClockContext& context); | 58 | Result SetNetworkSystemClockContext(Service::PSC::Time::SystemClockContext& context); |
| 60 | Result IsUserSystemClockAutomaticCorrectionEnabled(bool& out_enabled); | 59 | Result IsUserSystemClockAutomaticCorrectionEnabled(bool& out_enabled); |
| 61 | Result SetUserSystemClockAutomaticCorrectionEnabled(bool enabled); | 60 | Result SetUserSystemClockAutomaticCorrectionEnabled(bool enabled); |
| 62 | Result SetExternalSteadyClockInternalOffset(s64 offset); | 61 | Result SetExternalSteadyClockInternalOffset(s64 offset); |
| 63 | Result GetExternalSteadyClockInternalOffset(s64& out_offset); | 62 | Result GetExternalSteadyClockInternalOffset(s64& out_offset); |
| 64 | Result GetDeviceTimeZoneLocationUpdatedTime( | 63 | Result GetDeviceTimeZoneLocationUpdatedTime( |
| 65 | Service::Time::Clock::SteadyClockTimePoint& out_time_point); | 64 | Service::PSC::Time::SteadyClockTimePoint& out_time_point); |
| 66 | Result SetDeviceTimeZoneLocationUpdatedTime( | 65 | Result SetDeviceTimeZoneLocationUpdatedTime( |
| 67 | Service::Time::Clock::SteadyClockTimePoint& time_point); | 66 | Service::PSC::Time::SteadyClockTimePoint& time_point); |
| 68 | Result GetUserSystemClockAutomaticCorrectionUpdatedTime( | 67 | Result GetUserSystemClockAutomaticCorrectionUpdatedTime( |
| 69 | Service::Time::Clock::SteadyClockTimePoint& out_time_point); | 68 | Service::PSC::Time::SteadyClockTimePoint& out_time_point); |
| 70 | Result SetUserSystemClockAutomaticCorrectionUpdatedTime( | 69 | Result SetUserSystemClockAutomaticCorrectionUpdatedTime( |
| 71 | Service::Time::Clock::SteadyClockTimePoint time_point); | 70 | Service::PSC::Time::SteadyClockTimePoint time_point); |
| 72 | 71 | ||
| 73 | private: | 72 | private: |
| 74 | void SetLanguageCode(HLERequestContext& ctx); | 73 | void SetLanguageCode(HLERequestContext& ctx); |
| @@ -147,8 +146,8 @@ private: | |||
| 147 | PrivateSettings m_private_settings{}; | 146 | PrivateSettings m_private_settings{}; |
| 148 | DeviceSettings m_device_settings{}; | 147 | DeviceSettings m_device_settings{}; |
| 149 | ApplnSettings m_appln_settings{}; | 148 | ApplnSettings m_appln_settings{}; |
| 150 | std::jthread m_save_thread; | ||
| 151 | std::mutex m_save_needed_mutex; | 149 | std::mutex m_save_needed_mutex; |
| 150 | std::jthread m_save_thread; | ||
| 152 | bool m_save_needed{false}; | 151 | bool m_save_needed{false}; |
| 153 | }; | 152 | }; |
| 154 | 153 | ||