sysmenu: fix luminance calculation, and allow going above preset 5 in many cases.

Unlike SetLuminanceLevel, SetLuminance doesn't check if preset <= 5, and actually allows the lumiance levels provisioned for the "brightness boost mode" (brighter when adapter is plugged in), even when the feature is disabled (it is disabled for anything but the OG model, iirc).
This commit is contained in:
TuxSH 2025-07-04 00:17:11 +02:00
parent 97cc70d35d
commit da66af3f8a
2 changed files with 9 additions and 3 deletions

View File

@ -104,8 +104,13 @@ u32 getMinLuminancePreset(void)
u32 getMaxLuminancePreset(void)
{
// Unlike SetLuminanceLevel, SetLuminance doesn't
// check if preset <= 5, and actually allows the lumiance
// levels provisioned for the "brightness boost mode" (brighter
// when adapter is plugged in), even when the feature is disabled
// (it is disabled for anything but the OG model, iirc)
readCalibration();
return s_blPwmData.luminanceLevels[s_blPwmData.numLevels - 1];
return s_blPwmData.luminanceLevels[6];
}
u32 getCurrentLuminance(bool top)
@ -114,7 +119,8 @@ u32 getCurrentLuminance(bool top)
readCalibration();
const float *coeffs = s_blPwmData.coeffs[top ? (isN3DS ? 2 : 1) : 0];
bool is3d = (REG32(0x10202000 + 0x000) & 1) != 0;
const float *coeffs = s_blPwmData.coeffs[top ? (is3d ? 2 : 1) : 0];
u32 brightness = REG32(regbase + 0x40);
float ratio = getPwmRatio(s_blPwmData.brightnessMax, REG32(regbase + 0x44));

View File

@ -560,7 +560,7 @@ void SysConfigMenu_ChangeScreenBrightness(void)
posY = Draw_DrawString(10, posY, COLOR_WHITE, "Press A to start, B to exit.\n\n");
posY = Draw_DrawString(10, posY, COLOR_RED, "WARNING: \n");
posY = Draw_DrawString(10, posY, COLOR_WHITE, " * value will be limited by the presets.\n");
posY = Draw_DrawString(10, posY, COLOR_WHITE, " * value will be limited by calibration.\n");
posY = Draw_DrawString(10, posY, COLOR_WHITE, " * bottom framebuffer will be restored until\nyou exit.");
Draw_FlushFramebuffer();
Draw_Unlock();