WiiUtils: Skip WAD import if it's already installed

The check is fairly quick, and this allows saving a lot of time and
resources for larger WADs.
This commit is contained in:
Léo Lam 2017-10-01 12:38:35 +02:00
parent 5fdb19f3db
commit 0bdeb63894
1 changed files with 9 additions and 0 deletions

View File

@ -113,6 +113,15 @@ bool InstallWAD(const std::string& wad_path)
{
IOS::HLE::Kernel ios;
const DiscIO::WiiWAD wad{wad_path};
if (!wad.GetTMD().IsValid())
return false;
// Skip the install if the WAD is already installed.
const auto installed_contents = ios.GetES()->GetStoredContentsFromTMD(wad.GetTMD());
if (wad.GetTMD().GetContents() == installed_contents)
return true;
const bool result = InstallWAD(ios, wad);
DiscIO::NANDContentManager::Access().ClearCache();