qt: add menu item to remove cache storage
This commit is contained in:
parent
d6db422098
commit
fcd48eb239
|
@ -544,6 +544,7 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::stri
|
||||||
QAction* remove_update = remove_menu->addAction(tr("Remove Installed Update"));
|
QAction* remove_update = remove_menu->addAction(tr("Remove Installed Update"));
|
||||||
QAction* remove_dlc = remove_menu->addAction(tr("Remove All Installed DLC"));
|
QAction* remove_dlc = remove_menu->addAction(tr("Remove All Installed DLC"));
|
||||||
QAction* remove_custom_config = remove_menu->addAction(tr("Remove Custom Configuration"));
|
QAction* remove_custom_config = remove_menu->addAction(tr("Remove Custom Configuration"));
|
||||||
|
QAction* remove_cache_storage = remove_menu->addAction(tr("Remove Cache Storage"));
|
||||||
QAction* remove_gl_shader_cache = remove_menu->addAction(tr("Remove OpenGL Pipeline Cache"));
|
QAction* remove_gl_shader_cache = remove_menu->addAction(tr("Remove OpenGL Pipeline Cache"));
|
||||||
QAction* remove_vk_shader_cache = remove_menu->addAction(tr("Remove Vulkan Pipeline Cache"));
|
QAction* remove_vk_shader_cache = remove_menu->addAction(tr("Remove Vulkan Pipeline Cache"));
|
||||||
remove_menu->addSeparator();
|
remove_menu->addSeparator();
|
||||||
|
@ -614,6 +615,9 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::stri
|
||||||
connect(remove_custom_config, &QAction::triggered, [this, program_id, path]() {
|
connect(remove_custom_config, &QAction::triggered, [this, program_id, path]() {
|
||||||
emit RemoveFileRequested(program_id, GameListRemoveTarget::CustomConfiguration, path);
|
emit RemoveFileRequested(program_id, GameListRemoveTarget::CustomConfiguration, path);
|
||||||
});
|
});
|
||||||
|
connect(remove_cache_storage, &QAction::triggered, [this, program_id, path] {
|
||||||
|
emit RemoveFileRequested(program_id, GameListRemoveTarget::CacheStorage, path);
|
||||||
|
});
|
||||||
connect(dump_romfs, &QAction::triggered, [this, program_id, path]() {
|
connect(dump_romfs, &QAction::triggered, [this, program_id, path]() {
|
||||||
emit DumpRomFSRequested(program_id, path, DumpRomFSTarget::Normal);
|
emit DumpRomFSRequested(program_id, path, DumpRomFSTarget::Normal);
|
||||||
});
|
});
|
||||||
|
|
|
@ -45,6 +45,7 @@ enum class GameListRemoveTarget {
|
||||||
VkShaderCache,
|
VkShaderCache,
|
||||||
AllShaderCache,
|
AllShaderCache,
|
||||||
CustomConfiguration,
|
CustomConfiguration,
|
||||||
|
CacheStorage,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class DumpRomFSTarget {
|
enum class DumpRomFSTarget {
|
||||||
|
|
|
@ -2323,6 +2323,8 @@ void GMainWindow::OnGameListRemoveFile(u64 program_id, GameListRemoveTarget targ
|
||||||
return tr("Delete All Transferable Shader Caches?");
|
return tr("Delete All Transferable Shader Caches?");
|
||||||
case GameListRemoveTarget::CustomConfiguration:
|
case GameListRemoveTarget::CustomConfiguration:
|
||||||
return tr("Remove Custom Game Configuration?");
|
return tr("Remove Custom Game Configuration?");
|
||||||
|
case GameListRemoveTarget::CacheStorage:
|
||||||
|
return tr("Remove Cache Storage?");
|
||||||
default:
|
default:
|
||||||
return QString{};
|
return QString{};
|
||||||
}
|
}
|
||||||
|
@ -2346,6 +2348,9 @@ void GMainWindow::OnGameListRemoveFile(u64 program_id, GameListRemoveTarget targ
|
||||||
case GameListRemoveTarget::CustomConfiguration:
|
case GameListRemoveTarget::CustomConfiguration:
|
||||||
RemoveCustomConfiguration(program_id, game_path);
|
RemoveCustomConfiguration(program_id, game_path);
|
||||||
break;
|
break;
|
||||||
|
case GameListRemoveTarget::CacheStorage:
|
||||||
|
RemoveCacheStorage(program_id);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2435,6 +2440,21 @@ void GMainWindow::RemoveCustomConfiguration(u64 program_id, const std::string& g
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GMainWindow::RemoveCacheStorage(u64 program_id) {
|
||||||
|
const auto nand_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir);
|
||||||
|
auto vfs_nand_dir =
|
||||||
|
vfs->OpenDirectory(Common::FS::PathToUTF8String(nand_dir), FileSys::Mode::Read);
|
||||||
|
|
||||||
|
const auto cache_storage_path = FileSys::SaveDataFactory::GetFullPath(
|
||||||
|
*system, vfs_nand_dir, FileSys::SaveDataSpaceId::NandUser,
|
||||||
|
FileSys::SaveDataType::CacheStorage, 0 /* program_id */, {}, 0);
|
||||||
|
|
||||||
|
const auto path = Common::FS::ConcatPathSafe(nand_dir, cache_storage_path);
|
||||||
|
|
||||||
|
// Not an error if it wasn't cleared.
|
||||||
|
Common::FS::RemoveDirRecursively(path);
|
||||||
|
}
|
||||||
|
|
||||||
void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_path,
|
void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_path,
|
||||||
DumpRomFSTarget target) {
|
DumpRomFSTarget target) {
|
||||||
const auto failed = [this] {
|
const auto failed = [this] {
|
||||||
|
|
|
@ -370,6 +370,7 @@ private:
|
||||||
void RemoveVulkanDriverPipelineCache(u64 program_id);
|
void RemoveVulkanDriverPipelineCache(u64 program_id);
|
||||||
void RemoveAllTransferableShaderCaches(u64 program_id);
|
void RemoveAllTransferableShaderCaches(u64 program_id);
|
||||||
void RemoveCustomConfiguration(u64 program_id, const std::string& game_path);
|
void RemoveCustomConfiguration(u64 program_id, const std::string& game_path);
|
||||||
|
void RemoveCacheStorage(u64 program_id);
|
||||||
std::optional<u64> SelectRomFSDumpTarget(const FileSys::ContentProvider&, u64 program_id);
|
std::optional<u64> SelectRomFSDumpTarget(const FileSys::ContentProvider&, u64 program_id);
|
||||||
InstallResult InstallNSPXCI(const QString& filename);
|
InstallResult InstallNSPXCI(const QString& filename);
|
||||||
InstallResult InstallNCA(const QString& filename);
|
InstallResult InstallNCA(const QString& filename);
|
||||||
|
|
Loading…
Reference in New Issue