From 3113ae66162c9095f6e75e09078072afe2ecfcd2 Mon Sep 17 00:00:00 2001 From: Steveice10 <1269164+Steveice10@users.noreply.github.com> Date: Tue, 26 Dec 2023 09:01:16 -0800 Subject: [PATCH] cfg: Only select preferred region once per instance. (#7284) --- src/core/hle/service/cfg/cfg.cpp | 4 +++- src/core/hle/service/cfg/cfg.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp index e7b7c4476..d37fbb242 100644 --- a/src/core/hle/service/cfg/cfg.cpp +++ b/src/core/hle/service/cfg/cfg.cpp @@ -40,6 +40,7 @@ void Module::serialize(Archive& ar, const unsigned int) { ar& cfg_config_file_buffer; ar& cfg_system_save_data_archive; ar& preferred_region_code; + ar& preferred_region_chosen; } SERIALIZE_IMPL(Module) @@ -656,9 +657,10 @@ static std::tuple AdjustLanguageInfoBlock( } void Module::UpdatePreferredRegionCode() { - if (!system.IsPoweredOn()) { + if (preferred_region_chosen || !system.IsPoweredOn()) { return; } + preferred_region_chosen = true; const auto preferred_regions = system.GetAppLoader().GetPreferredRegions(); if (preferred_regions.empty()) { diff --git a/src/core/hle/service/cfg/cfg.h b/src/core/hle/service/cfg/cfg.h index 4ac9b3e14..16edf7746 100644 --- a/src/core/hle/service/cfg/cfg.h +++ b/src/core/hle/service/cfg/cfg.h @@ -591,6 +591,7 @@ private: std::array cfg_config_file_buffer; std::unique_ptr cfg_system_save_data_archive; u32 preferred_region_code = 0; + bool preferred_region_chosen = false; MCUData mcu_data{}; template