summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/glue
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2024-02-16 19:11:36 +0100
committerGitHub <noreply@github.com>2024-02-16 19:11:36 +0100
commitc7588c042ba14bce871d12f5cf4dbf64bb5b3fe9 (patch)
tree59e23eb8b42ec44318ca00f8972a33fe7181984c /src/core/hle/service/glue
parentMerge pull request #13011 from liamwhite/vi-ipc (diff)
parentservice: set: Migrate ISystemSettingsServer to new IPC (diff)
downloadyuzu-c7588c042ba14bce871d12f5cf4dbf64bb5b3fe9.tar
yuzu-c7588c042ba14bce871d12f5cf4dbf64bb5b3fe9.tar.gz
yuzu-c7588c042ba14bce871d12f5cf4dbf64bb5b3fe9.tar.bz2
yuzu-c7588c042ba14bce871d12f5cf4dbf64bb5b3fe9.tar.lz
yuzu-c7588c042ba14bce871d12f5cf4dbf64bb5b3fe9.tar.xz
yuzu-c7588c042ba14bce871d12f5cf4dbf64bb5b3fe9.tar.zst
yuzu-c7588c042ba14bce871d12f5cf4dbf64bb5b3fe9.zip
Diffstat (limited to 'src/core/hle/service/glue')
-rw-r--r--src/core/hle/service/glue/time/manager.cpp43
-rw-r--r--src/core/hle/service/glue/time/static.cpp17
-rw-r--r--src/core/hle/service/glue/time/worker.cpp2
3 files changed, 20 insertions, 42 deletions
diff --git a/src/core/hle/service/glue/time/manager.cpp b/src/core/hle/service/glue/time/manager.cpp
index 0c27e8029..cad755fa7 100644
--- a/src/core/hle/service/glue/time/manager.cpp
+++ b/src/core/hle/service/glue/time/manager.cpp
@@ -21,19 +21,6 @@
namespace Service::Glue::Time {
namespace {
-
-template <typename T>
-T GetSettingsItemValue(std::shared_ptr<Service::Set::ISystemSettingsServer>& set_sys,
- const char* category, const char* name) {
- std::vector<u8> interval_buf;
- auto res = set_sys->GetSettingsItemValue(interval_buf, category, name);
- ASSERT(res == ResultSuccess);
-
- T v{};
- std::memcpy(&v, interval_buf.data(), sizeof(T));
- return v;
-}
-
s64 CalendarTimeToEpoch(Service::PSC::Time::CalendarTime calendar) {
constexpr auto is_leap = [](s32 year) -> bool {
return (((year) % 4) == 0 && (((year) % 100) != 0 || ((year) % 400) == 0));
@@ -65,13 +52,15 @@ s64 CalendarTimeToEpoch(Service::PSC::Time::CalendarTime calendar) {
s64 GetEpochTimeFromInitialYear(std::shared_ptr<Service::Set::ISystemSettingsServer>& set_sys) {
Service::PSC::Time::CalendarTime calendar{
- .year = GetSettingsItemValue<s16>(set_sys, "time", "standard_user_clock_initial_year"),
+ .year = 2000,
.month = 1,
.day = 1,
.hour = 0,
.minute = 0,
.second = 0,
};
+ set_sys->GetSettingsItemValueImpl<s16>(calendar.year, "time",
+ "standard_user_clock_initial_year");
return CalendarTimeToEpoch(calendar);
}
@@ -124,7 +113,7 @@ TimeManager::TimeManager(Core::System& system)
ASSERT(res == ResultSuccess);
Service::PSC::Time::SystemClockContext user_clock_context{};
- res = m_set_sys->GetUserSystemClockContext(user_clock_context);
+ res = m_set_sys->GetUserSystemClockContext(&user_clock_context);
ASSERT(res == ResultSuccess);
// TODO the local clock should initialise with this epoch time, and be updated somewhere else on
@@ -140,11 +129,12 @@ TimeManager::TimeManager(Core::System& system)
ASSERT(res == ResultSuccess);
Service::PSC::Time::SystemClockContext network_clock_context{};
- res = m_set_sys->GetNetworkSystemClockContext(network_clock_context);
+ res = m_set_sys->GetNetworkSystemClockContext(&network_clock_context);
ASSERT(res == ResultSuccess);
- auto network_accuracy_m{GetSettingsItemValue<s32>(
- m_set_sys, "time", "standard_network_clock_sufficient_accuracy_minutes")};
+ s32 network_accuracy_m{};
+ m_set_sys->GetSettingsItemValueImpl<s32>(network_accuracy_m, "time",
+ "standard_network_clock_sufficient_accuracy_minutes");
auto one_minute_ns{
std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::minutes(1)).count()};
s64 network_accuracy_ns{network_accuracy_m * one_minute_ns};
@@ -153,12 +143,12 @@ TimeManager::TimeManager(Core::System& system)
ASSERT(res == ResultSuccess);
bool is_automatic_correction_enabled{};
- res = m_set_sys->IsUserSystemClockAutomaticCorrectionEnabled(is_automatic_correction_enabled);
+ res = m_set_sys->IsUserSystemClockAutomaticCorrectionEnabled(&is_automatic_correction_enabled);
ASSERT(res == ResultSuccess);
Service::PSC::Time::SteadyClockTimePoint automatic_correction_time_point{};
res = m_set_sys->GetUserSystemClockAutomaticCorrectionUpdatedTime(
- automatic_correction_time_point);
+ &automatic_correction_time_point);
ASSERT(res == ResultSuccess);
res = m_time_m->SetupStandardUserSystemClockCore(is_automatic_correction_enabled,
@@ -198,11 +188,11 @@ TimeManager::TimeManager(Core::System& system)
Result TimeManager::SetupStandardSteadyClockCore() {
Common::UUID external_clock_source_id{};
- auto res = m_set_sys->GetExternalSteadyClockSourceId(external_clock_source_id);
+ auto res = m_set_sys->GetExternalSteadyClockSourceId(&external_clock_source_id);
ASSERT(res == ResultSuccess);
s64 external_steady_clock_internal_offset_s{};
- res = m_set_sys->GetExternalSteadyClockInternalOffset(external_steady_clock_internal_offset_s);
+ res = m_set_sys->GetExternalSteadyClockInternalOffset(&external_steady_clock_internal_offset_s);
ASSERT(res == ResultSuccess);
auto one_second_ns{
@@ -210,8 +200,9 @@ Result TimeManager::SetupStandardSteadyClockCore() {
s64 external_steady_clock_internal_offset_ns{external_steady_clock_internal_offset_s *
one_second_ns};
- s32 standard_steady_clock_test_offset_m{
- GetSettingsItemValue<s32>(m_set_sys, "time", "standard_steady_clock_test_offset_minutes")};
+ s32 standard_steady_clock_test_offset_m{};
+ m_set_sys->GetSettingsItemValueImpl<s32>(standard_steady_clock_test_offset_m, "time",
+ "standard_steady_clock_test_offset_minutes");
auto one_minute_ns{
std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::minutes(1)).count()};
s64 standard_steady_clock_test_offset_ns{standard_steady_clock_test_offset_m * one_minute_ns};
@@ -237,7 +228,7 @@ Result TimeManager::SetupStandardSteadyClockCore() {
Result TimeManager::SetupTimeZoneServiceCore() {
Service::PSC::Time::LocationName name{};
- auto res = m_set_sys->GetDeviceTimeZoneLocationName(name);
+ auto res = m_set_sys->GetDeviceTimeZoneLocationName(&name);
ASSERT(res == ResultSuccess);
auto configured_zone = GetTimeZoneString(name);
@@ -255,7 +246,7 @@ Result TimeManager::SetupTimeZoneServiceCore() {
}
Service::PSC::Time::SteadyClockTimePoint time_point{};
- res = m_set_sys->GetDeviceTimeZoneLocationUpdatedTime(time_point);
+ res = m_set_sys->GetDeviceTimeZoneLocationUpdatedTime(&time_point);
ASSERT(res == ResultSuccess);
auto location_count = GetTimeZoneCount();
diff --git a/src/core/hle/service/glue/time/static.cpp b/src/core/hle/service/glue/time/static.cpp
index f8c1218f3..ec9b0efb1 100644
--- a/src/core/hle/service/glue/time/static.cpp
+++ b/src/core/hle/service/glue/time/static.cpp
@@ -20,19 +20,6 @@
#include "core/hle/service/sm/sm.h"
namespace Service::Glue::Time {
-namespace {
-template <typename T>
-T GetSettingsItemValue(std::shared_ptr<Service::Set::ISystemSettingsServer>& set_sys,
- const char* category, const char* name) {
- std::vector<u8> interval_buf;
- auto res = set_sys->GetSettingsItemValue(interval_buf, category, name);
- ASSERT(res == ResultSuccess);
-
- T v{};
- std::memcpy(&v, interval_buf.data(), sizeof(T));
- return v;
-}
-} // namespace
StaticService::StaticService(Core::System& system_,
Service::PSC::Time::StaticServiceSetupInfo setup_info,
@@ -181,8 +168,8 @@ Result StaticService::SetStandardUserSystemClockAutomaticCorrectionEnabled(
Result StaticService::GetStandardUserSystemClockInitialYear(Out<s32> out_year) {
SCOPE_EXIT({ LOG_DEBUG(Service_Time, "called. out_year={}", *out_year); });
- *out_year = GetSettingsItemValue<s32>(m_set_sys, "time", "standard_user_clock_initial_year");
- R_SUCCEED();
+ R_RETURN(m_set_sys->GetSettingsItemValueImpl<s32>(*out_year, "time",
+ "standard_user_clock_initial_year"));
}
Result StaticService::IsStandardNetworkSystemClockAccuracySufficient(Out<bool> out_is_sufficient) {
diff --git a/src/core/hle/service/glue/time/worker.cpp b/src/core/hle/service/glue/time/worker.cpp
index 8787f2dcd..b28569b68 100644
--- a/src/core/hle/service/glue/time/worker.cpp
+++ b/src/core/hle/service/glue/time/worker.cpp
@@ -27,7 +27,7 @@ template <typename T>
T GetSettingsItemValue(std::shared_ptr<Service::Set::ISystemSettingsServer>& set_sys,
const char* category, const char* name) {
std::vector<u8> interval_buf;
- auto res = set_sys->GetSettingsItemValue(interval_buf, category, name);
+ auto res = set_sys->GetSettingsItemValueImpl(interval_buf, category, name);
ASSERT(res == ResultSuccess);
T v{};