diff options
| author | 2023-05-26 23:21:18 -0400 | |
|---|---|---|
| committer | 2023-05-26 23:29:44 -0400 | |
| commit | fcd48eb239df4be823bd37b3cf373b87263e5810 (patch) | |
| tree | 02fa9717f0966a8eb4235992115ee747d3c71353 /src | |
| parent | Merge pull request #10414 from liamwhite/anv-push-descriptor (diff) | |
| download | yuzu-fcd48eb239df4be823bd37b3cf373b87263e5810.tar.gz yuzu-fcd48eb239df4be823bd37b3cf373b87263e5810.tar.xz yuzu-fcd48eb239df4be823bd37b3cf373b87263e5810.zip | |
qt: add menu item to remove cache storage
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/game_list.cpp | 4 | ||||
| -rw-r--r-- | src/yuzu/game_list.h | 1 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 20 | ||||
| -rw-r--r-- | src/yuzu/main.h | 1 |
4 files changed, 26 insertions, 0 deletions
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index c21828b1d..465084fea 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp | |||
| @@ -544,6 +544,7 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::stri | |||
| 544 | QAction* remove_update = remove_menu->addAction(tr("Remove Installed Update")); | 544 | QAction* remove_update = remove_menu->addAction(tr("Remove Installed Update")); |
| 545 | QAction* remove_dlc = remove_menu->addAction(tr("Remove All Installed DLC")); | 545 | QAction* remove_dlc = remove_menu->addAction(tr("Remove All Installed DLC")); |
| 546 | QAction* remove_custom_config = remove_menu->addAction(tr("Remove Custom Configuration")); | 546 | QAction* remove_custom_config = remove_menu->addAction(tr("Remove Custom Configuration")); |
| 547 | QAction* remove_cache_storage = remove_menu->addAction(tr("Remove Cache Storage")); | ||
| 547 | QAction* remove_gl_shader_cache = remove_menu->addAction(tr("Remove OpenGL Pipeline Cache")); | 548 | QAction* remove_gl_shader_cache = remove_menu->addAction(tr("Remove OpenGL Pipeline Cache")); |
| 548 | QAction* remove_vk_shader_cache = remove_menu->addAction(tr("Remove Vulkan Pipeline Cache")); | 549 | QAction* remove_vk_shader_cache = remove_menu->addAction(tr("Remove Vulkan Pipeline Cache")); |
| 549 | remove_menu->addSeparator(); | 550 | remove_menu->addSeparator(); |
| @@ -614,6 +615,9 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::stri | |||
| 614 | connect(remove_custom_config, &QAction::triggered, [this, program_id, path]() { | 615 | connect(remove_custom_config, &QAction::triggered, [this, program_id, path]() { |
| 615 | emit RemoveFileRequested(program_id, GameListRemoveTarget::CustomConfiguration, path); | 616 | emit RemoveFileRequested(program_id, GameListRemoveTarget::CustomConfiguration, path); |
| 616 | }); | 617 | }); |
| 618 | connect(remove_cache_storage, &QAction::triggered, [this, program_id, path] { | ||
| 619 | emit RemoveFileRequested(program_id, GameListRemoveTarget::CacheStorage, path); | ||
| 620 | }); | ||
| 617 | connect(dump_romfs, &QAction::triggered, [this, program_id, path]() { | 621 | connect(dump_romfs, &QAction::triggered, [this, program_id, path]() { |
| 618 | emit DumpRomFSRequested(program_id, path, DumpRomFSTarget::Normal); | 622 | emit DumpRomFSRequested(program_id, path, DumpRomFSTarget::Normal); |
| 619 | }); | 623 | }); |
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h index 64e5af4c1..6c2f75e53 100644 --- a/src/yuzu/game_list.h +++ b/src/yuzu/game_list.h | |||
| @@ -45,6 +45,7 @@ enum class GameListRemoveTarget { | |||
| 45 | VkShaderCache, | 45 | VkShaderCache, |
| 46 | AllShaderCache, | 46 | AllShaderCache, |
| 47 | CustomConfiguration, | 47 | CustomConfiguration, |
| 48 | CacheStorage, | ||
| 48 | }; | 49 | }; |
| 49 | 50 | ||
| 50 | enum class DumpRomFSTarget { | 51 | enum class DumpRomFSTarget { |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 4489f43af..25cfef6d5 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -2323,6 +2323,8 @@ void GMainWindow::OnGameListRemoveFile(u64 program_id, GameListRemoveTarget targ | |||
| 2323 | return tr("Delete All Transferable Shader Caches?"); | 2323 | return tr("Delete All Transferable Shader Caches?"); |
| 2324 | case GameListRemoveTarget::CustomConfiguration: | 2324 | case GameListRemoveTarget::CustomConfiguration: |
| 2325 | return tr("Remove Custom Game Configuration?"); | 2325 | return tr("Remove Custom Game Configuration?"); |
| 2326 | case GameListRemoveTarget::CacheStorage: | ||
| 2327 | return tr("Remove Cache Storage?"); | ||
| 2326 | default: | 2328 | default: |
| 2327 | return QString{}; | 2329 | return QString{}; |
| 2328 | } | 2330 | } |
| @@ -2346,6 +2348,9 @@ void GMainWindow::OnGameListRemoveFile(u64 program_id, GameListRemoveTarget targ | |||
| 2346 | case GameListRemoveTarget::CustomConfiguration: | 2348 | case GameListRemoveTarget::CustomConfiguration: |
| 2347 | RemoveCustomConfiguration(program_id, game_path); | 2349 | RemoveCustomConfiguration(program_id, game_path); |
| 2348 | break; | 2350 | break; |
| 2351 | case GameListRemoveTarget::CacheStorage: | ||
| 2352 | RemoveCacheStorage(program_id); | ||
| 2353 | break; | ||
| 2349 | } | 2354 | } |
| 2350 | } | 2355 | } |
| 2351 | 2356 | ||
| @@ -2435,6 +2440,21 @@ void GMainWindow::RemoveCustomConfiguration(u64 program_id, const std::string& g | |||
| 2435 | } | 2440 | } |
| 2436 | } | 2441 | } |
| 2437 | 2442 | ||
| 2443 | void GMainWindow::RemoveCacheStorage(u64 program_id) { | ||
| 2444 | const auto nand_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir); | ||
| 2445 | auto vfs_nand_dir = | ||
| 2446 | vfs->OpenDirectory(Common::FS::PathToUTF8String(nand_dir), FileSys::Mode::Read); | ||
| 2447 | |||
| 2448 | const auto cache_storage_path = FileSys::SaveDataFactory::GetFullPath( | ||
| 2449 | *system, vfs_nand_dir, FileSys::SaveDataSpaceId::NandUser, | ||
| 2450 | FileSys::SaveDataType::CacheStorage, 0 /* program_id */, {}, 0); | ||
| 2451 | |||
| 2452 | const auto path = Common::FS::ConcatPathSafe(nand_dir, cache_storage_path); | ||
| 2453 | |||
| 2454 | // Not an error if it wasn't cleared. | ||
| 2455 | Common::FS::RemoveDirRecursively(path); | ||
| 2456 | } | ||
| 2457 | |||
| 2438 | void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_path, | 2458 | void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_path, |
| 2439 | DumpRomFSTarget target) { | 2459 | DumpRomFSTarget target) { |
| 2440 | const auto failed = [this] { | 2460 | const auto failed = [this] { |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 17631a2d9..6bb70972f 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -370,6 +370,7 @@ private: | |||
| 370 | void RemoveVulkanDriverPipelineCache(u64 program_id); | 370 | void RemoveVulkanDriverPipelineCache(u64 program_id); |
| 371 | void RemoveAllTransferableShaderCaches(u64 program_id); | 371 | void RemoveAllTransferableShaderCaches(u64 program_id); |
| 372 | void RemoveCustomConfiguration(u64 program_id, const std::string& game_path); | 372 | void RemoveCustomConfiguration(u64 program_id, const std::string& game_path); |
| 373 | void RemoveCacheStorage(u64 program_id); | ||
| 373 | std::optional<u64> SelectRomFSDumpTarget(const FileSys::ContentProvider&, u64 program_id); | 374 | std::optional<u64> SelectRomFSDumpTarget(const FileSys::ContentProvider&, u64 program_id); |
| 374 | InstallResult InstallNSPXCI(const QString& filename); | 375 | InstallResult InstallNSPXCI(const QString& filename); |
| 375 | InstallResult InstallNCA(const QString& filename); | 376 | InstallResult InstallNCA(const QString& filename); |