From 0bdeb63894b1bc345b4f6e79cc8c0880dd436816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sun, 1 Oct 2017 12:38:35 +0200 Subject: [PATCH] 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. --- Source/Core/Core/WiiUtils.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Source/Core/Core/WiiUtils.cpp b/Source/Core/Core/WiiUtils.cpp index 4235c9ba96..6667bf80e7 100644 --- a/Source/Core/Core/WiiUtils.cpp +++ b/Source/Core/Core/WiiUtils.cpp @@ -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();