Skip to content

Commit

Permalink
cfg: Only select preferred region once per instance. (#7284)
Browse files Browse the repository at this point in the history
  • Loading branch information
Steveice10 authored Dec 26, 2023
1 parent bd4ec25 commit 3113ae6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/hle/service/cfg/cfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -656,9 +657,10 @@ static std::tuple<u32 /*region*/, SystemLanguage> 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()) {
Expand Down
1 change: 1 addition & 0 deletions src/core/hle/service/cfg/cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ class Module final {
std::array<u8, CONFIG_SAVEFILE_SIZE> cfg_config_file_buffer;
std::unique_ptr<FileSys::ArchiveBackend> cfg_system_save_data_archive;
u32 preferred_region_code = 0;
bool preferred_region_chosen = false;
MCUData mcu_data{};

template <class Archive>
Expand Down

0 comments on commit 3113ae6

Please sign in to comment.