mirror of
https://github.com/shadps4-emu/shadps4-qtlauncher.git
synced 2026-01-31 01:05:16 +01:00
Add Shader Cache to the Experimental menu | delete button (#201)
* Add Shader Cache to the Experimental menu | delete button * pipelineCacheArchive * fix deleteShaderCache
This commit is contained in:
@@ -191,6 +191,8 @@ static ConfigEntry<bool> vkCrashDiagnostic(false);
|
||||
static ConfigEntry<bool> vkHostMarkers(false);
|
||||
static ConfigEntry<bool> vkGuestMarkers(false);
|
||||
static ConfigEntry<bool> rdocEnable(false);
|
||||
static ConfigEntry<bool> pipelineCacheEnable(false);
|
||||
static ConfigEntry<bool> pipelineCacheArchive(false);
|
||||
|
||||
// Debug
|
||||
static ConfigEntry<bool> isDebugDump(false);
|
||||
@@ -451,6 +453,14 @@ bool isRdocEnabled() {
|
||||
return rdocEnable.get();
|
||||
}
|
||||
|
||||
bool isPipelineCacheEnabled() {
|
||||
return pipelineCacheEnable.get();
|
||||
}
|
||||
|
||||
bool isPipelineCacheArchived() {
|
||||
return pipelineCacheArchive.get();
|
||||
}
|
||||
|
||||
bool fpsColor() {
|
||||
return isFpsColor.get();
|
||||
}
|
||||
@@ -602,6 +612,14 @@ void setRdocEnabled(bool enable, bool is_game_specific) {
|
||||
rdocEnable.set(enable, is_game_specific);
|
||||
}
|
||||
|
||||
void setPipelineCacheEnabled(bool enable, bool is_game_specific) {
|
||||
pipelineCacheEnable.set(enable, is_game_specific);
|
||||
}
|
||||
|
||||
void setPipelineCacheArchived(bool enable, bool is_game_specific) {
|
||||
pipelineCacheArchive.set(enable, is_game_specific);
|
||||
}
|
||||
|
||||
void setVblankFreq(u32 value, bool is_game_specific) {
|
||||
vblankFrequency.set(value, is_game_specific);
|
||||
}
|
||||
@@ -931,6 +949,8 @@ void load(const std::filesystem::path& path, bool is_game_specific) {
|
||||
vkHostMarkers.setFromToml(vk, "hostMarkers", is_game_specific);
|
||||
vkGuestMarkers.setFromToml(vk, "guestMarkers", is_game_specific);
|
||||
rdocEnable.setFromToml(vk, "rdocEnable", is_game_specific);
|
||||
pipelineCacheEnable.setFromToml(vk, "pipelineCacheEnable", is_game_specific);
|
||||
pipelineCacheArchive.setFromToml(vk, "pipelineCacheArchive", is_game_specific);
|
||||
}
|
||||
|
||||
string current_version = {};
|
||||
@@ -1099,6 +1119,8 @@ void save(const std::filesystem::path& path, bool is_game_specific) {
|
||||
vkHostMarkers.setTomlValue(data, "Vulkan", "hostMarkers", is_game_specific);
|
||||
vkGuestMarkers.setTomlValue(data, "Vulkan", "guestMarkers", is_game_specific);
|
||||
rdocEnable.setTomlValue(data, "Vulkan", "rdocEnable", is_game_specific);
|
||||
pipelineCacheEnable.setTomlValue(data, "Vulkan", "pipelineCacheEnable", is_game_specific);
|
||||
pipelineCacheArchive.setTomlValue(data, "Vulkan", "pipelineCacheArchive", is_game_specific);
|
||||
|
||||
isDebugDump.setTomlValue(data, "Debug", "DebugDump", is_game_specific);
|
||||
isShaderDebug.setTomlValue(data, "Debug", "CollectShader", is_game_specific);
|
||||
@@ -1181,6 +1203,8 @@ void setDefaultValues(bool is_game_specific) {
|
||||
isConnectedToNetwork.set(false, is_game_specific);
|
||||
directMemoryAccessEnabled.set(false, is_game_specific);
|
||||
extraDmemInMbytes.set(0, is_game_specific);
|
||||
pipelineCacheEnable.set(false, is_game_specific);
|
||||
pipelineCacheArchive.set(false, is_game_specific);
|
||||
}
|
||||
|
||||
// Entries with game-specific settings that are in both the game-specific and global GUI
|
||||
|
||||
@@ -94,7 +94,11 @@ void setVkGuestMarkersEnabled(bool enable, bool is_game_specific = false);
|
||||
bool getEnableDiscordRPC();
|
||||
void setEnableDiscordRPC(bool enable);
|
||||
bool isRdocEnabled();
|
||||
bool isPipelineCacheEnabled();
|
||||
bool isPipelineCacheArchived();
|
||||
void setRdocEnabled(bool enable, bool is_game_specific = false);
|
||||
void setPipelineCacheEnabled(bool enable, bool is_game_specific = false);
|
||||
void setPipelineCacheArchived(bool enable, bool is_game_specific = false);
|
||||
std::string getLogType();
|
||||
void setLogType(const std::string& type, bool is_game_specific = false);
|
||||
std::string getLogFilter();
|
||||
|
||||
@@ -154,6 +154,7 @@ static auto UserPaths = [] {
|
||||
create_path(PathType::MetaDataDir, user_dir / METADATA_DIR);
|
||||
create_path(PathType::CustomTrophy, user_dir / CUSTOM_TROPHY);
|
||||
create_path(PathType::CustomConfigs, user_dir / CUSTOM_CONFIGS);
|
||||
create_path(PathType::CacheDir, user_dir / CACHE_DIR);
|
||||
|
||||
create_path(PathType::LauncherDir, launcher_dir);
|
||||
create_path(PathType::LauncherMetaData, launcher_dir / METADATA_DIR);
|
||||
|
||||
@@ -12,23 +12,24 @@ class QString; // to avoid including <QString> in this header
|
||||
namespace Common::FS {
|
||||
|
||||
enum class PathType {
|
||||
UserDir, // Where shadPS4 stores its data.
|
||||
LogDir, // Where log files are stored.
|
||||
ScreenshotsDir, // Where screenshots are stored.
|
||||
ShaderDir, // Where shaders are stored.
|
||||
TempDataDir, // Where game temp data is stored.
|
||||
GameDataDir, // Where game data is stored.
|
||||
SysModuleDir, // Where system modules are stored.
|
||||
DownloadDir, // Where downloads/temp files are stored.
|
||||
CapturesDir, // Where rdoc captures are stored.
|
||||
CheatsDir, // Where cheats are stored.
|
||||
PatchesDir, // Where patches are stored.
|
||||
MetaDataDir, // Where game metadata (e.g. trophies and menu backgrounds) is stored.
|
||||
CustomTrophy, // Where custom files for trophies are stored.
|
||||
CustomConfigs, // Where custom files for different games are stored.
|
||||
VersionDir, // Where emulator versions are stored.
|
||||
LauncherDir, // Where launcher stores its data.
|
||||
LauncherMetaData // Where launcher stores its game metadata.
|
||||
UserDir, // Where shadPS4 stores its data.
|
||||
LogDir, // Where log files are stored.
|
||||
ScreenshotsDir, // Where screenshots are stored.
|
||||
ShaderDir, // Where shaders are stored.
|
||||
TempDataDir, // Where game temp data is stored.
|
||||
GameDataDir, // Where game data is stored.
|
||||
SysModuleDir, // Where system modules are stored.
|
||||
DownloadDir, // Where downloads/temp files are stored.
|
||||
CapturesDir, // Where rdoc captures are stored.
|
||||
CheatsDir, // Where cheats are stored.
|
||||
PatchesDir, // Where patches are stored.
|
||||
MetaDataDir, // Where game metadata (e.g. trophies and menu backgrounds) is stored.
|
||||
CustomTrophy, // Where custom files for trophies are stored.
|
||||
CustomConfigs, // Where custom files for different games are stored.
|
||||
VersionDir, // Where emulator versions are stored.
|
||||
LauncherDir, // Where launcher stores its data.
|
||||
LauncherMetaData, // Where launcher stores its game metadata.
|
||||
CacheDir, // Where pipeline and shader cache is stored.
|
||||
};
|
||||
|
||||
constexpr auto PORTABLE_DIR = "user";
|
||||
@@ -49,6 +50,7 @@ constexpr auto METADATA_DIR = "game_data";
|
||||
constexpr auto CUSTOM_TROPHY = "custom_trophy";
|
||||
constexpr auto CUSTOM_CONFIGS = "custom_configs";
|
||||
constexpr auto VERSION_DIR = "versions";
|
||||
constexpr auto CACHE_DIR = "cache";
|
||||
|
||||
// Filenames
|
||||
constexpr auto LOG_FILE = "shad_log.txt";
|
||||
|
||||
@@ -158,12 +158,14 @@ public:
|
||||
QAction* deleteSaveData = new QAction(tr("Delete Save Data"), widget);
|
||||
QAction* deleteDLC = new QAction(tr("Delete DLC"), widget);
|
||||
QAction* deleteTrophy = new QAction(tr("Delete Trophy"), widget);
|
||||
QAction* deleteShaderCache = new QAction(tr("Delete Shader Cache"), widget);
|
||||
|
||||
deleteMenu->addAction(deleteGame);
|
||||
deleteMenu->addAction(deleteUpdate);
|
||||
deleteMenu->addAction(deleteSaveData);
|
||||
deleteMenu->addAction(deleteDLC);
|
||||
deleteMenu->addAction(deleteTrophy);
|
||||
deleteMenu->addAction(deleteShaderCache);
|
||||
|
||||
menu.addMenu(deleteMenu);
|
||||
|
||||
@@ -506,9 +508,11 @@ public:
|
||||
}
|
||||
|
||||
if (selected == deleteGame || selected == deleteUpdate || selected == deleteDLC ||
|
||||
selected == deleteSaveData || selected == deleteTrophy) {
|
||||
selected == deleteSaveData || selected == deleteTrophy ||
|
||||
selected == deleteShaderCache) {
|
||||
bool error = false;
|
||||
QString folder_path, game_update_path, dlc_path, save_data_path, trophy_data_path;
|
||||
QString folder_path, game_update_path, dlc_path, save_data_path, trophy_data_path,
|
||||
shader_cache_path, shader_cache_zip_path;
|
||||
Common::FS::PathToQString(folder_path, m_games[itemID].path);
|
||||
game_update_path = folder_path + "-UPDATE";
|
||||
if (!std::filesystem::exists(Common::FS::PathFromQString(game_update_path))) {
|
||||
@@ -519,11 +523,15 @@ public:
|
||||
Common::FS::PathFromQString(folder_path).parent_path().filename());
|
||||
Common::FS::PathToQString(save_data_path,
|
||||
Config::GetSaveDataPath() / "1" / m_games[itemID].save_dir);
|
||||
|
||||
Common::FS::PathToQString(trophy_data_path,
|
||||
Common::FS::GetUserPath(Common::FS::PathType::MetaDataDir) /
|
||||
m_games[itemID].serial / "TrophyFiles");
|
||||
|
||||
Common::FS::PathToQString(shader_cache_path,
|
||||
Common::FS::GetUserPath(Common::FS::PathType::CacheDir) /
|
||||
m_games[itemID].serial);
|
||||
Common::FS::PathToQString(shader_cache_zip_path,
|
||||
Common::FS::GetUserPath(Common::FS::PathType::CacheDir) /
|
||||
(m_games[itemID].serial + ".zip"));
|
||||
QString message_type;
|
||||
|
||||
if (selected == deleteGame) {
|
||||
@@ -566,6 +574,26 @@ public:
|
||||
folder_path = trophy_data_path;
|
||||
message_type = tr("Trophy");
|
||||
}
|
||||
} else if (selected == deleteShaderCache) {
|
||||
const auto dir_path = Common::FS::PathFromQString(shader_cache_path);
|
||||
const auto zip_path = Common::FS::PathFromQString(shader_cache_zip_path);
|
||||
|
||||
bool has_dir = std::filesystem::exists(dir_path);
|
||||
bool has_zip = std::filesystem::exists(zip_path);
|
||||
|
||||
if (!has_dir && !has_zip) {
|
||||
QMessageBox::critical(
|
||||
nullptr, tr("Error"),
|
||||
tr("This game does not have any saved Shader Cache to delete!"));
|
||||
error = true;
|
||||
} else {
|
||||
if (has_dir)
|
||||
std::filesystem::remove_all(dir_path);
|
||||
if (has_zip)
|
||||
std::filesystem::remove(zip_path);
|
||||
folder_path = shader_cache_path;
|
||||
message_type = tr("Shader Cache");
|
||||
}
|
||||
}
|
||||
if (!error) {
|
||||
QString gameName = QString::fromStdString(m_games[itemID].name);
|
||||
|
||||
@@ -433,6 +433,15 @@ SettingsDialog::SettingsDialog(std::shared_ptr<gui_settings> gui_settings,
|
||||
});
|
||||
}
|
||||
|
||||
// Experimental
|
||||
{
|
||||
connect(ui->shaderCaheCheckBox, &QCheckBox::checkStateChanged, this,
|
||||
[this](Qt::CheckState state) {
|
||||
state ? ui->shaderCacheArchiveCheckBox->setVisible(true)
|
||||
: ui->shaderCacheArchiveCheckBox->setVisible(false);
|
||||
});
|
||||
}
|
||||
|
||||
// GRAPHICS TAB
|
||||
connect(ui->RCASSlider, &QSlider::valueChanged, this, [this](int value) {
|
||||
QString RCASValue = QString::number(value / 1000.0, 'f', 3);
|
||||
@@ -534,6 +543,8 @@ SettingsDialog::SettingsDialog(std::shared_ptr<gui_settings> gui_settings,
|
||||
ui->devkitCheckBox->installEventFilter(this);
|
||||
ui->neoCheckBox->installEventFilter(this);
|
||||
ui->networkConnectedCheckBox->installEventFilter(this);
|
||||
ui->shaderCaheCheckBox->installEventFilter(this);
|
||||
ui->shaderCacheArchiveCheckBox->installEventFilter(this);
|
||||
ui->psnSignInCheckBox->installEventFilter(this);
|
||||
ui->dmemGroupBox->installEventFilter(this);
|
||||
}
|
||||
@@ -675,6 +686,10 @@ void SettingsDialog::LoadValuesFromConfig() {
|
||||
ui->devkitCheckBox->setChecked(toml::find_or<bool>(data, "General", "isDevKit", false));
|
||||
ui->networkConnectedCheckBox->setChecked(
|
||||
toml::find_or<bool>(data, "General", "isConnectedToNetwork", false));
|
||||
ui->shaderCaheCheckBox->setChecked(
|
||||
toml::find_or<bool>(data, "Vulkan", "pipelineCacheEnable", false));
|
||||
ui->shaderCacheArchiveCheckBox->setChecked(
|
||||
toml::find_or<bool>(data, "Vulkan", "pipelineCacheArchive", false));
|
||||
ui->psnSignInCheckBox->setChecked(toml::find_or<bool>(data, "General", "isPSNSignedIn", false));
|
||||
ui->vblankSpinBox->setValue(toml::find_or<int>(data, "GPU", "vblankFrequency", 60));
|
||||
ui->dmemSpinBox->setValue(toml::find_or<int>(data, "General", "extraDmemInMbytes", 0));
|
||||
@@ -747,6 +762,8 @@ void SettingsDialog::LoadValuesFromConfig() {
|
||||
toml::find_or<bool>(data, "Vulkan", "validation_gpu", false));
|
||||
ui->vkValidationCheckBox->isChecked() ? ui->vkLayersGroupBox->setVisible(true)
|
||||
: ui->vkLayersGroupBox->setVisible(false);
|
||||
ui->shaderCaheCheckBox->isChecked() ? ui->shaderCacheArchiveCheckBox->setVisible(true)
|
||||
: ui->shaderCacheArchiveCheckBox->setVisible(false);
|
||||
|
||||
ui->rdocCheckBox->setChecked(toml::find_or<bool>(data, "Vulkan", "rdocEnable", false));
|
||||
ui->crashDiagnosticsCheckBox->setChecked(
|
||||
@@ -999,6 +1016,10 @@ void SettingsDialog::updateNoteTextEdit(const QString& elementName) {
|
||||
text = tr("Enable Devkit Console Mode:\\nAdds support for Devkit console memory size.");
|
||||
} else if (elementName == "networkConnectedCheckBox") {
|
||||
text = tr("Set Network Connected to True:\\nForces games to detect an active network connection. Actual online capabilities are not yet supported.");
|
||||
} else if (elementName == "shaderCaheCheckBox") {
|
||||
text = tr("Enable Shader Cache:\\nStoring compiled shaders to avoid recompilations, reduce stuttering.");
|
||||
} else if (elementName == "shaderCacheArchiveCheckBox") {
|
||||
text = tr("Compress the Shader Cache files into a zip file:\\nThe shader cache files are stored within a single zip file instead of multiple separate files.");
|
||||
} else if (elementName == "psnSignInCheckBox") {
|
||||
text = tr("Set PSN Signed-in to True:\\nForces games to detect an active PSN sign-in. Actual PSN capabilities are not supported.");
|
||||
} else if (elementName == "readbacksCheckBox") {
|
||||
@@ -1037,6 +1058,8 @@ void SettingsDialog::UpdateSettings(bool is_specific) {
|
||||
Config::setDevKitConsole(ui->devkitCheckBox->isChecked(), is_specific);
|
||||
Config::setNeoMode(ui->neoCheckBox->isChecked(), is_specific);
|
||||
Config::setConnectedToNetwork(ui->networkConnectedCheckBox->isChecked(), is_specific);
|
||||
Config::setPipelineCacheEnabled(ui->shaderCaheCheckBox->isChecked(), is_specific);
|
||||
Config::setPipelineCacheArchived(ui->shaderCacheArchiveCheckBox->isChecked(), is_specific);
|
||||
Config::setPSNSignedIn(ui->psnSignInCheckBox->isChecked(), is_specific);
|
||||
Config::setVblankFreq(ui->vblankSpinBox->value(), is_specific);
|
||||
Config::setExtraDmemInMbytes(ui->dmemSpinBox->value(), is_specific);
|
||||
|
||||
@@ -1587,7 +1587,7 @@
|
||||
<height>505</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="inputTabVLayout" stretch="0,0,0">
|
||||
<layout class="QVBoxLayout" name="inputTabVLayout" stretch="0,0,0,0">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="inputTabHLayoutTop" stretch="1,1">
|
||||
<item>
|
||||
@@ -1842,27 +1842,27 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="USBDeviceLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="USBDeviceGroupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>USB Device</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7_1">
|
||||
<item>
|
||||
<widget class="QComboBox" name="usbComboBox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<layout class="QVBoxLayout" name="USBDeviceLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="USBDeviceGroupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>USB Device</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7_1">
|
||||
<item>
|
||||
<widget class="QComboBox" name="usbComboBox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_11">
|
||||
<property name="orientation">
|
||||
@@ -2412,7 +2412,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>946</width>
|
||||
<height>395</height>
|
||||
<height>459</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@@ -2502,6 +2502,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="shaderCaheCheckBox">
|
||||
<property name="text">
|
||||
<string>Enable Shader Cache</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="shaderCacheArchiveCheckBox">
|
||||
<property name="text">
|
||||
<string>Compress the Shader Cache files into a zip file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user