rosalina: allow setting top and bot screen filters separately
This commit is contained in:
parent
35e6c5ace9
commit
777b43b285
Binary file not shown.
@ -432,33 +432,61 @@ static int configIniHandler(void* user, const char* section, const char* name, c
|
|||||||
CHECK_PARSE_OPTION(parseDecIntOption(&opt, value, -779, 899));
|
CHECK_PARSE_OPTION(parseDecIntOption(&opt, value, -779, 899));
|
||||||
cfg->ntpTzOffetMinutes = (s16)opt;
|
cfg->ntpTzOffetMinutes = (s16)opt;
|
||||||
return 1;
|
return 1;
|
||||||
} else if (strcmp(name, "screen_filters_cct") == 0) {
|
} else {
|
||||||
|
CHECK_PARSE_OPTION(-1);
|
||||||
|
}
|
||||||
|
} else if (strcmp(section, "screen_filters") == 0) {
|
||||||
|
if (strcmp(name, "screen_filters_top_cct") == 0) {
|
||||||
s64 opt;
|
s64 opt;
|
||||||
CHECK_PARSE_OPTION(parseDecIntOption(&opt, value, 1000, 25100));
|
CHECK_PARSE_OPTION(parseDecIntOption(&opt, value, 1000, 25100));
|
||||||
cfg->screenFiltersCct = (u32)opt;
|
cfg->topScreenFilter.cct = (u32)opt;
|
||||||
return 1;
|
return 1;
|
||||||
} else if (strcmp(name, "screen_filters_gamma") == 0) {
|
} else if (strcmp(name, "screen_filters_top_gamma") == 0) {
|
||||||
s64 opt;
|
s64 opt;
|
||||||
CHECK_PARSE_OPTION(parseDecFloatOption(&opt, value, 0, 1411 * FLOAT_CONV_MULT));
|
CHECK_PARSE_OPTION(parseDecFloatOption(&opt, value, 0, 1411 * FLOAT_CONV_MULT));
|
||||||
cfg->screenFiltersGammaEnc = opt;
|
cfg->topScreenFilter.gammaEnc = opt;
|
||||||
return 1;
|
return 1;
|
||||||
} else if (strcmp(name, "screen_filters_contrast") == 0) {
|
} else if (strcmp(name, "screen_filters_top_contrast") == 0) {
|
||||||
s64 opt;
|
s64 opt;
|
||||||
CHECK_PARSE_OPTION(parseDecFloatOption(&opt, value, 0, 255 * FLOAT_CONV_MULT));
|
CHECK_PARSE_OPTION(parseDecFloatOption(&opt, value, 0, 255 * FLOAT_CONV_MULT));
|
||||||
cfg->screenFiltersContrastEnc = opt;
|
cfg->topScreenFilter.contrastEnc = opt;
|
||||||
return 1;
|
return 1;
|
||||||
} else if (strcmp(name, "screen_filters_brightness") == 0) {
|
} else if (strcmp(name, "screen_filters_top_brightness") == 0) {
|
||||||
s64 opt;
|
s64 opt;
|
||||||
CHECK_PARSE_OPTION(parseDecFloatOption(&opt, value, -1 * FLOAT_CONV_MULT, 1 * FLOAT_CONV_MULT));
|
CHECK_PARSE_OPTION(parseDecFloatOption(&opt, value, -1 * FLOAT_CONV_MULT, 1 * FLOAT_CONV_MULT));
|
||||||
cfg->screenFiltersBrightnessEnc = opt;
|
cfg->topScreenFilter.brightnessEnc = opt;
|
||||||
return 1;
|
return 1;
|
||||||
} else if (strcmp(name, "screen_filters_invert") == 0) {
|
} else if (strcmp(name, "screen_filters_top_invert") == 0) {
|
||||||
bool opt;
|
bool opt;
|
||||||
CHECK_PARSE_OPTION(parseBoolOption(&opt, value));
|
CHECK_PARSE_OPTION(parseBoolOption(&opt, value));
|
||||||
cfg->screenFiltersInvert = opt;
|
cfg->topScreenFilter.invert = opt;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
} else if (strcmp(name, "screen_filters_bot_cct") == 0) {
|
||||||
else {
|
s64 opt;
|
||||||
|
CHECK_PARSE_OPTION(parseDecIntOption(&opt, value, 1000, 25100));
|
||||||
|
cfg->bottomScreenFilter.cct = (u32)opt;
|
||||||
|
return 1;
|
||||||
|
} else if (strcmp(name, "screen_filters_bot_gamma") == 0) {
|
||||||
|
s64 opt;
|
||||||
|
CHECK_PARSE_OPTION(parseDecFloatOption(&opt, value, 0, 1411 * FLOAT_CONV_MULT));
|
||||||
|
cfg->bottomScreenFilter.gammaEnc = opt;
|
||||||
|
return 1;
|
||||||
|
} else if (strcmp(name, "screen_filters_bot_contrast") == 0) {
|
||||||
|
s64 opt;
|
||||||
|
CHECK_PARSE_OPTION(parseDecFloatOption(&opt, value, 0, 255 * FLOAT_CONV_MULT));
|
||||||
|
cfg->bottomScreenFilter.contrastEnc = opt;
|
||||||
|
return 1;
|
||||||
|
} else if (strcmp(name, "screen_filters_bot_brightness") == 0) {
|
||||||
|
s64 opt;
|
||||||
|
CHECK_PARSE_OPTION(parseDecFloatOption(&opt, value, -1 * FLOAT_CONV_MULT, 1 * FLOAT_CONV_MULT));
|
||||||
|
cfg->bottomScreenFilter.brightnessEnc = opt;
|
||||||
|
return 1;
|
||||||
|
} else if (strcmp(name, "screen_filters_bot_invert") == 0) {
|
||||||
|
bool opt;
|
||||||
|
CHECK_PARSE_OPTION(parseBoolOption(&opt, value));
|
||||||
|
cfg->bottomScreenFilter.invert = opt;
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
CHECK_PARSE_OPTION(-1);
|
CHECK_PARSE_OPTION(-1);
|
||||||
}
|
}
|
||||||
} else if (strcmp(section, "autoboot") == 0) {
|
} else if (strcmp(section, "autoboot") == 0) {
|
||||||
@ -531,12 +559,19 @@ static size_t saveLumaIniConfigToStr(char *out)
|
|||||||
static const int pinOptionToDigits[] = { 0, 4, 6, 8 };
|
static const int pinOptionToDigits[] = { 0, 4, 6, 8 };
|
||||||
int pinNumDigits = pinOptionToDigits[MULTICONFIG(PIN)];
|
int pinNumDigits = pinOptionToDigits[MULTICONFIG(PIN)];
|
||||||
|
|
||||||
char screenFiltersGammaStr[32];
|
char topScreenFilterGammaStr[32];
|
||||||
char screenFiltersContrastStr[32];
|
char topScreenFilterContrastStr[32];
|
||||||
char screenFiltersBrightnessStr[32];
|
char topScreenFilterBrightnessStr[32];
|
||||||
encodedFloatToString(screenFiltersGammaStr, cfg->screenFiltersGammaEnc);
|
encodedFloatToString(topScreenFilterGammaStr, cfg->topScreenFilter.gammaEnc);
|
||||||
encodedFloatToString(screenFiltersContrastStr, cfg->screenFiltersContrastEnc);
|
encodedFloatToString(topScreenFilterContrastStr, cfg->topScreenFilter.contrastEnc);
|
||||||
encodedFloatToString(screenFiltersBrightnessStr, cfg->screenFiltersBrightnessEnc);
|
encodedFloatToString(topScreenFilterBrightnessStr, cfg->topScreenFilter.brightnessEnc);
|
||||||
|
|
||||||
|
char bottomScreenFilterGammaStr[32];
|
||||||
|
char bottomScreenFilterContrastStr[32];
|
||||||
|
char bottomScreenFilterBrightnessStr[32];
|
||||||
|
encodedFloatToString(bottomScreenFilterGammaStr, cfg->bottomScreenFilter.gammaEnc);
|
||||||
|
encodedFloatToString(bottomScreenFilterContrastStr, cfg->bottomScreenFilter.contrastEnc);
|
||||||
|
encodedFloatToString(bottomScreenFilterBrightnessStr, cfg->bottomScreenFilter.brightnessEnc);
|
||||||
|
|
||||||
int n = sprintf(
|
int n = sprintf(
|
||||||
out, (const char *)config_template_ini,
|
out, (const char *)config_template_ini,
|
||||||
@ -555,9 +590,11 @@ static size_t saveLumaIniConfigToStr(char *out)
|
|||||||
cfg->hbldr3dsxTitleId, rosalinaMenuComboStr,
|
cfg->hbldr3dsxTitleId, rosalinaMenuComboStr,
|
||||||
(int)cfg->ntpTzOffetMinutes,
|
(int)cfg->ntpTzOffetMinutes,
|
||||||
|
|
||||||
(int)cfg->screenFiltersCct, screenFiltersGammaStr,
|
(int)cfg->topScreenFilter.cct, (int)cfg->bottomScreenFilter.cct,
|
||||||
screenFiltersContrastStr, screenFiltersBrightnessStr,
|
topScreenFilterGammaStr, bottomScreenFilterGammaStr,
|
||||||
(int)cfg->screenFiltersInvert,
|
topScreenFilterContrastStr, bottomScreenFilterContrastStr,
|
||||||
|
topScreenFilterBrightnessStr, bottomScreenFilterBrightnessStr,
|
||||||
|
(int)cfg->topScreenFilter.invert, (int)cfg->bottomScreenFilter.invert,
|
||||||
|
|
||||||
cfg->autobootTwlTitleId, (int)cfg->autobootCtrAppmemtype,
|
cfg->autobootTwlTitleId, (int)cfg->autobootCtrAppmemtype,
|
||||||
|
|
||||||
@ -666,9 +703,10 @@ bool readConfig(void)
|
|||||||
configData.splashDurationMsec = 3000;
|
configData.splashDurationMsec = 3000;
|
||||||
configData.hbldr3dsxTitleId = HBLDR_DEFAULT_3DSX_TID;
|
configData.hbldr3dsxTitleId = HBLDR_DEFAULT_3DSX_TID;
|
||||||
configData.rosalinaMenuCombo = 1u << 9 | 1u << 7 | 1u << 2; // L+Start+Select
|
configData.rosalinaMenuCombo = 1u << 9 | 1u << 7 | 1u << 2; // L+Start+Select
|
||||||
configData.screenFiltersCct = 6500; // default temp, no-op
|
configData.topScreenFilter.cct = 6500; // default temp, no-op
|
||||||
configData.screenFiltersGammaEnc = 1 * FLOAT_CONV_MULT; // 1.0f
|
configData.topScreenFilter.gammaEnc = 1 * FLOAT_CONV_MULT; // 1.0f
|
||||||
configData.screenFiltersContrastEnc = 1 * FLOAT_CONV_MULT; // 1.0f
|
configData.topScreenFilter.contrastEnc = 1 * FLOAT_CONV_MULT; // 1.0f
|
||||||
|
configData.bottomScreenFilter = configData.topScreenFilter;
|
||||||
configData.autobootTwlTitleId = AUTOBOOT_DEFAULT_TWL_TID;
|
configData.autobootTwlTitleId = AUTOBOOT_DEFAULT_TWL_TID;
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
#define CONFIG_FILE "config.bin"
|
#define CONFIG_FILE "config.bin"
|
||||||
#define CONFIG_VERSIONMAJOR 3
|
#define CONFIG_VERSIONMAJOR 3
|
||||||
#define CONFIG_VERSIONMINOR 3
|
#define CONFIG_VERSIONMINOR 4
|
||||||
|
|
||||||
#define BOOTCFG_NAND BOOTCONFIG(0, 7)
|
#define BOOTCFG_NAND BOOTCONFIG(0, 7)
|
||||||
#define BOOTCFG_FIRM BOOTCONFIG(3, 7)
|
#define BOOTCFG_FIRM BOOTCONFIG(3, 7)
|
||||||
|
@ -133,11 +133,10 @@ u32 installK11Extension(u8 *pos, u32 size, bool needToInitSd, u32 baseK11VA, u32
|
|||||||
u64 hbldr3dsxTitleId;
|
u64 hbldr3dsxTitleId;
|
||||||
u32 rosalinaMenuCombo;
|
u32 rosalinaMenuCombo;
|
||||||
s16 ntpTzOffetMinutes;
|
s16 ntpTzOffetMinutes;
|
||||||
u16 screenFiltersCct;
|
|
||||||
s64 screenFiltersGammaEnc;
|
ScreenFiltersCfgData topScreenFilter;
|
||||||
s64 screenFiltersContrastEnc;
|
ScreenFiltersCfgData bottomScreenFilter;
|
||||||
s64 screenFiltersBrightnessEnc;
|
|
||||||
bool screenFiltersInvert;
|
|
||||||
u64 autobootTwlTitleId;
|
u64 autobootTwlTitleId;
|
||||||
u8 autobootCtrAppmemtype;
|
u8 autobootCtrAppmemtype;
|
||||||
} info;
|
} info;
|
||||||
@ -214,11 +213,8 @@ u32 installK11Extension(u8 *pos, u32 size, bool needToInitSd, u32 baseK11VA, u32
|
|||||||
info->hbldr3dsxTitleId = configData.hbldr3dsxTitleId;
|
info->hbldr3dsxTitleId = configData.hbldr3dsxTitleId;
|
||||||
info->rosalinaMenuCombo = configData.rosalinaMenuCombo;
|
info->rosalinaMenuCombo = configData.rosalinaMenuCombo;
|
||||||
info->ntpTzOffetMinutes = configData.ntpTzOffetMinutes;
|
info->ntpTzOffetMinutes = configData.ntpTzOffetMinutes;
|
||||||
info->screenFiltersCct = configData.screenFiltersCct;
|
info->topScreenFilter = configData.topScreenFilter;
|
||||||
info->screenFiltersGammaEnc = configData.screenFiltersGammaEnc;
|
info->bottomScreenFilter = configData.bottomScreenFilter;
|
||||||
info->screenFiltersContrastEnc = configData.screenFiltersContrastEnc;
|
|
||||||
info->screenFiltersBrightnessEnc = configData.screenFiltersBrightnessEnc;
|
|
||||||
info->screenFiltersInvert = configData.screenFiltersInvert;
|
|
||||||
info->autobootTwlTitleId = configData.autobootTwlTitleId;
|
info->autobootTwlTitleId = configData.autobootTwlTitleId;
|
||||||
info->autobootCtrAppmemtype = configData.autobootCtrAppmemtype;
|
info->autobootCtrAppmemtype = configData.autobootCtrAppmemtype;
|
||||||
info->versionMajor = VERSION_MAJOR;
|
info->versionMajor = VERSION_MAJOR;
|
||||||
|
@ -61,7 +61,15 @@ typedef volatile s64 vs64;
|
|||||||
#define ISN3DS (CFG11_SOCINFO & 2)
|
#define ISN3DS (CFG11_SOCINFO & 2)
|
||||||
#define ISDEVUNIT (CFG_UNITINFO != 0)
|
#define ISDEVUNIT (CFG_UNITINFO != 0)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct ScreenFiltersCfgData {
|
||||||
|
u16 cct;
|
||||||
|
bool invert;
|
||||||
|
s64 gammaEnc;
|
||||||
|
s64 contrastEnc;
|
||||||
|
s64 brightnessEnc;
|
||||||
|
} ScreenFiltersCfgData;
|
||||||
|
|
||||||
|
typedef struct CfgData {
|
||||||
u16 formatVersionMajor, formatVersionMinor;
|
u16 formatVersionMajor, formatVersionMinor;
|
||||||
|
|
||||||
u32 config, multiConfig, bootConfig;
|
u32 config, multiConfig, bootConfig;
|
||||||
@ -70,11 +78,9 @@ typedef struct {
|
|||||||
u64 hbldr3dsxTitleId;
|
u64 hbldr3dsxTitleId;
|
||||||
u32 rosalinaMenuCombo;
|
u32 rosalinaMenuCombo;
|
||||||
s16 ntpTzOffetMinutes;
|
s16 ntpTzOffetMinutes;
|
||||||
u16 screenFiltersCct;
|
|
||||||
s64 screenFiltersGammaEnc;
|
ScreenFiltersCfgData topScreenFilter;
|
||||||
s64 screenFiltersContrastEnc;
|
ScreenFiltersCfgData bottomScreenFilter;
|
||||||
s64 screenFiltersBrightnessEnc;
|
|
||||||
bool screenFiltersInvert;
|
|
||||||
|
|
||||||
u64 autobootTwlTitleId;
|
u64 autobootTwlTitleId;
|
||||||
u8 autobootCtrAppmemtype;
|
u8 autobootCtrAppmemtype;
|
||||||
|
@ -115,6 +115,14 @@ extern void (*initFPU)(void);
|
|||||||
extern void (*mcuReboot)(void);
|
extern void (*mcuReboot)(void);
|
||||||
extern void (*coreBarrier)(void);
|
extern void (*coreBarrier)(void);
|
||||||
|
|
||||||
|
typedef struct ScreenFiltersCfgData {
|
||||||
|
u16 cct;
|
||||||
|
bool invert;
|
||||||
|
s64 gammaEnc;
|
||||||
|
s64 contrastEnc;
|
||||||
|
s64 brightnessEnc;
|
||||||
|
} ScreenFiltersCfgData;
|
||||||
|
|
||||||
typedef struct CfwInfo
|
typedef struct CfwInfo
|
||||||
{
|
{
|
||||||
char magic[4];
|
char magic[4];
|
||||||
@ -132,11 +140,10 @@ typedef struct CfwInfo
|
|||||||
u64 hbldr3dsxTitleId;
|
u64 hbldr3dsxTitleId;
|
||||||
u32 rosalinaMenuCombo;
|
u32 rosalinaMenuCombo;
|
||||||
s16 ntpTzOffetMinutes;
|
s16 ntpTzOffetMinutes;
|
||||||
u16 screenFiltersCct;
|
|
||||||
s64 screenFiltersGammaEnc;
|
ScreenFiltersCfgData topScreenFilter;
|
||||||
s64 screenFiltersContrastEnc;
|
ScreenFiltersCfgData bottomScreenFilter;
|
||||||
s64 screenFiltersBrightnessEnc;
|
|
||||||
bool screenFiltersInvert;
|
|
||||||
u64 autobootTwlTitleId;
|
u64 autobootTwlTitleId;
|
||||||
u8 autobootCtrAppmemtype;
|
u8 autobootCtrAppmemtype;
|
||||||
} CfwInfo;
|
} CfwInfo;
|
||||||
|
@ -39,6 +39,8 @@ Result GetSystemInfoHook(s64 *out, s32 type, s32 param)
|
|||||||
{
|
{
|
||||||
switch(param)
|
switch(param)
|
||||||
{
|
{
|
||||||
|
// Please do not use these, except 0, 1, and 0x200
|
||||||
|
// Other types may get removed or reordered without notice
|
||||||
case 0:
|
case 0:
|
||||||
*out = SYSTEM_VERSION(cfwInfo.versionMajor, cfwInfo.versionMinor, cfwInfo.versionBuild);
|
*out = SYSTEM_VERSION(cfwInfo.versionMajor, cfwInfo.versionMinor, cfwInfo.versionBuild);
|
||||||
break;
|
break;
|
||||||
@ -75,22 +77,37 @@ Result GetSystemInfoHook(s64 *out, s32 type, s32 param)
|
|||||||
*out = cfwInfo.rosalinaMenuCombo;
|
*out = cfwInfo.rosalinaMenuCombo;
|
||||||
break;
|
break;
|
||||||
case 0x102:
|
case 0x102:
|
||||||
*out = cfwInfo.screenFiltersCct;
|
*out = cfwInfo.topScreenFilter.cct;
|
||||||
break;
|
break;
|
||||||
case 0x103:
|
case 0x103:
|
||||||
*out = (s64)cfwInfo.ntpTzOffetMinutes;
|
*out = (s64)cfwInfo.ntpTzOffetMinutes;
|
||||||
break;
|
break;
|
||||||
case 0x104:
|
case 0x104:
|
||||||
*out = cfwInfo.screenFiltersGammaEnc;
|
*out = cfwInfo.topScreenFilter.gammaEnc;
|
||||||
break;
|
break;
|
||||||
case 0x105:
|
case 0x105:
|
||||||
*out = cfwInfo.screenFiltersContrastEnc;
|
*out = cfwInfo.topScreenFilter.contrastEnc;
|
||||||
break;
|
break;
|
||||||
case 0x106:
|
case 0x106:
|
||||||
*out = cfwInfo.screenFiltersBrightnessEnc;
|
*out = cfwInfo.topScreenFilter.brightnessEnc;
|
||||||
break;
|
break;
|
||||||
case 0x107:
|
case 0x107:
|
||||||
*out = (s64)cfwInfo.screenFiltersInvert;
|
*out = (s64)cfwInfo.topScreenFilter.invert;
|
||||||
|
break;
|
||||||
|
case 0x108:
|
||||||
|
*out = cfwInfo.bottomScreenFilter.cct;
|
||||||
|
break;
|
||||||
|
case 0x109:
|
||||||
|
*out = cfwInfo.bottomScreenFilter.gammaEnc;
|
||||||
|
break;
|
||||||
|
case 0x10A:
|
||||||
|
*out = cfwInfo.bottomScreenFilter.contrastEnc;
|
||||||
|
break;
|
||||||
|
case 0x10B:
|
||||||
|
*out = cfwInfo.bottomScreenFilter.brightnessEnc;
|
||||||
|
break;
|
||||||
|
case 0x10C:
|
||||||
|
*out = (s64)cfwInfo.bottomScreenFilter.invert;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x200: // isRelease
|
case 0x200: // isRelease
|
||||||
|
Binary file not shown.
@ -30,13 +30,19 @@
|
|||||||
|
|
||||||
extern Menu screenFiltersMenu;
|
extern Menu screenFiltersMenu;
|
||||||
|
|
||||||
extern int screenFiltersCurrentTemperature;
|
typedef struct ScreenFilter {
|
||||||
extern float screenFiltersCurrentGamma;
|
u16 cct;
|
||||||
extern float screenFiltersCurrentContrast;
|
bool invert;
|
||||||
extern float screenFiltersCurrentBrightness;
|
float gamma;
|
||||||
extern bool screenFiltersCurrentInvert;
|
float contrast;
|
||||||
|
float brightness;
|
||||||
|
} ScreenFilter;
|
||||||
|
|
||||||
|
extern ScreenFilter topScreenFilter;
|
||||||
|
extern ScreenFilter bottomScreenFilter;
|
||||||
|
|
||||||
void ScreenFiltersMenu_RestoreSettings(void);
|
void ScreenFiltersMenu_RestoreSettings(void);
|
||||||
|
void ScreenFiltersMenu_LoadConfig(void);
|
||||||
|
|
||||||
void ScreenFiltersMenu_SetDefault(void); // 6500K (default)
|
void ScreenFiltersMenu_SetDefault(void); // 6500K (default)
|
||||||
|
|
||||||
|
@ -258,32 +258,7 @@ void menuThreadMain(void)
|
|||||||
while (!isServiceUsable("ac:u") || !isServiceUsable("hid:USER") || !isServiceUsable("gsp::Gpu"))
|
while (!isServiceUsable("ac:u") || !isServiceUsable("hid:USER") || !isServiceUsable("gsp::Gpu"))
|
||||||
svcSleepThread(250 * 1000 * 1000LL);
|
svcSleepThread(250 * 1000 * 1000LL);
|
||||||
|
|
||||||
s64 out = 0;
|
ScreenFiltersMenu_LoadConfig();
|
||||||
|
|
||||||
svcGetSystemInfo(&out, 0x10000, 0x102);
|
|
||||||
screenFiltersCurrentTemperature = (int)(u32)out;
|
|
||||||
if (screenFiltersCurrentTemperature < 1000 || screenFiltersCurrentTemperature > 25100)
|
|
||||||
screenFiltersCurrentTemperature = 6500;
|
|
||||||
|
|
||||||
svcGetSystemInfo(&out, 0x10000, 0x104);
|
|
||||||
screenFiltersCurrentGamma = (float)(out / FLOAT_CONV_MULT);
|
|
||||||
if (screenFiltersCurrentGamma < 0.0f || screenFiltersCurrentGamma > 1411.0f)
|
|
||||||
screenFiltersCurrentGamma = 1.0f;
|
|
||||||
|
|
||||||
svcGetSystemInfo(&out, 0x10000, 0x105);
|
|
||||||
screenFiltersCurrentContrast = (float)(out / FLOAT_CONV_MULT);
|
|
||||||
if (screenFiltersCurrentContrast < 0.0f || screenFiltersCurrentContrast > 255.0f)
|
|
||||||
screenFiltersCurrentContrast = 1.0f;
|
|
||||||
|
|
||||||
svcGetSystemInfo(&out, 0x10000, 0x106);
|
|
||||||
screenFiltersCurrentBrightness = (float)(out / FLOAT_CONV_MULT);
|
|
||||||
if (screenFiltersCurrentBrightness < -1.0f || screenFiltersCurrentBrightness > 1.0f)
|
|
||||||
screenFiltersCurrentBrightness = 0.0f;
|
|
||||||
|
|
||||||
svcGetSystemInfo(&out, 0x10000, 0x107);
|
|
||||||
screenFiltersCurrentInvert = (bool)out;
|
|
||||||
|
|
||||||
ScreenFiltersMenu_RestoreSettings();
|
|
||||||
|
|
||||||
hidInit(); // assume this doesn't fail
|
hidInit(); // assume this doesn't fail
|
||||||
isHidInitialized = true;
|
isHidInitialized = true;
|
||||||
|
@ -100,11 +100,9 @@ typedef struct CfgData {
|
|||||||
u64 hbldr3dsxTitleId;
|
u64 hbldr3dsxTitleId;
|
||||||
u32 rosalinaMenuCombo;
|
u32 rosalinaMenuCombo;
|
||||||
s16 ntpTzOffetMinutes;
|
s16 ntpTzOffetMinutes;
|
||||||
u16 screenFiltersCct;
|
|
||||||
float screenFiltersGamma;
|
ScreenFilter topScreenFilter;
|
||||||
float screenFiltersContrast;
|
ScreenFilter bottomScreenFilter;
|
||||||
float screenFiltersBrightness;
|
|
||||||
bool screenFiltersInvert;
|
|
||||||
|
|
||||||
u64 autobootTwlTitleId;
|
u64 autobootTwlTitleId;
|
||||||
u8 autobootCtrAppmemtype;
|
u8 autobootCtrAppmemtype;
|
||||||
@ -302,12 +300,19 @@ static size_t saveLumaIniConfigToStr(char *out, const CfgData *cfg)
|
|||||||
static const int pinOptionToDigits[] = { 0, 4, 6, 8 };
|
static const int pinOptionToDigits[] = { 0, 4, 6, 8 };
|
||||||
int pinNumDigits = pinOptionToDigits[MULTICONFIG(PIN)];
|
int pinNumDigits = pinOptionToDigits[MULTICONFIG(PIN)];
|
||||||
|
|
||||||
char screenFiltersGammaStr[32];
|
char topScreenFilterGammaStr[32];
|
||||||
char screenFiltersContrastStr[32];
|
char topScreenFilterContrastStr[32];
|
||||||
char screenFiltersBrightnessStr[32];
|
char topScreenFilterBrightnessStr[32];
|
||||||
floatToString(screenFiltersGammaStr, cfg->screenFiltersGamma, 6, false);
|
floatToString(topScreenFilterGammaStr, cfg->topScreenFilter.gamma, 6, false);
|
||||||
floatToString(screenFiltersContrastStr, cfg->screenFiltersContrast, 6, false);
|
floatToString(topScreenFilterContrastStr, cfg->topScreenFilter.contrast, 6, false);
|
||||||
floatToString(screenFiltersBrightnessStr, cfg->screenFiltersBrightness, 6, false);
|
floatToString(topScreenFilterBrightnessStr, cfg->topScreenFilter.brightness, 6, false);
|
||||||
|
|
||||||
|
char bottomScreenFilterGammaStr[32];
|
||||||
|
char bottomScreenFilterContrastStr[32];
|
||||||
|
char bottomScreenFilterBrightnessStr[32];
|
||||||
|
floatToString(bottomScreenFilterGammaStr, cfg->bottomScreenFilter.gamma, 6, false);
|
||||||
|
floatToString(bottomScreenFilterContrastStr, cfg->bottomScreenFilter.contrast, 6, false);
|
||||||
|
floatToString(bottomScreenFilterBrightnessStr, cfg->bottomScreenFilter.brightness, 6, false);
|
||||||
|
|
||||||
int n = sprintf(
|
int n = sprintf(
|
||||||
out, (const char *)config_template_ini,
|
out, (const char *)config_template_ini,
|
||||||
@ -326,9 +331,11 @@ static size_t saveLumaIniConfigToStr(char *out, const CfgData *cfg)
|
|||||||
cfg->hbldr3dsxTitleId, rosalinaMenuComboStr,
|
cfg->hbldr3dsxTitleId, rosalinaMenuComboStr,
|
||||||
(int)cfg->ntpTzOffetMinutes,
|
(int)cfg->ntpTzOffetMinutes,
|
||||||
|
|
||||||
(int)cfg->screenFiltersCct, screenFiltersGammaStr,
|
(int)cfg->topScreenFilter.cct, (int)cfg->bottomScreenFilter.cct,
|
||||||
screenFiltersContrastStr, screenFiltersBrightnessStr,
|
topScreenFilterGammaStr, bottomScreenFilterGammaStr,
|
||||||
(int)cfg->screenFiltersInvert,
|
topScreenFilterContrastStr, bottomScreenFilterContrastStr,
|
||||||
|
topScreenFilterBrightnessStr, bottomScreenFilterBrightnessStr,
|
||||||
|
(int)cfg->topScreenFilter.invert, (int)cfg->bottomScreenFilter.invert,
|
||||||
|
|
||||||
cfg->autobootTwlTitleId, (int)cfg->autobootCtrAppmemtype,
|
cfg->autobootTwlTitleId, (int)cfg->autobootCtrAppmemtype,
|
||||||
|
|
||||||
@ -388,11 +395,8 @@ void MiscellaneousMenu_SaveSettings(void)
|
|||||||
configData.hbldr3dsxTitleId = Luma_SharedConfig->hbldr_3dsx_tid;
|
configData.hbldr3dsxTitleId = Luma_SharedConfig->hbldr_3dsx_tid;
|
||||||
configData.rosalinaMenuCombo = menuCombo;
|
configData.rosalinaMenuCombo = menuCombo;
|
||||||
configData.ntpTzOffetMinutes = (s16)lastNtpTzOffset;
|
configData.ntpTzOffetMinutes = (s16)lastNtpTzOffset;
|
||||||
configData.screenFiltersCct = (u16)screenFiltersCurrentTemperature;
|
configData.topScreenFilter = topScreenFilter;
|
||||||
configData.screenFiltersGamma = screenFiltersCurrentGamma;
|
configData.bottomScreenFilter = bottomScreenFilter;
|
||||||
configData.screenFiltersContrast = screenFiltersCurrentContrast;
|
|
||||||
configData.screenFiltersBrightness = screenFiltersCurrentBrightness;
|
|
||||||
configData.screenFiltersInvert = screenFiltersCurrentInvert;
|
|
||||||
configData.autobootTwlTitleId = autobootTwlTitleId;
|
configData.autobootTwlTitleId = autobootTwlTitleId;
|
||||||
configData.autobootCtrAppmemtype = autobootCtrAppmemtype;
|
configData.autobootCtrAppmemtype = autobootCtrAppmemtype;
|
||||||
|
|
||||||
|
@ -42,19 +42,15 @@ typedef union {
|
|||||||
u32 raw;
|
u32 raw;
|
||||||
} Pixel;
|
} Pixel;
|
||||||
|
|
||||||
int screenFiltersCurrentTemperature = 6500;
|
ScreenFilter topScreenFilter;
|
||||||
float screenFiltersCurrentGamma = 1.0f;
|
ScreenFilter bottomScreenFilter;
|
||||||
float screenFiltersCurrentContrast = 1.0f;
|
|
||||||
float screenFiltersCurrentBrightness = 0.0f;
|
|
||||||
bool screenFiltersCurrentInvert = false;
|
|
||||||
|
|
||||||
static inline bool ScreenFiltersMenu_IsDefaultSettings(void)
|
static inline bool ScreenFiltersMenu_IsDefaultSettings(void)
|
||||||
{
|
{
|
||||||
bool ret = screenFiltersCurrentTemperature == 6500;
|
static const ScreenFilter defaultFilter = { 6500, false, 1.0f, 1.0f, 0.0f };
|
||||||
ret = ret && screenFiltersCurrentGamma == 1.0f;
|
bool ok1 = memcmp(&topScreenFilter, &defaultFilter, sizeof(defaultFilter)) == 0;
|
||||||
ret = ret && screenFiltersCurrentContrast == 1.0f;
|
bool ok2 = memcmp(&bottomScreenFilter, &defaultFilter, sizeof(defaultFilter)) == 0;
|
||||||
ret = ret && screenFiltersCurrentBrightness == 0.0f;
|
return ok1 && ok2;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline u8 ScreenFiltersMenu_GetColorLevel(int inLevel, float wp, float a, float b, float g)
|
static inline u8 ScreenFiltersMenu_GetColorLevel(int inLevel, float wp, float a, float b, float g)
|
||||||
@ -84,9 +80,11 @@ static u8 ScreenFilterMenu_CalculatePolynomialColorLutComponent(const float coef
|
|||||||
return (u8)CLAMP(levelInt, 0, 255); // clamp again just to be sure
|
return (u8)CLAMP(levelInt, 0, 255); // clamp again just to be sure
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ScreenFilterMenu_WritePolynomialColorLut(const float coeffs[][3], bool invert, float gamma, u32 dim)
|
static void ScreenFilterMenu_WritePolynomialColorLut(bool top, const float coeffs[][3], bool invert, float gamma, u32 dim)
|
||||||
{
|
{
|
||||||
|
if (top)
|
||||||
GPU_FB_TOP_COL_LUT_INDEX = 0;
|
GPU_FB_TOP_COL_LUT_INDEX = 0;
|
||||||
|
else
|
||||||
GPU_FB_BOTTOM_COL_LUT_INDEX = 0;
|
GPU_FB_BOTTOM_COL_LUT_INDEX = 0;
|
||||||
|
|
||||||
for (int i = 0; i <= 255; i++) {
|
for (int i = 0; i <= 255; i++) {
|
||||||
@ -96,35 +94,39 @@ static void ScreenFilterMenu_WritePolynomialColorLut(const float coeffs[][3], bo
|
|||||||
px.g = ScreenFilterMenu_CalculatePolynomialColorLutComponent(coeffs, 1, gamma, dim, inLevel);
|
px.g = ScreenFilterMenu_CalculatePolynomialColorLutComponent(coeffs, 1, gamma, dim, inLevel);
|
||||||
px.b = ScreenFilterMenu_CalculatePolynomialColorLutComponent(coeffs, 2, gamma, dim, inLevel);
|
px.b = ScreenFilterMenu_CalculatePolynomialColorLutComponent(coeffs, 2, gamma, dim, inLevel);
|
||||||
px.z = 0;
|
px.z = 0;
|
||||||
|
|
||||||
|
if (top)
|
||||||
GPU_FB_TOP_COL_LUT_ELEM = px.raw;
|
GPU_FB_TOP_COL_LUT_ELEM = px.raw;
|
||||||
|
else
|
||||||
GPU_FB_BOTTOM_COL_LUT_ELEM = px.raw;
|
GPU_FB_BOTTOM_COL_LUT_ELEM = px.raw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ScreenFiltersMenu_ApplyColorSettings(void)
|
static void ScreenFiltersMenu_ApplyColorSettings(bool top)
|
||||||
{
|
{
|
||||||
GPU_FB_TOP_COL_LUT_INDEX = 0;
|
const ScreenFilter *filter = top ? &topScreenFilter : &bottomScreenFilter;
|
||||||
GPU_FB_BOTTOM_COL_LUT_INDEX = 0;
|
|
||||||
|
|
||||||
float wp[3];
|
float wp[3];
|
||||||
colorramp_get_white_point(wp, screenFiltersCurrentTemperature);
|
colorramp_get_white_point(wp, filter->cct);
|
||||||
float a = screenFiltersCurrentContrast;
|
float a = filter->contrast;
|
||||||
float g = screenFiltersCurrentGamma;
|
float b = filter->brightness;
|
||||||
float b = screenFiltersCurrentBrightness;
|
float g = filter->gamma;
|
||||||
bool inv = screenFiltersCurrentInvert;
|
bool inv = filter->invert;
|
||||||
|
|
||||||
float poly[][3] = {
|
float poly[][3] = {
|
||||||
{ b, b, b }, // x^0
|
{ b, b, b }, // x^0
|
||||||
{ a * wp[0], a * wp[1], a * wp[2] }, // x^1
|
{ a * wp[0], a * wp[1], a * wp[2] }, // x^1
|
||||||
};
|
};
|
||||||
|
|
||||||
ScreenFilterMenu_WritePolynomialColorLut(poly, inv, g, 1);
|
ScreenFilterMenu_WritePolynomialColorLut(top, poly, inv, g, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ScreenFiltersMenu_SetCct(int cct)
|
static void ScreenFiltersMenu_SetCct(u16 cct)
|
||||||
{
|
{
|
||||||
screenFiltersCurrentTemperature = cct;
|
topScreenFilter.cct = cct;
|
||||||
ScreenFiltersMenu_ApplyColorSettings();
|
bottomScreenFilter.cct = cct;
|
||||||
|
ScreenFiltersMenu_ApplyColorSettings(true);
|
||||||
|
ScreenFiltersMenu_ApplyColorSettings(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu screenFiltersMenu = {
|
Menu screenFiltersMenu = {
|
||||||
@ -168,13 +170,67 @@ void ScreenFiltersMenu_RestoreSettings(void)
|
|||||||
svcKernelSetState(0x10000, 2);
|
svcKernelSetState(0x10000, 2);
|
||||||
svcSleepThread(5 * 1000 * 100LL);
|
svcSleepThread(5 * 1000 * 100LL);
|
||||||
|
|
||||||
ScreenFiltersMenu_ApplyColorSettings();
|
ScreenFiltersMenu_ApplyColorSettings(true);
|
||||||
|
ScreenFiltersMenu_ApplyColorSettings(false);
|
||||||
|
|
||||||
// Unpause GSP
|
// Unpause GSP
|
||||||
svcKernelSetState(0x10000, 2);
|
svcKernelSetState(0x10000, 2);
|
||||||
svcSleepThread(5 * 1000 * 100LL);
|
svcSleepThread(5 * 1000 * 100LL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScreenFiltersMenu_LoadConfig(void)
|
||||||
|
{
|
||||||
|
s64 out = 0;
|
||||||
|
|
||||||
|
svcGetSystemInfo(&out, 0x10000, 0x102);
|
||||||
|
topScreenFilter.cct = (u16)out;
|
||||||
|
if (topScreenFilter.cct < 1000 || topScreenFilter.cct > 25100)
|
||||||
|
topScreenFilter.cct = 6500;
|
||||||
|
|
||||||
|
svcGetSystemInfo(&out, 0x10000, 0x104);
|
||||||
|
topScreenFilter.gamma = (float)(out / FLOAT_CONV_MULT);
|
||||||
|
if (topScreenFilter.gamma < 0.0f || topScreenFilter.gamma > 1411.0f)
|
||||||
|
topScreenFilter.gamma = 1.0f;
|
||||||
|
|
||||||
|
svcGetSystemInfo(&out, 0x10000, 0x105);
|
||||||
|
topScreenFilter.contrast = (float)(out / FLOAT_CONV_MULT);
|
||||||
|
if (topScreenFilter.contrast < 0.0f || topScreenFilter.contrast > 255.0f)
|
||||||
|
topScreenFilter.contrast = 1.0f;
|
||||||
|
|
||||||
|
svcGetSystemInfo(&out, 0x10000, 0x106);
|
||||||
|
topScreenFilter.brightness = (float)(out / FLOAT_CONV_MULT);
|
||||||
|
if (topScreenFilter.brightness < -1.0f || topScreenFilter.brightness > 1.0f)
|
||||||
|
topScreenFilter.brightness = 0.0f;
|
||||||
|
|
||||||
|
svcGetSystemInfo(&out, 0x10000, 0x107);
|
||||||
|
topScreenFilter.invert = (bool)out;
|
||||||
|
|
||||||
|
svcGetSystemInfo(&out, 0x10000, 0x108);
|
||||||
|
bottomScreenFilter.cct = (u16)out;
|
||||||
|
if (bottomScreenFilter.cct < 1000 || bottomScreenFilter.cct > 25100)
|
||||||
|
bottomScreenFilter.cct = 6500;
|
||||||
|
|
||||||
|
svcGetSystemInfo(&out, 0x10000, 0x109);
|
||||||
|
bottomScreenFilter.gamma = (float)(out / FLOAT_CONV_MULT);
|
||||||
|
if (bottomScreenFilter.gamma < 0.0f || bottomScreenFilter.gamma > 1411.0f)
|
||||||
|
bottomScreenFilter.gamma = 1.0f;
|
||||||
|
|
||||||
|
svcGetSystemInfo(&out, 0x10000, 0x10A);
|
||||||
|
bottomScreenFilter.contrast = (float)(out / FLOAT_CONV_MULT);
|
||||||
|
if (bottomScreenFilter.contrast < 0.0f || bottomScreenFilter.contrast > 255.0f)
|
||||||
|
bottomScreenFilter.contrast = 1.0f;
|
||||||
|
|
||||||
|
svcGetSystemInfo(&out, 0x10000, 0x10B);
|
||||||
|
bottomScreenFilter.brightness = (float)(out / FLOAT_CONV_MULT);
|
||||||
|
if (bottomScreenFilter.brightness < -1.0f || bottomScreenFilter.brightness > 1.0f)
|
||||||
|
bottomScreenFilter.brightness = 0.0f;
|
||||||
|
|
||||||
|
svcGetSystemInfo(&out, 0x10000, 0x10C);
|
||||||
|
bottomScreenFilter.invert = (bool)out;
|
||||||
|
|
||||||
|
ScreenFiltersMenu_RestoreSettings();
|
||||||
|
}
|
||||||
|
|
||||||
DEF_CCT_SETTER(6500, Default)
|
DEF_CCT_SETTER(6500, Default)
|
||||||
|
|
||||||
DEF_CCT_SETTER(10000, Aquarium)
|
DEF_CCT_SETTER(10000, Aquarium)
|
||||||
@ -187,35 +243,77 @@ DEF_CCT_SETTER(2300, WarmIncandescent)
|
|||||||
DEF_CCT_SETTER(1900, Candle)
|
DEF_CCT_SETTER(1900, Candle)
|
||||||
DEF_CCT_SETTER(1200, Ember)
|
DEF_CCT_SETTER(1200, Ember)
|
||||||
|
|
||||||
static void ScreenFiltersMenu_AdvancedConfigurationChangeValue(int pos, int mult)
|
static void ScreenFiltersMenu_ClampFilter(ScreenFilter *filter)
|
||||||
{
|
{
|
||||||
switch (pos)
|
filter->cct = CLAMP(filter->cct, 1000, 25100);
|
||||||
|
filter->gamma = CLAMP(filter->gamma, 0.0f, 1411.0f); // ln(255) / ln(254/255): (254/255)^1411 <= 1/255
|
||||||
|
filter->contrast = CLAMP(filter->contrast, 0.0f, 255.0f);
|
||||||
|
filter->brightness = CLAMP(filter->brightness, -1.0f, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ScreenFiltersMenu_AdvancedConfigurationChangeValue(int pos, int mult, bool sync)
|
||||||
|
{
|
||||||
|
ScreenFilter *filter = pos >= 5 ? &bottomScreenFilter : &topScreenFilter;
|
||||||
|
ScreenFilter *otherFilter = pos >= 5 ? &topScreenFilter : &bottomScreenFilter;
|
||||||
|
|
||||||
|
int otherMult = sync ? mult : 0;
|
||||||
|
|
||||||
|
switch (pos % 5)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
screenFiltersCurrentTemperature += 100 * mult;
|
filter->cct += 100 * mult;
|
||||||
|
otherFilter->cct += 100 * otherMult;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
screenFiltersCurrentGamma += 0.01f * mult;
|
filter->gamma += 0.01f * mult;
|
||||||
|
otherFilter->gamma += 0.01f * otherMult;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
screenFiltersCurrentContrast += 0.01f * mult;
|
filter->contrast += 0.01f * mult;
|
||||||
|
otherFilter->contrast += 0.01f * otherMult;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
screenFiltersCurrentBrightness += 0.01f * mult;
|
filter->brightness += 0.01f * mult;
|
||||||
|
otherFilter->brightness += 0.01f * otherMult;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
screenFiltersCurrentInvert = !screenFiltersCurrentInvert;
|
filter->invert = !filter->invert;
|
||||||
|
otherFilter->invert = sync ? !otherFilter->invert : otherFilter->invert;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clamp
|
// Clamp
|
||||||
screenFiltersCurrentTemperature = CLAMP(screenFiltersCurrentTemperature, 1000, 25100);
|
ScreenFiltersMenu_ClampFilter(&topScreenFilter);
|
||||||
screenFiltersCurrentGamma = CLAMP(screenFiltersCurrentGamma, 0.0f, 1411.0f); // ln(255) / ln(254/255): (254/255)^1411 <= 1/255
|
ScreenFiltersMenu_ClampFilter(&bottomScreenFilter);
|
||||||
screenFiltersCurrentContrast = CLAMP(screenFiltersCurrentContrast, 0.0f, 255.0f);
|
|
||||||
screenFiltersCurrentBrightness = CLAMP(screenFiltersCurrentBrightness, -1.0f, 1.0f);
|
|
||||||
|
|
||||||
// Update the LUT
|
// Update the LUT
|
||||||
ScreenFiltersMenu_ApplyColorSettings();
|
ScreenFiltersMenu_ApplyColorSettings(true);
|
||||||
|
ScreenFiltersMenu_ApplyColorSettings(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
static u32 ScreenFiltersMenu_AdvancedConfigurationHelper(const ScreenFilter *filter, int offset, int pos, u32 posY)
|
||||||
|
{
|
||||||
|
char buf[64];
|
||||||
|
|
||||||
|
Draw_DrawCharacter(10, posY, COLOR_TITLE, pos == offset++ ? '>' : ' ');
|
||||||
|
posY = Draw_DrawFormattedString(30, posY, COLOR_WHITE, "Temperature: %12dK \n", filter->cct);
|
||||||
|
|
||||||
|
floatToString(buf, filter->gamma, 2, true);
|
||||||
|
Draw_DrawCharacter(10, posY, COLOR_TITLE, pos == offset++ ? '>' : ' ');
|
||||||
|
posY = Draw_DrawFormattedString(30, posY, COLOR_WHITE, "Gamma: %13s \n", buf);
|
||||||
|
|
||||||
|
floatToString(buf, filter->contrast, 2, true);
|
||||||
|
Draw_DrawCharacter(10, posY, COLOR_TITLE, pos == offset++ ? '>' : ' ');
|
||||||
|
posY = Draw_DrawFormattedString(30, posY, COLOR_WHITE, "Contrast: %13s \n", buf);
|
||||||
|
|
||||||
|
floatToString(buf, filter->brightness, 2, true);
|
||||||
|
Draw_DrawCharacter(10, posY, COLOR_TITLE, pos == offset++ ? '>' : ' ');
|
||||||
|
posY = Draw_DrawFormattedString(30, posY, COLOR_WHITE, "Brightness: %13s \n", buf);
|
||||||
|
|
||||||
|
Draw_DrawCharacter(10, posY, COLOR_TITLE, pos == offset++ ? '>' : ' ');
|
||||||
|
posY = Draw_DrawFormattedString(30, posY, COLOR_WHITE, "Invert: %13s \n", filter->invert ? "true" : "false");
|
||||||
|
|
||||||
|
return posY;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenFiltersMenu_AdvancedConfiguration(void)
|
void ScreenFiltersMenu_AdvancedConfiguration(void)
|
||||||
@ -224,48 +322,40 @@ void ScreenFiltersMenu_AdvancedConfiguration(void)
|
|||||||
u32 input = 0;
|
u32 input = 0;
|
||||||
u32 held = 0;
|
u32 held = 0;
|
||||||
|
|
||||||
char buf[64];
|
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
int mult = 1;
|
int mult = 1;
|
||||||
|
|
||||||
|
bool sync = true;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
Draw_Lock();
|
Draw_Lock();
|
||||||
Draw_DrawString(10, 10, COLOR_TITLE, "Screen filters menu");
|
Draw_DrawString(10, 10, COLOR_TITLE, "Screen filters menu");
|
||||||
|
|
||||||
posY = 30;
|
posY = 30;
|
||||||
posY = Draw_DrawFormattedString(10, posY, COLOR_WHITE, "Use left/right to increase/decrease the sel. value.\n");
|
posY = Draw_DrawString(10, posY, COLOR_WHITE, "Use left/right to increase/decrease the sel. value.\n");
|
||||||
posY = Draw_DrawFormattedString(10, posY, COLOR_WHITE, "Hold R to change the value faster.\n") + SPACING_Y;
|
posY = Draw_DrawString(10, posY, COLOR_WHITE, "Hold R to change the value faster.\n");
|
||||||
|
posY = Draw_DrawFormattedString(10, posY, COLOR_WHITE, "Update both screens: %s (L to toggle) \n", sync ? "yes" : "no") + SPACING_Y;
|
||||||
|
|
||||||
Draw_DrawCharacter(10, posY, COLOR_TITLE, pos == 0 ? '>' : ' ');
|
posY = Draw_DrawString(10, posY, COLOR_WHITE, "Top screen:\n");
|
||||||
posY = Draw_DrawFormattedString(30, posY, COLOR_WHITE, "Temperature: %12dK \n", screenFiltersCurrentTemperature);
|
posY = ScreenFiltersMenu_AdvancedConfigurationHelper(&topScreenFilter, 0, pos, posY) + SPACING_Y;
|
||||||
|
|
||||||
floatToString(buf, screenFiltersCurrentGamma, 2, true);
|
posY = Draw_DrawString(10, posY, COLOR_WHITE, "Bottom screen:\n");
|
||||||
Draw_DrawCharacter(10, posY, COLOR_TITLE, pos == 1 ? '>' : ' ');
|
posY = ScreenFiltersMenu_AdvancedConfigurationHelper(&bottomScreenFilter, 5, pos, posY) + SPACING_Y;
|
||||||
posY = Draw_DrawFormattedString(30, posY, COLOR_WHITE, "Gamma: %13s \n", buf);
|
|
||||||
|
|
||||||
floatToString(buf, screenFiltersCurrentContrast, 2, true);
|
|
||||||
Draw_DrawCharacter(10, posY, COLOR_TITLE, pos == 2 ? '>' : ' ');
|
|
||||||
posY = Draw_DrawFormattedString(30, posY, COLOR_WHITE, "Contrast: %13s \n", buf);
|
|
||||||
|
|
||||||
floatToString(buf, screenFiltersCurrentBrightness, 2, true);
|
|
||||||
Draw_DrawCharacter(10, posY, COLOR_TITLE, pos == 3 ? '>' : ' ');
|
|
||||||
posY = Draw_DrawFormattedString(30, posY, COLOR_WHITE, "Brightness: %13s \n", buf);
|
|
||||||
|
|
||||||
Draw_DrawCharacter(10, posY, COLOR_TITLE, pos == 4 ? '>' : ' ');
|
|
||||||
posY = Draw_DrawFormattedString(30, posY, COLOR_WHITE, "Invert: %13s \n", screenFiltersCurrentInvert ? "true" : "false");
|
|
||||||
|
|
||||||
input = waitInputWithTimeoutEx(&held, -1);
|
input = waitInputWithTimeoutEx(&held, -1);
|
||||||
mult = (held & KEY_R) ? 10 : 1;
|
mult = (held & KEY_R) ? 10 : 1;
|
||||||
|
|
||||||
|
if (input & KEY_L)
|
||||||
|
sync = !sync;
|
||||||
if (input & KEY_LEFT)
|
if (input & KEY_LEFT)
|
||||||
ScreenFiltersMenu_AdvancedConfigurationChangeValue(pos, -mult);
|
ScreenFiltersMenu_AdvancedConfigurationChangeValue(pos, -mult, sync);
|
||||||
if (input & KEY_RIGHT)
|
if (input & KEY_RIGHT)
|
||||||
ScreenFiltersMenu_AdvancedConfigurationChangeValue(pos, mult);
|
ScreenFiltersMenu_AdvancedConfigurationChangeValue(pos, mult, sync);
|
||||||
if (input & KEY_UP)
|
if (input & KEY_UP)
|
||||||
pos = (5 + pos - 1) % 5;
|
pos = (10 + pos - 1) % 10;
|
||||||
if (input & KEY_DOWN)
|
if (input & KEY_DOWN)
|
||||||
pos = (pos + 1) % 5;
|
pos = (pos + 1) % 10;
|
||||||
|
|
||||||
Draw_FlushFramebuffer();
|
Draw_FlushFramebuffer();
|
||||||
Draw_Unlock();
|
Draw_Unlock();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user