summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/yuzu/game_list.cpp14
-rw-r--r--src/yuzu/game_list.h4
-rw-r--r--src/yuzu/main.cpp59
-rw-r--r--src/yuzu/main.h3
4 files changed, 64 insertions, 16 deletions
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index 76c063c97..f746bd85d 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -520,9 +520,11 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::stri
520 QMenu* remove_menu = context_menu.addMenu(tr("Remove")); 520 QMenu* remove_menu = context_menu.addMenu(tr("Remove"));
521 QAction* remove_update = remove_menu->addAction(tr("Remove Installed Update")); 521 QAction* remove_update = remove_menu->addAction(tr("Remove Installed Update"));
522 QAction* remove_dlc = remove_menu->addAction(tr("Remove All Installed DLC")); 522 QAction* remove_dlc = remove_menu->addAction(tr("Remove All Installed DLC"));
523 QAction* remove_shader_cache = remove_menu->addAction(tr("Remove Shader Cache"));
524 QAction* remove_custom_config = remove_menu->addAction(tr("Remove Custom Configuration")); 523 QAction* remove_custom_config = remove_menu->addAction(tr("Remove Custom Configuration"));
524 QAction* remove_gl_shader_cache = remove_menu->addAction(tr("Remove OpenGL Shader Cache"));
525 QAction* remove_vk_shader_cache = remove_menu->addAction(tr("Remove Vulkan Shader Cache"));
525 remove_menu->addSeparator(); 526 remove_menu->addSeparator();
527 QAction* remove_shader_cache = remove_menu->addAction(tr("Remove All Shader Caches"));
526 QAction* remove_all_content = remove_menu->addAction(tr("Remove All Installed Contents")); 528 QAction* remove_all_content = remove_menu->addAction(tr("Remove All Installed Contents"));
527 QMenu* dump_romfs_menu = context_menu.addMenu(tr("Dump RomFS")); 529 QMenu* dump_romfs_menu = context_menu.addMenu(tr("Dump RomFS"));
528 QAction* dump_romfs = dump_romfs_menu->addAction(tr("Dump RomFS")); 530 QAction* dump_romfs = dump_romfs_menu->addAction(tr("Dump RomFS"));
@@ -540,6 +542,8 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::stri
540 open_transferable_shader_cache->setVisible(program_id != 0); 542 open_transferable_shader_cache->setVisible(program_id != 0);
541 remove_update->setVisible(program_id != 0); 543 remove_update->setVisible(program_id != 0);
542 remove_dlc->setVisible(program_id != 0); 544 remove_dlc->setVisible(program_id != 0);
545 remove_gl_shader_cache->setVisible(program_id != 0);
546 remove_vk_shader_cache->setVisible(program_id != 0);
543 remove_shader_cache->setVisible(program_id != 0); 547 remove_shader_cache->setVisible(program_id != 0);
544 remove_all_content->setVisible(program_id != 0); 548 remove_all_content->setVisible(program_id != 0);
545 auto it = FindMatchingCompatibilityEntry(compatibility_list, program_id); 549 auto it = FindMatchingCompatibilityEntry(compatibility_list, program_id);
@@ -569,8 +573,14 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::stri
569 connect(remove_dlc, &QAction::triggered, [this, program_id]() { 573 connect(remove_dlc, &QAction::triggered, [this, program_id]() {
570 emit RemoveInstalledEntryRequested(program_id, InstalledEntryType::AddOnContent); 574 emit RemoveInstalledEntryRequested(program_id, InstalledEntryType::AddOnContent);
571 }); 575 });
576 connect(remove_gl_shader_cache, &QAction::triggered, [this, program_id, path]() {
577 emit RemoveFileRequested(program_id, GameListRemoveTarget::GlShaderCache, path);
578 });
579 connect(remove_vk_shader_cache, &QAction::triggered, [this, program_id, path]() {
580 emit RemoveFileRequested(program_id, GameListRemoveTarget::VkShaderCache, path);
581 });
572 connect(remove_shader_cache, &QAction::triggered, [this, program_id, path]() { 582 connect(remove_shader_cache, &QAction::triggered, [this, program_id, path]() {
573 emit RemoveFileRequested(program_id, GameListRemoveTarget::ShaderCache, path); 583 emit RemoveFileRequested(program_id, GameListRemoveTarget::AllShaderCache, path);
574 }); 584 });
575 connect(remove_custom_config, &QAction::triggered, [this, program_id, path]() { 585 connect(remove_custom_config, &QAction::triggered, [this, program_id, path]() {
576 emit RemoveFileRequested(program_id, GameListRemoveTarget::CustomConfiguration, path); 586 emit RemoveFileRequested(program_id, GameListRemoveTarget::CustomConfiguration, path);
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h
index c9a9f4654..10339dcca 100644
--- a/src/yuzu/game_list.h
+++ b/src/yuzu/game_list.h
@@ -41,7 +41,9 @@ enum class GameListOpenTarget {
41}; 41};
42 42
43enum class GameListRemoveTarget { 43enum class GameListRemoveTarget {
44 ShaderCache, 44 GlShaderCache,
45 VkShaderCache,
46 AllShaderCache,
45 CustomConfiguration, 47 CustomConfiguration,
46}; 48};
47 49
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 562dfa620..a5159a1ee 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -1655,9 +1655,9 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
1655void GMainWindow::OnTransferableShaderCacheOpenFile(u64 program_id) { 1655void GMainWindow::OnTransferableShaderCacheOpenFile(u64 program_id) {
1656 const auto shader_cache_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ShaderDir); 1656 const auto shader_cache_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ShaderDir);
1657 const auto shader_cache_folder_path{shader_cache_dir / fmt::format("{:016x}", program_id)}; 1657 const auto shader_cache_folder_path{shader_cache_dir / fmt::format("{:016x}", program_id)};
1658 if (!Common::FS::Exists(shader_cache_folder_path)) { 1658 if (!Common::FS::CreateDirs(shader_cache_folder_path)) {
1659 QMessageBox::warning(this, tr("Error Opening Transferable Shader Cache"), 1659 QMessageBox::warning(this, tr("Error Opening Transferable Shader Cache"),
1660 tr("A shader cache for this title does not exist.")); 1660 tr("Filed to create the shader cache directory for this title."));
1661 return; 1661 return;
1662 } 1662 }
1663 const auto shader_path_string{Common::FS::PathToUTF8String(shader_cache_folder_path)}; 1663 const auto shader_path_string{Common::FS::PathToUTF8String(shader_cache_folder_path)};
@@ -1805,8 +1805,12 @@ void GMainWindow::OnGameListRemoveFile(u64 program_id, GameListRemoveTarget targ
1805 const std::string& game_path) { 1805 const std::string& game_path) {
1806 const QString question = [this, target] { 1806 const QString question = [this, target] {
1807 switch (target) { 1807 switch (target) {
1808 case GameListRemoveTarget::ShaderCache: 1808 case GameListRemoveTarget::GlShaderCache:
1809 return tr("Delete Transferable Shader Cache?"); 1809 return tr("Delete OpenGL Transferable Shader Cache?");
1810 case GameListRemoveTarget::VkShaderCache:
1811 return tr("Delete Vulkan Transferable Shader Cache?");
1812 case GameListRemoveTarget::AllShaderCache:
1813 return tr("Delete All Transferable Shader Caches?");
1810 case GameListRemoveTarget::CustomConfiguration: 1814 case GameListRemoveTarget::CustomConfiguration:
1811 return tr("Remove Custom Game Configuration?"); 1815 return tr("Remove Custom Game Configuration?");
1812 default: 1816 default:
@@ -1820,8 +1824,12 @@ void GMainWindow::OnGameListRemoveFile(u64 program_id, GameListRemoveTarget targ
1820 } 1824 }
1821 1825
1822 switch (target) { 1826 switch (target) {
1823 case GameListRemoveTarget::ShaderCache: 1827 case GameListRemoveTarget::GlShaderCache:
1824 RemoveTransferableShaderCache(program_id); 1828 case GameListRemoveTarget::VkShaderCache:
1829 RemoveTransferableShaderCache(program_id, target);
1830 break;
1831 case GameListRemoveTarget::AllShaderCache:
1832 RemoveAllTransferableShaderCaches(program_id);
1825 break; 1833 break;
1826 case GameListRemoveTarget::CustomConfiguration: 1834 case GameListRemoveTarget::CustomConfiguration:
1827 RemoveCustomConfiguration(program_id, game_path); 1835 RemoveCustomConfiguration(program_id, game_path);
@@ -1829,18 +1837,27 @@ void GMainWindow::OnGameListRemoveFile(u64 program_id, GameListRemoveTarget targ
1829 } 1837 }
1830} 1838}
1831 1839
1832void GMainWindow::RemoveTransferableShaderCache(u64 program_id) { 1840void GMainWindow::RemoveTransferableShaderCache(u64 program_id, GameListRemoveTarget target) {
1841 const auto target_file_name = [target] {
1842 switch (target) {
1843 case GameListRemoveTarget::GlShaderCache:
1844 return "opengl.bin";
1845 case GameListRemoveTarget::VkShaderCache:
1846 return "vulkan.bin";
1847 default:
1848 return "";
1849 }
1850 }();
1833 const auto shader_cache_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ShaderDir); 1851 const auto shader_cache_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ShaderDir);
1834 const auto transferable_shader_cache_file_path = 1852 const auto shader_cache_folder_path = shader_cache_dir / fmt::format("{:016x}", program_id);
1835 shader_cache_dir / "opengl" / "transferable" / fmt::format("{:016X}.bin", program_id); 1853 const auto target_file = shader_cache_folder_path / target_file_name;
1836 1854
1837 if (!Common::FS::Exists(transferable_shader_cache_file_path)) { 1855 if (!Common::FS::Exists(target_file)) {
1838 QMessageBox::warning(this, tr("Error Removing Transferable Shader Cache"), 1856 QMessageBox::warning(this, tr("Error Removing Transferable Shader Cache"),
1839 tr("A shader cache for this title does not exist.")); 1857 tr("A shader cache for this title does not exist."));
1840 return; 1858 return;
1841 } 1859 }
1842 1860 if (Common::FS::RemoveFile(target_file)) {
1843 if (Common::FS::RemoveFile(transferable_shader_cache_file_path)) {
1844 QMessageBox::information(this, tr("Successfully Removed"), 1861 QMessageBox::information(this, tr("Successfully Removed"),
1845 tr("Successfully removed the transferable shader cache.")); 1862 tr("Successfully removed the transferable shader cache."));
1846 } else { 1863 } else {
@@ -1849,6 +1866,24 @@ void GMainWindow::RemoveTransferableShaderCache(u64 program_id) {
1849 } 1866 }
1850} 1867}
1851 1868
1869void GMainWindow::RemoveAllTransferableShaderCaches(u64 program_id) {
1870 const auto shader_cache_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ShaderDir);
1871 const auto program_shader_cache_dir = shader_cache_dir / fmt::format("{:016x}", program_id);
1872
1873 if (!Common::FS::Exists(program_shader_cache_dir)) {
1874 QMessageBox::warning(this, tr("Error Removing Transferable Shader Caches"),
1875 tr("A shader cache for this title does not exist."));
1876 return;
1877 }
1878 if (Common::FS::RemoveDirRecursively(program_shader_cache_dir)) {
1879 QMessageBox::information(this, tr("Successfully Removed"),
1880 tr("Successfully removed the transferable shader caches."));
1881 } else {
1882 QMessageBox::warning(this, tr("Error Removing Transferable Shader Caches"),
1883 tr("Failed to remove the transferable shader cache directory."));
1884 }
1885}
1886
1852void GMainWindow::RemoveCustomConfiguration(u64 program_id, const std::string& game_path) { 1887void GMainWindow::RemoveCustomConfiguration(u64 program_id, const std::string& game_path) {
1853 const auto file_path = std::filesystem::path(Common::FS::ToU8String(game_path)); 1888 const auto file_path = std::filesystem::path(Common::FS::ToU8String(game_path));
1854 const auto config_file_name = 1889 const auto config_file_name =
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index a50e5b9fe..3eb6aed56 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -282,7 +282,8 @@ private:
282 void RemoveBaseContent(u64 program_id, const QString& entry_type); 282 void RemoveBaseContent(u64 program_id, const QString& entry_type);
283 void RemoveUpdateContent(u64 program_id, const QString& entry_type); 283 void RemoveUpdateContent(u64 program_id, const QString& entry_type);
284 void RemoveAddOnContent(u64 program_id, const QString& entry_type); 284 void RemoveAddOnContent(u64 program_id, const QString& entry_type);
285 void RemoveTransferableShaderCache(u64 program_id); 285 void RemoveTransferableShaderCache(u64 program_id, GameListRemoveTarget target);
286 void RemoveAllTransferableShaderCaches(u64 program_id);
286 void RemoveCustomConfiguration(u64 program_id, const std::string& game_path); 287 void RemoveCustomConfiguration(u64 program_id, const std::string& game_path);
287 std::optional<u64> SelectRomFSDumpTarget(const FileSys::ContentProvider&, u64 program_id); 288 std::optional<u64> SelectRomFSDumpTarget(const FileSys::ContentProvider&, u64 program_id);
288 InstallResult InstallNSPXCI(const QString& filename); 289 InstallResult InstallNSPXCI(const QString& filename);