Add more logging around Wii save copying for Netplay.

This commit is contained in:
Admiral H. Curtiss 2022-09-10 04:24:57 +02:00
parent 91b1faa36a
commit 39314ac162
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
2 changed files with 29 additions and 4 deletions

View File

@ -1696,6 +1696,11 @@ bool NetPlayClient::StartGame(const std::string& path)
// boot game
auto boot_session_data = std::make_unique<BootSessionData>();
INFO_LOG_FMT(NETPLAY,
"Setting Wii sync data: has FS {}, sync_titles = {:016x}, redirect folder = {}",
!!m_wii_sync_fs, fmt::join(m_wii_sync_titles, ", "), m_wii_sync_redirect_folder);
boot_session_data->SetWiiSyncData(std::move(m_wii_sync_fs), std::move(m_wii_sync_titles),
std::move(m_wii_sync_redirect_folder), [] {
// on emulation end clean up the Wii save sync directory --

View File

@ -151,8 +151,11 @@ static void InitializeDeterministicWiiSaves(FS::FileSystem* session_fs,
auto& sync_titles = boot_session_data.GetWiiSyncTitles();
if (sync_fs)
{
INFO_LOG_FMT(CORE, "Wii Save Init: Copying from sync_fs to session_fs.");
for (const u64 title : sync_titles)
{
INFO_LOG_FMT(CORE, "Wii Save Init: Copying {0:016x}.", title);
CopySave(sync_fs, session_fs, title);
}
@ -165,15 +168,19 @@ static void InitializeDeterministicWiiSaves(FS::FileSystem* session_fs,
}
else
{
INFO_LOG_FMT(CORE, "Wii Save Init: Copying from configured_fs to session_fs.");
if (NetPlay::IsSyncingAllWiiSaves())
{
for (const u64 title : sync_titles)
{
INFO_LOG_FMT(CORE, "Wii Save Init: Copying {0:016x}.", title);
CopySave(configured_fs.get(), session_fs, title);
}
}
else
{
INFO_LOG_FMT(CORE, "Wii Save Init: Copying {0:016x}.", title_id);
CopySave(configured_fs.get(), session_fs, title_id);
}
@ -375,11 +382,22 @@ void InitializeWiiFileSystemContents(
void CleanUpWiiFileSystemContents(const BootSessionData& boot_session_data)
{
if (!WiiRootIsTemporary() || !Config::Get(Config::SESSION_SAVE_DATA_WRITABLE) ||
boot_session_data.GetWiiSyncFS())
{
const bool wii_root_is_temporary = WiiRootIsTemporary();
const bool session_save_data_writable = Config::Get(Config::SESSION_SAVE_DATA_WRITABLE);
const bool has_wii_sync_fs = !!boot_session_data.GetWiiSyncFS();
const bool cleanup_required =
wii_root_is_temporary && session_save_data_writable && !has_wii_sync_fs;
INFO_LOG_FMT(CORE,
"Wii FS Cleanup: cleanup_required = {} (wii_root_is_temporary = {}, "
"session_save_data_writable = {}, has_wii_sync_fs = {})",
cleanup_required, wii_root_is_temporary, session_save_data_writable,
has_wii_sync_fs);
if (!cleanup_required)
return;
}
INFO_LOG_FMT(CORE, "Wii FS Cleanup: Copying from temporary FS to configured_fs.");
// copy back the temp nand redirected files to where they should normally be redirected to
for (const auto& redirect : s_temp_nand_redirects)
@ -402,6 +420,8 @@ void CleanUpWiiFileSystemContents(const BootSessionData& boot_session_data)
for (const u64 title_id : ios->GetES()->GetInstalledTitles())
{
INFO_LOG_FMT(CORE, "Wii FS Cleanup: Copying {0:016x}.", title_id);
const auto session_save = WiiSave::MakeNandStorage(ios->GetFS().get(), title_id);
// FS won't write the save if the directory doesn't exist