masterbrightness works now exactly as on hardware (see added comments, where the problems with some files might come from and for a test .NDS)
This commit is contained in:
parent
db5a7884fc
commit
1eba551108
|
@ -506,34 +506,34 @@ static INLINE void GPU_ligne(Screen * screen, u16 l)
|
||||||
// Bright up
|
// Bright up
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
unsigned int masterBrightFactor = 16;
|
unsigned int masterBrightFactor = gpu->masterBright.bits.Factor ;
|
||||||
// if (gpu->masterBright.bit.FactorEx)
|
|
||||||
gpu->masterBright.bits.Factor;
|
|
||||||
|
|
||||||
if (!masterBrightFactor) break ; /* when we wont do anything, we dont need to loop */
|
if (gpu->masterBright.bits.FactorEx)
|
||||||
if (masterBrightFactor == 16)
|
|
||||||
{
|
{
|
||||||
/* the formular would create only white, as (r + (31-r)) = 31 */
|
/* the formular would create only white, as (r + (31-r)) = 31 */
|
||||||
/* white = enable all bits */
|
/* white = enable all bits */
|
||||||
|
|
||||||
/* damdoum : well, i think the formula was with 63!
|
/* damdoum : well, i think the formula was with 63!
|
||||||
so (r + (63-r)) = 63 & 31 = 31 = still white*/
|
so (r + (63-r)) = 63 & 31 = 31 = still white*/
|
||||||
|
|
||||||
memset(dst,0xFF, 256*2 /* sizeof(COLOR) */) ;
|
memset(dst,0xFF, 256*2 /* sizeof(COLOR) */) ;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
if (!masterBrightFactor) break ; /* when we wont do anything, we dont need to loop */
|
||||||
for(i16 = 0; i16 < 256; ++i16)
|
for(i16 = 0; i16 < 256; ++i16)
|
||||||
{
|
{
|
||||||
COLOR dstColor;
|
COLOR dstColor;
|
||||||
|
u8 base ;
|
||||||
unsigned int r,g,b; // get components, 5bit each
|
unsigned int r,g,b; // get components, 5bit each
|
||||||
dstColor.val = T1ReadWord(dst, i16 << 1);
|
dstColor.val = T1ReadWord(dst, i16 << 1);
|
||||||
r = dstColor.bits.red;
|
r = dstColor.bits.red;
|
||||||
g = dstColor.bits.green;
|
g = dstColor.bits.green;
|
||||||
b = dstColor.bits.blue;
|
b = dstColor.bits.blue;
|
||||||
// Bright up and clamp to 5bit <-- automatic
|
// Bright up and clamp to 5bit <-- automatic
|
||||||
dstColor.bits.red = r + ((63-r)*masterBrightFactor)/16;
|
base = /*gpu->masterBright.bits.FactorEx? 63:*/ 31 ;
|
||||||
dstColor.bits.green = g + ((63-g)*masterBrightFactor)/16;
|
dstColor.bits.red = r + ((base-r)*masterBrightFactor)/16;
|
||||||
dstColor.bits.blue = b + ((63-b)*masterBrightFactor)/16;
|
dstColor.bits.green = g + ((base-g)*masterBrightFactor)/16;
|
||||||
|
dstColor.bits.blue = b + ((base-b)*masterBrightFactor)/16;
|
||||||
T2WriteWord (dst, i16 << 1, dstColor.val);
|
T2WriteWord (dst, i16 << 1, dstColor.val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -552,20 +552,24 @@ static INLINE void GPU_ligne(Screen * screen, u16 l)
|
||||||
|
|
||||||
i have seen pics of pokemon ranger getting white with 31, with 63 it is nice.
|
i have seen pics of pokemon ranger getting white with 31, with 63 it is nice.
|
||||||
it could be pb of alpha or blending or...
|
it could be pb of alpha or blending or...
|
||||||
*/
|
|
||||||
unsigned int masterBrightFactor = 16;
|
|
||||||
// if (gpu->masterBright.bit.FactorEx)
|
|
||||||
gpu->masterBright.bits.Factor;
|
|
||||||
|
|
||||||
if (!masterBrightFactor) break ; /* when we wont do anything, we dont need to loop */
|
MightyMax> created a test NDS to check how the brightness values work,
|
||||||
if (masterBrightFactor == 16)
|
and 31 seems to be correct. FactorEx is a override for max brighten/darken
|
||||||
|
See: http://mightymax.org/gfx_test_brightness.nds
|
||||||
|
The Pokemon Problem could be a problem with 8/32 bit writes not recognized yet,
|
||||||
|
i'll add that so you can check back.
|
||||||
|
|
||||||
|
*/
|
||||||
|
unsigned int masterBrightFactor = gpu->masterBright.bits.Factor ;
|
||||||
|
|
||||||
|
if (gpu->masterBright.bits.FactorEx)
|
||||||
{
|
{
|
||||||
/* the formular would create only black, as (r - r) = 0 */
|
/* the formular would create only black, as (r - r) = 0 */
|
||||||
/* black = disable all bits */
|
/* black = disable all bits */
|
||||||
memset(dst,0, 256*2 /* sizeof(COLOR) */) ;
|
memset(dst,0, 256*2 /* sizeof(COLOR) */) ;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
if (!masterBrightFactor) break ; /* when we wont do anything, we dont need to loop */
|
||||||
for(i16 = 0; i16 < 256; ++i16)
|
for(i16 = 0; i16 < 256; ++i16)
|
||||||
{
|
{
|
||||||
COLOR dstColor;
|
COLOR dstColor;
|
||||||
|
|
Loading…
Reference in New Issue