WiiUtils: Refactor InstallWAD

Allows using an existing instance of IOS and WiiWAD.
This commit is contained in:
Léo Lam 2017-07-04 15:05:09 +02:00
parent bc588948c9
commit 5976d3934d
1 changed files with 11 additions and 4 deletions

View File

@ -38,9 +38,8 @@
namespace WiiUtils namespace WiiUtils
{ {
bool InstallWAD(const std::string& wad_path) bool InstallWAD(IOS::HLE::Kernel& ios, const DiscIO::WiiWAD& wad)
{ {
const DiscIO::WiiWAD wad{wad_path};
if (!wad.IsValid()) if (!wad.IsValid())
{ {
PanicAlertT("WAD installation failed: The selected file is not a valid WAD."); PanicAlertT("WAD installation failed: The selected file is not a valid WAD.");
@ -48,7 +47,6 @@ bool InstallWAD(const std::string& wad_path)
} }
const auto tmd = wad.GetTMD(); const auto tmd = wad.GetTMD();
IOS::HLE::Kernel ios;
const auto es = ios.GetES(); const auto es = ios.GetES();
IOS::HLE::Device::ES::Context context; IOS::HLE::Device::ES::Context context;
@ -99,10 +97,19 @@ bool InstallWAD(const std::string& wad_path)
return false; return false;
} }
DiscIO::NANDContentManager::Access().ClearCache();
return true; return true;
} }
bool InstallWAD(const std::string& wad_path)
{
IOS::HLE::Kernel ios;
const DiscIO::WiiWAD wad{wad_path};
const bool result = InstallWAD(ios, wad);
DiscIO::NANDContentManager::Access().ClearCache();
return result;
}
// Common functionality for system updaters. // Common functionality for system updaters.
class SystemUpdater class SystemUpdater
{ {