Commit 5d9e9a50 authored by StapleButter's avatar StapleButter
Browse files

no master brightness when screen is disabled.

parent c4d9d27e
......@@ -270,46 +270,49 @@ void GPU2D::DrawScanline(u32 line)
}
// master brightness
if ((MasterBrightness >> 14) == 1)
if (dispmode != 0)
{
// up
u32 factor = MasterBrightness & 0x1F;
if (factor > 16) factor = 16;
for (int i = 0; i < 256; i++)
if ((MasterBrightness >> 14) == 1)
{
u32 val = dst[i];
// up
u32 factor = MasterBrightness & 0x1F;
if (factor > 16) factor = 16;
u32 r = val & 0x00003F;
u32 g = val & 0x003F00;
u32 b = val & 0x3F0000;
for (int i = 0; i < 256; i++)
{
u32 val = dst[i];
r += (((0x00003F - r) * factor) >> 4);
g += ((((0x003F00 - g) * factor) >> 4) & 0x003F00);
b += ((((0x3F0000 - b) * factor) >> 4) & 0x3F0000);
u32 r = val & 0x00003F;
u32 g = val & 0x003F00;
u32 b = val & 0x3F0000;
dst[i] = r | g | b;
}
}
else if ((MasterBrightness >> 14) == 2)
{
// down
u32 factor = MasterBrightness & 0x1F;
if (factor > 16) factor = 16;
r += (((0x00003F - r) * factor) >> 4);
g += ((((0x003F00 - g) * factor) >> 4) & 0x003F00);
b += ((((0x3F0000 - b) * factor) >> 4) & 0x3F0000);
for (int i = 0; i < 256; i++)
dst[i] = r | g | b;
}
}
else if ((MasterBrightness >> 14) == 2)
{
u32 val = dst[i];
// down
u32 factor = MasterBrightness & 0x1F;
if (factor > 16) factor = 16;
u32 r = val & 0x00003F;
u32 g = val & 0x003F00;
u32 b = val & 0x3F0000;
for (int i = 0; i < 256; i++)
{
u32 val = dst[i];
u32 r = val & 0x00003F;
u32 g = val & 0x003F00;
u32 b = val & 0x3F0000;
r -= ((r * factor) >> 4);
g -= (((g * factor) >> 4) & 0x003F00);
b -= (((b * factor) >> 4) & 0x3F0000);
r -= ((r * factor) >> 4);
g -= (((g * factor) >> 4) & 0x003F00);
b -= (((b * factor) >> 4) & 0x3F0000);
dst[i] = r | g | b;
dst[i] = r | g | b;
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment