From 57e6cb4c8a1d2e8345fa53c70b21ae2fd0bba776 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Mon, 19 Jan 2009 15:11:18 +0000 Subject: Makefile cleanup with additional comments. Added DEBUG_WII_MEMSTATS for memory statistics and splitted existing DEBUG_* tunables. svn-id: r35920 --- backends/platform/wii/main.cpp | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) (limited to 'backends/platform/wii/main.cpp') diff --git a/backends/platform/wii/main.cpp b/backends/platform/wii/main.cpp index c1c403bdd8..3b5ce3762f 100644 --- a/backends/platform/wii/main.cpp +++ b/backends/platform/wii/main.cpp @@ -24,11 +24,12 @@ #include #include +#include #include #include "osystem.h" -#ifdef DEBUG_WII +#ifdef DEBUG_WII_GDB #include #endif @@ -40,13 +41,41 @@ bool reset_btn_pressed = false; bool power_btn_pressed = false; void reset_cb(void) { +#ifdef DEBUG_WII_GDB + printf("attach gdb now\n"); + _break(); + SYS_SetResetCallback(reset_cb); +#else reset_btn_pressed = true; +#endif } void power_cb(void) { power_btn_pressed = true; } +#ifdef DEBUG_WII_MEMSTATS +void wii_memstats(void) { + static u32 min_free = UINT_MAX; + static u32 temp_free; + static u32 level; + + _CPU_ISR_Disable(level); +#ifdef GAMECUBE + temp_free = (u32) SYS_GetArenaHi() - (u32) SYS_GetArenaLo(); +#else + temp_free = (u32) SYS_GetArena1Hi() - (u32) SYS_GetArena1Lo() + + (u32) SYS_GetArena2Hi() - (u32) SYS_GetArena2Lo(); +#endif + _CPU_ISR_Restore(level); + + if (temp_free < min_free) { + min_free = temp_free; + fprintf(stderr, "free: %8u\n", min_free); + } +} +#endif + int main(int argc, char *argv[]) { s32 res; @@ -54,9 +83,12 @@ int main(int argc, char *argv[]) { PAD_Init(); AUDIO_Init(NULL); -#ifdef DEBUG_WII +#ifdef DEBUG_WII_USBGECKO CON_EnableGecko(1, false); - //DEBUG_Init(GDBSTUB_DEVICE_USB, 1); +#endif + +#ifdef DEBUG_WII_GDB + DEBUG_Init(GDBSTUB_DEVICE_USB, 1); #endif printf("startup as "); -- cgit v1.2.3