From 413316560784348b8ea2684d272b974fd0428267 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Mon, 5 Jun 2023 20:41:50 -0400 Subject: settings,core,config_sys: Remove optional type from custom_rtc, rng_seed core: Fix MSVC errors --- src/core/core.cpp | 4 +++- src/core/hle/kernel/k_process.cpp | 3 ++- src/core/hle/service/spl/spl_module.cpp | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src/core') diff --git a/src/core/core.cpp b/src/core/core.cpp index 9e3eb3795..da1baa892 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -149,7 +149,9 @@ struct System::Impl { const auto current_time = std::chrono::duration_cast(posix_time).count(); Settings::values.custom_rtc_differential = - Settings::values.custom_rtc.value_or(current_time) - current_time; + (Settings::values.custom_rtc_enabled ? Settings::values.custom_rtc.GetValue() + : current_time) - + current_time; // Create a default fs if one doesn't already exist. if (virtual_filesystem == nullptr) { diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp index efe86ad27..ae064ee04 100644 --- a/src/core/hle/kernel/k_process.cpp +++ b/src/core/hle/kernel/k_process.cpp @@ -81,7 +81,8 @@ Result KProcess::Initialize(KProcess* process, Core::System& system, std::string process->m_capabilities.InitializeForMetadatalessProcess(); process->m_is_initialized = true; - std::mt19937 rng(Settings::values.rng_seed.GetValue().value_or(std::time(nullptr))); + std::mt19937 rng(Settings::values.rng_seed_enabled ? Settings::values.rng_seed.GetValue() + : static_cast(std::time(nullptr))); std::uniform_int_distribution distribution; std::generate(process->m_random_entropy.begin(), process->m_random_entropy.end(), [&] { return distribution(rng); }); diff --git a/src/core/hle/service/spl/spl_module.cpp b/src/core/hle/service/spl/spl_module.cpp index 0227d4393..cd631b2ea 100644 --- a/src/core/hle/service/spl/spl_module.cpp +++ b/src/core/hle/service/spl/spl_module.cpp @@ -19,7 +19,8 @@ namespace Service::SPL { Module::Interface::Interface(Core::System& system_, std::shared_ptr module_, const char* name) : ServiceFramework{system_, name}, module{std::move(module_)}, - rng(Settings::values.rng_seed.GetValue().value_or(std::time(nullptr))) {} + rng(Settings::values.rng_seed_enabled ? Settings::values.rng_seed.GetValue() + : static_cast(std::time(nullptr))) {} Module::Interface::~Interface() = default; -- cgit v1.2.3