citra_qt: Add shader cache options
This commit is contained in:
@@ -26,6 +26,7 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
|
|||||||
ui->graphics_api_combo->setEnabled(not_running);
|
ui->graphics_api_combo->setEnabled(not_running);
|
||||||
ui->toggle_shader_jit->setEnabled(not_running);
|
ui->toggle_shader_jit->setEnabled(not_running);
|
||||||
ui->toggle_disk_shader_cache->setEnabled(hw_renderer_enabled && not_running);
|
ui->toggle_disk_shader_cache->setEnabled(hw_renderer_enabled && not_running);
|
||||||
|
ui->toggle_async_recording->setEnabled(hw_renderer_enabled && not_running);
|
||||||
ui->physical_device_combo->setEnabled(not_running);
|
ui->physical_device_combo->setEnabled(not_running);
|
||||||
SetPhysicalDeviceComboVisibility(ui->graphics_api_combo->currentIndex());
|
SetPhysicalDeviceComboVisibility(ui->graphics_api_combo->currentIndex());
|
||||||
|
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QDir>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QFileSystemWatcher>
|
#include <QFileSystemWatcher>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
@@ -31,6 +32,8 @@
|
|||||||
#include "core/file_sys/archive_extsavedata.h"
|
#include "core/file_sys/archive_extsavedata.h"
|
||||||
#include "core/file_sys/archive_source_sd_savedata.h"
|
#include "core/file_sys/archive_source_sd_savedata.h"
|
||||||
#include "core/hle/service/fs/archive.h"
|
#include "core/hle/service/fs/archive.h"
|
||||||
|
#include "core/settings.h"
|
||||||
|
#include "qcursor.h"
|
||||||
|
|
||||||
GameListSearchField::KeyReleaseEater::KeyReleaseEater(GameList* gamelist, QObject* parent)
|
GameListSearchField::KeyReleaseEater::KeyReleaseEater(GameList* gamelist, QObject* parent)
|
||||||
: QObject(parent), gamelist{gamelist} {}
|
: QObject(parent), gamelist{gamelist} {}
|
||||||
@@ -462,6 +465,7 @@ void GameList::PopupContextMenu(const QPoint& menu_location) {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
context_menu.exec(tree_view->viewport()->mapToGlobal(menu_location));
|
context_menu.exec(tree_view->viewport()->mapToGlobal(menu_location));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -475,19 +479,27 @@ void GameList::AddGamePopup(QMenu& context_menu, const QString& path, u64 progra
|
|||||||
QAction* open_texture_load_location =
|
QAction* open_texture_load_location =
|
||||||
context_menu.addAction(tr("Open Custom Texture Location"));
|
context_menu.addAction(tr("Open Custom Texture Location"));
|
||||||
QAction* open_mods_location = context_menu.addAction(tr("Open Mods Location"));
|
QAction* open_mods_location = context_menu.addAction(tr("Open Mods Location"));
|
||||||
|
QMenu* shader_menu = context_menu.addMenu(tr("Disk Shader Cache"));
|
||||||
QAction* dump_romfs = context_menu.addAction(tr("Dump RomFS"));
|
QAction* dump_romfs = context_menu.addAction(tr("Dump RomFS"));
|
||||||
QAction* navigate_to_gamedb_entry = context_menu.addAction(tr("Navigate to GameDB entry"));
|
QAction* navigate_to_gamedb_entry = context_menu.addAction(tr("Navigate to GameDB entry"));
|
||||||
|
|
||||||
|
QAction* open_shader_cache_location = shader_menu->addAction(tr("Open Shader Cache Location"));
|
||||||
|
shader_menu->addSeparator();
|
||||||
|
QAction* delete_opengl_disk_shader_cache =
|
||||||
|
shader_menu->addAction(tr("Delete OpenGL Shader Cache"));
|
||||||
|
QAction* delete_vulkan_disk_shader_cache =
|
||||||
|
shader_menu->addAction(tr("Delete Vulkan Shader Cache"));
|
||||||
|
|
||||||
const bool is_application =
|
const bool is_application =
|
||||||
0x0004000000000000 <= program_id && program_id <= 0x00040000FFFFFFFF;
|
0x0004000000000000 <= program_id && program_id <= 0x00040000FFFFFFFF;
|
||||||
|
|
||||||
std::string sdmc_dir = FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir);
|
std::string sdmc_dir = FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir);
|
||||||
open_save_location->setVisible(
|
open_save_location->setEnabled(
|
||||||
is_application && FileUtil::Exists(FileSys::ArchiveSource_SDSaveData::GetSaveDataPathFor(
|
is_application && FileUtil::Exists(FileSys::ArchiveSource_SDSaveData::GetSaveDataPathFor(
|
||||||
sdmc_dir, program_id)));
|
sdmc_dir, program_id)));
|
||||||
|
|
||||||
if (extdata_id) {
|
if (extdata_id) {
|
||||||
open_extdata_location->setVisible(
|
open_extdata_location->setEnabled(
|
||||||
is_application &&
|
is_application &&
|
||||||
FileUtil::Exists(FileSys::GetExtDataPathFromId(sdmc_dir, extdata_id)));
|
FileUtil::Exists(FileSys::GetExtDataPathFromId(sdmc_dir, extdata_id)));
|
||||||
} else {
|
} else {
|
||||||
@@ -495,9 +507,9 @@ void GameList::AddGamePopup(QMenu& context_menu, const QString& path, u64 progra
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto media_type = Service::AM::GetTitleMediaType(program_id);
|
auto media_type = Service::AM::GetTitleMediaType(program_id);
|
||||||
open_application_location->setVisible(path.toStdString() ==
|
open_application_location->setEnabled(path.toStdString() ==
|
||||||
Service::AM::GetTitleContentPath(media_type, program_id));
|
Service::AM::GetTitleContentPath(media_type, program_id));
|
||||||
open_update_location->setVisible(
|
open_update_location->setEnabled(
|
||||||
is_application && FileUtil::Exists(Service::AM::GetTitlePath(Service::FS::MediaType::SDMC,
|
is_application && FileUtil::Exists(Service::AM::GetTitlePath(Service::FS::MediaType::SDMC,
|
||||||
program_id + 0xe00000000) +
|
program_id + 0xe00000000) +
|
||||||
"content/"));
|
"content/"));
|
||||||
@@ -536,6 +548,13 @@ void GameList::AddGamePopup(QMenu& context_menu, const QString& path, u64 progra
|
|||||||
emit OpenFolderRequested(program_id, GameListOpenTarget::TEXTURE_LOAD);
|
emit OpenFolderRequested(program_id, GameListOpenTarget::TEXTURE_LOAD);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
connect(open_texture_load_location, &QAction::triggered, this, [this, program_id] {
|
||||||
|
if (FileUtil::CreateFullPath(fmt::format("{}textures/{:016X}/",
|
||||||
|
FileUtil::GetUserPath(FileUtil::UserPath::LoadDir),
|
||||||
|
program_id))) {
|
||||||
|
emit OpenFolderRequested(program_id, GameListOpenTarget::TEXTURE_LOAD);
|
||||||
|
}
|
||||||
|
});
|
||||||
connect(open_mods_location, &QAction::triggered, this, [this, program_id] {
|
connect(open_mods_location, &QAction::triggered, this, [this, program_id] {
|
||||||
if (FileUtil::CreateFullPath(fmt::format("{}mods/{:016X}/",
|
if (FileUtil::CreateFullPath(fmt::format("{}mods/{:016X}/",
|
||||||
FileUtil::GetUserPath(FileUtil::UserPath::LoadDir),
|
FileUtil::GetUserPath(FileUtil::UserPath::LoadDir),
|
||||||
@@ -548,6 +567,26 @@ void GameList::AddGamePopup(QMenu& context_menu, const QString& path, u64 progra
|
|||||||
connect(navigate_to_gamedb_entry, &QAction::triggered, this, [this, program_id]() {
|
connect(navigate_to_gamedb_entry, &QAction::triggered, this, [this, program_id]() {
|
||||||
emit NavigateToGamedbEntryRequested(program_id, compatibility_list);
|
emit NavigateToGamedbEntryRequested(program_id, compatibility_list);
|
||||||
});
|
});
|
||||||
|
connect(open_shader_cache_location, &QAction::triggered, this, [this, program_id] {
|
||||||
|
if (FileUtil::CreateFullPath(FileUtil::GetUserPath(FileUtil::UserPath::ShaderDir))) {
|
||||||
|
emit OpenFolderRequested(program_id, GameListOpenTarget::SHADER_CACHE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
connect(delete_opengl_disk_shader_cache, &QAction::triggered, this, [program_id] {
|
||||||
|
const std::string_view cache_type =
|
||||||
|
Settings::values.separable_shader ? "separable" : "conventional";
|
||||||
|
const std::string path = fmt::format("{}opengl/precompiled/{}/{:016X}.bin",
|
||||||
|
FileUtil::GetUserPath(FileUtil::UserPath::ShaderDir),
|
||||||
|
cache_type, program_id);
|
||||||
|
QFile file{QString::fromStdString(path)};
|
||||||
|
file.remove();
|
||||||
|
});
|
||||||
|
connect(delete_vulkan_disk_shader_cache, &QAction::triggered, this, [] {
|
||||||
|
const std::string path =
|
||||||
|
fmt::format("{}vulkan", FileUtil::GetUserPath(FileUtil::UserPath::ShaderDir));
|
||||||
|
QDir dir{QString::fromStdString(path)};
|
||||||
|
dir.removeRecursively();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
void GameList::AddCustomDirPopup(QMenu& context_menu, QModelIndex selected) {
|
void GameList::AddCustomDirPopup(QMenu& context_menu, QModelIndex selected) {
|
||||||
|
@@ -37,6 +37,7 @@ enum class GameListOpenTarget {
|
|||||||
TEXTURE_DUMP = 4,
|
TEXTURE_DUMP = 4,
|
||||||
TEXTURE_LOAD = 5,
|
TEXTURE_LOAD = 5,
|
||||||
MODS = 6,
|
MODS = 6,
|
||||||
|
SHADER_CACHE = 7
|
||||||
};
|
};
|
||||||
|
|
||||||
class GameList : public QWidget {
|
class GameList : public QWidget {
|
||||||
|
@@ -1340,26 +1340,35 @@ void GMainWindow::OnGameListOpenFolder(u64 data_id, GameListOpenTarget target) {
|
|||||||
path = Service::AM::GetTitlePath(media_type, data_id) + "content/";
|
path = Service::AM::GetTitlePath(media_type, data_id) + "content/";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GameListOpenTarget::UPDATE_DATA:
|
case GameListOpenTarget::UPDATE_DATA: {
|
||||||
open_target = "Update Data";
|
open_target = "Update Data";
|
||||||
path = Service::AM::GetTitlePath(Service::FS::MediaType::SDMC, data_id + 0xe00000000) +
|
path = Service::AM::GetTitlePath(Service::FS::MediaType::SDMC, data_id + 0xe00000000) +
|
||||||
"content/";
|
"content/";
|
||||||
break;
|
break;
|
||||||
case GameListOpenTarget::TEXTURE_DUMP:
|
}
|
||||||
|
case GameListOpenTarget::TEXTURE_DUMP: {
|
||||||
open_target = "Dumped Textures";
|
open_target = "Dumped Textures";
|
||||||
path = fmt::format("{}textures/{:016X}/",
|
path = fmt::format("{}textures/{:016X}/",
|
||||||
FileUtil::GetUserPath(FileUtil::UserPath::DumpDir), data_id);
|
FileUtil::GetUserPath(FileUtil::UserPath::DumpDir), data_id);
|
||||||
break;
|
break;
|
||||||
case GameListOpenTarget::TEXTURE_LOAD:
|
}
|
||||||
|
case GameListOpenTarget::TEXTURE_LOAD: {
|
||||||
open_target = "Custom Textures";
|
open_target = "Custom Textures";
|
||||||
path = fmt::format("{}textures/{:016X}/",
|
path = fmt::format("{}textures/{:016X}/",
|
||||||
FileUtil::GetUserPath(FileUtil::UserPath::LoadDir), data_id);
|
FileUtil::GetUserPath(FileUtil::UserPath::LoadDir), data_id);
|
||||||
break;
|
break;
|
||||||
case GameListOpenTarget::MODS:
|
}
|
||||||
|
case GameListOpenTarget::MODS: {
|
||||||
open_target = "Mods";
|
open_target = "Mods";
|
||||||
path = fmt::format("{}mods/{:016X}/", FileUtil::GetUserPath(FileUtil::UserPath::LoadDir),
|
path = fmt::format("{}mods/{:016X}/", FileUtil::GetUserPath(FileUtil::UserPath::LoadDir),
|
||||||
data_id);
|
data_id);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
case GameListOpenTarget::SHADER_CACHE: {
|
||||||
|
open_target = "Shader Cache";
|
||||||
|
path = FileUtil::GetUserPath(FileUtil::UserPath::ShaderDir);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(Frontend, "Unexpected target {}", static_cast<int>(target));
|
LOG_ERROR(Frontend, "Unexpected target {}", static_cast<int>(target));
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user