From ea4d0960a06d7536e1773fb627963350fb2842b8 Mon Sep 17 00:00:00 2001 From: rogerman Date: Sun, 31 Jan 2016 03:37:40 +0000 Subject: [PATCH] GPU: - Fix bug where 3D layers still needed to be rendered even when the DISPCNT.BG0_Enable flag is disabled. Fixes minimap rendering in Advance Wars: Dual Strike during some conversations. (Regression from r5255.) --- desmume/src/GPU.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/desmume/src/GPU.cpp b/desmume/src/GPU.cpp index 7ee2b0f46..dcf83e5c2 100644 --- a/desmume/src/GPU.cpp +++ b/desmume/src/GPU.cpp @@ -4127,7 +4127,13 @@ void GPUEngineA::_RenderLine_Layer(const u16 l, u16 *dstColorLine, const size_t const GPULayerID layerID = (GPULayerID)item->BGs[i]; if (this->_enableLayer[layerID]) { - if (layerID == GPULayerID_BG0 && this->is3DEnabled) + // When determining whether to render the BG0 layer as a 3D layer, we only need to + // check the DISPCNT.BG0_3D flag. There is no need to check the DISPCNT.BG0_Enable + // flag here, as this flag could be disabled while the DISPCNT.BG0_3D flag is enabled. + // + // Test case: During some conversations in Advance Wars: Dual Strike, the minimap + // will be rendered as garbage pixels unless the DISPCNT.BG0_Enable flag is ignored. + if (layerID == GPULayerID_BG0 && (this->_IORegisterMap->DISPCNT.BG0_3D != 0)) { const NDSDisplayInfo &dispInfo = GPU->GetDisplayInfo(); const float customWidthScale = (float)dispInfo.customWidth / (float)GPU_FRAMEBUFFER_NATIVE_WIDTH;