From 1aeae789abac7a23edd4b99368b561a197dd2d68 Mon Sep 17 00:00:00 2001 From: Michael Huang Date: Sat, 10 Sep 2022 19:42:46 -0700 Subject: [PATCH 1/3] Add GC Loader support --- README.md | 1 + source/fatfs/ff.h | 2 +- source/main.c | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 90a5ce2..3707b93 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ iplboot will attempt to load DOLs from the following locations in order: - SD Gecko in Card Slot B - USB Gecko in Card Slot A - SD Gecko in Card Slot A +- GC Loader - SD2SP2 You can use button shortcuts to keep alternate software on quick access. When loading from an SD card, iplboot will look for and load different filenames depending on what buttons are being held: diff --git a/source/fatfs/ff.h b/source/fatfs/ff.h index 5cf76c9..e7a9f5b 100644 --- a/source/fatfs/ff.h +++ b/source/fatfs/ff.h @@ -172,7 +172,7 @@ typedef struct { LBA_t bitbase; /* Allocation bitmap base sector */ #endif LBA_t winsect; /* Current sector appearing in the win[] */ - BYTE win[FF_MAX_SS]; /* Disk access window for Directory, FAT (and file data at tiny cfg) */ + BYTE __attribute__((aligned (32))) win[FF_MAX_SS]; /* Disk access window for Directory, FAT (and file data at tiny cfg), must be 32-bit aligned for __io_gcode */ } FATFS; diff --git a/source/main.c b/source/main.c index e7f350b..b2c7ede 100644 --- a/source/main.c +++ b/source/main.c @@ -392,6 +392,8 @@ int main() if (load_fat("sda", &__io_gcsda, paths, num_paths)) goto load; + if (load_fat("gcl", &__io_gcode, paths, num_paths)) goto load; + if (load_fat("sd2", &__io_gcsd2, paths, num_paths)) goto load; load: From 760b8970459030226d1991270240aeb52a7cb351 Mon Sep 17 00:00:00 2001 From: Michael Huang Date: Sat, 10 Sep 2022 21:39:16 -0700 Subject: [PATCH 2/3] Align FIL; move priority last --- README.md | 2 +- source/main.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3707b93..dc88b60 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ iplboot will attempt to load DOLs from the following locations in order: - SD Gecko in Card Slot B - USB Gecko in Card Slot A - SD Gecko in Card Slot A -- GC Loader - SD2SP2 +- GC Loader You can use button shortcuts to keep alternate software on quick access. When loading from an SD card, iplboot will look for and load different filenames depending on what buttons are being held: diff --git a/source/main.c b/source/main.c index b2c7ede..43c7ccc 100644 --- a/source/main.c +++ b/source/main.c @@ -173,7 +173,7 @@ int load_fat(const char *slot_name, const DISC_INTERFACE *iface_, char **paths, { char *path = paths[i]; kprintf("Reading %s\n", path); - FIL file; + FIL file ATTRIBUTE_ALIGN (32); FRESULT open_result = f_open(&file, path, FA_READ); if (open_result != FR_OK) { @@ -392,10 +392,10 @@ int main() if (load_fat("sda", &__io_gcsda, paths, num_paths)) goto load; - if (load_fat("gcl", &__io_gcode, paths, num_paths)) goto load; - if (load_fat("sd2", &__io_gcsd2, paths, num_paths)) goto load; + if (load_fat("gcl", &__io_gcode, paths, num_paths)) goto load; + load: if (!dol) { From 4b9957607002d5a865ed90d1ddb1ebec7cb067ae Mon Sep 17 00:00:00 2001 From: Michael Huang Date: Sat, 10 Sep 2022 21:52:43 -0700 Subject: [PATCH 3/3] Align FIL in load_parse_cli too --- source/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/main.c b/source/main.c index 43c7ccc..fd90b60 100644 --- a/source/main.c +++ b/source/main.c @@ -68,7 +68,7 @@ void load_parse_cli(char *path) path[path_length - 1] = 'i'; kprintf("Reading %s\n", path); - FIL file; + FIL file ATTRIBUTE_ALIGN (32); FRESULT result = f_open(&file, path, FA_READ); if (result != FR_OK) {