WiiSave: In Import(), make sure the TMD exists or can be reinstalled before allowing save to be imported.

This commit is contained in:
Admiral H. Curtiss 2020-12-31 19:33:48 +01:00
parent 46e4c17db3
commit 700d53e00f

View File

@ -40,6 +40,7 @@
#include "Core/IOS/IOS.h"
#include "Core/IOS/IOSC.h"
#include "Core/IOS/Uids.h"
#include "Core/WiiUtils.h"
namespace WiiSave
{
@ -475,6 +476,14 @@ bool Import(const std::string& data_bin_path, std::function<bool()> can_overwrit
ERROR_LOG_FMT(CORE, "WiiSave::Import: Failed to read header");
return false;
}
if (!WiiUtils::EnsureTMDIsImported(*ios.GetFS(), *ios.GetES(), header->tid))
{
ERROR_LOG_FMT(CORE, "WiiSave::Import: Failed to find or import TMD for title {:16x}",
header->tid);
return false;
}
const auto nand = MakeNandStorage(ios.GetFS().get(), header->tid);
if (nand->SaveExists() && !can_overwrite())
return false;