Settings: Add resolution scaling to settings.

This commit is contained in:
Fernando Sahmkow
2021-07-18 20:33:20 +02:00
parent 22f4b290b6
commit 37ef9c9130
6 changed files with 155 additions and 5 deletions

View File

@ -102,6 +102,8 @@ void ConfigureGraphics::SetConfiguration() {
ui->nvdec_emulation->setCurrentIndex(
static_cast<int>(Settings::values.nvdec_emulation.GetValue()));
ui->aspect_ratio_combobox->setCurrentIndex(Settings::values.aspect_ratio.GetValue());
ui->resolution_combobox->setCurrentIndex(
static_cast<int>(Settings::values.resolution_setup.GetValue()));
} else {
ConfigurationShared::SetPerGameSetting(ui->api, &Settings::values.renderer_backend);
ConfigurationShared::SetHighlight(ui->api_widget,
@ -122,6 +124,11 @@ void ConfigureGraphics::SetConfiguration() {
ConfigurationShared::SetHighlight(ui->ar_label,
!Settings::values.aspect_ratio.UsingGlobal());
ConfigurationShared::SetPerGameSetting(ui->resolution_combobox,
&Settings::values.resolution_setup);
ConfigurationShared::SetHighlight(ui->resolution_label,
!Settings::values.resolution_setup.UsingGlobal());
ui->bg_combobox->setCurrentIndex(Settings::values.bg_red.UsingGlobal() ? 0 : 1);
ui->bg_button->setEnabled(!Settings::values.bg_red.UsingGlobal());
ConfigurationShared::SetHighlight(ui->bg_layout, !Settings::values.bg_red.UsingGlobal());
@ -133,11 +140,14 @@ void ConfigureGraphics::SetConfiguration() {
}
void ConfigureGraphics::ApplyConfiguration() {
const auto resolution_setup = static_cast<Settings::ResolutionSetup>(
ui->resolution_combobox->currentIndex() -
((Settings::IsConfiguringGlobal()) ? 0 : ConfigurationShared::USE_GLOBAL_OFFSET));
ConfigurationShared::ApplyPerGameSetting(&Settings::values.fullscreen_mode,
ui->fullscreen_mode_combobox);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.aspect_ratio,
ui->aspect_ratio_combobox);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_disk_shader_cache,
ui->use_disk_shader_cache, use_disk_shader_cache);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_gpu_emulation,
@ -165,7 +175,16 @@ void ConfigureGraphics::ApplyConfiguration() {
Settings::values.bg_green.SetValue(static_cast<u8>(bg_color.green()));
Settings::values.bg_blue.SetValue(static_cast<u8>(bg_color.blue()));
}
if (Settings::values.resolution_setup.UsingGlobal()) {
Settings::values.resolution_setup.SetValue(resolution_setup);
}
} else {
if (ui->resolution_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
Settings::values.resolution_setup.SetGlobal(true);
} else {
Settings::values.resolution_setup.SetGlobal(false);
Settings::values.resolution_setup.SetValue(resolution_setup);
}
if (ui->api->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
Settings::values.renderer_backend.SetGlobal(true);
Settings::values.shader_backend.SetGlobal(true);
@ -207,6 +226,7 @@ void ConfigureGraphics::ApplyConfiguration() {
Settings::values.bg_blue.SetValue(static_cast<u8>(bg_color.blue()));
}
}
Settings::UpdateRescalingInfo();
}
void ConfigureGraphics::changeEvent(QEvent* event) {
@ -312,6 +332,7 @@ void ConfigureGraphics::SetupPerGameUI() {
ui->device->setEnabled(Settings::values.renderer_backend.UsingGlobal());
ui->fullscreen_mode_combobox->setEnabled(Settings::values.fullscreen_mode.UsingGlobal());
ui->aspect_ratio_combobox->setEnabled(Settings::values.aspect_ratio.UsingGlobal());
ui->resolution_combobox->setEnabled(Settings::values.resolution_setup.UsingGlobal());
ui->use_asynchronous_gpu_emulation->setEnabled(
Settings::values.use_asynchronous_gpu_emulation.UsingGlobal());
ui->nvdec_emulation->setEnabled(Settings::values.nvdec_emulation.UsingGlobal());
@ -340,6 +361,9 @@ void ConfigureGraphics::SetupPerGameUI() {
ConfigurationShared::SetColoredComboBox(
ui->fullscreen_mode_combobox, ui->fullscreen_mode_label,
static_cast<int>(Settings::values.fullscreen_mode.GetValue(true)));
ConfigurationShared::SetColoredComboBox(
ui->resolution_combobox, ui->resolution_label,
static_cast<int>(Settings::values.resolution_setup.GetValue(true)));
ConfigurationShared::InsertGlobalItem(
ui->api, static_cast<int>(Settings::values.renderer_backend.GetValue(true)));
ConfigurationShared::InsertGlobalItem(