Boot: Initialize Wii root before saving SYSCONF file

Fixes netplay and movie overrides of SYSCONF settings not applying.
This commit is contained in:
JosJuice
2021-03-06 19:14:18 +01:00
parent 359ed5348a
commit 46dbb455e1
7 changed files with 44 additions and 16 deletions

View File

@ -433,11 +433,23 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
if (StartUp.bWii && DiscIO::IsNTSC(StartUp.m_region) && Config::Get(Config::SYSCONF_PAL60))
Config::SetCurrent(Config::SYSCONF_PAL60, false);
// Ensure any new settings are written to the SYSCONF
if (StartUp.bWii)
{
Core::BackupWiiSettings();
ConfigLoaders::SaveToSYSCONF(Config::LayerType::Meta);
const bool want_determinism = Movie::IsMovieActive() || NetPlay::IsNetPlayRunning();
Core::InitializeWiiRoot(want_determinism);
// Ensure any new settings are written to the SYSCONF
if (!want_determinism)
{
Core::BackupWiiSettings();
ConfigLoaders::SaveToSYSCONF(Config::LayerType::Meta);
}
else
{
ConfigLoaders::SaveToSYSCONF(Config::LayerType::Meta, [](const Config::Location& location) {
return Config::GetActiveLayerForConfig(location) >= Config::LayerType::Movie;
});
}
}
const bool load_ipl = !StartUp.bWii && !StartUp.bHLE_BS2 &&
@ -486,8 +498,14 @@ static void RestoreSYSCONF()
void RestoreConfig()
{
Core::RestoreWiiSettings(Core::RestoreReason::EmulationEnd);
RestoreSYSCONF();
Core::ShutdownWiiRoot();
if (!Core::WiiRootIsTemporary())
{
Core::RestoreWiiSettings(Core::RestoreReason::EmulationEnd);
RestoreSYSCONF();
}
Config::ClearCurrentRunLayer();
Config::RemoveLayer(Config::LayerType::Movie);
Config::RemoveLayer(Config::LayerType::Netplay);