From e59d17167d72a96068b7fd929e11a1cf26ecb809 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Mon, 20 Jul 2020 10:30:56 -0400 Subject: [PATCH] main: Add support for removing SDMC installed titles --- src/yuzu/main.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 08aac9f45b..276658c9e0 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1428,16 +1428,15 @@ void GMainWindow::OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryT RemoveAddOnContent(program_id, entry_type); break; } - game_list->PopulateAsync(UISettings::values.game_dirs); FileUtil::DeleteDirRecursively(FileUtil::GetUserPath(FileUtil::UserPath::CacheDir) + DIR_SEP + "game_list"); + game_list->PopulateAsync(UISettings::values.game_dirs); } void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) { - const auto res = Core::System::GetInstance() - .GetFileSystemController() - .GetUserNANDContents() - ->RemoveExistingEntry(program_id); + const auto& fs_controller = Core::System::GetInstance().GetFileSystemController(); + const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(program_id) || + fs_controller.GetSDMCContents()->RemoveExistingEntry(program_id); if (res) { QMessageBox::information(this, tr("Successfully Removed"), @@ -1450,10 +1449,10 @@ void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) { } void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type) { - const auto res = Core::System::GetInstance() - .GetFileSystemController() - .GetUserNANDContents() - ->RemoveExistingEntry(program_id | 0x800); + const auto update_id = program_id | 0x800; + const auto& fs_controller = Core::System::GetInstance().GetFileSystemController(); + const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(update_id) || + fs_controller.GetSDMCContents()->RemoveExistingEntry(update_id); if (res) { QMessageBox::information(this, tr("Successfully Removed"), @@ -1466,15 +1465,15 @@ void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type) void GMainWindow::RemoveAddOnContent(u64 program_id, const QString& entry_type) { u32 count{}; + const auto& fs_controller = Core::System::GetInstance().GetFileSystemController(); const auto dlc_entries = Core::System::GetInstance().GetContentProvider().ListEntriesFilter( FileSys::TitleType::AOC, FileSys::ContentRecordType::Data); for (const auto& entry : dlc_entries) { if ((entry.title_id & DLC_BASE_TITLE_ID_MASK) == program_id) { - const auto res = Core::System::GetInstance() - .GetFileSystemController() - .GetUserNANDContents() - ->RemoveExistingEntry(entry.title_id); + const auto res = + fs_controller.GetUserNANDContents()->RemoveExistingEntry(entry.title_id) || + fs_controller.GetSDMCContents()->RemoveExistingEntry(entry.title_id); if (res) { ++count; } @@ -1883,9 +1882,9 @@ void GMainWindow::OnMenuInstallToNAND() { : tr("%n file(s) failed to install\n", "", failed_files.size())); QMessageBox::information(this, tr("Install Results"), install_results); - game_list->PopulateAsync(UISettings::values.game_dirs); FileUtil::DeleteDirRecursively(FileUtil::GetUserPath(FileUtil::UserPath::CacheDir) + DIR_SEP + "game_list"); + game_list->PopulateAsync(UISettings::values.game_dirs); ui.action_Install_File_NAND->setEnabled(true); }