Config changes and fixes, see description

- Remove allow_updown_leftright_dsi (option was unused and useless)
- Hide enable_dsi_external_filter. Do not mention out-of-date wiki,
  fixes #1992
- Limit gamma to a more reasonable value of 8, fixes #1989
This commit is contained in:
TuxSH 2024-05-01 17:58:15 +02:00
parent 23e478d67a
commit 64293f8942
11 changed files with 19 additions and 57 deletions

Binary file not shown.

View File

@ -65,12 +65,11 @@ static const char *singleOptionIniNamesBoot[] = {
"app_syscore_threads_on_core_2",
"show_system_settings_string",
"show_gba_boot_screen",
"enable_dsi_external_filter",
"allow_updown_leftright_dsi",
};
static const char *singleOptionIniNamesMisc[] = {
"use_dev_unitinfo",
"enable_dsi_external_filter",
"disable_arm11_exception_handlers",
"enable_safe_firm_rosalina",
};
@ -484,7 +483,7 @@ static int configIniHandler(void* user, const char* section, const char* name, c
return 1;
} else if (strcmp(name, "screen_filters_top_gamma") == 0) {
s64 opt;
CHECK_PARSE_OPTION(parseDecFloatOption(&opt, value, 0, 1411 * FLOAT_CONV_MULT));
CHECK_PARSE_OPTION(parseDecFloatOption(&opt, value, 0, 8 * FLOAT_CONV_MULT));
cfg->topScreenFilter.gammaEnc = opt;
return 1;
} else if (strcmp(name, "screen_filters_top_contrast") == 0) {
@ -509,7 +508,7 @@ static int configIniHandler(void* user, const char* section, const char* name, c
return 1;
} else if (strcmp(name, "screen_filters_bot_gamma") == 0) {
s64 opt;
CHECK_PARSE_OPTION(parseDecFloatOption(&opt, value, 0, 1411 * FLOAT_CONV_MULT));
CHECK_PARSE_OPTION(parseDecFloatOption(&opt, value, 0, 8 * FLOAT_CONV_MULT));
cfg->bottomScreenFilter.gammaEnc = opt;
return 1;
} else if (strcmp(name, "screen_filters_bot_contrast") == 0) {
@ -657,7 +656,6 @@ static size_t saveLumaIniConfigToStr(char *out)
(int)CONFIG(AUTOBOOTEMU), (int)CONFIG(LOADEXTFIRMSANDMODULES),
(int)CONFIG(PATCHGAMES), (int)CONFIG(REDIRECTAPPTHREADS),
(int)CONFIG(PATCHVERSTRING), (int)CONFIG(SHOWGBABOOT),
(int)CONFIG(ENABLEDSIEXTFILTER), (int)CONFIG(ALLOWUPDOWNLEFTRIGHTDSI),
1 + (int)MULTICONFIG(DEFAULTEMU), 4 - (int)MULTICONFIG(BRIGHTNESS),
splashPosStr, (unsigned int)cfg->splashDurationMsec,
@ -678,8 +676,8 @@ static size_t saveLumaIniConfigToStr(char *out)
forceAudioOutputStr,
cfg->volumeSliderOverride,
(int)CONFIG(PATCHUNITINFO), (int)CONFIG(DISABLEARM11EXCHANDLERS),
(int)CONFIG(ENABLESAFEFIRMROSALINA)
(int)CONFIG(PATCHUNITINFO), (int)CONFIG(ENABLEDSIEXTFILTER),
(int)CONFIG(DISABLEARM11EXCHANDLERS), (int)CONFIG(ENABLESAFEFIRMROSALINA)
);
return n < 0 ? 0 : (size_t)n;
@ -839,8 +837,6 @@ void configMenu(bool oldPinStatus, u32 oldPinMode)
"( ) Redirect app. syscore threads to core2",
"( ) Show NAND or user string in System Settings",
"( ) Show GBA boot screen in patched AGB_FIRM",
"( ) Enable custom upscaling filters for DSi",
"( ) Allow Left+Right / Up+Down combos for DSi",
// Should always be the last 2 entries
"\nBoot chainloader",
@ -930,19 +926,6 @@ void configMenu(bool oldPinStatus, u32 oldPinMode)
"Enable showing the GBA boot screen\n"
"when booting GBA games.",
"Enable replacing the default upscaling\n"
"filter used for DS(i) software by the\n"
"contents of:\n\n"
"/luma/twl_upscaling_filter.bin\n\n"
"Refer to the wiki for further details.",
"Allow Left+Right and Up+Down button\n"
"combos (using DPAD and CPAD\n"
"simultaneously) in DS(i) software.\n\n"
"Commercial software filter these\n"
"combos on their own too, though.",
// Should always be the last 2 entries
"Boot to the Luma3DS chainloader menu.",
@ -988,8 +971,6 @@ void configMenu(bool oldPinStatus, u32 oldPinMode)
{ .visible = true },
{ .visible = true },
{ .visible = true },
{ .visible = true },
{ .visible = true },
};
//Calculate the amount of the various kinds of options and pre-select the first single one
@ -1060,13 +1041,13 @@ void configMenu(bool oldPinStatus, u32 oldPinMode)
}
drawString(false, 10, 10, COLOR_WHITE, optionsDescription[selectedOption]);
bool startPressed = false;
//Boring configuration menu
while(true)
{
u32 pressed = 0;
if (!startPressed)
if (!startPressed)
do
{
pressed = waitInput(true) & MENU_BUTTONS;
@ -1074,7 +1055,7 @@ void configMenu(bool oldPinStatus, u32 oldPinMode)
while(!pressed);
// Force the selection of "save and exit" and trigger it.
if(pressed & BUTTON_START)
if(pressed & BUTTON_START)
{
startPressed = true;
// This moves the cursor to the last entry

View File

@ -36,7 +36,7 @@
#define CONFIG_FILE "config.ini"
#define CONFIG_VERSIONMAJOR 3
#define CONFIG_VERSIONMINOR 11
#define CONFIG_VERSIONMINOR 12
#define BOOTCFG_NAND BOOTCONFIG(0, 1)
#define BOOTCFG_EMUINDEX BOOTCONFIG(1, 3)
@ -62,9 +62,8 @@ enum singleOptions
REDIRECTAPPTHREADS,
PATCHVERSTRING,
SHOWGBABOOT,
ENABLEDSIEXTFILTER,
ALLOWUPDOWNLEFTRIGHTDSI,
PATCHUNITINFO,
ENABLEDSIEXTFILTER,
DISABLEARM11EXCHANDLERS,
ENABLESAFEFIRMROSALINA,

View File

@ -797,19 +797,6 @@ void patchTwlBg(u8 *pos, u32 size)
// else error("Failed to apply enable_dsi_external_filter.");
}
}
if (CONFIG(ALLOWUPDOWNLEFTRIGHTDSI))
{
u16 *off2;
for (off2 = (u16 *)pos; (u8 *)off2 < pos + size && (off2[0] != 0x2040 || off2[1] != 0x4020); off2++);
if ((u8 *)off2 < pos + size)
{
// else error("Failed to apply allow_updown_leftright_dsi.");
for (u32 i = 0; i < 8; i++)
off2[i] = 0x46C0;
}
}
}
u32 patchLgyK11(u8 *section1, u32 section1Size, u8 *section2, u32 section2Size)

