diff --git a/source/draw.c b/source/draw.c index 420b5a0..0cae22c 100644 --- a/source/draw.c +++ b/source/draw.c @@ -30,9 +30,8 @@ #include "screen.h" #include "utils.h" #include "fs.h" -#include "font.h" -#include #include "fmt.h" +#include "font.h" bool loadSplash(void) { diff --git a/source/firm.c b/source/firm.c index 0371149..310b7ed 100755 --- a/source/firm.c +++ b/source/firm.c @@ -326,10 +326,10 @@ static inline void copySection0AndInjectSystemModules(FirmwareType firmType, boo if(loadFromStorage) { - char fileName[64]; + char fileName[24]; //Read modules from files if they exist - sprintf(fileName, "%.8s.cxi", moduleName); + sprintf(fileName, "sysmodules/%.8s.cxi", moduleName); dstModuleSize = getFileSize(fileName); @@ -349,7 +349,7 @@ static inline void copySection0AndInjectSystemModules(FirmwareType firmType, boo const u8 *module; - if(firmType == NATIVE_FIRM && memcmp(moduleName, "loader", 6 + 1) == 0) + if(firmType == NATIVE_FIRM && memcmp(moduleName, "loader", 6) == 0) { module = injector_bin; dstModuleSize = injector_bin_size; diff --git a/source/fs.c b/source/fs.c index 446a8bd..5272778 100644 --- a/source/fs.c +++ b/source/fs.c @@ -142,7 +142,7 @@ void loadPayload(u32 pressed, const char *payloadPath) DIR dir; FILINFO info; FRESULT result; - char path[128]; + char path[22]; result = f_findfirst(&dir, &info, "payloads", pattern); @@ -272,8 +272,9 @@ u32 firmRead(void *dest, u32 firmType) {"00000003", "20000003"}, {"00000001", "20000001"}}; - char folderPath[48]; - char path[48]; + char folderPath[35], + path[48]; + sprintf(folderPath, "1:/title/00040138/%s/content", firmFolders[firmType][ISN3DS ? 1 : 0]); DIR dir; diff --git a/source/main.c b/source/main.c index c4af584..a5514e1 100644 --- a/source/main.c +++ b/source/main.c @@ -264,7 +264,7 @@ boot: if(res != 0) { - char patchesError[64]; + char patchesError[43]; sprintf(patchesError, "Failed to apply %u FIRM patch(es).", res); error(patchesError); } diff --git a/source/strings.c b/source/strings.c index 113d123..a639e39 100644 --- a/source/strings.c +++ b/source/strings.c @@ -35,6 +35,7 @@ u32 strlen(const char *string) u32 strnlen(const char *string, u32 maxlen) { u32 size; + for(size = 0; size < maxlen && *string; string++, size++); return size; diff --git a/source/types.h b/source/types.h index afbcba5..5173104 100644 --- a/source/types.h +++ b/source/types.h @@ -25,6 +25,7 @@ #include #include #include +#include //Common data types typedef uint8_t u8;