Fixed the oversaturation in the output by using a lower gamma. This is roughly tuned for launch day o3DS. If you want the previous colors back set inGamma to 2.2 and outGamma to 1.21.

Make path creation faster in case it already exists.
This commit is contained in:
profi200 2020-12-03 18:23:13 +01:00
parent 48def49f8b
commit 29413979fa
No known key found for this signature in database
GPG Key ID: 17B42AE5911139F3
4 changed files with 25 additions and 14 deletions

View File

@ -48,8 +48,8 @@ NAKED void wait_cycles(u32 cycles);
size_t safeStrcpy(char *const dst, const char *const src, size_t num);
/**
* @brief Basic string to float conversion.
* Limited to 6 after-decimal digits.
* @brief Basic string to float conversion. Limited to 6 decimal places.
* Doesn't support exponents.
*
* @param[in] str The string.
*

View File

@ -49,8 +49,8 @@
"backlight=40\n" \
"biosIntro=true\n\n" \
"[video]\n" \
"inGamma=4.0\n" \
"outGamma=2.8\n" \
"inGamma=2.2\n" \
"outGamma=1.54\n" \
"contrast=1.0\n" \
"brightness=0.0\n"
@ -77,10 +77,10 @@ static OafConfig g_oafConfig =
{
40,
true,
4.0f,
2.8f,
1.0f,
0.0f
2.2f,
1.54f,
1.f,
0.f
};
@ -578,6 +578,7 @@ static Result parseMainConfig(void)
// Apply backlight brightness.
// TODO: Move this elsewhere.
// FIXME: If any error happens before this point it will be invisible.
const u8 backlight = g_oafConfig.backlight;
GFX_setBrightness(backlight, backlight);

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include <string.h>
#include "fsutil.h"
#include "fs.h"
@ -53,17 +54,24 @@ Result fsQuickWrite(const char *const path, const void *const buf, u32 size)
Result fsMakePath(const char *const path)
{
char tmpPath[512];
Result res = fMkdir(path);
if(res != RES_FR_NO_PATH) return res;
char *tmpPath = (char*)malloc(512);
if(tmpPath == NULL) return RES_OUT_OF_MEM;
safeStrcpy(tmpPath, path, 512);
char *str;
if((str = strchr(tmpPath, ':')) == NULL) str = tmpPath;
else str++;
// Path without any dir.
if(*str == '\0') return RES_INVALID_ARG;
// Empty path.
if(*str == '\0')
{
free(tmpPath);
return RES_INVALID_ARG;
}
Result res = RES_OK;
while((str = strchr(str + 1, '/')) != NULL)
{
*str = '\0';
@ -75,5 +83,7 @@ Result fsMakePath(const char *const path)
// previous error code is not an unexpected one.
if(res == RES_OK || res == RES_FR_EXIST) res = fMkdir(tmpPath);
free(tmpPath);
return res;
}

View File

@ -46,12 +46,12 @@ size_t safeStrcpy(char *const dst, const char *const src, size_t num)
return 1;
}
strcpy(dst, src);
memcpy(dst, src, len);
return len;
}
// Limited to 6 after-decimal places.
// Limited to 6 decimal places. Doesn't support exponents.
// Based on: https://codereview.stackexchange.com/a/158724
float str2float(const char *str)
{