[Scummvm-cvs-logs] SF.net SVN: scummvm:[44190] scummvm/trunk/backends/platform/wii/main.cpp
dhewg at users.sourceforge.net
dhewg at users.sourceforge.net
Fri Sep 18 23:25:32 CEST 2009
Revision: 44190
http://scummvm.svn.sourceforge.net/scummvm/?rev=44190&view=rev
Author: dhewg
Date: 2009-09-18 21:25:32 +0000 (Fri, 18 Sep 2009)
Log Message:
-----------
Show the console when exiting abnormally.
Modified Paths:
--------------
scummvm/trunk/backends/platform/wii/main.cpp
Modified: scummvm/trunk/backends/platform/wii/main.cpp
===================================================================
--- scummvm/trunk/backends/platform/wii/main.cpp 2009-09-18 18:56:16 UTC (rev 44189)
+++ scummvm/trunk/backends/platform/wii/main.cpp 2009-09-18 21:25:32 UTC (rev 44190)
@@ -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 @@
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 @@
else
printf("<unknown>\n");
+ SYS_RegisterResetFunc(&resetinfo);
+
SYS_SetResetCallback(reset_cb);
#ifndef GAMECUBE
SYS_SetPowerCallback(power_cb);
@@ -135,8 +187,12 @@
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);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list