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/hle/kernel/k_process.cpp | 3 ++- src/core/hle/service/spl/spl_module.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/core/hle') 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 From 8e151460265f04c7bf4a981b5f97f252a0444c27 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Wed, 10 May 2023 17:57:25 -0400 Subject: configure_system: Implement with for loop --- src/core/hle/service/ns/ns.cpp | 2 +- src/core/hle/service/set/set.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/core/hle') diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index 376067a95..91c5a2182 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp @@ -409,7 +409,7 @@ ResultVal IApplicationManagerInterface::GetApplicationDesiredLanguage( // Get language code from settings const auto language_code = - Set::GetLanguageCodeFromIndex(Settings::values.language_index.GetValue()); + Set::GetLanguageCodeFromIndex(static_cast(Settings::values.language_index.GetValue())); // Convert to application language, get priority list const auto application_language = ConvertToApplicationLanguage(language_code); diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp index f5788b481..83f888c54 100644 --- a/src/core/hle/service/set/set.cpp +++ b/src/core/hle/service/set/set.cpp @@ -93,7 +93,8 @@ void GetAvailableLanguageCodesImpl(HLERequestContext& ctx, std::size_t max_entri } void GetKeyCodeMapImpl(HLERequestContext& ctx) { - const auto language_code = available_language_codes[Settings::values.language_index.GetValue()]; + const auto language_code = + available_language_codes[static_cast(Settings::values.language_index.GetValue())]; const auto key_code = std::find_if(language_to_layout.cbegin(), language_to_layout.cend(), [=](const auto& element) { return element.first == language_code; }); @@ -162,7 +163,7 @@ void SET::GetQuestFlag(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); - rb.Push(static_cast(Settings::values.quest_flag.GetValue())); + rb.Push(static_cast(Settings::values.quest_flag.GetValue())); } void SET::GetLanguageCode(HLERequestContext& ctx) { @@ -170,7 +171,8 @@ void SET::GetLanguageCode(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 4}; rb.Push(ResultSuccess); - rb.PushEnum(available_language_codes[Settings::values.language_index.GetValue()]); + rb.PushEnum( + available_language_codes[static_cast(Settings::values.language_index.GetValue())]); } void SET::GetRegionCode(HLERequestContext& ctx) { @@ -178,7 +180,7 @@ void SET::GetRegionCode(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); - rb.Push(Settings::values.region_index.GetValue()); + rb.Push(static_cast(Settings::values.region_index.GetValue())); } void SET::GetKeyCodeMap(HLERequestContext& ctx) { -- cgit v1.2.3 From ff6a5031d5ea509375a5dc1ee7b9eeddda6d9ebc Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Tue, 4 Jul 2023 16:48:48 -0400 Subject: settings: Require time zone setting value for stirng --- src/core/hle/service/time/time_zone_content_manager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/core/hle') diff --git a/src/core/hle/service/time/time_zone_content_manager.cpp b/src/core/hle/service/time/time_zone_content_manager.cpp index 5d60be67a..565f6b39b 100644 --- a/src/core/hle/service/time/time_zone_content_manager.cpp +++ b/src/core/hle/service/time/time_zone_content_manager.cpp @@ -76,7 +76,8 @@ TimeZoneContentManager::TimeZoneContentManager(Core::System& system_) : system{system_}, location_name_cache{BuildLocationNameCache(system)} {} void TimeZoneContentManager::Initialize(TimeManager& time_manager) { - const auto timezone_setting = Settings::GetTimeZoneString(); + const auto timezone_setting = + Settings::GetTimeZoneString(Settings::values.time_zone_index.GetValue()); if (FileSys::VirtualFile vfs_file; GetTimeZoneInfoFile(timezone_setting, vfs_file) == ResultSuccess) { -- cgit v1.2.3 From 127b3da0f13ea0850c10115d45488dfe32a0a3f4 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Mon, 17 Jul 2023 19:59:22 -0400 Subject: core,common: Give memory layout setting an enum Allows for 6GB and 8GB layouts to be selected. --- .../kernel/board/nintendo/nx/k_system_control.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/core/hle') diff --git a/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp b/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp index 49bdc671e..7320b87b9 100644 --- a/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp +++ b/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp @@ -35,13 +35,25 @@ namespace { using namespace Common::Literals; u32 GetMemorySizeForInit() { - return Settings::values.use_unsafe_extended_memory_layout ? Smc::MemorySize_8GB - : Smc::MemorySize_4GB; + switch (Settings::values.memory_layout_mode.GetValue()) { + case Settings::MemoryLayout::Memory_4Gb: + return Smc::MemorySize_4GB; + case Settings::MemoryLayout::Memory_6Gb: + return Smc::MemorySize_6GB; + case Settings::MemoryLayout::Memory_8Gb: + return Smc::MemorySize_8GB; + } } Smc::MemoryArrangement GetMemoryArrangeForInit() { - return Settings::values.use_unsafe_extended_memory_layout ? Smc::MemoryArrangement_8GB - : Smc::MemoryArrangement_4GB; + switch (Settings::values.memory_layout_mode.GetValue()) { + case Settings::MemoryLayout::Memory_4Gb: + return Smc::MemoryArrangement_4GB; + case Settings::MemoryLayout::Memory_6Gb: + return Smc::MemoryArrangement_6GB; + case Settings::MemoryLayout::Memory_8Gb: + return Smc::MemoryArrangement_8GB; + } } } // namespace -- cgit v1.2.3 From 8e91554e116b46f1c194012a2b21a15542743827 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Tue, 18 Jul 2023 17:11:23 -0400 Subject: k_system_control: Always return some memory size --- src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/core/hle') diff --git a/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp b/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp index 7320b87b9..4cfdf4558 100644 --- a/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp +++ b/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp @@ -43,6 +43,7 @@ u32 GetMemorySizeForInit() { case Settings::MemoryLayout::Memory_8Gb: return Smc::MemorySize_8GB; } + return Smc::MemorySize_4GB; } Smc::MemoryArrangement GetMemoryArrangeForInit() { @@ -54,6 +55,7 @@ Smc::MemoryArrangement GetMemoryArrangeForInit() { case Settings::MemoryLayout::Memory_8Gb: return Smc::MemoryArrangement_8GB; } + return Smc::MemoryArrangement_4GB; } } // namespace -- cgit v1.2.3