[Scummvm-cvs-logs] SF.net SVN: scummvm:[35920] scummvm/trunk/backends/platform/wii

dhewg at users.sourceforge.net dhewg at users.sourceforge.net
Mon Jan 19 16:11:18 CET 2009


Revision: 35920
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35920&view=rev
Author:   dhewg
Date:     2009-01-19 15:11:18 +0000 (Mon, 19 Jan 2009)

Log Message:
-----------
Makefile cleanup with additional comments. Added DEBUG_WII_MEMSTATS for memory statistics and splitted existing DEBUG_* tunables.

Modified Paths:
--------------
    scummvm/trunk/backends/platform/wii/Makefile
    scummvm/trunk/backends/platform/wii/main.cpp
    scummvm/trunk/backends/platform/wii/osystem.h
    scummvm/trunk/backends/platform/wii/osystem_gfx.cpp

Modified: scummvm/trunk/backends/platform/wii/Makefile
===================================================================
--- scummvm/trunk/backends/platform/wii/Makefile	2009-01-19 07:31:34 UTC (rev 35919)
+++ scummvm/trunk/backends/platform/wii/Makefile	2009-01-19 15:11:18 UTC (rev 35920)
@@ -1,10 +1,20 @@
-# this enables port specific debug messages and redirects stdout/err over
-# usbgecko in memcard slot b
-DEBUG_WII = 1
+# This toggle redirects stdout/err over a USB Gecko adapter in memcard slot b.
+# It is safe to keep this enabled, even if no such adapter is present.
+DEBUG_WII_USBGECKO = 1
 
-# builds a gamecube version. cleanup object files before flipping this
+# This toggle enables simple memory statistics. The amount of physical
+# available memory will be printed to stderr when it shrinks.
+# The buckets of the allocator are not taken into account.
+DEBUG_WII_MEMSTATS = 0
+
+# This toggle sets up the GDB stub. Upon a crash or a reset button press
+# attach a remote GDB via `make debug` (requires a USB Gecko adapter).
+DEBUG_WII_GDB = 0
+
+# Builds a Gamecube version. Cleanup object files before flipping this!
 GAMECUBE = 0
 
+# List of game engines to compile in. Comment the line to disable an engine.
 ENABLE_SCUMM = STATIC_PLUGIN
 ENABLE_SCUMM_7_8 = STATIC_PLUGIN
 ENABLE_HE = STATIC_PLUGIN
@@ -32,20 +42,30 @@
 ENABLE_TOUCHE = STATIC_PLUGIN
 ENABLE_TUCKER = STATIC_PLUGIN
 
+# Scalers are currently not supported by this port.
 DISABLE_HQ_SCALERS = 1
 DISABLE_SCALERS = 1
 
-USE_ZLIB = 1
-USE_MAD = 1
-USE_TREMOR = 1
-USE_FLAC = 1
-#USE_MPEG2 = 1
+# MT32 emulation, included in ScummVM. The Gamecube does not have enough
+# memory to use it.
 ifeq ($(GAMECUBE),1)
 USE_MT32EMU = 0
 else
 USE_MT32EMU = 1
 endif
 
+# Additional features to compile in. zLib and MAD are inluded in libogc, the
+# others require installed headers and crosscompiled static libraries.
+USE_ZLIB = 1
+USE_MAD = 1
+USE_TREMOR = 1
+USE_FLAC = 1
+#USE_MPEG2 = 1
+
+#
+# Don't change anything below this line unless you know what you are doing.
+#
+
 srcdir = ../../..
 VPATH = $(srcdir)
 HAVE_GCC3 = 1
@@ -95,37 +115,45 @@
 CXXFLAGS += -I$(DEVKITPRO)/3rd/wii/include
 LDFLAGS  += -L$(DEVKITPRO)/3rd/wii/lib
 
-ifdef DEBUG_WII
-CXXFLAGS += -DDEBUG_WII
+ifeq ($(DEBUG_WII_USBGECKO),1)
+CXXFLAGS += -DDEBUG_WII_USBGECKO
 LIBS     += -ldb
 endif
 
-ifdef USE_ZLIB
+ifeq ($(DEBUG_WII_MEMSTATS),1)
+CXXFLAGS += -DDEBUG_WII_MEMSTATS
+endif
+
+ifeq ($(DEBUG_WII_GDB),1)
+CXXFLAGS += -DDEBUG_WII_GDB
+endif
+
+ifeq ($(USE_ZLIB),1)
 CXXFLAGS += -DUSE_ZLIB
 LIBS     += -lz
 endif
 
-ifdef USE_MAD
+ifeq ($(USE_MAD),1)
 CXXFLAGS += -DUSE_MAD -I$(DEVKITPRO)/libogc/include/mad
 LIBS     += -lmad
 endif
 
-ifdef USE_TREMOR
+ifeq ($(USE_TREMOR),1)
 CXXFLAGS += -DUSE_VORBIS -DUSE_TREMOR
 LIBS     += -lvorbisidec
 endif
 
-ifdef USE_FLAC
+ifeq ($(USE_FLAC),1)
 CXXFLAGS += -DUSE_FLAC
 LIBS     += -lFLAC
 endif
 
-ifdef USE_MPEG2
+ifeq ($(USE_MPEG2),1)
 CXXFLAGS += -DUSE_MPEG2
 LIBS     += -lmpeg2
 endif
 
-ifdef USE_MT32EMU
+ifeq ($(USE_MT32EMU),1)
 CXXFLAGS += -DUSE_MT32EMU
 endif
 

Modified: scummvm/trunk/backends/platform/wii/main.cpp
===================================================================
--- scummvm/trunk/backends/platform/wii/main.cpp	2009-01-19 07:31:34 UTC (rev 35919)
+++ scummvm/trunk/backends/platform/wii/main.cpp	2009-01-19 15:11:18 UTC (rev 35920)
@@ -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 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,11 +83,14 @@
 	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 ");
 	if (argc > 0)
 		printf("'%s'\n", argv[0]);

Modified: scummvm/trunk/backends/platform/wii/osystem.h
===================================================================
--- scummvm/trunk/backends/platform/wii/osystem.h	2009-01-19 07:31:34 UTC (rev 35919)
+++ scummvm/trunk/backends/platform/wii/osystem.h	2009-01-19 15:11:18 UTC (rev 35920)
@@ -44,6 +44,10 @@
 extern bool reset_btn_pressed;
 extern bool power_btn_pressed;
 
+#ifdef DEBUG_WII_MEMSTATS
+extern void wii_memstats(void);
+#endif
+
 #ifdef __cplusplus
 }
 #endif

Modified: scummvm/trunk/backends/platform/wii/osystem_gfx.cpp
===================================================================
--- scummvm/trunk/backends/platform/wii/osystem_gfx.cpp	2009-01-19 07:31:34 UTC (rev 35919)
+++ scummvm/trunk/backends/platform/wii/osystem_gfx.cpp	2009-01-19 15:11:18 UTC (rev 35920)
@@ -275,6 +275,10 @@
 	if (now - _lastScreenUpdate < 1000 / MAX_FPS)
 		return;
 
+#ifdef DEBUG_WII_MEMSTATS
+	wii_memstats();
+#endif
+
 	_lastScreenUpdate = now;
 
 	h = 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