aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/wii/main.cpp
diff options
context:
space:
mode:
authorAndre Heider2009-01-19 15:11:18 +0000
committerAndre Heider2009-01-19 15:11:18 +0000
commit57e6cb4c8a1d2e8345fa53c70b21ae2fd0bba776 (patch)
tree12ad2fe164e0e30dafa06bd90435d48ece608166 /backends/platform/wii/main.cpp
parent2a22b9bcc6758d589ffe6af361ee53e8c1a6841e (diff)
downloadscummvm-rg350-57e6cb4c8a1d2e8345fa53c70b21ae2fd0bba776.tar.gz
scummvm-rg350-57e6cb4c8a1d2e8345fa53c70b21ae2fd0bba776.tar.bz2
scummvm-rg350-57e6cb4c8a1d2e8345fa53c70b21ae2fd0bba776.zip
Makefile cleanup with additional comments. Added DEBUG_WII_MEMSTATS for memory statistics and splitted existing DEBUG_* tunables.
svn-id: r35920
Diffstat (limited to 'backends/platform/wii/main.cpp')
-rw-r--r--backends/platform/wii/main.cpp38
1 files changed, 35 insertions, 3 deletions
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 <errno.h>
#include <unistd.h>
+#include <ogc/machine/processor.h>
#include <fat.h>
#include "osystem.h"
-#ifdef DEBUG_WII
+#ifdef DEBUG_WII_GDB
#include <debug.h>
#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 ");