|
|
|
|
@@ -11,6 +11,7 @@
|
|
|
|
|
#include <fmt/format.h>
|
|
|
|
|
|
|
|
|
|
#include "common/config.h"
|
|
|
|
|
#include "common/logging/log.h"
|
|
|
|
|
#include "common/scm_rev.h"
|
|
|
|
|
#include "core/libraries/audio/audioout.h"
|
|
|
|
|
#include "qt_gui/compatibility_info.h"
|
|
|
|
|
@@ -27,6 +28,7 @@
|
|
|
|
|
#include "common/logging/backend.h"
|
|
|
|
|
#include "common/logging/filter.h"
|
|
|
|
|
#include "log_presets_dialog.h"
|
|
|
|
|
#include "sdl_event_wrapper.h"
|
|
|
|
|
#include "settings_dialog.h"
|
|
|
|
|
#include "ui_settings_dialog.h"
|
|
|
|
|
#include "video_core/renderer_vulkan/vk_instance.h"
|
|
|
|
|
@@ -82,18 +84,20 @@ static std::vector<QString> m_physical_devices;
|
|
|
|
|
|
|
|
|
|
SettingsDialog::SettingsDialog(std::shared_ptr<gui_settings> gui_settings,
|
|
|
|
|
std::shared_ptr<CompatibilityInfoClass> m_compat_info,
|
|
|
|
|
QWidget* parent, bool is_game_specific, std::string gsc_serial)
|
|
|
|
|
QWidget* parent, bool is_running, bool is_specific,
|
|
|
|
|
std::string gsc_serial)
|
|
|
|
|
: QDialog(parent), ui(new Ui::SettingsDialog), m_gui_settings(std::move(gui_settings)),
|
|
|
|
|
game_specific(is_game_specific), gs_serial(gsc_serial) {
|
|
|
|
|
is_game_running(is_running), is_game_specific(is_specific), gs_serial(gsc_serial) {
|
|
|
|
|
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
ui->tabWidgetSettings->setUsesScrollButtons(false);
|
|
|
|
|
|
|
|
|
|
initialHeight = this->height();
|
|
|
|
|
|
|
|
|
|
// Add a small clear "x" button inside the Log Filter input
|
|
|
|
|
ui->logFilterLineEdit->setClearButtonEnabled(true);
|
|
|
|
|
|
|
|
|
|
if (game_specific) {
|
|
|
|
|
if (is_game_specific) {
|
|
|
|
|
// Paths tab
|
|
|
|
|
ui->tabWidgetSettings->setTabVisible(5, false);
|
|
|
|
|
ui->chooseHomeTabComboBox->removeItem(5);
|
|
|
|
|
@@ -109,7 +113,7 @@ SettingsDialog::SettingsDialog(std::shared_ptr<gui_settings> gui_settings,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::filesystem::path config_file =
|
|
|
|
|
game_specific
|
|
|
|
|
is_game_specific
|
|
|
|
|
? Common::FS::GetUserPath(Common::FS::PathType::CustomConfigs) / (gs_serial + ".toml")
|
|
|
|
|
: Common::FS::GetUserPath(Common::FS::PathType::UserDir) / "config.toml";
|
|
|
|
|
|
|
|
|
|
@@ -184,6 +188,7 @@ SettingsDialog::SettingsDialog(std::shared_ptr<gui_settings> gui_settings,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InitializeEmulatorLanguages();
|
|
|
|
|
onAudioDeviceChange(true);
|
|
|
|
|
LoadValuesFromConfig();
|
|
|
|
|
|
|
|
|
|
defaultTextEdit = tr("Point your mouse at an option to display its description.");
|
|
|
|
|
@@ -194,17 +199,17 @@ SettingsDialog::SettingsDialog(std::shared_ptr<gui_settings> gui_settings,
|
|
|
|
|
connect(ui->buttonBox, &QDialogButtonBox::clicked, this,
|
|
|
|
|
[this, config_file](QAbstractButton* button) {
|
|
|
|
|
if (button == ui->buttonBox->button(QDialogButtonBox::Save)) {
|
|
|
|
|
is_saving = true;
|
|
|
|
|
UpdateSettings(game_specific);
|
|
|
|
|
Config::save(config_file, game_specific);
|
|
|
|
|
is_game_saving = true;
|
|
|
|
|
UpdateSettings(is_game_specific);
|
|
|
|
|
Config::save(config_file, is_game_specific);
|
|
|
|
|
QWidget::close();
|
|
|
|
|
} else if (button == ui->buttonBox->button(QDialogButtonBox::Apply)) {
|
|
|
|
|
UpdateSettings(game_specific);
|
|
|
|
|
Config::save(config_file, game_specific);
|
|
|
|
|
UpdateSettings(is_game_specific);
|
|
|
|
|
Config::save(config_file, is_game_specific);
|
|
|
|
|
} else if (button == ui->buttonBox->button(QDialogButtonBox::RestoreDefaults)) {
|
|
|
|
|
setDefaultValues();
|
|
|
|
|
Config::setDefaultValues(game_specific);
|
|
|
|
|
Config::save(config_file, game_specific);
|
|
|
|
|
Config::setDefaultValues(is_game_specific);
|
|
|
|
|
Config::save(config_file, is_game_specific);
|
|
|
|
|
LoadValuesFromConfig();
|
|
|
|
|
} else if (button == ui->buttonBox->button(QDialogButtonBox::Close)) {
|
|
|
|
|
ui->backgroundImageOpacitySlider->setValue(backgroundImageOpacitySlider_backup);
|
|
|
|
|
@@ -232,7 +237,7 @@ SettingsDialog::SettingsDialog(std::shared_ptr<gui_settings> gui_settings,
|
|
|
|
|
{
|
|
|
|
|
connect(ui->horizontalVolumeSlider, &QSlider::valueChanged, this, [this](int value) {
|
|
|
|
|
VolumeSliderChange(value);
|
|
|
|
|
Config::setVolumeSlider(value, game_specific);
|
|
|
|
|
Config::setVolumeSlider(value, is_game_specific);
|
|
|
|
|
Libraries::AudioOut::AdjustVol();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@@ -526,30 +531,52 @@ SettingsDialog::SettingsDialog(std::shared_ptr<gui_settings> gui_settings,
|
|
|
|
|
ui->networkConnectedCheckBox->installEventFilter(this);
|
|
|
|
|
ui->psnSignInCheckBox->installEventFilter(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SdlEventWrapper::Wrapper::wrapperActive = true;
|
|
|
|
|
if (!is_game_running) {
|
|
|
|
|
SDL_InitSubSystem(SDL_INIT_EVENTS);
|
|
|
|
|
Polling = QtConcurrent::run(&SettingsDialog::pollSDLevents, this);
|
|
|
|
|
} else {
|
|
|
|
|
SdlEventWrapper::Wrapper* DeviceEventWrapper = SdlEventWrapper::Wrapper::GetInstance();
|
|
|
|
|
QObject::connect(DeviceEventWrapper, &SdlEventWrapper::Wrapper::audioDeviceChanged, this,
|
|
|
|
|
&SettingsDialog::onAudioDeviceChange);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::closeEvent(QCloseEvent* event) {
|
|
|
|
|
if (!is_saving) {
|
|
|
|
|
if (!is_game_saving) {
|
|
|
|
|
ui->backgroundImageOpacitySlider->setValue(backgroundImageOpacitySlider_backup);
|
|
|
|
|
emit BackgroundOpacityChanged(backgroundImageOpacitySlider_backup);
|
|
|
|
|
ui->BGMVolumeSlider->setValue(bgm_volume_backup);
|
|
|
|
|
BackgroundMusicPlayer::getInstance().setVolume(bgm_volume_backup);
|
|
|
|
|
SyncRealTimeWidgetstoConfig();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SdlEventWrapper::Wrapper::wrapperActive = false;
|
|
|
|
|
if (!is_game_running) {
|
|
|
|
|
SDL_Event quitLoop{};
|
|
|
|
|
quitLoop.type = SDL_EVENT_QUIT;
|
|
|
|
|
SDL_PushEvent(&quitLoop);
|
|
|
|
|
Polling.waitForFinished();
|
|
|
|
|
|
|
|
|
|
SDL_QuitSubSystem(SDL_INIT_EVENTS);
|
|
|
|
|
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
|
|
|
|
SDL_Quit();
|
|
|
|
|
}
|
|
|
|
|
QDialog::closeEvent(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::LoadValuesFromConfig() {
|
|
|
|
|
std::filesystem::path config_file;
|
|
|
|
|
config_file =
|
|
|
|
|
game_specific
|
|
|
|
|
is_game_specific
|
|
|
|
|
? Common::FS::GetUserPath(Common::FS::PathType::CustomConfigs) / (gs_serial + ".toml")
|
|
|
|
|
: Common::FS::GetUserPath(Common::FS::PathType::UserDir) / "config.toml";
|
|
|
|
|
|
|
|
|
|
std::error_code error;
|
|
|
|
|
bool is_newly_created = false;
|
|
|
|
|
if (!std::filesystem::exists(config_file, error)) {
|
|
|
|
|
Config::save(config_file, game_specific);
|
|
|
|
|
Config::save(config_file, is_game_specific);
|
|
|
|
|
is_newly_created = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -567,7 +594,7 @@ void SettingsDialog::LoadValuesFromConfig() {
|
|
|
|
|
15, 16, 17, 7, 26, 8, 11, 20, 3, 13, 27, 10, 19, 30, 28};
|
|
|
|
|
|
|
|
|
|
// Entries with no game-specific settings
|
|
|
|
|
if (!game_specific) {
|
|
|
|
|
if (!is_game_specific) {
|
|
|
|
|
const auto save_data_path = Config::GetSaveDataPath();
|
|
|
|
|
QString save_data_path_string;
|
|
|
|
|
Common::FS::PathToQString(save_data_path_string, save_data_path);
|
|
|
|
|
@@ -728,6 +755,11 @@ void SettingsDialog::LoadValuesFromConfig() {
|
|
|
|
|
toml::find_or<bool>(data, "Debug", "CollectShader", false));
|
|
|
|
|
ui->enableLoggingCheckBox->setChecked(toml::find_or<bool>(data, "Debug", "logEnabled", true));
|
|
|
|
|
|
|
|
|
|
ui->GenAudioComboBox->setCurrentText(QString::fromStdString(
|
|
|
|
|
toml::find_or<std::string>(data, "General", "mainOutputDevice", "")));
|
|
|
|
|
ui->DsAudioComboBox->setCurrentText(QString::fromStdString(
|
|
|
|
|
toml::find_or<std::string>(data, "General", "padSpkOutputDevice", "")));
|
|
|
|
|
|
|
|
|
|
std::string chooseHomeTab =
|
|
|
|
|
toml::find_or<std::string>(data, "General", "chooseHomeTab", "General");
|
|
|
|
|
QString translatedText = chooseHomeTabMap.key(QString::fromStdString(chooseHomeTab));
|
|
|
|
|
@@ -979,76 +1011,75 @@ bool SettingsDialog::eventFilter(QObject* obj, QEvent* event) {
|
|
|
|
|
return QDialog::eventFilter(obj, event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::UpdateSettings(bool game_specific) {
|
|
|
|
|
void SettingsDialog::UpdateSettings(bool is_specific) {
|
|
|
|
|
// 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::setReadbacks(ui->readbacksCheckBox->isChecked(), is_specific);
|
|
|
|
|
Config::setReadbackLinearImages(ui->readbackLinearImagesCheckBox->isChecked(), is_specific);
|
|
|
|
|
Config::setDirectMemoryAccess(ui->dmaCheckBox->isChecked(), is_specific);
|
|
|
|
|
Config::setDevKitConsole(ui->devkitCheckBox->isChecked(), is_specific);
|
|
|
|
|
Config::setNeoMode(ui->neoCheckBox->isChecked(), is_specific);
|
|
|
|
|
Config::setConnectedToNetwork(ui->networkConnectedCheckBox->isChecked(), is_specific);
|
|
|
|
|
Config::setPSNSignedIn(ui->psnSignInCheckBox->isChecked(), is_specific);
|
|
|
|
|
|
|
|
|
|
Config::setIsFullscreen(
|
|
|
|
|
screenModeMap.value(ui->displayModeComboBox->currentText()) != "Windowed", game_specific);
|
|
|
|
|
screenModeMap.value(ui->displayModeComboBox->currentText()) != "Windowed", is_specific);
|
|
|
|
|
Config::setFullscreenMode(
|
|
|
|
|
screenModeMap.value(ui->displayModeComboBox->currentText()).toStdString(), game_specific);
|
|
|
|
|
screenModeMap.value(ui->displayModeComboBox->currentText()).toStdString(), is_specific);
|
|
|
|
|
Config::setPresentMode(
|
|
|
|
|
presentModeMap.value(ui->presentModeComboBox->currentText()).toStdString(), game_specific);
|
|
|
|
|
Config::setIsMotionControlsEnabled(ui->motionControlsCheckBox->isChecked(), game_specific);
|
|
|
|
|
presentModeMap.value(ui->presentModeComboBox->currentText()).toStdString(), is_specific);
|
|
|
|
|
Config::setIsMotionControlsEnabled(ui->motionControlsCheckBox->isChecked(), is_specific);
|
|
|
|
|
Config::setBackgroundControllerInput(ui->backgroundControllerCheckBox->isChecked(),
|
|
|
|
|
game_specific);
|
|
|
|
|
Config::setisTrophyPopupDisabled(ui->disableTrophycheckBox->isChecked(), game_specific);
|
|
|
|
|
Config::setTrophyNotificationDuration(ui->popUpDurationSpinBox->value(), game_specific);
|
|
|
|
|
is_specific);
|
|
|
|
|
Config::setisTrophyPopupDisabled(ui->disableTrophycheckBox->isChecked(), is_specific);
|
|
|
|
|
Config::setTrophyNotificationDuration(ui->popUpDurationSpinBox->value(), is_specific);
|
|
|
|
|
|
|
|
|
|
if (ui->radioButton_Top->isChecked()) {
|
|
|
|
|
Config::setSideTrophy("top", game_specific);
|
|
|
|
|
Config::setSideTrophy("top", is_specific);
|
|
|
|
|
} else if (ui->radioButton_Left->isChecked()) {
|
|
|
|
|
Config::setSideTrophy("left", game_specific);
|
|
|
|
|
Config::setSideTrophy("left", is_specific);
|
|
|
|
|
} else if (ui->radioButton_Right->isChecked()) {
|
|
|
|
|
Config::setSideTrophy("right", game_specific);
|
|
|
|
|
Config::setSideTrophy("right", is_specific);
|
|
|
|
|
} else if (ui->radioButton_Bottom->isChecked()) {
|
|
|
|
|
Config::setSideTrophy("bottom", game_specific);
|
|
|
|
|
Config::setSideTrophy("bottom", is_specific);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Config::setLoggingEnabled(ui->enableLoggingCheckBox->isChecked(), game_specific);
|
|
|
|
|
Config::setAllowHDR(ui->enableHDRCheckBox->isChecked(), game_specific);
|
|
|
|
|
Config::setLoggingEnabled(ui->enableLoggingCheckBox->isChecked(), is_specific);
|
|
|
|
|
Config::setAllowHDR(ui->enableHDRCheckBox->isChecked(), is_specific);
|
|
|
|
|
Config::setLogType(logTypeMap.value(ui->logTypeComboBox->currentText()).toStdString(),
|
|
|
|
|
game_specific);
|
|
|
|
|
Config::setMicDevice(ui->micComboBox->currentData().toString().toStdString(), game_specific);
|
|
|
|
|
Config::setLogFilter(ui->logFilterLineEdit->text().toStdString(), game_specific);
|
|
|
|
|
Config::setUserName(ui->userNameLineEdit->text().toStdString(), game_specific);
|
|
|
|
|
Config::setCursorState(ui->hideCursorComboBox->currentIndex(), game_specific);
|
|
|
|
|
Config::setCursorHideTimeout(ui->hideCursorComboBox->currentIndex(), game_specific);
|
|
|
|
|
Config::setGpuId(ui->graphicsAdapterBox->currentIndex() - 1, game_specific);
|
|
|
|
|
Config::setVolumeSlider(ui->horizontalVolumeSlider->value(), game_specific);
|
|
|
|
|
Config::setLanguage(languageIndexes[ui->consoleLanguageComboBox->currentIndex()],
|
|
|
|
|
game_specific);
|
|
|
|
|
Config::setWindowWidth(ui->widthSpinBox->value(), game_specific);
|
|
|
|
|
Config::setWindowHeight(ui->heightSpinBox->value(), game_specific);
|
|
|
|
|
Config::setVblankFreq(ui->vblankSpinBox->value(), game_specific);
|
|
|
|
|
Config::setDumpShaders(ui->dumpShadersCheckBox->isChecked(), game_specific);
|
|
|
|
|
Config::setNullGpu(ui->nullGpuCheckBox->isChecked(), game_specific);
|
|
|
|
|
Config::setFsrEnabled(ui->FSRCheckBox->isChecked(), game_specific);
|
|
|
|
|
Config::setRcasEnabled(ui->RCASCheckBox->isChecked(), game_specific);
|
|
|
|
|
Config::setRcasAttenuation(ui->RCASSlider->value(), game_specific);
|
|
|
|
|
Config::setShowSplash(ui->showSplashCheckBox->isChecked(), game_specific);
|
|
|
|
|
Config::setDebugDump(ui->debugDump->isChecked(), game_specific);
|
|
|
|
|
Config::setSeparateLogFilesEnabled(ui->separateLogFilesCheckbox->isChecked(), game_specific);
|
|
|
|
|
Config::setVkValidation(ui->vkValidationCheckBox->isChecked(), game_specific);
|
|
|
|
|
Config::setVkSyncValidation(ui->vkSyncValidationCheckBox->isChecked(), game_specific);
|
|
|
|
|
Config::setRdocEnabled(ui->rdocCheckBox->isChecked(), game_specific);
|
|
|
|
|
Config::setVkHostMarkersEnabled(ui->hostMarkersCheckBox->isChecked(), game_specific);
|
|
|
|
|
Config::setVkGuestMarkersEnabled(ui->guestMarkersCheckBox->isChecked(), game_specific);
|
|
|
|
|
Config::setVkCrashDiagnosticEnabled(ui->crashDiagnosticsCheckBox->isChecked(), game_specific);
|
|
|
|
|
Config::setCollectShaderForDebug(ui->collectShaderCheckBox->isChecked(), game_specific);
|
|
|
|
|
Config::setCopyGPUCmdBuffers(ui->copyGPUBuffersCheckBox->isChecked(), game_specific);
|
|
|
|
|
is_specific);
|
|
|
|
|
Config::setMicDevice(ui->micComboBox->currentData().toString().toStdString(), is_specific);
|
|
|
|
|
Config::setLogFilter(ui->logFilterLineEdit->text().toStdString(), is_specific);
|
|
|
|
|
Config::setUserName(ui->userNameLineEdit->text().toStdString(), is_specific);
|
|
|
|
|
Config::setCursorState(ui->hideCursorComboBox->currentIndex(), is_specific);
|
|
|
|
|
Config::setCursorHideTimeout(ui->hideCursorComboBox->currentIndex(), is_specific);
|
|
|
|
|
Config::setGpuId(ui->graphicsAdapterBox->currentIndex() - 1, is_specific);
|
|
|
|
|
Config::setVolumeSlider(ui->horizontalVolumeSlider->value(), is_specific);
|
|
|
|
|
Config::setLanguage(languageIndexes[ui->consoleLanguageComboBox->currentIndex()], is_specific);
|
|
|
|
|
Config::setWindowWidth(ui->widthSpinBox->value(), is_specific);
|
|
|
|
|
Config::setWindowHeight(ui->heightSpinBox->value(), is_specific);
|
|
|
|
|
Config::setVblankFreq(ui->vblankSpinBox->value(), is_specific);
|
|
|
|
|
Config::setDumpShaders(ui->dumpShadersCheckBox->isChecked(), is_specific);
|
|
|
|
|
Config::setNullGpu(ui->nullGpuCheckBox->isChecked(), is_specific);
|
|
|
|
|
Config::setFsrEnabled(ui->FSRCheckBox->isChecked(), is_specific);
|
|
|
|
|
Config::setRcasEnabled(ui->RCASCheckBox->isChecked(), is_specific);
|
|
|
|
|
Config::setRcasAttenuation(ui->RCASSlider->value(), is_specific);
|
|
|
|
|
Config::setShowSplash(ui->showSplashCheckBox->isChecked(), is_specific);
|
|
|
|
|
Config::setDebugDump(ui->debugDump->isChecked(), is_specific);
|
|
|
|
|
Config::setSeparateLogFilesEnabled(ui->separateLogFilesCheckbox->isChecked(), is_specific);
|
|
|
|
|
Config::setVkValidation(ui->vkValidationCheckBox->isChecked(), is_specific);
|
|
|
|
|
Config::setVkSyncValidation(ui->vkSyncValidationCheckBox->isChecked(), is_specific);
|
|
|
|
|
Config::setRdocEnabled(ui->rdocCheckBox->isChecked(), is_specific);
|
|
|
|
|
Config::setVkHostMarkersEnabled(ui->hostMarkersCheckBox->isChecked(), is_specific);
|
|
|
|
|
Config::setVkGuestMarkersEnabled(ui->guestMarkersCheckBox->isChecked(), is_specific);
|
|
|
|
|
Config::setVkCrashDiagnosticEnabled(ui->crashDiagnosticsCheckBox->isChecked(), is_specific);
|
|
|
|
|
Config::setCollectShaderForDebug(ui->collectShaderCheckBox->isChecked(), is_specific);
|
|
|
|
|
Config::setCopyGPUCmdBuffers(ui->copyGPUBuffersCheckBox->isChecked(), is_specific);
|
|
|
|
|
Config::setChooseHomeTab(
|
|
|
|
|
chooseHomeTabMap.value(ui->chooseHomeTabComboBox->currentText()).toStdString(),
|
|
|
|
|
game_specific);
|
|
|
|
|
is_specific);
|
|
|
|
|
|
|
|
|
|
// Entries with no game-specific settings
|
|
|
|
|
if (!game_specific) {
|
|
|
|
|
if (!is_specific) {
|
|
|
|
|
std::vector<Config::GameInstallDir> dirs_with_states;
|
|
|
|
|
for (int i = 0; i < ui->gameFoldersListWidget->count(); i++) {
|
|
|
|
|
QListWidgetItem* item = ui->gameFoldersListWidget->item(i);
|
|
|
|
|
@@ -1096,7 +1127,7 @@ void SettingsDialog::SyncRealTimeWidgetstoConfig() {
|
|
|
|
|
std::filesystem::path userdir = Common::FS::GetUserPath(Common::FS::PathType::UserDir);
|
|
|
|
|
const toml::value data = toml::parse(userdir / "config.toml");
|
|
|
|
|
|
|
|
|
|
if (!game_specific) {
|
|
|
|
|
if (!is_game_specific) {
|
|
|
|
|
ui->gameFoldersListWidget->clear();
|
|
|
|
|
if (data.contains("GUI")) {
|
|
|
|
|
const toml::value& gui = data.at("GUI");
|
|
|
|
|
@@ -1137,7 +1168,7 @@ void SettingsDialog::SyncRealTimeWidgetstoConfig() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
toml::value gs_data;
|
|
|
|
|
game_specific
|
|
|
|
|
is_game_specific
|
|
|
|
|
? gs_data = toml::parse(Common::FS::GetUserPath(Common::FS::PathType::CustomConfigs) /
|
|
|
|
|
(gs_serial + ".toml"))
|
|
|
|
|
: gs_data = data;
|
|
|
|
|
@@ -1147,8 +1178,8 @@ void SettingsDialog::SyncRealTimeWidgetstoConfig() {
|
|
|
|
|
|
|
|
|
|
// Since config::set can be called for volume slider (connected to the widget) outside the save
|
|
|
|
|
// function, need to null it out if GS GUI is closed without saving
|
|
|
|
|
game_specific ? Config::resetGameSpecificValue("volumeSlider")
|
|
|
|
|
: Config::setVolumeSlider(sliderValue);
|
|
|
|
|
is_game_specific ? Config::resetGameSpecificValue("volumeSlider")
|
|
|
|
|
: Config::setVolumeSlider(sliderValue);
|
|
|
|
|
|
|
|
|
|
if (presenter) {
|
|
|
|
|
presenter->GetFsrSettingsRef().enable =
|
|
|
|
|
@@ -1161,7 +1192,7 @@ void SettingsDialog::SyncRealTimeWidgetstoConfig() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::setDefaultValues() {
|
|
|
|
|
if (!game_specific) {
|
|
|
|
|
if (!is_game_specific) {
|
|
|
|
|
m_gui_settings->SetValue(gui::gl_showBackgroundImage, true);
|
|
|
|
|
m_gui_settings->SetValue(gui::gl_backgroundImageOpacity, 50);
|
|
|
|
|
m_gui_settings->SetValue(gui::gl_playBackgroundMusic, false);
|
|
|
|
|
@@ -1176,3 +1207,59 @@ void SettingsDialog::setDefaultValues() {
|
|
|
|
|
m_gui_settings->SetValue(gui::gen_guiLanguage, "en_US");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::pollSDLevents() {
|
|
|
|
|
SDL_Event event;
|
|
|
|
|
while (SdlEventWrapper::Wrapper::wrapperActive) {
|
|
|
|
|
|
|
|
|
|
if (!SDL_WaitEvent(&event)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (event.type == SDL_EVENT_QUIT) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (event.type == SDL_EVENT_AUDIO_DEVICE_ADDED) {
|
|
|
|
|
onAudioDeviceChange(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (event.type == SDL_EVENT_AUDIO_DEVICE_REMOVED) {
|
|
|
|
|
onAudioDeviceChange(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::onAudioDeviceChange(bool isAdd) {
|
|
|
|
|
ui->GenAudioComboBox->clear();
|
|
|
|
|
ui->DsAudioComboBox->clear();
|
|
|
|
|
|
|
|
|
|
// prevent device list from refreshing too fast when game not running
|
|
|
|
|
if (!is_game_running && isAdd == false)
|
|
|
|
|
QThread::msleep(100);
|
|
|
|
|
|
|
|
|
|
int deviceCount;
|
|
|
|
|
QStringList deviceList;
|
|
|
|
|
SDL_AudioDeviceID* devices = SDL_GetAudioPlaybackDevices(&deviceCount);
|
|
|
|
|
|
|
|
|
|
if (!devices) {
|
|
|
|
|
LOG_ERROR(Lib_AudioOut, "Unable to retrieve audio device list {}", SDL_GetError());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < deviceCount; ++i) {
|
|
|
|
|
const char* name = SDL_GetAudioDeviceName(devices[i]);
|
|
|
|
|
std::string name_string = std::string(name);
|
|
|
|
|
deviceList.append(QString::fromStdString(name_string));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ui->GenAudioComboBox->addItem(tr("Default Device"), "Default Device");
|
|
|
|
|
ui->GenAudioComboBox->addItems(deviceList);
|
|
|
|
|
ui->GenAudioComboBox->setCurrentText(QString::fromStdString(Config::getMainOutputDevice()));
|
|
|
|
|
|
|
|
|
|
ui->DsAudioComboBox->addItem(tr("Default Device"), "Default Device");
|
|
|
|
|
ui->DsAudioComboBox->addItems(deviceList);
|
|
|
|
|
ui->DsAudioComboBox->setCurrentText(QString::fromStdString(Config::getPadSpkOutputDevice()));
|
|
|
|
|
|
|
|
|
|
SDL_free(devices);
|
|
|
|
|
}
|
|
|
|
|
|