mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-07 10:48:43 +00:00
Show the console when exiting abnormally.
svn-id: r44190
This commit is contained in:
parent
3e24220a19
commit
aeda407a17
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user