|
@@ -1655,9 +1655,9 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
|
|
|
void GMainWindow::OnTransferableShaderCacheOpenFile(u64 program_id) {
|
|
void GMainWindow::OnTransferableShaderCacheOpenFile(u64 program_id) {
|
|
|
const auto shader_cache_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ShaderDir);
|
|
const auto shader_cache_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ShaderDir);
|
|
|
const auto shader_cache_folder_path{shader_cache_dir / fmt::format("{:016x}", program_id)};
|
|
const auto shader_cache_folder_path{shader_cache_dir / fmt::format("{:016x}", program_id)};
|
|
|
- if (!Common::FS::Exists(shader_cache_folder_path)) {
|
|
|
|
|
|
|
+ if (!Common::FS::CreateDirs(shader_cache_folder_path)) {
|
|
|
QMessageBox::warning(this, tr("Error Opening Transferable Shader Cache"),
|
|
QMessageBox::warning(this, tr("Error Opening Transferable Shader Cache"),
|
|
|
- tr("A shader cache for this title does not exist."));
|
|
|
|
|
|
|
+ tr("Filed to create the shader cache directory for this title."));
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
const auto shader_path_string{Common::FS::PathToUTF8String(shader_cache_folder_path)};
|
|
const auto shader_path_string{Common::FS::PathToUTF8String(shader_cache_folder_path)};
|
|
@@ -1805,8 +1805,12 @@ void GMainWindow::OnGameListRemoveFile(u64 program_id, GameListRemoveTarget targ
|
|
|
const std::string& game_path) {
|
|
const std::string& game_path) {
|
|
|
const QString question = [this, target] {
|
|
const QString question = [this, target] {
|
|
|
switch (target) {
|
|
switch (target) {
|
|
|
- case GameListRemoveTarget::ShaderCache:
|
|
|
|
|
- return tr("Delete Transferable Shader Cache?");
|
|
|
|
|
|
|
+ case GameListRemoveTarget::GlShaderCache:
|
|
|
|
|
+ return tr("Delete OpenGL Transferable Shader Cache?");
|
|
|
|
|
+ case GameListRemoveTarget::VkShaderCache:
|
|
|
|
|
+ return tr("Delete Vulkan Transferable Shader Cache?");
|
|
|
|
|
+ case GameListRemoveTarget::AllShaderCache:
|
|
|
|
|
+ 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?");
|
|
|
default:
|
|
default:
|
|
@@ -1820,8 +1824,12 @@ void GMainWindow::OnGameListRemoveFile(u64 program_id, GameListRemoveTarget targ
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
switch (target) {
|
|
switch (target) {
|
|
|
- case GameListRemoveTarget::ShaderCache:
|
|
|
|
|
- RemoveTransferableShaderCache(program_id);
|
|
|
|
|
|
|
+ case GameListRemoveTarget::GlShaderCache:
|
|
|
|
|
+ case GameListRemoveTarget::VkShaderCache:
|
|
|
|
|
+ RemoveTransferableShaderCache(program_id, target);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case GameListRemoveTarget::AllShaderCache:
|
|
|
|
|
+ RemoveAllTransferableShaderCaches(program_id);
|
|
|
break;
|
|
break;
|
|
|
case GameListRemoveTarget::CustomConfiguration:
|
|
case GameListRemoveTarget::CustomConfiguration:
|
|
|
RemoveCustomConfiguration(program_id, game_path);
|
|
RemoveCustomConfiguration(program_id, game_path);
|
|
@@ -1829,18 +1837,27 @@ void GMainWindow::OnGameListRemoveFile(u64 program_id, GameListRemoveTarget targ
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void GMainWindow::RemoveTransferableShaderCache(u64 program_id) {
|
|
|
|
|
|
|
+void GMainWindow::RemoveTransferableShaderCache(u64 program_id, GameListRemoveTarget target) {
|
|
|
|
|
+ const auto target_file_name = [target] {
|
|
|
|
|
+ switch (target) {
|
|
|
|
|
+ case GameListRemoveTarget::GlShaderCache:
|
|
|
|
|
+ return "opengl.bin";
|
|
|
|
|
+ case GameListRemoveTarget::VkShaderCache:
|
|
|
|
|
+ return "vulkan.bin";
|
|
|
|
|
+ default:
|
|
|
|
|
+ return "";
|
|
|
|
|
+ }
|
|
|
|
|
+ }();
|
|
|
const auto shader_cache_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ShaderDir);
|
|
const auto shader_cache_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ShaderDir);
|
|
|
- const auto transferable_shader_cache_file_path =
|
|
|
|
|
- shader_cache_dir / "opengl" / "transferable" / fmt::format("{:016X}.bin", program_id);
|
|
|
|
|
|
|
+ const auto shader_cache_folder_path = shader_cache_dir / fmt::format("{:016x}", program_id);
|
|
|
|
|
+ const auto target_file = shader_cache_folder_path / target_file_name;
|
|
|
|
|
|
|
|
- if (!Common::FS::Exists(transferable_shader_cache_file_path)) {
|
|
|
|
|
|
|
+ if (!Common::FS::Exists(target_file)) {
|
|
|
QMessageBox::warning(this, tr("Error Removing Transferable Shader Cache"),
|
|
QMessageBox::warning(this, tr("Error Removing Transferable Shader Cache"),
|
|
|
tr("A shader cache for this title does not exist."));
|
|
tr("A shader cache for this title does not exist."));
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- if (Common::FS::RemoveFile(transferable_shader_cache_file_path)) {
|
|
|
|
|
|
|
+ if (Common::FS::RemoveFile(target_file)) {
|
|
|
QMessageBox::information(this, tr("Successfully Removed"),
|
|
QMessageBox::information(this, tr("Successfully Removed"),
|
|
|
tr("Successfully removed the transferable shader cache."));
|
|
tr("Successfully removed the transferable shader cache."));
|
|
|
} else {
|
|
} else {
|
|
@@ -1849,6 +1866,24 @@ void GMainWindow::RemoveTransferableShaderCache(u64 program_id) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+void GMainWindow::RemoveAllTransferableShaderCaches(u64 program_id) {
|
|
|
|
|
+ const auto shader_cache_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ShaderDir);
|
|
|
|
|
+ const auto program_shader_cache_dir = shader_cache_dir / fmt::format("{:016x}", program_id);
|
|
|
|
|
+
|
|
|
|
|
+ if (!Common::FS::Exists(program_shader_cache_dir)) {
|
|
|
|
|
+ QMessageBox::warning(this, tr("Error Removing Transferable Shader Caches"),
|
|
|
|
|
+ tr("A shader cache for this title does not exist."));
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (Common::FS::RemoveDirRecursively(program_shader_cache_dir)) {
|
|
|
|
|
+ QMessageBox::information(this, tr("Successfully Removed"),
|
|
|
|
|
+ tr("Successfully removed the transferable shader caches."));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ QMessageBox::warning(this, tr("Error Removing Transferable Shader Caches"),
|
|
|
|
|
+ tr("Failed to remove the transferable shader cache directory."));
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
void GMainWindow::RemoveCustomConfiguration(u64 program_id, const std::string& game_path) {
|
|
void GMainWindow::RemoveCustomConfiguration(u64 program_id, const std::string& game_path) {
|
|
|
const auto file_path = std::filesystem::path(Common::FS::ToU8String(game_path));
|
|
const auto file_path = std::filesystem::path(Common::FS::ToU8String(game_path));
|
|
|
const auto config_file_name =
|
|
const auto config_file_name =
|