master brightness has different biases (are you serious, Nintendo)
also add all these biases to the OpenGL compositor
This commit is contained in:
parent
f6a55354fa
commit
86f725f2f2
|
@ -67,24 +67,24 @@ u32 SoftRenderer::ColorBlend5(u32 val1, u32 val2)
|
|||
return r | g | b | 0xFF000000;
|
||||
}
|
||||
|
||||
u32 SoftRenderer::ColorBrightnessUp(u32 val, u32 factor)
|
||||
u32 SoftRenderer::ColorBrightnessUp(u32 val, u32 factor, u32 bias)
|
||||
{
|
||||
u32 rb = val & 0x3F003F;
|
||||
u32 g = val & 0x003F00;
|
||||
|
||||
rb += (((((0x3F003F - rb) * factor) + 0x080008) >> 4) & 0x3F003F);
|
||||
g += (((((0x003F00 - g ) * factor) + 0x000800) >> 4) & 0x003F00);
|
||||
rb += (((((0x3F003F - rb) * factor) + (bias*0x010001)) >> 4) & 0x3F003F);
|
||||
g += (((((0x003F00 - g ) * factor) + (bias*0x000100)) >> 4) & 0x003F00);
|
||||
|
||||
return rb | g | 0xFF000000;
|
||||
}
|
||||
|
||||
u32 SoftRenderer::ColorBrightnessDown(u32 val, u32 factor)
|
||||
u32 SoftRenderer::ColorBrightnessDown(u32 val, u32 factor, u32 bias)
|
||||
{
|
||||
u32 rb = val & 0x3F003F;
|
||||
u32 g = val & 0x003F00;
|
||||
|
||||
rb -= ((((rb * factor) + 0x070007) >> 4) & 0x3F003F);
|
||||
g -= ((((g * factor) + 0x000700) >> 4) & 0x003F00);
|
||||
rb -= ((((rb * factor) + (bias*0x010001)) >> 4) & 0x3F003F);
|
||||
g -= ((((g * factor) + (bias*0x000100)) >> 4) & 0x003F00);
|
||||
|
||||
return rb | g | 0xFF000000;
|
||||
}
|
||||
|
@ -153,8 +153,8 @@ u32 SoftRenderer::ColorComposite(int i, u32 val1, u32 val2)
|
|||
{
|
||||
case 0: return val1;
|
||||
case 1: return ColorBlend4(val1, val2, eva, evb);
|
||||
case 2: return ColorBrightnessUp(val1, CurUnit->EVY);
|
||||
case 3: return ColorBrightnessDown(val1, CurUnit->EVY);
|
||||
case 2: return ColorBrightnessUp(val1, CurUnit->EVY, 0x8);
|
||||
case 3: return ColorBrightnessDown(val1, CurUnit->EVY, 0x7);
|
||||
case 4: return ColorBlend5(val1, val2);
|
||||
}
|
||||
|
||||
|
@ -328,7 +328,7 @@ void SoftRenderer::DrawScanline(u32 line, Unit* unit)
|
|||
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
dst[i] = ColorBrightnessUp(dst[i], factor);
|
||||
dst[i] = ColorBrightnessUp(dst[i], factor, 0x0);
|
||||
}
|
||||
}
|
||||
else if ((masterBrightness >> 14) == 2)
|
||||
|
@ -339,7 +339,7 @@ void SoftRenderer::DrawScanline(u32 line, Unit* unit)
|
|||
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
dst[i] = ColorBrightnessDown(dst[i], factor);
|
||||
dst[i] = ColorBrightnessDown(dst[i], factor, 0xF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -445,8 +445,8 @@ void SoftRenderer::DoCapture(u32 line, u32 width)
|
|||
u32 evy = (val3 >> 8) & 0x1F;
|
||||
|
||||
val1 = _3dval;
|
||||
if (compmode == 2) val1 = ColorBrightnessUp(val1, evy);
|
||||
else if (compmode == 3) val1 = ColorBrightnessDown(val1, evy);
|
||||
if (compmode == 2) val1 = ColorBrightnessUp(val1, evy, 0x8);
|
||||
else if (compmode == 3) val1 = ColorBrightnessDown(val1, evy, 0x7);
|
||||
}
|
||||
else
|
||||
val1 = val2;
|
||||
|
|
|
@ -49,8 +49,8 @@ private:
|
|||
|
||||
u32 ColorBlend4(u32 val1, u32 val2, u32 eva, u32 evb);
|
||||
u32 ColorBlend5(u32 val1, u32 val2);
|
||||
u32 ColorBrightnessUp(u32 val, u32 factor);
|
||||
u32 ColorBrightnessDown(u32 val, u32 factor);
|
||||
u32 ColorBrightnessUp(u32 val, u32 factor, u32 bias);
|
||||
u32 ColorBrightnessDown(u32 val, u32 factor, u32 bias);
|
||||
u32 ColorComposite(int i, u32 val1, u32 val2);
|
||||
|
||||
template<u32 bgmode> void DrawScanlineBGMode(u32 line);
|
||||
|
@ -78,4 +78,4 @@ private:
|
|||
void DoCapture(u32 line, u32 width);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,8 +82,7 @@ void main()
|
|||
eva = (_3dpix.a & 0x1F) + 1;
|
||||
evb = 32 - eva;
|
||||
|
||||
val1 = ((_3dpix * eva) + (val1 * evb)) >> 5;
|
||||
if (eva <= 16) val1 += ivec4(1,1,1,0);
|
||||
val1 = ((_3dpix * eva) + (val1 * evb) + 0x10) >> 5;
|
||||
val1 = min(val1, 0x3F);
|
||||
}
|
||||
else
|
||||
|
@ -103,7 +102,7 @@ void main()
|
|||
eva = val3.g;
|
||||
evb = val3.b;
|
||||
|
||||
val1 = ((val1 * eva) + (_3dpix * evb)) >> 4;
|
||||
val1 = ((val1 * eva) + (_3dpix * evb) + 0x8) >> 4;
|
||||
val1 = min(val1, 0x3F);
|
||||
}
|
||||
else
|
||||
|
@ -123,8 +122,8 @@ void main()
|
|||
evy = val3.g;
|
||||
|
||||
val1 = _3dpix;
|
||||
if (compmode == 2) val1 += ((ivec4(0x3F,0x3F,0x3F,0) - val1) * evy) >> 4;
|
||||
else if (compmode == 3) val1 -= (val1 * evy) >> 4;
|
||||
if (compmode == 2) val1 += (((0x3F - val1) * evy) + 0x8) >> 4;
|
||||
else if (compmode == 3) val1 -= ((val1 * evy) + 0x7) >> 4;
|
||||
}
|
||||
else
|
||||
val1 = val2;
|
||||
|
@ -142,7 +141,7 @@ void main()
|
|||
int evy = mbright.r & 0x1F;
|
||||
if (evy > 16) evy = 16;
|
||||
|
||||
pixel += ((ivec4(0x3F,0x3F,0x3F,0) - pixel) * evy) >> 4;
|
||||
pixel += ((0x3F - pixel) * evy) >> 4;
|
||||
}
|
||||
else if (brightmode == 2)
|
||||
{
|
||||
|
@ -150,7 +149,7 @@ void main()
|
|||
int evy = mbright.r & 0x1F;
|
||||
if (evy > 16) evy = 16;
|
||||
|
||||
pixel -= (pixel * evy) >> 4;
|
||||
pixel -= ((pixel * evy) + 0xF) >> 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue