mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Boot: Initialize Wii root before saving SYSCONF file
Fixes netplay and movie overrides of SYSCONF settings not applying.
This commit is contained in:
@ -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))
|
if (StartUp.bWii && DiscIO::IsNTSC(StartUp.m_region) && Config::Get(Config::SYSCONF_PAL60))
|
||||||
Config::SetCurrent(Config::SYSCONF_PAL60, false);
|
Config::SetCurrent(Config::SYSCONF_PAL60, false);
|
||||||
|
|
||||||
// Ensure any new settings are written to the SYSCONF
|
|
||||||
if (StartUp.bWii)
|
if (StartUp.bWii)
|
||||||
{
|
{
|
||||||
Core::BackupWiiSettings();
|
const bool want_determinism = Movie::IsMovieActive() || NetPlay::IsNetPlayRunning();
|
||||||
ConfigLoaders::SaveToSYSCONF(Config::LayerType::Meta);
|
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 &&
|
const bool load_ipl = !StartUp.bWii && !StartUp.bHLE_BS2 &&
|
||||||
@ -486,8 +498,14 @@ static void RestoreSYSCONF()
|
|||||||
|
|
||||||
void RestoreConfig()
|
void RestoreConfig()
|
||||||
{
|
{
|
||||||
Core::RestoreWiiSettings(Core::RestoreReason::EmulationEnd);
|
Core::ShutdownWiiRoot();
|
||||||
RestoreSYSCONF();
|
|
||||||
|
if (!Core::WiiRootIsTemporary())
|
||||||
|
{
|
||||||
|
Core::RestoreWiiSettings(Core::RestoreReason::EmulationEnd);
|
||||||
|
RestoreSYSCONF();
|
||||||
|
}
|
||||||
|
|
||||||
Config::ClearCurrentRunLayer();
|
Config::ClearCurrentRunLayer();
|
||||||
Config::RemoveLayer(Config::LayerType::Movie);
|
Config::RemoveLayer(Config::LayerType::Movie);
|
||||||
Config::RemoveLayer(Config::LayerType::Netplay);
|
Config::RemoveLayer(Config::LayerType::Netplay);
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <functional>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -29,7 +30,7 @@
|
|||||||
|
|
||||||
namespace ConfigLoaders
|
namespace ConfigLoaders
|
||||||
{
|
{
|
||||||
void SaveToSYSCONF(Config::LayerType layer)
|
void SaveToSYSCONF(Config::LayerType layer, std::function<bool(const Config::Location&)> predicate)
|
||||||
{
|
{
|
||||||
if (Core::IsRunning())
|
if (Core::IsRunning())
|
||||||
return;
|
return;
|
||||||
@ -40,7 +41,10 @@ void SaveToSYSCONF(Config::LayerType layer)
|
|||||||
for (const Config::SYSCONFSetting& setting : Config::SYSCONF_SETTINGS)
|
for (const Config::SYSCONFSetting& setting : Config::SYSCONF_SETTINGS)
|
||||||
{
|
{
|
||||||
std::visit(
|
std::visit(
|
||||||
[layer, &setting, &sysconf](auto* info) {
|
[&](auto* info) {
|
||||||
|
if (predicate && !predicate(info->GetLocation()))
|
||||||
|
return;
|
||||||
|
|
||||||
const std::string key = info->GetLocation().section + "." + info->GetLocation().key;
|
const std::string key = info->GetLocation().section + "." + info->GetLocation().key;
|
||||||
|
|
||||||
if (setting.type == SysConf::Entry::Type::Long)
|
if (setting.type == SysConf::Entry::Type::Long)
|
||||||
|
@ -4,16 +4,19 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace Config
|
namespace Config
|
||||||
{
|
{
|
||||||
class ConfigLayerLoader;
|
class ConfigLayerLoader;
|
||||||
enum class LayerType;
|
enum class LayerType;
|
||||||
|
struct Location;
|
||||||
} // namespace Config
|
} // namespace Config
|
||||||
|
|
||||||
namespace ConfigLoaders
|
namespace ConfigLoaders
|
||||||
{
|
{
|
||||||
void SaveToSYSCONF(Config::LayerType layer);
|
void SaveToSYSCONF(Config::LayerType layer,
|
||||||
|
std::function<bool(const Config::Location&)> predicate = {});
|
||||||
std::unique_ptr<Config::ConfigLayerLoader> GenerateBaseConfigLoader();
|
std::unique_ptr<Config::ConfigLayerLoader> GenerateBaseConfigLoader();
|
||||||
} // namespace ConfigLoaders
|
} // namespace ConfigLoaders
|
||||||
|
@ -590,7 +590,7 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Initialise Wii filesystem contents.
|
// Initialise Wii filesystem contents.
|
||||||
// This is done here after Boot and not in HW to ensure that we operate
|
// This is done here after Boot and not in BootManager to ensure that we operate
|
||||||
// with the correct title context since save copying requires title directories to exist.
|
// with the correct title context since save copying requires title directories to exist.
|
||||||
Common::ScopeGuard wiifs_guard{&Core::CleanUpWiiFileSystemContents};
|
Common::ScopeGuard wiifs_guard{&Core::CleanUpWiiFileSystemContents};
|
||||||
if (SConfig::GetInstance().bWii)
|
if (SConfig::GetInstance().bWii)
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include "Core/HW/WII_IPC.h"
|
#include "Core/HW/WII_IPC.h"
|
||||||
#include "Core/IOS/IOS.h"
|
#include "Core/IOS/IOS.h"
|
||||||
#include "Core/State.h"
|
#include "Core/State.h"
|
||||||
#include "Core/WiiRoot.h"
|
|
||||||
|
|
||||||
namespace HW
|
namespace HW
|
||||||
{
|
{
|
||||||
@ -52,8 +51,6 @@ void Init()
|
|||||||
|
|
||||||
if (SConfig::GetInstance().bWii)
|
if (SConfig::GetInstance().bWii)
|
||||||
{
|
{
|
||||||
// The NAND should only be initialised once per emulation session.
|
|
||||||
Core::InitializeWiiRoot(Core::WantsDeterminism());
|
|
||||||
IOS::Init();
|
IOS::Init();
|
||||||
IOS::HLE::Init(); // Depends on Memory
|
IOS::HLE::Init(); // Depends on Memory
|
||||||
}
|
}
|
||||||
@ -64,7 +61,6 @@ void Shutdown()
|
|||||||
// IOS should always be shut down regardless of bWii because it can be running in GC mode (MIOS).
|
// IOS should always be shut down regardless of bWii because it can be running in GC mode (MIOS).
|
||||||
IOS::HLE::Shutdown(); // Depends on Memory
|
IOS::HLE::Shutdown(); // Depends on Memory
|
||||||
IOS::Shutdown();
|
IOS::Shutdown();
|
||||||
Core::ShutdownWiiRoot();
|
|
||||||
|
|
||||||
SystemTimers::Shutdown();
|
SystemTimers::Shutdown();
|
||||||
CPU::Shutdown();
|
CPU::Shutdown();
|
||||||
|
@ -202,13 +202,18 @@ void InitializeWiiRoot(bool use_temporary)
|
|||||||
|
|
||||||
void ShutdownWiiRoot()
|
void ShutdownWiiRoot()
|
||||||
{
|
{
|
||||||
if (!s_temp_wii_root.empty())
|
if (WiiRootIsTemporary())
|
||||||
{
|
{
|
||||||
File::DeleteDirRecursively(s_temp_wii_root);
|
File::DeleteDirRecursively(s_temp_wii_root);
|
||||||
s_temp_wii_root.clear();
|
s_temp_wii_root.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WiiRootIsTemporary()
|
||||||
|
{
|
||||||
|
return !s_temp_wii_root.empty();
|
||||||
|
}
|
||||||
|
|
||||||
void BackupWiiSettings()
|
void BackupWiiSettings()
|
||||||
{
|
{
|
||||||
// Back up files which Dolphin can modify at boot, so that we can preserve the original contents.
|
// Back up files which Dolphin can modify at boot, so that we can preserve the original contents.
|
||||||
@ -282,7 +287,7 @@ void InitializeWiiFileSystemContents()
|
|||||||
if (!CopySysmenuFilesToFS(fs.get(), File::GetSysDirectory() + WII_USER_DIR, ""))
|
if (!CopySysmenuFilesToFS(fs.get(), File::GetSysDirectory() + WII_USER_DIR, ""))
|
||||||
WARN_LOG_FMT(CORE, "Failed to copy initial System Menu files to the NAND");
|
WARN_LOG_FMT(CORE, "Failed to copy initial System Menu files to the NAND");
|
||||||
|
|
||||||
if (s_temp_wii_root.empty())
|
if (!WiiRootIsTemporary())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Generate a SYSCONF with default settings for the temporary Wii NAND.
|
// Generate a SYSCONF with default settings for the temporary Wii NAND.
|
||||||
@ -294,7 +299,7 @@ void InitializeWiiFileSystemContents()
|
|||||||
|
|
||||||
void CleanUpWiiFileSystemContents()
|
void CleanUpWiiFileSystemContents()
|
||||||
{
|
{
|
||||||
if (s_temp_wii_root.empty() || !SConfig::GetInstance().bEnableMemcardSdWriting ||
|
if (!WiiRootIsTemporary() || !SConfig::GetInstance().bEnableMemcardSdWriting ||
|
||||||
NetPlay::GetWiiSyncFS())
|
NetPlay::GetWiiSyncFS())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -15,6 +15,8 @@ enum class RestoreReason
|
|||||||
void InitializeWiiRoot(bool use_temporary);
|
void InitializeWiiRoot(bool use_temporary);
|
||||||
void ShutdownWiiRoot();
|
void ShutdownWiiRoot();
|
||||||
|
|
||||||
|
bool WiiRootIsTemporary();
|
||||||
|
|
||||||
void BackupWiiSettings();
|
void BackupWiiSettings();
|
||||||
void RestoreWiiSettings(RestoreReason reason);
|
void RestoreWiiSettings(RestoreReason reason);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user