summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar unknown2019-02-08 09:05:51 +0100
committerGravatar unknown2019-02-08 09:05:51 +0100
commit9d411699d86538c21255642a2adecbace1ce33fc (patch)
treeec781afef0437c6b956599a4514cecfb8ac97f96
parentMerge pull request #2083 from ReinUsesLisp/shader-ir-cbuf-tracking (diff)
downloadyuzu-9d411699d86538c21255642a2adecbace1ce33fc.tar.gz
yuzu-9d411699d86538c21255642a2adecbace1ce33fc.tar.xz
yuzu-9d411699d86538c21255642a2adecbace1ce33fc.zip
frontend: Open transferable shader cache for a selected game in the gamelist
Diffstat (limited to '')
-rw-r--r--src/yuzu/game_list.cpp4
-rw-r--r--src/yuzu/game_list.h1
-rw-r--r--src/yuzu/main.cpp44
-rw-r--r--src/yuzu/main.h1
4 files changed, 50 insertions, 0 deletions
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index c0e3c5fa9..4422a572b 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -329,6 +329,8 @@ void GameList::PopupContextMenu(const QPoint& menu_location) {
329 QMenu context_menu; 329 QMenu context_menu;
330 QAction* open_save_location = context_menu.addAction(tr("Open Save Data Location")); 330 QAction* open_save_location = context_menu.addAction(tr("Open Save Data Location"));
331 QAction* open_lfs_location = context_menu.addAction(tr("Open Mod Data Location")); 331 QAction* open_lfs_location = context_menu.addAction(tr("Open Mod Data Location"));
332 QAction* open_transferable_shader_cache =
333 context_menu.addAction(tr("Open Transferable Shader Cache"));
332 context_menu.addSeparator(); 334 context_menu.addSeparator();
333 QAction* dump_romfs = context_menu.addAction(tr("Dump RomFS")); 335 QAction* dump_romfs = context_menu.addAction(tr("Dump RomFS"));
334 QAction* copy_tid = context_menu.addAction(tr("Copy Title ID to Clipboard")); 336 QAction* copy_tid = context_menu.addAction(tr("Copy Title ID to Clipboard"));
@@ -344,6 +346,8 @@ void GameList::PopupContextMenu(const QPoint& menu_location) {
344 [&]() { emit OpenFolderRequested(program_id, GameListOpenTarget::SaveData); }); 346 [&]() { emit OpenFolderRequested(program_id, GameListOpenTarget::SaveData); });
345 connect(open_lfs_location, &QAction::triggered, 347 connect(open_lfs_location, &QAction::triggered,
346 [&]() { emit OpenFolderRequested(program_id, GameListOpenTarget::ModData); }); 348 [&]() { emit OpenFolderRequested(program_id, GameListOpenTarget::ModData); });
349 connect(open_transferable_shader_cache, &QAction::triggered,
350 [&]() { emit OpenTransferableShaderCacheRequested(program_id); });
347 connect(dump_romfs, &QAction::triggered, [&]() { emit DumpRomFSRequested(program_id, path); }); 351 connect(dump_romfs, &QAction::triggered, [&]() { emit DumpRomFSRequested(program_id, path); });
348 connect(copy_tid, &QAction::triggered, [&]() { emit CopyTIDRequested(program_id); }); 352 connect(copy_tid, &QAction::triggered, [&]() { emit CopyTIDRequested(program_id); });
349 connect(navigate_to_gamedb_entry, &QAction::triggered, 353 connect(navigate_to_gamedb_entry, &QAction::triggered,
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h
index b317eb2fc..8ea5cbaaa 100644
--- a/src/yuzu/game_list.h
+++ b/src/yuzu/game_list.h
@@ -66,6 +66,7 @@ signals:
66 void GameChosen(QString game_path); 66 void GameChosen(QString game_path);
67 void ShouldCancelWorker(); 67 void ShouldCancelWorker();
68 void OpenFolderRequested(u64 program_id, GameListOpenTarget target); 68 void OpenFolderRequested(u64 program_id, GameListOpenTarget target);
69 void OpenTransferableShaderCacheRequested(u64 program_id);
69 void DumpRomFSRequested(u64 program_id, const std::string& game_path); 70 void DumpRomFSRequested(u64 program_id, const std::string& game_path);
70 void CopyTIDRequested(u64 program_id); 71 void CopyTIDRequested(u64 program_id);
71 void NavigateToGamedbEntryRequested(u64 program_id, 72 void NavigateToGamedbEntryRequested(u64 program_id,
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 1d460c189..b1df2760d 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -632,6 +632,8 @@ void GMainWindow::RestoreUIState() {
632void GMainWindow::ConnectWidgetEvents() { 632void GMainWindow::ConnectWidgetEvents() {
633 connect(game_list, &GameList::GameChosen, this, &GMainWindow::OnGameListLoadFile); 633 connect(game_list, &GameList::GameChosen, this, &GMainWindow::OnGameListLoadFile);
634 connect(game_list, &GameList::OpenFolderRequested, this, &GMainWindow::OnGameListOpenFolder); 634 connect(game_list, &GameList::OpenFolderRequested, this, &GMainWindow::OnGameListOpenFolder);
635 connect(game_list, &GameList::OpenTransferableShaderCacheRequested, this,
636 &GMainWindow::OnTransferableShaderCacheOpenFile);
635 connect(game_list, &GameList::DumpRomFSRequested, this, &GMainWindow::OnGameListDumpRomFS); 637 connect(game_list, &GameList::DumpRomFSRequested, this, &GMainWindow::OnGameListDumpRomFS);
636 connect(game_list, &GameList::CopyTIDRequested, this, &GMainWindow::OnGameListCopyTID); 638 connect(game_list, &GameList::CopyTIDRequested, this, &GMainWindow::OnGameListCopyTID);
637 connect(game_list, &GameList::NavigateToGamedbEntryRequested, this, 639 connect(game_list, &GameList::NavigateToGamedbEntryRequested, this,
@@ -1066,6 +1068,48 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
1066 QDesktopServices::openUrl(QUrl::fromLocalFile(qpath)); 1068 QDesktopServices::openUrl(QUrl::fromLocalFile(qpath));
1067} 1069}
1068 1070
1071void GMainWindow::OnTransferableShaderCacheOpenFile(u64 program_id) {
1072 ASSERT(program_id != 0);
1073
1074 std::string transferable_shader_cache_file_path;
1075 const std::string open_target = "Transferable Shader Cache";
1076 const std::string tranferable_shader_cache_folder =
1077 FileUtil::GetUserPath(FileUtil::UserPath::ShaderDir) + "opengl" + DIR_SEP "transferable";
1078
1079 transferable_shader_cache_file_path.append(tranferable_shader_cache_folder);
1080 transferable_shader_cache_file_path.append(DIR_SEP);
1081 transferable_shader_cache_file_path.append(fmt::format("{:016X}", program_id));
1082 transferable_shader_cache_file_path.append(".bin");
1083
1084 const QString qpath_transferable_shader_cache_file =
1085 QString::fromStdString(transferable_shader_cache_file_path);
1086
1087 const QFile qfile(qpath_transferable_shader_cache_file);
1088 if (!qfile.exists()) {
1089 QMessageBox::warning(this,
1090 tr("Error Opening %1 File").arg(QString::fromStdString(open_target)),
1091 tr("File does not exist!"));
1092 return;
1093 }
1094 LOG_INFO(Frontend, "Opening {} path for program_id={:016x}", open_target, program_id);
1095
1096 // Windows supports opening a folder with selecting a specified file in explorer. On every other
1097 // OS we just open the transferable shader cache folder without preselecting the transferable
1098 // shader cache file for the selected game.
1099#if defined(Q_OS_WIN)
1100 const QString explorer = "explorer";
1101 QStringList param;
1102 if (!QFileInfo(qpath_transferable_shader_cache_file).isDir())
1103 param << QLatin1String("/select,");
1104 param << QDir::toNativeSeparators(qpath_transferable_shader_cache_file);
1105 QProcess::startDetached(explorer, param);
1106#else
1107 const QString qpath_transferable_shader_cache_folder =
1108 QString::fromStdString(tranferable_shader_cache_folder);
1109 QDesktopServices::openUrl(QUrl::fromLocalFile(qpath_transferable_shader_cache_folder));
1110#endif
1111}
1112
1069static std::size_t CalculateRomFSEntrySize(const FileSys::VirtualDir& dir, bool full) { 1113static std::size_t CalculateRomFSEntrySize(const FileSys::VirtualDir& dir, bool full) {
1070 std::size_t out = 0; 1114 std::size_t out = 0;
1071 1115
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index e07c892cf..7f3aa998e 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -176,6 +176,7 @@ private slots:
176 /// Called whenever a user selects a game in the game list widget. 176 /// Called whenever a user selects a game in the game list widget.
177 void OnGameListLoadFile(QString game_path); 177 void OnGameListLoadFile(QString game_path);
178 void OnGameListOpenFolder(u64 program_id, GameListOpenTarget target); 178 void OnGameListOpenFolder(u64 program_id, GameListOpenTarget target);
179 void OnTransferableShaderCacheOpenFile(u64 program_id);
179 void OnGameListDumpRomFS(u64 program_id, const std::string& game_path); 180 void OnGameListDumpRomFS(u64 program_id, const std::string& game_path);
180 void OnGameListCopyTID(u64 program_id); 181 void OnGameListCopyTID(u64 program_id);
181 void OnGameListNavigateToGamedbEntry(u64 program_id, 182 void OnGameListNavigateToGamedbEntry(u64 program_id,