SysConf: Migrate to new filesystem interface

It was discovered that some titles rely on filesystem metadata to work
properly. Currently, in master they either simply won't find their
save files (for example Bolt) or will complain about the Wii system
memory being corrupted (on first use or every time depending on
the title).

In order to even be able to keep track of file metadata, we first need
to eliminate all direct accesses to the NAND and make all kinds of
operations go through the filesystem code added in PR 6421.

This commit starts the migration process by making SysConf use
the new FS interface.
This commit is contained in:
Léo Lam
2018-03-11 12:05:12 +01:00
parent 3744a6d3f5
commit 0856d4a68a
6 changed files with 44 additions and 28 deletions

View File

@ -22,6 +22,7 @@
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigLoaders/IsSettingSaveable.h"
#include "Core/Core.h"
#include "Core/IOS/IOS.h"
#include "Core/IOS/USB/Bluetooth/BTBase.h"
namespace ConfigLoaders
@ -31,7 +32,8 @@ void SaveToSYSCONF(Config::LayerType layer)
if (Core::IsRunning())
return;
SysConf sysconf{Common::FromWhichRoot::FROM_CONFIGURED_ROOT};
IOS::HLE::Kernel ios;
SysConf sysconf{ios.GetFS()};
for (const Config::SYSCONFSetting& setting : Config::SYSCONF_SETTINGS)
{
@ -154,7 +156,8 @@ private:
if (Core::IsRunning())
return;
SysConf sysconf{Common::FromWhichRoot::FROM_CONFIGURED_ROOT};
IOS::HLE::Kernel ios;
SysConf sysconf{ios.GetFS()};
for (const Config::SYSCONFSetting& setting : Config::SYSCONF_SETTINGS)
{
std::visit(

View File

@ -42,8 +42,7 @@ namespace Device
BluetoothEmu::BluetoothEmu(Kernel& ios, const std::string& device_name)
: BluetoothBase(ios, device_name)
{
SysConf sysconf{Core::WantsDeterminism() ? Common::FromWhichRoot::FROM_SESSION_ROOT :
Common::FromWhichRoot::FROM_CONFIGURED_ROOT};
SysConf sysconf{ios.GetFS()};
if (!Core::WantsDeterminism())
BackUpBTInfoSection(&sysconf);

View File

@ -13,6 +13,7 @@
#include "Common/StringUtil.h"
#include "Common/SysConf.h"
#include "Core/ConfigManager.h"
#include "Core/IOS/IOS.h"
#include "Core/Movie.h"
#include "Core/NetPlayClient.h"
@ -64,7 +65,7 @@ void InitializeWiiRoot(bool use_temporary)
WARN_LOG(IOS_FS, "Using temporary directory %s for minimal Wii FS", s_temp_wii_root.c_str());
File::SetUserPath(D_SESSION_WIIROOT_IDX, s_temp_wii_root);
// Generate a SYSCONF with default settings for the temporary Wii NAND.
SysConf sysconf{Common::FromWhichRoot::FROM_SESSION_ROOT};
SysConf sysconf{IOS::HLE::Kernel{}.GetFS()};
sysconf.Save();
InitializeDeterministicWiiSaves();

View File

@ -136,7 +136,7 @@ bool InstallWAD(IOS::HLE::Kernel& ios, const DiscIO::WiiWAD& wad, InstallType in
}
// Delete a previous temporary title, if it exists.
SysConf sysconf{Common::FROM_SESSION_ROOT};
SysConf sysconf{ios.GetFS()};
SysConf::Entry* tid_entry = sysconf.GetOrAddEntry("IPL.TID", SysConf::Entry::Type::LongLong);
if (const u64 previous_temporary_title_id = Common::swap64(tid_entry->GetData<u64>(0)))
ios.GetES()->DeleteTitleContent(previous_temporary_title_id);