aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Heider2009-03-19 18:56:54 +0000
committerAndre Heider2009-03-19 18:56:54 +0000
commit38baf3b19f0369c4b4dcceca1fd03aca5e076d67 (patch)
tree55f3562f587313ea28152a32cfe24302d86e6fde
parenta0545c413330d5993806e8d7956a1c254d77020b (diff)
downloadscummvm-rg350-38baf3b19f0369c4b4dcceca1fd03aca5e076d67.tar.gz
scummvm-rg350-38baf3b19f0369c4b4dcceca1fd03aca5e076d67.tar.bz2
scummvm-rg350-38baf3b19f0369c4b4dcceca1fd03aca5e076d67.zip
Added configure support for the Wii and Gamecube port
svn-id: r39531
-rw-r--r--backends/platform/wii/Makefile254
-rw-r--r--backends/platform/wii/main.cpp4
-rw-r--r--backends/platform/wii/module.mk15
-rw-r--r--backends/platform/wii/osystem_events.cpp4
-rw-r--r--backends/platform/wii/wii.mk61
-rwxr-xr-xconfigure98
6 files changed, 175 insertions, 261 deletions
diff --git a/backends/platform/wii/Makefile b/backends/platform/wii/Makefile
deleted file mode 100644
index a3b651023e..0000000000
--- a/backends/platform/wii/Makefile
+++ /dev/null
@@ -1,254 +0,0 @@
-# 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
-
-# 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
-
-# Enable DVD ISO9660/Joliet support using libdi (included in libogc, but the
-# ISO9660 support has not been commited to the official svn yet, requires the
-# git repository for now).
-# This requires a working DVDX install to function, not available on Gamecube.
-ifeq ($(GAMECUBE),1)
-USE_WII_DI = 0
-else
-USE_WII_DI = 1
-endif
-
-# Enable USB keyboard support through libwiikeyboard (included in libogc, but
-# it has not been commited to the official svn yet, requires the git repository
-# for now). Not available on Gamecube.
-ifeq ($(GAMECUBE),1)
-USE_WII_KBD = 0
-else
-USE_WII_KBD = 1
-endif
-
-# List of game engines to compile in. Comment a to disable the engine.
-ENABLE_SCUMM = STATIC_PLUGIN
-ENABLE_SCUMM_7_8 = STATIC_PLUGIN
-ENABLE_HE = STATIC_PLUGIN
-ENABLE_AGI = STATIC_PLUGIN
-ENABLE_AGOS = STATIC_PLUGIN
-ENABLE_CINE = STATIC_PLUGIN
-ENABLE_CRUISE = STATIC_PLUGIN
-ENABLE_DRASCULA = STATIC_PLUGIN
-ENABLE_GOB = STATIC_PLUGIN
-ENABLE_GROOVIE = STATIC_PLUGIN
-ENABLE_IGOR = STATIC_PLUGIN
-ENABLE_KYRA = STATIC_PLUGIN
-ENABLE_LURE = STATIC_PLUGIN
-ENABLE_M4 = STATIC_PLUGIN
-ENABLE_MADE = STATIC_PLUGIN
-ENABLE_PARALLACTION = STATIC_PLUGIN
-ENABLE_QUEEN = STATIC_PLUGIN
-ENABLE_SAGA = STATIC_PLUGIN
-ENABLE_SCI = STATIC_PLUGIN
-ENABLE_IHNM = STATIC_PLUGIN
-ENABLE_SAGA2 = STATIC_PLUGIN
-ENABLE_SKY = STATIC_PLUGIN
-ENABLE_SWORD1 = STATIC_PLUGIN
-ENABLE_SWORD2 = STATIC_PLUGIN
-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
-
-# 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
-DEPDIR = .deps
-
-DISTPATH = $(srcdir)/dists/wii
-
-ifeq ($(strip $(DEVKITPPC)),)
-$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
-endif
-
-PREFIX = $(DEVKITPPC)/bin/powerpc-gekko-
-CXX = $(PREFIX)g++
-AS = $(PREFIX)gcc
-LD = $(PREFIX)gcc
-AR = $(PREFIX)ar cru
-RANLIB = $(PREFIX)ranlib
-STRIP = $(PREFIX)strip -g
-GDB = $(PREFIX)gdb
-MKDIR = mkdir -p
-RM = rm -f
-RM_REC = rm -rf
-CP = cp -f
-
-ifeq ($(GAMECUBE),1)
-TARGET = scummvm-gc
-MACHDEP = -DGEKKO -DGAMECUBE -mogc -mcpu=750 -meabi -mhard-float \
- -ffunction-sections -fdata-sections -fmodulo-sched
-LIBDIR = $(DEVKITPRO)/libogc/lib/cube
-LIBS = -lstdc++ -lfat -logc -lm
-else
-TARGET = scummvm-wii
-MACHDEP = -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float \
- -ffunction-sections -fdata-sections -fmodulo-sched
-LIBDIR = $(DEVKITPRO)/libogc/lib/wii
-LIBS = -lstdc++ -ldi -lfat -lwiiuse -lbte -logc -lwiikeyboard -lm
-endif
-
-INCDIR = $(srcdir) . $(srcdir)/engines/ $(DEVKITPRO)/libogc/include
-
-CXXFLAGS = -g -Os -Wall $(MACHDEP) -D__WII__ -Wno-multichar -Wno-long-long \
- -Wno-unknown-pragmas -Wno-reorder -fno-exceptions -fno-rtti
-
-CXXFLAGS += $(addprefix -I,$(INCDIR))
-LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(TARGET).elf.map
-LDFLAGS += $(addprefix -L,$(LIBDIR))
-
-CXXFLAGS += -I$(DEVKITPRO)/3rd/wii/include
-LDFLAGS += -L$(DEVKITPRO)/3rd/wii/lib
-
-CXXFLAGS += -DENABLE_VKEYBD -DENABLE_KEYMAPPER
-
-ifeq ($(DEBUG_WII_USBGECKO),1)
-CXXFLAGS += -DDEBUG_WII_USBGECKO
-endif
-
-ifeq ($(DEBUG_WII_MEMSTATS),1)
-CXXFLAGS += -DDEBUG_WII_MEMSTATS
-endif
-
-ifeq ($(DEBUG_WII_GDB),1)
-CXXFLAGS += -DDEBUG_WII_GDB
-LIBS += -ldb
-endif
-
-ifeq ($(USE_WII_DI),1)
-CXXFLAGS += -DUSE_WII_DI
-endif
-
-ifeq ($(USE_WII_KBD),1)
-CXXFLAGS += -DUSE_WII_KBD
-endif
-
-ifeq ($(USE_ZLIB),1)
-CXXFLAGS += -DUSE_ZLIB
-LIBS += -lz
-endif
-
-ifeq ($(USE_MAD),1)
-CXXFLAGS += -DUSE_MAD -I$(DEVKITPRO)/libogc/include/mad
-LIBS += -lmad
-endif
-
-ifeq ($(USE_TREMOR),1)
-CXXFLAGS += -DUSE_VORBIS -DUSE_TREMOR
-LIBS += -lvorbisidec
-endif
-
-ifeq ($(USE_FLAC),1)
-CXXFLAGS += -DUSE_FLAC
-LIBS += -lFLAC
-endif
-
-ifeq ($(USE_MPEG2),1)
-CXXFLAGS += -DUSE_MPEG2
-LIBS += -lmpeg2
-endif
-
-ifeq ($(USE_MT32EMU),1)
-CXXFLAGS += -DUSE_MT32EMU
-endif
-
-OBJS := backends/platform/wii/main.o \
- backends/platform/wii/gx_supp.o \
- backends/platform/wii/osystem.o \
- backends/platform/wii/osystem_gfx.o \
- backends/platform/wii/osystem_sfx.o \
- backends/platform/wii/osystem_events.o
-
-include $(srcdir)/Makefile.common
-
-.PHONY: clean-wii distclean-wii upload dist
-
-all: $(TARGET).dol
-
-$(TARGET).dol: $(TARGET).elf
- $(DEVKITPPC)/bin/elf2dol $< $@
-
-$(TARGET).elf: $(OBJS)
- $(LD) $^ $(LDFLAGS) $(LIBS) -o $@
-
-clean: clean-wii
-
-clean-wii:
- @$(RM) $(TARGET).elf $(TARGET).elf.map $(TARGET).dol
-
-distclean: distclean-wii
-
-distclean-wii:
- @$(RM_REC) dist
-
-upload: $(TARGET).dol
-ifeq ($(GAMECUBE),1)
- $(DEVKITPPC)/bin/geckoupload $(TARGET).dol
-else
- $(DEVKITPPC)/bin/wiiload $(TARGET).dol -d3
-endif
-
-gdb:
- $(GDB) -n $(TARGET).elf
-
-debug:
- $(GDB) -n $(TARGET).elf -x gdb.txt
-
-dist:
- $(MKDIR) dist/scummvm
-ifeq ($(GAMECUBE),1)
- $(CP) $(TARGET).dol dist/scummvm/
-else
- $(CP) $(TARGET).dol dist/scummvm/boot.dol
- $(CP) $(DISTPATH)/meta.xml dist/scummvm/
- $(CP) $(DISTPATH)/icon.png dist/scummvm/
-endif
- $(CP) $(DISTPATH)/READMII dist/scummvm/
- $(CP) $(srcdir)/AUTHORS dist/scummvm/
- $(CP) $(srcdir)/COPYING dist/scummvm/
- $(CP) $(srcdir)/COPYING.LGPL dist/scummvm/
- $(CP) $(srcdir)/COPYRIGHT dist/scummvm/
- $(CP) $(srcdir)/NEWS dist/scummvm/
- $(CP) $(srcdir)/README dist/scummvm/
- $(CP) $(srcdir)/dists/pred.dic dist/scummvm/
- $(CP) $(DIST_FILES_THEMES) dist/scummvm/
-ifneq ($(DIST_FILES_ENGINEDATA),)
- $(CP) $(DIST_FILES_ENGINEDATA) dist/scummvm/
-endif
-
diff --git a/backends/platform/wii/main.cpp b/backends/platform/wii/main.cpp
index 1182ddd31b..54c6f49ef2 100644
--- a/backends/platform/wii/main.cpp
+++ b/backends/platform/wii/main.cpp
@@ -27,6 +27,8 @@
#include <ogc/machine/processor.h>
#include <fat.h>
+#include "osystem.h"
+
#ifdef USE_WII_DI
#include <di/di.h>
#endif
@@ -35,8 +37,6 @@
#include <debug.h>
#endif
-#include "osystem.h"
-
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/backends/platform/wii/module.mk b/backends/platform/wii/module.mk
new file mode 100644
index 0000000000..912389902b
--- /dev/null
+++ b/backends/platform/wii/module.mk
@@ -0,0 +1,15 @@
+MODULE := backends/platform/wii
+
+MODULE_OBJS := \
+ main.o \
+ gx_supp.o \
+ osystem.o \
+ osystem_gfx.o \
+ osystem_sfx.o \
+ osystem_events.o
+
+MODULE_DIRS += \
+ backends/platform/wii/
+
+# We don't use the rules.mk here on purpose
+OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)
diff --git a/backends/platform/wii/osystem_events.cpp b/backends/platform/wii/osystem_events.cpp
index 202c3ecfd7..05f3469e42 100644
--- a/backends/platform/wii/osystem_events.cpp
+++ b/backends/platform/wii/osystem_events.cpp
@@ -22,6 +22,8 @@
#include <unistd.h>
#include <malloc.h>
+#include "osystem.h"
+
#ifndef GAMECUBE
#include <wiiuse/wpad.h>
#endif
@@ -31,8 +33,6 @@
#include <ogc/lwp_watchdog.h>
-#include "osystem.h"
-
#define TIMER_THREAD_STACKSIZE (1024 * 32)
#define TIMER_THREAD_PRIO 64
diff --git a/backends/platform/wii/wii.mk b/backends/platform/wii/wii.mk
new file mode 100644
index 0000000000..030cc997eb
--- /dev/null
+++ b/backends/platform/wii/wii.mk
@@ -0,0 +1,61 @@
+WII_ELF=scummvm.elf
+WII_DOL=scummvm.dol
+WII_DISTPATH=$(srcdir)/dists/wii
+all: $(WII_DOL)
+
+$(WII_DOL): $(WII_ELF)
+ $(DEVKITPPC)/bin/elf2dol $< $@
+
+clean: wiiclean
+
+wiiclean:
+ $(RM) $(WII_DOL)
+
+wiiload: $(WII_DOL)
+ $(DEVKITPPC)/bin/wiiload $(WII_DOL) -d3
+
+geckoupload: $(WII_DOL)
+ $(DEVKITPPC)/bin/geckoupload $(WII_DOL)
+
+wiigdb:
+ $(DEVKITPPC)/bin/powerpc-gekko-gdb -n $(WII_ELF)
+
+wiidebug:
+ $(DEVKITPPC)/bin/powerpc-gekko-gdb -n $(WII_ELF) -x $(srcdir)/backends/platform/wii/gdb.txt
+
+wiidist:
+ $(MKDIR) dist/scummvm
+ $(CP) $(WII_DOL) dist/scummvm/boot.dol
+ $(CP) $(WII_DISTPATH)/meta.xml dist/scummvm/
+ $(CP) $(WII_DISTPATH)/icon.png dist/scummvm/
+ $(CP) $(WII_DISTPATH)/READMII dist/scummvm/
+ $(CP) $(srcdir)/AUTHORS dist/scummvm/
+ $(CP) $(srcdir)/COPYING dist/scummvm/
+ $(CP) $(srcdir)/COPYING.LGPL dist/scummvm/
+ $(CP) $(srcdir)/COPYRIGHT dist/scummvm/
+ $(CP) $(srcdir)/NEWS dist/scummvm/
+ $(CP) $(srcdir)/README dist/scummvm/
+ $(CP) $(srcdir)/dists/pred.dic dist/scummvm/
+ $(CP) $(DIST_FILES_THEMES) dist/scummvm/
+ifneq ($(DIST_FILES_ENGINEDATA),)
+ $(CP) $(DIST_FILES_ENGINEDATA) dist/scummvm/
+endif
+
+gcdist:
+ $(MKDIR) dist/scummvm
+ $(CP) $(WII_DOL) dist/scummvm/
+ $(CP) $(WII_DISTPATH)/READMII dist/scummvm/
+ $(CP) $(srcdir)/AUTHORS dist/scummvm/
+ $(CP) $(srcdir)/COPYING dist/scummvm/
+ $(CP) $(srcdir)/COPYING.LGPL dist/scummvm/
+ $(CP) $(srcdir)/COPYRIGHT dist/scummvm/
+ $(CP) $(srcdir)/NEWS dist/scummvm/
+ $(CP) $(srcdir)/README dist/scummvm/
+ $(CP) $(srcdir)/dists/pred.dic dist/scummvm/
+ $(CP) $(DIST_FILES_THEMES) dist/scummvm/
+ifneq ($(DIST_FILES_ENGINEDATA),)
+ $(CP) $(DIST_FILES_ENGINEDATA) dist/scummvm/
+endif
+
+.PHONY: wiiclean wiiload geckoupload wiigdb wiidebug wiidist gcdist
+
diff --git a/configure b/configure
index 5a5f0e60bd..345af6fcd5 100755
--- a/configure
+++ b/configure
@@ -603,7 +603,7 @@ Usage: $0 [OPTIONS]...
Configuration:
-h, --help display this help and exit
- --backend=BACKEND backend to build (sdl, morphos, dc, gp2x, iphone, null) [sdl]
+ --backend=BACKEND backend to build (sdl, morphos, dc, gp2x, iphone, wii, null) [sdl]
Installation directories:
--prefix=DIR use this prefix for installing ScummVM [/usr/local]
@@ -615,6 +615,9 @@ Installation directories:
Special configuration feature:
--host=HOST cross-compile to target HOST (arm-linux, ...)
special targets: linupy for Yopy PDA
+ dreamcast for Sega Dreamcast
+ wii for Nintendo Wii
+ gamecube for Nintendo GameCube
Optional Features:
--disable-debug disable building with debugging symbols
@@ -854,6 +857,16 @@ dreamcast)
CXXFLAGS="$CXXFLAGS -ml -m4-single-only"
LDFLAGS="$LDFLAGS -ml -m4-single-only"
;;
+wii)
+ _host_os=wii
+ _host_cpu=ppc
+ _host_alias=powerpc-gekko
+ ;;
+gamecube)
+ _host_os=gamecube
+ _host_cpu=ppc
+ _host_alias=powerpc-gekko
+ ;;
*)
if test -z "$_host"; then
guessed_host=`$_srcdir/config.guess`
@@ -883,7 +896,7 @@ arm-riscos)
gp2x-linux)
EXEEXT=".gp2x"
;;
-dreamcast)
+dreamcast | wii | gamecube)
EXEEXT=".elf"
;;
*)
@@ -904,6 +917,21 @@ os2-emx* )
esac
#
+# Platform specific sanity checks
+#
+
+case $_host_os in
+wii | gamecube)
+ if test -z "$DEVKITPRO"; then
+ echo "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to devkitPRO>"
+ exit 1
+ fi
+ ;;
+*)
+ ;;
+esac
+
+#
# Determine the C++ compiler
#
echo_n "Looking for C++ compiler... "
@@ -1104,6 +1132,18 @@ case $_host_os in
dreamcast)
DEFINES="$DEFINES -D__DC__ -DNONSTANDARD_PORT"
;;
+ wii)
+ CXXFLAGS="$CXXFLAGS -Os -mrvl -mcpu=750 -meabi -mhard-float"
+ CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections -fmodulo-sched"
+ CXXFLAGS="$CXXFLAGS -I$DEVKITPRO/libogc/include"
+ LDFLAGS="$LDFLAGS -mrvl -mcpu=750 -L$DEVKITPRO/libogc/lib/wii"
+ ;;
+ gamecube)
+ CXXFLAGS="$CXXFLAGS -Os -mogc -mcpu=750 -meabi -mhard-float"
+ CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections -fmodulo-sched"
+ CXXFLAGS="$CXXFLAGS -I$DEVKITPRO/libogc/include"
+ LDFLAGS="$LDFLAGS -mogc -mcpu=750 -L$DEVKITPRO/libogc/lib/cube"
+ ;;
# given this is a shell script assume some type of unix
*)
echo "WARNING: could not establish system type, assuming unix like"
@@ -1232,6 +1272,41 @@ if test -n "$_host"; then
_ranlib=$_host_alias-ranlib
add_line_to_config_mk 'include $(srcdir)/backends/platform/dc/dreamcast.mk'
;;
+ wii)
+ echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
+ _endian=big
+ _need_memalign=yes
+ type_1_byte='char'
+ type_2_byte='short'
+ type_4_byte='int'
+ _ar="$_host_alias-ar cru"
+ _ranlib=$_host_alias-ranlib
+ _backend="wii"
+ _build_hq_scalers="no"
+ add_line_to_config_mk 'include $(srcdir)/backends/platform/wii/wii.mk'
+ add_line_to_config_h "#define DEBUG_WII_USBGECKO"
+ add_line_to_config_h "/* #define DEBUG_WII_MEMSTATS */"
+ add_line_to_config_h "/* #define DEBUG_WII_GDB */"
+ add_line_to_config_h "#define USE_WII_DI"
+ add_line_to_config_h "#define USE_WII_KBD"
+ ;;
+ gamecube)
+ echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
+ _endian=big
+ _need_memalign=yes
+ type_1_byte='char'
+ type_2_byte='short'
+ type_4_byte='int'
+ _ar="$_host_alias-ar cru"
+ _ranlib=$_host_alias-ranlib
+ _backend="wii"
+ _build_hq_scalers="no"
+ _mt32emu="no"
+ add_line_to_config_mk 'include $(srcdir)/backends/platform/wii/wii.mk'
+ add_line_to_config_h "/* #define DEBUG_WII_USBGECKO */"
+ add_line_to_config_h "/* #define DEBUG_WII_MEMSTATS */"
+ add_line_to_config_h "/* #define DEBUG_WII_GDB */"
+ ;;
*)
echo "Continuing with auto-detected values ... if you have problems, please add your target to configure."
;;
@@ -1727,6 +1802,19 @@ case $_backend in
LIBS="$LIBS -lronin -lm"
MODULES="$MODULES backends/platform/dc"
;;
+ wii)
+ DEFINES="$DEFINES -D__WII__ -DGEKKO"
+ MODULES="$MODULES backends/platform/wii"
+ case $_host_os in
+ gamecube)
+ DEFINES="$DEFINES -DGAMECUBE"
+ LIBS="$LIBS -lfat -logc -ldb"
+ ;;
+ *)
+ LIBS="$LIBS -ldi -lfat -lwiiuse -lbte -logc -lwiikeyboard -ldb"
+ ;;
+ esac
+ ;;
*)
echo "support for $_backend backend not implemented in configure script yet"
exit 1
@@ -1738,7 +1826,9 @@ esac
#
if test "$_cxx_major" -ge "3" ; then
case $_host_os in
- mingw* | cygwin* | dreamcast)
+ # newlib-based system include files suppress non-C89 function
+ # declarations under __STRICT_ANSI__
+ mingw* | cygwin* | dreamcast | wii | gamecube)
CXXFLAGS="$CXXFLAGS -W -Wno-unused-parameter"
;;
*)
@@ -1756,6 +1846,8 @@ fi;
# Some platforms use certain GNU extensions in header files
case $_host_os in
+wii | gamecube)
+ ;;
*)
CXXFLAGS="$CXXFLAGS -pedantic"
;;