also, do master brightness
This commit is contained in:
parent
a752b1d7c2
commit
f5a7cb71fd
|
@ -254,7 +254,7 @@ void SetDisplaySettings(int topscale, int bottomscale, bool accel)
|
||||||
FBScale[0] = accel ? 0 : topscale;
|
FBScale[0] = accel ? 0 : topscale;
|
||||||
|
|
||||||
int fbsize;
|
int fbsize;
|
||||||
if (accel) fbsize = (256*3 + 1) * 192;
|
if (accel) fbsize = (256*3 + 2) * 192;
|
||||||
else fbsize = (256 * 192) << (FBScale[0] * 2);
|
else fbsize = (256 * 192) << (FBScale[0] * 2);
|
||||||
if (Framebuffer[0][0]) delete[] Framebuffer[0][0];
|
if (Framebuffer[0][0]) delete[] Framebuffer[0][0];
|
||||||
if (Framebuffer[1][0]) delete[] Framebuffer[1][0];
|
if (Framebuffer[1][0]) delete[] Framebuffer[1][0];
|
||||||
|
@ -283,7 +283,7 @@ void SetDisplaySettings(int topscale, int bottomscale, bool accel)
|
||||||
FBScale[1] = accel ? 0 : bottomscale;
|
FBScale[1] = accel ? 0 : bottomscale;
|
||||||
|
|
||||||
int fbsize;
|
int fbsize;
|
||||||
if (accel) fbsize = (256*3 + 1) * 192;
|
if (accel) fbsize = (256*3 + 2) * 192;
|
||||||
else fbsize = (256 * 192) << (FBScale[1] * 2);
|
else fbsize = (256 * 192) << (FBScale[1] * 2);
|
||||||
if (Framebuffer[0][1]) delete[] Framebuffer[0][1];
|
if (Framebuffer[0][1]) delete[] Framebuffer[0][1];
|
||||||
if (Framebuffer[1][1]) delete[] Framebuffer[1][1];
|
if (Framebuffer[1][1]) delete[] Framebuffer[1][1];
|
||||||
|
|
|
@ -626,7 +626,7 @@ u32 GPU2D::ColorBrightnessDown(u32 val, u32 factor)
|
||||||
|
|
||||||
void GPU2D::DrawScanline(u32 line)
|
void GPU2D::DrawScanline(u32 line)
|
||||||
{
|
{
|
||||||
int stride = Accelerated ? (256*3 + 1) : LineStride;
|
int stride = Accelerated ? (256*3 + 2) : LineStride;
|
||||||
u32* dst = &Framebuffer[stride * line];
|
u32* dst = &Framebuffer[stride * line];
|
||||||
|
|
||||||
int n3dline = line;
|
int n3dline = line;
|
||||||
|
@ -804,6 +804,7 @@ void GPU2D::DrawScanline(u32 line)
|
||||||
ctl |= (EVY << 26);
|
ctl |= (EVY << 26);
|
||||||
|
|
||||||
dst[256*3] = ctl;
|
dst[256*3] = ctl;
|
||||||
|
dst[256*3 + 1] = MasterBrightness;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -367,9 +367,9 @@ void GLDrawing_DrawScreen()
|
||||||
GL_UNSIGNED_BYTE, GPU::Framebuffer[frontbuf][0]);
|
GL_UNSIGNED_BYTE, GPU::Framebuffer[frontbuf][0]);
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 768, 256<<ScreenScale[1], 192<<ScreenScale[1], GL_RGBA_INTEGER,
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 768, 256<<ScreenScale[1], 192<<ScreenScale[1], GL_RGBA_INTEGER,
|
||||||
GL_UNSIGNED_BYTE, GPU::Framebuffer[frontbuf][1]);*/
|
GL_UNSIGNED_BYTE, GPU::Framebuffer[frontbuf][1]);*/
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 256*3 + 1, 192, GL_RGBA_INTEGER,
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 256*3 + 2, 192, GL_RGBA_INTEGER,
|
||||||
GL_UNSIGNED_BYTE, GPU::Framebuffer[frontbuf][0]);
|
GL_UNSIGNED_BYTE, GPU::Framebuffer[frontbuf][0]);
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 768, 256*3 + 1, 192, GL_RGBA_INTEGER,
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 768, 256*3 + 2, 192, GL_RGBA_INTEGER,
|
||||||
GL_UNSIGNED_BYTE, GPU::Framebuffer[frontbuf][1]);
|
GL_UNSIGNED_BYTE, GPU::Framebuffer[frontbuf][1]);
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE1);
|
glActiveTexture(GL_TEXTURE1);
|
||||||
|
|
|
@ -65,13 +65,14 @@ out vec4 oColor;
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
ivec4 pixel = ivec4(texelFetch(ScreenTex, ivec2(fTexcoord), 0));
|
ivec4 pixel = ivec4(texelFetch(ScreenTex, ivec2(fTexcoord), 0));
|
||||||
ivec4 zog=pixel;
|
|
||||||
// bit0-13: BLDCNT
|
// bit0-13: BLDCNT
|
||||||
// bit14-15: DISPCNT display mode
|
// bit14-15: DISPCNT display mode
|
||||||
// bit16-20: EVA
|
// bit16-20: EVA
|
||||||
// bit21-25: EVB
|
// bit21-25: EVB
|
||||||
// bit26-30: EVY
|
// bit26-30: EVY
|
||||||
ivec4 ctl = ivec4(texelFetch(ScreenTex, ivec2(256*3, int(fTexcoord.y)), 0));
|
ivec4 ctl = ivec4(texelFetch(ScreenTex, ivec2(256*3, int(fTexcoord.y)), 0));
|
||||||
|
ivec4 mbright = ivec4(texelFetch(ScreenTex, ivec2(256*3 + 1, int(fTexcoord.y)), 0));
|
||||||
int dispmode = (ctl.g >> 6) & 0x3;
|
int dispmode = (ctl.g >> 6) & 0x3;
|
||||||
|
|
||||||
if (dispmode == 1)
|
if (dispmode == 1)
|
||||||
|
@ -182,6 +183,27 @@ ivec4 zog=pixel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dispmode != 0)
|
||||||
|
{
|
||||||
|
int brightmode = mbright.g >> 6;
|
||||||
|
if (brightmode == 1)
|
||||||
|
{
|
||||||
|
// up
|
||||||
|
int evy = mbright.r & 0x1F;
|
||||||
|
if (evy > 16) evy = 16;
|
||||||
|
|
||||||
|
pixel += ((ivec4(0x3F,0x3F,0x3F,0) - pixel) * evy) >> 4;
|
||||||
|
}
|
||||||
|
else if (brightmode == 2)
|
||||||
|
{
|
||||||
|
// down
|
||||||
|
int evy = mbright.r & 0x1F;
|
||||||
|
if (evy > 16) evy = 16;
|
||||||
|
|
||||||
|
pixel -= (pixel * evy) >> 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pixel.rgb <<= 2;
|
pixel.rgb <<= 2;
|
||||||
pixel.rgb |= (pixel.rgb >> 6);
|
pixel.rgb |= (pixel.rgb >> 6);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue