From cf6345497b09b8a7fe82bed54dbd5b9e519f817c Mon Sep 17 00:00:00 2001 From: zeromus Date: Fri, 30 Mar 2012 05:50:39 +0000 Subject: [PATCH] gpu-backtrack a little bit from r4073, which introduced bugs involved with flashing colors during fully-faded transitions between game modes. i left insufficient records at the time to know what i was trying to fix by r4073, so I can't double check it, but I think this checkin is even better than before while fixing the noted regressions. --- desmume/src/GPU.cpp | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/desmume/src/GPU.cpp b/desmume/src/GPU.cpp index 23c6c335c..4c771a7ed 100644 --- a/desmume/src/GPU.cpp +++ b/desmume/src/GPU.cpp @@ -1,7 +1,8 @@ -/* Copyright (C) 2006 yopyop - Copyright (C) 2006-2007 Theo Berkau - Copyright (C) 2007 shash - Copyright (C) 2008-2011 DeSmuME team +/* + Copyright (C) 2006 yopyop + Copyright (C) 2006-2007 Theo Berkau + Copyright (C) 2007 shash + Copyright (C) 2008-2012 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,6 +18,7 @@ along with the this software. If not, see . */ + #include #include #include @@ -2033,13 +2035,24 @@ static void GPU_RenderLine_layer(NDS_Screen * screen, u16 l) //we need to write backdrop colors in the same way as we do BG pixels in order to do correct window processing //this is currently eating up 2fps or so. it is a reasonable candidate for optimization. gpu->currBgNum = 5; - switch(gpu->setFinalColorBck_funcNum) { - //for backdrops, effects arent applied. - case 0: case 1: - case 2: case 3: + switch(gpu->setFinalColorBck_funcNum) + { + //for backdrops, blend isnt applied (it's illogical, isnt it?) + case 0: + case 1: memset_u16_le<256>(gpu->currDst,backdrop_color); break; + //for backdrops, fade in and fade out can be applied if it's a 1st target screen + case 2: + if(gpu->BLDCNT & 0x20) //backdrop is selected for color effect + memset_u16_le<256>(gpu->currDst,gpu->currentFadeInColors[backdrop_color]); + break; + case 3: + if(gpu->BLDCNT & 0x20) //backdrop is selected for color effect + memset_u16_le<256>(gpu->currDst,gpu->currentFadeOutColors[backdrop_color]); + break; + //windowed cases apparently need special treatment? why? can we not render the backdrop? how would that even work? case 4: for(int x=0;x<256;x++) gpu->___setFinalColorBck(backdrop_color,x,1); break; case 5: for(int x=0;x<256;x++) gpu->___setFinalColorBck(backdrop_color,x,1); break;