View File

@ -33,9 +33,8 @@ enum singleOptions
REDIRECTAPPTHREADS,
PATCHVERSTRING,
SHOWGBABOOT,
ENABLEDSIEXTFILTER,
ALLOWUPDOWNLEFTRIGHTDSI,
PATCHUNITINFO,
ENABLEDSIEXTFILTER,
DISABLEARM11EXCHANDLERS,
ENABLESAFEFIRMROSALINA,
};

View File

@ -36,9 +36,8 @@ enum singleOptions
REDIRECTAPPTHREADS,
PATCHVERSTRING,
SHOWGBABOOT,
ENABLEDSIEXTFILTER,
ALLOWUPDOWNLEFTRIGHTDSI,
PATCHUNITINFO,
ENABLEDSIEXTFILTER,
DISABLEARM11EXCHANDLERS,
ENABLESAFEFIRMROSALINA,
};

View File

@ -30,9 +30,8 @@ enum singleOptions
REDIRECTAPPTHREADS,
PATCHVERSTRING,
SHOWGBABOOT,
ENABLEDSIEXTFILTER,
ALLOWUPDOWNLEFTRIGHTDSI,
PATCHUNITINFO,
ENABLEDSIEXTFILTER,
DISABLEARM11EXCHANDLERS,
ENABLESAFEFIRMROSALINA,
};

