yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

Merge pull request #2331 from lioncash/cache

yuzu/main: Minor adjustments to OnTransferableShaderCacheOpenFile()
This commit is contained in:
bunnei 2019-04-04 22:35:53 -04:00 committed by GitHub
commit 9959c95966
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 9 deletions

View File

@ -1090,31 +1090,28 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
void GMainWindow::OnTransferableShaderCacheOpenFile(u64 program_id) { void GMainWindow::OnTransferableShaderCacheOpenFile(u64 program_id) {
ASSERT(program_id != 0); ASSERT(program_id != 0);
constexpr char open_target[] = "Transferable Shader Cache";
const QString tranferable_shader_cache_folder_path = const QString tranferable_shader_cache_folder_path =
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::ShaderDir)) + "opengl" + QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::ShaderDir)) + "opengl" +
DIR_SEP + "transferable"; DIR_SEP + "transferable";
const QString transferable_shader_cache_file_path = const QString transferable_shader_cache_file_path =
tranferable_shader_cache_folder_path + DIR_SEP + tranferable_shader_cache_folder_path + DIR_SEP +
QString::fromStdString(fmt::format("{:016X}", program_id)) + ".bin"; QString::fromStdString(fmt::format("{:016X}.bin", program_id));
if (!QFile(transferable_shader_cache_file_path).exists()) { if (!QFile::exists(transferable_shader_cache_file_path)) {
QMessageBox::warning(this, QMessageBox::warning(this, tr("Error Opening Transferable Shader Cache"),
tr("Error Opening %1 File").arg(QString::fromStdString(open_target)), tr("A shader cache for this title does not exist."));
tr("File does not exist!"));
return; return;
} }
LOG_INFO(Frontend, "Opening {} path for program_id={:016x}", open_target, program_id);
// Windows supports opening a folder with selecting a specified file in explorer. On every other // Windows supports opening a folder with selecting a specified file in explorer. On every other
// OS we just open the transferable shader cache folder without preselecting the transferable // OS we just open the transferable shader cache folder without preselecting the transferable
// shader cache file for the selected game. // shader cache file for the selected game.
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
const QString explorer = "explorer"; const QString explorer = QStringLiteral("explorer");
QStringList param; QStringList param;
if (!QFileInfo(transferable_shader_cache_file_path).isDir()) { if (!QFileInfo(transferable_shader_cache_file_path).isDir()) {
param << QLatin1String("/select,"); param << QStringLiteral("/select,");
} }
param << QDir::toNativeSeparators(transferable_shader_cache_file_path); param << QDir::toNativeSeparators(transferable_shader_cache_file_path);
QProcess::startDetached(explorer, param); QProcess::startDetached(explorer, param);