diff options
Diffstat (limited to '')
| -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 | 38 | ||||
| -rw-r--r-- | src/yuzu/main.h | 1 |
4 files changed, 44 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 41ba3c4c6..9efe626d0 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -648,6 +648,8 @@ void GMainWindow::RestoreUIState() { | |||
| 648 | void GMainWindow::ConnectWidgetEvents() { | 648 | void GMainWindow::ConnectWidgetEvents() { |
| 649 | connect(game_list, &GameList::GameChosen, this, &GMainWindow::OnGameListLoadFile); | 649 | connect(game_list, &GameList::GameChosen, this, &GMainWindow::OnGameListLoadFile); |
| 650 | connect(game_list, &GameList::OpenFolderRequested, this, &GMainWindow::OnGameListOpenFolder); | 650 | connect(game_list, &GameList::OpenFolderRequested, this, &GMainWindow::OnGameListOpenFolder); |
| 651 | connect(game_list, &GameList::OpenTransferableShaderCacheRequested, this, | ||
| 652 | &GMainWindow::OnTransferableShaderCacheOpenFile); | ||
| 651 | connect(game_list, &GameList::DumpRomFSRequested, this, &GMainWindow::OnGameListDumpRomFS); | 653 | connect(game_list, &GameList::DumpRomFSRequested, this, &GMainWindow::OnGameListDumpRomFS); |
| 652 | connect(game_list, &GameList::CopyTIDRequested, this, &GMainWindow::OnGameListCopyTID); | 654 | connect(game_list, &GameList::CopyTIDRequested, this, &GMainWindow::OnGameListCopyTID); |
| 653 | connect(game_list, &GameList::NavigateToGamedbEntryRequested, this, | 655 | connect(game_list, &GameList::NavigateToGamedbEntryRequested, this, |
| @@ -1082,6 +1084,42 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target | |||
| 1082 | QDesktopServices::openUrl(QUrl::fromLocalFile(qpath)); | 1084 | QDesktopServices::openUrl(QUrl::fromLocalFile(qpath)); |
| 1083 | } | 1085 | } |
| 1084 | 1086 | ||
| 1087 | void GMainWindow::OnTransferableShaderCacheOpenFile(u64 program_id) { | ||
| 1088 | ASSERT(program_id != 0); | ||
| 1089 | |||
| 1090 | constexpr char open_target[] = "Transferable Shader Cache"; | ||
| 1091 | const QString tranferable_shader_cache_folder_path = | ||
| 1092 | QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::ShaderDir)) + "opengl" + | ||
| 1093 | DIR_SEP + "transferable"; | ||
| 1094 | |||
| 1095 | const QString transferable_shader_cache_file_path = | ||
| 1096 | tranferable_shader_cache_folder_path + DIR_SEP + | ||
| 1097 | QString::fromStdString(fmt::format("{:016X}", program_id)) + ".bin"; | ||
| 1098 | |||
| 1099 | if (!QFile(transferable_shader_cache_file_path).exists()) { | ||
| 1100 | QMessageBox::warning(this, | ||
| 1101 | tr("Error Opening %1 File").arg(QString::fromStdString(open_target)), | ||
| 1102 | tr("File does not exist!")); | ||
| 1103 | return; | ||
| 1104 | } | ||
| 1105 | LOG_INFO(Frontend, "Opening {} path for program_id={:016x}", open_target, program_id); | ||
| 1106 | |||
| 1107 | // Windows supports opening a folder with selecting a specified file in explorer. On every other | ||
| 1108 | // OS we just open the transferable shader cache folder without preselecting the transferable | ||
| 1109 | // shader cache file for the selected game. | ||
| 1110 | #if defined(Q_OS_WIN) | ||
| 1111 | const QString explorer = "explorer"; | ||
| 1112 | QStringList param; | ||
| 1113 | if (!QFileInfo(transferable_shader_cache_file_path).isDir()) { | ||
| 1114 | param << QLatin1String("/select,"); | ||
| 1115 | } | ||
| 1116 | param << QDir::toNativeSeparators(transferable_shader_cache_file_path); | ||
| 1117 | QProcess::startDetached(explorer, param); | ||
| 1118 | #else | ||
| 1119 | QDesktopServices::openUrl(QUrl::fromLocalFile(tranferable_shader_cache_folder_path)); | ||
| 1120 | #endif | ||
| 1121 | } | ||
| 1122 | |||
| 1085 | static std::size_t CalculateRomFSEntrySize(const FileSys::VirtualDir& dir, bool full) { | 1123 | static std::size_t CalculateRomFSEntrySize(const FileSys::VirtualDir& dir, bool full) { |
| 1086 | std::size_t out = 0; | 1124 | std::size_t out = 0; |
| 1087 | 1125 | ||
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, |