Skip to content

Commit 9100ecf

Browse files
committed
main: add USB rescue support for chainloader
1 parent 3a9c90b commit 9100ecf

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export HEADER
1313
# ---{BUILD CFG}--- #
1414
HAS_EMBED_IRX ?= 1# whether to embed or not non vital IRX (wich will be loaded from memcard files)
1515
DEBUG ?= 0
16-
CHAINLOAD ?= 0 # Only inits the system and boots CHAINLOAD_PATH from the memory card
16+
CHAINLOAD ?= 0 # Only inits the system and boots CHAINLOAD_PATH from the memory card. If specified file doesn't exist, attempts to boot RESCUE.ELF from USB
1717
CHAINLOAD_PATH ?= "mc?:BOOT/PAYLOAD.ELF"
1818
PSX ?= 0 # PSX DESR support
1919
HDD ?= 0 #wether to add internal HDD support

src/main.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,15 @@ int main(int argc, char *argv[])
191191
init_scr();
192192
scr_setCursor(0); // get rid of annoying that cursor.
193193
scr_printf("\n\n\n"CHAINLOAD_PATH" not found\n");
194-
while (1) {}
194+
sleep(2);
195+
j = LoadUSBIRX();
196+
if (j != 0) {
197+
scr_setfontcolor(0x0000ff);
198+
scr_printf("ERROR: could not load USB modules (%d)\n", j);
199+
scr_setfontcolor(0xffffff);
200+
__builtin_trap();
201+
}
202+
EMERGENCY();
195203
#endif
196204

197205
DPRINTF("Init pads\n");

0 commit comments

Comments
 (0)