diff options
| author | 2024-01-30 19:08:47 +0000 | |
|---|---|---|
| committer | 2024-01-31 01:41:59 +0000 | |
| commit | 9ed82a280e8f22dbd119b4b7becd3582b50f3ffa (patch) | |
| tree | 723a135615c95aeee9a775742466eab86f54ce82 | |
| parent | Merge pull request #12856 from liamwhite/serialization (diff) | |
| download | yuzu-9ed82a280e8f22dbd119b4b7becd3582b50f3ffa.tar.gz yuzu-9ed82a280e8f22dbd119b4b7becd3582b50f3ffa.tar.xz yuzu-9ed82a280e8f22dbd119b4b7becd3582b50f3ffa.zip | |
Remove a few hacks for clock setups, which seem to no longer be needed, but fix network clock to local clock on every boot. Also fix some logging strings.
| -rw-r--r-- | src/core/hle/service/glue/time/time_zone.cpp | 27 | ||||
| -rw-r--r-- | src/core/hle/service/glue/time/time_zone.h | 6 | ||||
| -rw-r--r-- | src/core/hle/service/psc/time/common.h | 24 | ||||
| -rw-r--r-- | src/core/hle/service/psc/time/service_manager.cpp | 14 | ||||
| -rw-r--r-- | src/core/hle/service/psc/time/time_zone.cpp | 41 | ||||
| -rw-r--r-- | src/core/hle/service/psc/time/time_zone.h | 12 | ||||
| -rw-r--r-- | src/core/hle/service/psc/time/time_zone_service.cpp | 20 | ||||
| -rw-r--r-- | src/core/hle/service/psc/time/time_zone_service.h | 4 | ||||
| -rw-r--r-- | src/core/hle/service/set/system_settings_server.cpp | 2 |
9 files changed, 66 insertions, 84 deletions
diff --git a/src/core/hle/service/glue/time/time_zone.cpp b/src/core/hle/service/glue/time/time_zone.cpp index 5dc1187cb..98d928697 100644 --- a/src/core/hle/service/glue/time/time_zone.cpp +++ b/src/core/hle/service/glue/time/time_zone.cpp | |||
| @@ -197,32 +197,27 @@ Result TimeZoneService::ToCalendarTimeWithMyRule( | |||
| 197 | 197 | ||
| 198 | Result TimeZoneService::ToPosixTime(Out<u32> out_count, | 198 | Result TimeZoneService::ToPosixTime(Out<u32> out_count, |
| 199 | OutArray<s64, BufferAttr_HipcPointer> out_times, | 199 | OutArray<s64, BufferAttr_HipcPointer> out_times, |
| 200 | Out<u32> out_times_count, | 200 | const Service::PSC::Time::CalendarTime& calendar_time, |
| 201 | Service::PSC::Time::CalendarTime& calendar_time, InRule rule) { | 201 | InRule rule) { |
| 202 | SCOPE_EXIT({ | 202 | SCOPE_EXIT({ |
| 203 | LOG_DEBUG(Service_Time, | 203 | LOG_DEBUG(Service_Time, |
| 204 | "called. calendar_time={} out_count={} out_times[0]={} out_times[1]={} " | 204 | "called. calendar_time={} out_count={} out_times[0]={} out_times[1]={}", |
| 205 | "out_times_count={}", | 205 | calendar_time, *out_count, out_times[0], out_times[1]); |
| 206 | calendar_time, *out_count, out_times[0], out_times[1], *out_times_count); | ||
| 207 | }); | 206 | }); |
| 208 | 207 | ||
| 209 | R_RETURN( | 208 | R_RETURN(m_wrapped_service->ToPosixTime(out_count, out_times, calendar_time, rule)); |
| 210 | m_wrapped_service->ToPosixTime(out_count, out_times, out_times_count, calendar_time, rule)); | ||
| 211 | } | 209 | } |
| 212 | 210 | ||
| 213 | Result TimeZoneService::ToPosixTimeWithMyRule(Out<u32> out_count, | 211 | Result TimeZoneService::ToPosixTimeWithMyRule( |
| 214 | OutArray<s64, BufferAttr_HipcPointer> out_times, | 212 | Out<u32> out_count, OutArray<s64, BufferAttr_HipcPointer> out_times, |
| 215 | Out<u32> out_times_count, | 213 | const Service::PSC::Time::CalendarTime& calendar_time) { |
| 216 | Service::PSC::Time::CalendarTime& calendar_time) { | ||
| 217 | SCOPE_EXIT({ | 214 | SCOPE_EXIT({ |
| 218 | LOG_DEBUG(Service_Time, | 215 | LOG_DEBUG(Service_Time, |
| 219 | "called. calendar_time={} out_count={} out_times[0]={} out_times[1]={} " | 216 | "called. calendar_time={} out_count={} out_times[0]={} out_times[1]={}", |
| 220 | "out_times_count={}", | 217 | calendar_time, *out_count, out_times[0], out_times[1]); |
| 221 | calendar_time, *out_count, out_times[0], out_times[1], *out_times_count); | ||
| 222 | }); | 218 | }); |
| 223 | 219 | ||
| 224 | R_RETURN(m_wrapped_service->ToPosixTimeWithMyRule(out_count, out_times, out_times_count, | 220 | R_RETURN(m_wrapped_service->ToPosixTimeWithMyRule(out_count, out_times, calendar_time)); |
| 225 | calendar_time)); | ||
| 226 | } | 221 | } |
| 227 | 222 | ||
| 228 | } // namespace Service::Glue::Time | 223 | } // namespace Service::Glue::Time |
diff --git a/src/core/hle/service/glue/time/time_zone.h b/src/core/hle/service/glue/time/time_zone.h index bf12adbdc..9c1530966 100644 --- a/src/core/hle/service/glue/time/time_zone.h +++ b/src/core/hle/service/glue/time/time_zone.h | |||
| @@ -68,12 +68,10 @@ public: | |||
| 68 | Out<Service::PSC::Time::CalendarTime> out_calendar_time, | 68 | Out<Service::PSC::Time::CalendarTime> out_calendar_time, |
| 69 | Out<Service::PSC::Time::CalendarAdditionalInfo> out_additional_info, s64 time); | 69 | Out<Service::PSC::Time::CalendarAdditionalInfo> out_additional_info, s64 time); |
| 70 | Result ToPosixTime(Out<u32> out_count, OutArray<s64, BufferAttr_HipcPointer> out_times, | 70 | Result ToPosixTime(Out<u32> out_count, OutArray<s64, BufferAttr_HipcPointer> out_times, |
| 71 | Out<u32> out_times_count, Service::PSC::Time::CalendarTime& calendar_time, | 71 | const Service::PSC::Time::CalendarTime& calendar_time, InRule rule); |
| 72 | InRule rule); | ||
| 73 | Result ToPosixTimeWithMyRule(Out<u32> out_count, | 72 | Result ToPosixTimeWithMyRule(Out<u32> out_count, |
| 74 | OutArray<s64, BufferAttr_HipcPointer> out_times, | 73 | OutArray<s64, BufferAttr_HipcPointer> out_times, |
| 75 | Out<u32> out_times_count, | 74 | const Service::PSC::Time::CalendarTime& calendar_time); |
| 76 | Service::PSC::Time::CalendarTime& calendar_time); | ||
| 77 | 75 | ||
| 78 | private: | 76 | private: |
| 79 | Core::System& m_system; | 77 | Core::System& m_system; |
diff --git a/src/core/hle/service/psc/time/common.h b/src/core/hle/service/psc/time/common.h index 596828b8b..3e13144a0 100644 --- a/src/core/hle/service/psc/time/common.h +++ b/src/core/hle/service/psc/time/common.h | |||
| @@ -189,7 +189,7 @@ struct fmt::formatter<Service::PSC::Time::SteadyClockTimePoint> : fmt::formatter | |||
| 189 | template <typename FormatContext> | 189 | template <typename FormatContext> |
| 190 | auto format(const Service::PSC::Time::SteadyClockTimePoint& time_point, | 190 | auto format(const Service::PSC::Time::SteadyClockTimePoint& time_point, |
| 191 | FormatContext& ctx) const { | 191 | FormatContext& ctx) const { |
| 192 | return fmt::format_to(ctx.out(), "time_point={}", time_point.time_point); | 192 | return fmt::format_to(ctx.out(), "[time_point={}]", time_point.time_point); |
| 193 | } | 193 | } |
| 194 | }; | 194 | }; |
| 195 | 195 | ||
| @@ -197,7 +197,7 @@ template <> | |||
| 197 | struct fmt::formatter<Service::PSC::Time::SystemClockContext> : fmt::formatter<fmt::string_view> { | 197 | struct fmt::formatter<Service::PSC::Time::SystemClockContext> : fmt::formatter<fmt::string_view> { |
| 198 | template <typename FormatContext> | 198 | template <typename FormatContext> |
| 199 | auto format(const Service::PSC::Time::SystemClockContext& context, FormatContext& ctx) const { | 199 | auto format(const Service::PSC::Time::SystemClockContext& context, FormatContext& ctx) const { |
| 200 | return fmt::format_to(ctx.out(), "offset={} steady_time_point={}", context.offset, | 200 | return fmt::format_to(ctx.out(), "[offset={} steady_time_point={}]", context.offset, |
| 201 | context.steady_time_point.time_point); | 201 | context.steady_time_point.time_point); |
| 202 | } | 202 | } |
| 203 | }; | 203 | }; |
| @@ -206,8 +206,9 @@ template <> | |||
| 206 | struct fmt::formatter<Service::PSC::Time::CalendarTime> : fmt::formatter<fmt::string_view> { | 206 | struct fmt::formatter<Service::PSC::Time::CalendarTime> : fmt::formatter<fmt::string_view> { |
| 207 | template <typename FormatContext> | 207 | template <typename FormatContext> |
| 208 | auto format(const Service::PSC::Time::CalendarTime& calendar, FormatContext& ctx) const { | 208 | auto format(const Service::PSC::Time::CalendarTime& calendar, FormatContext& ctx) const { |
| 209 | return fmt::format_to(ctx.out(), "{}/{}/{} {}:{}:{}", calendar.day, calendar.month, | 209 | return fmt::format_to(ctx.out(), "[{:02}/{:02}/{:04} {:02}:{:02}:{:02}]", calendar.day, |
| 210 | calendar.year, calendar.hour, calendar.minute, calendar.second); | 210 | calendar.month, calendar.year, calendar.hour, calendar.minute, |
| 211 | calendar.second); | ||
| 211 | } | 212 | } |
| 212 | }; | 213 | }; |
| 213 | 214 | ||
| @@ -217,7 +218,7 @@ struct fmt::formatter<Service::PSC::Time::CalendarAdditionalInfo> | |||
| 217 | template <typename FormatContext> | 218 | template <typename FormatContext> |
| 218 | auto format(const Service::PSC::Time::CalendarAdditionalInfo& additional, | 219 | auto format(const Service::PSC::Time::CalendarAdditionalInfo& additional, |
| 219 | FormatContext& ctx) const { | 220 | FormatContext& ctx) const { |
| 220 | return fmt::format_to(ctx.out(), "weekday={} yearday={} name={} is_dst={} ut_offset={}", | 221 | return fmt::format_to(ctx.out(), "[weekday={} yearday={} name={} is_dst={} ut_offset={}]", |
| 221 | additional.day_of_week, additional.day_of_year, | 222 | additional.day_of_week, additional.day_of_year, |
| 222 | additional.name.data(), additional.is_dst, additional.ut_offset); | 223 | additional.name.data(), additional.is_dst, additional.ut_offset); |
| 223 | } | 224 | } |
| @@ -227,8 +228,7 @@ template <> | |||
| 227 | struct fmt::formatter<Service::PSC::Time::LocationName> : fmt::formatter<fmt::string_view> { | 228 | struct fmt::formatter<Service::PSC::Time::LocationName> : fmt::formatter<fmt::string_view> { |
| 228 | template <typename FormatContext> | 229 | template <typename FormatContext> |
| 229 | auto format(const Service::PSC::Time::LocationName& name, FormatContext& ctx) const { | 230 | auto format(const Service::PSC::Time::LocationName& name, FormatContext& ctx) const { |
| 230 | std::string_view n{name.data(), name.size()}; | 231 | return formatter<string_view>::format(name.data(), ctx); |
| 231 | return formatter<string_view>::format(n, ctx); | ||
| 232 | } | 232 | } |
| 233 | }; | 233 | }; |
| 234 | 234 | ||
| @@ -236,8 +236,7 @@ template <> | |||
| 236 | struct fmt::formatter<Service::PSC::Time::RuleVersion> : fmt::formatter<fmt::string_view> { | 236 | struct fmt::formatter<Service::PSC::Time::RuleVersion> : fmt::formatter<fmt::string_view> { |
| 237 | template <typename FormatContext> | 237 | template <typename FormatContext> |
| 238 | auto format(const Service::PSC::Time::RuleVersion& version, FormatContext& ctx) const { | 238 | auto format(const Service::PSC::Time::RuleVersion& version, FormatContext& ctx) const { |
| 239 | std::string_view v{version.data(), version.size()}; | 239 | return formatter<string_view>::format(version.data(), ctx); |
| 240 | return formatter<string_view>::format(v, ctx); | ||
| 241 | } | 240 | } |
| 242 | }; | 241 | }; |
| 243 | 242 | ||
| @@ -247,10 +246,11 @@ struct fmt::formatter<Service::PSC::Time::ClockSnapshot> : fmt::formatter<fmt::s | |||
| 247 | auto format(const Service::PSC::Time::ClockSnapshot& snapshot, FormatContext& ctx) const { | 246 | auto format(const Service::PSC::Time::ClockSnapshot& snapshot, FormatContext& ctx) const { |
| 248 | return fmt::format_to( | 247 | return fmt::format_to( |
| 249 | ctx.out(), | 248 | ctx.out(), |
| 250 | "user_context={} network_context={} user_time={} network_time={} user_calendar_time={} " | 249 | "[user_context={} network_context={} user_time={} network_time={} " |
| 250 | "user_calendar_time={} " | ||
| 251 | "network_calendar_time={} user_calendar_additional_time={} " | 251 | "network_calendar_time={} user_calendar_additional_time={} " |
| 252 | "network_calendar_additional_time={} steady_clock_time_point={} location={} " | 252 | "network_calendar_additional_time={} steady_clock_time_point={} location={} " |
| 253 | "is_automatic_correction_enabled={} type={}", | 253 | "is_automatic_correction_enabled={} type={}]", |
| 254 | snapshot.user_context, snapshot.network_context, snapshot.user_time, | 254 | snapshot.user_context, snapshot.network_context, snapshot.user_time, |
| 255 | snapshot.network_time, snapshot.user_calendar_time, snapshot.network_calendar_time, | 255 | snapshot.network_time, snapshot.user_calendar_time, snapshot.network_calendar_time, |
| 256 | snapshot.user_calendar_additional_time, snapshot.network_calendar_additional_time, | 256 | snapshot.user_calendar_additional_time, snapshot.network_calendar_additional_time, |
| @@ -266,7 +266,7 @@ struct fmt::formatter<Service::PSC::Time::ContinuousAdjustmentTimePoint> | |||
| 266 | auto format(const Service::PSC::Time::ContinuousAdjustmentTimePoint& time_point, | 266 | auto format(const Service::PSC::Time::ContinuousAdjustmentTimePoint& time_point, |
| 267 | FormatContext& ctx) const { | 267 | FormatContext& ctx) const { |
| 268 | return fmt::format_to(ctx.out(), | 268 | return fmt::format_to(ctx.out(), |
| 269 | "rtc_offset={} diff_scale={} shift_amount={} lower={} upper={}", | 269 | "[rtc_offset={} diff_scale={} shift_amount={} lower={} upper={}]", |
| 270 | time_point.rtc_offset, time_point.diff_scale, time_point.shift_amount, | 270 | time_point.rtc_offset, time_point.diff_scale, time_point.shift_amount, |
| 271 | time_point.lower, time_point.upper); | 271 | time_point.lower, time_point.upper); |
| 272 | } | 272 | } |
diff --git a/src/core/hle/service/psc/time/service_manager.cpp b/src/core/hle/service/psc/time/service_manager.cpp index ec906b723..4e1643fcb 100644 --- a/src/core/hle/service/psc/time/service_manager.cpp +++ b/src/core/hle/service/psc/time/service_manager.cpp | |||
| @@ -120,11 +120,8 @@ Result ServiceManager::SetupStandardNetworkSystemClockCore(SystemClockContext& c | |||
| 120 | context, context.steady_time_point.clock_source_id.RawString(), accuracy); | 120 | context, context.steady_time_point.clock_source_id.RawString(), accuracy); |
| 121 | 121 | ||
| 122 | // TODO this is a hack! The network clock should be updated independently, from the ntc service | 122 | // TODO this is a hack! The network clock should be updated independently, from the ntc service |
| 123 | // and maybe elsewhere. We do not do that, so fix the clock to the local clock on first boot | 123 | // and maybe elsewhere. We do not do that, so fix the clock to the local clock. |
| 124 | // to avoid it being stuck at 0. | 124 | m_local_system_clock.GetContext(context); |
| 125 | if (context == Service::PSC::Time::SystemClockContext{}) { | ||
| 126 | m_local_system_clock.GetContext(context); | ||
| 127 | } | ||
| 128 | 125 | ||
| 129 | m_network_system_clock.SetContextWriter(m_network_system_context_writer); | 126 | m_network_system_clock.SetContextWriter(m_network_system_context_writer); |
| 130 | m_network_system_clock.Initialize(context, accuracy); | 127 | m_network_system_clock.Initialize(context, accuracy); |
| @@ -138,13 +135,6 @@ Result ServiceManager::SetupStandardUserSystemClockCore(bool automatic_correctio | |||
| 138 | LOG_DEBUG(Service_Time, "called. automatic_correction={} time_point={} clock_source_id={}", | 135 | LOG_DEBUG(Service_Time, "called. automatic_correction={} time_point={} clock_source_id={}", |
| 139 | automatic_correction, time_point, time_point.clock_source_id.RawString()); | 136 | automatic_correction, time_point, time_point.clock_source_id.RawString()); |
| 140 | 137 | ||
| 141 | // TODO this is a hack! The user clock should be updated independently, from the ntc service | ||
| 142 | // and maybe elsewhere. We do not do that, so fix the clock to the local clock on first boot | ||
| 143 | // to avoid it being stuck at 0. | ||
| 144 | if (time_point == Service::PSC::Time::SteadyClockTimePoint{}) { | ||
| 145 | m_local_system_clock.GetCurrentTimePoint(time_point); | ||
| 146 | } | ||
| 147 | |||
| 148 | m_user_system_clock.SetAutomaticCorrection(automatic_correction); | 138 | m_user_system_clock.SetAutomaticCorrection(automatic_correction); |
| 149 | m_user_system_clock.SetTimePointAndSignal(time_point); | 139 | m_user_system_clock.SetTimePointAndSignal(time_point); |
| 150 | m_user_system_clock.SetInitialized(); | 140 | m_user_system_clock.SetInitialized(); |
diff --git a/src/core/hle/service/psc/time/time_zone.cpp b/src/core/hle/service/psc/time/time_zone.cpp index 82ddba42f..cc855c763 100644 --- a/src/core/hle/service/psc/time/time_zone.cpp +++ b/src/core/hle/service/psc/time/time_zone.cpp | |||
| @@ -140,11 +140,11 @@ Result TimeZone::ParseBinaryInto(Tz::Rule& out_rule, std::span<const u8> binary) | |||
| 140 | R_RETURN(ParseBinaryImpl(out_rule, binary)); | 140 | R_RETURN(ParseBinaryImpl(out_rule, binary)); |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | Result TimeZone::ToPosixTime(u32& out_count, std::span<s64> out_times, u32 out_times_count, | 143 | Result TimeZone::ToPosixTime(u32& out_count, std::span<s64> out_times, size_t out_times_max_count, |
| 144 | CalendarTime& calendar, const Tz::Rule& rule) { | 144 | const CalendarTime& calendar, const Tz::Rule& rule) { |
| 145 | std::scoped_lock l{m_mutex}; | 145 | std::scoped_lock l{m_mutex}; |
| 146 | 146 | ||
| 147 | auto res = ToPosixTimeImpl(out_count, out_times, out_times_count, calendar, rule, -1); | 147 | auto res = ToPosixTimeImpl(out_count, out_times, out_times_max_count, calendar, rule, -1); |
| 148 | 148 | ||
| 149 | if (res != ResultSuccess) { | 149 | if (res != ResultSuccess) { |
| 150 | if (res == ResultTimeZoneNotFound) { | 150 | if (res == ResultTimeZoneNotFound) { |
| @@ -158,10 +158,10 @@ Result TimeZone::ToPosixTime(u32& out_count, std::span<s64> out_times, u32 out_t | |||
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | Result TimeZone::ToPosixTimeWithMyRule(u32& out_count, std::span<s64> out_times, | 160 | Result TimeZone::ToPosixTimeWithMyRule(u32& out_count, std::span<s64> out_times, |
| 161 | u32 out_times_count, CalendarTime& calendar) { | 161 | size_t out_times_max_count, const CalendarTime& calendar) { |
| 162 | std::scoped_lock l{m_mutex}; | 162 | std::scoped_lock l{m_mutex}; |
| 163 | 163 | ||
| 164 | auto res = ToPosixTimeImpl(out_count, out_times, out_times_count, calendar, m_my_rule, -1); | 164 | auto res = ToPosixTimeImpl(out_count, out_times, out_times_max_count, calendar, m_my_rule, -1); |
| 165 | 165 | ||
| 166 | if (res != ResultSuccess) { | 166 | if (res != ResultSuccess) { |
| 167 | if (res == ResultTimeZoneNotFound) { | 167 | if (res == ResultTimeZoneNotFound) { |
| @@ -212,20 +212,23 @@ Result TimeZone::ToCalendarTimeImpl(CalendarTime& out_calendar_time, | |||
| 212 | R_SUCCEED(); | 212 | R_SUCCEED(); |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | Result TimeZone::ToPosixTimeImpl(u32& out_count, std::span<s64> out_times, u32 out_times_count, | 215 | Result TimeZone::ToPosixTimeImpl(u32& out_count, std::span<s64> out_times, |
| 216 | CalendarTime& calendar, const Tz::Rule& rule, s32 is_dst) { | 216 | size_t out_times_max_count, const CalendarTime& calendar, |
| 217 | const Tz::Rule& rule, s32 is_dst) { | ||
| 217 | R_TRY(ValidateRule(rule)); | 218 | R_TRY(ValidateRule(rule)); |
| 218 | 219 | ||
| 219 | calendar.month -= 1; | 220 | CalendarTime local_calendar{calendar}; |
| 220 | calendar.year -= 1900; | 221 | |
| 222 | local_calendar.month -= 1; | ||
| 223 | local_calendar.year -= 1900; | ||
| 221 | 224 | ||
| 222 | Tz::CalendarTimeInternal internal{ | 225 | Tz::CalendarTimeInternal internal{ |
| 223 | .tm_sec = calendar.second, | 226 | .tm_sec = local_calendar.second, |
| 224 | .tm_min = calendar.minute, | 227 | .tm_min = local_calendar.minute, |
| 225 | .tm_hour = calendar.hour, | 228 | .tm_hour = local_calendar.hour, |
| 226 | .tm_mday = calendar.day, | 229 | .tm_mday = local_calendar.day, |
| 227 | .tm_mon = calendar.month, | 230 | .tm_mon = local_calendar.month, |
| 228 | .tm_year = calendar.year, | 231 | .tm_year = local_calendar.year, |
| 229 | .tm_wday = 0, | 232 | .tm_wday = 0, |
| 230 | .tm_yday = 0, | 233 | .tm_yday = 0, |
| 231 | .tm_isdst = is_dst, | 234 | .tm_isdst = is_dst, |
| @@ -243,9 +246,9 @@ Result TimeZone::ToPosixTimeImpl(u32& out_count, std::span<s64> out_times, u32 o | |||
| 243 | R_RETURN(ResultTimeZoneNotFound); | 246 | R_RETURN(ResultTimeZoneNotFound); |
| 244 | } | 247 | } |
| 245 | 248 | ||
| 246 | if (internal.tm_sec != calendar.second || internal.tm_min != calendar.minute || | 249 | if (internal.tm_sec != local_calendar.second || internal.tm_min != local_calendar.minute || |
| 247 | internal.tm_hour != calendar.hour || internal.tm_mday != calendar.day || | 250 | internal.tm_hour != local_calendar.hour || internal.tm_mday != local_calendar.day || |
| 248 | internal.tm_mon != calendar.month || internal.tm_year != calendar.year) { | 251 | internal.tm_mon != local_calendar.month || internal.tm_year != local_calendar.year) { |
| 249 | R_RETURN(ResultTimeZoneNotFound); | 252 | R_RETURN(ResultTimeZoneNotFound); |
| 250 | } | 253 | } |
| 251 | 254 | ||
| @@ -254,7 +257,7 @@ Result TimeZone::ToPosixTimeImpl(u32& out_count, std::span<s64> out_times, u32 o | |||
| 254 | } | 257 | } |
| 255 | 258 | ||
| 256 | out_times[0] = time; | 259 | out_times[0] = time; |
| 257 | if (out_times_count < 2) { | 260 | if (out_times_max_count < 2) { |
| 258 | out_count = 1; | 261 | out_count = 1; |
| 259 | R_SUCCEED(); | 262 | R_SUCCEED(); |
| 260 | } | 263 | } |
diff --git a/src/core/hle/service/psc/time/time_zone.h b/src/core/hle/service/psc/time/time_zone.h index 6bd8f2fda..6248e45f9 100644 --- a/src/core/hle/service/psc/time/time_zone.h +++ b/src/core/hle/service/psc/time/time_zone.h | |||
| @@ -38,18 +38,18 @@ public: | |||
| 38 | CalendarAdditionalInfo& calendar_additional, s64 time); | 38 | CalendarAdditionalInfo& calendar_additional, s64 time); |
| 39 | Result ParseBinary(LocationName& name, std::span<const u8> binary); | 39 | Result ParseBinary(LocationName& name, std::span<const u8> binary); |
| 40 | Result ParseBinaryInto(Tz::Rule& out_rule, std::span<const u8> binary); | 40 | Result ParseBinaryInto(Tz::Rule& out_rule, std::span<const u8> binary); |
| 41 | Result ToPosixTime(u32& out_count, std::span<s64> out_times, u32 out_times_count, | 41 | Result ToPosixTime(u32& out_count, std::span<s64> out_times, size_t out_times_max_count, |
| 42 | CalendarTime& calendar, const Tz::Rule& rule); | 42 | const CalendarTime& calendar, const Tz::Rule& rule); |
| 43 | Result ToPosixTimeWithMyRule(u32& out_count, std::span<s64> out_times, u32 out_times_count, | 43 | Result ToPosixTimeWithMyRule(u32& out_count, std::span<s64> out_times, |
| 44 | CalendarTime& calendar); | 44 | size_t out_times_max_count, const CalendarTime& calendar); |
| 45 | 45 | ||
| 46 | private: | 46 | private: |
| 47 | Result ParseBinaryImpl(Tz::Rule& out_rule, std::span<const u8> binary); | 47 | Result ParseBinaryImpl(Tz::Rule& out_rule, std::span<const u8> binary); |
| 48 | Result ToCalendarTimeImpl(CalendarTime& out_calendar_time, | 48 | Result ToCalendarTimeImpl(CalendarTime& out_calendar_time, |
| 49 | CalendarAdditionalInfo& out_additional_info, s64 time, | 49 | CalendarAdditionalInfo& out_additional_info, s64 time, |
| 50 | const Tz::Rule& rule); | 50 | const Tz::Rule& rule); |
| 51 | Result ToPosixTimeImpl(u32& out_count, std::span<s64> out_times, u32 out_times_count, | 51 | Result ToPosixTimeImpl(u32& out_count, std::span<s64> out_times, size_t out_times_max_count, |
| 52 | CalendarTime& calendar, const Tz::Rule& rule, s32 is_dst); | 52 | const CalendarTime& calendar, const Tz::Rule& rule, s32 is_dst); |
| 53 | 53 | ||
| 54 | bool m_initialized{}; | 54 | bool m_initialized{}; |
| 55 | std::recursive_mutex m_mutex; | 55 | std::recursive_mutex m_mutex; |
diff --git a/src/core/hle/service/psc/time/time_zone_service.cpp b/src/core/hle/service/psc/time/time_zone_service.cpp index 9376a0324..eb81f5b03 100644 --- a/src/core/hle/service/psc/time/time_zone_service.cpp +++ b/src/core/hle/service/psc/time/time_zone_service.cpp | |||
| @@ -138,32 +138,28 @@ Result TimeZoneService::ToCalendarTimeWithMyRule(Out<CalendarTime> out_calendar_ | |||
| 138 | 138 | ||
| 139 | Result TimeZoneService::ToPosixTime(Out<u32> out_count, | 139 | Result TimeZoneService::ToPosixTime(Out<u32> out_count, |
| 140 | OutArray<s64, BufferAttr_HipcPointer> out_times, | 140 | OutArray<s64, BufferAttr_HipcPointer> out_times, |
| 141 | Out<u32> out_times_count, CalendarTime& calendar_time, | 141 | const CalendarTime& calendar_time, InRule rule) { |
| 142 | InRule rule) { | ||
| 143 | SCOPE_EXIT({ | 142 | SCOPE_EXIT({ |
| 144 | LOG_DEBUG(Service_Time, | 143 | LOG_DEBUG(Service_Time, |
| 145 | "called. calendar_time={} out_count={} out_times[0]={} out_times[1]={} " | 144 | "called. calendar_time={} out_count={} out_times[0]={} out_times[1]={} ", |
| 146 | "out_times_count={}", | 145 | calendar_time, *out_count, out_times[0], out_times[1]); |
| 147 | calendar_time, *out_count, out_times[0], out_times[1], *out_times_count); | ||
| 148 | }); | 146 | }); |
| 149 | 147 | ||
| 150 | R_RETURN( | 148 | R_RETURN( |
| 151 | m_time_zone.ToPosixTime(*out_count, out_times, *out_times_count, calendar_time, *rule)); | 149 | m_time_zone.ToPosixTime(*out_count, out_times, out_times.size(), calendar_time, *rule)); |
| 152 | } | 150 | } |
| 153 | 151 | ||
| 154 | Result TimeZoneService::ToPosixTimeWithMyRule(Out<u32> out_count, | 152 | Result TimeZoneService::ToPosixTimeWithMyRule(Out<u32> out_count, |
| 155 | OutArray<s64, BufferAttr_HipcPointer> out_times, | 153 | OutArray<s64, BufferAttr_HipcPointer> out_times, |
| 156 | Out<u32> out_times_count, | 154 | const CalendarTime& calendar_time) { |
| 157 | CalendarTime& calendar_time) { | ||
| 158 | SCOPE_EXIT({ | 155 | SCOPE_EXIT({ |
| 159 | LOG_DEBUG(Service_Time, | 156 | LOG_DEBUG(Service_Time, |
| 160 | "called. calendar_time={} out_count={} out_times[0]={} out_times[1]={} " | 157 | "called. calendar_time={} out_count={} out_times[0]={} out_times[1]={} ", |
| 161 | "out_times_count={}", | 158 | calendar_time, *out_count, out_times[0], out_times[1]); |
| 162 | calendar_time, *out_count, out_times[0], out_times[1], *out_times_count); | ||
| 163 | }); | 159 | }); |
| 164 | 160 | ||
| 165 | R_RETURN( | 161 | R_RETURN( |
| 166 | m_time_zone.ToPosixTimeWithMyRule(*out_count, out_times, *out_times_count, calendar_time)); | 162 | m_time_zone.ToPosixTimeWithMyRule(*out_count, out_times, out_times.size(), calendar_time)); |
| 167 | } | 163 | } |
| 168 | 164 | ||
| 169 | } // namespace Service::PSC::Time | 165 | } // namespace Service::PSC::Time |
diff --git a/src/core/hle/service/psc/time/time_zone_service.h b/src/core/hle/service/psc/time/time_zone_service.h index 084e3f907..6eb9ddc4b 100644 --- a/src/core/hle/service/psc/time/time_zone_service.h +++ b/src/core/hle/service/psc/time/time_zone_service.h | |||
| @@ -50,10 +50,10 @@ public: | |||
| 50 | Result ToCalendarTimeWithMyRule(Out<CalendarTime> out_calendar_time, | 50 | Result ToCalendarTimeWithMyRule(Out<CalendarTime> out_calendar_time, |
| 51 | Out<CalendarAdditionalInfo> out_additional_info, s64 time); | 51 | Out<CalendarAdditionalInfo> out_additional_info, s64 time); |
| 52 | Result ToPosixTime(Out<u32> out_count, OutArray<s64, BufferAttr_HipcPointer> out_times, | 52 | Result ToPosixTime(Out<u32> out_count, OutArray<s64, BufferAttr_HipcPointer> out_times, |
| 53 | Out<u32> out_times_count, CalendarTime& calendar_time, InRule rule); | 53 | const CalendarTime& calendar_time, InRule rule); |
| 54 | Result ToPosixTimeWithMyRule(Out<u32> out_count, | 54 | Result ToPosixTimeWithMyRule(Out<u32> out_count, |
| 55 | OutArray<s64, BufferAttr_HipcPointer> out_times, | 55 | OutArray<s64, BufferAttr_HipcPointer> out_times, |
| 56 | Out<u32> out_times_count, CalendarTime& calendar_time); | 56 | const CalendarTime& calendar_time); |
| 57 | 57 | ||
| 58 | private: | 58 | private: |
| 59 | Core::System& m_system; | 59 | Core::System& m_system; |
diff --git a/src/core/hle/service/set/system_settings_server.cpp b/src/core/hle/service/set/system_settings_server.cpp index 100cb2db4..d3d0fb112 100644 --- a/src/core/hle/service/set/system_settings_server.cpp +++ b/src/core/hle/service/set/system_settings_server.cpp | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | namespace Service::Set { | 25 | namespace Service::Set { |
| 26 | 26 | ||
| 27 | namespace { | 27 | namespace { |
| 28 | constexpr u32 SETTINGS_VERSION{2u}; | 28 | constexpr u32 SETTINGS_VERSION{3u}; |
| 29 | constexpr auto SETTINGS_MAGIC = Common::MakeMagic('y', 'u', 'z', 'u', '_', 's', 'e', 't'); | 29 | constexpr auto SETTINGS_MAGIC = Common::MakeMagic('y', 'u', 'z', 'u', '_', 's', 'e', 't'); |
| 30 | struct SettingsHeader { | 30 | struct SettingsHeader { |
| 31 | u64 magic; | 31 | u64 magic; |