Changed the chainloader to load payloads named "BUTTON_NAME.bin", to remember which payload is which. Original idea and code by @habbbe (many thanks!)
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
/ 2: Enable with LF-CRLF conversion. */
|
||||
|
||||
|
||||
#define _USE_FIND 0
|
||||
#define _USE_FIND 1
|
||||
/* This option switches filtered directory read feature and related functions,
|
||||
/ f_findfirst() and f_findnext(). (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
12
source/fs.c
12
source/fs.c
@@ -64,16 +64,16 @@ u32 fileSize(const char *path)
|
||||
return size;
|
||||
}
|
||||
|
||||
u32 fileExists(const char *path)
|
||||
u32 defPayloadExists(void)
|
||||
{
|
||||
FIL fp;
|
||||
u32 exists = 0;
|
||||
DIR dir;
|
||||
FILINFO info = { .lfname = NULL };
|
||||
|
||||
if(f_open(&fp, path, FA_READ) == FR_OK) exists = 1;
|
||||
FRESULT result = f_findfirst(&dir, &info, "/aurei/payloads", "def_*.bin");
|
||||
|
||||
f_close(&fp);
|
||||
f_closedir(&dir);
|
||||
|
||||
return exists;
|
||||
return (result == FR_OK && info.fname[0]);
|
||||
}
|
||||
|
||||
void firmRead(void *dest, const char *firmFolder)
|
||||
|
||||
@@ -12,5 +12,5 @@ u32 mountFs(void);
|
||||
u32 fileRead(void *dest, const char *path, u32 size);
|
||||
u32 fileWrite(const void *buffer, const char *path, u32 size);
|
||||
u32 fileSize(const char *path);
|
||||
u32 fileExists(const char *path);
|
||||
u32 defPayloadExists(void);
|
||||
void firmRead(void *dest, const char *firmFolder);
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
void loadPayload(void)
|
||||
{
|
||||
if(fileExists("aurei/payloads/default.bin"))
|
||||
if(defPayloadExists())
|
||||
{
|
||||
initScreens();
|
||||
memcpy((void *)PAYLOAD_ADDRESS, loader, loader_size);
|
||||
|
||||
Reference in New Issue
Block a user