From 9fa2003bc523d1b5c51880fb54c25d61fc6aad8f Mon Sep 17 00:00:00 2001 From: luigi__ Date: Sat, 11 Apr 2009 22:07:32 +0000 Subject: [PATCH] The display capture EVA/EVB factors are now clamped to 16. This avoids corrupted colors when the game sets these factors to values over 16. --- desmume/src/GPU.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/desmume/src/GPU.cpp b/desmume/src/GPU.cpp index b19b5fdba..633a55acf 100644 --- a/desmume/src/GPU.cpp +++ b/desmume/src/GPU.cpp @@ -2518,8 +2518,8 @@ void GPU_set_DISPCAPCNT(u32 val) struct _DISPCNT * dispCnt = &(gpu->dispx_st)->dispx_DISPCNT.bits; gpu->dispCapCnt.val = val; - gpu->dispCapCnt.EVA = val & 0x1F; - gpu->dispCapCnt.EVB = (val >> 8) & 0x1F; + gpu->dispCapCnt.EVA = std::min((u32)16, (val & 0x1F)); + gpu->dispCapCnt.EVB = std::min((u32)16, ((val >> 8) & 0x1F)); gpu->dispCapCnt.writeBlock = (val >> 16) & 0x03; gpu->dispCapCnt.writeOffset = (val >> 18) & 0x03; gpu->dispCapCnt.readBlock = dispCnt->VRAM_Block;