diff options
author | Andre Heider | 2009-09-18 21:25:32 +0000 |
---|---|---|
committer | Andre Heider | 2009-09-18 21:25:32 +0000 |
commit | aeda407a17984b6a99af4595f284c7650ae1b362 (patch) | |
tree | 3b5633e015cc9bbeebcebd83cb5c8dac47cf98d0 /backends/platform | |
parent | 3e24220a19005a0c53ed436ded721ee77bc68e7f (diff) | |
download | scummvm-rg350-aeda407a17984b6a99af4595f284c7650ae1b362.tar.gz scummvm-rg350-aeda407a17984b6a99af4595f284c7650ae1b362.tar.bz2 scummvm-rg350-aeda407a17984b6a99af4595f284c7650ae1b362.zip |
Show the console when exiting abnormally.
svn-id: r44190
Diffstat (limited to 'backends/platform')
-rw-r--r-- | backends/platform/wii/main.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/backends/platform/wii/main.cpp b/backends/platform/wii/main.cpp index 85ce7b02de..644726ac44 100644 --- a/backends/platform/wii/main.cpp +++ b/backends/platform/wii/main.cpp @@ -28,6 +28,9 @@ #include <ogc/machine/processor.h> #include <fat.h> +#ifndef GAMECUBE +#include <wiiuse/wpad.h> +#endif #ifdef USE_WII_DI #include <di/di.h> #endif @@ -58,6 +61,53 @@ void power_cb(void) { power_btn_pressed = true; } +static void show_console(int code) { + u32 b; + + printf("ScummVM exited abnormally (%d).\n", code); + + if (!gfx_frame_start()) + return; + + gfx_con_draw(); + gfx_frame_end(); + + while (true) { + b = 0; + + if (PAD_ScanPads() & 1) + b = PAD_ButtonsDown(0); + +#ifndef GAMECUBE + WPAD_ScanPads(); + if (WPAD_Probe(0, NULL) == WPAD_ERR_NONE) + b |= WPAD_ButtonsDown(0); +#endif + + if (b) + break; + + VIDEO_WaitVSync(); + } +} + +s32 reset_func(s32 final) { + static bool done = false; + + if (!done) { + show_console(-127); + done = true; + } + + return 1; +} + +static sys_resetinfo resetinfo = { + { NULL, NULL }, + reset_func, + 1 +}; + #ifdef DEBUG_WII_MEMSTATS void wii_memstats(void) { static u32 min_free = UINT_MAX; @@ -105,6 +155,8 @@ int main(int argc, char *argv[]) { else printf("<unknown>\n"); + SYS_RegisterResetFunc(&resetinfo); + SYS_SetResetCallback(reset_cb); #ifndef GAMECUBE SYS_SetPowerCallback(power_cb); @@ -135,8 +187,12 @@ int main(int argc, char *argv[]) { printf("shutdown\n"); + SYS_UnregisterResetFunc(&resetinfo); fatUnmountDefault(); + if (res) + show_console(res); + if (power_btn_pressed) { printf("shutting down\n"); SYS_ResetSystem(SYS_POWEROFF, 0, 0); |