From 5976d3934dd46f79887938c4396f253ece3ec486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Tue, 4 Jul 2017 15:05:09 +0200 Subject: [PATCH] WiiUtils: Refactor InstallWAD Allows using an existing instance of IOS and WiiWAD. --- Source/Core/Core/WiiUtils.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Source/Core/Core/WiiUtils.cpp b/Source/Core/Core/WiiUtils.cpp index aaaacff91b..f023ccda47 100644 --- a/Source/Core/Core/WiiUtils.cpp +++ b/Source/Core/Core/WiiUtils.cpp @@ -38,9 +38,8 @@ 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()) { 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(); - IOS::HLE::Kernel ios; const auto es = ios.GetES(); IOS::HLE::Device::ES::Context context; @@ -99,10 +97,19 @@ bool InstallWAD(const std::string& wad_path) return false; } - DiscIO::NANDContentManager::Access().ClearCache(); 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. class SystemUpdater {