mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 08:22:32 +00:00
refactor
This commit is contained in:
parent
6e3783a77d
commit
7bab3961e9
2
externals/ext-boost
vendored
2
externals/ext-boost
vendored
@ -1 +1 @@
|
|||||||
Subproject commit a04136add1e469f46d8ae8d3e8307779240a5c53
|
Subproject commit f2474e1b584fb7a3ed6f85ba875e6eacd742ec8a
|
@ -60,6 +60,7 @@ static bool vkMarkers = false;
|
|||||||
static bool vkCrashDiagnostic = false;
|
static bool vkCrashDiagnostic = false;
|
||||||
static s16 cursorState = HideCursorState::Idle;
|
static s16 cursorState = HideCursorState::Idle;
|
||||||
static int cursorHideTimeout = 5; // 5 seconds (default)
|
static int cursorHideTimeout = 5; // 5 seconds (default)
|
||||||
|
static bool separateupdatefolder = false;
|
||||||
|
|
||||||
// Gui
|
// Gui
|
||||||
std::vector<std::filesystem::path> settings_install_dirs = {};
|
std::vector<std::filesystem::path> settings_install_dirs = {};
|
||||||
@ -207,6 +208,10 @@ bool vkCrashDiagnosticEnabled() {
|
|||||||
return vkCrashDiagnostic;
|
return vkCrashDiagnostic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool getSeparateUpdateEnabled() {
|
||||||
|
return separateupdatefolder;
|
||||||
|
}
|
||||||
|
|
||||||
void setGpuId(s32 selectedGpuId) {
|
void setGpuId(s32 selectedGpuId) {
|
||||||
gpuId = selectedGpuId;
|
gpuId = selectedGpuId;
|
||||||
}
|
}
|
||||||
@ -319,6 +324,10 @@ void setSpecialPadClass(int type) {
|
|||||||
specialPadClass = type;
|
specialPadClass = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setSeparateUpdateEnabled(bool use) {
|
||||||
|
separateupdatefolder = use;
|
||||||
|
}
|
||||||
|
|
||||||
void setMainWindowGeometry(u32 x, u32 y, u32 w, u32 h) {
|
void setMainWindowGeometry(u32 x, u32 y, u32 w, u32 h) {
|
||||||
main_window_geometry_x = x;
|
main_window_geometry_x = x;
|
||||||
main_window_geometry_y = y;
|
main_window_geometry_y = y;
|
||||||
@ -483,6 +492,7 @@ void load(const std::filesystem::path& path) {
|
|||||||
}
|
}
|
||||||
isShowSplash = toml::find_or<bool>(general, "showSplash", true);
|
isShowSplash = toml::find_or<bool>(general, "showSplash", true);
|
||||||
isAutoUpdate = toml::find_or<bool>(general, "autoUpdate", false);
|
isAutoUpdate = toml::find_or<bool>(general, "autoUpdate", false);
|
||||||
|
separateupdatefolder = toml::find_or<bool>(general, "separateUpdateEnabled", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.contains("Input")) {
|
if (data.contains("Input")) {
|
||||||
@ -597,6 +607,7 @@ void save(const std::filesystem::path& path) {
|
|||||||
data["General"]["updateChannel"] = updateChannel;
|
data["General"]["updateChannel"] = updateChannel;
|
||||||
data["General"]["showSplash"] = isShowSplash;
|
data["General"]["showSplash"] = isShowSplash;
|
||||||
data["General"]["autoUpdate"] = isAutoUpdate;
|
data["General"]["autoUpdate"] = isAutoUpdate;
|
||||||
|
data["General"]["separateUpdateEnabled"] = separateupdatefolder;
|
||||||
data["Input"]["cursorState"] = cursorState;
|
data["Input"]["cursorState"] = cursorState;
|
||||||
data["Input"]["cursorHideTimeout"] = cursorHideTimeout;
|
data["Input"]["cursorHideTimeout"] = cursorHideTimeout;
|
||||||
data["Input"]["backButtonBehavior"] = backButtonBehavior;
|
data["Input"]["backButtonBehavior"] = backButtonBehavior;
|
||||||
|
@ -19,6 +19,7 @@ bool isFullscreenMode();
|
|||||||
bool getPlayBGM();
|
bool getPlayBGM();
|
||||||
int getBGMvolume();
|
int getBGMvolume();
|
||||||
bool getEnableDiscordRPC();
|
bool getEnableDiscordRPC();
|
||||||
|
bool getSeparateUpdateEnabled();
|
||||||
|
|
||||||
std::string getLogFilter();
|
std::string getLogFilter();
|
||||||
std::string getLogType();
|
std::string getLogType();
|
||||||
@ -62,6 +63,7 @@ void setLanguage(u32 language);
|
|||||||
void setNeoMode(bool enable);
|
void setNeoMode(bool enable);
|
||||||
void setUserName(const std::string& type);
|
void setUserName(const std::string& type);
|
||||||
void setUpdateChannel(const std::string& type);
|
void setUpdateChannel(const std::string& type);
|
||||||
|
void setSeparateUpdateEnabled(bool use);
|
||||||
|
|
||||||
void setCursorState(s16 cursorState);
|
void setCursorState(s16 cursorState);
|
||||||
void setCursorHideTimeout(int newcursorHideTimeout);
|
void setCursorHideTimeout(int newcursorHideTimeout);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include "common/config.h"
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
#include "core/file_sys/fs.h"
|
#include "core/file_sys/fs.h"
|
||||||
|
|
||||||
@ -56,7 +57,7 @@ std::filesystem::path MntPoints::GetHostPath(std::string_view guest_directory, b
|
|||||||
std::filesystem::path host_path = mount->host_path / rel_path;
|
std::filesystem::path host_path = mount->host_path / rel_path;
|
||||||
|
|
||||||
std::filesystem::path patch_path = mount->host_path.string() + "-UPDATE";
|
std::filesystem::path patch_path = mount->host_path.string() + "-UPDATE";
|
||||||
if (std::filesystem::exists(patch_path / rel_path)) {
|
if (std::filesystem::exists(patch_path / rel_path) && Config::getSeparateUpdateEnabled()) {
|
||||||
host_path = patch_path / rel_path;
|
host_path = patch_path / rel_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,10 +114,11 @@ void Emulator::Run(const std::filesystem::path& file) {
|
|||||||
std::string app_version;
|
std::string app_version;
|
||||||
u32 fw_version;
|
u32 fw_version;
|
||||||
|
|
||||||
std::filesystem::path game_patch_folder = (file.parent_path().string() + "-UPDATE");
|
std::filesystem::path game_patch_folder = file.parent_path().concat("-UPDATE");
|
||||||
std::filesystem::path sce_sys_folder = std::filesystem::exists(game_patch_folder / "sce_sys")
|
bool use_game_patch = std::filesystem::exists(game_patch_folder / "sce_sys") &&
|
||||||
? game_patch_folder / "sce_sys"
|
Config::getSeparateUpdateEnabled();
|
||||||
: file.parent_path() / "sce_sys";
|
std::filesystem::path sce_sys_folder =
|
||||||
|
use_game_patch ? game_patch_folder / "sce_sys" : file.parent_path() / "sce_sys";
|
||||||
if (std::filesystem::is_directory(sce_sys_folder)) {
|
if (std::filesystem::is_directory(sce_sys_folder)) {
|
||||||
for (const auto& entry : std::filesystem::directory_iterator(sce_sys_folder)) {
|
for (const auto& entry : std::filesystem::directory_iterator(sce_sys_folder)) {
|
||||||
if (entry.path().filename() == "param.sfo") {
|
if (entry.path().filename() == "param.sfo") {
|
||||||
|
@ -28,7 +28,8 @@ public:
|
|||||||
std::filesystem::path sce_folder_path = filePath / "sce_sys" / "param.sfo";
|
std::filesystem::path sce_folder_path = filePath / "sce_sys" / "param.sfo";
|
||||||
std::filesystem::path game_update_path =
|
std::filesystem::path game_update_path =
|
||||||
std::filesystem::path(filePath.string() + "-UPDATE");
|
std::filesystem::path(filePath.string() + "-UPDATE");
|
||||||
if (std::filesystem::exists(game_update_path / "sce_sys" / "param.sfo")) {
|
if (std::filesystem::exists(game_update_path / "sce_sys" / "param.sfo") &&
|
||||||
|
Config::getSeparateUpdateEnabled()) {
|
||||||
sce_folder_path = game_update_path / "sce_sys" / "param.sfo";
|
sce_folder_path = game_update_path / "sce_sys" / "param.sfo";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,11 +94,13 @@ public:
|
|||||||
|
|
||||||
if (selected == &openSfoViewer) {
|
if (selected == &openSfoViewer) {
|
||||||
PSF psf;
|
PSF psf;
|
||||||
std::string game_folder_path = m_games[itemID].path;
|
QString game_update_path;
|
||||||
if (std::filesystem::exists(game_folder_path + "-UPDATE")) {
|
Common::FS::PathToQString(game_update_path, m_games[itemID].path.concat("-UPDATE"));
|
||||||
game_folder_path += "-UPDATE";
|
std::filesystem::path game_folder_path = m_games[itemID].path;
|
||||||
|
if (std::filesystem::exists(m_games[itemID].path)) {
|
||||||
|
game_folder_path = Common::FS::PathFromQString(game_update_path);
|
||||||
}
|
}
|
||||||
if (psf.Open(std::filesystem::path(game_folder_path) / "sce_sys" / "param.sfo")) {
|
if (psf.Open(game_folder_path / "sce_sys" / "param.sfo")) {
|
||||||
int rows = psf.GetEntries().size();
|
int rows = psf.GetEntries().size();
|
||||||
QTableWidget* tableWidget = new QTableWidget(rows, 2);
|
QTableWidget* tableWidget = new QTableWidget(rows, 2);
|
||||||
tableWidget->setAttribute(Qt::WA_DeleteOnClose);
|
tableWidget->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
@ -288,22 +290,31 @@ public:
|
|||||||
|
|
||||||
if (selected == deleteGame || selected == deleteUpdate || selected == deleteDLC) {
|
if (selected == deleteGame || selected == deleteUpdate || selected == deleteDLC) {
|
||||||
bool error = false;
|
bool error = false;
|
||||||
QString folder_path = QString::fromStdString(m_games[itemID].path);
|
QString folder_path, game_update_path;
|
||||||
|
Common::FS::PathToQString(folder_path, m_games[itemID].path.concat("-UPDATE"));
|
||||||
|
Common::FS::PathToQString(game_update_path, m_games[itemID].path.concat("-UPDATE"));
|
||||||
QString message_type = tr("Game");
|
QString message_type = tr("Game");
|
||||||
if (selected == deleteUpdate) {
|
if (selected == deleteUpdate) {
|
||||||
if (!std::filesystem::exists(m_games[itemID].path + "-UPDATE")) {
|
if (!Config::getSeparateUpdateEnabled()) {
|
||||||
|
QMessageBox::critical(
|
||||||
|
nullptr, tr("Error"),
|
||||||
|
QString(tr("This feature requires the 'Enable Separate Update Folder' "
|
||||||
|
"config option "
|
||||||
|
"to work. If you want to use this feature, please enable it.")));
|
||||||
|
error = true;
|
||||||
|
} else if (!std::filesystem::exists(m_games[itemID].path.concat("-UPDATE"))) {
|
||||||
QMessageBox::critical(nullptr, tr("Error"),
|
QMessageBox::critical(nullptr, tr("Error"),
|
||||||
QString(tr("This game has no update to delete!")));
|
QString(tr("This game has no update to delete!")));
|
||||||
error = true;
|
error = true;
|
||||||
} else {
|
} else {
|
||||||
folder_path = QString::fromStdString(m_games[itemID].path + "-UPDATE");
|
folder_path = game_update_path;
|
||||||
message_type = tr("Update");
|
message_type = tr("Update");
|
||||||
}
|
}
|
||||||
} else if (selected == deleteDLC) {
|
} else if (selected == deleteDLC) {
|
||||||
std::filesystem::path game_path = folder_path.toStdString();
|
|
||||||
std::filesystem::path addon_path =
|
std::filesystem::path addon_path =
|
||||||
Config::getAddonInstallDir() / game_path.parent_path().filename();
|
Config::getAddonInstallDir() /
|
||||||
if (!std::filesystem::exists(addon_path.string())) {
|
Common::FS::PathFromQString(folder_path).parent_path().filename();
|
||||||
|
if (!std::filesystem::exists(addon_path)) {
|
||||||
QMessageBox::critical(nullptr, tr("Error"),
|
QMessageBox::critical(nullptr, tr("Error"),
|
||||||
QString(tr("This game has no DLC to delete!")));
|
QString(tr("This game has no DLC to delete!")));
|
||||||
error = true;
|
error = true;
|
||||||
|
@ -678,8 +678,9 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int
|
|||||||
auto game_install_dir = ids.getSelectedDirectory();
|
auto game_install_dir = ids.getSelectedDirectory();
|
||||||
auto game_folder_path = game_install_dir / pkg.GetTitleID();
|
auto game_folder_path = game_install_dir / pkg.GetTitleID();
|
||||||
QString pkgType = QString::fromStdString(pkg.GetPkgFlags());
|
QString pkgType = QString::fromStdString(pkg.GetPkgFlags());
|
||||||
auto game_update_path = pkgType.contains("PATCH")
|
bool use_game_update = pkgType.contains("Patch") && Config::getSeparateUpdateEnabled();
|
||||||
? Config::getGameInstallDir() / (std::string(pkg.GetTitleID()) + "-UPDATE")
|
auto game_update_path = use_game_update ? Config::getGameInstallDir() /
|
||||||
|
(std::string(pkg.GetTitleID()) + "-UPDATE")
|
||||||
: game_folder_path;
|
: game_folder_path;
|
||||||
if (!std::filesystem::exists(game_update_path)) {
|
if (!std::filesystem::exists(game_update_path)) {
|
||||||
std::filesystem::create_directory(game_update_path);
|
std::filesystem::create_directory(game_update_path);
|
||||||
|
@ -133,6 +133,9 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices, QWidge
|
|||||||
connect(ui->ps4proCheckBox, &QCheckBox::stateChanged, this,
|
connect(ui->ps4proCheckBox, &QCheckBox::stateChanged, this,
|
||||||
[](int val) { Config::setNeoMode(val); });
|
[](int val) { Config::setNeoMode(val); });
|
||||||
|
|
||||||
|
connect(ui->separateUpdatesCheckBox, &QCheckBox::stateChanged, this,
|
||||||
|
[](int val) { Config::setSeparateUpdateEnabled(val); });
|
||||||
|
|
||||||
connect(ui->logTypeComboBox, &QComboBox::currentTextChanged, this,
|
connect(ui->logTypeComboBox, &QComboBox::currentTextChanged, this,
|
||||||
[](const QString& text) { Config::setLogType(text.toStdString()); });
|
[](const QString& text) { Config::setLogType(text.toStdString()); });
|
||||||
|
|
||||||
@ -270,6 +273,7 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices, QWidge
|
|||||||
ui->showSplashCheckBox->installEventFilter(this);
|
ui->showSplashCheckBox->installEventFilter(this);
|
||||||
ui->ps4proCheckBox->installEventFilter(this);
|
ui->ps4proCheckBox->installEventFilter(this);
|
||||||
ui->discordRPCCheckbox->installEventFilter(this);
|
ui->discordRPCCheckbox->installEventFilter(this);
|
||||||
|
ui->separateUpdatesCheckBox->installEventFilter(this);
|
||||||
ui->userName->installEventFilter(this);
|
ui->userName->installEventFilter(this);
|
||||||
ui->logTypeGroupBox->installEventFilter(this);
|
ui->logTypeGroupBox->installEventFilter(this);
|
||||||
ui->logFilter->installEventFilter(this);
|
ui->logFilter->installEventFilter(this);
|
||||||
@ -328,6 +332,7 @@ void SettingsDialog::LoadValuesFromConfig() {
|
|||||||
ui->logTypeComboBox->setCurrentText(QString::fromStdString(Config::getLogType()));
|
ui->logTypeComboBox->setCurrentText(QString::fromStdString(Config::getLogType()));
|
||||||
ui->logFilterLineEdit->setText(QString::fromStdString(Config::getLogFilter()));
|
ui->logFilterLineEdit->setText(QString::fromStdString(Config::getLogFilter()));
|
||||||
ui->userNameLineEdit->setText(QString::fromStdString(Config::getUserName()));
|
ui->userNameLineEdit->setText(QString::fromStdString(Config::getUserName()));
|
||||||
|
ui->separateUpdatesCheckBox->setChecked(Config::getSeparateUpdateEnabled());
|
||||||
|
|
||||||
ui->debugDump->setChecked(Config::debugDump());
|
ui->debugDump->setChecked(Config::debugDump());
|
||||||
ui->vkValidationCheckBox->setChecked(Config::vkValidationEnabled());
|
ui->vkValidationCheckBox->setChecked(Config::vkValidationEnabled());
|
||||||
@ -437,6 +442,8 @@ void SettingsDialog::updateNoteTextEdit(const QString& elementName) {
|
|||||||
text = tr("ps4proCheckBox");
|
text = tr("ps4proCheckBox");
|
||||||
} else if (elementName == "discordRPCCheckbox") {
|
} else if (elementName == "discordRPCCheckbox") {
|
||||||
text = tr("discordRPCCheckbox");
|
text = tr("discordRPCCheckbox");
|
||||||
|
} else if (elementName == "separateUpdatesCheckBox") {
|
||||||
|
text = tr("separateUpdatesCheckBox");
|
||||||
} else if (elementName == "userName") {
|
} else if (elementName == "userName") {
|
||||||
text = tr("userName");
|
text = tr("userName");
|
||||||
} else if (elementName == "logTypeGroupBox") {
|
} else if (elementName == "logTypeGroupBox") {
|
||||||
|
@ -134,6 +134,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="separateUpdatesCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable Separate Update Folder</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="showSplashCheckBox">
|
<widget class="QCheckBox" name="showSplashCheckBox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
Loading…
Reference in New Issue
Block a user