3DS: Fix screen darkening (fixes #1562)

This commit is contained in:
Vicki Pfau 2019-10-29 19:32:52 -07:00
parent 3d5ec91a2a
commit 7ef0c5074c
2 changed files with 43 additions and 37 deletions

View File

@ -87,6 +87,7 @@ Misc:
- Vita: L2/R2 and L3/R3 can now be mapped on PSTV (fixes mgba.io/i/1292) - Vita: L2/R2 and L3/R3 can now be mapped on PSTV (fixes mgba.io/i/1292)
Changes from beta 1: Changes from beta 1:
Other fixes: Other fixes:
- 3DS: Fix screen darkening (fixes mgba.io/i/1562)
- Vita: Fix analog controls (fixes mgba.io/i/1554) - Vita: Fix analog controls (fixes mgba.io/i/1554)
0.8 beta 1: (2019-10-20) 0.8 beta 1: (2019-10-20)

View File

@ -417,6 +417,46 @@ static void _gameUnloaded(struct mGUIRunner* runner) {
} }
} }
static u32 _setupTex(int out, bool faded) {
ctrActivateTexture(&outputTexture[out]);
u32 color;
if (!faded) {
color = 0xFFFFFFFF;
switch (darkenMode) {
case DM_NATIVE:
case DM_MAX:
break;
case DM_MULT_SCALE_BIAS:
ctrTextureBias(0x070707);
// Fall through
case DM_MULT_SCALE:
color = 0xFF707070;
// Fall through
case DM_MULT:
ctrTextureMultiply();
break;
}
} else {
color = 0xFF484848;
switch (darkenMode) {
case DM_NATIVE:
case DM_MAX:
break;
case DM_MULT_SCALE_BIAS:
ctrTextureBias(0x030303);
// Fall through
case DM_MULT_SCALE:
color = 0xFF303030;
// Fall through
case DM_MULT:
ctrTextureMultiply();
break;
}
}
return color;
}
static void _drawTex(struct mCore* core, bool faded, bool both) { static void _drawTex(struct mCore* core, bool faded, bool both) {
unsigned screen_w, screen_h; unsigned screen_w, screen_h;
switch (screenMode) { switch (screenMode) {
@ -485,45 +525,10 @@ static void _drawTex(struct mCore* core, bool faded, bool both) {
break; break;
} }
u32 color; uint32_t color = _setupTex(activeOutputTexture, faded);
if (!faded) {
color = 0xFFFFFFFF;
switch (darkenMode) {
case DM_NATIVE:
case DM_MAX:
break;
case DM_MULT_SCALE_BIAS:
ctrTextureBias(0x070707);
// Fall through
case DM_MULT_SCALE:
color = 0xFF707070;
// Fall through
case DM_MULT:
ctrTextureMultiply();
break;
}
} else {
color = 0xFF484848;
switch (darkenMode) {
case DM_NATIVE:
case DM_MAX:
break;
case DM_MULT_SCALE_BIAS:
ctrTextureBias(0x030303);
// Fall through
case DM_MULT_SCALE:
color = 0xFF303030;
// Fall through
case DM_MULT:
ctrTextureMultiply();
break;
}
}
ctrActivateTexture(&outputTexture[activeOutputTexture]);
ctrAddRectEx(color, x, y, w, h, 0, 0, corew, coreh, 0); ctrAddRectEx(color, x, y, w, h, 0, 0, corew, coreh, 0);
if (both) { if (both) {
ctrActivateTexture(&outputTexture[activeOutputTexture ^ 1]); color = _setupTex(activeOutputTexture ^ 1, faded);
ctrAddRectEx(color & 0x7FFFFFFF, x, y, w, h, 0, 0, corew, coreh, 0); ctrAddRectEx(color & 0x7FFFFFFF, x, y, w, h, 0, 0, corew, coreh, 0);
} }
ctrFlushBatch(); ctrFlushBatch();