summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar ameerj2021-06-12 16:57:31 -0400
committerGravatar ameerj2021-07-22 21:51:35 -0400
commit544579926069050d4a9b37c9584705919aab24e8 (patch)
tree3d204c10558311058fc96743b46afee070f1c6e4 /src
parenttmml: Remove index component from coords vec (diff)
downloadyuzu-544579926069050d4a9b37c9584705919aab24e8.tar.gz
yuzu-544579926069050d4a9b37c9584705919aab24e8.tar.xz
yuzu-544579926069050d4a9b37c9584705919aab24e8.zip
main: Fix Open Transferable Shader Cache context item
Opens the new shader cache directory location for the specified title, if it exists.
Diffstat (limited to '')
-rw-r--r--src/yuzu/main.cpp30
1 files changed, 5 insertions, 25 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 7e0b1adc4..562dfa620 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -1654,35 +1654,15 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
1654 1654
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 transferable_shader_cache_folder_path = shader_cache_dir / "opengl" / "transferable"; 1657 const auto shader_cache_folder_path{shader_cache_dir / fmt::format("{:016x}", program_id)};
1658 const auto transferable_shader_cache_file_path = 1658 if (!Common::FS::Exists(shader_cache_folder_path)) {
1659 transferable_shader_cache_folder_path / fmt::format("{:016X}.bin", program_id);
1660
1661 if (!Common::FS::Exists(transferable_shader_cache_file_path)) {
1662 QMessageBox::warning(this, tr("Error Opening Transferable Shader Cache"), 1659 QMessageBox::warning(this, tr("Error Opening Transferable Shader Cache"),
1663 tr("A shader cache for this title does not exist.")); 1660 tr("A shader cache for this title does not exist."));
1664 return; 1661 return;
1665 } 1662 }
1666 1663 const auto shader_path_string{Common::FS::PathToUTF8String(shader_cache_folder_path)};
1667 const auto qt_shader_cache_folder_path = 1664 const auto qt_shader_cache_path = QString::fromStdString(shader_path_string);
1668 QString::fromStdString(Common::FS::PathToUTF8String(transferable_shader_cache_folder_path)); 1665 QDesktopServices::openUrl(QUrl::fromLocalFile(qt_shader_cache_path));
1669 const auto qt_shader_cache_file_path =
1670 QString::fromStdString(Common::FS::PathToUTF8String(transferable_shader_cache_file_path));
1671
1672 // Windows supports opening a folder with selecting a specified file in explorer. On every other
1673 // OS we just open the transferable shader cache folder without preselecting the transferable
1674 // shader cache file for the selected game.
1675#if defined(Q_OS_WIN)
1676 const QString explorer = QStringLiteral("explorer");
1677 QStringList param;
1678 if (!QFileInfo(qt_shader_cache_file_path).isDir()) {
1679 param << QStringLiteral("/select,");
1680 }
1681 param << QDir::toNativeSeparators(qt_shader_cache_file_path);
1682 QProcess::startDetached(explorer, param);
1683#else
1684 QDesktopServices::openUrl(QUrl::fromLocalFile(qt_shader_cache_folder_path));
1685#endif
1686} 1666}
1687 1667
1688static std::size_t CalculateRomFSEntrySize(const FileSys::VirtualDir& dir, bool full) { 1668static std::size_t CalculateRomFSEntrySize(const FileSys::VirtualDir& dir, bool full) {