From 2d26f51d560d3c5e318606a2098a1a11ba898148 Mon Sep 17 00:00:00 2001 From: Harrison <53527582+HTV04@users.noreply.github.com> Date: Thu, 25 Feb 2021 22:35:26 -0500 Subject: [PATCH] Changed backlightRange to maxBacklight See updated README for more details. --- README.md | 11 +++++----- include/arm11/fmt.h | 2 +- source/arm11/fmt.c | 2 +- source/arm11/open_agb_firm.c | 41 +++++++++++++++++++----------------- 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index f116f51..47737a2 100644 --- a/README.md +++ b/README.md @@ -54,12 +54,11 @@ Video-related settings. ### Advanced Options for advanced users. No pun intended. **If you don't know what you're doing, leave these options on the default settings.** -`u8 backlightRange` - Backlight range preset (default: `0`, max: `2`) -* `0`: Recommended (`20`-`64`) -* `1`: Old 3DS (`20`-`117`) -* `2`: New 3DS (`16`-`142`)* - -*Please do not use the New 3DS range on an Old 3DS. +`bool maxBacklight` - Extend backlight limit (default: `false`) +* `false`: `20`-`64` +* `true`: + * Old 3DS: `20`-`117` + * New 3DS: `16`-`142` ## Compiling If you're using Windows 10, install and perform the following steps using [WSL 2](https://docs.microsoft.com/en-us/windows/wsl/install-win10). diff --git a/include/arm11/fmt.h b/include/arm11/fmt.h index 6d2783f..274b508 100644 --- a/include/arm11/fmt.h +++ b/include/arm11/fmt.h @@ -2,7 +2,7 @@ /* * This file is part of Luma3DS -* Copyright (C) 2016-2017 Aurora Wright, TuxSH +* Copyright (C) 2016-2020 Aurora Wright, TuxSH * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/source/arm11/fmt.c b/source/arm11/fmt.c index 89886fb..e1cbafe 100644 --- a/source/arm11/fmt.c +++ b/source/arm11/fmt.c @@ -1,6 +1,6 @@ /* * This file is part of Luma3DS -* Copyright (C) 2016-2017 Aurora Wright, TuxSH +* Copyright (C) 2016-2020 Aurora Wright, TuxSH * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/source/arm11/open_agb_firm.c b/source/arm11/open_agb_firm.c index d36c4b4..829513a 100644 --- a/source/arm11/open_agb_firm.c +++ b/source/arm11/open_agb_firm.c @@ -52,7 +52,7 @@ "contrast=1.0\n" \ "brightness=0.0\n\n" \ "[advanced]\n" \ - "backlightRange=0\n" \ + "maxBacklight=false\n" \ typedef struct @@ -69,7 +69,7 @@ typedef struct float brightness; // [advanced] - u8 backlightRange; + bool maxBacklight; } OafConfig; typedef struct @@ -97,7 +97,7 @@ static OafConfig g_oafConfig = 1.54f, 1.f, 0.f, - 0 + false }; static KHandle g_frameReadyEvent = 0; @@ -534,8 +534,8 @@ static int confIniHandler(void* user, const char* section, const char* name, con }*/ else if(strcmp(section, "advanced") == 0) { - if(strcmp(name, "backlightRange") == 0) - config->backlightRange = (u8)strtoul(value, NULL, 10); + if(strcmp(name, "maxBacklight") == 0) + config->maxBacklight = (strcmp(value, "true") == 0 ? true : false); } else return 0; // Error. @@ -606,23 +606,26 @@ static Result handleFsStuff(char romAndSavePath[512]) // Parse config. parseConfig("config.ini", /* 0, */ &g_oafConfig); { // TODO: Move this elsewhere? - const u8 backlightRange = g_oafConfig.backlightRange; + const bool maxBacklight = g_oafConfig.maxBacklight; u8 backlightMax; u8 backlightMin; - switch(backlightRange) + if(maxBacklight) { - case 1: - backlightMax = 117; - backlightMin = 20; - break; - case 2: - backlightMax = 142; - backlightMin = 16; - break; - default: - backlightMax = 64; - backlightMin = 20; - break; + if(MCU_getSystemModel() >= 4) + { + backlightMax=142; + backlightMin=16; + } + else + { + backlightMax=117; + backlightMin=20; + } + } + else + { + backlightMax=64; + backlightMin=20; } const u8 backlight = g_oafConfig.backlight;