diff --git a/desmume/ChangeLog b/desmume/ChangeLog index 4da1ed119..8b0e4e081 100644 --- a/desmume/ChangeLog +++ b/desmume/ChangeLog @@ -20,7 +20,9 @@ Graphics: bug: fix backdrop blending with garbage bug: fix 256B granularity sprite addressing for sub gpu bug: fix 128-wide captures - bug: swrast: add clear image emulation + bug: fix color overflow in capture blending + bug: swrast: add clear image and scroll emulation + bug: swrast: fixes to shadow rendering Windows: bug: improve map view tool to support more modes diff --git a/desmume/src/GPU.cpp b/desmume/src/GPU.cpp index f5e3bd156..977bc4258 100644 --- a/desmume/src/GPU.cpp +++ b/desmume/src/GPU.cpp @@ -545,7 +545,7 @@ static void GPU_InitFadeColors() for(int eva=0;eva<=16;eva++) for(int evb=0;evb<=16;evb++) { - int blend = ((c0 * eva / 16) + (c1 * evb / 16) ); + int blend = ((c0 * eva) + (c1 * evb) ) / 16; int final = std::min(31,blend); gpuBlendTable555[eva][evb][c0][c1] = final; } @@ -2574,6 +2574,7 @@ template static void GPU_ligne_DispCapture(u16 l) if ((srcA) && (srcB)) { const int todo = (gpu->dispCapCnt.capx==DISPCAPCNT::_128?128:256); + for(u16 i = 0; i < todo; i++) { u16 a,r,g,b; @@ -2581,7 +2582,7 @@ template static void GPU_ligne_DispCapture(u16 l) u16 a_alpha = srcA[i] & 0x8000; u16 b_alpha = srcB[i] & 0x8000; - if (gpu->dispCapCnt.EVA && a_alpha) + if(a_alpha) { a = 0x8000; r = ((srcA[i] & 0x1F) * gpu->dispCapCnt.EVA); @@ -2591,7 +2592,7 @@ template static void GPU_ligne_DispCapture(u16 l) else a = r = g = b = 0; - if (gpu->dispCapCnt.EVB && b_alpha) + if(b_alpha) { a = 0x8000; r += ((srcB[i] & 0x1F) * gpu->dispCapCnt.EVB); @@ -2603,6 +2604,10 @@ template static void GPU_ligne_DispCapture(u16 l) g >>= 4; b >>= 4; + r = std::min((u16)31,r); + g = std::min((u16)31,g); + b = std::min((u16)31,b); + T2WriteWord(cap_dst, i << 1, a | (b << 10) | (g << 5) | r); } } diff --git a/desmume/src/rasterize.cpp b/desmume/src/rasterize.cpp index 61de8c207..111220403 100644 --- a/desmume/src/rasterize.cpp +++ b/desmume/src/rasterize.cpp @@ -345,7 +345,8 @@ struct Shader { mode = (polyattr>>4)&0x3; //if there is no texture set, then set to the mode which doesnt even use a texture - if(sampler.texFormat == 0 && mode == 0) + //unless we're in shadow + if(sampler.texFormat == 0 && mode != 3) mode = 4; }