aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
Diffstat (limited to 'backends')
-rw-r--r--backends/gp32/Makefile163
-rw-r--r--backends/gp32/README.GP3239
-rw-r--r--backends/gp32/build.rules131
-rw-r--r--backends/gp32/fontdata.c283
-rw-r--r--backends/gp32/gfx_splash.h25
-rw-r--r--backends/gp32/gp-fs.cpp163
-rw-r--r--backends/gp32/gp32.h316
-rw-r--r--backends/gp32/gp32_launcher.cpp148
-rw-r--r--backends/gp32/gp32_launcher.h34
-rw-r--r--backends/gp32/gp32_main.cpp183
-rw-r--r--backends/gp32/gp32_osys.cpp744
-rw-r--r--backends/gp32/gp32_osys.h158
-rw-r--r--backends/gp32/gp32std.cpp564
-rw-r--r--backends/gp32/gp32std.h92
-rw-r--r--backends/gp32/gp32std_grap.cpp133
-rw-r--r--backends/gp32/gp32std_grap.h (renamed from backends/gp32/startup.h)40
-rw-r--r--backends/gp32/gp32std_input.cpp210
-rw-r--r--backends/gp32/gp32std_input.h51
-rw-r--r--backends/gp32/gp32std_sound.cpp107
-rw-r--r--backends/gp32/gp32std_sound.h45
-rw-r--r--backends/gp32/gp_asmlib.s393
-rw-r--r--backends/gp32/gp_clipped.c100
-rw-r--r--backends/gp32/graphics.h112
-rw-r--r--backends/gp32/memcpy.S498
-rw-r--r--backends/gp32/portdefs.h185
-rw-r--r--backends/gp32/setup.h102
-rw-r--r--backends/gp32/startup.c15
27 files changed, 4057 insertions, 977 deletions
diff --git a/backends/gp32/Makefile b/backends/gp32/Makefile
index e16c146cd1..6420c7b714 100644
--- a/backends/gp32/Makefile
+++ b/backends/gp32/Makefile
@@ -1,4 +1,7 @@
-CXX := c++
+CC := arm-elf-gcc
+CXX := arm-elf-g++
+LD := arm-elf-g++
+AS := arm-elf-as
AR := arm-elf-ar cru
RANLIB := arm-elf-ranlib
RM := rm -f
@@ -10,6 +13,9 @@ RM := rm -f
RM_REC := $(RM) -r
ZIP := zip -q
CP := cp
+OBJCOPY := arm-elf-objcopy
+FXETOOL := b2fxec
+
#######################################################################
# Default compilation parameters. Normally don't edit these #
@@ -28,19 +34,114 @@ CXXFLAGS+= -Wshadow -Wuninitialized -Wimplicit -Wundef
CXXFLAGS+= -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder
CXXFLAGS+= -Wwrite-strings -fcheck-new -Wctor-dtor-privacy -Wnon-virtual-dtor
-# Seems GCC 2.95 doesn't support the following, so we do not yet turn them
-# on by default (but I'd strongly recommend to all GCC 2.95 users to update
-# to a better compiler like GCC 3.x).
-#CXXFLAGS+= -ansi -W -Wno-unused-parameter -Woverloaded-virtual -Wdisabled-optimization -Wfloat-equal
-
-# The following causes problems on some systems where the system header
-# contain duplicate declarations already. That's really a bug in the
-# system headers, but since it causes lots of warnings on those systems,
-# we don't enable it by default
-#CXXFLAGS+= -Wredundant-decls
-
-# Load the build rules & settings for the chosen backend
--include build.rules
+# GPSDK (SDK, Includes and Startup Files) base dir
+GPSDK = /usr/compat/gp32/share/sdk
+
+# Outputs
+EXEEXT = .elf
+MAPFILE = scummvm.map
+BIN = scummvm.gxb
+FXE = scummvm.fxe
+
+# Stripped Build? (Smaller ELF, Minimal debug symbol information).
+# You MUST comment this out with a # if you wish to debug your code.
+# STRIP_DEBUG = -Wl,--strip-debug
+
+# Plugins hack
+srcdir = ./
+
+# GP32 Direct Execute Tool (i.e. pclink -e on Windows, gplink run on Linux)
+EXECUTE_TOOL = pclink -e
+#
+# -ffast-math \
+# -fshort-double \
+#
+#
+#
+
+ #-Wno-multichar \
+ # Remove the below from the above flags for Debug.
+CFLAGS = -marm -march=armv4t -mtune=arm920 -mapcs \
+ -finline-functions \
+ -fshort-enums \
+ -mstructure-size-boundary=32 \
+ -mno-thumb-interwork \
+ -I$(GPSDK)/include \
+ -g \
+ -O3 \
+ -fomit-frame-pointer
+
+CPPFLAGS = $(CFLAGS)
+
+DEFINES = -D__GP32__
+DEFINES += -DNONSTANDARD_PORT
+
+# Support Vorbis Tremor Patches.
+#DEFINES += -DVORBIS_TREMOR
+
+# Support LIBMAD Patches.
+#DEFINES += -DGP32_MADMP3
+
+# Support for 8:3 save files names (The GP32 uses FAT12/16 (no vFAT) for the file system).
+DEFINES += -DSHORT_SAVENAMES
+
+# Support for the unsigned sound mixer.
+DEFINES += -DOUTPUT_UNSIGNED_AUDIO
+
+# Support for the GP32 (fmOPL derived) MIDI engine.
+# - NOT fully implemented yet.
+DEFINES += -DUSE_GP32_FMOPL
+
+LDSPECS = -specs=gp32_gpsdk.specs
+
+LDFLAGS = $(STRIP_DEBUG) \
+ -Wl,-Map,$(MAPFILE) \
+ $(LDSPECS) -Wl,--no-warn-mismatch
+
+LIBS += -L$(GPSDK)/lib \
+ -lgpmem -lgpos -lgpstdio -lgpstdlib -lgpsound -lgpgraphic -lgpfont \
+ -lm -lc -lgcc
+
+INCLUDES += -Ibackends/gp32 -I$(GPSDK)/include
+
+MODULES += backends/gp32
+
+#GP32 Debug - Remove from Release builds
+# This builds in the GP32 GDB USB Stub. Don't use it unless you know what your doing.
+# You also need to remove ANY optemisation from the compiler flags.
+#DEFINES += -DGP32_GDB
+#OBJS += backends/gp32/debug-gdbstub-usb.o
+
+# Standard librarys and optimization modules
+OBJS += backends/gp32/startup.o \
+ backends/gp32/memcpy.o \
+ backends/gp32/gp_asmlib.o \
+ backends/gp32/gp_clipped.o \
+ backends/gp32/fontdata.o
+
+# Custom GP32 std library
+OBJS += backends/gp32/gp32std.o \
+ backends/gp32/gp32std_grap.o \
+ backends/gp32/gp32std_input.o \
+ backends/gp32/gp32std_sound.o \
+ #backends/gp32/dmaaudio_asm.o \
+ #backends/gp32/dmaaudio.o \
+
+#Main ScummVM for the GP32 Backend
+OBJS += backends/gp32/gp32_main.o \
+ backends/gp32/gp32_launcher.o \
+ backends/gp32/gp32_osys.o \
+ backends/gp32/gp-fs.o
+
+#install: all
+ #$(EXECUTE_TOOL) $(BIN)
+
+$(FXE): $(BIN)
+ $(FXETOOL) -f -a "The ScummVM Team" -t "ScummVM for the GP32" $< $@
+# $(FXETOOL) -f -a "The ScummVM Team" -t "ScummVM for the GP32" -b scummvm.bmp $< $@
+
+$(BIN): scummvm$(EXEEXT)
+ $(OBJCOPY) -O binary $< $@
#######################################################################
# Compile options - you can modify these to tweak ScummVM compilation #
@@ -69,11 +170,17 @@ HAVE_GCC3 = 1
# Control which modules are built - uncomment any to disable module #
#######################################################################
+DISABLE_SCALERS = 1
+DISABLE_HQ_SCALERS = 1
+
#DISABLE_SCUMM = 1
+#DISABLE_SCUMM_7_8 = 1
+DISABLE_HE = 1
DISABLE_SIMON = 1
DISABLE_SKY = 1
DISABLE_QUEEN = 1
+
# The engines below are not supported on the GP32 port so there is
# no point compiling support into the binary.
DISABLE_SWORD1 = 1
@@ -83,6 +190,7 @@ DISABLE_SWORD2 = 1
# Disable for ALL release builds.
DISABLE_SAGA = 1
DISABLE_KYRA = 1
+DISABLE_GOB = 1
#######################################################################
# Misc stuff - you should normally never have to edit this #
@@ -96,32 +204,5 @@ dist:
$(RM) $(ZIPFILE)
$(ZIP) $(ZIPFILE) $(DISTFILES)
-# Pull in the GP32 backend build.rules here.
-build.rules: backends/gp32/build.rules
- $(CP) backends/gp32/build.rules build.rules
-
-# Special target to create a application wrapper for Mac OS X
-bundle_name = ScummVM.app
-bundle: scummvm-static
- mkdir -p $(bundle_name)/Contents/MacOS
- mkdir -p $(bundle_name)/Contents/Resources
- echo "APPL????" > $(bundle_name)/Contents/PkgInfo
- cp Info.plist $(bundle_name)/Contents/
- cp scummvm.icns $(bundle_name)/Contents/Resources/
- cp scummvm-static $(bundle_name)/Contents/MacOS/scummvm
- strip $(bundle_name)/Contents/MacOS/scummvm
-
install: $(FXE)
$(EXECUTE_TOOL) $(BIN)
-
-# Special target to create a static linked binary for Mac OS X
-scummvm-static: $(OBJS)
- $(CXX) $(LDFLAGS) -o scummvm-static $(OBJS) \
- /sw/lib/libSDLmain.a /sw/lib/libSDL.a \
- /sw/lib/libmad.a \
- /sw/lib/libvorbisfile.a /sw/lib/libvorbis.a /sw/lib/libogg.a \
- -framework Cocoa -framework Carbon -framework IOKit \
- -framework OpenGL -framework AGL -framework QuickTime \
- -framework AudioUnit -framework AudioToolbox
-
-.PHONY: deb bundle
diff --git a/backends/gp32/README.GP32 b/backends/gp32/README.GP32
index dc5f7eb649..15120c7303 100644
--- a/backends/gp32/README.GP32
+++ b/backends/gp32/README.GP32
@@ -1,38 +1 @@
-ScummVM port for GamePark 32
-============================
-
-Compiling instructions:
- 1. download and install Fenix's devkit advance (see Windows.txt)
- 2. get chn's gp32 devkit and install it (see readme-gp32.txt)
- 3. In Makefile change the line: build.rules: to
- $(CP) backends/gp32/build.rules build.rules
- 4. run make
-
- * In case you have installed devkitadv to a different directory
- than it's default, you'll have to modify build.rules in backend/gp32/
-
-How to run:
- - upload scummvm.fxe in gp:\gpmm
- - upload all game data files in gp:\
-
-Controls:
- A: left click
- B: right click
- L: debug console
- R: game screen
- Start: menu
- Select:skip
- L+R: save
-
-For the latest source release visit the official ScummVM page:
- http://www.scummvm.org/
-
-You can get the precompiled gp32 executable (fxe) from my site:
- http://people.inf.elte.hu/ph0x
-
-
-Thanks to the following people for their help:
- Endy, khalek and the rest ScummVM team members,
- Jeff, DarkFader, Inopia, groepaz, chn, FireFly, #gp32dev
-
- ph0x (ph0x@freemail.hu)
+TODO. :)
diff --git a/backends/gp32/build.rules b/backends/gp32/build.rules
deleted file mode 100644
index 59ae58b3e7..0000000000
--- a/backends/gp32/build.rules
+++ /dev/null
@@ -1,131 +0,0 @@
-# ScummVM - Scumm Interpreter
-# Copyright (C) 2001 Ludvig Strigeus
-# Copyright (C) 2001/2004 The ScummVM project
-# Copyright (C) 2002 ph0x - GP32 port
-# Copyright (C) 2003-4 DJWillis - GP32 port
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Module Details - ScummVM for the GP32
-# Build.Rules for GP32 Backend.
-#
-# Port Maintainer - DJWillis <gp32@distant-earth.co.uk>
-
-# GPSDK (SDK, Includes and Startup Files) base dir
-GPSDK = /usr/compat/gp32/share/sdk
-
-# Outputs
-EXEEXT = .elf
-MAPFILE = scummvm.map
-BIN = scummvm.gxb
-FXE = scummvm.fxe
-
-# Stripped Build? (Smaller ELF, Minimal debug symbol information).
-# You MUST comment this out with a # if you wish to debug your code.
-# STRIP_DEBUG = -Wl,--strip-debug
-
-# Plugins hack
-srcdir = ./
-
-# GP32 Direct Execute Tool (i.e. pclink -e on Windows, gplink run on Linux)
-EXECUTE_TOOL = pclink -e
-
-# GCC Tool-chain
-CC = arm-elf-gcc
-CXX = arm-elf-g++
-LD = arm-elf-g++
-AS = arm-elf-as
-OBJCOPY = arm-elf-objcopy
-FXETOOL = b2fxec
-
-CFLAGS = -marm \
- -march=armv4t \
- -mapcs \
- -finline-functions \
- -fshort-enums \
- -ffast-math \
- -fshort-double \
- -mstructure-size-boundary=32 \
- -mno-thumb-interwork \
- -I$(GPSDK)/include \
- -g \
- #-Wno-multichar \
- #-O3 \
- #-fomit-frame-pointer
-
- # Remove the below from the above flags for Debug.
- #-O3 \
- #-fomit-frame-pointer
-
-CPPFLAGS = $(CFLAGS)
-
-DEFINES = -D__GP32__
-DEFINES += -DNONSTANDARD_PORT
-
-# Support Vorbis Tremor Patches.
-#DEFINES += -DUSE_TREMOR
-
-# Support LIBMAD Patches.
-#DEFINES += -DGP32_MADMP3
-
-# Support for 8:3 save files names (The GP32 uses FAT12/16 (no vFAT) for the file system).
-DEFINES += -DSHORT_SAVENAMES
-
-# Support for the unsigned sound mixer.
-DEFINES += -DOUTPUT_UNSIGNED_AUDIO
-
-# Support for the GP32 (fmOPL derived) MIDI engine.
-# - NOT fully implemented yet.
-DEFINES += -DUSE_GP32_FMOPL
-
-LDSPECS = -specs=gp32_gpsdk.specs
-
-LDFLAGS = $(STRIP_DEBUG) \
- -Wl,-Map,$(MAPFILE) \
- $(LDSPECS) -Wl,--no-warn-mismatch
-
-LIBS += -L$(GPSDK)/lib \
- -lgpmem -lgpos -lgpstdio -lgpstdlib -lgpsound -lgpgraphic -lgpgraphic16 -lgpfont -lgpfont16 \
- -lm -lc -lgcc
-
-INCLUDES += -Ibackends/gp32 -I$(GPSDK)/include
-
-MODULES += backends/gp32
-
-#GP32 Debug - Remove from Release builds
-# This builds in the GP32 GDB USB Stub. Don't use it unless you know what your doing.
-# You also need to remove ANY optemisation from the compiler flags.
-DEFINES += -DGP32_GDB
-OBJS += backends/gp32/debug-gdbstub-usb.o
-
-#GamePark SDK startup.
-OBJS += backends/gp32/startup.o
-
-#Main ScummVM for the GP32 Backend
-OBJS += backends/gp32/gp32.o \
- backends/gp32/gp-fs.o \
- backends/gp32/cpuspeed.o \
-
- #backends/gp32/dmaaudio_asm.o \
- #backends/gp32/dmaaudio.o \
-
-#install: all
- #$(EXECUTE_TOOL) $(BIN)
-
-$(FXE): $(BIN)
- $(FXETOOL) -f -a "DJWillis/ScummVM Team" -t "ScummVM for the GP32" -b scummvm.bmp $< $@
-
-$(BIN): scummvm$(EXEEXT)
- $(OBJCOPY) -O binary $< $@
diff --git a/backends/gp32/fontdata.c b/backends/gp32/fontdata.c
new file mode 100644
index 0000000000..3b605958e0
--- /dev/null
+++ b/backends/gp32/fontdata.c
@@ -0,0 +1,283 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001-2005 The ScummVM project
+ * Copyright (C) 2002 Ph0x - GP32 Backend
+ * Copyright (C) 2003/2004 DJWillis - GP32 Backend
+ * Copyright (C) 2005 Won Star - GP32 Backend
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $Header$
+ *
+ */
+
+const unsigned char fontresEng1[] =
+{
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x7E,0x81,0xA5,0x81,0x81,0xBD,0x81,0x7E,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x7E,0xFF,0xDB,0xFF,0xFF,0xC3,0xFF,0x7E,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x36,0x7F,0x7F,0x7F,0x7F,0x3E,0x1C,0x08,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x08,0x1C,0x3E,0x7F,0x3E,0x1C,0x08,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x18,0x3C,0x3C,0x7E,0x66,0x7E,0x18,0x3C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x18,0x3C,0x3C,0x7E,0x7E,0x3C,0x18,0x3C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x18,0x3C,0x3C,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0xFF,0xFF,0xFF,0xFF,0xE7,0xC3,0xC3,0xE7,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x3C,0x66,0x42,0x42,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0xFF,0xFF,0xFF,0xC3,0x99,0xBD,0xBD,0x99,0xC3,0xFF,0xFF,0xFF,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x0F,0x07,0x0D,0x19,0x3C,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x3C,0x66,0x66,0x3C,0x18,0x7E,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x3C,0x33,0x3C,0x33,0x30,0x70,0xF0,0x70,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x7F,0x63,0x7F,0x63,0x63,0x67,0xE7,0xE6,0xC0,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x18,0x18,0xDB,0x3C,0xE7,0x3C,0xDB,0x18,0x18,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x40,0x60,0x70,0x7C,0x7F,0x7C,0x70,0x60,0x40,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x01,0x03,0x07,0x1F,0x7F,0x1F,0x07,0x03,0x01,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x7E,0x3C,0x18,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x33,0x33,0x33,0x33,0x33,0x00,0x33,0x33,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x7F,0xDB,0xDB,0xDB,0x7B,0x1B,0x1B,0x1B,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x3E,0x63,0x30,0x1C,0x36,0x63,0x63,0x36,0x1C,0x06,0x63,0x3E,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x7F,0x7F,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x7E,0x3C,0x18,0x7E,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x7E,0x3C,0x18,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x0C,0x06,0x7F,0x06,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x18,0x30,0x7F,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x24,0x66,0xFF,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x08,0x1C,0x1C,0x3E,0x3E,0x7F,0x7F,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x7F,0x7F,0x3E,0x3E,0x1C,0x1C,0x08,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x18,0x3C,0x3C,0x3C,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x66,0x66,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x36,0x36,0x7F,0x36,0x36,0x7F,0x36,0x36,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x18,0x18,0x3C,0x66,0x60,0x3C,0x06,0x06,0x66,0x3C,0x18,0x18,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x61,0x63,0x06,0x0C,0x18,0x30,0x63,0x43,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x1C,0x36,0x36,0x1C,0x3B,0x6E,0x66,0x3B,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x30,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x0C,0x18,0x30,0x30,0x30,0x30,0x18,0x0C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x18,0x0C,0x06,0x06,0x06,0x06,0x0C,0x18,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x66,0x3C,0xFF,0x3C,0x66,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x18,0x18,0x18,0xFF,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x01,0x03,0x06,0x0C,0x18,0x30,0x60,0x40,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x3C,0x66,0x66,0x6E,0x76,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x18,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x3C,0x66,0x66,0x06,0x0C,0x18,0x30,0x7E,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x3C,0x66,0x06,0x1C,0x06,0x06,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x0C,0x1C,0x3C,0x6C,0x6C,0x7E,0x0C,0x0C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x7E,0x60,0x60,0x7C,0x06,0x06,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x3C,0x60,0x60,0x7C,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x7E,0x06,0x06,0x0C,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x3C,0x66,0x66,0x3C,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x3E,0x06,0x06,0x3C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x18,0x18,0x30,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x06,0x0C,0x18,0x30,0x30,0x18,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x60,0x30,0x18,0x0C,0x0C,0x18,0x30,0x60,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x3C,0x66,0x06,0x0C,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x3C,0x66,0x66,0x6E,0x6E,0x6E,0x60,0x3C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x18,0x3C,0x66,0x66,0x7E,0x66,0x66,0x66,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x7C,0x66,0x66,0x7C,0x66,0x66,0x66,0x7C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x3C,0x66,0x60,0x60,0x60,0x60,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x66,0x66,0x66,0x7C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x7E,0x60,0x60,0x7C,0x60,0x60,0x60,0x7E,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x7E,0x60,0x60,0x7C,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x3C,0x66,0x60,0x60,0x6E,0x66,0x66,0x3E,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x66,0x66,0x66,0x7E,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x66,0x6C,0x78,0x70,0x78,0x6C,0x66,0x66,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x7E,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x63,0x77,0x7F,0x6B,0x6B,0x63,0x63,0x63,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x66,0x66,0x76,0x7E,0x6E,0x66,0x66,0x66,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x7C,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x66,0x66,0x3C,0x04,0x06,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x7C,0x66,0x66,0x7C,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x3C,0x66,0x60,0x3C,0x06,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x7E,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x3C,0x18,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x63,0x63,0x63,0x63,0x6B,0x7F,0x77,0x63,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x66,0x66,0x3C,0x18,0x3C,0x66,0x66,0x66,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x66,0x66,0x66,0x3C,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x7E,0x06,0x0C,0x18,0x30,0x60,0x60,0x7E,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x3C,0x30,0x30,0x30,0x30,0x30,0x30,0x3C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x40,0x60,0x30,0x18,0x0C,0x06,0x03,0x01,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x18,0x3C,0x66,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,
+ 0x00,0x00,0x18,0x18,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x3C,0x06,0x3E,0x66,0x66,0x3E,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x7C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x60,0x60,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x06,0x06,0x3E,0x66,0x66,0x66,0x66,0x3E,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x7E,0x60,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x3C,0x66,0x60,0x78,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x3E,0x06,0x66,0x3C,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x06,0x00,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3C,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x60,0x60,0x66,0x6C,0x78,0x6C,0x66,0x66,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x77,0x7F,0x6B,0x6B,0x6B,0x6B,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x6C,0x7E,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x7C,0x60,0x60,0x60,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66,0x66,0x3E,0x06,0x06,0x06,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x6E,0x78,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x38,0x0C,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x30,0x30,0x7C,0x30,0x30,0x30,0x36,0x1C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x3C,0x18,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x63,0x6B,0x7F,0x36,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x66,0x3C,0x18,0x18,0x3C,0x66,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x3E,0x06,0x66,0x3C,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x7E,0x0C,0x18,0x30,0x60,0x7E,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x0E,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x0E,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x70,0x18,0x18,0x18,0x0E,0x18,0x18,0x18,0x70,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x3B,0x6E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x08,0x1C,0x36,0x63,0x63,0x7F,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x3C,0x66,0xC2,0xC0,0xC2,0x66,0x3C,0x18,0x0E,0x0C,0x78,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x66,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x3E,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x06,0x0C,0x18,0x00,0x3E,0x63,0x7F,0x60,0x63,0x3E,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x08,0x1C,0x36,0x00,0x3C,0x06,0x3E,0x66,0x66,0x3B,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x66,0x66,0x00,0x3C,0x06,0x3E,0x66,0x66,0x3B,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x30,0x18,0x0C,0x00,0x3C,0x06,0x3E,0x66,0x66,0x3B,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x1C,0x36,0x1C,0x00,0x3C,0x06,0x3E,0x66,0x66,0x3B,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x60,0x66,0x3C,0x0C,0x06,0x3C,0x00,0x00,0x00,
+ 0x00,0x00,0x08,0x1C,0x36,0x00,0x3E,0x63,0x7F,0x60,0x63,0x3E,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x66,0x66,0x00,0x3E,0x63,0x7F,0x60,0x63,0x3E,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x30,0x18,0x0C,0x00,0x3E,0x63,0x7F,0x60,0x63,0x3E,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x66,0x66,0x00,0x38,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x18,0x3C,0x66,0x00,0x38,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x60,0x30,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x63,0x63,0x08,0x1C,0x36,0x63,0x63,0x7F,0x63,0x63,0x00,0x00,0x00,0x00,
+ 0x00,0x1C,0x36,0x1C,0x00,0x1C,0x36,0x63,0x63,0x7F,0x63,0x63,0x00,0x00,0x00,0x00,
+ 0x00,0x0C,0x18,0x30,0x00,0x7F,0x33,0x30,0x3E,0x30,0x33,0x7F,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x6E,0x3B,0x1B,0x7E,0xD8,0xDC,0x77,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x1F,0x36,0x66,0x66,0x7F,0x66,0x66,0x66,0x67,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x08,0x1C,0x36,0x00,0x3E,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x63,0x63,0x00,0x3E,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x30,0x18,0x0C,0x00,0x3E,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x18,0x3C,0x66,0x00,0x66,0x66,0x66,0x66,0x66,0x3B,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x30,0x18,0x0C,0x00,0x66,0x66,0x66,0x66,0x66,0x3B,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x63,0x63,0x00,0x63,0x63,0x63,0x63,0x3F,0x03,0x06,0x3C,0x00,0x00,
+ 0x00,0x00,0x63,0x63,0x1C,0x36,0x63,0x63,0x63,0x63,0x36,0x1C,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x63,0x63,0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x18,0x18,0x7E,0xC3,0xC0,0xC0,0xC3,0x7E,0x18,0x18,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x1C,0x36,0x32,0x30,0x78,0x30,0x30,0x30,0x73,0x7E,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0xC3,0x66,0x3C,0x18,0xFF,0x18,0xFF,0x18,0x18,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0xFC,0x66,0x66,0x7C,0x62,0x66,0x6F,0x66,0x66,0xF3,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x0E,0x1B,0x18,0x18,0x18,0x7E,0x18,0x18,0x18,0x18,0xD8,0x70,0x00,0x00,
+ 0x00,0x00,0x0C,0x18,0x30,0x00,0x3C,0x06,0x3E,0x66,0x66,0x3B,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x0C,0x18,0x30,0x00,0x38,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x0C,0x18,0x30,0x00,0x3E,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x0C,0x18,0x30,0x00,0x66,0x66,0x66,0x66,0x66,0x3B,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x3B,0x6E,0x00,0x6E,0x33,0x33,0x33,0x33,0x33,0x00,0x00,0x00,0x00,
+ 0x00,0x3B,0x6E,0x00,0x63,0x73,0x7B,0x7F,0x6F,0x67,0x63,0x63,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x3C,0x6C,0x6C,0x3E,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x38,0x6C,0x6C,0x38,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x18,0x18,0x00,0x18,0x18,0x30,0x63,0x63,0x3E,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x60,0xE0,0x63,0x66,0x6C,0x18,0x30,0x6E,0xC3,0x06,0x0C,0x1F,0x00,0x00,
+ 0x00,0x00,0x60,0xE0,0x63,0x66,0x6C,0x18,0x33,0x67,0xCF,0x1F,0x03,0x03,0x00,0x00,
+ 0x00,0x00,0x00,0x18,0x18,0x00,0x18,0x18,0x3C,0x3C,0x3C,0x18,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x1B,0x36,0x6C,0x36,0x1B,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x6C,0x36,0x1B,0x36,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,
+ 0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,
+ 0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x36,0x36,0x36,0x36,0x36,0x36,0xF6,0x06,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
+ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x06,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
+ 0x36,0x36,0x36,0x36,0x36,0x36,0xF6,0x06,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
+ 0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
+ 0x36,0x36,0x36,0x36,0x36,0x36,0xF7,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xF7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
+ 0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x36,0x36,0x36,0x36,0x36,0x36,0xF7,0x00,0xF7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
+ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
+ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFF,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x18,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,
+ 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x3B,0x6E,0x6C,0x6C,0x6E,0x3B,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x3E,0x63,0x7E,0x63,0x63,0x7E,0x60,0x60,0x20,0x00,0x00,
+ 0x00,0x00,0x00,0x7F,0x63,0x63,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x7F,0x36,0x36,0x36,0x36,0x36,0x36,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x7F,0x63,0x30,0x18,0x0C,0x18,0x30,0x63,0x7F,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x6C,0x6C,0x6C,0x6C,0x38,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x33,0x33,0x33,0x33,0x3E,0x30,0x30,0x60,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x3F,0x6C,0x0C,0x0C,0x0C,0x0C,0x0C,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x7E,0x18,0x3C,0x66,0x66,0x66,0x3C,0x18,0x7E,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x1C,0x36,0x63,0x63,0x7F,0x63,0x63,0x36,0x1C,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x1C,0x36,0x63,0x63,0x63,0x36,0x36,0x36,0x77,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x1E,0x30,0x18,0x0C,0x3E,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0xDB,0xDB,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x03,0x06,0x7E,0xDB,0xDB,0xF3,0x7E,0x60,0xC0,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x1C,0x30,0x60,0x60,0x7C,0x60,0x60,0x30,0x1C,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x3E,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x7F,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x18,0x18,0x18,0xFF,0x18,0x18,0x18,0x00,0xFF,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x00,0x7E,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x00,0x7E,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x0E,0x1B,0x1B,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,
+ 0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xD8,0xD8,0x70,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x18,0x18,0x00,0x00,0xFF,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x3B,0x6E,0x00,0x3B,0x6E,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x38,0x6C,0x6C,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x0F,0x0C,0x0C,0x0C,0x0C,0x0C,0xEC,0x6C,0x3C,0x1C,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0xD8,0x6C,0x6C,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x70,0xD8,0x30,0x60,0xC8,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x3E,0x3E,0x3E,0x3E,0x3E,0x3E,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+};
diff --git a/backends/gp32/gfx_splash.h b/backends/gp32/gfx_splash.h
index 5d0ca42050..ec7b5ac6ca 100644
--- a/backends/gp32/gfx_splash.h
+++ b/backends/gp32/gfx_splash.h
@@ -1,3 +1,26 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001-2005 The ScummVM project
+ * Copyright (C) 2003/2004 DJWillis - GP32 Backend
+ * Copyright (C) 2005 Won Star - GP32 Backend
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $Header$
+ *
+ */
+
/////////////////////////////////////////
//
// Header file for GP32
@@ -18,7 +41,7 @@
#define gfx_splash_palnb 256
-#include "gpgraphic.h"
+#include <gpgraphic.h>
GP_PALETTEENTRY gfx_splash_Pal[256] = {
0x843, 0x88B, 0x1941, 0x110D, 0x2883, 0x30C9, 0x2945, 0x2109, 0x214D, 0x2989, 0x218F, 0x3149, 0x394D, 0x3989, 0x318D, 0x8D1,
diff --git a/backends/gp32/gp-fs.cpp b/backends/gp32/gp-fs.cpp
index 0c70d568f8..663bb5afba 100644
--- a/backends/gp32/gp-fs.cpp
+++ b/backends/gp32/gp-fs.cpp
@@ -1,8 +1,8 @@
/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001 Ludvig Strigeus
- * Copyright (C) 2001/2004 The ScummVM project
+ * Copyright (C) 2001-2005 The ScummVM project
* Copyright (C) 2002 Ph0x - GP32 Backend
* Copyright (C) 2003/2004 DJWillis - GP32 Backend
+ * Copyright (C) 2005 Won Star - GP32 Backend
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -22,104 +22,98 @@
*
*/
-#if defined (__GP32__)
+#include "stdafx.h"
-#include "common/stdafx.h"
-
-#include "backends/gp32/gp32.h"
#include "backends/fs/fs.h"
-#include <stdio.h>
-#include <gpstdio.h>
-/*
- * Implementation of the ScummVM file system API based on GP32 SMC File Access.
- */
-
-class GP32FilesystemNode : public FilesystemNode {
+class GP32FilesystemNode : public AbstractFilesystemNode {
protected:
- Common::String _displayName;
+ String _displayName;
bool _isDirectory;
- bool _isValid;
- Common::String _path;
+ bool _isRoot;
+ String _path;
public:
- GP32FilesystemNode();
- GP32FilesystemNode(const Common::String &path);
+ GP32FilesystemNode(void);
GP32FilesystemNode(const GP32FilesystemNode *node);
+ GP32FilesystemNode(const String &path);
- virtual Common::String displayName() const { return _displayName; }
- virtual bool isValid() const { return _isValid; }
+ virtual String displayName() const { return _displayName; }
+ virtual bool isValid() const { return true; }
virtual bool isDirectory() const { return _isDirectory; }
- virtual Common::String path() const { return _path; }
+ virtual String path() const { return _path; }
- virtual FSList listDir(ListMode mode = kListDirectoriesOnly) const;
- virtual FilesystemNode *parent() const;
- virtual FilesystemNode *clone() const { return new GP32FilesystemNode(this); }
+ virtual FSList listDir(ListMode) const;
+ virtual AbstractFilesystemNode *parent() const;
+ virtual AbstractFilesystemNode *clone() const { return new GP32FilesystemNode(this); }
};
-
-AbstractFilesystemNode *FilesystemNode::getRoot() {
+AbstractFilesystemNode *FilesystemNode::getRoot(void) {
return new GP32FilesystemNode();
}
-GP32FilesystemNode::GP32FilesystemNode() {
- _displayName = "gp:\\SCUMMVM\\GAMES\\";
- _isValid = true;
- _isDirectory = true;
- _path = "gp:\\scummvm\\games\\";
+AbstractFilesystemNode *FilesystemNode::getNodeForPath(const String &path) {
+ return new GP32FilesystemNode(path);
}
-/*
-GP32FilesystemNode::GP32FilesystemNode() {
- _displayName = "gp:\\";
- _isValid = true;
+GP32FilesystemNode::GP32FilesystemNode(void) {
_isDirectory = true;
+ _isRoot = true;
+ _displayName = "GP32 Root";
_path = "gp:\\";
}
-*/
-GP32FilesystemNode::GP32FilesystemNode(const Common::String &p) {
- // TODO - extract last component from path
- _displayName = p;
- // TODO - check whether it is a directory, and whether the file actually exists
- _isValid = true;
+GP32FilesystemNode::GP32FilesystemNode(const String &path) {
+ _path = path;
+ const char *dsplName = NULL, *pos = path.c_str();
+ while (*pos)
+ if (*pos++ == '\\')
+ dsplName = pos;
+
+ BP("path name: %s", path.c_str());
+
+ if (strcmp(path.c_str(), "gp:\\") == 0) {
+ _isRoot = true;
+ _displayName = "GP32 Root";
+ } else {
+ _displayName = String(dsplName);
+ }
_isDirectory = true;
- _path = p;
}
GP32FilesystemNode::GP32FilesystemNode(const GP32FilesystemNode *node) {
_displayName = node->_displayName;
- _isValid = node->_isValid;
_isDirectory = node->_isDirectory;
_path = node->_path;
-}
-
-AbstractFilesystemNode *FilesystemNode::getNodeForPath(const String &path) {
- return new GP32FilesystemNode(path);
+ _isRoot = node->_isRoot;
}
FSList GP32FilesystemNode::listDir(ListMode mode) const {
assert(_isDirectory);
- GPDIRENTRY dp;
- ulong read;
-
+ GPDIRENTRY dirEntry;
+ uint32 read;
FSList myList;
- int start=0; // current file
+ if (mode == AbstractFilesystemNode::kListAll)
+ LP("listDir(kListAll)");
+ else
+ LP("listDir(kListDirectoriesOnly)");
- // ... loop over dir entries using readdir
- while (GpDirEnumList(_path.c_str(), start++, 1, &dp, &read) == SM_OK) {
- if (strcmp(dp.name,".")==0|| strcmp(dp.name,"..")==0) continue;
+ int startIdx = 0; // current file
+ String listDir(_path);
+ //listDir += "/";
+ while (GpDirEnumList(listDir.c_str(), startIdx++, 1, &dirEntry, &read) == SM_OK) {
+ if (dirEntry.name[0] == '.')
+ continue;
GP32FilesystemNode entry;
- entry._displayName = dp.name;
+ entry._displayName = dirEntry.name;
entry._path = _path;
- entry._path += dp.name;
+ entry._path += dirEntry.name;
GPFILEATTR attr;
- char s[256];
- sprintf(s, "%s%s", _path.c_str(), dp.name);
- GpFileAttr(s, &attr);
+ String fileName(entry._path);
+ GpFileAttr(fileName.c_str(), &attr);
entry._isDirectory = attr.attr & (1<<4);
// Honor the chosen mode
@@ -128,11 +122,36 @@ FSList GP32FilesystemNode::listDir(ListMode mode) const {
continue;
if (entry._isDirectory)
- entry._path += "\\"; //ph0x
- myList.push_back(entry);
+ entry._path += "\\";
+ myList.push_back(wrap(new GP32FilesystemNode(&entry)));
}
+
+ BP("Dir... %s", listDir.c_str());
+
return myList;
}
+/*
+AbstractFilesystemNode *GP32FilesystemNode::parent() const {
+ if (_isRoot)
+ return new GP32FilesystemNode(this);
+
+ GP32FilesystemNode *p = new GP32FilesystemNode();
+
+ const char *slash = NULL;
+ const char *cnt = _path.c_str();
+
+ while (*cnt) {
+ if (*cnt == '\\')
+ slash = cnt;
+ cnt++;
+ }
+
+ p->_path = String(_path.c_str(), slash - _path.c_str());
+ p->_isDirectory = true;
+ p->_displayName = slash + 1;
+ return p;
+}
+*/
const char *lastPathComponent(const Common::String &str) {
const char *start = str.c_str();
@@ -145,25 +164,10 @@ const char *lastPathComponent(const Common::String &str) {
return cur+1;
}
-FilesystemNode *GP32FilesystemNode::parent() const {
+AbstractFilesystemNode *GP32FilesystemNode::parent() const {
GP32FilesystemNode *p = new GP32FilesystemNode();
-// OLD - REMOVE ON CLEAN COMPILE
-// // Root node is its own parent. Still we can't just return this
-// // as the GUI code will call delete on the old node.
-// if (_path != "gp:\\") { //ph0x
-// const char *start = _path.c_str();
-// const char *end = lastPathComponent(_path);
-//
-// p->_path = String(start, end - start);
-// p->_isValid = true;
-// p->_isDirectory = true;
-// p->_displayName = lastPathComponent(p->_path);
-// }
-// return p;
-//}
-
// Root node is its own parent. Still we can't just return this
// as the GUI code will call delete on the old node.
if (_path != "gp:\\") {
@@ -172,13 +176,12 @@ FilesystemNode *GP32FilesystemNode::parent() const {
p->_path = Common::String(start, end - start);
p->_displayName = lastPathComponent(p->_path);
+ p->_isRoot = true;
} else {
+ p->_isRoot = false;
p->_path = _path;
p->_displayName = _displayName;
}
- p->_isValid = true;
p->_isDirectory = true;
return p;
}
-
-#endif /* defined(__GP32__) */
diff --git a/backends/gp32/gp32.h b/backends/gp32/gp32.h
deleted file mode 100644
index 5e2e542449..0000000000
--- a/backends/gp32/gp32.h
+++ /dev/null
@@ -1,316 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001 Ludvig Strigeus
- * Copyright (C) 2001/2004 The ScummVM project
- * Copyright (C) 2002 Ph0x - GP32 Backend
- * Copyright (C) 2003/2004 DJWillis - GP32 Backend
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $Header$
- *
- */
-
-#ifndef GP32_H
-#define GP32_H
-
-/////////////////////////////////////////////////////////////////////////////
-// Header for GP32 ScummVM Backend
-/////////////////////////////////////////////////////////////////////////////
-
-//Standard ScummVM includes.
-#include "common/stdafx.h"
-#include "common/scummsys.h"
-#include "common/scaler.h"
-#include "common/system.h"
-#include "backends/intern.h"
-
-#include "base/engine.h"
-//#include "scumm/saveload.h"
-
-//Graphics wrapper - SDL Derived.
-#include "backends/gp32/graphics.h"
-
-//Pre-ScummVM Config stuff
-//#include "backends/gp32/config.h"
-
-#define LCD_WIDTH 320
-#define LCD_HEIGHT 240
-#define LCD_WIDTH_CENTER LCD_WIDTH / 2
-#define LCD_HEIGHT_CENTER LCD_HEIGHT / 2
-#define LCD_SIZE (LCD_WIDTH * LCD_HEIGHT)
-
-// Graphics Bits
-#define GAME_SURFACE 0
-#define GAME_SURFACE2 1
-#define DEBUG_SURFACE 2
-
-extern int nflip, keydata; // Flip Index
-extern GP_HPALETTE PAL; //palette
-
-//void Delay(int ms);
-//void FadeToBlack(int delay_time);
-
-
-#define BUFFERCOUNT 2
-extern GPDRAWSURFACE LCDbuffer[BUFFERCOUNT + 1]; //buffers
-
-#define BACKGROUND_COLOR 0 //Black color
-#define COLOUR_8BIT_MODE 8
-#define COLOUR_16BIT_MODE 16
-
-/* Assembly routines from cpuspeed.s */
-extern "C" {void cpu_speed(int,int,int);} // CPU Speed control (3 int's, clock, bus, dividor)
-
-/* Fake main() entry point */
-//int main_scummvm(int argc, char *argv[]);
-
-//Prototypes
-class OSystem_GP32 : public OSystem
-{
-public:
- OSystem_GP32();
- virtual ~OSystem_GP32();
-
- // Set colors of the palette
- void setPalette(const byte *colors, uint start, uint num);
-
- // Set the size of the video bitmap.
- // Typically, 320x200
- void initSize(uint w, uint h, int overlayScale);
- int16 getHeight() { return _screenHeight; }
- int16 getWidth() { return _screenWidth; }
-
- // Draw a bitmap to screen.
- // The screen will not be updated to reflect the new bitmap
- void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
-
- // Update the dirty areas of the screen
- void updateScreen();
-
- // Either show or hide the mouse cursor
- bool showMouse(bool visible);
-
- void warpMouse(int x, int y);
-
- // Set the bitmap that's used when drawing the cursor.
- void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, byte keycolor = 255, int cursorTargetScale = 1);
-
- // Shaking is used in SCUMM. Set current shake position.
- void setShakePos(int shake_pos);
-
- // Get the number of milliseconds since the program was started.
- uint32 getMillis();
-
- // Delay for a specified amount of milliseconds
- void delayMillis(uint msecs);
-
- // Get the next event.
- // Returns true if an event was retrieved.
- bool pollEvent(Event &event);
-
- // Set the function to be invoked whenever samples need to be generated
- // Format is the sample type format.
- // Only 16-bit signed mode is needed for simon & scumm
- bool setSoundCallback(SoundProc proc, void *param);
-
- // Clear Sound Sample
- void clearSoundCallback();
-
- // OLD - Delete when sure not needed.
- // Get or set a property
- //uint32 property(int param, Property *value);
- //virtual uint32 property(int param, Property *value);
-
- // Poll cdrom status
- // Returns true if cd audio is playing
- bool pollCD();
-
- // Play cdrom audio track
- void playCD(int track, int num_loops, int start_frame, int duration);
-
- // Stop cdrom audio track
- void stopCD();
-
- // Update cdrom audio status
- void updateCD();
-
- // Add a new callback timer
- void setTimerCallback(TimerProc callback, int timer);
-
- // Mutex handling
- OSystem::MutexRef createMutex();
- void lockMutex(MutexRef mutex);
- void unlockMutex(MutexRef mutex);
- void deleteMutex(MutexRef mutex);
- // DJWillis
-
- //helper
- int16 get_height();
- int16 get_width();
-
- // Quit
- void quit();
-
- // Overlay
- void showOverlay();
- void hideOverlay();
- void clearOverlay();
- void grabOverlay(int16 *buf, int pitch);
- void copyRectToOverlay(const int16 *buf, int pitch, int x, int y, int w, int h);
-
- //static OSystem *create(int gfx_mode, bool full_screen);
-
- int16 RBGToColor(uint8 r, uint8 g, uint8 b);
- void colorToRBG(int16 color, uint8 &r, uint8 &g, uint8 &b);
-
- //void *gm_yocalloc(size_t num_elem, size_t size_elem);
- //void *gm_realloc(void *ptr, size_t size);
-
- // New 0.6.0 +
- const GraphicsMode *getSupportedGraphicsModes() const;
- int getDefaultGraphicsMode() const;
- bool setGraphicsMode(int mode);
- int getGraphicsMode() const;
-
- void setWindowCaption(const char *caption);
- bool openCD(int drive);
-
- // Determine the output sample rate. Audio data provided by the sound
- // Callback sound be played using this rate.
- // FIXME: GP32 Hardcodes rate currently.
- int getOutputSampleRate() const;
-
- bool hasFeature(Feature f);
- void setFeatureState(Feature f, bool enable);
- bool getFeatureState(Feature f);
-
- //static OSystem *create();
-
-private:
-
- // Set the position of the mouse cursor - Not part of OSystem anymore.
- void set_mouse_pos(int x, int y);
-
- gpSurface *_tmpscreen; // temporary screen (for scalers/overlay)
- gpSurface *_hwscreen; // hardware screen
- bool _overlayVisible;
-
- ScalerProc *_scaler_proc;
-
- int TMP_SCREEN_WIDTH;
-
- //uint msec_start;
- //uint32 get_ticks();
-
- // unseen game screen
- gpSurface *_screen;
- int _screenWidth, _screenHeight;
-
- // CD Audio, Not used in GP32 backend
- int cd_track, cd_num_loops, cd_start_frame, cd_end_frame;
- uint32 cd_end_time, cd_stop_time, cd_next_second;
-
- enum {
- DF_WANT_RECT_OPTIM = 1 << 0,
- DF_UPDATE_EXPAND_1_PIXEL = 1 << 3
- };
-
- bool _forceFull; // Force full redraw on next updateScreen
- int _scaleFactor;
- int _mode;
- bool _full_screen;
- uint32 _mode_flags;
- bool _modeChanged;
-
- /** True if aspect ratio correction is enabled. */
- bool _adjustAspectRatio;
-
- enum {
- NUM_DIRTY_RECT = 100,
- MAX_MOUSE_W = 40,
- MAX_MOUSE_H = 40,
- MAX_SCALING = 3
- };
-
- // Dirty rect managment
- gpRect _dirty_rect_list[100];
- int _num_dirty_rects;
- uint32 *_dirty_checksums;
- bool cksum_valid;
- int CKSUM_NUM;
-
- // Keyboard mouse emulation
- struct KbdMouse {
- int16 x, y, x_vel, y_vel, x_max, y_max, x_down_count, y_down_count;
- uint32 last_time, delay_time, x_down_time, y_down_time;
- } km;
-
- struct MousePos {
- int16 x, y, w, h;
- };
-
- bool _mouseVisible;
- bool _mouseDrawn;
- byte *_mouseData;
- byte *_mouseBackup;
- MousePos _mouseCurState;
- MousePos _mouseOldState;
- int16 _mouseHotspotX;
- int16 _mouseHotspotY;
- byte _mouseKeycolor;
-
- // Shake mode
- int _currentShakePos;
- int _newShakePos;
-
- // Palette data
- gpColor *_currentPalette;
- uint _paletteDirtyStart, _paletteDirtyEnd;
-
- /**
- * Mutex which prevents multiple threads from interfering with each other
- * when accessing the screen.
- */
- MutexRef _graphicsMutex;
-
- void add_dirty_rgn_auto(const byte *buf);
- void mk_checksums(const byte *buf);
-
- static void fill_sound(void *userdata, Uint8 * stream, int len);
-
- void add_dirty_rect(int x, int y, int w, int h);
-
- void draw_mouse();
- void undraw_mouse();
-
- void internUpdateScreen();
-
- void load_gfx_mode();
- void unload_gfx_mode();
- void hotswap_gfx_mode();
-
- void setFullscreenMode(bool enable);
-
- void get_screen_image(byte *buf);
-
- void setup_icon();
- void kbd_mouse();
- //static OSystem_GP32 *create();
-};
-
-#else
- #warning GP32.H Called more then once.
-#endif /* GP32_H */
-
diff --git a/backends/gp32/gp32_launcher.cpp b/backends/gp32/gp32_launcher.cpp
new file mode 100644
index 0000000000..5eaa1158a7
--- /dev/null
+++ b/backends/gp32/gp32_launcher.cpp
@@ -0,0 +1,148 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001-2005 The ScummVM project
+ * Copyright (C) 2003/2004 DJWillis - GP32 Backend
+ * Copyright (C) 2005 Won Star - GP32 Backend
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $Header$
+ *
+ */
+
+#include "stdafx.h"
+#include "common/scummsys.h"
+#include "common/scaler.h"
+#include "common/system.h"
+#include "backends/intern.h"
+
+#include "base/engine.h"
+
+#include "backends/gp32/gp32std.h"
+#include "backends/gp32/gp32std_grap.h"
+#include "backends/gp32/gp32std_input.h"
+
+#include "backends/gp32/gfx_splash.h"
+#include "backends/gp32/gp32_launcher.h"
+
+uint16 cpuSpeedTable[15] = {40, 66, 100, 120, 133, 144, 156, 160, 166, 172, 176, 180, 188, 192, 200};
+uint16 gammaTable[16] = {50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200};
+char *oplTable[3] = {"LOW", "MEDIUM", "HIGH"};
+uint16 sampleTable[3] = {11025, 22050, 44100};
+
+uint8 maxTable[5] = {15, 16, 3, 3, 2};
+uint8 currentSetting[5] = {3, 5, 1, 0, 0};
+
+int g_cpuSpeed = 120;
+int g_gammaRamp = 100;
+
+void configMenu() {
+ uint32 nKeyUD;
+ uint16 nKeyP;
+
+ int currentSelect = 0;
+ char text[32];
+
+ while (1) {
+ gp_fillRect(frameBuffer2, 0, 0, 320, 240, 0xffff);
+ gp_textOut(frameBuffer2, 90, 10, "Configuration Menu", 0);
+
+ gp_textOut(frameBuffer2, 30, 40, "CPU clock speed", 0);
+ gp_textOut(frameBuffer2, 30, 80, "Gamma ramp", 0);
+ gp_textOut(frameBuffer2, 30, 120, "FMOPL (AdLib) quality", gp_RGBTo16(128, 128, 128));
+ gp_textOut(frameBuffer2, 30, 160, "Sampling rate", gp_RGBTo16(128, 128, 128));
+
+ gp_textOut(frameBuffer2, 100, 210, "OK CANCEL", 0);
+
+ if (currentSelect == 4)
+ gp_textOut(frameBuffer2, 80, 210, "@", 0);
+ else
+ gp_textOut(frameBuffer2, 20, (currentSelect + 1) * 40, "@", 0);
+
+ sprintf(text, "%d MHz", cpuSpeedTable[currentSetting[0]]);
+ gp_textOut(frameBuffer2, 220, 40, text, 0);
+ sprintf(text, "%d %%", gammaTable[currentSetting[1]]);
+ gp_textOut(frameBuffer2, 220, 80, text, 0);
+ gp_textOut(frameBuffer2, 220, 120, oplTable[currentSetting[2]], gp_RGBTo16(128, 128, 128));
+ sprintf(text, "%d Hz", sampleTable[currentSetting[3]]);
+ gp_textOut(frameBuffer2, 220, 160, text, gp_RGBTo16(128, 128, 128));
+
+ gp_flipScreen();
+
+ gp_getButtonEvent(&nKeyUD, &nKeyP);
+
+ if (gpd_getButtonDown(nKeyUD, GPC_VK_UP)) {
+ if (currentSelect > 0)
+ currentSelect--;
+ }
+ if (gpd_getButtonDown(nKeyUD, GPC_VK_DOWN)) {
+ if (currentSelect < 4)
+ currentSelect++;
+ }
+ if (gpd_getButtonDown(nKeyUD, GPC_VK_LEFT)) {
+ if (currentSelect <= 1)
+ if (currentSetting[currentSelect] > 0)
+ currentSetting[currentSelect]--;
+ }
+ if (gpd_getButtonDown(nKeyUD, GPC_VK_RIGHT)) {
+ if (currentSelect <= 1)
+ if (currentSetting[currentSelect] < maxTable[currentSelect] - 1)
+ currentSetting[currentSelect]++;
+ }
+
+ if (gpd_getButtonUp(nKeyUD, GPC_VK_START) ||
+ gpd_getButtonUp(nKeyUD, GPC_VK_FA)) {
+ if (currentSelect == 4) {
+ if (currentSetting[currentSelect] == 0) { // OK
+ g_cpuSpeed = cpuSpeedTable[currentSetting[0]];
+ g_gammaRamp = gammaTable[currentSetting[1]];
+ return;
+ } else { // CANCEL
+ return;
+ }
+ }
+ }
+ }
+}
+
+void splashScreen() {
+ uint32 nKeyUD;
+ uint16 nKeyP;
+
+ while (1) {
+ uint16 *buffer = frameBuffer2;//&frameBuffer1[240 - _screenHeight];
+ uint8 *picBuffer = gfx_splash;
+
+ for (int c = 0; c < LCD_WIDTH * LCD_HEIGHT; c++) {
+ *buffer++ = gfx_splash_Pal[*picBuffer++];
+ }
+
+ gp_flipScreen();
+
+ while (1) {
+ gp_getButtonEvent(&nKeyUD, &nKeyP);
+
+ if (gpd_getButtonUp(nKeyUD, GPC_VK_START) ||
+ gpd_getButtonUp(nKeyUD, GPC_VK_FA)) {
+ gp_fillRect(frameBuffer1, 0, 0, 320, 240, 0xffff);
+ gp_fillRect(frameBuffer2, 0, 0, 320, 240, 0xffff);
+ return;
+ }
+ if (gpd_getButtonUp(nKeyUD, GPC_VK_SELECT)) {
+ configMenu();
+ break;
+ }
+ }
+ }
+}
diff --git a/backends/gp32/gp32_launcher.h b/backends/gp32/gp32_launcher.h
new file mode 100644
index 0000000000..6acc74f715
--- /dev/null
+++ b/backends/gp32/gp32_launcher.h
@@ -0,0 +1,34 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001-2005 The ScummVM project
+ * Copyright (C) 2005 Won Star - GP32 Backend
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $Header$
+ *
+ */
+
+#ifndef __GP32_LAUNCHER_H
+#define __GP32_LAUNCHER_H
+
+#include "stdafx.h"
+#include "common/scummsys.h"
+
+extern void splashScreen();
+
+extern int g_cpuSpeed;
+extern int g_gammaRamp;
+
+#endif
diff --git a/backends/gp32/gp32_main.cpp b/backends/gp32/gp32_main.cpp
new file mode 100644
index 0000000000..46496ccf51
--- /dev/null
+++ b/backends/gp32/gp32_main.cpp
@@ -0,0 +1,183 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001-2005 The ScummVM project
+ * Copyright (C) 2005 Won Star - GP32 Backend
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Header$
+ *
+ */
+
+#include "stdafx.h"
+#include "common/scummsys.h"
+#include "common/scaler.h"
+#include "common/system.h"
+#include "backends/intern.h"
+
+#include "base/engine.h"
+
+#include "backends/gp32/gp32std.h"
+#include "backends/gp32/gp32std_grap.h"
+
+#include "backends/gp32/gp32_launcher.h"
+
+#include "backends/gp32/gp32_osys.h"
+
+extern "C" int scummvm_main(int argc, char *argv[]);
+
+extern void gp_delay(uint32 msecs);
+
+extern "C" void cpu_speed(int MCLK, int CLKDIV, int CLKMODE); // CPU Speed control (3 int's, clock, bus, dividor)
+
+// Where's better position?
+static int CLKDIV = 0x48013;
+static int MCLK = 40000000;
+static int CLKMODE = 0;
+static int HCLK = 40000000;
+static int PCLK = 40000000;
+/*
+int gp_getPCLK() {
+ return PCLK;
+}
+
+int gp_getHCLK() {
+ return HCLK;
+}
+*/
+void gp_clockSpeedChange(int freq, int magic, int div) {
+ #define rTCFG0 (*(volatile unsigned *)0x15100000)
+ #define rTCFG1 (*(volatile unsigned *)0x15100004)
+ #define rTCNTB4 (*(volatile unsigned *)0x1510003c)
+ unsigned int pclk;
+ unsigned int prescaler0;
+
+ /* Change CPU Speed */
+ GpClockSpeedChange(freq, magic, div);
+ pclk = GpPClkGet();
+
+ /* Repair SDK timer - it forgets to set prescaler */
+ prescaler0 = (pclk / (8000 * 40)) - 1;
+ rTCFG0 = (rTCFG0 & 0xFFFFFF00) | prescaler0;
+ rTCFG1 = 0x30033;
+
+ /* Repair GpTickCountGet */
+ rTCNTB4 = pclk / 1600;
+}
+
+void gp_setCpuSpeed(int freq) {
+ switch (freq) {
+ // overclocked
+ case 168: { CLKDIV = 0x14000; MCLK = 168000000; CLKMODE = 3; break; }
+ case 172: { CLKDIV = 0x23010; MCLK = 172000000; CLKMODE = 3; break; }
+ case 176: { CLKDIV = 0x24010; MCLK = 176000000; CLKMODE = 3; break; }
+ case 180: { CLKDIV = 0x16000; MCLK = 180000000; CLKMODE = 3; break; }
+ case 184: { CLKDIV = 0x26010; MCLK = 184000000; CLKMODE = 3; break; }
+ case 188: { CLKDIV = 0x27010; MCLK = 188000000; CLKMODE = 3; break; }
+ case 192: { CLKDIV = 0x18000; MCLK = 192000000; CLKMODE = 3; break; }
+ case 196: { CLKDIV = 0x29010; MCLK = 196000000; CLKMODE = 3; break; }
+ case 200: { CLKDIV = 0x2A010; MCLK = 200000000; CLKMODE = 3; break; }
+ case 204: { CLKDIV = 0x2b010; MCLK = 204000000; CLKMODE = 3; break; }
+ case 208: { CLKDIV = 0x2c010; MCLK = 208000000; CLKMODE = 3; break; }
+ case 212: { CLKDIV = 0x2d010; MCLK = 212000000; CLKMODE = 3; break; }
+ case 216: { CLKDIV = 0x2e010; MCLK = 216000000; CLKMODE = 3; break; }
+ case 220: { CLKDIV = 0x2f010; MCLK = 220000000; CLKMODE = 3; break; }
+ case 224: { CLKDIV = 0x30010; MCLK = 224000000; CLKMODE = 3; break; }
+ case 228: { CLKDIV = 0x1e000; MCLK = 228000000; CLKMODE = 3; break; }
+ case 232: { CLKDIV = 0x32010; MCLK = 232000000; CLKMODE = 3; break; }
+ case 236: { CLKDIV = 0x33010; MCLK = 236000000; CLKMODE = 3; break; }
+ case 240: { CLKDIV = 0x20000; MCLK = 240000000; CLKMODE = 3; break; }
+ case 244: { CLKDIV = 0x35010; MCLK = 244000000; CLKMODE = 3; break; }
+ case 248: { CLKDIV = 0x36010; MCLK = 248000000; CLKMODE = 3; break; }
+ case 252: { CLKDIV = 0x22000; MCLK = 252000000; CLKMODE = 3; break; }
+ case 256: { CLKDIV = 0x38010; MCLK = 256000000; CLKMODE = 3; break; }
+
+ // normal
+// case 166: { CLKDIV = 0x4B011; MCLK = 166000000; CLKMODE = 3; break; }
+ case 166: { CLKDIV = 0x2f001; MCLK = 165000000; CLKMODE = 3; break; }
+ case 164: { CLKDIV = 0x4a011; MCLK = 164000000; CLKMODE = 3; break; }
+ case 160: { CLKDIV = 0x48011; MCLK = 160000000; CLKMODE = 3; break; }
+// case 156: { CLKDIV = 0x2c001; MCLK = 156000000; CLKMODE = 3; break; }
+ case 156: { CLKDIV = 0x2c001; MCLK = 156000000; CLKMODE = 3; break; }
+ case 144: { CLKDIV = 0x28001; MCLK = 144000000; CLKMODE = 3; break; }
+// case 133: { CLKDIV = 0x3a011; MCLK = 132000000; CLKMODE = 3; break; }
+ case 133: { CLKDIV = (81 << 12) | (2 << 4) | 1; MCLK = 133500000; CLKMODE = 2; break; }
+ case 132: { CLKDIV = 0x3a011; MCLK = 132000000; CLKMODE = 3; break; }
+ case 120: { CLKDIV = 0x24001; MCLK = 120000000; CLKMODE = 2; break; }
+// case 100: { CLKDIV = 0x2b011; MCLK = 102000000; CLKMODE=2; break; }
+ case 100: { CLKDIV =( 43 << 12) | (1 << 4) | 1; MCLK = 102000000; CLKMODE = 2; break; }
+// case 66: { CLKDIV = 0x25002; MCLK= 67500000; CLKMODE=2; break; }
+ case 66: { CLKDIV = (37 << 12) | (0 << 4) | 2; MCLK= 67500000; CLKMODE = 2; break; }
+ case 50: { CLKDIV = 0x2a012; MCLK= 50000000; CLKMODE = 0; break; }
+// case 40: { CLKDIV = 0x48013; MCLK= 40000000; CLKMODE = 0; break; }
+ case 40: { CLKDIV = 0x48013; MCLK= 40000000; CLKMODE = 1; break; }
+// case 33: { CLKDIV = 0x25003; MCLK= 33750000; CLKMODE = 0; break; }
+ case 33: { CLKDIV = (37 << 12) | (0 << 4) | 3; MCLK = 33750000; CLKMODE = 2; break; }
+ case 22: { CLKDIV = 0x33023; MCLK = 22125000; CLKMODE = 0; break; }
+ }
+ if (CLKMODE==0) { HCLK = MCLK; PCLK = MCLK; }
+ if (CLKMODE==1) { HCLK = MCLK; PCLK = MCLK / 2; }
+ if (CLKMODE==2) { HCLK = MCLK / 2; PCLK = MCLK / 2; }
+ if (CLKMODE==3) { HCLK = MCLK / 2; PCLK = MCLK / 4; }
+ //cpu_speed(MCLK, CLKDIV, CLKMODE);
+ gp_clockSpeedChange(MCLK, CLKDIV, CLKMODE);
+}
+
+void gp_Reset() {
+ gp_setCpuSpeed(66);
+ asm volatile("swi #4\n");
+}
+
+void init() {
+ gp_setCpuSpeed(66); // Default CPU Speed
+
+ GpGraphicModeSet(16, NULL);
+
+ //if (type == NLU || type == FLU || type == BLU)
+ // gp_initFramebuffer(frameBuffer, 16, 85);
+ //else if (type == BLUPLUS)
+ // gp_initFramebufferBP(frameBuffer, 16, 85);
+ // else
+ // error("Invalid Console");
+ gp_initFrameBuffer();
+
+
+ GpFatInit();
+ GpRelativePathSet("gp:\\gpmm");
+ //ERR_CODE err_code;
+ //err_code = GpDirCreate("temp", 0);
+ // if (err_code != SM_OK) return;
+ g_cpuSpeed = 120;
+}
+
+void GpMain(void *arg) {
+ init();
+
+ splashScreen();
+
+ //doConfig
+ gp_setCpuSpeed(g_cpuSpeed);
+ GPDEBUG("Set CPU Speed: %d", g_cpuSpeed);
+
+ // FOR DEBUG PURPOSE!
+ int argc = 2;
+ //char *argv[] = { "scummvm", "playfate" };
+ //char *argv[] = { "scummvm", "-enull", "-pgp:\\game\\loomcd\\", "loomcd" };
+ //char *argv[] = { "scummvm", "-enull", "-pgp:\\game\\dott\\", "tentacle" };
+ char *argv[] = { "scummvm", "-enull", "-d3" };
+
+ //scummvm_main(argc, argv);
+
+ scummvm_main(1, NULL);
+}
diff --git a/backends/gp32/gp32_osys.cpp b/backends/gp32/gp32_osys.cpp
new file mode 100644
index 0000000000..61125e22e5
--- /dev/null
+++ b/backends/gp32/gp32_osys.cpp
@@ -0,0 +1,744 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001-2005 The ScummVM project
+ * Copyright (C) 2002 Ph0x - GP32 Backend
+ * Copyright (C) 2003/2004 DJWillis - GP32 Backend
+ * Copyright (C) 2005 Won Star - GP32 Backend
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Header$
+ *
+ */
+
+#include "backends/gp32/gp32_osys.h"
+
+#include "stdafx.h"
+#include "common/scummsys.h"
+#include "common/system.h"
+
+#include "common/rect.h"
+#include "common/savefile.h"
+#include "common/config-manager.h"
+
+static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
+ {0, 0, 0}
+};
+
+OSystem_GP32::OSystem_GP32() :
+ _screenWidth(0), _screenHeight(0), _gameScreen(NULL), _hwScreen(NULL),
+ _overlayVisible(false), _forceFull(false), _adjustAspectRatio(false),
+ /*_paletteDirtyStart(0), _paletteDirtyEnd(0),*/ _mouseBuf(NULL) {
+ NP("OSys::OSystem_GP32()");
+ // allocate palette storage
+ memset(_currentPalette, 0, 256 * sizeof(uint16));
+
+ memset(&_km, 0, sizeof(_km));
+
+ // HACK: bring mouse cursor to center
+ _mouseX = 160;
+ _mouseY = 120;
+}
+
+OSystem_GP32::~OSystem_GP32() {
+ NP("OSys::~OSystem_GP32()");
+}
+
+bool OSystem_GP32::hasFeature(Feature f) {
+ NP("OSys::hasFeature()");
+ return false;
+}
+
+void OSystem_GP32::setFeatureState(Feature f, bool enable) {
+ NP("OSys::setFeatureState()");
+}
+
+bool OSystem_GP32::getFeatureState(Feature f) {
+ NP("OSys::getFeatureState()");
+ return false;
+}
+
+const OSystem::GraphicsMode* OSystem_GP32::getSupportedGraphicsModes() const {
+ NP("OSys::getSupportedGraphicsModes()");
+ return s_supportedGraphicsModes;
+}
+
+
+int OSystem_GP32::getDefaultGraphicsMode() const {
+ NP("OSys::getSupportedGraphicsModes()");
+ return -1;
+}
+
+bool OSystem_GP32::setGraphicsMode(int mode) {
+ NP("OSys::setGraphicsMode()");
+ return true;
+}
+
+bool OSystem_GP32::setGraphicsMode(const char *name) {
+ NP("OSys::setGraphicsMode()");
+ return true;
+}
+
+int OSystem_GP32::getGraphicsMode() const {
+ NP("OSys::getGraphicsMode()");
+ return -1;
+}
+
+void OSystem_GP32::initSize(uint width, uint height, int overlayScale) {
+ NP("OSys::initSize()");
+
+ if (width == _screenWidth && height == _screenHeight)
+ return;
+
+ _screenWidth = width;
+ _screenHeight = height;
+
+ if (height != 200)
+ _adjustAspectRatio = false;
+
+ _overlayWidth = width;
+ _overlayHeight = height;
+
+ // Create the surface that contains the 8 bit game data
+ _gameScreen = new uint8[_screenWidth * _screenHeight];
+
+ // Create the surface that contains the scaled graphics in 16 bit mode
+ _tmpScreen = frameBuffer2;
+
+ // Create the surface that is connected with hardware screen
+ _hwScreen = frameBuffer1;
+
+ _overlayBuffer = new OverlayColor[_overlayWidth * _overlayHeight];
+
+ _km.x_max = _screenWidth - 1;
+ _km.y_max = _screenHeight - 1;
+ _km.x = _mouseX;
+ _km.y = _mouseY;
+ _km.delay_time = 25;
+ _km.last_time = 0;
+
+ // Clear Screen
+ gp_fillRect(_hwScreen, 0, 0, 320, 240, 0xFFFF);
+}
+
+int16 OSystem_GP32::getHeight() {
+ NP("OSys::getHeight()");
+ return _screenHeight;
+}
+
+int16 OSystem_GP32::getWidth() {
+ NP("OSys::getWidth()");
+ return _screenWidth;
+}
+
+void OSystem_GP32::setPalette(const byte *colors, uint start, uint num) {
+ NP("OSys::setPalette()");
+ const byte *b = colors;
+ uint i;
+ uint16 *base = _currentPalette + start;
+ for (i = 0; i < num; i++) {
+ base[i] = gp_RGBTo16(b[0], b[1], b[2]);
+ b += 4;
+ }
+
+// if (start < _paletteDirtyStart)
+// _paletteDirtyStart = start;
+
+// if (start + num > _paletteDirtyEnd)
+// _paletteDirtyEnd = start + num;
+}
+
+void OSystem_GP32::grabPalette(byte *colors, uint start, uint num) {
+ NP("OSys::grabPalette()");
+}
+
+void OSystem_GP32::copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h) {
+ NP("OSys::copyRectToScreen()");
+ //Clip the coordinates
+ if (x < 0) {
+ w += x;
+ src -= x;
+ x = 0;
+ }
+
+ if (y < 0) {
+ h += y;
+ src -= y * pitch;
+ y = 0;
+ }
+
+ if (w > _screenWidth - x) {
+ w = _screenWidth - x;
+ }
+
+ if (h > _screenHeight - y) {
+ h = _screenHeight - y;
+ }
+
+ if (w <= 0 || h <= 0)
+ return;
+
+ byte *dst = _gameScreen + y * _screenWidth + x;
+
+ if (_screenWidth == pitch && pitch == w) {
+ memcpy(dst, src, h * w);
+ } else {
+ do {
+ memcpy(dst, src, w);
+ src += pitch;
+ dst += _screenWidth;
+ } while (--h);
+ }
+}
+
+//TODO: Implement Dirty rect?
+void OSystem_GP32::updateScreen() {
+ uint16 *buffer;
+ //TODO: adjust shakePos
+
+ // draw gamescreen
+ buffer = &_tmpScreen[240 - _screenHeight];
+ for (int x = 0; x < _screenWidth; x++) {
+ for (int y = 0; y < _screenHeight; y++) {
+ *buffer++ = _currentPalette[_gameScreen[((_screenHeight - 1) - y) * _screenWidth + x]];
+ }
+ buffer += 240 - _screenHeight;
+ }
+
+ // draw overlay
+ if (_overlayVisible) {
+ buffer = &_tmpScreen[240 - _overlayHeight];
+ for (int x = 0; x < _overlayWidth; x++) {
+ for (int y = 0; y < _overlayHeight; y++) {
+ *buffer++ = _overlayBuffer[((_overlayHeight - 1) - y) * _overlayWidth + x];
+ }
+ buffer += 240 - _overlayHeight;
+ }
+ }
+
+ // draw mouse
+ //adjust cursor position
+ int mX = _mouseX - _mouseHotspotX;
+ int mY = _mouseY - _mouseHotspotY;
+ //if (_overlayVisible)
+ //else
+ if (_mouseVisible)
+ for (int y = 0; y < _mouseHeight; y++) {
+ for (int x = 0; x < _mouseWidth; x++) {
+ if (mX + x < _screenWidth && mY + y < _screenHeight && mX + x >= 0 && mY + y >= 0)
+ if (_mouseBuf[y * _mouseWidth + x] != _mouseKeyColor)
+ gpd_drawPixel16(_tmpScreen, mX + x, mY + y, _currentPalette[_mouseBuf[y * _mouseWidth + x]]);
+ }
+ }
+
+ //TODO: draw softkeyboard
+
+ gp_flipScreen();
+ _hwScreen = frameBuffer1;
+ _tmpScreen = frameBuffer2;
+ //memcpy(_hwScreen, _tmpScreen, LCD_WIDTH * LCD_HEIGHT * sizeof(uint16));
+}
+
+void OSystem_GP32::setShakePos(int shakeOffset) {
+ NP("OSys::setShakePos()");
+}
+
+void OSystem_GP32::showOverlay() {
+ _overlayVisible = true;
+ clearOverlay();
+}
+
+void OSystem_GP32::hideOverlay() {
+ _overlayVisible = false;
+ clearOverlay();
+ _forceFull = true;
+}
+
+// Clear overlay with game screen
+//TODO: Optimize?
+void OSystem_GP32::clearOverlay() {
+ NP("OSys::clearOverlay()");
+ if (!_overlayVisible)
+ return;
+
+ uint8 *s = _gameScreen;
+ OverlayColor *d = _overlayBuffer;
+ uint8 c;
+ for (int y = 0; y < _overlayHeight; y++) {
+ for (int x = 0; x < _overlayWidth; x++) {
+ c = *s;
+ *d++ = _currentPalette[c];
+ s++;
+ }
+ }
+
+ _forceFull = true;
+}
+
+void OSystem_GP32::grabOverlay(OverlayColor *buf, int pitch)
+{
+ NP("OSys::grabOverlay()");
+}
+
+void OSystem_GP32::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
+ OverlayColor *dst = (OverlayColor *)_overlayBuffer + y * _overlayWidth + x;
+ do {
+ memcpy(dst, buf, w * sizeof(uint16));
+ dst += _overlayWidth;
+ buf += pitch;
+ } while (--h);
+}
+
+int16 OSystem_GP32::getOverlayHeight() {
+ NP("OSys::getOverlayHeight()");
+ return getHeight();
+}
+
+int16 OSystem_GP32::getOverlayWidth() {
+ NP("OSys::getOverlayWidth()");
+ return getWidth();
+}
+
+OverlayColor OSystem_GP32::RGBToColor(uint8 r, uint8 g, uint8 b) {
+ return gp_RGBTo16(r, g, b);
+}
+
+void OSystem_GP32::colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) {
+ gp_16ToRGB(color, &r, &g, &b);
+}
+
+bool OSystem_GP32::showMouse(bool visible) {
+ NP("OSys::showMouse()");
+ if (_mouseVisible == visible)
+ return visible;
+
+ bool last = _mouseVisible;
+ _mouseVisible = visible;
+
+ updateScreen();
+
+ return last;
+}
+
+void OSystem_GP32::warpMouse(int x, int y) {
+ NP("OSys::warpMouse()");
+ //assert(x > 0 && x < _screenWidth);
+ //assert(y > 0 && y < _screenHeight);
+ _mouseX = x;
+ _mouseY = y;
+}
+
+void OSystem_GP32::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor, int cursorTargetScale) {
+ //NP("OSys::setMouseCursor()");
+ _mouseWidth = w;
+ _mouseHeight = h;
+
+ _mouseHotspotX = hotspotX;
+ _mouseHotspotY = hotspotY;
+
+ _mouseKeyColor = keycolor;
+
+ if (_mouseBuf)
+ free(_mouseBuf);
+
+ _mouseBuf = (byte *)malloc(w * h);
+ memcpy(_mouseBuf, buf, w * h);
+}
+
+void OSystem_GP32::handleKbdMouse() {
+ uint32 curTime = getMillis();
+ if (curTime >= _km.last_time + _km.delay_time) {
+ _km.last_time = curTime;
+ if (_km.x_down_count == 1) {
+ _km.x_down_time = curTime;
+ _km.x_down_count = 2;
+ }
+ if (_km.y_down_count == 1) {
+ _km.y_down_time = curTime;
+ _km.y_down_count = 2;
+ }
+
+ if (_km.x_vel || _km.y_vel) {
+ if (_km.x_down_count) {
+ if (curTime > _km.x_down_time + _km.delay_time * 12) {
+ if (_km.x_vel > 0)
+ _km.x_vel++;
+ else
+ _km.x_vel--;
+ } else if (curTime > _km.x_down_time + _km.delay_time * 8) {
+ if (_km.x_vel > 0)
+ _km.x_vel = 5;
+ else
+ _km.x_vel = -5;
+ }
+ }
+ if (_km.y_down_count) {
+ if (curTime > _km.y_down_time + _km.delay_time * 12) {
+ if (_km.y_vel > 0)
+ _km.y_vel++;
+ else
+ _km.y_vel--;
+ } else if (curTime > _km.y_down_time + _km.delay_time * 8) {
+ if (_km.y_vel > 0)
+ _km.y_vel = 5;
+ else
+ _km.y_vel = -5;
+ }
+ }
+
+ //GPDEBUG("%d %d - %d %d", _km.x, _km.y, _km.x_vel, _km.y_vel);
+ _km.x += _km.x_vel;
+ _km.y += _km.y_vel;
+
+ if (_km.x < 0) {
+ _km.x = 0;
+ _km.x_vel = -1;
+ _km.x_down_count = 1;
+ } else if (_km.x > _km.x_max) {
+ _km.x = _km.x_max;
+ _km.x_vel = 1;
+ _km.x_down_count = 1;
+ }
+
+ if (_km.y < 0) {
+ _km.y = 0;
+ _km.y_vel = -1;
+ _km.y_down_count = 1;
+ } else if (_km.y > _km.y_max) {
+ _km.y = _km.y_max;
+ _km.y_vel = 1;
+ _km.y_down_count = 1;
+ }
+
+ warpMouse(_km.x, _km.y);
+ }
+ }
+}
+
+void OSystem_GP32::fillMouseEvent(Event &event, int x, int y) {
+ event.mouse.x = x;
+ event.mouse.y = y;
+
+ // Update the "keyboard mouse" coords
+ _km.x = x;
+ _km.y = y;
+
+ // Optionally perform aspect ratio adjusting
+ //if (_adjustAspectRatio)
+ // event.mouse.y = aspect2Real(event.mouse.y);
+}
+
+bool OSystem_GP32::pollEvent(Event &event) {
+ GP32BtnEvent ev;
+
+ handleKbdMouse();
+
+ if (!gp_pollButtonEvent(&ev))
+ return false;
+
+ switch(ev.type) {
+ case BUTTON_DOWN:
+ if (ev.button == GPC_VK_LEFT) {
+ _km.x_vel = -1;
+ _km.x_down_count = 1;
+ }
+ if (ev.button == GPC_VK_RIGHT) {
+ _km.x_vel = 1;
+ _km.x_down_count = 1;
+ }
+ if (ev.button == GPC_VK_UP) {
+ _km.y_vel = -1;
+ _km.y_down_count = 1;
+ }
+ if (ev.button == GPC_VK_DOWN) {
+ _km.y_vel = 1;
+ _km.y_down_count = 1;
+ }
+ if (ev.button == GPC_VK_START) { // START = menu/enter
+ event.type = EVENT_KEYDOWN;
+ if (_overlayVisible)
+ event.kbd.keycode = event.kbd.ascii = 13;
+ else
+ event.kbd.keycode = event.kbd.ascii = 319;
+ return true;
+ }
+ if (ev.button == GPC_VK_SELECT) { // SELECT = pause
+ event.type = EVENT_KEYDOWN;
+ event.kbd.keycode = event.kbd.ascii = 32;
+ return true;
+ }
+ if (ev.button == GPC_VK_FR) { // R = ESC
+ event.type = EVENT_KEYDOWN;
+ event.kbd.keycode = event.kbd.ascii = 27;
+ return true;
+ }
+ if (ev.button == GPC_VK_FA) {
+ event.type = EVENT_LBUTTONDOWN;
+ fillMouseEvent(event, _km.x, _km.y);
+ return true;
+ }
+ if (ev.button == GPC_VK_FB) {
+ event.type = EVENT_RBUTTONDOWN;
+ fillMouseEvent(event, _km.x, _km.y);
+ return true;
+ }
+ break;
+ case BUTTON_UP:
+ if (ev.button == GPC_VK_LEFT) {
+ if (_km.x_vel < 0) {
+ _km.x_vel = 0;
+ _km.x_down_count = 0;
+ }
+ event.type = EVENT_MOUSEMOVE;
+ fillMouseEvent(event, _km.x, _km.y);
+ return true;
+ }
+ if (ev.button == GPC_VK_RIGHT) {
+ if (_km.x_vel > 0) {
+ _km.x_vel = 0;
+ _km.x_down_count = 0;
+ }
+ event.type = EVENT_MOUSEMOVE;
+ fillMouseEvent(event, _km.x, _km.y);
+ return true;
+ }
+ if (ev.button == GPC_VK_UP) {
+ if (_km.y_vel < 0) {
+ _km.y_vel = 0;
+ _km.y_down_count = 0;
+ }
+ event.type = EVENT_MOUSEMOVE;
+ fillMouseEvent(event, _km.x, _km.y);
+ return true;
+ }
+ if (ev.button == GPC_VK_DOWN) {
+ if (_km.y_vel > 0) {
+ _km.y_vel = 0;
+ _km.y_down_count = 0;
+ }
+ event.type = EVENT_MOUSEMOVE;
+ fillMouseEvent(event, _km.x, _km.y);
+ return true;
+ }
+
+ if (ev.button == GPC_VK_START) {
+ event.type = EVENT_KEYUP;
+ if (_overlayVisible)
+ event.kbd.keycode = event.kbd.ascii = 13;
+ else
+ event.kbd.keycode = event.kbd.ascii = 319;
+ return true;
+ }
+ if (ev.button == GPC_VK_SELECT) {
+ event.type = EVENT_KEYUP;
+ event.kbd.keycode = event.kbd.ascii = 32;
+ return true;
+ }
+ if (ev.button == GPC_VK_FR) {
+ event.type = EVENT_KEYUP;
+ event.kbd.keycode = event.kbd.ascii = 27;
+ return true;
+ }
+ if (ev.button == GPC_VK_FA) {
+ event.type = EVENT_LBUTTONUP;
+ fillMouseEvent(event, _km.x, _km.y);
+ return true;
+ }
+ if (ev.button == GPC_VK_FB) {
+ event.type = EVENT_RBUTTONUP;
+ fillMouseEvent(event, _km.x, _km.y);
+ return true;
+ }
+ break;
+ default:
+ error("Unknown Event!");
+ }
+
+ if (gp_getButtonPressed(GPC_VK_LEFT) ||
+ gp_getButtonPressed(GPC_VK_RIGHT) ||
+ gp_getButtonPressed(GPC_VK_UP) ||
+ gp_getButtonPressed(GPC_VK_DOWN)) {
+ event.type = EVENT_MOUSEMOVE;
+ fillMouseEvent(event, _km.x, _km.y);
+ return true;
+ }
+ return false;
+}
+
+uint32 OSystem_GP32::getMillis() {
+ return GpTickCountGet();
+}
+
+void OSystem_GP32::delayMillis(uint msecs) {
+ int startTime = GpTickCountGet();
+ while (GpTickCountGet() < startTime + msecs);
+}
+
+// Add a new callback timer
+//FIXME: Add to member
+int _timerInterval;
+int (*_timerCallback)(int);
+
+static void _timerCallbackVoid() {
+ //NP("timer running");
+ _timerCallback(_timerInterval); //FIXME ?? (*_timercallback)(_timerinterval);
+}
+
+void OSystem_GP32::setTimerCallback(TimerProc callback, int interval) {
+ NP("OSys::setTimerCallback()");
+
+ int timerNo = 1;
+
+ if (callback == NULL) {
+ GpTimerKill(timerNo);
+ return;
+ }
+
+ if (GpTimerOptSet(timerNo, interval, 0, _timerCallbackVoid) == GPOS_ERR_ALREADY_USED) {
+ error("Timer slot is already used");
+ }
+
+ _timerInterval = interval;
+ _timerCallback = callback;
+
+ GpTimerSet(timerNo);
+}
+
+OSystem::MutexRef OSystem_GP32::createMutex() {
+ NP("OSys::createMutex()");
+ return NULL;
+}
+
+void OSystem_GP32::lockMutex(MutexRef mutex) {
+ NP("OSys::lockMutex()");
+}
+
+void OSystem_GP32::unlockMutex(MutexRef mutex) {
+ NP("OSys::unlockMutex()");
+}
+
+void OSystem_GP32::deleteMutex(MutexRef mutex) {
+ NP("OSys::deleteMutex()");
+}
+
+bool OSystem_GP32::setSoundCallback(SoundProc proc, void *param) {
+ NP("OSys::setSoundCallback()");
+
+ GPSOUNDBUF gpSoundBuf;
+ PCM_SR sampleFreq;
+
+ if (ConfMan.hasKey("output_rate"))
+ _samplesPerSec = ConfMan.getInt("output_rate");
+
+ if (_samplesPerSec <= 0)
+ _samplesPerSec = SAMPLES_PER_SEC;
+
+ // Originally, we always used 2048 samples. This loop will produce the
+ // same result at 22050 Hz, and should hopefully produce something
+ // sensible for other frequencies. Note that it must be a power of two.
+
+ uint32 samples = 0x8000;
+
+ for (;;) {
+ if ((1000 * samples) / _samplesPerSec < 100)
+ break;
+ samples >>= 1;
+ }
+
+ switch(_samplesPerSec) {
+ case 44100:
+ sampleFreq = PCM_S44;
+ break;
+ case 22050:
+ sampleFreq = PCM_S22;
+ break;
+ case 11025:
+ sampleFreq = PCM_S11;
+ break;
+ default:
+ _samplesPerSec = 22050;
+ sampleFreq = PCM_S22;
+ }
+
+ gpSoundBuf.freq = sampleFreq;
+ gpSoundBuf.format = PCM_16BIT;
+ gpSoundBuf.samples = samples;
+ gpSoundBuf.userdata = param;
+ gpSoundBuf.callback = proc;
+// gpSoundBuf.pollfreq = 2 * (SAMPLES_PER_SEC / gpSoundBuf.samples);
+ gpSoundBuf.pollfreq = 2 * 4 * (SAMPLES_PER_SEC / gpSoundBuf.samples); // FIXME?
+ // Frequency of the timer interrupt which polls the playing position
+ // recommended value: 2*(playingfreq in Hz/GPSOUNDBUF.samples)
+ //s.samplesize; // Size of one sample (8bit mono->1, 16bit stereo->4) - don't touch this
+
+ GpPcmInit(gpSoundBuf.freq, gpSoundBuf.format);
+ gp_soundBufStart(&gpSoundBuf);
+
+ // For Safety...
+ GPDEBUG("_samplesPerSec = %d, samples = %d", _samplesPerSec, samples);
+ gp_delay(1000);
+ return true;
+}
+
+void OSystem_GP32::clearSoundCallback() {
+ NP("OSys::clearSoundCallback()");
+ gp_soundBufStop();
+}
+
+int OSystem_GP32::getOutputSampleRate() const {
+ NP("OSys::getOutputSampleRate()");
+ return _samplesPerSec;
+}
+
+bool OSystem_GP32::openCD(int drive) {
+ NP("OSys::openCD()");
+ return true;
+}
+
+bool OSystem_GP32::pollCD() {
+ NP("OSys::pollCD()");
+ return true;
+}
+
+void OSystem_GP32::playCD(int track, int num_loops, int start_frame, int duration) {
+ NP("OSys::playCD()");
+}
+
+void OSystem_GP32::stopCD() {
+ NP("OSys::stopCD()");
+}
+
+void OSystem_GP32::updateCD() {
+ NP("OSys::updateCD()");
+}
+
+void OSystem_GP32::quit() {
+ NP("OSys::quit()");
+ clearSoundCallback();
+ setTimerCallback(0, 0);
+ exit(0);
+}
+
+void OSystem_GP32::setWindowCaption(const char *caption) {
+ NP("OSys::setWindowCaption(%s)", caption);
+}
+
+void OSystem_GP32::displayMessageOnOSD(const char *msg) {
+ NP("OSys::displayMessageOnOSD(%s)", msg);
+}
+
+OSystem *OSystem_GP32_create() {
+ NP("OSys::OSystem_GP32_create()");
+ return new OSystem_GP32();
+}
diff --git a/backends/gp32/gp32_osys.h b/backends/gp32/gp32_osys.h
new file mode 100644
index 0000000000..e00bdde556
--- /dev/null
+++ b/backends/gp32/gp32_osys.h
@@ -0,0 +1,158 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001-2005 The ScummVM project
+ * Copyright (C) 2002 Ph0x - GP32 Backend
+ * Copyright (C) 2003/2004 DJWillis - GP32 Backend
+ * Copyright (C) 2005 Won Star - GP32 Backend
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $Header$
+ *
+ */
+
+#ifndef GP32_OSYS_H
+#define GP32_OSYS_H
+
+//Standard ScummVM includes.
+#include "common/stdafx.h"
+#include "common/scummsys.h"
+#include "common/scaler.h"
+#include "common/system.h"
+#include "backends/intern.h"
+
+#include "base/engine.h"
+
+#include "backends/gp32/gp32std.h"
+#include "backends/gp32/gp32std_grap.h"
+#include "backends/gp32/gp32std_input.h"
+#include "backends/gp32/gp32std_sound.h"
+
+class OSystem_GP32 : public OSystem {
+public:
+ static OSystem *instance();
+
+protected:
+ uint16 _screenWidth, _screenHeight;
+ uint8 *_gameScreen;
+ uint16 *_tmpScreen, *_hwScreen;
+ OverlayColor *_overlayBuffer;
+
+ int _overlayWidth, _overlayHeight;
+ bool _overlayVisible;
+ uint32 _shakePos;
+
+ // Keyboard mouse emulation
+ struct KbdMouse {
+ int16 x, y, x_vel, y_vel, x_max, y_max, x_down_count, y_down_count;
+ uint32 last_time, delay_time, x_down_time, y_down_time;
+ };
+
+ struct MousePos {
+ int16 x, y, w, h;
+ };
+
+ // mouse
+ KbdMouse _km;
+ bool _mouseVisible;
+ int _mouseX, _mouseY;
+ int _mouseWidth, _mouseHeight;
+ int _mouseHotspotX, _mouseHotspotY;
+ byte _mouseKeyColor;
+ byte *_mouseBuf;
+
+ bool _adjustAspectRatio;
+
+ /** Force full redraw on next updateScreen */
+ bool _forceFull;
+
+ uint16 _currentPalette[256];
+// uint _paletteDirtyStart, _paletteDirtyEnd;
+
+ int32 _samplesPerSec;
+
+public:
+
+ OSystem_GP32();
+ virtual ~OSystem_GP32();
+
+ virtual bool hasFeature(Feature f);
+ virtual void setFeatureState(Feature f, bool enable);
+ virtual bool getFeatureState(Feature f);
+ virtual const GraphicsMode *getSupportedGraphicsModes() const;
+ virtual int getDefaultGraphicsMode() const;
+ virtual bool setGraphicsMode(int mode);
+ bool setGraphicsMode(const char *name);
+ virtual int getGraphicsMode() const;
+ virtual void initSize(uint width, uint height, int overlayScale);
+ virtual int16 getHeight();
+ virtual int16 getWidth();
+ virtual void setPalette(const byte *colors, uint start, uint num);
+ virtual void grabPalette(byte *colors, uint start, uint num);
+
+ virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
+ virtual void updateScreen();
+ virtual void setShakePos(int shakeOffset);
+
+ virtual void showOverlay();
+ virtual void hideOverlay();
+ virtual void clearOverlay();
+ virtual void grabOverlay(OverlayColor *buf, int pitch);
+ virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
+ virtual int16 getOverlayHeight();
+ virtual int16 getOverlayWidth();
+
+ virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b);
+ virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b);
+
+ virtual bool showMouse(bool visible);
+
+ virtual void warpMouse(int x, int y);
+ virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255, int cursorTargetScale = 1);
+
+ virtual bool pollEvent(Event &event);
+ virtual uint32 getMillis();
+ virtual void delayMillis(uint msecs);
+
+ virtual void setTimerCallback(TimerProc callback, int interval);
+
+ virtual MutexRef createMutex(void);
+ virtual void lockMutex(MutexRef mutex);
+ virtual void unlockMutex(MutexRef mutex);
+ virtual void deleteMutex(MutexRef mutex);
+
+ virtual bool setSoundCallback(SoundProc proc, void *param);
+ virtual void clearSoundCallback();
+ virtual int getOutputSampleRate() const;
+
+ virtual bool openCD(int drive);
+ virtual bool pollCD();
+
+ virtual void playCD(int track, int num_loops, int start_frame, int duration);
+ virtual void stopCD();
+ virtual void updateCD();
+
+ virtual void quit();
+
+ virtual void setWindowCaption(const char *caption);
+
+ virtual void displayMessageOnOSD(const char *msg);
+
+ void fillMouseEvent(Event &event, int x, int y);
+ void handleKbdMouse();
+};
+
+#else
+ #warning GP32_OSYS.H Called more then once.
+#endif /* GP32_H */
diff --git a/backends/gp32/gp32std.cpp b/backends/gp32/gp32std.cpp
new file mode 100644
index 0000000000..1a62cb13dc
--- /dev/null
+++ b/backends/gp32/gp32std.cpp
@@ -0,0 +1,564 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001-2005 The ScummVM project
+ * Copyright (C) 2002 Ph0x - GP32 Backend
+ * Copyright (C) 2003/2004 DJWillis - GP32 Backend
+ * Copyright (C) 2005 Won Star - GP32 Backend
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $Header$
+ *
+ */
+
+#include "stdafx.h"
+#include "common/scummsys.h"
+#include "common/scaler.h"
+#include "common/system.h"
+#include "backends/intern.h"
+
+#include "base/engine.h"
+
+#include "backends/gp32/gp32std.h"
+#include "backends/gp32/gp32std_grap.h"
+
+FILE *gp_stderr = NULL;
+FILE *gp_stdout = NULL;
+FILE *gp_stdin = NULL;
+
+#define DEBUG_MAX 4
+char debline[DEBUG_MAX][256];
+static int debnext = 0;
+
+void _dprintf(const char *s, ...) {
+ int deba, deb;
+ char buf[1024];
+ va_list va;
+
+ va_start(va, s);
+ vsprintf(buf, s, va);
+ va_end(va);
+
+ strcpy(debline[debnext], buf);
+
+ gp_fillRect(frameBuffer1, 0, 200, 320, 40, 0);
+
+ for (deb = debnext + 1, deba = 0; deb < DEBUG_MAX; deb++, deba++) {
+ gp_textOut(frameBuffer1, 0, 200 + 8 * deba, debline[deb], 0xFFFF);
+ }
+ for (deb = 0; deb <= debnext; deb++, deba++) {
+ gp_textOut(frameBuffer1, 0, 200 + 8 * deba, debline[deb], 0xFFFF);
+ }
+ debnext++;
+ if (debnext == DEBUG_MAX)
+ debnext = 0;
+}
+
+//////////////////
+//File functions
+// FOR LATER USE
+/*
+#define SM_PATH_SIZE 256
+
+const char smRootPath[] = "gp:\\";
+char smCurrentPath[SM_PATH_SIZE] = "gp:\\"; // must end with '\'
+
+int smMakePath(const char *path, char *smPath) {
+ // copy root or current directory
+ {
+ const char *p;
+ if ((*path == '/') || (*path == '\\'))
+ {
+ path++;
+ p = smRootPath;
+ }
+ else
+ p = smCurrentPath;
+ while (*p) *smPath++ = *p++;
+ }
+
+ // add filenames/directories. remove "." & ".."
+ do
+ {
+ switch (*path)
+ {
+ case 0:
+ case '/':
+ case '\\':
+ if (*(smPath-1) == '\\')
+ {
+ // already ends with '\'
+ }
+ else if ((*(smPath-1) == '.') && (*(smPath-2) == '\\'))
+ {
+ smPath--; // remove '.' and end with '\'
+ }
+ else if ((*(smPath-1) == '.') && (*(smPath-2) == '.') && (*(smPath-3) == '\\'))
+ {
+ smPath -= 3; // remove "\.."
+ if (*(smPath-1) == ':') *smPath++ = '\\'; // "dev0:" -> "dev0:\"
+ else while (*(smPath-1) != '\\') smPath--; // remove one directory and end with '\'
+ }
+ else
+ {
+ *smPath++ = '\\'; // just add '\'
+ }
+ break;
+
+ default:
+ *smPath++ = *path;
+ break;
+ }
+ }
+ while (*path++);
+
+ *smPath = '\\';
+
+// *--smPath = 0; // remove last '\' and null-terminate
+ *smPath = 0; // remove last '\' and null-terminate
+
+ return 0;
+}
+*/
+GPFILE *gp_fopen(const char *fileName, const char *openMode) {
+ //FIXME: allocation, mode, malloc -> new
+ uint32 mode;
+ GPFILE *file;
+ ERR_CODE err;
+ char s[256];
+
+ if (!strchr(fileName, '.')) {
+ sprintf(s, "%s.", fileName);
+ fileName = s;
+ }
+
+ file = (GPFILE *)malloc(sizeof(GPFILE));
+
+// NP("%s(\"%s\", \"%s\")", __FUNCTION__, fileName, openMode);
+
+ // FIXME add binary/text support
+ if (tolower(openMode[0]) == 'r') {
+ mode = OPEN_R;
+ GpFileGetSize(fileName, &file->size);
+ err = GpFileOpen(fileName, mode, &file->handle);
+ } else if (tolower(openMode[0]) == 'w') {
+ //printf("open if as W");
+ file->size = 0; // FIXME? new file has no size?
+ file->cachePos = 0;
+ mode = OPEN_W;
+ err = GpFileCreate(fileName, ALWAYS_CREATE, &file->handle);
+ } else {
+ error("wrong file mode");
+ }
+
+ if (!file) {
+ error("%s: cannot create FILE structure", __FUNCTION__);
+ }
+ if (err) {
+// BP("%s: IO error %d", __FUNCTION__, err);
+ free(file);
+ return NULL;
+ }
+
+ return file;
+}
+
+int gp_fclose(GPFILE *stream) {
+ if (!stream) {
+ //warning("closing null file");
+ return 1;
+ }
+
+/* if (*(uint32 *)((char *)stream - sizeof(uint32)) == 0x4321) {
+ debug(0, "Double closing", __FUNCTION__);
+ return 1;
+ } // return 1 ??
+*/
+
+ if (stream->cachePos) {
+ GpFileWrite(stream->handle, (char *)stream->cacheData, stream->cachePos); // flush cache
+ stream->cachePos = 0;
+ }
+
+ ERR_CODE err = GpFileClose(stream->handle);
+ free(stream);
+
+ return err;
+}
+
+int gp_fseek(GPFILE *stream, long offset, int whence) {
+ ulong dummy;
+
+ switch (whence) {
+ case SEEK_SET:
+ whence = FROM_BEGIN;
+ break;
+ case SEEK_CUR:
+ whence = FROM_CURRENT;
+ break;
+ case SEEK_END:
+ whence = FROM_END;
+ break;
+ }
+ return GpFileSeek(stream->handle, whence, offset, (long *)&dummy);
+}
+
+size_t gp_fread(void *ptr, size_t size, size_t n, GPFILE *stream) {
+ ulong readcount = 0;
+ ERR_CODE err = GpFileRead(stream->handle, ptr, size * n, &readcount); //fixme? size*n
+ return readcount / size; //FIXME?
+}
+
+size_t gp_fwrite(const void *ptr, size_t size, size_t n, GPFILE *stream) {
+ int len = size * n;
+
+ if (!stream) {
+ //warning("writing to null file");
+ return 0;
+ }
+
+ if (stream->cachePos + len < FCACHE_SIZE) {
+ memcpy(stream->cacheData + stream->cachePos, ptr, len);
+ stream->cachePos += len;
+ } else {
+ if (stream->cachePos) {
+ GpFileWrite(stream->handle, stream->cacheData, stream->cachePos); // flush cache
+ stream->cachePos = 0;
+ }
+
+ ERR_CODE err = GpFileWrite(stream->handle, ptr, len);
+ if (!err)
+ return n;
+ else
+ return -err;
+ }
+ return 0;
+}
+
+//FIXME? use standard func
+long gp_ftell(GPFILE *stream) {
+ ulong pos = 0;
+ ERR_CODE err = GpFileSeek(stream->handle, FROM_CURRENT, 0, (long*)&pos);
+ return pos;
+}
+
+void gp_clearerr(GPFILE *stream)
+{
+}
+
+//FIXME!
+int gp_feof(GPFILE *stream) {
+ return gp_ftell(stream) >= stream->size;
+}
+
+char gp_fgetc(GPFILE *stream) {
+ char c[1];
+
+ gp_fread(&c[0], 1, 1, stream);
+ return c[0];
+}
+
+char *gp_fgets(char *s, int n, GPFILE *stream) {
+ int i = 0;
+
+ while (!gp_feof(stream) && i < n) {
+ gp_fread(&s[i], 1, 1, stream);
+ if (s[i] == '\n') {
+ s[i + 1] = 0;
+ return s;
+ }
+ i++;
+ }
+ if (gp_feof(stream))
+ return NULL;
+ else
+ return s;
+}
+
+int gp_fprintf(GPFILE *stream, const char *fmt, ...) {
+ char s[256];
+ va_list marker;
+
+ va_start(marker, fmt);
+ vsnprintf(s, 256, fmt, marker);
+ va_end(marker);
+
+ return gp_fwrite(s, 1, strlen(s), stream);
+}
+
+int gp_fflush(GPFILE *stream) {
+ return 0;
+}
+
+int gp_ferror(GPFILE *stream) {
+ return 0;
+}
+
+/////////////////////
+//Memory management
+#undef memcpy
+#undef memset
+void *gp_memcpy(void *dst, const void *src, size_t count) {
+ return memcpy(dst, src, count);
+}
+
+void *gp_memset(void *dst, int val, size_t count) {
+ return memset(dst, val, count);
+}
+
+void *gp_malloc(size_t size) {
+ uint32 np;
+ uint32 *up;
+
+ np = (uint32) gm_malloc(size + sizeof(uint32));
+
+ if (np) {
+ up = (uint32 *) np;
+ *up = 0x1234;
+ return (void *)(np + sizeof(uint32));
+ }
+
+ return NULL;
+}
+
+void *gp_calloc(size_t nitems, size_t size) {
+ void *p = gp_malloc(nitems * size); //gpcalloc doesnt clear?
+
+ gp_memset(p, 0, nitems * size);
+
+// if (*(uint8 *)p != 0)
+// warning("%s: calloc doesn't clear!", __FUNCTION__); //fixme: was error
+
+ return p;
+}
+
+void gp_free(void *block) {
+ uint32 np;
+ uint32 *up;
+
+ if (!block) {
+ return;
+ }
+
+ np = ((uint32) block) - sizeof(uint32);
+ up = (uint32 *) np;
+ if (*up == 0x4321) {
+ warning("%s: double deallocation!", __FUNCTION__);
+ return;
+ }
+
+ if (*up != 0x1234) {
+ warning("%s: corrupt block!", __FUNCTION__);
+ return;
+ }
+ *up = 0x4321;
+
+ gm_free(up);
+}
+
+//////////////////////////////////////////////////
+// GP32 stuff
+//////////////////////////////////////////////////
+void *operator new(size_t size) {
+// printf("BP:operator new(%d)", size);
+ return memset(malloc(size), 0xE7, size);
+}
+
+void operator delete(void *ptr) {
+// printf("operator delete(%x)", ptr);
+ free(ptr);
+}
+
+////////////////////
+//String functions
+char *gp_strcpy(char *dst, const char *src) {
+ char *pDst = dst;
+
+ while (*pDst++ = *src++)
+ ;
+
+ return dst;
+}
+
+char *gp_strncpy(char *dst, const char *src, size_t count) {
+ char *start = dst;
+
+ while (count && (*dst++ = *src++))
+ count--;
+
+ if (count)
+ while (--count)
+ *dst++ = '\0';
+
+ return start;
+}
+
+char *gp_strcat(char *dst, const char *src) {
+ char *pDst = dst;
+
+ while (*pDst)
+ pDst++;
+
+ while (*pDst++ = *src++)
+ ;
+
+ return dst;
+
+}
+
+char *gp_strdup(const char *str) {
+ char *memory;
+
+ if (!str)
+ return NULL;
+
+ if (memory = (char *)malloc(strlen(str) + 1))
+ return gp_strcpy(memory, str);
+
+ return NULL;
+}
+
+int gp_strcasecmp(const char *dst, const char *src) {
+ int f, l;
+ do {
+ f = tolower((unsigned char)(*(dst++)));
+ l = tolower((unsigned char)(*(src++)));
+ } while (f && (f == l));
+
+ return f - l;
+}
+
+int gp_strncasecmp(const char *dst, const char *src, size_t count) {
+ int f,l;
+
+ if (count) {
+ do {
+ f = tolower((unsigned char)(*(dst++)));
+ l = tolower((unsigned char)(*(src++)));
+ } while (--count && f && (f == l));
+ return f - l;
+ }
+
+ return 0;
+}
+
+//FIXME: Handle LONG string
+void gp_sprintf(char *str, const char *fmt, ...) {
+ char s[512];
+ va_list marker;
+
+ va_start(marker, fmt);
+ vsnprintf(s, 512, fmt, marker);
+ va_end(marker);
+
+ gp_strcpy(str, s);
+}
+
+int gp_printf(const char *fmt, ...) {
+ char s[256];
+ va_list marker;
+
+ va_start(marker, fmt);
+ vsnprintf(s, 256, fmt, marker);
+ va_end(marker);
+
+ _dprintf("%s", s);
+ //gp_delay(100);
+ return 0;
+}
+
+void gp_delay(uint32 msecs) {
+ int startTime = GpTickCountGet();
+ while (GpTickCountGet() < startTime + msecs);
+}
+
+void gp_exit(int code) {
+ if (!code) {
+ printf(" ----------------------------------------");
+ printf(" Your GP32 is now restarting... ");
+ printf(" ----------------------------------------");
+ printf("");
+
+ gp_delay(3000);
+
+ GpAppExit();
+ } else {
+ printf("Exit Code %d", code);
+ while (1);
+ }
+}
+
+// Debug functions
+void GPDEBUG(const char *fmt, ...) {
+ char s[256];
+ va_list marker;
+
+ va_start(marker, fmt);
+ vsnprintf(s, 256, fmt, marker);
+ va_end(marker);
+
+ _dprintf("%s", s);
+}
+
+void NP(const char *fmt, ...) {
+ return;
+ char s[256];
+ va_list marker;
+
+ va_start(marker, fmt);
+ vsnprintf(s, 256, fmt, marker);
+ va_end(marker);
+
+ _dprintf("NP:%s", s);
+ //gp_delay(50);
+}
+
+void LP(const char *fmt, ...) {
+ return;
+ char s[256];
+ va_list marker;
+
+ va_start(marker, fmt);
+ vsnprintf(s, 256, fmt, marker);
+ va_end(marker);
+
+ _dprintf("LP:%s", s);
+ //gp_delay(300);
+}
+
+void SP(const char *fmt, ...) {
+ return;
+ char s[256];
+ va_list marker;
+
+ va_start(marker, fmt);
+ vsnprintf(s, 256, fmt, marker);
+ va_end(marker);
+
+ _dprintf("SP:%s", s);
+ //gp_delay(50);
+}
+
+void BP(const char *fmt, ...) {
+ return;
+ char s[256];
+ va_list marker;
+
+ va_start(marker, fmt);
+ vsnprintf(s, 256, fmt, marker);
+ va_end(marker);
+
+ _dprintf("BP:%s", s);
+ //gp_delay(2000);
+}
diff --git a/backends/gp32/gp32std.h b/backends/gp32/gp32std.h
new file mode 100644
index 0000000000..8be7abf1bb
--- /dev/null
+++ b/backends/gp32/gp32std.h
@@ -0,0 +1,92 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001-2005 The ScummVM project
+ * Copyright (C) 2002 Ph0x - GP32 Backend
+ * Copyright (C) 2003/2004 DJWillis - GP32 Backend
+ * Copyright (C) 2005 Won Star - GP32 Backend
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $Header$
+ *
+ */
+
+#ifndef __GP32STD_H
+#define __GP32STD_H
+
+#include <gpfont.h>
+#include <gpfont_port.h>
+#include <gpgraphic.h>
+#include <gpmm.h>
+#include <gpmem.h>
+#include <gpos_def.h>
+#include <gpstdio.h>
+#include <gpstdlib.h>
+#include <gpdef.h>
+
+#define LCD_WIDTH 320
+#define LCD_HEIGHT 240
+
+#define FCACHE_SIZE 8 * 1024 // speed up writes
+
+typedef struct {
+ F_HANDLE handle;
+ unsigned long size;
+ unsigned long cachePos; //cache position
+ unsigned char cacheData[FCACHE_SIZE];
+} GPFILE;
+
+extern GPFILE *gp_stderr;
+extern GPFILE *gp_stdout;
+extern GPFILE *gp_stdin;
+
+extern GPFILE * gp_fopen(const char *filename, const char *mode);
+extern int gp_fclose(GPFILE *stream);
+extern int gp_fseek(GPFILE *stream, long offset, int whence);
+extern size_t gp_fread(void *ptr, size_t size, size_t n, GPFILE *stream);
+extern size_t gp_fwrite(const void *ptr, size_t size, size_t n, GPFILE *stream);
+extern long gp_ftell(GPFILE *stream);
+extern void gp_clearerr(GPFILE *stream);
+extern int gp_feof(GPFILE *stream);
+extern char gp_fgetc(GPFILE *stream);
+extern char * gp_fgets(char *s, int n, GPFILE *stream);
+extern int gp_fflush(GPFILE *stream);
+extern int gp_ferror(GPFILE *stream);
+extern int gp_fprintf(GPFILE *stream, const char *fmt, ...);
+
+extern char * gp_strcpy(char *dst, const char *src);
+extern char * gp_strncpy(char *dst, const char *src, size_t count);
+extern char * gp_strcat(char *dst, const char *src);
+extern char * gp_strdup(const char *str);
+extern int gp_strcasecmp(const char *dst, const char *src);
+extern int gp_strncasecmp(const char *dst, const char *src, size_t count);
+extern void gp_sprintf(char *str, const char *fmt, ...);
+
+extern void * gp_memcpy(void *dst, const void *src, size_t count);
+extern void * gp_memset(void *dst, int val, size_t count);
+extern void * gp_malloc(size_t size);
+extern void * gp_calloc(size_t nitems, size_t size);
+extern void gp_free(void *block);
+
+extern int gp_printf(const char *fmt, ...);
+extern void gp_delay(unsigned long msecs);
+extern void gp_exit(int code);
+
+extern void GPDEBUG(const char *fmt, ...);
+extern void LP(const char *fmt, ...);
+extern void NP(const char *fmt, ...);
+extern void SP(const char *fmt, ...);
+extern void BP(const char *fmt, ...);
+
+#endif
diff --git a/backends/gp32/gp32std_grap.cpp b/backends/gp32/gp32std_grap.cpp
new file mode 100644
index 0000000000..63eb3862d1
--- /dev/null
+++ b/backends/gp32/gp32std_grap.cpp
@@ -0,0 +1,133 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001-2005 The ScummVM project
+ * Copyright (C) 2005 Won Star - GP32 Backend
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $Header$
+ *
+ */
+
+#include "stdafx.h"
+#include "common/scummsys.h"
+#include "common/system.h"
+#include "backends/intern.h"
+
+#include "backends/gp32/gp32std.h"
+#include "backends/gp32/gp32std_grap.h"
+
+#include "backends/gp32/gp32_launcher.h"
+
+GPDRAWSURFACE lcdSurface[2];
+
+uint8 flipIndex = 1;
+
+uint16 *frameBuffer1;
+uint16 *frameBuffer2;
+
+extern const unsigned char fontresEng1[];
+extern const unsigned char fontresKor1[];
+
+void gp_putBitmap8x16(uint16 *frameBuffer, int x, int y, byte *lpBitmap, uint16 wColor) {
+ byte *pBitmap = lpBitmap;
+ for (int nRow = 0; nRow < 12; nRow ++) {
+ byte data = *pBitmap++;
+ for (int nCol = 0; nCol < 7; nCol ++) {
+ if (data & 0x80)
+ gpd_drawPixel16(frameBuffer, x + nCol, y + nRow, wColor);
+
+ data <<= 1;
+ }
+ }
+}
+
+void gp_putEngFont(uint16 *frameBuffer, int x, int y, char c, uint16 wColor) {
+ byte *pBitmap = (byte *) &fontresEng1[c * 16];
+ gp_putBitmap8x16(frameBuffer, x, y, pBitmap, wColor);
+}
+
+void gp_textOut(uint16 *frameBuffer, int x, int y, char* lpszText, uint16 wColor) {
+ // TODO: Handle korean font
+ int nPos = x;
+ char* pszText = lpszText;
+
+ while (*pszText != '\0') {
+ if (*pszText == '\n') {
+ nPos = x;
+ y += 8;
+ } else {
+ gp_putEngFont(frameBuffer, nPos, y, *pszText, wColor);
+ nPos += 7;
+ }
+
+ pszText++;
+ }
+}
+
+void gp_fillRect(uint16 *frameBuffer, int16 x, int16 y, int16 w, int16 h, uint16 color) {
+ uint16 *buffer = &frameBuffer[(240 - (y + h)) + (240 * x)];
+ for (int i = 0; i < w; i++) {
+ for (int j = 0; j < h; j++) {
+ *buffer++ = color;
+ }
+ buffer += 240 - h;
+ }
+}
+
+uint16 gp_RGBTo16(uint16 r, uint16 g, uint16 b) {
+ // GP32 16bit color 5551
+ if(g_gammaRamp != 100) {
+ r *= ((float)g_gammaRamp / 100);
+ g *= ((float)g_gammaRamp / 100);
+ b *= ((float)g_gammaRamp / 100);
+ r = r >= 255 ? 255 : r;
+ g = g >= 255 ? 255 : g;
+ b = b >= 255 ? 255 : b;
+ }
+ return (((r >> 3) & 0x1F) << 11) | (((g >> 3) & 0x1F) << 6) | ((b >> 3) & 0x1F) << 1;
+}
+
+void gp_16ToRGB(uint16 color, uint8 *r, uint8 *g, uint8 *b) {
+ *r = ((((color) >> 11) & 0x1F) << 3);
+ *g = ((((color) >> 6) & 0x1F) << 3); //(((color>>5)&0x3F) << 2);
+ *b = ((((color) >> 1) & 0x1F) << 3); //((color&0x1F) << 3);
+
+ if(g_gammaRamp != 100) {
+ *r /= ((float)g_gammaRamp / 100);
+ *g /= ((float)g_gammaRamp / 100);
+ *b /= ((float)g_gammaRamp / 100);
+ }
+}
+
+void gp_flipScreen() {
+ uint16 *frameBuffer1_old = frameBuffer1;
+ uint16 *frameBuffer2_old = frameBuffer2;
+
+ GpSurfaceFlip(&lcdSurface[flipIndex]);
+ flipIndex = 1 - flipIndex;
+ frameBuffer1 = frameBuffer2_old;
+ frameBuffer2 = frameBuffer1_old;
+}
+
+void gp_initFrameBuffer() {
+ GpLcdSurfaceGet(&lcdSurface[0], 0);
+ GpLcdSurfaceGet(&lcdSurface[1], 1);
+ GpSurfaceSet(&lcdSurface[0]);
+ frameBuffer1 = (uint16 *)lcdSurface[0].ptbuffer;
+ frameBuffer2 = (uint16 *)lcdSurface[1].ptbuffer;
+
+ memset(frameBuffer1, 0xFF, LCD_WIDTH * LCD_HEIGHT * sizeof(uint16));
+ memset(frameBuffer2, 0xFF, LCD_WIDTH * LCD_HEIGHT * sizeof(uint16));
+}
diff --git a/backends/gp32/startup.h b/backends/gp32/gp32std_grap.h
index bea53a0233..cf42cebcf3 100644
--- a/backends/gp32/startup.h
+++ b/backends/gp32/gp32std_grap.h
@@ -1,8 +1,8 @@
/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001 Ludvig Strigeus
- * Copyright (C) 2001/2004 The ScummVM project
+ * Copyright (C) 2001-2005 The ScummVM project
* Copyright (C) 2002 Ph0x - GP32 Backend
* Copyright (C) 2003/2004 DJWillis - GP32 Backend
+ * Copyright (C) 2005 Won Star - GP32 Backend
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -22,28 +22,24 @@
*
*/
-#ifndef STARTUP_H
-#define STARTUP_H
+#ifndef __GP32STD_GRAP_H
+#define __GP32STD_GRAP_H
-/////////////////////////////////////////////////////////////////////////////
-//
-// ScummVM/GP32 - GP32 start-up header.
-// Not part of ScummVM backend as such.
-//
-/////////////////////////////////////////////////////////////////////////////
+extern GPDRAWSURFACE lcdSurface[2];
+extern uint8 flipIndex;
-// GP32 SDK Includes.
-#include <gpdef.h>
-#include <gpstdlib.h>
-#include <gpfont.h>
-#include <gpfont_port.h>
-#include <gpfontres.dat>
-#include <initval_port.h>
+extern uint16 *frameBuffer1;
+extern uint16 *frameBuffer2;
-// GP32 System startup.
+extern void gp_fillRect(uint16 *frameBuffer, int16 x, int16 y, int16 w, int16 h, uint16 color);
+extern uint16 gp_RGBTo16(uint16 r, uint16 g, uint16 b);
+extern void gp_16ToRGB(uint16 color, uint8 *r, uint8 *g, uint8 *b);
-unsigned int HEAPSTART;
-unsigned int HEAPEND;
-void InitializeFont (void);
+extern void gp_textOut(uint16 *frameBuffer, int x, int y, char* lpszText, uint16 wColor);
-#endif /* STARTUP_H */
+extern void gp_initFrameBuffer();
+extern void gp_flipScreen();
+
+#define gpd_drawPixel16(dst,x,y,color) (dst)[(239 - (y)) + (240 * (x))] = (color)
+
+#endif
diff --git a/backends/gp32/gp32std_input.cpp b/backends/gp32/gp32std_input.cpp
new file mode 100644
index 0000000000..5a1ffcc0f9
--- /dev/null
+++ b/backends/gp32/gp32std_input.cpp
@@ -0,0 +1,210 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001-2005 The ScummVM project
+ * Copyright (C) 2002 Ph0x - GP32 Backend
+ * Copyright (C) 2003/2004 DJWillis - GP32 Backend
+ * Copyright (C) 2005 Won Star - GP32 Backend
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $Header$
+ *
+ */
+
+#include "stdafx.h"
+#include "common/scummsys.h"
+
+#include "backends/gp32/gp32std.h"
+#include "backends/gp32/gp32std_input.h"
+
+static uint32 buttonState = 0;
+static uint16 buttonPressState = 0;
+
+#define GET_BUTTON_PRESSED(a) (buttonPressState & (a))
+#define ON_BUTTON_PRESSED(a) (buttonPressState |= (a))
+#define OFF_BUTTON_PRESSED(a) (buttonPressState &= ~(a))
+
+#define GET_BUTTON_DOWN(a) (buttonState & (a) << 12)
+#define ON_BUTTON_DOWN(a) buttonState |= ((a) << 12)
+#define OFF_BUTTON_DOWN(a) buttonState &= ~((a) << 12)
+
+#define GET_BUTTON_UP(a) (buttonState & (a))
+#define ON_BUTTON_UP(a) buttonState |= (a)
+#define OFF_BUTTON_UP(a) buttonState &= ~(a)
+
+#define rKEY_A 0x4000
+#define rKEY_B 0x2000
+#define rKEY_L 0x1000
+#define rKEY_R 0x8000
+#define rKEY_UP 0x0800
+#define rKEY_DOWN 0x0200
+#define rKEY_LEFT 0x0100
+#define rKEY_RIGHT 0x0400
+#define rKEY_START 0x0040
+#define rKEY_SELECT 0x0080
+#define rPBDAT (*(volatile unsigned *)0x1560000c)
+#define rPEDAT (*(volatile unsigned *)0x15600030)
+
+/****************************************************************
+ GP32 Input mappings - Returns Button Pressed.
+****************************************************************/
+int gp_trapKey() {
+ int value = 0;
+
+ unsigned long gpb = rPBDAT; // 0x156
+ unsigned long gpe = rPEDAT;
+
+ if ((gpb & rKEY_LEFT) == 0)
+ value |= GPC_VK_LEFT;
+ if ((gpb & rKEY_RIGHT) == 0)
+ value |= GPC_VK_RIGHT;
+ if ((gpb & rKEY_UP) == 0)
+ value |= GPC_VK_UP;
+ if ((gpb & rKEY_DOWN) == 0)
+ value |= GPC_VK_DOWN;
+ if ((gpb & rKEY_A) == 0)
+ value |= GPC_VK_FA;
+ if ((gpb & rKEY_B) == 0)
+ value |= GPC_VK_FB;
+ if ((gpb & rKEY_L) == 0)
+ value |= GPC_VK_FL;
+ if ((gpb & rKEY_R) == 0)
+ value |= GPC_VK_FR;
+ if ((gpe & rKEY_SELECT) == 0)
+ value |= GPC_VK_SELECT;
+ if ((gpe & rKEY_START) == 0)
+ value |= GPC_VK_START;
+
+ return value;
+}
+
+bool gp_getButtonEvent(uint32 *nKeyUD, uint16 *nKeyP) {
+// int nKey = GpKeyGet();
+ int nKey = gp_trapKey();
+
+ const int keyBitMask[10] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x100, 0x200};
+
+ for (int i = 0; i < 10; i++) {
+ OFF_BUTTON_DOWN(keyBitMask[i]);
+ OFF_BUTTON_UP(keyBitMask[i]);
+ if (nKey & keyBitMask[i]) {
+ if (!GET_BUTTON_PRESSED(keyBitMask[i])) {
+// GPDEBUG("DOWN %d", i);
+ ON_BUTTON_PRESSED(keyBitMask[i]);
+ ON_BUTTON_DOWN(keyBitMask[i]);
+ }
+ } else {
+ if (GET_BUTTON_PRESSED(keyBitMask[i])) {
+// GPDEBUG("UP %d", i);
+ OFF_BUTTON_PRESSED(keyBitMask[i]);
+ ON_BUTTON_UP(keyBitMask[i]);
+ }
+ }
+ }
+
+// GPDEBUG("%08x %04x", buttonState, buttonPressState);
+ *nKeyUD = buttonState;
+ *nKeyP = buttonPressState;
+ return true;
+}
+
+#define MAX_EVENTS 32
+
+struct EventQueue {
+protected:
+ int front, rear;
+ int numElement;
+ GP32BtnEvent event[MAX_EVENTS];
+
+public:
+ void push(GP32BtnEvent *ev) {
+ if ((rear + 1) % MAX_EVENTS == front) {
+ GPDEBUG("Queue Overflow!");
+ return;
+ }
+ numElement++;
+
+ event[rear].type = ev->type;
+ event[rear].button = ev->button;
+ rear = (rear + 1) % MAX_EVENTS;
+ }
+
+ bool isEmpty() {
+ return (numElement == 0);
+ }
+
+ bool isFull() {
+ return (numElement == MAX_EVENTS);
+ }
+
+ bool get(GP32BtnEvent *ev) {
+ if (front == rear) {
+ return false;
+ }
+ numElement--;
+ ev->type = event[front].type;
+ ev->button = event[front].button;
+ front = (front + 1) % MAX_EVENTS;
+ return true;
+ }
+};
+
+EventQueue eventQueue;
+
+bool gp_pumpButtonEvent() {
+ int nKey = gp_trapKey();
+ GP32BtnEvent ev;
+
+ const int keyBitMask[10] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x100, 0x200};
+
+ for (int i = 0; i < 10; i++) {
+ if (nKey & keyBitMask[i]) {
+ if (!GET_BUTTON_PRESSED(keyBitMask[i])) {
+ ON_BUTTON_PRESSED(keyBitMask[i]);
+ ev.type = BUTTON_DOWN;
+ ev.button = keyBitMask[i];
+ eventQueue.push(&ev);
+ //ON_BUTTON_DOWN(keyBitMask[i]);
+ }
+ } else {
+ if (GET_BUTTON_PRESSED(keyBitMask[i])) {
+ OFF_BUTTON_PRESSED(keyBitMask[i]);
+ ev.type = BUTTON_UP;
+ ev.button = keyBitMask[i];
+ eventQueue.push(&ev);
+ //ON_BUTTON_UP(keyBitMask[i]);
+ }
+ }
+ }
+
+ return true;
+}
+
+bool gp_pollButtonEvent(GP32BtnEvent *ev) {
+ gp_pumpButtonEvent();
+
+ if(eventQueue.isEmpty()) {
+ return false;
+ }
+
+ eventQueue.get(ev);
+// GPDEBUG("Event poll %d %d", ev->type, ev->button);
+
+ return true;
+}
+
+bool gp_getButtonPressed(uint16 button)
+{
+ return buttonPressState & button;
+}
diff --git a/backends/gp32/gp32std_input.h b/backends/gp32/gp32std_input.h
new file mode 100644
index 0000000000..4aa300af3d
--- /dev/null
+++ b/backends/gp32/gp32std_input.h
@@ -0,0 +1,51 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001-2005 The ScummVM project
+ * Copyright (C) 2005 Won Star - GP32 Backend
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $Header$
+ *
+ */
+
+#ifndef __GP32STD_INPUT_H
+#define __GP32STD_INPUT_H
+
+#include "stdafx.h"
+#include "common/scummsys.h"
+
+#define BUTTON_DOWN 1
+#define BUTTON_UP 2
+
+struct GP32BtnEvent {
+ uint16 type;
+ uint16 button;
+};
+
+extern int gp_trapKey();
+
+extern bool gp_getButtonEvent(uint32 *nKeyUD, uint16 *nKeyP);
+
+#define gpd_getEventDown(a) (((a) >> 12) & 0x0fff)
+#define gpd_getEventUp(a) ((a) & 0x0fff)
+#define gpd_getEventPressed(a) ((a) & 0x0fff)
+#define gpd_getButtonDown(a,button) ((a) & (button) << 12)
+#define gpd_getButtonUp(a,button) ((a) & (button))
+#define gpd_getButtonPressed(a,button) ((a) & (button))
+
+extern bool gp_pollButtonEvent(GP32BtnEvent *ev);
+extern bool gp_getButtonPressed(uint16 button);
+
+#endif
diff --git a/backends/gp32/gp32std_sound.cpp b/backends/gp32/gp32std_sound.cpp
new file mode 100644
index 0000000000..2bef7aac3a
--- /dev/null
+++ b/backends/gp32/gp32std_sound.cpp
@@ -0,0 +1,107 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001-2005 The ScummVM project
+ * Copyright (C) 2002 Ph0x - GP32 Backend
+ * Copyright (C) 2003/2004 DJWillis - GP32 Backend
+ * Copyright (C) 2005 Won Star - GP32 Backend
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $Header$
+ *
+ */
+
+#include "stdafx.h"
+#include "common/scummsys.h"
+
+#include "gp32std.h"
+#include "gp32std_sound.h"
+
+#define GP32_TIMER_AUDIO_IDX 0
+
+// Global variables
+static volatile unsigned int frame = 0;
+static volatile unsigned int *soundPos = 0;
+static volatile int idx_buf;
+static volatile unsigned int shiftVal = 0;
+static void *buffer;
+static GPSOUNDBUF soundBuf;
+
+// This routine gets called by the timer interrupt and
+// polls the current playing position within the buffer.
+
+static void soundTimer() {
+ unsigned int t = (((unsigned int)(*soundPos) - (unsigned int)buffer) >> shiftVal) >= soundBuf.samples ? 1 : 0;
+ if (t != frame) {
+ unsigned int offs = ((frame == 1) ? (soundBuf.samples << shiftVal) : 0);
+ soundBuf.callback(soundBuf.userdata, (uint8 *)((unsigned int)buffer + offs), soundBuf.samples << shiftVal);
+ frame = t;
+ }
+}
+
+int gp_soundBufStart(GPSOUNDBUF *sb) {
+ int bufferSize = 0;
+ frame = 0;
+
+ // Copy the structure
+ memcpy(&soundBuf, sb, sizeof(GPSOUNDBUF));
+
+ // Calculate size of a single sample in bytes
+ // and a corresponding shift value
+ shiftVal = 0;
+ switch (soundBuf.freq) {
+ case PCM_S11:
+ break;
+ case PCM_S22:
+ break;
+ case PCM_S44:
+ shiftVal++;
+ break;
+ case PCM_M11:
+ break;
+ case PCM_M22:
+ break;
+ case PCM_M44:
+ shiftVal++;
+ break;
+ }
+ if (soundBuf.format == PCM_16BIT)
+ shiftVal++;
+ soundBuf.samplesize = 1 << shiftVal;
+
+ // Allocate memory for the playing buffer
+ bufferSize = soundBuf.samplesize * soundBuf.samples * 2;
+ buffer = malloc(bufferSize);
+ memset(buffer, 0, bufferSize);
+
+ // Set timer interrupt
+ if (GpTimerOptSet(GP32_TIMER_AUDIO_IDX, soundBuf.pollfreq, 0, soundTimer) == GPOS_ERR_ALREADY_USED) {
+ NP(" Timer is already used... kill timer");
+ GpTimerKill(GP32_TIMER_AUDIO_IDX);
+ }
+ GpTimerSet(GP32_TIMER_AUDIO_IDX);
+ // Start playing
+ GpPcmInit(soundBuf.freq, soundBuf.format);
+ GpPcmPlay((unsigned short *)buffer, bufferSize, 1);
+ GpPcmLock((unsigned short *)buffer, (int *)&idx_buf, (unsigned int *)&soundPos);
+
+ return 0;
+}
+
+void gp_soundBufStop() {
+ GpPcmStop();
+ GpPcmRemove((unsigned short *)buffer);
+ GpTimerKill(GP32_TIMER_AUDIO_IDX);
+ free(buffer);
+}
diff --git a/backends/gp32/gp32std_sound.h b/backends/gp32/gp32std_sound.h
new file mode 100644
index 0000000000..90613029a2
--- /dev/null
+++ b/backends/gp32/gp32std_sound.h
@@ -0,0 +1,45 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001-2005 The ScummVM project
+ * Copyright (C) 2002 Ph0x - GP32 Backend
+ * Copyright (C) 2003/2004 DJWillis - GP32 Backend
+ * Copyright (C) 2005 Won Star - GP32 Backend
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $Header$
+ *
+ */
+
+#ifndef __GP32STD_SOUND_H
+#define __GP32STD_SOUND_H
+
+// GPSOUNDBUF.userdata / Pointer to the buffer which needs to be refilled / Length of the buffer in bytes
+typedef void SoundProc(void *param, byte *buf, int len);
+
+typedef struct TGPSOUNDBUF {
+ PCM_SR freq; // Taken from gpmm.h
+ PCM_BIT format; // Taken from gpmm.h
+ unsigned int samples; // Buffer length (in samples)
+ void *userdata; // Userdata which gets passed to the callback function
+ SoundProc *callback; // Callback function (just like in SDL)
+ unsigned int pollfreq; // Frequency of the timer interrupt which polls the playing position
+ // recommended value: 2*(playingfreq in Hz/GPSOUNDBUF.samples)
+ unsigned int samplesize; // Size of one sample (8bit mono->1, 16bit stereo->4) - don't touch this
+} GPSOUNDBUF;
+
+int gp_soundBufStart(GPSOUNDBUF *sb);
+void gp_soundBufStop();
+
+#endif
diff --git a/backends/gp32/gp_asmlib.s b/backends/gp32/gp_asmlib.s
new file mode 100644
index 0000000000..f00f39a573
--- /dev/null
+++ b/backends/gp32/gp_asmlib.s
@@ -0,0 +1,393 @@
+ .ALIGN
+@ .ARM
+
+ .GLOBAL cpu_speed
+ .GLOBAL mmu_change
+
+cpu_speed:
+ stmdb r13!, {r0-r12,lr}
+ stmdb sp!, {r0, r1, r2}
+ mov r0, sp
+ swi #0x0d
+ add sp, sp, #12
+ ldmia r13!, {r0-r12,lr}
+ bx lr
+ nop
+
+mmu_change:
+ stmdb r13!, {r0-r12,lr}
+ swi #0x02
+ ldmia r13!, {r0-r12,lr}
+ bx lr
+ nop
+
+@ ******** ASMFastSolidBlit(unsigned char *src4, unsigned char *dst4, int nbx, int nby, int height2, int trans, int coul) ********
+
+ .ALIGN
+ .GLOBAL ASMFastSolidBlit
+ .TYPE ASMFastSolidBlit, function
+ .CODE 32
+
+@r0 = src4
+@r1 = dst4
+@r2 = nbx
+@r3 = nby
+
+@r4 = height2
+@r5 = trans
+@r6 = coul
+@r7 = tmp
+@r8 = tmpnby
+@r9 = tmp2
+
+_bx7:
+ ldrb r8,[r0,+r3] @lecture 1er pixel
+ subs r7,r3,#1
+ bmi _sauty2
+
+_sauty2: @ecriture r8
+ TEQ r8,r5
+ STRNEB r8,[r1,+r7]
+ SUB r0,r0,r4
+ SUB r1,r1,#240
+ SUBS r2,r2,#1
+ BPL _bx7
+
+ ldmfd r13!,{r4-r8}
+ add sp,sp,#8
+ bx lr
+
+ASMFastSolidBlit:
+
+ sub sp,sp,#12
+ stmfd r13!,{r4-r9}
+ ldr r4,[r13,#36]
+ ldr r5,[r13,#40]
+ ldr r6,[r13,#44]
+
+_bx8:
+ ldrb r9,[r0,+r3] @lecture 1er pixel
+ subs r8,r3,#1
+ bmi _sauty2
+
+_by8:
+ LDRB r7,[r0,+r8]
+ TEQ r9,r5
+ STRNEB r6,[r1,+r8]
+ SUBS r8,r8,#1
+ BMI _sauty3b
+ LDRB r9,[r0,+r8]
+ TEQ r7,r5
+ STRNEB r6,[r1,+r8]
+ SUBS r8,r8,#1
+ BMI _sauty3
+ LDRB r7,[r0,+r8]
+ TEQ r9,r5
+ STRNEB r6,[r1,+r8]
+ SUBS r8,r8,#1
+ BMI _sauty3b
+ LDRB r9,[r0,+r8]
+ TEQ r7,r5
+ STRNEB r6,[r1,+r8]
+ SUBS r8,r8,#1
+ BMI _sauty3
+ LDRB r7,[r0,+r8]
+ TEQ r9,r5
+ STRNEB r6,[r1,+r8]
+ SUBS r8,r8,#1
+ BMI _sauty3b
+ LDRB r9,[r0,+r8]
+ TEQ r7,r5
+ STRNEB r6,[r1,+r8]
+ SUBS r8,r8,#1
+ BMI _sauty3
+ LDRB r7,[r0,+r8]
+ TEQ r9,r5
+ STRNEB r6,[r1,+r8]
+ SUBS r8,r8,#1
+ BMI _sauty3b
+ LDRB r9,[r0,+r8]
+ TEQ r7,r5
+ STRNEB r6,[r1,+r8]
+ SUBS r8,r8,#1
+ BMI _sauty3
+ LDRB r7,[r0,+r8]
+ TEQ r9,r5
+ STRNEB r6,[r1,+r8]
+ SUBS r8,r8,#1
+ BMI _sauty3b
+ LDRB r9,[r0,+r8]
+ TEQ r7,r5
+ STRNEB r6,[r1,+r8]
+ SUBS r8,r8,#1
+ BMI _sauty3
+ LDRB r7,[r0,+r8]
+ TEQ r9,r5
+ STRNEB r6,[r1,+r8]
+ SUBS r8,r8,#1
+ BMI _sauty3b
+ LDRB r9,[r0,+r8]
+ TEQ r7,r5
+ STRNEB r6,[r1,+r8]
+ SUBS r8,r8,#1
+ BMI _sauty3
+ LDRB r7,[r0,+r8]
+ TEQ r9,r5
+ STRNEB r6,[r1,+r8]
+ SUBS r8,r8,#1
+ BMI _sauty3b
+ LDRB r9,[r0,+r8]
+ TEQ r7,r5
+ STRNEB r6,[r1,+r8]
+ SUBS r8,r8,#1
+ BMI _sauty3
+ LDRB r7,[r0,+r8]
+ TEQ r9,r5
+ STRNEB r6,[r1,+r8]
+ SUBS r8,r8,#1
+ BMI _sauty3b
+ LDRB r9,[r0,+r8]
+ TEQ r7,r5
+ STRNEB r6,[r1,+r8]
+ SUBS r8,r8,#1
+
+ BPL _by8
+
+_sauty3: @ecriture pour r9
+ TEQ r9,r5
+ STRNEB r6,[r1,+r8]
+ SUB r0,r0,r4
+ SUB r1,r1,#240
+ SUBS r2,r2,#1
+ BPL _bx8
+
+ ldmfd r13!,{r4-r9}
+ add sp,sp,#12
+ bx lr
+
+_sauty3b: @ecriture pour r7
+ TEQ r7,r5
+ STRNEB r6,[r1,+r8]
+ SUB r0,r0,r4
+ SUB r1,r1,#240
+ SUBS r2,r2,#1
+ BPL _bx8
+
+ ldmfd r13!,{r4-r9}
+ add sp,sp,#12
+ bx lr
+
+
+@ ******** ASMSaveBitmap(unsigned char *src4, unsigned char *dst, int nbx, int nby, int height2) ********
+
+ .ALIGN
+ .GLOBAL ASMSaveBitmap
+ .TYPE ASMSaveBitmap, function
+ .CODE 32
+
+@r0 = src4
+@r1 = dst + 1
+@r2 = nbx
+@r3 = nby
+
+@r7 = height2
+@r8 = tmp
+@r9 = tmpnby
+@r10 = dst4
+
+ASMSaveBitmap:
+
+ sub sp,sp,#4
+ stmfd r13!,{r7-r10}
+ LDR r7,[r13,#20]
+
+_bx6:
+ MLA r10,r2,r7,r1
+ MOV r9,r3
+
+_by6:
+ LDRB r8,[r0,+r9]
+ SUBS r9,r9,#1
+ STRB r8,[r10,+r9]
+ BMI _fincol6
+ LDRB r8,[r0,+r9]
+ SUBS r9,r9,#1
+ STRB r8,[r10,+r9]
+ BMI _fincol6
+ LDRB r8,[r0,+r9]
+ SUBS r9,r9,#1
+ STRB r8,[r10,+r9]
+ BMI _fincol6
+ LDRB r8,[r0,+r9]
+ SUBS r9,r9,#1
+ STRB r8,[r10,+r9]
+ BMI _fincol6
+ LDRB r8,[r0,+r9]
+ SUBS r9,r9,#1
+ STRB r8,[r10,+r9]
+ BMI _fincol6
+ LDRB r8,[r0,+r9]
+ SUBS r9,r9,#1
+ STRB r8,[r10,+r9]
+ BMI _fincol6
+ LDRB r8,[r0,+r9]
+ SUBS r9,r9,#1
+ STRB r8,[r10,+r9]
+ BMI _fincol6
+ LDRB r8,[r0,+r9]
+ SUBS r9,r9,#1
+ STRB r8,[r10,+r9]
+ BMI _fincol6
+ LDRB r8,[r0,+r9]
+ SUBS r9,r9,#1
+ STRB r8,[r10,+r9]
+ BMI _fincol6
+ LDRB r8,[r0,+r9]
+ SUBS r9,r9,#1
+ STRB r8,[r10,+r9]
+ BMI _fincol6
+ LDRB r8,[r0,+r9]
+ SUBS r9,r9,#1
+ STRB r8,[r10,+r9]
+ BMI _fincol6
+ LDRB r8,[r0,+r9]
+ SUBS r9,r9,#1
+ STRB r8,[r10,+r9]
+ BMI _fincol6
+ LDRB r8,[r0,+r9]
+ SUBS r9,r9,#1
+ STRB r8,[r10,+r9]
+ BMI _fincol6
+ LDRB r8,[r0,+r9]
+ SUBS r9,r9,#1
+ STRB r8,[r10,+r9]
+ BMI _fincol6
+ LDRB r8,[r0,+r9]
+ SUBS r9,r9,#1
+ STRB r8,[r10,+r9]
+ BMI _fincol6
+ LDRB r8,[r0,+r9]
+ SUBS r9,r9,#1
+ STRB r8,[r10,+r9]
+
+ BPL _by6
+
+_fincol6:
+ SUB r0,r0,#240
+ SUBS r2,r2,#1
+ BPL _bx6
+
+ ldmfd r13!,{r7-r10}
+ add sp,sp,#4
+ bx lr
+
+
+ .ALIGN
+ .GLOBAL gp_clearFramebuffer
+ .TYPE gp_clearFramebuffer, function
+ .CODE 32
+gp_clearFramebuffer:
+ @ r0 = framebuffer
+ @ r1 = color
+ orr r1,r1,r1,lsl #16 @hi halfword = lo halfword
+ mov r2,#38400
+clear: str r1,[r0],#4
+ subs r2,r2,#1
+ bne clear
+ bx lr
+
+
+@ ******** ASMFastClear(unsigned char *dst4, int nbx, int nby) ********
+
+ .ALIGN
+ .GLOBAL ASMFastClear
+ .TYPE ASMFastClear, function
+ .CODE 32
+
+@r0 = dst4
+@r1 = nbx
+@r2 = nby
+
+@r3 = #0
+@r4 = tmpnby
+
+@optimis?pour h=20
+
+ASMFastClear:
+
+ str r4,[sp,#-4]!
+ MOV r3,#0
+
+_bx9:
+ MOV r4,r2
+
+_by9:
+ STRB r3,[r0,+r4]
+ SUBS r4,r4,#1
+ BMI _sauty4
+ STRB r3,[r0,+r4]
+ SUBS r4,r4,#1
+ BMI _sauty4
+ STRB r3,[r0,+r4]
+ SUBS r4,r4,#1
+ BMI _sauty4
+ STRB r3,[r0,+r4]
+ SUBS r4,r4,#1
+ BMI _sauty4
+ STRB r3,[r0,+r4]
+ SUBS r4,r4,#1
+ BMI _sauty4
+ STRB r3,[r0,+r4]
+ SUBS r4,r4,#1
+ BMI _sauty4
+ STRB r3,[r0,+r4]
+ SUBS r4,r4,#1
+ BMI _sauty4
+ STRB r3,[r0,+r4]
+ SUBS r4,r4,#1
+ BMI _sauty4
+ STRB r3,[r0,+r4]
+ SUBS r4,r4,#1
+ BMI _sauty4
+ STRB r3,[r0,+r4]
+ SUBS r4,r4,#1
+ BMI _sauty4
+ STRB r3,[r0,+r4]
+ SUBS r4,r4,#1
+ BMI _sauty4
+ STRB r3,[r0,+r4]
+ SUBS r4,r4,#1
+ BMI _sauty4
+ STRB r3,[r0,+r4]
+ SUBS r4,r4,#1
+ BMI _sauty4
+ STRB r3,[r0,+r4]
+ SUBS r4,r4,#1
+ BMI _sauty4
+ STRB r3,[r0,+r4]
+ SUBS r4,r4,#1
+ BMI _sauty4
+ STRB r3,[r0,+r4]
+ SUBS r4,r4,#1
+ BMI _sauty4
+ STRB r3,[r0,+r4]
+ SUBS r4,r4,#1
+ BMI _sauty4
+ STRB r3,[r0,+r4]
+ SUBS r4,r4,#1
+ BMI _sauty4
+ STRB r3,[r0,+r4]
+ SUBS r4,r4,#1
+ BMI _sauty4
+ STRB r3,[r0,+r4]
+ SUBS r4,r4,#1
+
+ BPL _by9
+
+_sauty4:
+ SUB r0,r0,#240
+ SUBS r1,r1,#1
+ BPL _bx9
+
+ ldr r4,[sp],#4
+ bx lr
diff --git a/backends/gp32/gp_clipped.c b/backends/gp32/gp_clipped.c
new file mode 100644
index 0000000000..d3e161c470
--- /dev/null
+++ b/backends/gp32/gp_clipped.c
@@ -0,0 +1,100 @@
+/* ScummVM - Scumm Interpreter
+ * GP32 Blitting library
+ * Copyright (C) 2001-2005 The ScummVM project
+ * Copyright (C) 2003,2004,2005 CARTIER Matthieu
+ * Copyright (C) 2005 Won Star - GP32 Backend
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $Header$
+ *
+ */
+
+//Some global variables and macros
+
+#define screen_width 320
+#define screen_height 240
+
+void gp_FastSolidBlit(void *framebuffer, int dx, const int dy, const int width, const int height, const unsigned char *src, const int trans, const int coul) {
+ int xmin, ymin, xmax, ymax;
+ int height2 = ( (height + 3) >> 2) << 2;
+
+ if(dx < 0) {
+ xmin = -dx;
+ } else xmin = 0;
+ if( (dx++ + width) > screen_width) {
+ xmax = screen_width - dx;
+ } else xmax = width - 1;
+ if(dy < 0) {
+ ymax = height + dy - 1;
+ } else ymax = height - 1;
+ if( (dy + height) > screen_height) {
+ ymin = dy + height - screen_height;
+ } else ymin = 0;
+ if( (xmin > xmax) || (ymin > ymax) ) return;
+
+ unsigned char *dst4 = framebuffer + (dx + xmax) * screen_height - height - dy + 1 + ymin;
+ src += (xmax * height2 + ymin);
+ ASMFastSolidBlit(src, dst4, xmax - xmin, ymax - ymin, height2, trans, coul);
+}
+
+//Copy from framebuffer to dest
+void gp_SaveBitmap(void *framebuffer, int dx, const int dy, const int width, const int height, const unsigned char *dest) { //Sur l'icran
+ int xmin, ymin, xmax, ymax;
+ int height2 = ( (height + 3) >> 2) << 2;
+
+ if(dx < 0) {
+ xmin = -dx;
+ } else xmin = 0;
+ if( (dx++ + width) > screen_width) {
+ xmax = screen_width - dx;
+ } else xmax = width - 1;
+ if(dy < 0) {
+ ymax = height + dy - 1;
+ } else ymax = height - 1;
+ if( (dy + height) > screen_height) {
+ ymin = dy + height - screen_height;
+ } else ymin = 0;
+ if( (xmin > xmax) || (ymin > ymax) ) return;
+
+ unsigned char *src4 = framebuffer + (dx + xmax) * screen_height - height - dy + ymin;
+ dest += (xmin * height2 + ymin + 1);
+ ASMSaveBitmap(src4, dest, xmax - xmin, ymax - ymin, height2);
+}
+
+//Clears area with color #0, should not trigger clicky noise
+
+void gp_FastClear(void *framebuffer, int dx, int dy, int width, int height) {
+ int xmin, ymin, xmax, ymax;
+
+ if(dx < 0) {
+ xmin = -dx;
+ } else xmin = 0;
+ if( (dx++ + width) > screen_width) {
+ xmax = screen_width - dx;
+ } else xmax = width - 1;
+ if(dy < 0) {
+ ymax = height + dy - 1;
+ } else ymax = height - 1;
+ if( (dy + height) > screen_height) {
+ ymin = dy + height - screen_height;
+ } else ymin = 0;
+ if( (xmin > xmax) || (ymin > ymax) ) return;
+
+ int decaly = screen_height - height - dy;
+
+ unsigned char *dst4 = framebuffer + (dx + xmax) * screen_height - height - dy + ymin;
+ ASMFastClear(dst4, xmax - xmin, ymax - ymin);
+}
diff --git a/backends/gp32/graphics.h b/backends/gp32/graphics.h
deleted file mode 100644
index 6a6ef5c9ac..0000000000
--- a/backends/gp32/graphics.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001 Ludvig Strigeus
- * Copyright (C) 2001/2004 The ScummVM project
- * Copyright (C) 2002 Ph0x - GP32 Backend
- * Copyright (C) 2003/2004 DJWillis - GP32 Backend
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $Header$
- *
- */
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// GP32 Graphics structure header
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef GRAPHICS_H
-#define GRAPHICS_H
-
-#define Sint16 s16
-#define Uint16 u16
-#define Uint32 u32
-#define Uint8 u8
-
-typedef struct {
- Sint16 x, y;
- Uint16 w, h;
-} gpRect;
-
-typedef struct {
- Uint8 r;
- Uint8 g;
- Uint8 b;
- Uint8 unused;
-} gpColor;
-
-typedef struct {
- int ncolors;
- gpColor *colors;
-} gpPalette;
-
-/* Everything in the pixel format structure is read-only */
-typedef struct gpPixelFormat {
- gpPalette *palette;
- Uint8 BitsPerPixel;
- Uint8 BytesPerPixel;
- Uint8 Rloss;
- Uint8 Gloss;
- Uint8 Bloss;
- Uint8 Aloss;
- Uint8 Rshift;
- Uint8 Gshift;
- Uint8 Bshift;
- Uint8 Ashift;
- Uint32 Rmask;
- Uint32 Gmask;
- Uint32 Bmask;
- Uint32 Amask;
-
- /* RGB color key information */
- Uint32 colorkey;
- /* Alpha value information (per-surface alpha) */
- Uint8 alpha;
-} gpPixelFormat;
-
-typedef struct gpSurface {
- Uint32 flags; /* Read-only */
- gpPixelFormat *format; /* Read-only */
- int w, h; /* Read-only */
- Uint16 pitch; /* Read-only */
- void *pixels; /* Read-write */
- int offset; /* Private */
-
- /* Hardware-specific surface info */
- struct private_hwdata *hwdata;
-
- /* clipping information */
- gpRect clip_rect; /* Read-only */
- Uint32 unused1; /* for binary compatibility */
-
- /* Allow recursive locks */
- Uint32 locked; /* Private */
-
- /* info for fast blit mapping to other surfaces */
- // struct gpBlitMap *map; /* Private */
-
- /* format version, bumped at every change to invalidate blit maps */
- unsigned int format_version; /* Private */
-
- /* Reference count -- used when freeing surface */
- int refcount; /* Read-mostly */
-} gpSurface;
-
-#define gpSWSurface 0x00000000
-#define gpHWSurface 0x00000001
-#define gpFullScreen 0x80000000
-
-#endif /* GRAPHICS_H */
diff --git a/backends/gp32/memcpy.S b/backends/gp32/memcpy.S
new file mode 100644
index 0000000000..1572831179
--- /dev/null
+++ b/backends/gp32/memcpy.S
@@ -0,0 +1,498 @@
+/* $NetBSD: memcpy.S,v 1.3 1997/11/22 03:27:12 mark Exp $ */
+
+/*-
+* Copyright (c) 1997 The NetBSD Foundation, Inc.
+* All rights reserved.
+*
+* This code is derived from software contributed to The NetBSD Foundation
+* by Neil A. Carson and Mark Brinicombe
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* 3. All advertising materials mentioning features or use of this software
+* must display the following acknowledgement:
+* This product includes software developed by the NetBSD
+* Foundation, Inc. and its contributors.
+* 4. Neither the name of The NetBSD Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+* ``AS IS\'\' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+* POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* This was modified by Jay Monkman <jmonkman@smoothsmoothie.com> to
+* save and restore r12. This is necessary for RTEMS.
+*/
+/* #include <machine/asm.h>*/
+
+#define ENTRY(_LABEL) \
+ .global _LABEL; _LABEL:
+/*
+.globl memcpy
+memcpy:
+*/
+ENTRY(memcpy)
+stmfd sp!, {r0, r12, lr}
+bl _memcpy
+ldmfd sp!, {r0, r12, pc}
+
+
+/*
+.globl memove
+memmove:
+*/
+ENTRY(memmove)
+stmfd sp!, {r0, r12, lr}
+bl _memcpy
+ldmfd sp!, {r0, r12, pc}
+
+
+
+/*
+* This is one fun bit of code ...
+* Some easy listening music is suggested while trying to understand this
+* code e.g. Iron Maiden
+*
+* For anyone attempting to understand it :
+*
+* The core code is implemented here with simple stubs for memcpy()
+* memmove() and bcopy().
+*
+* All local labels are prefixed with Lmemcpy_
+* Following the prefix a label starting f is used in the forward copy code
+* while a label using b is used in the backwards copy code
+* The source and destination addresses determine whether a forward or
+* backward copy is performed.
+* Separate bits of code are used to deal with the following situations
+* for both the forward and backwards copy.
+* unaligned source address
+* unaligned destination address
+* Separate copy routines are used to produce an optimised result for each
+* of these cases.
+* The copy code will use LDM/STM instructions to copy up to 32 bytes at
+* a time where possible.
+*
+* Note: r12 (aka ip) can be trashed during the function along with
+* r0-r3 although r0-r2 have defined uses i.e. src, dest, len through out.
+* Additional registers are preserved prior to use i.e. r4, r5 & lr
+*
+* Apologies for the state of the comments;-)
+*/
+
+
+/*
+_memcpy:
+*/
+ENTRY(_memcpy)
+/* Determine copy direction */
+cmp r1, r0
+bcc Lmemcpy_backwards
+
+moveq r0, #0 /* Quick abort for len=0 */
+moveq pc, lr
+
+stmdb sp!, {r0, lr} /* memcpy() returns dest addr */
+subs r2, r2, #4
+blt Lmemcpy_fl4 /* less than 4 bytes */
+ands r12, r0, #3
+bne Lmemcpy_fdestul /* oh unaligned destination addr */
+ands r12, r1, #3
+bne Lmemcpy_fsrcul /* oh unaligned source addr */
+
+Lmemcpy_ft8:
+/* We have aligned source and destination */
+subs r2, r2, #8
+blt Lmemcpy_fl12 /* less than 12 bytes (4 from above) */
+subs r2, r2, #0x14
+blt Lmemcpy_fl32 /* less than 32 bytes (12 from above) */
+stmdb sp!, {r4} /* borrow r4 */
+
+/* blat 32 bytes at a time */
+/* XXX for really big copies perhaps we should use more registers */
+Lmemcpy_floop32:
+ldmia r1!, {r3, r4, r12, lr}
+stmia r0!, {r3, r4, r12, lr}
+ldmia r1!, {r3, r4, r12, lr}
+stmia r0!, {r3, r4, r12, lr}
+subs r2, r2, #0x20
+bge Lmemcpy_floop32
+
+cmn r2, #0x10
+ldmgeia r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */
+stmgeia r0!, {r3, r4, r12, lr}
+subge r2, r2, #0x10
+ldmia sp!, {r4} /* return r4 */
+
+Lmemcpy_fl32:
+adds r2, r2, #0x14
+
+/* blat 12 bytes at a time */
+Lmemcpy_floop12:
+ldmgeia r1!, {r3, r12, lr}
+stmgeia r0!, {r3, r12, lr}
+subges r2, r2, #0x0c
+bge Lmemcpy_floop12
+
+Lmemcpy_fl12:
+adds r2, r2, #8
+blt Lmemcpy_fl4
+
+subs r2, r2, #4
+ldrlt r3, [r1], #4
+strlt r3, [r0], #4
+ldmgeia r1!, {r3, r12}
+stmgeia r0!, {r3, r12}
+subge r2, r2, #4
+
+Lmemcpy_fl4:
+/* less than 4 bytes to go */
+adds r2, r2, #4
+ldmeqia sp!, {r0, pc} /* done */
+
+/* copy the crud byte at a time */
+cmp r2, #2
+ldrb r3, [r1], #1
+strb r3, [r0], #1
+ldrgeb r3, [r1], #1
+strgeb r3, [r0], #1
+ldrgtb r3, [r1], #1
+strgtb r3, [r0], #1
+ldmia sp!, {r0, pc}
+
+/* erg - unaligned destination */
+Lmemcpy_fdestul:
+rsb r12, r12, #4
+cmp r12, #2
+
+/* align destination with byte copies */
+ldrb r3, [r1], #1
+strb r3, [r0], #1
+ldrgeb r3, [r1], #1
+strgeb r3, [r0], #1
+ldrgtb r3, [r1], #1
+strgtb r3, [r0], #1
+subs r2, r2, r12
+blt Lmemcpy_fl4 /* less the 4 bytes */
+
+ands r12, r1, #3
+beq Lmemcpy_ft8 /* we have an aligned source */
+
+/* erg - unaligned source */
+/* This is where it gets nasty ... */
+Lmemcpy_fsrcul:
+bic r1, r1, #3
+ldr lr, [r1], #4
+cmp r12, #2
+bgt Lmemcpy_fsrcul3
+beq Lmemcpy_fsrcul2
+cmp r2, #0x0c
+blt Lmemcpy_fsrcul1loop4
+sub r2, r2, #0x0c
+stmdb sp!, {r4, r5}
+
+Lmemcpy_fsrcul1loop16:
+mov r3, lr, lsr #8
+ldmia r1!, {r4, r5, r12, lr}
+orr r3, r3, r4, lsl #24
+mov r4, r4, lsr #8
+orr r4, r4, r5, lsl #24
+mov r5, r5, lsr #8
+orr r5, r5, r12, lsl #24
+mov r12, r12, lsr #8
+orr r12, r12, lr, lsl #24
+stmia r0!, {r3-r5, r12}
+subs r2, r2, #0x10
+bge Lmemcpy_fsrcul1loop16
+ldmia sp!, {r4, r5}
+adds r2, r2, #0x0c
+blt Lmemcpy_fsrcul1l4
+
+Lmemcpy_fsrcul1loop4:
+mov r12, lr, lsr #8
+ldr lr, [r1], #4
+orr r12, r12, lr, lsl #24
+str r12, [r0], #4
+subs r2, r2, #4
+bge Lmemcpy_fsrcul1loop4
+
+Lmemcpy_fsrcul1l4:
+sub r1, r1, #3
+b Lmemcpy_fl4
+
+Lmemcpy_fsrcul2:
+cmp r2, #0x0c
+blt Lmemcpy_fsrcul2loop4
+sub r2, r2, #0x0c
+stmdb sp!, {r4, r5}
+
+Lmemcpy_fsrcul2loop16:
+mov r3, lr, lsr #16
+ldmia r1!, {r4, r5, r12, lr}
+orr r3, r3, r4, lsl #16
+mov r4, r4, lsr #16
+orr r4, r4, r5, lsl #16
+mov r5, r5, lsr #16
+orr r5, r5, r12, lsl #16
+mov r12, r12, lsr #16
+orr r12, r12, lr, lsl #16
+stmia r0!, {r3-r5, r12}
+subs r2, r2, #0x10
+bge Lmemcpy_fsrcul2loop16
+ldmia sp!, {r4, r5}
+adds r2, r2, #0x0c
+blt Lmemcpy_fsrcul2l4
+
+Lmemcpy_fsrcul2loop4:
+mov r12, lr, lsr #16
+ldr lr, [r1], #4
+orr r12, r12, lr, lsl #16
+str r12, [r0], #4
+subs r2, r2, #4
+bge Lmemcpy_fsrcul2loop4
+
+Lmemcpy_fsrcul2l4:
+sub r1, r1, #2
+b Lmemcpy_fl4
+
+Lmemcpy_fsrcul3:
+cmp r2, #0x0c
+blt Lmemcpy_fsrcul3loop4
+sub r2, r2, #0x0c
+stmdb sp!, {r4, r5}
+
+Lmemcpy_fsrcul3loop16:
+mov r3, lr, lsr #24
+ldmia r1!, {r4, r5, r12, lr}
+orr r3, r3, r4, lsl #8
+mov r4, r4, lsr #24
+orr r4, r4, r5, lsl #8
+mov r5, r5, lsr #24
+orr r5, r5, r12, lsl #8
+mov r12, r12, lsr #24
+orr r12, r12, lr, lsl #8
+stmia r0!, {r3-r5, r12}
+subs r2, r2, #0x10
+bge Lmemcpy_fsrcul3loop16
+ldmia sp!, {r4, r5}
+adds r2, r2, #0x0c
+blt Lmemcpy_fsrcul3l4
+
+Lmemcpy_fsrcul3loop4:
+mov r12, lr, lsr #24
+ldr lr, [r1], #4
+orr r12, r12, lr, lsl #8
+str r12, [r0], #4
+subs r2, r2, #4
+bge Lmemcpy_fsrcul3loop4
+
+Lmemcpy_fsrcul3l4:
+sub r1, r1, #1
+b Lmemcpy_fl4
+
+Lmemcpy_backwards:
+add r1, r1, r2
+add r0, r0, r2
+subs r2, r2, #4
+blt Lmemcpy_bl4 /* less than 4 bytes */
+ands r12, r0, #3
+bne Lmemcpy_bdestul /* oh unaligned destination addr */
+ands r12, r1, #3
+bne Lmemcpy_bsrcul /* oh unaligned source addr */
+
+Lmemcpy_bt8:
+/* We have aligned source and destination */
+subs r2, r2, #8
+blt Lmemcpy_bl12 /* less than 12 bytes (4 from above) */
+stmdb sp!, {r4, lr}
+subs r2, r2, #0x14 /* less than 32 bytes (12 from above) */
+blt Lmemcpy_bl32
+
+/* blat 32 bytes at a time */
+/* XXX for really big copies perhaps we should use more registers */
+Lmemcpy_bloop32:
+ldmdb r1!, {r3, r4, r12, lr}
+stmdb r0!, {r3, r4, r12, lr}
+ldmdb r1!, {r3, r4, r12, lr}
+stmdb r0!, {r3, r4, r12, lr}
+subs r2, r2, #0x20
+bge Lmemcpy_bloop32
+
+Lmemcpy_bl32:
+cmn r2, #0x10
+ldmgedb r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */
+stmgedb r0!, {r3, r4, r12, lr}
+subge r2, r2, #0x10
+adds r2, r2, #0x14
+ldmgedb r1!, {r3, r12, lr} /* blat a remaining 12 bytes */
+stmgedb r0!, {r3, r12, lr}
+subge r2, r2, #0x0c
+ldmia sp!, {r4, lr}
+
+Lmemcpy_bl12:
+adds r2, r2, #8
+blt Lmemcpy_bl4
+subs r2, r2, #4
+ldrlt r3, [r1, #-4]!
+strlt r3, [r0, #-4]!
+ldmgedb r1!, {r3, r12}
+stmgedb r0!, {r3, r12}
+subge r2, r2, #4
+
+Lmemcpy_bl4:
+/* less than 4 bytes to go */
+adds r2, r2, #4
+moveq pc, lr /* done */
+
+/* copy the crud byte at a time */
+cmp r2, #2
+ldrb r3, [r1, #-1]!
+strb r3, [r0, #-1]!
+ldrgeb r3, [r1, #-1]!
+strgeb r3, [r0, #-1]!
+ldrgtb r3, [r1, #-1]!
+strgtb r3, [r0, #-1]!
+mov pc, lr
+
+/* erg - unaligned destination */
+Lmemcpy_bdestul:
+cmp r12, #2
+
+/* align destination with byte copies */
+ldrb r3, [r1, #-1]!
+strb r3, [r0, #-1]!
+ldrgeb r3, [r1, #-1]!
+strgeb r3, [r0, #-1]!
+ldrgtb r3, [r1, #-1]!
+strgtb r3, [r0, #-1]!
+subs r2, r2, r12
+blt Lmemcpy_bl4 /* less than 4 bytes to go */
+ands r12, r1, #3
+beq Lmemcpy_bt8 /* we have an aligned source */
+
+/* erg - unaligned source */
+/* This is where it gets nasty ... */
+Lmemcpy_bsrcul:
+bic r1, r1, #3
+ldr r3, [r1, #0]
+cmp r12, #2
+blt Lmemcpy_bsrcul1
+beq Lmemcpy_bsrcul2
+cmp r2, #0x0c
+blt Lmemcpy_bsrcul3loop4
+sub r2, r2, #0x0c
+stmdb sp!, {r4, r5, lr}
+
+Lmemcpy_bsrcul3loop16:
+mov lr, r3, lsl #8
+ldmdb r1!, {r3-r5, r12}
+orr lr, lr, r12, lsr #24
+mov r12, r12, lsl #8
+orr r12, r12, r5, lsr #24
+mov r5, r5, lsl #8
+orr r5, r5, r4, lsr #24
+mov r4, r4, lsl #8
+orr r4, r4, r3, lsr #24
+stmdb r0!, {r4, r5, r12, lr}
+subs r2, r2, #0x10
+bge Lmemcpy_bsrcul3loop16
+ldmia sp!, {r4, r5, lr}
+adds r2, r2, #0x0c
+blt Lmemcpy_bsrcul3l4
+
+Lmemcpy_bsrcul3loop4:
+mov r12, r3, lsl #8
+ldr r3, [r1, #-4]!
+orr r12, r12, r3, lsr #24
+str r12, [r0, #-4]!
+subs r2, r2, #4
+bge Lmemcpy_bsrcul3loop4
+
+Lmemcpy_bsrcul3l4:
+add r1, r1, #3
+b Lmemcpy_bl4
+
+Lmemcpy_bsrcul2:
+cmp r2, #0x0c
+blt Lmemcpy_bsrcul2loop4
+sub r2, r2, #0x0c
+stmdb sp!, {r4, r5, lr}
+
+Lmemcpy_bsrcul2loop16:
+mov lr, r3, lsl #16
+ldmdb r1!, {r3-r5, r12}
+orr lr, lr, r12, lsr #16
+mov r12, r12, lsl #16
+orr r12, r12, r5, lsr #16
+mov r5, r5, lsl #16
+orr r5, r5, r4, lsr #16
+mov r4, r4, lsl #16
+orr r4, r4, r3, lsr #16
+stmdb r0!, {r4, r5, r12, lr}
+subs r2, r2, #0x10
+bge Lmemcpy_bsrcul2loop16
+ldmia sp!, {r4, r5, lr}
+adds r2, r2, #0x0c
+blt Lmemcpy_bsrcul2l4
+
+Lmemcpy_bsrcul2loop4:
+mov r12, r3, lsl #16
+ldr r3, [r1, #-4]!
+orr r12, r12, r3, lsr #16
+str r12, [r0, #-4]!
+subs r2, r2, #4
+bge Lmemcpy_bsrcul2loop4
+
+Lmemcpy_bsrcul2l4:
+add r1, r1, #2
+b Lmemcpy_bl4
+
+Lmemcpy_bsrcul1:
+cmp r2, #0x0c
+blt Lmemcpy_bsrcul1loop4
+sub r2, r2, #0x0c
+stmdb sp!, {r4, r5, lr}
+
+Lmemcpy_bsrcul1loop32:
+mov lr, r3, lsl #24
+ldmdb r1!, {r3-r5, r12}
+orr lr, lr, r12, lsr #8
+mov r12, r12, lsl #24
+orr r12, r12, r5, lsr #8
+mov r5, r5, lsl #24
+orr r5, r5, r4, lsr #8
+mov r4, r4, lsl #24
+orr r4, r4, r3, lsr #8
+stmdb r0!, {r4, r5, r12, lr}
+subs r2, r2, #0x10
+bge Lmemcpy_bsrcul1loop32
+ldmia sp!, {r4, r5, lr}
+adds r2, r2, #0x0c
+blt Lmemcpy_bsrcul1l4
+
+Lmemcpy_bsrcul1loop4:
+mov r12, r3, lsl #24
+ldr r3, [r1, #-4]!
+orr r12, r12, r3, lsr #8
+str r12, [r0, #-4]!
+subs r2, r2, #4
+bge Lmemcpy_bsrcul1loop4
+
+Lmemcpy_bsrcul1l4:
+add r1, r1, #1
+b Lmemcpy_bl4
diff --git a/backends/gp32/portdefs.h b/backends/gp32/portdefs.h
index ecb918dea4..0408c56690 100644
--- a/backends/gp32/portdefs.h
+++ b/backends/gp32/portdefs.h
@@ -1,8 +1,8 @@
/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001 Ludvig Strigeus
- * Copyright (C) 2001/2004 The ScummVM project
+ * Copyright (C) 2001-2005 The ScummVM project
* Copyright (C) 2002 Ph0x - GP32 Backend
* Copyright (C) 2003/2004 DJWillis - GP32 Backend
+ * Copyright (C) 2005 Won Star - GP32 Backend
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -25,11 +25,6 @@
#ifndef PORTDEFS_H
#define PORTDEFS_H
-// Prevents error trying to call main() twice from within the program ;-).
-#ifndef REAL_MAIN
- #define main scummvm_main
-#endif /* REAL_MAIN */
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -38,28 +33,10 @@
#include <time.h>
#include <cctype>
-//??
-//#include <math.h>
-//#include <time.h>
-
-// GP32 SDK Includes
-#include <gpfont.h>
-#include <gpfont16.h>
-#include <gpfont_port.h>
-#include <gpgraphic.h>
-#include <gpgraphic16.h>
-#include <gpmm.h>
-#include <gpmem.h>
-#include <gpos_def.h>
-#include <gpstdio.h>
-#include <gpstdlib.h>
-#include <gpdef.h>
-
-#define size_t long unsigned int // SDK hack
-
-// Undefine SDK defs.
+#include "gp32std.h"
#undef byte
+
#undef malloc
#undef calloc
#undef free
@@ -68,106 +45,70 @@
#undef stdout
#undef stdin
-// Redefine SDK defs.
-typedef unsigned char u8;
-typedef signed char s8;
-typedef unsigned short u16;
-typedef short s16;
-typedef unsigned int u32;
-typedef int s32;
-typedef int time_t;
-
-extern int gpprintf(const char *fmt, ...);
-#define printf gpprintf
-
-extern void *gpmalloc(size_t size);
-extern void *gpcalloc(size_t nitems, size_t size);
-extern void gpfree(void *block);
-extern char *gpstrdup(const char *s);
-
-#define malloc gpmalloc
-#define calloc gpcalloc //gm_calloc
-//#define calloc gm_calloc
-#define free gpfree
-
-// #define memset gm_memset
-// #define memcopy gm_memcopy
-//
-// #define strcpy gm_strcpy // uncomment?
-// #define strncpy gm_strncpy
-// #define strcat gm_strcat
-// #define sprintf gm_sprintf
-
-#define strdup gpstrdup
+#undef fopen
+#undef fread
+#undef fwrite
+#undef fclose
+#undef ftell
+#undef rewind
+#undef fseek
-#define assert(e) ((e) ? 0 : (printf("!AS: " #e " (%s, %d)\n", __FILE__, __LINE__)))
-#define ASSERT assert
+#undef ferror
+#undef clearerr
-#define ENDLESSLOOP while (1)
+#undef feof
+#undef getc
+
+#define FILE GPFILE
+
+#define stderr gp_stderr
+#define stdout gp_stdout
+#define stdin gp_stdin
+
+#define fopen gp_fopen
+#define fread gp_fread
+#define fwrite gp_fwrite
+#define fclose gp_fclose
+#define fseek gp_fseek
+#define ftell gp_ftell
+#define ferror gp_ferror
+#define clearerr gp_clearerr
+
+#define feof gp_feof
+#define fgets gp_fgets
+#define fgetc gp_fgetc
+#define getc gp_fgetc
+
+#define fprintf gp_fprintf
+#define fflush gp_fflush
+
+#define printf gp_printf
+
+#define exit gp_exit
+
+#define strcpy gp_strcpy
+#define strncpy gp_strncpy
+#define strcat gp_strcat
+#define strdup gp_strdup
+#define sprintf gp_sprintf
+#define strcasecmp gp_strcasecmp
+#define strncasecmp gp_strncasecmp
+
+#define memcpy gp_memcpy
+#define memset gp_memset
+#define malloc gp_malloc
+#define calloc gp_calloc //gm_calloc
+#define free gp_free
+
+#define FUNCTION GPDEBUG("FUNC: %s", __FUNCTION__);
+
+#define DELAY gp_delay(500);
-#define FILE F_HANDLE
-extern FILE *fstderr;
-extern FILE *fstdout;
-extern FILE *fstdin;
-
-#define stderr fstderr
-#define stdout fstdout
-#define stdin fstdin
-
-extern FILE *gpfopen(const char *filename, const char *mode);
-extern int gpfclose(FILE *stream);
-extern int gpfseek(FILE *stream, long offset, int whence);
-extern size_t gpfread(void *ptr, size_t size, size_t n, FILE *stream);
-extern size_t gpfwrite(const void *ptr, size_t size, size_t n, FILE*stream);
-extern long gpftell(FILE *stream);
-extern void gpclearerr(FILE *stream);
-extern int gpfeof(FILE *stream);
-extern char *gpfgets(char *s, int n, FILE *stream);
-extern int gpfflush(FILE *stream);
-extern char gpfgetc(FILE *stream);
-
-#define fopen gpfopen
-#define fclose gpfclose
-#define fseek gpfseek
-#define fread gpfread
-#define fwrite gpfwrite
-#define ftell gpftell
-
-#undef clearerr
-#define clearerr gpclearerr
-
-#undef feof
-#define feof gpfeof
-#define fgets gpfgets
-#define fgetc gpfgetc
-#define getc gpfgetc
-
-extern int gpfprintf(FILE *stream, const char *fmt, ...);
-#define fprintf gpfprintf
-#define fflush gpfflush
-
-extern void gpexit(int code);
-#define exit gpexit
-//#define error printf
-
-//extern time_t gptime(time_t *timer);
-//#define time gptime
-
-// MARK Debug Point.
#define MARK printf("MARK: %s, %s, %d", __FILE__, __FUNCTION__, __LINE__);
-extern void *gpmemset (void *s, int c, size_t n);
-extern void *gpmemcpy (void *dest, const void *src, size_t n);
-//#define memset gpmemset
-//#define memcpy gpmemcpy
+#define assert(e) ((e) ? 0 : (printf("!AS: " #e " (%s, %d)\n", __FILE__, __LINE__)))
+#define ASSERT assert
-// Missing stuff
-int stricmp(const char *string1, const char *string2);
-int strnicmp(const char *string1, const char *string2, int len);
-inline float sin(float) { return 0; }
-inline float cos(float) { return 0; }
-inline float sqrt(float) { return 0; }
-inline float atan2(float, float) { return 0; }
+#define ENDLESSLOOP while (1)
-// EOF
#endif /* PORTDEFS_H */
diff --git a/backends/gp32/setup.h b/backends/gp32/setup.h
deleted file mode 100644
index 66da45b91e..0000000000
--- a/backends/gp32/setup.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001 Ludvig Strigeus
- * Copyright (C) 2001/2004 The ScummVM project
- * Copyright (C) 2002 Ph0x - GP32 Backend
- * Copyright (C) 2003/2004 DJWillis - GP32 Backend
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $Header$
- *
- */
-
-#ifndef SETUP_H
-#define SETUP_H
-
-#ifndef NULL
- #define NULL 0
-#endif
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// ScummVM/GP32 - Configuration front-end launcher and splash-screen stuff.
-// Also contains GP32 start-up code.
-// Not part of ScummVM backend as such.
-//
-/////////////////////////////////////////////////////////////////////////////
-
-#define MENU_MUSICDRV 0
-#define MENU_SCREENPOS 1
-#define MENU_CPUSPEED 2
-
-// OLD CONFIG
-// NULL marks end (FIXME)
-typedef struct {
- const char *option;
- const char **submenu;
- int index;
-} tmenu;
-
-const char *sautorun[] = {
-"NOT IMPLEMENTED",
-/*
-"Off",
-"On",
-*/
-//NULL
-};
-
-const char *ssounddrv[] = {
-"-eadlib",
-"-enull",
-NULL
-};
-
-const char *sscreenpos[] = {
-"Top",
-"Center",
-NULL
-};
-
-const char *scpuspeed[] = {
-"66",
-"100",
-"120",
-"132",
-"156",
-"166",
-"180",
-"200",
-NULL
-};
-
-const char *sbrightness[] = {
-"Normal",
-"Lighter",
-"Lightest",
-"Darker",
-"Darkest",
-NULL
-};
-
-tmenu menu[] = {
-{"Music Driver", ssounddrv, 0},
-{"Screen Position", sscreenpos, 1},
-{"CPU Speed (MHz)", scpuspeed, 3},
-};
-
-#else
- #warning GP32 LAUNCHER.H Called more then once.
-#endif /* SETUP_H */
diff --git a/backends/gp32/startup.c b/backends/gp32/startup.c
index b7f7e22862..86f69d7ba8 100644
--- a/backends/gp32/startup.c
+++ b/backends/gp32/startup.c
@@ -1,8 +1,8 @@
/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001 Ludvig Strigeus
- * Copyright (C) 2001/2004 The ScummVM project
+ * Copyright (C) 2001-2005 The ScummVM project
* Copyright (C) 2002 Ph0x - GP32 Backend
* Copyright (C) 2003/2004 DJWillis - GP32 Backend
+ * Copyright (C) 2005 Won Star - GP32 Backend
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -16,7 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header$
*
@@ -34,10 +34,6 @@
#include <gpmem.h>
#endif
-//#ifdef GP32_GDB
-// #include <gdb-stub.h>
-//#endif /*GP32_GDB*/
-
unsigned int HEAPSTART;
unsigned int HEAPEND;
@@ -45,11 +41,6 @@ void InitializeFont (void);
extern void GpKeyPollingTimeSet (int loop_cnt);
extern void GpMain(void *arg);
-//extern int OpenUSB ();
-//extern void InstallISR ();
-
-
-
int main (int arg_len, char * arg_v)
{
GM_HEAP_DEF gm_heap_def;