2022-04-23 20:49:07 +02:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2020-12-28 16:15:37 +01:00
|
|
|
|
2021-04-15 04:05:28 +02:00
|
|
|
#include "common/settings.h"
|
2020-12-28 16:15:37 +01:00
|
|
|
#include "core/core.h"
|
|
|
|
#include "ui_configure_graphics_advanced.h"
|
|
|
|
#include "yuzu/configuration/configuration_shared.h"
|
|
|
|
#include "yuzu/configuration/configure_graphics_advanced.h"
|
|
|
|
|
2021-10-09 02:29:53 +02:00
|
|
|
ConfigureGraphicsAdvanced::ConfigureGraphicsAdvanced(const Core::System& system_, QWidget* parent)
|
2021-10-16 02:35:29 +02:00
|
|
|
: QWidget(parent), ui{std::make_unique<Ui::ConfigureGraphicsAdvanced>()}, system{system_} {
|
2020-12-28 16:15:37 +01:00
|
|
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
|
|
SetupPerGameUI();
|
|
|
|
|
|
|
|
SetConfiguration();
|
|
|
|
}
|
|
|
|
|
|
|
|
ConfigureGraphicsAdvanced::~ConfigureGraphicsAdvanced() = default;
|
|
|
|
|
|
|
|
void ConfigureGraphicsAdvanced::SetConfiguration() {
|
2021-10-09 02:29:53 +02:00
|
|
|
const bool runtime_lock = !system.IsPoweredOn();
|
2020-12-28 16:15:37 +01:00
|
|
|
ui->use_vsync->setEnabled(runtime_lock);
|
|
|
|
ui->use_asynchronous_shaders->setEnabled(runtime_lock);
|
|
|
|
ui->anisotropic_filtering_combobox->setEnabled(runtime_lock);
|
|
|
|
|
|
|
|
ui->use_vsync->setChecked(Settings::values.use_vsync.GetValue());
|
|
|
|
ui->use_asynchronous_shaders->setChecked(Settings::values.use_asynchronous_shaders.GetValue());
|
|
|
|
ui->use_fast_gpu_time->setChecked(Settings::values.use_fast_gpu_time.GetValue());
|
2022-08-27 04:27:11 +02:00
|
|
|
ui->use_pessimistic_flushes->setChecked(Settings::values.use_pessimistic_flushes.GetValue());
|
2020-12-28 16:15:37 +01:00
|
|
|
|
|
|
|
if (Settings::IsConfiguringGlobal()) {
|
|
|
|
ui->gpu_accuracy->setCurrentIndex(
|
|
|
|
static_cast<int>(Settings::values.gpu_accuracy.GetValue()));
|
|
|
|
ui->anisotropic_filtering_combobox->setCurrentIndex(
|
|
|
|
Settings::values.max_anisotropy.GetValue());
|
|
|
|
} else {
|
|
|
|
ConfigurationShared::SetPerGameSetting(ui->gpu_accuracy, &Settings::values.gpu_accuracy);
|
|
|
|
ConfigurationShared::SetPerGameSetting(ui->anisotropic_filtering_combobox,
|
|
|
|
&Settings::values.max_anisotropy);
|
|
|
|
ConfigurationShared::SetHighlight(ui->label_gpu_accuracy,
|
|
|
|
!Settings::values.gpu_accuracy.UsingGlobal());
|
|
|
|
ConfigurationShared::SetHighlight(ui->af_label,
|
|
|
|
!Settings::values.max_anisotropy.UsingGlobal());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ConfigureGraphicsAdvanced::ApplyConfiguration() {
|
2021-07-28 21:57:36 +02:00
|
|
|
ConfigurationShared::ApplyPerGameSetting(&Settings::values.gpu_accuracy, ui->gpu_accuracy);
|
2021-05-17 02:21:13 +02:00
|
|
|
ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy,
|
|
|
|
ui->anisotropic_filtering_combobox);
|
|
|
|
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync, use_vsync);
|
|
|
|
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_shaders,
|
|
|
|
ui->use_asynchronous_shaders,
|
|
|
|
use_asynchronous_shaders);
|
|
|
|
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_fast_gpu_time,
|
|
|
|
ui->use_fast_gpu_time, use_fast_gpu_time);
|
2022-08-27 04:27:11 +02:00
|
|
|
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_pessimistic_flushes,
|
|
|
|
ui->use_pessimistic_flushes, use_pessimistic_flushes);
|
2020-12-28 16:15:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void ConfigureGraphicsAdvanced::changeEvent(QEvent* event) {
|
|
|
|
if (event->type() == QEvent::LanguageChange) {
|
|
|
|
RetranslateUI();
|
|
|
|
}
|
|
|
|
|
|
|
|
QWidget::changeEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ConfigureGraphicsAdvanced::RetranslateUI() {
|
|
|
|
ui->retranslateUi(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ConfigureGraphicsAdvanced::SetupPerGameUI() {
|
|
|
|
// Disable if not global (only happens during game)
|
|
|
|
if (Settings::IsConfiguringGlobal()) {
|
|
|
|
ui->gpu_accuracy->setEnabled(Settings::values.gpu_accuracy.UsingGlobal());
|
|
|
|
ui->use_vsync->setEnabled(Settings::values.use_vsync.UsingGlobal());
|
|
|
|
ui->use_asynchronous_shaders->setEnabled(
|
|
|
|
Settings::values.use_asynchronous_shaders.UsingGlobal());
|
|
|
|
ui->use_fast_gpu_time->setEnabled(Settings::values.use_fast_gpu_time.UsingGlobal());
|
2022-08-27 04:27:11 +02:00
|
|
|
ui->use_pessimistic_flushes->setEnabled(
|
|
|
|
Settings::values.use_pessimistic_flushes.UsingGlobal());
|
2020-12-28 16:15:37 +01:00
|
|
|
ui->anisotropic_filtering_combobox->setEnabled(
|
|
|
|
Settings::values.max_anisotropy.UsingGlobal());
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ConfigurationShared::SetColoredTristate(ui->use_vsync, Settings::values.use_vsync, use_vsync);
|
|
|
|
ConfigurationShared::SetColoredTristate(ui->use_asynchronous_shaders,
|
|
|
|
Settings::values.use_asynchronous_shaders,
|
|
|
|
use_asynchronous_shaders);
|
|
|
|
ConfigurationShared::SetColoredTristate(ui->use_fast_gpu_time,
|
|
|
|
Settings::values.use_fast_gpu_time, use_fast_gpu_time);
|
2022-08-27 04:27:11 +02:00
|
|
|
ConfigurationShared::SetColoredTristate(ui->use_pessimistic_flushes,
|
|
|
|
Settings::values.use_pessimistic_flushes,
|
|
|
|
use_pessimistic_flushes);
|
2020-12-28 16:15:37 +01:00
|
|
|
ConfigurationShared::SetColoredComboBox(
|
|
|
|
ui->gpu_accuracy, ui->label_gpu_accuracy,
|
|
|
|
static_cast<int>(Settings::values.gpu_accuracy.GetValue(true)));
|
|
|
|
ConfigurationShared::SetColoredComboBox(
|
|
|
|
ui->anisotropic_filtering_combobox, ui->af_label,
|
|
|
|
static_cast<int>(Settings::values.max_anisotropy.GetValue(true)));
|
|
|
|
}
|