1
0
Fork 0
forked from suyu/suyu

main: Add support for removing SDMC installed titles

This commit is contained in:
Morph 2020-07-20 10:30:56 -04:00
parent ed46f3c62a
commit e59d17167d

View file

@ -1428,16 +1428,15 @@ void GMainWindow::OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryT
RemoveAddOnContent(program_id, entry_type); RemoveAddOnContent(program_id, entry_type);
break; break;
} }
game_list->PopulateAsync(UISettings::values.game_dirs);
FileUtil::DeleteDirRecursively(FileUtil::GetUserPath(FileUtil::UserPath::CacheDir) + DIR_SEP + FileUtil::DeleteDirRecursively(FileUtil::GetUserPath(FileUtil::UserPath::CacheDir) + DIR_SEP +
"game_list"); "game_list");
game_list->PopulateAsync(UISettings::values.game_dirs);
} }
void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) { void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) {
const auto res = Core::System::GetInstance() const auto& fs_controller = Core::System::GetInstance().GetFileSystemController();
.GetFileSystemController() const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(program_id) ||
.GetUserNANDContents() fs_controller.GetSDMCContents()->RemoveExistingEntry(program_id);
->RemoveExistingEntry(program_id);
if (res) { if (res) {
QMessageBox::information(this, tr("Successfully Removed"), 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) { void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type) {
const auto res = Core::System::GetInstance() const auto update_id = program_id | 0x800;
.GetFileSystemController() const auto& fs_controller = Core::System::GetInstance().GetFileSystemController();
.GetUserNANDContents() const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(update_id) ||
->RemoveExistingEntry(program_id | 0x800); fs_controller.GetSDMCContents()->RemoveExistingEntry(update_id);
if (res) { if (res) {
QMessageBox::information(this, tr("Successfully Removed"), 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) { void GMainWindow::RemoveAddOnContent(u64 program_id, const QString& entry_type) {
u32 count{}; u32 count{};
const auto& fs_controller = Core::System::GetInstance().GetFileSystemController();
const auto dlc_entries = Core::System::GetInstance().GetContentProvider().ListEntriesFilter( const auto dlc_entries = Core::System::GetInstance().GetContentProvider().ListEntriesFilter(
FileSys::TitleType::AOC, FileSys::ContentRecordType::Data); FileSys::TitleType::AOC, FileSys::ContentRecordType::Data);
for (const auto& entry : dlc_entries) { for (const auto& entry : dlc_entries) {
if ((entry.title_id & DLC_BASE_TITLE_ID_MASK) == program_id) { if ((entry.title_id & DLC_BASE_TITLE_ID_MASK) == program_id) {
const auto res = Core::System::GetInstance() const auto res =
.GetFileSystemController() fs_controller.GetUserNANDContents()->RemoveExistingEntry(entry.title_id) ||
.GetUserNANDContents() fs_controller.GetSDMCContents()->RemoveExistingEntry(entry.title_id);
->RemoveExistingEntry(entry.title_id);
if (res) { if (res) {
++count; ++count;
} }
@ -1883,9 +1882,9 @@ void GMainWindow::OnMenuInstallToNAND() {
: tr("%n file(s) failed to install\n", "", failed_files.size())); : tr("%n file(s) failed to install\n", "", failed_files.size()));
QMessageBox::information(this, tr("Install Results"), install_results); QMessageBox::information(this, tr("Install Results"), install_results);
game_list->PopulateAsync(UISettings::values.game_dirs);
FileUtil::DeleteDirRecursively(FileUtil::GetUserPath(FileUtil::UserPath::CacheDir) + DIR_SEP + FileUtil::DeleteDirRecursively(FileUtil::GetUserPath(FileUtil::UserPath::CacheDir) + DIR_SEP +
"game_list"); "game_list");
game_list->PopulateAsync(UISettings::values.game_dirs);
ui.action_Install_File_NAND->setEnabled(true); ui.action_Install_File_NAND->setEnabled(true);
} }