mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-05 08:52:36 +00:00
Delete and replace old config entry if found
This commit is contained in:
parent
34d62dbcc1
commit
f6733861e8
@ -552,11 +552,22 @@ void load(const std::filesystem::path& path) {
|
||||
fmt::print("Got exception trying to load config file. Exception: {}\n", ex.what());
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.contains("General")) {
|
||||
|
||||
toml::value& table = toml::find(data, "General");
|
||||
auto findkey = table.as_table().find("isPS4Pro");
|
||||
if (findkey != table.as_table().end()) {
|
||||
table.as_table().erase(findkey);
|
||||
data["General"]["isPS4ProEnabled"] = false;
|
||||
std::ofstream file(path, std::ios::binary);
|
||||
file << data;
|
||||
file.close();
|
||||
}
|
||||
|
||||
const toml::value& general = data.at("General");
|
||||
|
||||
// isNeo = toml::find_or<bool>(general, "isPS4Pro", false);
|
||||
isNeo = toml::find_or<bool>(general, "isPS4Pro-temp", false);
|
||||
isNeo = toml::find_or<bool>(general, "isPS4ProEnabled", false);
|
||||
isFullscreen = toml::find_or<bool>(general, "Fullscreen", false);
|
||||
playBGM = toml::find_or<bool>(general, "playBGM", false);
|
||||
isTrophyPopupDisabled = toml::find_or<bool>(general, "isTrophyPopupDisabled", false);
|
||||
@ -676,8 +687,7 @@ void save(const std::filesystem::path& path) {
|
||||
fmt::print("Saving new configuration file {}\n", fmt::UTF(path.u8string()));
|
||||
}
|
||||
|
||||
// data["General"]["isPS4Pro"] = isNeo;
|
||||
data["General"]["isPS4Pro-temp"] = isNeo;
|
||||
data["General"]["isPS4ProEnabled"] = isNeo;
|
||||
data["General"]["Fullscreen"] = isFullscreen;
|
||||
data["General"]["isTrophyPopupDisabled"] = isTrophyPopupDisabled;
|
||||
data["General"]["playBGM"] = playBGM;
|
||||
|
@ -273,7 +273,8 @@ void SettingsDialog::LoadValuesFromConfig() {
|
||||
ui->separateUpdatesCheckBox->setChecked(
|
||||
toml::find_or<bool>(data, "General", "separateUpdateEnabled", false));
|
||||
ui->showSplashCheckBox->setChecked(toml::find_or<bool>(data, "General", "showSplash", false));
|
||||
// ui->ps4proCheckBox->setChecked(toml::find_or<bool>(data, "General", "isPS4Pro", false));
|
||||
// ui->ps4proCheckBox->setChecked(toml::find_or<bool>(data, "General", "isPS4ProEnabled",
|
||||
// false));
|
||||
ui->logTypeComboBox->setCurrentText(
|
||||
QString::fromStdString(toml::find_or<std::string>(data, "General", "logType", "async")));
|
||||
ui->logFilterLineEdit->setText(
|
||||
@ -554,4 +555,4 @@ void SettingsDialog::ResetInstallFolders() {
|
||||
}
|
||||
Config::setGameInstallDirs(settings_install_dirs_config);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user