mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-12-09 05:08:43 +00:00
Qt: Group game-specific and non-game-specific items in the same tabs (#3574)
* Group game-specific and non-game-specific items in the same tabs * Fix rebase * Transfer default settings tab to general, rename some items * Fix experimental tab contents not filling the tab * prevent saving game specific value if no valid value provided * Fix console language saving, add error message if trying to save nullopt
This commit is contained in:
@@ -100,6 +100,12 @@ public:
|
|||||||
void setTomlValue(toml::ordered_value& data, const std::string& header, const std::string& key,
|
void setTomlValue(toml::ordered_value& data, const std::string& header, const std::string& key,
|
||||||
bool is_game_specific = false) {
|
bool is_game_specific = false) {
|
||||||
if (is_game_specific) {
|
if (is_game_specific) {
|
||||||
|
if (game_specific_value == std::nullopt) {
|
||||||
|
fmt::print("Attempted to save std::nullopt value to {}-{}, matching config entry "
|
||||||
|
"may not be correctly set-up\n",
|
||||||
|
header, key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
data[header][key] = game_specific_value.value_or(base_value);
|
data[header][key] = game_specific_value.value_or(base_value);
|
||||||
game_specific_value = std::nullopt;
|
game_specific_value = std::nullopt;
|
||||||
} else {
|
} else {
|
||||||
@@ -1110,6 +1116,8 @@ void setDefaultValues(bool is_game_specific) {
|
|||||||
// Entries with game-specific settings that are in the game-specific setings GUI but not in
|
// Entries with game-specific settings that are in the game-specific setings GUI but not in
|
||||||
// the global settings GUI
|
// the global settings GUI
|
||||||
if (is_game_specific) {
|
if (is_game_specific) {
|
||||||
|
readbacksEnabled.set(false, is_game_specific);
|
||||||
|
readbackLinearImagesEnabled.set(false, is_game_specific);
|
||||||
isNeo.set(false, is_game_specific);
|
isNeo.set(false, is_game_specific);
|
||||||
isDevKit.set(false, is_game_specific);
|
isDevKit.set(false, is_game_specific);
|
||||||
isPSNSignedIn.set(false, is_game_specific);
|
isPSNSignedIn.set(false, is_game_specific);
|
||||||
@@ -1141,8 +1149,6 @@ void setDefaultValues(bool is_game_specific) {
|
|||||||
windowHeight.set(720, is_game_specific);
|
windowHeight.set(720, is_game_specific);
|
||||||
isNullGpu.set(false, is_game_specific);
|
isNullGpu.set(false, is_game_specific);
|
||||||
shouldCopyGPUBuffers.set(false, is_game_specific);
|
shouldCopyGPUBuffers.set(false, is_game_specific);
|
||||||
readbacksEnabled.set(false, is_game_specific);
|
|
||||||
readbackLinearImagesEnabled.set(false, is_game_specific);
|
|
||||||
shouldDumpShaders.set(false, is_game_specific);
|
shouldDumpShaders.set(false, is_game_specific);
|
||||||
vblankFrequency.set(60, is_game_specific);
|
vblankFrequency.set(60, is_game_specific);
|
||||||
isFullscreen.set(false, is_game_specific);
|
isFullscreen.set(false, is_game_specific);
|
||||||
|
|||||||
@@ -94,25 +94,18 @@ SettingsDialog::SettingsDialog(std::shared_ptr<gui_settings> gui_settings,
|
|||||||
ui->logFilterLineEdit->setClearButtonEnabled(true);
|
ui->logFilterLineEdit->setClearButtonEnabled(true);
|
||||||
|
|
||||||
if (game_specific) {
|
if (game_specific) {
|
||||||
|
// Paths tab
|
||||||
ui->tabWidgetSettings->setTabVisible(5, false);
|
ui->tabWidgetSettings->setTabVisible(5, false);
|
||||||
ui->chooseHomeTabComboBox->removeItem(5);
|
ui->chooseHomeTabComboBox->removeItem(5);
|
||||||
|
|
||||||
ui->label_Trophy->setVisible(false);
|
// Frontend tab
|
||||||
ui->trophyKeyLineEdit->setVisible(false);
|
ui->tabWidgetSettings->setTabVisible(1, false);
|
||||||
ui->CompatgroupBox->setVisible(false);
|
ui->chooseHomeTabComboBox->removeItem(1);
|
||||||
ui->gameSizeCheckBox->setVisible(false);
|
|
||||||
ui->GUIBackgroundImageGroupBox->setVisible(false);
|
|
||||||
ui->GUIMusicGroupBox->setVisible(false);
|
|
||||||
ui->gameSizeCheckBox->setVisible(false);
|
|
||||||
ui->updaterGroupBox->setVisible(false);
|
|
||||||
ui->discordRPCCheckbox->setVisible(false);
|
|
||||||
ui->emulatorLanguageGroupBox->setVisible(false);
|
|
||||||
} else {
|
} else {
|
||||||
ui->dmaCheckBox->setVisible(false);
|
// Experimental tab
|
||||||
ui->devkitCheckBox->setVisible(false);
|
ui->tabWidgetSettings->setTabVisible(8, false);
|
||||||
ui->neoCheckBox->setVisible(false);
|
ui->chooseHomeTabComboBox->removeItem(8);
|
||||||
ui->networkConnectedCheckBox->setVisible(false);
|
|
||||||
ui->psnSignInCheckBox->setVisible(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::path config_file =
|
std::filesystem::path config_file =
|
||||||
@@ -130,10 +123,15 @@ SettingsDialog::SettingsDialog(std::shared_ptr<gui_settings> gui_settings,
|
|||||||
presentModeMap = {{tr("Mailbox (Vsync)"), "Mailbox"},
|
presentModeMap = {{tr("Mailbox (Vsync)"), "Mailbox"},
|
||||||
{tr("Fifo (Vsync)"), "Fifo"},
|
{tr("Fifo (Vsync)"), "Fifo"},
|
||||||
{tr("Immediate (No Vsync)"), "Immediate"}};
|
{tr("Immediate (No Vsync)"), "Immediate"}};
|
||||||
chooseHomeTabMap = {{tr("General"), "General"}, {tr("GUI"), "GUI"},
|
chooseHomeTabMap = {{tr("General"), "General"},
|
||||||
{tr("Graphics"), "Graphics"}, {tr("User"), "User"},
|
{tr("Frontend"), "Frontend"},
|
||||||
{tr("Input"), "Input"}, {tr("Paths"), "Paths"},
|
{tr("Graphics"), "Graphics"},
|
||||||
{tr("Log"), "Log"}, {tr("Debug"), "Debug"}};
|
{tr("User"), "User"},
|
||||||
|
{tr("Input"), "Input"},
|
||||||
|
{tr("Paths"), "Paths"},
|
||||||
|
{tr("Log"), "Log"},
|
||||||
|
{tr("Debug"), "Debug"},
|
||||||
|
{tr("Experimental"), "Experimental"}};
|
||||||
micMap = {{tr("None"), "None"}, {tr("Default Device"), "Default Device"}};
|
micMap = {{tr("None"), "None"}, {tr("Default Device"), "Default Device"}};
|
||||||
|
|
||||||
if (m_physical_devices.empty()) {
|
if (m_physical_devices.empty()) {
|
||||||
@@ -646,6 +644,9 @@ void SettingsDialog::LoadValuesFromConfig() {
|
|||||||
ui->micComboBox->setCurrentIndex(0);
|
ui->micComboBox->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui->readbacksCheckBox->setChecked(toml::find_or<bool>(data, "GPU", "readbacks", false));
|
||||||
|
ui->readbackLinearImagesCheckBox->setChecked(
|
||||||
|
toml::find_or<bool>(data, "GPU", "readbackLinearImages", false));
|
||||||
ui->dmaCheckBox->setChecked(toml::find_or<bool>(data, "GPU", "directMemoryAccess", false));
|
ui->dmaCheckBox->setChecked(toml::find_or<bool>(data, "GPU", "directMemoryAccess", false));
|
||||||
ui->neoCheckBox->setChecked(toml::find_or<bool>(data, "General", "isPS4Pro", false));
|
ui->neoCheckBox->setChecked(toml::find_or<bool>(data, "General", "isPS4Pro", false));
|
||||||
ui->devkitCheckBox->setChecked(toml::find_or<bool>(data, "General", "isDevKit", false));
|
ui->devkitCheckBox->setChecked(toml::find_or<bool>(data, "General", "isDevKit", false));
|
||||||
@@ -725,10 +726,7 @@ void SettingsDialog::LoadValuesFromConfig() {
|
|||||||
toml::find_or<bool>(data, "GPU", "copyGPUBuffers", false));
|
toml::find_or<bool>(data, "GPU", "copyGPUBuffers", false));
|
||||||
ui->collectShaderCheckBox->setChecked(
|
ui->collectShaderCheckBox->setChecked(
|
||||||
toml::find_or<bool>(data, "Debug", "CollectShader", false));
|
toml::find_or<bool>(data, "Debug", "CollectShader", false));
|
||||||
ui->readbacksCheckBox->setChecked(toml::find_or<bool>(data, "GPU", "readbacks", false));
|
|
||||||
ui->enableLoggingCheckBox->setChecked(toml::find_or<bool>(data, "Debug", "logEnabled", true));
|
ui->enableLoggingCheckBox->setChecked(toml::find_or<bool>(data, "Debug", "logEnabled", true));
|
||||||
ui->readbackLinearImagesCheckBox->setChecked(
|
|
||||||
toml::find_or<bool>(data, "GPU", "readbackLinearImages", false));
|
|
||||||
|
|
||||||
std::string chooseHomeTab =
|
std::string chooseHomeTab =
|
||||||
toml::find_or<std::string>(data, "General", "chooseHomeTab", "General");
|
toml::find_or<std::string>(data, "General", "chooseHomeTab", "General");
|
||||||
@@ -981,17 +979,15 @@ bool SettingsDialog::eventFilter(QObject* obj, QEvent* event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::UpdateSettings(bool game_specific) {
|
void SettingsDialog::UpdateSettings(bool game_specific) {
|
||||||
// Entries that are only in the game-specific gui
|
|
||||||
|
|
||||||
if (game_specific) {
|
|
||||||
Config::setDirectMemoryAccess(ui->dmaCheckBox->isChecked(), true);
|
|
||||||
Config::setDevKitConsole(ui->devkitCheckBox->isChecked(), true);
|
|
||||||
Config::setNeoMode(ui->neoCheckBox->isChecked(), true);
|
|
||||||
Config::setConnectedToNetwork(ui->networkConnectedCheckBox->isChecked(), true);
|
|
||||||
Config::setPSNSignedIn(ui->psnSignInCheckBox->isChecked(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Entries with game-specific settings, needs the game-specific arg
|
// Entries with game-specific settings, needs the game-specific arg
|
||||||
|
Config::setReadbacks(ui->readbacksCheckBox->isChecked(), game_specific);
|
||||||
|
Config::setReadbackLinearImages(ui->readbackLinearImagesCheckBox->isChecked(), game_specific);
|
||||||
|
Config::setDirectMemoryAccess(ui->dmaCheckBox->isChecked(), game_specific);
|
||||||
|
Config::setDevKitConsole(ui->devkitCheckBox->isChecked(), game_specific);
|
||||||
|
Config::setNeoMode(ui->neoCheckBox->isChecked(), game_specific);
|
||||||
|
Config::setConnectedToNetwork(ui->networkConnectedCheckBox->isChecked(), game_specific);
|
||||||
|
Config::setPSNSignedIn(ui->psnSignInCheckBox->isChecked(), game_specific);
|
||||||
|
|
||||||
Config::setIsFullscreen(
|
Config::setIsFullscreen(
|
||||||
screenModeMap.value(ui->displayModeComboBox->currentText()) != "Windowed", game_specific);
|
screenModeMap.value(ui->displayModeComboBox->currentText()) != "Windowed", game_specific);
|
||||||
Config::setFullscreenMode(
|
Config::setFullscreenMode(
|
||||||
@@ -1025,7 +1021,8 @@ void SettingsDialog::UpdateSettings(bool game_specific) {
|
|||||||
Config::setCursorHideTimeout(ui->hideCursorComboBox->currentIndex(), game_specific);
|
Config::setCursorHideTimeout(ui->hideCursorComboBox->currentIndex(), game_specific);
|
||||||
Config::setGpuId(ui->graphicsAdapterBox->currentIndex() - 1, game_specific);
|
Config::setGpuId(ui->graphicsAdapterBox->currentIndex() - 1, game_specific);
|
||||||
Config::setVolumeSlider(ui->horizontalVolumeSlider->value(), game_specific);
|
Config::setVolumeSlider(ui->horizontalVolumeSlider->value(), game_specific);
|
||||||
Config::setLanguage(languageIndexes[ui->consoleLanguageComboBox->currentIndex()]);
|
Config::setLanguage(languageIndexes[ui->consoleLanguageComboBox->currentIndex()],
|
||||||
|
game_specific);
|
||||||
Config::setWindowWidth(ui->widthSpinBox->value(), game_specific);
|
Config::setWindowWidth(ui->widthSpinBox->value(), game_specific);
|
||||||
Config::setWindowHeight(ui->heightSpinBox->value(), game_specific);
|
Config::setWindowHeight(ui->heightSpinBox->value(), game_specific);
|
||||||
Config::setVblankFreq(ui->vblankSpinBox->value(), game_specific);
|
Config::setVblankFreq(ui->vblankSpinBox->value(), game_specific);
|
||||||
@@ -1043,8 +1040,6 @@ void SettingsDialog::UpdateSettings(bool game_specific) {
|
|||||||
Config::setVkHostMarkersEnabled(ui->hostMarkersCheckBox->isChecked(), game_specific);
|
Config::setVkHostMarkersEnabled(ui->hostMarkersCheckBox->isChecked(), game_specific);
|
||||||
Config::setVkGuestMarkersEnabled(ui->guestMarkersCheckBox->isChecked(), game_specific);
|
Config::setVkGuestMarkersEnabled(ui->guestMarkersCheckBox->isChecked(), game_specific);
|
||||||
Config::setVkCrashDiagnosticEnabled(ui->crashDiagnosticsCheckBox->isChecked(), game_specific);
|
Config::setVkCrashDiagnosticEnabled(ui->crashDiagnosticsCheckBox->isChecked(), game_specific);
|
||||||
Config::setReadbacks(ui->readbacksCheckBox->isChecked(), game_specific);
|
|
||||||
Config::setReadbackLinearImages(ui->readbackLinearImagesCheckBox->isChecked(), game_specific);
|
|
||||||
Config::setCollectShaderForDebug(ui->collectShaderCheckBox->isChecked(), game_specific);
|
Config::setCollectShaderForDebug(ui->collectShaderCheckBox->isChecked(), game_specific);
|
||||||
Config::setCopyGPUCmdBuffers(ui->copyGPUBuffersCheckBox->isChecked(), game_specific);
|
Config::setCopyGPUCmdBuffers(ui->copyGPUBuffersCheckBox->isChecked(), game_specific);
|
||||||
Config::setChooseHomeTab(
|
Config::setChooseHomeTab(
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user