From 64293f89425d93fca365dee31d100ecf513cf71a Mon Sep 17 00:00:00 2001 From: TuxSH <1922548+TuxSH@users.noreply.github.com> Date: Wed, 1 May 2024 17:58:15 +0200 Subject: [PATCH] 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 --- arm9/data/config_template.ini | Bin 6999 -> 6756 bytes arm9/source/config.c | 35 ++++-------------- arm9/source/config.h | 5 +-- arm9/source/patches.c | 13 ------- k11_extension/include/config.h | 3 +- sysmodules/loader/source/patcher.h | 3 +- sysmodules/pm/source/luma.h | 3 +- sysmodules/rosalina/data/config_template.ini | Bin 6999 -> 6756 bytes sysmodules/rosalina/include/luma_config.h | 3 +- sysmodules/rosalina/source/luma_config.c | 5 +-- .../rosalina/source/menus/screen_filters.c | 6 +-- 11 files changed, 19 insertions(+), 57 deletions(-) diff --git a/arm9/data/config_template.ini b/arm9/data/config_template.ini index 4b93e22fc31951d6a81bbc096ff962d29833d3e1..c1bd041f3f101e0471c55b965023c588eeb0e675 100644 GIT binary patch delta 32 ocmca^_QYgEH~VH=&aLc>7Ms5bOyii`%|35(Fo(+K9?8>;0No-CrT_o{ delta 269 zcmX}mze)o^5C(7r;X)cqQ+|a-V&vc;*a*UrD=j2qeXP0NyCHi!VgGPg3AUC2!NzA0 zuJ;9efV_YYlD&X-^UVh{zu(3F`s*#(?ax0iQ>>(t7M|f7iHi5;fFk*QJK=f$yJ#vvYZ)CTQ^ksO?U zo`DRChbhhASouy^nPSOpEA5(u{$E0o_D4wc+&cO9gv|gZi{Y_nzKW4U-K1kN7|XD& fVpHlUwF9)Q9QCiscXFC7vaHX~-bek%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 diff --git a/arm9/source/config.h b/arm9/source/config.h index 3d8cfc80..acbd20f1 100644 --- a/arm9/source/config.h +++ b/arm9/source/config.h @@ -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, diff --git a/arm9/source/patches.c b/arm9/source/patches.c index f1d7589f..6a2152cc 100644 --- a/arm9/source/patches.c +++ b/arm9/source/patches.c @@ -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) diff --git a/k11_extension/include/config.h b/k11_extension/include/config.h index b890fcff..4c3f80ec 100644 --- a/k11_extension/include/config.h +++ b/k11_extension/include/config.h @@ -33,9 +33,8 @@ enum singleOptions REDIRECTAPPTHREADS, PATCHVERSTRING, SHOWGBABOOT, - ENABLEDSIEXTFILTER, - ALLOWUPDOWNLEFTRIGHTDSI, PATCHUNITINFO, + ENABLEDSIEXTFILTER, DISABLEARM11EXCHANDLERS, ENABLESAFEFIRMROSALINA, }; diff --git a/sysmodules/loader/source/patcher.h b/sysmodules/loader/source/patcher.h index 35bd17de..62539ff0 100644 --- a/sysmodules/loader/source/patcher.h +++ b/sysmodules/loader/source/patcher.h @@ -36,9 +36,8 @@ enum singleOptions REDIRECTAPPTHREADS, PATCHVERSTRING, SHOWGBABOOT, - ENABLEDSIEXTFILTER, - ALLOWUPDOWNLEFTRIGHTDSI, PATCHUNITINFO, + ENABLEDSIEXTFILTER, DISABLEARM11EXCHANDLERS, ENABLESAFEFIRMROSALINA, }; diff --git a/sysmodules/pm/source/luma.h b/sysmodules/pm/source/luma.h index 27df022c..fdd67d03 100644 --- a/sysmodules/pm/source/luma.h +++ b/sysmodules/pm/source/luma.h @@ -30,9 +30,8 @@ enum singleOptions REDIRECTAPPTHREADS, PATCHVERSTRING, SHOWGBABOOT, - ENABLEDSIEXTFILTER, - ALLOWUPDOWNLEFTRIGHTDSI, PATCHUNITINFO, + ENABLEDSIEXTFILTER, DISABLEARM11EXCHANDLERS, ENABLESAFEFIRMROSALINA, }; diff --git a/sysmodules/rosalina/data/config_template.ini b/sysmodules/rosalina/data/config_template.ini index 4b93e22fc31951d6a81bbc096ff962d29833d3e1..c1bd041f3f101e0471c55b965023c588eeb0e675 100644 GIT binary patch delta 32 ocmca^_QYgEH~VH=&aLc>7Ms5bOyii`%|35(Fo(+K9?8>;0No-CrT_o{ delta 269 zcmX}mze)o^5C(7r;X)cqQ+|a-V&vc;*a*UrD=j2qeXP0NyCHi!VgGPg3AUC2!NzA0 zuJ;9efV_YYlD&X-^UVh{zu(3F`s*#(?ax0iQ>>(t7M|f7iHi5;fFk*QJK=f$yJ#vvYZ)CTQ^ksO?U zo`DRChbhhASouy^nPSOpEA5(u{$E0o_D4wc+&cO9gv|gZi{Y_nzKW4U-K1kN7|XD& fVpHlUwF9)Q9QCiscXFC7vaHX~-bek%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; diff --git a/sysmodules/rosalina/source/menus/screen_filters.c b/sysmodules/rosalina/source/menus/screen_filters.c index f3e0648a..53f9c620 100644 --- a/sysmodules/rosalina/source/menus/screen_filters.c +++ b/sysmodules/rosalina/source/menus/screen_filters.c @@ -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); }