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_config_file_buffer;
ar& cfg_system_save_data_archive; ar& cfg_system_save_data_archive;
ar& preferred_region_code; ar& preferred_region_code;
ar& preferred_region_chosen;
} }
SERIALIZE_IMPL(Module) SERIALIZE_IMPL(Module)
@ -656,9 +657,10 @@ static std::tuple<u32 /*region*/, SystemLanguage> AdjustLanguageInfoBlock(
} }
void Module::UpdatePreferredRegionCode() { void Module::UpdatePreferredRegionCode() {
if (!system.IsPoweredOn()) { if (preferred_region_chosen || !system.IsPoweredOn()) {
return; return;
} }
preferred_region_chosen = true;
const auto preferred_regions = system.GetAppLoader().GetPreferredRegions(); const auto preferred_regions = system.GetAppLoader().GetPreferredRegions();
if (preferred_regions.empty()) { if (preferred_regions.empty()) {

View file

@ -591,6 +591,7 @@ private:
std::array<u8, CONFIG_SAVEFILE_SIZE> cfg_config_file_buffer; std::array<u8, CONFIG_SAVEFILE_SIZE> cfg_config_file_buffer;
std::unique_ptr<FileSys::ArchiveBackend> cfg_system_save_data_archive; std::unique_ptr<FileSys::ArchiveBackend> cfg_system_save_data_archive;
u32 preferred_region_code = 0; u32 preferred_region_code = 0;
bool preferred_region_chosen = false;
MCUData mcu_data{}; MCUData mcu_data{};
template <class Archive> template <class Archive>