From 8daf6db9ac4de72099f3a1eb9f16e3183eba12c2 Mon Sep 17 00:00:00 2001 From: bushing Date: Mon, 10 May 2010 00:51:37 -0700 Subject: [PATCH] detect shutdown from GameCube mode; pass through to the system menu to let it shut the system down instead of launching the ccat UI --- main.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/main.c b/main.c index 2a5415b..cc302a3 100644 --- a/main.c +++ b/main.c @@ -73,18 +73,24 @@ u32 _main(void *base) gecko_printf("Initializing IPC...\n"); ipc_initialize(); - gecko_printf("Initializing SDHC...\n"); - sdhc_init(); - - gecko_printf("Mounting SD...\n"); - fres = f_mount(0, &fatfs); - if (read32(0x0d800190) & 2) { gecko_printf("GameCube compatibility mode detected...\n"); vector = boot2_run(1, 0x101); goto shutdown; } + if (read32(0x3130) == 0xFFFFFFFF) { + gecko_printf("GameCube shutdown detected, bypassing.\n"); + vector = boot2_run(1,2); + goto shutdown; + } + + gecko_printf("Initializing SDHC...\n"); + sdhc_init(); + + gecko_printf("Mounting SD...\n"); + fres = f_mount(0, &fatfs); + if(fres != FR_OK) { gecko_printf("Error %d while trying to mount SD\n", fres); panic2(0, PANIC_MOUNT); @@ -95,7 +101,9 @@ u32 _main(void *base) res = powerpc_boot_file(PPC_BOOT_FILE); if(res < 0) { gecko_printf("Failed to boot PPC: %d\n", res); - gecko_printf("Continuing anyway\n"); + gecko_printf("booting system menu\n"); + vector = boot2_run(1,2); + goto shutdown; } gecko_printf("Going into IPC mainloop...\n");