3DS: Fix screen darkening (fixes #1562)
Vicki Pfau vi@endrift.com
Tue, 29 Oct 2019 19:32:52 -0700
2 files changed,
43 insertions(+),
37 deletions(-)
M
CHANGES
→
CHANGES
@@ -87,6 +87,7 @@ - Switch: Support file associations
- Vita: L2/R2 and L3/R3 can now be mapped on PSTV (fixes mgba.io/i/1292) Changes from beta 1: Other fixes: + - 3DS: Fix screen darkening (fixes mgba.io/i/1562) - Vita: Fix analog controls (fixes mgba.io/i/1554) 0.8 beta 1: (2019-10-20)
M
src/platform/3ds/main.c
→
src/platform/3ds/main.c
@@ -417,6 +417,46 @@ break;
} } +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) { unsigned screen_w, screen_h; switch (screenMode) {@@ -485,45 +525,10 @@ ctrSetViewportSize(screen_w, screen_h, false);
break; } - 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; - } - - } - ctrActivateTexture(&outputTexture[activeOutputTexture]); + uint32_t color = _setupTex(activeOutputTexture, faded); ctrAddRectEx(color, x, y, w, h, 0, 0, corew, coreh, 0); if (both) { - ctrActivateTexture(&outputTexture[activeOutputTexture ^ 1]); + color = _setupTex(activeOutputTexture ^ 1, faded); ctrAddRectEx(color & 0x7FFFFFFF, x, y, w, h, 0, 0, corew, coreh, 0); } ctrFlushBatch();