From f4c01c4b577ba51d52fc41054f57feb28ea773fc Mon Sep 17 00:00:00 2001 From: rogerman Date: Wed, 4 Oct 2017 00:32:43 -0700 Subject: [PATCH] GPU: Fix bug where the backlight intensity would be incorrectly averaged if frameskipping is enabled. (Regression from commit f5c9a36.) --- desmume/src/GPU.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/desmume/src/GPU.cpp b/desmume/src/GPU.cpp index cbb87bcb1..d568a5268 100644 --- a/desmume/src/GPU.cpp +++ b/desmume/src/GPU.cpp @@ -8115,11 +8115,9 @@ void GPUSubsystem::RenderLine(const size_t l) this->_displayInfo.needConvertColorFormat[NDSDisplayID_Main] = (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev); this->_displayInfo.needConvertColorFormat[NDSDisplayID_Touch] = (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev); - // Set the average backlight intensity and then reset the current total. + // Set the average backlight intensity over 263 H-blanks. this->_displayInfo.backlightIntensity[NDSDisplayID_Main] = this->_backlightIntensityTotal[NDSDisplayID_Main] / 263.0f; this->_displayInfo.backlightIntensity[NDSDisplayID_Touch] = this->_backlightIntensityTotal[NDSDisplayID_Touch] / 263.0f; - this->_backlightIntensityTotal[NDSDisplayID_Main] = 0.0f; - this->_backlightIntensityTotal[NDSDisplayID_Touch] = 0.0f; this->_engineMain->UpdateMasterBrightnessDisplayInfo(this->_displayInfo); this->_engineSub->UpdateMasterBrightnessDisplayInfo(this->_displayInfo); @@ -8137,6 +8135,10 @@ void GPUSubsystem::RenderLine(const size_t l) } } + // Reset the current backlight intensity total. + this->_backlightIntensityTotal[NDSDisplayID_Main] = 0.0f; + this->_backlightIntensityTotal[NDSDisplayID_Touch] = 0.0f; + if (this->_frameNeedsFinish) { this->_frameNeedsFinish = false;