diff --git a/include/util.h b/include/util.h
index 172be90..b97f77c 100644
--- a/include/util.h
+++ b/include/util.h
@@ -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.
*
diff --git a/source/arm11/main.c b/source/arm11/main.c
index 173bc58..19f4c83 100644
--- a/source/arm11/main.c
+++ b/source/arm11/main.c
@@ -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);
diff --git a/source/fsutil.c b/source/fsutil.c
index 7814159..2a4d4d8 100644
--- a/source/fsutil.c
+++ b/source/fsutil.c
@@ -16,6 +16,7 @@
* along with this program. If not, see .
*/
+#include
#include
#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;
}
diff --git a/source/util.c b/source/util.c
index 6864372..c11d3f8 100644
--- a/source/util.c
+++ b/source/util.c
@@ -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)
{