Merge pull request #6758 from leoetlino/fs-wiiutils
WiiUtils: Migrate to new filesystem interface
This commit is contained in:
commit
8e3cad948c
|
@ -34,6 +34,7 @@
|
||||||
#include "Core/IOS/Device.h"
|
#include "Core/IOS/Device.h"
|
||||||
#include "Core/IOS/ES/ES.h"
|
#include "Core/IOS/ES/ES.h"
|
||||||
#include "Core/IOS/ES/Formats.h"
|
#include "Core/IOS/ES/Formats.h"
|
||||||
|
#include "Core/IOS/FS/FileSystem.h"
|
||||||
#include "Core/IOS/IOS.h"
|
#include "Core/IOS/IOS.h"
|
||||||
#include "Core/SysConf.h"
|
#include "Core/SysConf.h"
|
||||||
#include "DiscIO/DiscExtractor.h"
|
#include "DiscIO/DiscExtractor.h"
|
||||||
|
@ -168,18 +169,17 @@ bool UninstallTitle(u64 title_id)
|
||||||
|
|
||||||
bool IsTitleInstalled(u64 title_id)
|
bool IsTitleInstalled(u64 title_id)
|
||||||
{
|
{
|
||||||
const std::string content_dir =
|
IOS::HLE::Kernel ios;
|
||||||
Common::GetTitleContentPath(title_id, Common::FromWhichRoot::FROM_CONFIGURED_ROOT);
|
const auto entries = ios.GetFS()->ReadDirectory(0, 0, Common::GetTitleContentPath(title_id));
|
||||||
|
|
||||||
if (!File::IsDirectory(content_dir))
|
if (!entries)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Since this isn't IOS and we only need a simple way to figure out if a title is installed,
|
// Since this isn't IOS and we only need a simple way to figure out if a title is installed,
|
||||||
// we make the (reasonable) assumption that having more than just the TMD in the content
|
// we make the (reasonable) assumption that having more than just the TMD in the content
|
||||||
// directory means that the title is installed.
|
// directory means that the title is installed.
|
||||||
const auto entries = File::ScanDirectoryTree(content_dir, false);
|
return std::any_of(entries->begin(), entries->end(),
|
||||||
return std::any_of(entries.children.begin(), entries.children.end(),
|
[](const std::string& file) { return file != "title.tmd"; });
|
||||||
[](const auto& file) { return file.virtualName != "title.tmd"; });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Common functionality for system updaters.
|
// Common functionality for system updaters.
|
||||||
|
|
|
@ -897,10 +897,12 @@ void GameListCtrl::OnRightClick(wxMouseEvent& event)
|
||||||
auto* const uninstall_wad_item =
|
auto* const uninstall_wad_item =
|
||||||
popupMenu.Append(IDM_LIST_UNINSTALL_WAD, _("Uninstall from the NAND"));
|
popupMenu.Append(IDM_LIST_UNINSTALL_WAD, _("Uninstall from the NAND"));
|
||||||
// These should not be allowed while emulation is running for safety reasons.
|
// These should not be allowed while emulation is running for safety reasons.
|
||||||
for (auto* menu_item : {install_wad_item, uninstall_wad_item})
|
const bool can_enable = !Core::IsRunning() || !SConfig::GetInstance().bWii;
|
||||||
menu_item->Enable(!Core::IsRunning() || !SConfig::GetInstance().bWii);
|
install_wad_item->Enable(can_enable);
|
||||||
|
// IsTitleInstalled should also only be called when nothing is using the NAND.
|
||||||
if (!WiiUtils::IsTitleInstalled(selected_iso->GetTitleID()))
|
if (can_enable)
|
||||||
|
uninstall_wad_item->Enable(WiiUtils::IsTitleInstalled(selected_iso->GetTitleID()));
|
||||||
|
else
|
||||||
uninstall_wad_item->Enable(false);
|
uninstall_wad_item->Enable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue