Merge master into developer, remove createDirectory calls
This commit is contained in:
commit
ae8caf3d3a
@ -25,7 +25,7 @@ INCLUDE := $(foreach dir,$(LIBDIRS),-I$(dir)/include)
|
|||||||
ASFLAGS := -mcpu=mpcore -mfloat-abi=hard -mtp=soft
|
ASFLAGS := -mcpu=mpcore -mfloat-abi=hard -mtp=soft
|
||||||
CFLAGS := -Wall -Wextra -MMD -MP -marm $(ASFLAGS) -fno-builtin -std=c11 -O2 -flto -ffast-math -mword-relocations \
|
CFLAGS := -Wall -Wextra -MMD -MP -marm $(ASFLAGS) -fno-builtin -std=c11 -O2 -flto -ffast-math -mword-relocations \
|
||||||
-ffunction-sections -fdata-sections $(INCLUDE) -DARM11 -D_3DS
|
-ffunction-sections -fdata-sections $(INCLUDE) -DARM11 -D_3DS
|
||||||
LDFLAGS := -Xlinker --defsym="__start__=0x14000000" -specs=3dsx.specs $(ASFLAGS) -L$(DEVKITPRO)/libctru/lib
|
LDFLAGS := -Xlinker --defsym="__start__=0x14000000" -specs=3dsx.specs $(ASFLAGS)
|
||||||
|
|
||||||
objects = $(patsubst $(dir_source)/%.c, $(dir_build)/%.o, \
|
objects = $(patsubst $(dir_source)/%.c, $(dir_build)/%.o, \
|
||||||
$(call rwildcard, $(dir_source), *.s *.c))
|
$(call rwildcard, $(dir_source), *.s *.c))
|
||||||
|
@ -57,11 +57,7 @@ void writeConfig(const char *configPath, u32 configTemp)
|
|||||||
configData.formatVersionMinor = CONFIG_VERSIONMINOR;
|
configData.formatVersionMinor = CONFIG_VERSIONMINOR;
|
||||||
|
|
||||||
if(!fileWrite(&configData, configPath, sizeof(cfgData)))
|
if(!fileWrite(&configData, configPath, sizeof(cfgData)))
|
||||||
{
|
error("Error writing the configuration file");
|
||||||
createDirectory("luma");
|
|
||||||
if(!fileWrite(&configData, configPath, sizeof(cfgData)))
|
|
||||||
error("Error writing the configuration file");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,13 +121,7 @@ void detectAndProcessExceptionDumps(void)
|
|||||||
path[fileNameSpot] = '/';
|
path[fileNameSpot] = '/';
|
||||||
memcpy(&path[fileNameSpot + 1], fileName, sizeof(fileName));
|
memcpy(&path[fileNameSpot + 1], fileName, sizeof(fileName));
|
||||||
|
|
||||||
if(!fileWrite((void *)dumpHeader, path, size))
|
fileWrite((void *)dumpHeader, path, size);
|
||||||
{
|
|
||||||
createDirectory("/luma");
|
|
||||||
createDirectory("/luma/dumps");
|
|
||||||
createDirectory(pathFolder);
|
|
||||||
fileWrite((void *)dumpHeader, path, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
vu32 *regs = (vu32 *)((vu8 *)dumpHeader + sizeof(ExceptionDumpHeader));
|
vu32 *regs = (vu32 *)((vu8 *)dumpHeader + sizeof(ExceptionDumpHeader));
|
||||||
vu8 *additionalData = (vu8 *)dumpHeader + dumpHeader->totalSize - dumpHeader->additionalDataSize;
|
vu8 *additionalData = (vu8 *)dumpHeader + dumpHeader->totalSize - dumpHeader->additionalDataSize;
|
||||||
|
66
source/fs.c
66
source/fs.c
@ -64,7 +64,9 @@ bool fileWrite(const void *buffer, const char *path, u32 size)
|
|||||||
{
|
{
|
||||||
FIL file;
|
FIL file;
|
||||||
|
|
||||||
if(f_open(&file, path, FA_WRITE | FA_OPEN_ALWAYS) == FR_OK)
|
FRESULT result = f_open(&file, path, FA_WRITE | FA_OPEN_ALWAYS);
|
||||||
|
|
||||||
|
if(result == FR_OK)
|
||||||
{
|
{
|
||||||
unsigned int written;
|
unsigned int written;
|
||||||
f_write(&file, buffer, size, &written);
|
f_write(&file, buffer, size, &written);
|
||||||
@ -72,8 +74,21 @@ bool fileWrite(const void *buffer, const char *path, u32 size)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if(result == FR_NO_PATH)
|
||||||
|
{
|
||||||
|
char folder[256];
|
||||||
|
|
||||||
return false;
|
for(u32 i = 1; path[i] != 0; i++)
|
||||||
|
if(path[i] == '/')
|
||||||
|
{
|
||||||
|
memcpy(folder, path, i);
|
||||||
|
folder[i] = 0;
|
||||||
|
f_mkdir(folder);
|
||||||
|
}
|
||||||
|
|
||||||
|
return fileWrite(buffer, path, size);
|
||||||
|
}
|
||||||
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fileDelete(const char *path)
|
void fileDelete(const char *path)
|
||||||
@ -81,11 +96,6 @@ void fileDelete(const char *path)
|
|||||||
f_unlink(path);
|
f_unlink(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void createDirectory(const char *path)
|
|
||||||
{
|
|
||||||
f_mkdir(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loadPayload(u32 pressed)
|
void loadPayload(u32 pressed)
|
||||||
{
|
{
|
||||||
const char *pattern;
|
const char *pattern;
|
||||||
@ -132,27 +142,6 @@ void loadPayload(u32 pressed)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void findDumpFile(const char *path, char *fileName)
|
|
||||||
{
|
|
||||||
DIR dir;
|
|
||||||
FILINFO info;
|
|
||||||
u32 n = 0;
|
|
||||||
|
|
||||||
while(f_findfirst(&dir, &info, path, fileName) == FR_OK && info.fname[0])
|
|
||||||
{
|
|
||||||
u32 i = 18,
|
|
||||||
tmp = ++n;
|
|
||||||
|
|
||||||
while(tmp)
|
|
||||||
{
|
|
||||||
fileName[i--] = '0' + (tmp % 10);
|
|
||||||
tmp /= 10;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
f_closedir(&dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 firmRead(void *dest, u32 firmType)
|
u32 firmRead(void *dest, u32 firmType)
|
||||||
{
|
{
|
||||||
const char *firmFolders[4][2] = {{ "00000002", "20000002" },
|
const char *firmFolders[4][2] = {{ "00000002", "20000002" },
|
||||||
@ -208,4 +197,25 @@ u32 firmRead(void *dest, u32 firmType)
|
|||||||
fileRead(dest, path);
|
fileRead(dest, path);
|
||||||
|
|
||||||
return firmVersion;
|
return firmVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
void findDumpFile(const char *path, char *fileName)
|
||||||
|
{
|
||||||
|
DIR dir;
|
||||||
|
FILINFO info;
|
||||||
|
u32 n = 0;
|
||||||
|
|
||||||
|
while(f_findfirst(&dir, &info, path, fileName) == FR_OK && info.fname[0])
|
||||||
|
{
|
||||||
|
u32 i = 18,
|
||||||
|
tmp = ++n;
|
||||||
|
|
||||||
|
while(tmp)
|
||||||
|
{
|
||||||
|
fileName[i--] = '0' + (tmp % 10);
|
||||||
|
tmp /= 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
f_closedir(&dir);
|
||||||
}
|
}
|
@ -33,6 +33,7 @@ u32 fileRead(void *dest, const char *path);
|
|||||||
u32 getFileSize(const char *path);
|
u32 getFileSize(const char *path);
|
||||||
bool fileWrite(const void *buffer, const char *path, u32 size);
|
bool fileWrite(const void *buffer, const char *path, u32 size);
|
||||||
void fileDelete(const char *path);
|
void fileDelete(const char *path);
|
||||||
void createDirectory(const char *path);
|
void loadPayload(u32 pressed);
|
||||||
|
u32 firmRead(void *dest, u32 firmType);
|
||||||
|
|
||||||
void findDumpFile(const char *path, char *fileName);
|
void findDumpFile(const char *path, char *fileName);
|
||||||
void loadPayload(u32 pressed);u32 firmRead(void *dest, u32 firmType);
|
|
||||||
|
@ -41,7 +41,7 @@ void memset32(void *dest, u32 filler, u32 size)
|
|||||||
{
|
{
|
||||||
u32 *dest32 = (u32 *)dest;
|
u32 *dest32 = (u32 *)dest;
|
||||||
|
|
||||||
for (u32 i = 0; i < size / 4; i++)
|
for(u32 i = 0; i < size / 4; i++)
|
||||||
dest32[i] = filler;
|
dest32[i] = filler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,11 +96,7 @@ void newPin(bool allowSkipping)
|
|||||||
memcpy(pin.hash, tmp, 32);
|
memcpy(pin.hash, tmp, 32);
|
||||||
|
|
||||||
if(!fileWrite(&pin, "/luma/pin.bin", sizeof(PINData)))
|
if(!fileWrite(&pin, "/luma/pin.bin", sizeof(PINData)))
|
||||||
{
|
error("Error writing the PIN file");
|
||||||
createDirectory("luma");
|
|
||||||
if(!fileWrite(&pin, "/luma/pin.bin", sizeof(PINData)))
|
|
||||||
error("Error writing the PIN file");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool verifyPin(void)
|
bool verifyPin(void)
|
||||||
|
Reference in New Issue
Block a user