From 1a5f531d23d454d953a76e805c7f3d3289ed4d8a Mon Sep 17 00:00:00 2001 From: Joost Peters Date: Wed, 25 Mar 2009 21:58:16 +0000 Subject: Allow building of psp backend via configure (Part 1 - Still need to add the fixup + EBOOT packing steps). Thanks dhewg and fingolfin for assistance. :) svn-id: r39693 --- backends/fs/psp/psp-fs.cpp | 2 ++ backends/platform/psp/module.mk | 17 ++++++++++++++ backends/platform/psp/osys_psp.cpp | 3 +++ backends/platform/psp/osys_psp.h | 3 ++- backends/platform/psp/osys_psp_gu.cpp | 7 ++++-- backends/platform/psp/psp.spec | 3 +++ backends/saves/psp/psp-saves.cpp | 1 + common/scummsys.h | 2 ++ configure | 43 +++++++++++++++++++++++++++++++---- 9 files changed, 74 insertions(+), 7 deletions(-) create mode 100644 backends/platform/psp/module.mk create mode 100644 backends/platform/psp/psp.spec diff --git a/backends/fs/psp/psp-fs.cpp b/backends/fs/psp/psp-fs.cpp index 11063f3dd2..9936d37f77 100644 --- a/backends/fs/psp/psp-fs.cpp +++ b/backends/fs/psp/psp-fs.cpp @@ -31,6 +31,8 @@ #include #include +#include + #define ROOT_PATH "ms0:/" /** diff --git a/backends/platform/psp/module.mk b/backends/platform/psp/module.mk new file mode 100644 index 0000000000..afe9a23f58 --- /dev/null +++ b/backends/platform/psp/module.mk @@ -0,0 +1,17 @@ +MODULE := backends/platform/psp + +MODULE_OBJS := \ + psp_main.o \ + osys_psp.o \ + osys_psp_gu.o \ + kbd_ss_c.o \ + kbd_s_c.o \ + kbd_ls_c.o \ + kbd_l_c.o \ + trace.o + +MODULE_DIRS += \ + backends/platform/psp/ + +# We don't use the rules.mk here on purpose +OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index bb4f69006d..63ea5bc0dc 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -37,6 +37,9 @@ #include "sound/mixer_intern.h" #include +#include + +#include #include "./trace.h" diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h index acd98c6b74..7abba332df 100644 --- a/backends/platform/psp/osys_psp.h +++ b/backends/platform/psp/osys_psp.h @@ -30,9 +30,10 @@ #include "backends/base-backend.h" #include "backends/fs/psp/psp-fs-factory.h" - #include +#include + enum GraphicModeID { CENTERED_320X200, CENTERED_435X272, diff --git a/backends/platform/psp/osys_psp_gu.cpp b/backends/platform/psp/osys_psp_gu.cpp index 9c5cdfa197..76f6b42e37 100644 --- a/backends/platform/psp/osys_psp_gu.cpp +++ b/backends/platform/psp/osys_psp_gu.cpp @@ -22,11 +22,14 @@ * $Id$ */ -#include #include "osys_psp_gu.h" -#include "./trace.h" +#include "trace.h" #include "common/events.h" +#include + +#include + #define PIXEL_SIZE (4) #define BUF_WIDTH (512) #define PSP_SCREEN_WIDTH 480 diff --git a/backends/platform/psp/psp.spec b/backends/platform/psp/psp.spec new file mode 100644 index 0000000000..223bd58098 --- /dev/null +++ b/backends/platform/psp/psp.spec @@ -0,0 +1,3 @@ +%rename lib old_lib +*lib: +-lg -lm -lstdc++ -lsupc++ -lg -lpsprtc -lpspaudio -lpspuser -lpsputility -lpspdebug -lc -lpspgum -lpspvfpu -lpspgu -lpspctrl -lpspge -lpspdisplay_driver -lpspdisplay -lpsphprm -lpspge_driver -lpspsdk -lpsppower -lpsppower_driver -lpspgum_vfpu -lpspkernel %(old_lib) diff --git a/backends/saves/psp/psp-saves.cpp b/backends/saves/psp/psp-saves.cpp index 2a70af610d..f759d3f531 100644 --- a/backends/saves/psp/psp-saves.cpp +++ b/backends/saves/psp/psp-saves.cpp @@ -30,6 +30,7 @@ #include "common/config-manager.h" #include "common/savefile.h" +#include #define PSP_DEFAULT_SAVE_PATH "ms0:/scummvm_savegames" diff --git a/common/scummsys.h b/common/scummsys.h index 3caeab9ee0..a9c5fb3266 100644 --- a/common/scummsys.h +++ b/common/scummsys.h @@ -332,6 +332,8 @@ #elif defined(__PSP__) + #include + #define scumm_stricmp strcasecmp #define scumm_strnicmp strncasecmp diff --git a/configure b/configure index 9db0c07c3f..cf3eb30a31 100755 --- a/configure +++ b/configure @@ -273,7 +273,7 @@ get_system_exe_extension() { gp2x-linux) _exeext=".gp2x" ;; - dreamcast | wii | gamecube) + dreamcast | wii | gamecube | psp) _exeext=".elf" ;; *) @@ -547,7 +547,7 @@ Usage: $0 [OPTIONS]... Configuration: -h, --help display this help and exit - --backend=BACKEND backend to build (sdl, morphos, dc, gp2x, iphone, wii, null) [sdl] + --backend=BACKEND backend to build (sdl, morphos, dc, gp2x, iphone, wii, psp, null) [sdl] Installation directories: --prefix=DIR use this prefix for installing ScummVM [/usr/local] @@ -563,6 +563,7 @@ Special configuration feature: wii for Nintendo Wii gamecube for Nintendo Gamecube iphone for Apple iPhone + psp for PlayStation Portable Optional Features: --disable-debug disable building with debugging symbols @@ -809,6 +810,12 @@ wii) _host_cpu=ppc _host_alias=powerpc-gekko ;; +psp) + _host_os=psp + _host_cpu=mipsallegrexel + _host_alias=psp + LDFLAGS="$LDFLAGS -L$PSPDEV/psp/sdk/lib -specs=$_srcdir/backends/platform/psp/psp.spec" + ;; gamecube) _host_os=gamecube _host_cpu=ppc @@ -856,6 +863,12 @@ wii | gamecube) exit 1 fi ;; +psp) + if test -z "$PSPDEV"; then + echo "Please set PSPDEV in your environment. export PSPDEV=" + exit 1 + fi + ;; *) ;; esac @@ -1120,6 +1133,9 @@ case $_host_os in CXXFLAGS="$CXXFLAGS -I$DEVKITPRO/libogc/include" LDFLAGS="$LDFLAGS -mogc -mcpu=750 -L$DEVKITPRO/libogc/lib/cube" ;; + psp) + CXXFLAGS="$CXXFLAGS -O2 -G0 -I$PSPDEV/psp/sdk/include -D_PSP_FW_VERSION=150" + ;; # given this is a shell script assume some type of unix *) echo "WARNING: could not establish system type, assuming unix like" @@ -1286,6 +1302,20 @@ if test -n "$_host"; then add_line_to_config_h "/* #define DEBUG_WII_MEMSTATS */" add_line_to_config_h "/* #define DEBUG_WII_GDB */" ;; + psp) + echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes" + _endian=little + _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="psp" + _build_scalers="no" + _build_hq_scalers="no" + _mt32emu="no" + ;; *) echo "Continuing with auto-detected values ... if you have problems, please add your target to configure." ;; @@ -1840,6 +1870,11 @@ case $_backend in ;; esac ;; + psp) + DEFINES="$DEFINES -D__PSP__ -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE" + INCLUDES="$INCLUDES -I$PSPDEV/psp/include/SDL" + LIBS="$LIBS -lSDL" + ;; *) echo "support for $_backend backend not implemented in configure script yet" exit 1 @@ -1854,7 +1889,7 @@ if test "$_cxx_major" -ge "3" ; then case $_host_os in # newlib-based system include files suppress non-C89 function # declarations under __STRICT_ANSI__ - mingw* | cygwin* | dreamcast | wii | gamecube) + mingw* | cygwin* | dreamcast | wii | gamecube | psp) CXXFLAGS="$CXXFLAGS -W -Wno-unused-parameter" ;; *) @@ -1872,7 +1907,7 @@ fi; # Some platforms use certain GNU extensions in header files case $_host_os in -wii | gamecube) +wii | gamecube | psp) ;; *) CXXFLAGS="$CXXFLAGS -pedantic" -- cgit v1.2.3