From bc05d5f0d87ac977e7535d52cce10fb6cd2535fa Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Wed, 27 Nov 2019 17:08:17 +0700 Subject: [PATCH] Make optimization implemented in e0418c3c342c6 as optional. S. F. Rush looks much better without the optimization. Fixed #2068 S. F. Rush and Rush 2 - Regressions --- ini/GLideN64.custom.ini | 4 ++ src/Config.cpp | 2 +- src/Config.h | 6 +++ src/GLideNUI/ConfigDialog.cpp | 10 +++-- src/GLideNUI/ConfigDialog.h | 2 + src/GLideNUI/configDialog.ui | 65 +++++++++++++++++------------- src/TexrectDrawer.cpp | 3 ++ src/mupenplus/Config_mupenplus.cpp | 4 +- 8 files changed, 61 insertions(+), 35 deletions(-) diff --git a/ini/GLideN64.custom.ini b/ini/GLideN64.custom.ini index b7de67c6..fa135f87 100644 --- a/ini/GLideN64.custom.ini +++ b/ini/GLideN64.custom.ini @@ -182,18 +182,22 @@ graphics2D\correctTexrectCoords=2 [RUSH%202] frameBufferEmulation\bufferSwapMode=1 +graphics2D\correctTexrectCoords=2 [SAN%20FRANCISCO%20RUSH] Good_Name=San Francisco Rush Extreme Racing (U) frameBufferEmulation\bufferSwapMode=1 +graphics2D\enableNativeResTexrects=2 [S.F.RUSH] Good_Name=San Francisco Rush Extreme Racing (E) frameBufferEmulation\bufferSwapMode=1 +graphics2D\enableNativeResTexrects=2 [S.F.%20RUSH] Good_Name=San Francisco Rush Extreme Racing (U) frameBufferEmulation\bufferSwapMode=1 +graphics2D\enableNativeResTexrects=2 [SHADOWMAN] Good_Name=Shadow Man (B)(E)(F)(G)(U) diff --git a/src/Config.cpp b/src/Config.cpp index 020a466c..0c3178f0 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -50,7 +50,7 @@ void Config::resetToDefaults() #endif graphics2D.correctTexrectCoords = tcDisable; - graphics2D.enableNativeResTexrects = 0; + graphics2D.enableNativeResTexrects = NativeResTexrectsMode::ntDisable; graphics2D.bgMode = BGMode::bgStripped; frameBufferEmulation.enable = 1; diff --git a/src/Config.h b/src/Config.h index 45c33936..c53924a3 100644 --- a/src/Config.h +++ b/src/Config.h @@ -68,6 +68,12 @@ struct Config bgStripped = 1 }; + enum NativeResTexrectsMode { + ntDisable = 0, + ntOptimized, + ntUnptimized + }; + struct { u32 correctTexrectCoords; u32 enableNativeResTexrects; diff --git a/src/GLideNUI/ConfigDialog.cpp b/src/GLideNUI/ConfigDialog.cpp index 95f40e01..74f0bb39 100644 --- a/src/GLideNUI/ConfigDialog.cpp +++ b/src/GLideNUI/ConfigDialog.cpp @@ -182,8 +182,7 @@ void ConfigDialog::_init(bool reInit, bool blockCustomSettings) ui->halosRemovalCheckBox->setChecked(config.texture.enableHalosRemoval != 0); - ui->nativeRes2D_checkBox->toggle(); - ui->nativeRes2D_checkBox->setChecked(config.graphics2D.enableNativeResTexrects != 0); + ui->nativeRes2DComboBox->setCurrentIndex(config.graphics2D.enableNativeResTexrects); ui->gammaCorrectionNoteFrame->setHidden(true); ui->gammaLevelSpinBox->setValue(config.gammaCorrection.force != 0 ? config.gammaCorrection.level : 2.0); @@ -483,7 +482,7 @@ void ConfigDialog::accept(bool justSave) { config.graphics2D.bgMode = Config::BGMode::bgStripped; config.texture.enableHalosRemoval = ui->halosRemovalCheckBox->isChecked() ? 1 : 0; - config.graphics2D.enableNativeResTexrects = ui->nativeRes2D_checkBox->isChecked() ? 1 : 0; + config.graphics2D.enableNativeResTexrects = ui->nativeRes2DComboBox->currentIndex(); config.frameBufferEmulation.enable = ui->frameBufferCheckBox->isChecked() ? 1 : 0; @@ -977,3 +976,8 @@ void ConfigDialog::on_removeProfilePushButton_clicked() ui->removeProfilePushButton->setDisabled(ui->profilesComboBox->count() == 3); } } + +void ConfigDialog::on_nativeRes2DComboBox_currentIndexChanged(int index) +{ + ui->fixTexrectFrame->setEnabled(index == 0); +} diff --git a/src/GLideNUI/ConfigDialog.h b/src/GLideNUI/ConfigDialog.h index 3304dd42..ba39f5e7 100644 --- a/src/GLideNUI/ConfigDialog.h +++ b/src/GLideNUI/ConfigDialog.h @@ -76,6 +76,8 @@ private slots: void on_removeProfilePushButton_clicked(); + void on_nativeRes2DComboBox_currentIndexChanged(int index); + private: void _init(bool reInit = false, bool blockCustomSettings = false); void _getTranslations(QStringList & _translationFiles) const; diff --git a/src/GLideNUI/configDialog.ui b/src/GLideNUI/configDialog.ui index a24b1f82..a6c282e7 100644 --- a/src/GLideNUI/configDialog.ui +++ b/src/GLideNUI/configDialog.ui @@ -1419,6 +1419,42 @@ 0 + + + + + + <html><head/><body><p>When checked, 2D elements are rendered at the N64s resolution before copying them to output. This usually eliminates display issues with 2D elements, but it can be slow. This option uses heuristics to detect adjacent 2D elements that doesn't work for every game.</p><p>[Recommended: <span style=" font-style:italic;">Checked, unless you have performance problems</span>]</p></body></html> + + + Render 2D elements in N64 resolution (best quality, can be slow): + + + + + + + <html><head/><body><p>When checked, 2D elements are rendered at the N64s resolution before copying them to output. This usually eliminates display issues with 2D elements, but it can be slow. This option uses heuristics to detect adjacent 2D elements that doesn't work for every game.</p><p>[Recommended: <span style=" font-style:italic;">Checked, unless you have performance problems</span>]</p></body></html> + + + + Disable + + + + + Enable optimized + + + + + Enable unoptimized + + + + + + @@ -1426,19 +1462,6 @@ - - - - <html><head/><body><p>When checked, 2D elements are rendered at the N64s resolution before copying them to output. This usually eliminates display issues with 2D elements, but it can be slow. This option uses heuristics to detect adjacent 2D elements that doesn't work for every game.</p><p>[Recommended: <span style=" font-style:italic;">Checked, unless you have performance problems</span>]</p></body></html> - - - Render 2D elements in N64 resolution (best quality, can be slow) - - - true - - - @@ -3945,22 +3968,6 @@ - - nativeRes2D_checkBox - toggled(bool) - fixTexrectFrame - setDisabled(bool) - - - 235 - 350 - - - 253 - 446 - - - frameBufferCheckBox toggled(bool) diff --git a/src/TexrectDrawer.cpp b/src/TexrectDrawer.cpp index da837d94..426ef4b9 100644 --- a/src/TexrectDrawer.cpp +++ b/src/TexrectDrawer.cpp @@ -4,6 +4,7 @@ #include #include #include +#include "Config.h" #include "DisplayWindow.h" #include "Textures.h" #include "RDP.h" @@ -133,6 +134,8 @@ TexrectDrawer::iRect TexrectDrawer::_getiRect(u32 w0, u32 w1) const bool TexrectDrawer::_lookAhead(bool _checkCoordinates) const { + if (config.graphics2D.enableNativeResTexrects != Config::NativeResTexrectsMode::ntOptimized) + return true; if (RSP.LLE) return true; switch (GBI.getMicrocodeType()) { diff --git a/src/mupenplus/Config_mupenplus.cpp b/src/mupenplus/Config_mupenplus.cpp index 2f079c7c..a29f20ea 100644 --- a/src/mupenplus/Config_mupenplus.cpp +++ b/src/mupenplus/Config_mupenplus.cpp @@ -94,7 +94,7 @@ bool Config_SetDefault() //#2D graphics Settings res = ConfigSetDefaultInt(g_configVideoGliden64, "CorrectTexrectCoords", config.graphics2D.correctTexrectCoords, "Make texrect coordinates continuous to avoid black lines between them. (0=Off, 1=Auto, 2=Force)"); assert(res == M64ERR_SUCCESS); - res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableNativeResTexrects", config.graphics2D.enableNativeResTexrects, "Render 2D texrects in native resolution to fix misalignment between parts of 2D image."); + res = ConfigSetDefaultInt(g_configVideoGliden64, "EnableNativeResTexrects", config.graphics2D.enableNativeResTexrects, "Render 2D texrects in native resolution to fix misalignment between parts of 2D image. (0=Off, 1=Optimized, 2=Unoptimized)"); assert(res == M64ERR_SUCCESS); res = ConfigSetDefaultInt(g_configVideoGliden64, "BackgroundsMode", config.graphics2D.bgMode, "Render backgrounds mode (HLE only). (0=One piece (fast), 1=Stripped (precise))"); assert(res == M64ERR_SUCCESS); @@ -407,7 +407,7 @@ void Config_LoadConfig() #endif //#2D graphics Settings config.graphics2D.correctTexrectCoords = ConfigGetParamInt(g_configVideoGliden64, "CorrectTexrectCoords"); - config.graphics2D.enableNativeResTexrects = ConfigGetParamBool(g_configVideoGliden64, "EnableNativeResTexrects"); + config.graphics2D.enableNativeResTexrects = ConfigGetParamInt(g_configVideoGliden64, "EnableNativeResTexrects"); config.graphics2D.bgMode = ConfigGetParamInt(g_configVideoGliden64, "BackgroundsMode"); //#Frame Buffer Settings:" config.frameBufferEmulation.enable = ConfigGetParamBool(g_configVideoGliden64, "EnableFBEmulation");