1
0
Fork 0

cfg: Only select preferred region once per instance. (#7284)

This commit is contained in:
Steveice10 2023-12-26 09:01:16 -08:00 committed by GitHub
parent bd4ec251cd
commit 3113ae6616
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -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<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()) {

View File

@ -591,6 +591,7 @@ private:
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>