diff options
author | Andre Heider | 2009-01-19 15:11:18 +0000 |
---|---|---|
committer | Andre Heider | 2009-01-19 15:11:18 +0000 |
commit | 57e6cb4c8a1d2e8345fa53c70b21ae2fd0bba776 (patch) | |
tree | 12ad2fe164e0e30dafa06bd90435d48ece608166 /backends | |
parent | 2a22b9bcc6758d589ffe6af361ee53e8c1a6841e (diff) | |
download | scummvm-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')
-rw-r--r-- | backends/platform/wii/Makefile | 62 | ||||
-rw-r--r-- | backends/platform/wii/main.cpp | 38 | ||||
-rw-r--r-- | backends/platform/wii/osystem.h | 4 | ||||
-rw-r--r-- | backends/platform/wii/osystem_gfx.cpp | 4 |
4 files changed, 88 insertions, 20 deletions
diff --git a/backends/platform/wii/Makefile b/backends/platform/wii/Makefile index e3cb612705..8ee7ad7d42 100644 --- a/backends/platform/wii/Makefile +++ b/backends/platform/wii/Makefile @@ -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_TINSEL = STATIC_PLUGIN 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 @@ LDFLAGS += $(addprefix -L,$(LIBDIR)) 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 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 "); diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h index bedfadd934..807b825097 100644 --- a/backends/platform/wii/osystem.h +++ b/backends/platform/wii/osystem.h @@ -44,6 +44,10 @@ extern "C" { extern bool reset_btn_pressed; extern bool power_btn_pressed; +#ifdef DEBUG_WII_MEMSTATS +extern void wii_memstats(void); +#endif + #ifdef __cplusplus } #endif diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp index 6402ce9a35..0196c95f4c 100644 --- a/backends/platform/wii/osystem_gfx.cpp +++ b/backends/platform/wii/osystem_gfx.cpp @@ -275,6 +275,10 @@ void OSystem_Wii::updateScreen() { if (now - _lastScreenUpdate < 1000 / MAX_FPS) return; +#ifdef DEBUG_WII_MEMSTATS + wii_memstats(); +#endif + _lastScreenUpdate = now; h = 0; |