View File

@ -38,9 +38,8 @@ enum singleOptions
REDIRECTAPPTHREADS,
PATCHVERSTRING,
SHOWGBABOOT,
ENABLEDSIEXTFILTER,
ALLOWUPDOWNLEFTRIGHTDSI,
PATCHUNITINFO,
ENABLEDSIEXTFILTER,
DISABLEARM11EXCHANDLERS,
ENABLESAFEFIRMROSALINA,
};

View File

@ -170,7 +170,6 @@ static size_t LumaConfig_SaveLumaIniConfigToStr(char *out, const CfgData *cfg)
(int)CONFIG(AUTOBOOTEMU), (int)CONFIG(LOADEXTFIRMSANDMODULES),
(int)CONFIG(PATCHGAMES), (int)CONFIG(REDIRECTAPPTHREADS),
(int)CONFIG(PATCHVERSTRING), (int)CONFIG(SHOWGBABOOT),
(int)CONFIG(ENABLEDSIEXTFILTER), (int)CONFIG(ALLOWUPDOWNLEFTRIGHTDSI),
1 + (int)MULTICONFIG(DEFAULTEMU), 4 - (int)MULTICONFIG(BRIGHTNESS),
splashPosStr, (unsigned int)cfg->splashDurationMsec,
@ -191,8 +190,8 @@ static size_t LumaConfig_SaveLumaIniConfigToStr(char *out, const CfgData *cfg)
forceAudioOutputStr,
cfg->volumeSliderOverride,
(int)CONFIG(PATCHUNITINFO), (int)CONFIG(DISABLEARM11EXCHANDLERS),
(int)CONFIG(ENABLESAFEFIRMROSALINA)
(int)CONFIG(PATCHUNITINFO), (int)CONFIG(ENABLEDSIEXTFILTER),
(int)CONFIG(DISABLEARM11EXCHANDLERS), (int)CONFIG(ENABLESAFEFIRMROSALINA)
);
return n < 0 ? 0 : (size_t)n;

View File

@ -198,7 +198,7 @@ void ScreenFiltersMenu_LoadConfig(void)
svcGetSystemInfo(&out, 0x10000, 0x104);
topScreenFilter.gamma = (float)(out / FLOAT_CONV_MULT);
if (topScreenFilter.gamma < 0.0f || topScreenFilter.gamma > 1411.0f)
if (topScreenFilter.gamma < 0.0f || topScreenFilter.gamma > 8.0f)
topScreenFilter.gamma = 1.0f;
svcGetSystemInfo(&out, 0x10000, 0x105);
@ -221,7 +221,7 @@ void ScreenFiltersMenu_LoadConfig(void)
svcGetSystemInfo(&out, 0x10000, 0x109);
bottomScreenFilter.gamma = (float)(out / FLOAT_CONV_MULT);
if (bottomScreenFilter.gamma < 0.0f || bottomScreenFilter.gamma > 1411.0f)
if (bottomScreenFilter.gamma < 0.0f || bottomScreenFilter.gamma > 8.0f)
bottomScreenFilter.gamma = 1.0f;
svcGetSystemInfo(&out, 0x10000, 0x10A);
@ -253,7 +253,7 @@ DEF_CCT_SETTER(1200, Ember)
static void ScreenFiltersMenu_ClampFilter(ScreenFilter *filter)
{
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->gamma = CLAMP(filter->gamma, 0.0f, 8.0f);
filter->contrast = CLAMP(filter->contrast, 0.0f, 255.0f);
filter->brightness = CLAMP(filter->brightness, -1.0f, 1.0f);
}