+
+for the most current information on the port and any updates to this
+documentation.
+
+------------------------------------------------------------------------
+Installing:
+
+This archive contains ScummVM in a PND format ready to be copied to the
+OpenPandora and used.
+
+To install just copy the .pnd file from this archive to your device.
+
+You will need to place the .pnd file in a suitable location on your SD
+card.
+
+/pandora/desktop <- place here if you wish the icon to show on the
+ desktop. Documentation will show in the menu.
+
+/pandora/menu <- place here if you wish the icon to show on the
+ Xfce menu. Documentation will show in the menu.
+
+/pandora/apps <- place here if you wish the icon to show on the
+ desktop and in the menu. Documentation will show
+ in the menu.
+
+------------------------------------------------------------------------
+Credits
+
+Core ScummVM code (c) The ScummVM Team
+OpenPandora backend (c) John Willis
+Detailed (c) information can be found within the source code
diff --git a/backends/platform/openpandora/build/build.sh b/backends/platform/openpandora/build/build.sh
new file mode 100755
index 0000000000..10b98fe092
--- /dev/null
+++ b/backends/platform/openpandora/build/build.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+echo Quick script to make building all the time less painful.
+
+. /usr/local/angstrom/arm/environment-setup
+
+CROSS_COMPILE=arm-angstrom-linux-gnueabi-
+export CROSS_COMPILE
+
+# Export the tool names for cross-compiling
+export CXX=arm-angstrom-linux-gnueabi-g++
+export CC=arm-angstrom-linux-gnueabi-gcc
+export DEFINES=-DNDEBUG
+
+cd ../../../..
+
+echo Building ScummVM/OpenPandora.
+make
+
+echo Build for OpenPandora complete - Please check build logs.
diff --git a/backends/platform/openpandora/build/bundle.sh b/backends/platform/openpandora/build/bundle.sh
new file mode 100755
index 0000000000..12d34380bc
--- /dev/null
+++ b/backends/platform/openpandora/build/bundle.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+. /usr/local/angstrom/arm/environment-setup
+
+CROSS_COMPILE=arm-angstrom-linux-gnueabi-
+export CROSS_COMPILE
+
+echo Quick script to make building a distribution of the OpenPanodra backend more consistent.
+
+cd ../../../..
+
+make op-bundle
+make op-pnd
diff --git a/backends/platform/openpandora/build/clean.sh b/backends/platform/openpandora/build/clean.sh
new file mode 100755
index 0000000000..3574db2298
--- /dev/null
+++ b/backends/platform/openpandora/build/clean.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+echo Quick script to make building all the time less painful.
+
+. /usr/local/angstrom/arm/environment-setup
+
+cd ../../../..
+
+echo Cleaning ScummVM for the OpenPandora.
+make clean
diff --git a/backends/platform/openpandora/build/config-alleng.sh b/backends/platform/openpandora/build/config-alleng.sh
new file mode 100755
index 0000000000..cd9a17ef40
--- /dev/null
+++ b/backends/platform/openpandora/build/config-alleng.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+echo Quick script to make running configure all the time less painful
+echo and let all the build work be done from the backend/build folder.
+
+. /usr/local/angstrom/arm/environment-setup
+
+CROSS_COMPILE=arm-angstrom-linux-gnueabi-
+export CROSS_COMPILE
+
+# Export the tool names for cross-compiling
+export CXX=arm-angstrom-linux-gnueabi-g++
+export CPPFLAGS=-I/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/include
+export LDFLAGS=-L/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/lib
+
+export DEFINES=-DNDEBUG
+
+# Edit the configure line to suit.
+cd ../../../..
+./configure --backend=openpandora --host=openpandora --disable-nasm --with-sdl-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/bin --with-mpeg2-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --disable-vorbis --enable-tremor --with-tremor-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --enable-zlib --with-zlib-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --enable-mad --with-mad-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --enable-all-engines --enable-plugins --default-dynamic
+
+echo Generating config for OpenPandora complete. Check for errors.
diff --git a/backends/platform/openpandora/build/config.sh b/backends/platform/openpandora/build/config.sh
new file mode 100755
index 0000000000..8be16f1317
--- /dev/null
+++ b/backends/platform/openpandora/build/config.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+echo Quick script to make running configure all the time less painful
+echo and let all the build work be done from the backend/build folder.
+
+. /usr/local/angstrom/arm/environment-setup
+
+CROSS_COMPILE=arm-angstrom-linux-gnueabi-
+export CROSS_COMPILE
+
+# Export the tool names for cross-compiling
+export CXX=arm-angstrom-linux-gnueabi-g++
+export CPPFLAGS=-I/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/include
+export LDFLAGS=-L/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/lib
+
+export DEFINES=-DNDEBUG
+
+# Edit the configure line to suit.
+cd ../../../..
+./configure --backend=openpandora --host=openpandora --disable-nasm --with-sdl-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/bin --with-mpeg2-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --disable-vorbis --enable-tremor --with-tremor-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --enable-zlib --with-zlib-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --enable-mad --with-mad-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --enable-plugins --default-dynamic
+
+echo Generating config for OpenPandora complete. Check for errors.
diff --git a/backends/platform/openpandora/build/icon/preview-pic.png b/backends/platform/openpandora/build/icon/preview-pic.png
new file mode 100755
index 0000000000..2f4a536d30
Binary files /dev/null and b/backends/platform/openpandora/build/icon/preview-pic.png differ
diff --git a/backends/platform/openpandora/build/icon/scummvm.png b/backends/platform/openpandora/build/icon/scummvm.png
new file mode 100755
index 0000000000..128e59efc4
Binary files /dev/null and b/backends/platform/openpandora/build/icon/scummvm.png differ
diff --git a/backends/platform/openpandora/build/index.html b/backends/platform/openpandora/build/index.html
new file mode 100755
index 0000000000..34d381d0f8
--- /dev/null
+++ b/backends/platform/openpandora/build/index.html
@@ -0,0 +1,26 @@
+
+
+
+
Welcome to the ScummVM!
+
+
+
+
ScummVM: OpenPandora Specific Documentation
+
+
+ScummVM OpenPandora README
+ScummVM OpenPandora Website
+ScummVM OpenPandora WiKi
+
+
+
ScummVM: General Documentation
+
+
+ScummVM website
+ScummVM README
+ScummVM NEWS
+ScummVM Authors
+ScummVM Copyright
+GPL Licence
+
+
diff --git a/backends/platform/openpandora/build/pnd_make.sh b/backends/platform/openpandora/build/pnd_make.sh
new file mode 100755
index 0000000000..dcdcaceecd
--- /dev/null
+++ b/backends/platform/openpandora/build/pnd_make.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+######adjust path of genpxml.sh if you want to use that "feture"#####
+
+TEMP=`getopt -o p:d:x:i:c -- "$@"`
+
+if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
+
+eval set -- "$TEMP"
+while true ; do
+ case "$1" in
+ -p) echo "PNDNAME set to $2" ;PNDNAME=$2;shift 2;;
+ -d) echo "FOLDER set to $2" ;FOLDER=$2;shift 2 ;;
+ -x) echo "PXML set to $2" ;PXML=$2;shift 2 ;;
+ -i) echo "ICON set to $2" ;ICON=$2;shift 2 ;;
+ -c) echo "-c set, will create compressed squasfs image instead of iso $2" ;SQUASH=1;shift 1 ;;
+ --) shift ; break ;;
+ *) echo "Error while parsing arguments! $2" ; exit 1 ;;
+ esac
+done
+
+rnd=$RANDOM; # random number for genpxml and index$rnd.xml
+
+#generate pxml if guess or empty
+if [ ! $PXML ] || [ $PXML = "guess" ] && [ $PNDNAME ] && [ $FOLDER ]; then
+ PXMLtxt=$(/home/user/libpnd/pandora-libraries/testdata/scripts/genpxml.sh $FOLDER $ICON)
+ PXML=$FOLDER/PXML.xml
+ echo "$PXMLtxt" > $FOLDER/PXML.xml
+fi
+
+#check arguments
+if [ ! $PNDNAME ] || [ ! $FOLDER ] || [ ! $PXML ]; then
+ echo " Usage: pnd_make.sh -p your.pnd -d folder/containing/your/app/ -x
+ your.pxml (or \"guess\" to try to generate it from the folder) -i icon.png"
+ exit 1
+fi
+if [ ! -d $FOLDER ]; then echo "$FOLDER doesnt exist"; exit 1; fi #check if folder actually exists
+if [ ! -f $PXML ]; then echo "$PXML doesnt exist"; exit 1; fi #check if pxml actually exists
+
+#make iso from folder
+if [ ! $SQUASH ]; then
+ mkisofs -o $PNDNAME.iso -R $FOLDER
+else
+ if [ $(mksquashfs -version | awk '{if ($3 >= 4) print 1}') = 1 ]; then
+ echo "your squashfs version is older then version 4, please upgrade to 4.0 or later"
+ exit 1
+ fi
+ mksquashfs -no-recovery -nopad $FOLDER $PNDNAME.iso
+fi
+#append pxml to iso
+cat $PNDNAME.iso $PXML > $PNDNAME
+rm $PNDNAME.iso #cleanup
+
+#append icon if specified
+if [ $ICON ]; then # check if we want to add an icon
+ if [ ! -f $ICON ]; then #does the icon actually exist?
+ echo "$ICON doesnt exist"
+ else # yes
+ mv $PNDNAME $PNDNAME.tmp
+ cat $PNDNAME.tmp $ICON > $PNDNAME # append icon
+ rm $PNDNAME.tmp #cleanup
+ fi
+fi
+
+if [ $PXML = "guess" ];then rm $FOLDER/PXML.xml; fi #cleanup
diff --git a/backends/platform/openpandora/build/runscummvm.sh b/backends/platform/openpandora/build/runscummvm.sh
new file mode 100755
index 0000000000..0745bb41fd
--- /dev/null
+++ b/backends/platform/openpandora/build/runscummvm.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# Make sure any extra libs not in the firmware are pulled in.
+LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:../lib
+export LD_LIBRARY_PATH
+
+# Ensure we have a folder to store save games on the SD card.
+mkdir saves
+
+# make a runtime dir, just incase it creates anything in CWD
+mkdir runtime
+cd runtime
+
+../bin/scummvm --fullscreen --gfx-mode=2x --config=scummvmrc --extrapath=../data --savepath=../saves
diff --git a/backends/platform/openpandora/module.mk b/backends/platform/openpandora/module.mk
new file mode 100755
index 0000000000..c8a4b1b32d
--- /dev/null
+++ b/backends/platform/openpandora/module.mk
@@ -0,0 +1,15 @@
+MODULE := backends/platform/openpandora
+
+MODULE_OBJS := \
+ op-graphics.o \
+ op-events.o \
+ op-main.o
+
+MODULE_DIRS += \
+ backends/platform/openpandora/
+
+# We don't use the rules.mk here on purpose
+OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)
+
+# Hack to ensure the SDL backend is built so we can use OSystem_SDL.
+-include $(srcdir)/backends/platform/sdl/module.mk
\ No newline at end of file
diff --git a/backends/platform/openpandora/op-bundle.mk b/backends/platform/openpandora/op-bundle.mk
new file mode 100755
index 0000000000..a08d64a643
--- /dev/null
+++ b/backends/platform/openpandora/op-bundle.mk
@@ -0,0 +1,85 @@
+# Special target to create bundles and PND's for the OpenPandora.
+
+#bundle_name = release/scummvm-op-`date '+%Y-%m-%d'`
+bundle_name = release/scummvm-op
+f=$(shell which $(STRIP))
+libloc = $(shell dirname $(f))
+
+op-bundle: $(EXECUTABLE)
+ $(MKDIR) "$(bundle_name)"
+ $(MKDIR) "$(bundle_name)/scummvm"
+ $(MKDIR) "$(bundle_name)/scummvm/bin"
+ $(MKDIR) "$(bundle_name)/scummvm/data"
+ $(MKDIR) "$(bundle_name)/scummvm/docs"
+ $(MKDIR) "$(bundle_name)/scummvm/icon"
+ $(MKDIR) "$(bundle_name)/scummvm/lib"
+
+ $(CP) $(srcdir)/backends/platform/openpandora/build/runscummvm.sh $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/openpandora/build/PXML.xml $(bundle_name)/scummvm/data/
+
+ $(CP) $(srcdir)/backends/platform/openpandora/build/icon/scummvm.png $(bundle_name)/scummvm/icon/
+ $(CP) $(srcdir)/backends/platform/openpandora/build/icon/preview-pic.png $(bundle_name)/scummvm/icon/
+
+
+ $(CP) $(srcdir)/backends/platform/openpandora/build/README-OPENPANDORA $(bundle_name)/scummvm/docs/
+ $(CP) $(srcdir)/backends/platform/openpandora/build/index.html $(bundle_name)/scummvm/docs/
+
+ $(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/docs/
+
+ $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/data/
+ $(INSTALL) -c -m 644 $(DIST_FILES_ENGINEDATA) $(bundle_name)/scummvm/data/
+
+ $(STRIP) $(EXECUTABLE) -o $(bundle_name)/scummvm/bin/$(EXECUTABLE)
+
+ifdef DYNAMIC_MODULES
+ $(INSTALL) -d "$(bundle_name)/scummvm/plugins"
+ $(INSTALL) -c -m 644 $(PLUGINS) "$(bundle_name)/scummvm/plugins"
+ $(STRIP) $(bundle_name)/scummvm/plugins/*
+endif
+
+ $(CP) $(libloc)/../arm-angstrom-linux-gnueabi/usr/lib/libFLAC.so.8.2.0 $(bundle_name)/scummvm/lib/libFLAC.so.8
+ tar -C $(bundle_name) -cvjf $(bundle_name).tar.bz2 .
+ rm -R ./$(bundle_name)
+
+op-pnd: $(EXECUTABLE)
+ $(MKDIR) "$(bundle_name)"
+ $(MKDIR) "$(bundle_name)/scummvm"
+ $(MKDIR) "$(bundle_name)/scummvm/bin"
+ $(MKDIR) "$(bundle_name)/scummvm/data"
+ $(MKDIR) "$(bundle_name)/scummvm/docs"
+ $(MKDIR) "$(bundle_name)/scummvm/icon"
+ $(MKDIR) "$(bundle_name)/scummvm/lib"
+
+ $(CP) $(srcdir)/backends/platform/openpandora/build/runscummvm.sh $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/openpandora/build/PXML.xml $(bundle_name)/scummvm/data/
+
+ $(CP) $(srcdir)/backends/platform/openpandora/build/icon/scummvm.png $(bundle_name)/scummvm/icon/
+ $(CP) $(srcdir)/backends/platform/openpandora/build/icon/preview-pic.png $(bundle_name)/scummvm/icon/
+
+
+ $(CP) $(srcdir)/backends/platform/openpandora/build/README-OPENPANDORA $(bundle_name)/scummvm/docs/
+ $(CP) $(srcdir)/backends/platform/openpandora/build/index.html $(bundle_name)/scummvm/docs/
+
+ $(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/docs/
+
+ $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/data/
+ $(INSTALL) -c -m 644 $(DIST_FILES_ENGINEDATA) $(bundle_name)/scummvm/data/
+
+ $(STRIP) $(EXECUTABLE) -o $(bundle_name)/scummvm/bin/$(EXECUTABLE)
+
+ifdef DYNAMIC_MODULES
+ $(INSTALL) -d "$(bundle_name)/scummvm/plugins"
+ $(INSTALL) -c -m 644 $(PLUGINS) "$(bundle_name)/scummvm/plugins"
+ $(STRIP) $(bundle_name)/scummvm/plugins/*
+endif
+
+ $(CP) $(libloc)/../arm-angstrom-linux-gnueabi/usr/lib/libFLAC.so.8.2.0 $(bundle_name)/scummvm/lib/libFLAC.so.8
+
+ $(srcdir)/backends/platform/openpandora/build/pnd_make.sh -p $(bundle_name).pnd -d $(bundle_name)/scummvm -x $(bundle_name)/scummvm/data/PXML.xml -i $(bundle_name)/scummvm/icon/scummvm.png
+
+ $(CP) $(srcdir)/backends/platform/openpandora/build/README-PND.txt $(bundle_name)
+ tar -cvjf $(bundle_name)-pnd.tar.bz2 $(bundle_name).pnd $(bundle_name)/README-PND.txt
+ rm -R ./$(bundle_name)
+# rm $(bundle_name).pnd
+
+.PHONY: op-bundle op-pnd
diff --git a/backends/platform/openpandora/op-events.cpp b/backends/platform/openpandora/op-events.cpp
new file mode 100755
index 0000000000..b1caa7bb8a
--- /dev/null
+++ b/backends/platform/openpandora/op-events.cpp
@@ -0,0 +1,182 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+/*
+ * OpenPandora: Device Specific Event Handling.
+ *
+ */
+
+#include "backends/platform/openpandora/op-sdl.h"
+
+bool OSystem_OP::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
+ if (ev.button.button == SDL_BUTTON_LEFT){
+ SDLMod mod=SDL_GetModState();
+ if (mod & KMOD_RCTRL) /* KMOD_RCTRL = Right Trigger */
+ event.type = Common::EVENT_RBUTTONDOWN;
+ else if ( mod & KMOD_RSHIFT) /* KMOD_RSHIFT = Left Trigger */
+ event.type = Common::EVENT_MOUSEMOVE;
+ else
+ event.type = Common::EVENT_LBUTTONDOWN;
+ }
+ else if (ev.button.button == SDL_BUTTON_RIGHT)
+ event.type = Common::EVENT_RBUTTONDOWN;
+#if defined(SDL_BUTTON_WHEELUP) && defined(SDL_BUTTON_WHEELDOWN)
+ else if (ev.button.button == SDL_BUTTON_WHEELUP)
+ event.type = Common::EVENT_WHEELUP;
+ else if (ev.button.button == SDL_BUTTON_WHEELDOWN)
+ event.type = Common::EVENT_WHEELDOWN;
+#endif
+#if defined(SDL_BUTTON_MIDDLE)
+ else if (ev.button.button == SDL_BUTTON_MIDDLE)
+ event.type = Common::EVENT_MBUTTONDOWN;
+#endif
+ else
+ return false;
+
+ // People can use the touchscreen so may have no mouse motion events between taps.
+ // Not sure if this fixes anything ;).
+ // setMousePos(event.mouse.x, event.mouse.y);
+
+ fillMouseEvent(event, ev.button.x, ev.button.y);
+
+ return true;
+}
+
+bool OSystem_OP::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
+ if (ev.button.button == SDL_BUTTON_LEFT){
+ SDLMod mod=SDL_GetModState();
+ if (mod & KMOD_RCTRL) /* KMOD_RCTRL = Right Trigger */
+ event.type = Common::EVENT_RBUTTONUP;
+ else if ( mod & KMOD_RSHIFT) /* KMOD_RSHIFT = Left Trigger */
+ event.type = Common::EVENT_MOUSEMOVE;
+ else
+ event.type = Common::EVENT_LBUTTONUP;
+ }
+ else if (ev.button.button == SDL_BUTTON_RIGHT)
+ event.type = Common::EVENT_RBUTTONUP;
+#if defined(SDL_BUTTON_MIDDLE)
+ else if (ev.button.button == SDL_BUTTON_MIDDLE)
+ event.type = Common::EVENT_MBUTTONUP;
+#endif
+ else
+ return false;
+
+ fillMouseEvent(event, ev.button.x, ev.button.y);
+
+ return true;
+}
+
+
+bool OSystem_OP::handleMouseMotion(SDL_Event &ev, Common::Event &event) {
+ event.type = Common::EVENT_MOUSEMOVE;
+ fillMouseEvent(event, ev.motion.x, ev.motion.y);
+
+ setMousePos(event.mouse.x, event.mouse.y);
+ return true;
+}
+
+void OSystem_OP::warpMouse(int x, int y) {
+ if (_mouseCurState.x != x || _mouseCurState.y != y) {
+ SDL_WarpMouse(x, y);
+
+ // SDL_WarpMouse() generates a mouse movement event, so
+ // set_mouse_pos() would be called eventually. However, the
+ // cannon script in CoMI calls this function twice each time
+ // the cannon is reloaded. Unless we update the mouse position
+ // immediately the second call is ignored, causing the cannon
+ // to change its aim.
+
+ setMousePos(x, y);
+ }
+}
+
+void OSystem_OP::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;
+ }
+ }
+
+ _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((Uint16)_km.x, (Uint16)_km.y);
+ }
+ }
+}
diff --git a/backends/platform/openpandora/op-graphics.cpp b/backends/platform/openpandora/op-graphics.cpp
new file mode 100755
index 0000000000..4abe034ae4
--- /dev/null
+++ b/backends/platform/openpandora/op-graphics.cpp
@@ -0,0 +1,40 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "backends/platform/openpandora/op-sdl.h"
+
+bool OSystem_OP::loadGFXMode() {
+ _videoMode.overlayWidth = 800;
+ _videoMode.overlayHeight = 480;
+ _videoMode.fullscreen = true;
+
+ if (_videoMode.screenHeight != 200 && _videoMode.screenHeight != 400)
+ _videoMode.aspectRatioCorrection = false;
+
+ OSystem_SDL::loadGFXMode();
+
+ return true;
+
+}
diff --git a/backends/platform/openpandora/op-main.cpp b/backends/platform/openpandora/op-main.cpp
new file mode 100755
index 0000000000..71aa0b99f6
--- /dev/null
+++ b/backends/platform/openpandora/op-main.cpp
@@ -0,0 +1,206 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "common/scummsys.h"
+#include
+
+#include "backends/platform/openpandora/op-sdl.h"
+#include "backends/plugins/posix/posix-provider.h"
+#include "base/main.h"
+
+#include "common/archive.h"
+#include "common/config-manager.h"
+#include "common/debug.h"
+#include "common/events.h"
+#include "common/util.h"
+
+#include "common/file.h"
+#include "base/main.h"
+
+#include "backends/saves/default/default-saves.h"
+
+#include "backends/timer/default/default-timer.h"
+#include "sound/mixer_intern.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include // for getTimeAndDate()
+
+/* Dump console info to files. */
+#define DUMP_STDOUT
+
+int main(int argc, char *argv[]) {
+
+ g_system = new OSystem_OP();
+ assert(g_system);
+
+#ifdef DYNAMIC_MODULES
+ PluginManager::instance().addPluginProvider(new POSIXPluginProvider());
+#endif
+
+ // Invoke the actual ScummVM main entry point:
+ int res = scummvm_main(argc, argv);
+ g_system->quit();
+
+ return res;
+}
+
+void OSystem_OP::initBackend() {
+
+ /* Setup default save path to be workingdir/saves */
+
+ char savePath[PATH_MAX+1];
+ char workDirName[PATH_MAX+1];
+
+ if (getcwd(workDirName, PATH_MAX) == NULL) {
+ error("Could not obtain current working directory.");
+ } else {
+ printf("Current working directory: %s\n", workDirName);
+ }
+
+ strcpy(savePath, workDirName);
+ strcat(savePath, "/../saves");
+ printf("Current save directory: %s\n", savePath);
+ struct stat sb;
+ if (stat(savePath, &sb) == -1)
+ if (errno == ENOENT) // Create the dir if it does not exist
+ if (mkdir(savePath, 0755) != 0)
+ warning("mkdir for '%s' failed!", savePath);
+
+ _savefile = new DefaultSaveFileManager(savePath);
+
+ #ifdef DUMP_STDOUT
+ // The OpenPandora has a serial console on the EXT connection but most users do not use this so we
+ // output all our STDOUT and STDERR to files for debug purposes.
+ char STDOUT_FILE[PATH_MAX+1];
+ char STDERR_FILE[PATH_MAX+1];
+
+ strcpy(STDOUT_FILE, workDirName);
+ strcpy(STDERR_FILE, workDirName);
+ strcat(STDOUT_FILE, "/../scummvm.stdout.txt");
+ strcat(STDERR_FILE, "/../scummvm.stderr.txt");
+
+ // Flush the output in case anything is queued
+ fclose(stdout);
+ fclose(stderr);
+
+ // Redirect standard input and standard output
+ FILE *newfp = freopen(STDOUT_FILE, "w", stdout);
+ if (newfp == NULL) {
+ #if !defined(stdout)
+ stdout = fopen(STDOUT_FILE, "w");
+ #else
+ newfp = fopen(STDOUT_FILE, "w");
+ if (newfp) {
+ *stdout = *newfp;
+ }
+ #endif
+ }
+
+ newfp = freopen(STDERR_FILE, "w", stderr);
+ if (newfp == NULL) {
+ #if !defined(stderr)
+ stderr = fopen(STDERR_FILE, "w");
+ #else
+ newfp = fopen(STDERR_FILE, "w");
+ if (newfp) {
+ *stderr = *newfp;
+ }
+ #endif
+ }
+
+ setbuf(stderr, NULL);
+ printf("%s\n", "Debug: STDOUT and STDERR redirected to text files.");
+ #endif /* DUMP_STDOUT */
+
+ /* Trigger autosave every 4 minutes. */
+ ConfMan.registerDefault("autosave_period", 4 * 60);
+
+ /* Make sure that aspect ratio correction is enabled on the 1st run to stop
+ users asking me what the 'wasted space' at the bottom is ;-). */
+ ConfMan.registerDefault("aspect_ratio", true);
+
+ /* Make sure that aspect ratio correction is enabled on the 1st run to stop
+ users asking me what the 'wasted space' at the bottom is ;-). */
+ ConfMan.registerDefault("desired_screen_aspect_ratio", "5/4" );
+
+ /* Make sure SDL knows that we have a joystick we want to use. */
+ ConfMan.setInt("joystick_num", 0);
+
+ printf("%s\n", "Passing to OSystem::SDL initBackend.");
+
+ /* Pass to SDL backend to do the heavy lifting */
+ OSystem_SDL::initBackend();
+}
+
+void OSystem_OP::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
+
+ /* Setup default extra data paths for engine data files and plugins */
+ char workDirName[PATH_MAX+1];
+
+ if (getcwd(workDirName, PATH_MAX) == NULL) {
+ error("Error: Could not obtain current working directory.");
+ }
+
+ Common::FSNode workdirNode(workDirName);
+ if (workdirNode.exists() && workdirNode.isDirectory()) {
+ s.add("__OPENPANDORA_WORKDIR__", new Common::FSDirectory(workDirName), priority);
+ }
+
+ char enginedataPath[PATH_MAX+1];
+
+ strcpy(enginedataPath, workDirName);
+ strcat(enginedataPath, "./../data");
+
+ Common::FSNode engineNode(enginedataPath);
+ if (engineNode.exists() && engineNode.isDirectory()) {
+ s.add("__OPENPANDORA_ENGDATA__", new Common::FSDirectory(enginedataPath), priority);
+ }
+
+ char pluginsPath[PATH_MAX+1];
+
+ strcpy(pluginsPath, workDirName);
+ strcat(pluginsPath, "./../plugins");
+
+ Common::FSNode pluginsNode(pluginsPath);
+ if (pluginsNode.exists() && pluginsNode.isDirectory()) {
+ s.add("__OPENPANDORA_PLUGINS__", new Common::FSDirectory(pluginsPath), priority);
+ }
+}
+
+void OSystem_OP::quit() {
+
+ #ifdef DUMP_STDOUT
+ printf("%s\n", "Debug: STDOUT and STDERR text files closed.");
+ fclose(stdout);
+ fclose(stderr);
+ #endif /* DUMP_STDOUT */
+
+ OSystem_SDL::quit();
+}
diff --git a/backends/platform/openpandora/op-sdl.h b/backends/platform/openpandora/op-sdl.h
new file mode 100755
index 0000000000..5fd9bf4ed4
--- /dev/null
+++ b/backends/platform/openpandora/op-sdl.h
@@ -0,0 +1,73 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef OP_SDL_H
+#define OP_SDL_H
+
+#include "backends/platform/sdl/sdl.h"
+
+#define __OPENPANDORA__
+#define MIXER_DOUBLE_BUFFERING 1
+
+#ifndef PATH_MAX
+ #define PATH_MAX 255
+#endif
+
+class OSystem_OP : public OSystem_SDL {
+public:
+ OSystem_OP() {}
+
+ /* Events */
+ bool handleMouseButtonDown(SDL_Event &ev, Common::Event &event);
+ bool handleMouseButtonUp(SDL_Event &ev, Common::Event &event);
+ bool handleMouseMotion(SDL_Event &ev, Common::Event &event);
+ void warpMouse(int, int);
+ void handleKbdMouse();
+
+ /* Graphics */
+// void initSize(uint w, uint h);
+// void setGraphicsModeIntern();
+// bool setGraphicsMode(int mode);
+// void internUpdateScreen();
+// const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
+// bool setGraphicsMode(const char *name);
+// int getDefaultGraphicsMode() const;
+ bool loadGFXMode();
+// void drawMouse();
+// void undrawMouse();
+// void showOverlay();
+// void hideOverlay();
+
+// void warpMouse(int, int);
+
+ /* Platform Setup Stuff */
+ void addSysArchivesToSearchSet(Common::SearchSet &s, int priority);
+ void initBackend();
+ void quit();
+
+protected:
+
+};
+#endif
--
cgit v1.2.3
From 2e1b4278e2aa188e67c20b88d78260fd6dd6b429 Mon Sep 17 00:00:00 2001
From: John Willis
Date: Mon, 6 Sep 2010 17:28:17 +0000
Subject: SDL: Add masks to the SDL backend to support the OpenPandora backend.
svn-id: r52599
---
backends/platform/sdl/graphics.cpp | 4 ++--
backends/platform/sdl/main.cpp | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp
index 9bf71d1c33..69144dcc01 100644
--- a/backends/platform/sdl/graphics.cpp
+++ b/backends/platform/sdl/graphics.cpp
@@ -539,7 +539,7 @@ bool OSystem_SDL::loadGFXMode() {
assert(_inited);
_forceFull = true;
-#if !defined(__MAEMO__) && !defined(GP2XWIZ) && !defined(LINUXMOTO) && !defined(DINGUX)
+#if !defined(__MAEMO__) && !defined(GP2XWIZ) && !defined(LINUXMOTO) && !defined(DINGUX) && !defined(OPENPANDORA)
_videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
_videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
@@ -785,7 +785,7 @@ void OSystem_SDL::internUpdateScreen() {
#endif
// If the shake position changed, fill the dirty area with blackness
- if (_currentShakePos != _newShakePos ||
+ if (_currentShakePos != _newShakePos ||
(_mouseNeedsRedraw && _mouseBackup.y <= _currentShakePos)) {
SDL_Rect blackrect = {0, 0, _videoMode.screenWidth * _videoMode.scaleFactor, _newShakePos * _videoMode.scaleFactor};
diff --git a/backends/platform/sdl/main.cpp b/backends/platform/sdl/main.cpp
index 9d116d325a..c27ccc09d4 100644
--- a/backends/platform/sdl/main.cpp
+++ b/backends/platform/sdl/main.cpp
@@ -38,7 +38,7 @@
// Several SDL based ports use a custom main, and hence do not want to compile
// of this file. The following "#if" ensures that.
-#if !defined(__MAEMO__) && !defined(_WIN32_WCE) && !defined(GP2XWIZ)&& !defined(LINUXMOTO) && !defined(__SYMBIAN32__) && !defined(DINGUX)
+#if !defined(__MAEMO__) && !defined(_WIN32_WCE) && !defined(CAANOO) && !defined(GP2XWIZ) && !defined(LINUXMOTO) && !defined(OPENPANDORA) && !defined(__SYMBIAN32__) && !defined(DINGUX)
#include "backends/platform/sdl/sdl.h"
--
cgit v1.2.3
From fd407eeca3f2d50bc1a005bbcfd171369daa4f5f Mon Sep 17 00:00:00 2001
From: John Willis
Date: Tue, 7 Sep 2010 14:17:31 +0000
Subject: GP2XWIZ: Refactor backend.
* Add support for TouchScreen 'Tap Modes'
Left Click, Right Click and Hover.
* Rename OSystem_GP2XWIZ to OSystem_GPH to
start the work on supporting a unified
backend codebase for the GP2X, Wiz and
Caanoo.
* Sort out bugs in Caanoo input code.
* Rework GP2XWiz input code to support
switching new TouchScreen modes.
svn-id: r52619
---
backends/platform/gp2xwiz/gp2xwiz-events.cpp | 463 ++++++++++++-------------
backends/platform/gp2xwiz/gp2xwiz-graphics.cpp | 28 +-
backends/platform/gp2xwiz/gp2xwiz-hw.cpp | 25 ++
backends/platform/gp2xwiz/gp2xwiz-hw.h | 17 +
backends/platform/gp2xwiz/gp2xwiz-main.cpp | 8 +-
backends/platform/gp2xwiz/gp2xwiz-sdl.h | 10 +-
6 files changed, 281 insertions(+), 270 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/gp2xwiz/gp2xwiz-events.cpp b/backends/platform/gp2xwiz/gp2xwiz-events.cpp
index 19ef24ef58..1f603b4a3d 100644
--- a/backends/platform/gp2xwiz/gp2xwiz-events.cpp
+++ b/backends/platform/gp2xwiz/gp2xwiz-events.cpp
@@ -24,7 +24,7 @@
*/
/*
- * GP2X Wiz: Device Specific Event Handling.
+ * GPH: Device Specific Event Handling.
*
*/
@@ -35,33 +35,91 @@
#include "common/util.h"
#include "common/events.h"
-// FIXME move joystick defines out and replace with confile file options
-// we should really allow users to map any key to a joystick button using the keymapper.
#define JOY_DEADZONE 2200
#define JOY_XAXIS 0
#define JOY_YAXIS 1
-/* GP2X Wiz: Main Joystick Mappings */
+/* Quick default button states for modifiers. */
+int BUTTON_STATE_L = false;
+
+#if defined(CAANOO)
+
+ /* Caanoo: Main Joystick Button Mappings */
+ /* The Caanoo has an analogue stick so no digital DPAD */
+ enum {
+ /* Joystick Buttons */
+ BUTTON_A = 0,
+ BUTTON_X = 1,
+ BUTTON_B = 2,
+ BUTTON_Y = 3,
+ BUTTON_L = 4,
+ BUTTON_R = 5,
+ BUTTON_HOME = 6, // Home
+ BUTTON_HOLD = 7, // Hold (on Power)
+ BUTTON_HELP = 8, // Help I
+ BUTTON_HELP2 = 9, // Help II
+ BUTTON_CLICK = 10 // Stick Click
+ };
+
+ enum {
+ /* Unused Joystick Buttons on the Caanoo */
+ BUTTON_VOLUP = 51,
+ BUTTON_VOLDOWN = 52,
+ BUTTON_UP = 53,
+ BUTTON_UPLEFT = 54,
+ BUTTON_LEFT = 55,
+ BUTTON_DOWNLEFT = 56,
+ BUTTON_DOWN = 57,
+ BUTTON_DOWNRIGHT = 58,
+ BUTTON_RIGHT = 59,
+ BUTTON_UPRIGHT = 60,
+ BUTTON_MENU = 61,
+ BUTTON_SELECT = 62
+ };
+
+#else
+
+ /* Wiz: Main Joystick Mappings */
+ enum {
+ /* DPAD */
+ BUTTON_UP = 0,
+ BUTTON_UPLEFT = 1,
+ BUTTON_LEFT = 2,
+ BUTTON_DOWNLEFT = 3,
+ BUTTON_DOWN = 4,
+ BUTTON_DOWNRIGHT = 5,
+ BUTTON_RIGHT = 6,
+ BUTTON_UPRIGHT = 7,
+ /* Joystick Buttons */
+ BUTTON_MENU = 8,
+ BUTTON_SELECT = 9,
+ BUTTON_L = 10,
+ BUTTON_R = 11,
+ BUTTON_A = 12,
+ BUTTON_B = 13,
+ BUTTON_X = 14,
+ BUTTON_Y = 15,
+ BUTTON_VOLUP = 16,
+ BUTTON_VOLDOWN = 17
+ };
+
+ enum {
+ /* Unused Joystick Buttons on the Wiz */
+ BUTTON_HOME = 51,
+ BUTTON_HOLD = 52,
+ BUTTON_CLICK = 53,
+ BUTTON_HELP = 54,
+ BUTTON_HELP2 = 55
+ };
+
+#endif
+
enum {
- GP2X_BUTTON_UP = 0,
- GP2X_BUTTON_UPLEFT = 1,
- GP2X_BUTTON_LEFT = 2,
- GP2X_BUTTON_DOWNLEFT = 3,
- GP2X_BUTTON_DOWN = 4,
- GP2X_BUTTON_DOWNRIGHT = 5,
- GP2X_BUTTON_RIGHT = 6,
- GP2X_BUTTON_UPRIGHT = 7,
- GP2X_BUTTON_MENU = 8,
- GP2X_BUTTON_SELECT = 9,
- GP2X_BUTTON_L = 10,
- GP2X_BUTTON_R = 11,
- GP2X_BUTTON_A = 12,
- GP2X_BUTTON_B = 13,
- GP2X_BUTTON_X = 14,
- GP2X_BUTTON_Y = 15,
- GP2X_BUTTON_VOLUP = 16,
- GP2X_BUTTON_VOLDOWN = 17
+ /* Touchscreen TapMode */
+ TAPMODE_LEFT = 0,
+ TAPMODE_RIGHT = 1,
+ TAPMODE_HOVER = 2
};
static int mapKey(SDLKey key, SDLMod mod, Uint16 unicode) {
@@ -81,7 +139,8 @@ static int mapKey(SDLKey key, SDLMod mod, Uint16 unicode) {
return key;
}
-void OSystem_GP2XWIZ::fillMouseEvent(Common::Event &event, int x, int y) {
+
+void OSystem_GPH::fillMouseEvent(Common::Event &event, int x, int y) {
if (_videoMode.mode == GFX_HALF && !_overlayVisible){
event.mouse.x = x*2;
event.mouse.y = y*2;
@@ -103,19 +162,8 @@ void OSystem_GP2XWIZ::fillMouseEvent(Common::Event &event, int x, int y) {
}
}
-static byte SDLModToOSystemKeyFlags(SDLMod mod) {
- byte b = 0;
- if (mod & KMOD_SHIFT)
- b |= Common::KBD_SHIFT;
- if (mod & KMOD_ALT)
- b |= Common::KBD_ALT;
- if (mod & KMOD_CTRL)
- b |= Common::KBD_CTRL;
- return b;
-}
-
-void OSystem_GP2XWIZ::moveStick() {
+void OSystem_GPH::moveStick() {
bool stickBtn[32];
memcpy(stickBtn, _stickBtn, sizeof(stickBtn));
@@ -140,7 +188,6 @@ void OSystem_GP2XWIZ::moveStick() {
_km.x_down_count = 0;
}
-
if ((stickBtn[0])||(stickBtn[1])||(stickBtn[7])) {
if (_km.y_down_count!=2) {
_km.y_vel = -1;
@@ -159,167 +206,99 @@ void OSystem_GP2XWIZ::moveStick() {
}
}
-/* Quick default button states for modifiers. */
-int GP2X_BUTTON_STATE_L = false;
-
-/* Override the SDL pollEvent with the Wiz's own event code. */
-bool OSystem_GP2XWIZ::pollEvent(Common::Event &event) {
- SDL_Event ev;
- ev.type = SDL_NOEVENT;
- int axis;
- byte b = 0;
-
- handleKbdMouse();
-
- // If the screen mode changed, send an Common::EVENT_SCREEN_CHANGED
- if (_modeChanged) {
- _modeChanged = false;
- event.type = Common::EVENT_SCREEN_CHANGED;
- return true;
- }
-
- // GP2X Wiz Input mappings.
-
- /*
- Single Button
-
- Movement:
-
- GP2X_BUTTON_UP Cursor Up
- GP2X_BUTTON_DOWN Cursor Down
- GP2X_BUTTON_LEFT Cursor Left
- GP2X_BUTTON_RIGHT Cursor Right
-
- GP2X_BUTTON_UPLEFT Cursor Up Left
- GP2X_BUTTON_UPRIGHT Cursor Up Right
- GP2X_BUTTON_DOWNLEFT Cursor Down Left
- GP2X_BUTTON_DOWNRIGHT Cursor Down Right
-
- Button Emulation:
-
- GP2X_BUTTON_A . (Period)
- GP2X_BUTTON_B Left Mouse Click
- GP2X_BUTTON_Y Space Bar
- GP2X_BUTTON_X Right Mouse Click
- GP2X_BUTTON_L Combo Modifier (Left Trigger)
- GP2X_BUTTON_R Return (Right Trigger)
- GP2X_BUTTON_MENU F5 (Game Menu)
- GP2X_BUTTON_SELECT Escape
- GP2X_BUTTON_VOLUP /dev/mixer Global Volume Up
- GP2X_BUTTON_VOLDOWN /dev/mixer Global Volume Down
-
- Combos:
-
- GP2X_BUTTON_VOLUP & GP2X_BUTTON_VOLDOWN 0 (For Monkey 2 CP) or Virtual Keyboard if enabled
- GP2X_BUTTON_L & GP2X_BUTTON_SELECT Common::EVENT_QUIT (Calls Sync() to make sure SD is flushed)
- GP2X_BUTTON_L & GP2X_BUTTON_MENU Common::EVENT_MAINMENU (ScummVM Global Main Menu)
- GP2X_BUTTON_L & GP2X_BUTTON_A Common::EVENT_PREDICTIVE_DIALOG for predictive text entry box (AGI games)
- */
-
- while (SDL_PollEvent(&ev)) {
-
- switch (ev.type) {
- case SDL_KEYDOWN:{
- b = event.kbd.flags = SDLModToOSystemKeyFlags(SDL_GetModState());
-
- const bool event_complete = remapKey(ev,event);
-
- if (event_complete)
- return true;
-
- event.type = Common::EVENT_KEYDOWN;
- event.kbd.keycode = (Common::KeyCode)ev.key.keysym.sym;
- event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
-
- return true;
- }
- case SDL_KEYUP:
- {
- const bool event_complete = remapKey(ev,event);
-
- if (event_complete)
- return true;
-
- event.type = Common::EVENT_KEYUP;
- event.kbd.keycode = (Common::KeyCode)ev.key.keysym.sym;
- event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
- b = event.kbd.flags = SDLModToOSystemKeyFlags(SDL_GetModState());
-
- // Ctrl-Alt- will change the GFX mode
- if ((b & (Common::KBD_CTRL|Common::KBD_ALT)) == (Common::KBD_CTRL|Common::KBD_ALT)) {
- // Swallow these key up events
- break;
- }
-
- return true;
- }
- case SDL_MOUSEMOTION:
+/* Custom handleMouseButtonDown/handleMouseButtonUp to deal with 'Tap Mode' for the touchscreen */
+
+bool OSystem_GPH::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
+ if (ev.button.button == SDL_BUTTON_LEFT){
+ if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */
+ event.type = Common::EVENT_RBUTTONDOWN;
+ else if (GPH::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
+ event.type = Common::EVENT_LBUTTONDOWN;
+ else if (GPH::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */
+ event.type = Common::EVENT_RBUTTONDOWN;
+ else if (GPH::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
event.type = Common::EVENT_MOUSEMOVE;
- fillMouseEvent(event, ev.motion.x, ev.motion.y);
-
- setMousePos(event.mouse.x, event.mouse.y);
- return true;
-
- case SDL_MOUSEBUTTONDOWN:
- if (ev.button.button == SDL_BUTTON_LEFT)
- event.type = Common::EVENT_LBUTTONDOWN;
- else if (ev.button.button == SDL_BUTTON_RIGHT)
- event.type = Common::EVENT_RBUTTONDOWN;
+ else
+ event.type = Common::EVENT_LBUTTONDOWN; /* For normal mice etc. */
+ }
+ else if (ev.button.button == SDL_BUTTON_RIGHT)
+ event.type = Common::EVENT_RBUTTONDOWN;
#if defined(SDL_BUTTON_WHEELUP) && defined(SDL_BUTTON_WHEELDOWN)
- else if (ev.button.button == SDL_BUTTON_WHEELUP)
- event.type = Common::EVENT_WHEELUP;
- else if (ev.button.button == SDL_BUTTON_WHEELDOWN)
- event.type = Common::EVENT_WHEELDOWN;
+ else if (ev.button.button == SDL_BUTTON_WHEELUP)
+ event.type = Common::EVENT_WHEELUP;
+ else if (ev.button.button == SDL_BUTTON_WHEELDOWN)
+ event.type = Common::EVENT_WHEELDOWN;
#endif
#if defined(SDL_BUTTON_MIDDLE)
- else if (ev.button.button == SDL_BUTTON_MIDDLE)
- event.type = Common::EVENT_MBUTTONDOWN;
+ else if (ev.button.button == SDL_BUTTON_MIDDLE)
+ event.type = Common::EVENT_MBUTTONDOWN;
#endif
- else
- break;
+ else
+ return false;
- fillMouseEvent(event, ev.button.x, ev.button.y);
+ fillMouseEvent(event, ev.button.x, ev.button.y);
- return true;
+ return true;
+}
- case SDL_MOUSEBUTTONUP:
- if (ev.button.button == SDL_BUTTON_LEFT)
- event.type = Common::EVENT_LBUTTONUP;
- else if (ev.button.button == SDL_BUTTON_RIGHT)
- event.type = Common::EVENT_RBUTTONUP;
+bool OSystem_GPH::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
+ if (ev.button.button == SDL_BUTTON_LEFT){
+ if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */
+ event.type = Common::EVENT_RBUTTONUP;
+ else if (GPH::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
+ event.type = Common::EVENT_LBUTTONUP;
+ else if (GPH::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */
+ event.type = Common::EVENT_RBUTTONUP;
+ else if (GPH::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
+ event.type = Common::EVENT_MOUSEMOVE;
+ else
+ event.type = Common::EVENT_LBUTTONUP; /* For normal mice etc. */
+
+ }
+ else if (ev.button.button == SDL_BUTTON_RIGHT)
+ event.type = Common::EVENT_RBUTTONUP;
#if defined(SDL_BUTTON_MIDDLE)
- else if (ev.button.button == SDL_BUTTON_MIDDLE)
- event.type = Common::EVENT_MBUTTONUP;
+ else if (ev.button.button == SDL_BUTTON_MIDDLE)
+ event.type = Common::EVENT_MBUTTONUP;
#endif
- else
- break;
- fillMouseEvent(event, ev.button.x, ev.button.y);
+ else
+ return false;
- return true;
+ fillMouseEvent(event, ev.button.x, ev.button.y);
- case SDL_JOYBUTTONDOWN:
+ return true;
+}
+
+/* Custom handleJoyButtonDown/handleJoyButtonUp to deal with the joystick buttons on GPH devices */
+
+bool OSystem_GPH::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) {
_stickBtn[ev.jbutton.button] = 1;
- if (ev.jbutton.button == GP2X_BUTTON_B) {
+ if (ev.jbutton.button == BUTTON_B) {
+ event.type = Common::EVENT_LBUTTONDOWN;
+ fillMouseEvent(event, _km.x, _km.y);
+ } else if (ev.jbutton.button == BUTTON_CLICK) {
event.type = Common::EVENT_LBUTTONDOWN;
fillMouseEvent(event, _km.x, _km.y);
- } else if (ev.jbutton.button == GP2X_BUTTON_X) {
+ } else if (ev.jbutton.button == BUTTON_X) {
event.type = Common::EVENT_RBUTTONDOWN;
fillMouseEvent(event, _km.x, _km.y);
- } else if (_stickBtn[GP2X_BUTTON_L] && (ev.jbutton.button == GP2X_BUTTON_SELECT)) {
+ } else if (_stickBtn[BUTTON_L] && (ev.jbutton.button == BUTTON_SELECT)) {
event.type = Common::EVENT_QUIT;
+#if !defined (CAANOO)
} else if (ev.jbutton.button < 8) {
moveStick();
event.type = Common::EVENT_MOUSEMOVE;
fillMouseEvent(event, _km.x, _km.y);
+#endif
} else {
event.type = Common::EVENT_KEYDOWN;
event.kbd.flags = 0;
switch (ev.jbutton.button) {
- case GP2X_BUTTON_L:
- GP2X_BUTTON_STATE_L = true;
+ case BUTTON_L:
+ BUTTON_STATE_L = true;
break;
- case GP2X_BUTTON_R:
- if (GP2X_BUTTON_STATE_L == true) {
+ case BUTTON_R:
+ if (BUTTON_STATE_L == true) {
#ifdef ENABLE_VKEYBD
event.kbd.keycode = Common::KEYCODE_F7;
event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
@@ -332,35 +311,48 @@ bool OSystem_GP2XWIZ::pollEvent(Common::Event &event) {
event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
}
break;
- case GP2X_BUTTON_SELECT:
- if (GP2X_BUTTON_STATE_L == true) {
+ case BUTTON_SELECT:
+ case BUTTON_HELP2:
+ if (BUTTON_STATE_L == true) {
event.type = Common::EVENT_QUIT;
} else {
event.kbd.keycode = Common::KEYCODE_ESCAPE;
event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
}
break;
- case GP2X_BUTTON_A:
- if (GP2X_BUTTON_STATE_L == true) {
+ case BUTTON_A:
+ if (BUTTON_STATE_L == true) {
event.type = Common::EVENT_PREDICTIVE_DIALOG;
} else {
event.kbd.keycode = Common::KEYCODE_PERIOD;
event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
}
break;
- case GP2X_BUTTON_Y:
- event.kbd.keycode = Common::KEYCODE_SPACE;
- event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
+ case BUTTON_Y:
+ if (BUTTON_STATE_L == true) {
+ GPH::ToggleTapMode();
+ if (GPH::tapmodeLevel == TAPMODE_LEFT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode': Left Click");
+ } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode': Right Click");
+ } else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode': Hover (No Click)");
+ }
+ } else {
+ event.kbd.keycode = Common::KEYCODE_SPACE;
+ event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
+ }
break;
- case GP2X_BUTTON_MENU:
- if (GP2X_BUTTON_STATE_L == true) {
+ case BUTTON_MENU:
+ case BUTTON_HELP:
+ if (BUTTON_STATE_L == true) {
event.type = Common::EVENT_MAINMENU;
} else {
event.kbd.keycode = Common::KEYCODE_F5;
event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
}
break;
- case GP2X_BUTTON_VOLUP:
+ case BUTTON_VOLUP:
WIZ_HW::mixerMoveVolume(2);
if (WIZ_HW::volumeLevel == 100) {
displayMessageOnOSD("Maximum Volume");
@@ -368,8 +360,7 @@ bool OSystem_GP2XWIZ::pollEvent(Common::Event &event) {
displayMessageOnOSD("Increasing Volume");
}
break;
-
- case GP2X_BUTTON_VOLDOWN:
+ case BUTTON_VOLDOWN:
WIZ_HW::mixerMoveVolume(1);
if (WIZ_HW::volumeLevel == 0) {
displayMessageOnOSD("Minimal Volume");
@@ -377,51 +368,72 @@ bool OSystem_GP2XWIZ::pollEvent(Common::Event &event) {
displayMessageOnOSD("Decreasing Volume");
}
break;
+ case BUTTON_HOLD:
+ event.type = Common::EVENT_QUIT;
+ break;
+ case BUTTON_HOME:
+ GPH::ToggleTapMode();
+ if (GPH::tapmodeLevel == TAPMODE_LEFT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode': Left Click");
+ } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode': Right Click");
+ } else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode': Hover (No Click)");
+ }
+ break;
}
}
return true;
+}
- case SDL_JOYBUTTONUP:
+bool OSystem_GPH::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) {
_stickBtn[ev.jbutton.button] = 0;
- if (ev.jbutton.button == GP2X_BUTTON_B) {
+ if (ev.jbutton.button == BUTTON_B) {
+ event.type = Common::EVENT_LBUTTONUP;
+ fillMouseEvent(event, _km.x, _km.y);
+ } else if (ev.jbutton.button == BUTTON_CLICK) {
event.type = Common::EVENT_LBUTTONUP;
fillMouseEvent(event, _km.x, _km.y);
- } else if (ev.jbutton.button == GP2X_BUTTON_X) {
+ } else if (ev.jbutton.button == BUTTON_X) {
event.type = Common::EVENT_RBUTTONUP;
fillMouseEvent(event, _km.x, _km.y);
+#if !defined (CAANOO)
} else if (ev.jbutton.button < 8) {
moveStick();
event.type = Common::EVENT_MOUSEMOVE;
fillMouseEvent(event, _km.x, _km.y);
+#endif
} else {
event.type = Common::EVENT_KEYUP;
event.kbd.flags = 0;
switch (ev.jbutton.button) {
- case GP2X_BUTTON_SELECT:
+ case BUTTON_SELECT:
+ case BUTTON_HELP2:
event.kbd.keycode = Common::KEYCODE_ESCAPE;
event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
break;
- case GP2X_BUTTON_A:
+ case BUTTON_A:
event.kbd.keycode = Common::KEYCODE_PERIOD;
event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
break;
- case GP2X_BUTTON_Y:
+ case BUTTON_Y:
event.kbd.keycode = Common::KEYCODE_SPACE;
event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
break;
- case GP2X_BUTTON_MENU:
- if (GP2X_BUTTON_STATE_L == true) {
+ case BUTTON_MENU:
+ case BUTTON_HELP:
+ if (BUTTON_STATE_L == true) {
event.type = Common::EVENT_MAINMENU;
} else {
event.kbd.keycode = Common::KEYCODE_F5;
event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
}
break;
- case GP2X_BUTTON_L:
- GP2X_BUTTON_STATE_L = false;
+ case BUTTON_L:
+ BUTTON_STATE_L = false;
break;
- case GP2X_BUTTON_R:
- if (GP2X_BUTTON_STATE_L == true) {
+ case BUTTON_R:
+ if (BUTTON_STATE_L == true) {
#ifdef ENABLE_VKEYBD
event.kbd.keycode = Common::KEYCODE_F7;
event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
@@ -434,68 +446,19 @@ bool OSystem_GP2XWIZ::pollEvent(Common::Event &event) {
event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
}
break;
- case GP2X_BUTTON_VOLUP:
+ case BUTTON_VOLUP:
break;
- case GP2X_BUTTON_VOLDOWN:
+ case BUTTON_VOLDOWN:
+ break;
+ case BUTTON_HOLD:
+ break;
+ case BUTTON_HOME:
break;
}
}
return true;
-
- case SDL_JOYAXISMOTION:
- axis = ev.jaxis.value;
- if ( axis > JOY_DEADZONE) {
- axis -= JOY_DEADZONE;
- event.type = Common::EVENT_MOUSEMOVE;
- } else if ( axis < -JOY_DEADZONE ) {
- axis += JOY_DEADZONE;
- event.type = Common::EVENT_MOUSEMOVE;
- } else
- axis = 0;
-
- if ( ev.jaxis.axis == JOY_XAXIS) {
- if (axis != 0) {
- _km.x_vel = (axis > 0) ? 1:-1;
- _km.x_down_count = 1;
- } else {
- _km.x_vel = 0;
- _km.x_down_count = 0;
- }
-
- } else if (ev.jaxis.axis == JOY_YAXIS) {
-#ifndef JOY_INVERT_Y
- axis = -axis;
-#endif
-#ifdef JOY_ANALOG
- _km.y_vel = -axis / 2000;
- _km.y_down_count = 0;
-#else
- if (axis != 0) {
- _km.y_vel = (-axis > 0) ? 1: -1;
- _km.y_down_count = 1;
- } else {
- _km.y_vel = 0;
- _km.y_down_count = 0;
- }
-#endif
- }
-
- fillMouseEvent(event, _km.x, _km.y);
-
- return true;
-
- case SDL_VIDEOEXPOSE:
- _forceFull = true;
- break;
-
- case SDL_QUIT:
- event.type = Common::EVENT_QUIT;
- return true;
- }
- }
- return false;
}
-bool OSystem_GP2XWIZ::remapKey(SDL_Event &ev,Common::Event &event) {
+bool OSystem_GPH::remapKey(SDL_Event &ev,Common::Event &event) {
return false;
}
diff --git a/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp b/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp
index 9b8a41a7cf..92329d7c40 100644
--- a/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp
+++ b/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp
@@ -38,15 +38,15 @@ static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
{0, 0, 0}
};
-const OSystem::GraphicsMode *OSystem_GP2XWIZ::getSupportedGraphicsModes() const {
+const OSystem::GraphicsMode *OSystem_GPH::getSupportedGraphicsModes() const {
return s_supportedGraphicsModes;
}
-int OSystem_GP2XWIZ::getDefaultGraphicsMode() const {
+int OSystem_GPH::getDefaultGraphicsMode() const {
return GFX_NORMAL;
}
-bool OSystem_GP2XWIZ::setGraphicsMode(int mode) {
+bool OSystem_GPH::setGraphicsMode(int mode) {
Common::StackLock lock(_graphicsMutex);
assert(_transactionMode == kTransactionActive);
@@ -80,7 +80,7 @@ bool OSystem_GP2XWIZ::setGraphicsMode(int mode) {
return true;
}
-void OSystem_GP2XWIZ::setGraphicsModeIntern() {
+void OSystem_GPH::setGraphicsModeIntern() {
Common::StackLock lock(_graphicsMutex);
ScalerProc *newScalerProc = 0;
@@ -109,7 +109,7 @@ void OSystem_GP2XWIZ::setGraphicsModeIntern() {
blitCursor();
}
-void OSystem_GP2XWIZ::initSize(uint w, uint h) {
+void OSystem_GPH::initSize(uint w, uint h) {
assert(_transactionMode == kTransactionActive);
// Avoid redundant res changes
@@ -127,7 +127,7 @@ void OSystem_GP2XWIZ::initSize(uint w, uint h) {
_transactionDetails.sizeChanged = true;
}
-bool OSystem_GP2XWIZ::loadGFXMode() {
+bool OSystem_GPH::loadGFXMode() {
if (_videoMode.screenWidth > 320 || _videoMode.screenHeight > 240) {
_videoMode.aspectRatioCorrection = false;
setGraphicsMode(GFX_HALF);
@@ -155,7 +155,7 @@ bool OSystem_GP2XWIZ::loadGFXMode() {
return OSystem_SDL::loadGFXMode();
}
-void OSystem_GP2XWIZ::drawMouse() {
+void OSystem_GPH::drawMouse() {
if (!_mouseVisible || !_mouseSurface) {
_mouseBackup.x = _mouseBackup.y = _mouseBackup.w = _mouseBackup.h = 0;
return;
@@ -226,7 +226,7 @@ void OSystem_GP2XWIZ::drawMouse() {
addDirtyRect(dst.x, dst.y, dst.w, dst.h, true);
}
-void OSystem_GP2XWIZ::undrawMouse() {
+void OSystem_GPH::undrawMouse() {
const int x = _mouseBackup.x;
const int y = _mouseBackup.y;
@@ -244,7 +244,7 @@ void OSystem_GP2XWIZ::undrawMouse() {
}
}
-void OSystem_GP2XWIZ::internUpdateScreen() {
+void OSystem_GPH::internUpdateScreen() {
SDL_Surface *srcSurf, *origSurf;
int height, width;
ScalerProc *scalerProc;
@@ -256,7 +256,8 @@ void OSystem_GP2XWIZ::internUpdateScreen() {
#endif
// If the shake position changed, fill the dirty area with blackness
- if (_currentShakePos != _newShakePos) {
+ if (_currentShakePos != _newShakePos ||
+ (_mouseNeedsRedraw && _mouseBackup.y <= _currentShakePos)) {
SDL_Rect blackrect = {0, 0, _videoMode.screenWidth * _videoMode.scaleFactor, _newShakePos * _videoMode.scaleFactor};
if (_videoMode.aspectRatioCorrection && !_overlayVisible)
@@ -314,6 +315,7 @@ void OSystem_GP2XWIZ::internUpdateScreen() {
width = _videoMode.overlayWidth;
height = _videoMode.overlayHeight;
scalerProc = Normal1x;
+
scale1 = 1;
}
@@ -441,7 +443,7 @@ void OSystem_GP2XWIZ::internUpdateScreen() {
_mouseNeedsRedraw = false;
}
-void OSystem_GP2XWIZ::showOverlay() {
+void OSystem_GPH::showOverlay() {
if (_videoMode.mode == GFX_HALF){
_mouseCurState.x = _mouseCurState.x / 2;
_mouseCurState.y = _mouseCurState.y / 2;
@@ -449,7 +451,7 @@ void OSystem_GP2XWIZ::showOverlay() {
OSystem_SDL::showOverlay();
}
-void OSystem_GP2XWIZ::hideOverlay() {
+void OSystem_GPH::hideOverlay() {
if (_videoMode.mode == GFX_HALF){
_mouseCurState.x = _mouseCurState.x * 2;
_mouseCurState.y = _mouseCurState.y * 2;
@@ -457,7 +459,7 @@ void OSystem_GP2XWIZ::hideOverlay() {
OSystem_SDL::hideOverlay();
}
-void OSystem_GP2XWIZ::warpMouse(int x, int y) {
+void OSystem_GPH::warpMouse(int x, int y) {
if (_mouseCurState.x != x || _mouseCurState.y != y) {
if (_videoMode.mode == GFX_HALF && !_overlayVisible){
x = x / 2;
diff --git a/backends/platform/gp2xwiz/gp2xwiz-hw.cpp b/backends/platform/gp2xwiz/gp2xwiz-hw.cpp
index bc1aa00ce4..f7cc716df0 100644
--- a/backends/platform/gp2xwiz/gp2xwiz-hw.cpp
+++ b/backends/platform/gp2xwiz/gp2xwiz-hw.cpp
@@ -82,3 +82,28 @@ void mixerMoveVolume(int direction) {
}
} /* namespace WIZ_HW */
+
+namespace GPH {
+
+enum {
+ /* Touchscreen TapMode */
+ TAPMODE_LEFT = 0,
+ TAPMODE_RIGHT = 1,
+ TAPMODE_HOVER = 2
+};
+
+int tapmodeLevel = TAPMODE_LEFT;
+
+void ToggleTapMode() {
+ if (tapmodeLevel == TAPMODE_LEFT) {
+ tapmodeLevel = TAPMODE_RIGHT;
+ } else if (tapmodeLevel == TAPMODE_RIGHT) {
+ tapmodeLevel = TAPMODE_HOVER;
+ } else if (tapmodeLevel == TAPMODE_HOVER) {
+ tapmodeLevel = TAPMODE_LEFT;
+ } else {
+ tapmodeLevel = TAPMODE_LEFT;
+ }
+}
+
+} /* namespace GPH */
diff --git a/backends/platform/gp2xwiz/gp2xwiz-hw.h b/backends/platform/gp2xwiz/gp2xwiz-hw.h
index 507841e902..2fc7a85f5c 100644
--- a/backends/platform/gp2xwiz/gp2xwiz-hw.h
+++ b/backends/platform/gp2xwiz/gp2xwiz-hw.h
@@ -31,6 +31,14 @@
#ifndef GP2XWIZ_HW_H
#define GP2XWIZ_HW_H
+#if defined (CAANOO)
+ /* Vibrate features that GPH put in the */
+ /* SDL port but did not define */
+ extern void SDL_VibrateInit();
+ extern void SDL_VibrateQuit();
+ extern void SDL_VibratePlay(int);
+#endif
+
namespace WIZ_HW {
extern int volumeLevel;
@@ -41,4 +49,13 @@ extern void mixerMoveVolume(int);
} /* namespace WIZ_HW */
+namespace GPH {
+
+extern int tapmodeLevel;
+
+extern void ToggleTapMode();
+extern int GetTapMode();
+
+} /* namespace GPH */
+
#endif //GP2XWIZ_HW_H
diff --git a/backends/platform/gp2xwiz/gp2xwiz-main.cpp b/backends/platform/gp2xwiz/gp2xwiz-main.cpp
index 839afa6a95..a40b49ae18 100644
--- a/backends/platform/gp2xwiz/gp2xwiz-main.cpp
+++ b/backends/platform/gp2xwiz/gp2xwiz-main.cpp
@@ -57,7 +57,7 @@
#define DUMP_STDOUT
int main(int argc, char *argv[]) {
- g_system = new OSystem_GP2XWIZ();
+ g_system = new OSystem_GPH();
assert(g_system);
#ifdef DYNAMIC_MODULES
PluginManager::instance().addPluginProvider(new POSIXPluginProvider());
@@ -70,7 +70,7 @@ int main(int argc, char *argv[]) {
return res;
}
-void OSystem_GP2XWIZ::initBackend() {
+void OSystem_GPH::initBackend() {
/* Setup default save path to be workingdir/saves */
@@ -164,7 +164,7 @@ void OSystem_GP2XWIZ::initBackend() {
OSystem_SDL::initBackend();
}
-void OSystem_GP2XWIZ::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
+void OSystem_GPH::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
/* Setup default extra data paths for engine data files and plugins */
char workDirName[PATH_MAX+1];
@@ -199,7 +199,7 @@ void OSystem_GP2XWIZ::addSysArchivesToSearchSet(Common::SearchSet &s, int priori
}
}
-void OSystem_GP2XWIZ::quit() {
+void OSystem_GPH::quit() {
WIZ_HW::deviceDeinit();
diff --git a/backends/platform/gp2xwiz/gp2xwiz-sdl.h b/backends/platform/gp2xwiz/gp2xwiz-sdl.h
index e312d0f26d..bae9a87771 100644
--- a/backends/platform/gp2xwiz/gp2xwiz-sdl.h
+++ b/backends/platform/gp2xwiz/gp2xwiz-sdl.h
@@ -40,9 +40,9 @@ enum {
#define PATH_MAX 255
#endif
-class OSystem_GP2XWIZ : public OSystem_SDL {
+class OSystem_GPH : public OSystem_SDL {
public:
- OSystem_GP2XWIZ() {}
+ OSystem_GPH() {}
/* Graphics */
void initSize(uint w, uint h);
@@ -59,7 +59,6 @@ public:
void hideOverlay();
/* Event Stuff */
- bool pollEvent(Common::Event &event);
void moveStick();
void fillMouseEvent(Common::Event&, int, int);
void warpMouse(int, int);
@@ -72,6 +71,11 @@ public:
protected:
bool _stickBtn[32];
+
+ bool handleMouseButtonDown(SDL_Event &ev, Common::Event &event);
+ bool handleMouseButtonUp(SDL_Event &ev, Common::Event &event);
+ bool handleJoyButtonDown(SDL_Event &ev, Common::Event &event);
+ bool handleJoyButtonUp(SDL_Event &ev, Common::Event &event);
};
#endif
--
cgit v1.2.3
From 56b09b605dcae91a1d5e12c0c377d6b10985556e Mon Sep 17 00:00:00 2001
From: John Willis
Date: Tue, 7 Sep 2010 19:02:07 +0000
Subject: GP2XWIZ: Clean up input code.
* Clean up the if/switch mess.
* Also add missing Caanoo icon.
svn-id: r52629
---
backends/platform/gp2xwiz/build/scummvm.ini | 1 +
backends/platform/gp2xwiz/build/scummvmb.png | Bin 0 -> 34274 bytes
backends/platform/gp2xwiz/caanoo/caanoo-bundle.mk | 2 +
backends/platform/gp2xwiz/gp2xwiz-bundle.mk | 2 +
backends/platform/gp2xwiz/gp2xwiz-events.cpp | 354 +++++++++++-----------
5 files changed, 187 insertions(+), 172 deletions(-)
create mode 100644 backends/platform/gp2xwiz/build/scummvmb.png
(limited to 'backends/platform')
diff --git a/backends/platform/gp2xwiz/build/scummvm.ini b/backends/platform/gp2xwiz/build/scummvm.ini
index 5a8e6eefa1..c9cce92379 100644
--- a/backends/platform/gp2xwiz/build/scummvm.ini
+++ b/backends/platform/gp2xwiz/build/scummvm.ini
@@ -2,3 +2,4 @@
name="ScummVM"
path="/scummvm/scummvm.gpe"
icon="/scummvm/scummvm.png"
+title="/scummvm/scummvmb.png"
diff --git a/backends/platform/gp2xwiz/build/scummvmb.png b/backends/platform/gp2xwiz/build/scummvmb.png
new file mode 100644
index 0000000000..24a27bc0e1
Binary files /dev/null and b/backends/platform/gp2xwiz/build/scummvmb.png differ
diff --git a/backends/platform/gp2xwiz/caanoo/caanoo-bundle.mk b/backends/platform/gp2xwiz/caanoo/caanoo-bundle.mk
index f8ac26382d..d02ed5fe16 100755
--- a/backends/platform/gp2xwiz/caanoo/caanoo-bundle.mk
+++ b/backends/platform/gp2xwiz/caanoo/caanoo-bundle.mk
@@ -16,6 +16,7 @@ caanoo-bundle: $(EXECUTABLE)
$(CP) $(srcdir)/backends/platform/gp2xwiz/caanoo/scummvm.gpe $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvmb.png $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/README-GP2XWIZ $(bundle_name)/scummvm/README-CAANOO
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.ini $(bundle_name)/
@@ -46,6 +47,7 @@ caanoo-bundle-debug: $(EXECUTABLE)
$(CP) $(srcdir)/backends/platform/gp2xwiz/caanoo/scummvm-gdb.gpe $(bundle_name)/scummvm/scummvm.gpe
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvmb.png $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/README-GP2XWIZ $(bundle_name)/scummvm/README-CAANOO
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.ini $(bundle_name)/
diff --git a/backends/platform/gp2xwiz/gp2xwiz-bundle.mk b/backends/platform/gp2xwiz/gp2xwiz-bundle.mk
index fa5a247865..c572b86939 100755
--- a/backends/platform/gp2xwiz/gp2xwiz-bundle.mk
+++ b/backends/platform/gp2xwiz/gp2xwiz-bundle.mk
@@ -16,6 +16,7 @@ gp2xwiz-bundle: $(EXECUTABLE)
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.gpe $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvmb.png $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/README-GP2XWIZ $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.ini $(bundle_name)/
@@ -49,6 +50,7 @@ gp2xwiz-bundle-debug: $(EXECUTABLE)
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm-gdb.gpe $(bundle_name)/scummvm/scummvm.gpe
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvmb.png $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/README-GP2XWIZ $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.ini $(bundle_name)/
diff --git a/backends/platform/gp2xwiz/gp2xwiz-events.cpp b/backends/platform/gp2xwiz/gp2xwiz-events.cpp
index 1f603b4a3d..84c3006d6e 100644
--- a/backends/platform/gp2xwiz/gp2xwiz-events.cpp
+++ b/backends/platform/gp2xwiz/gp2xwiz-events.cpp
@@ -272,191 +272,201 @@ bool OSystem_GPH::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
/* Custom handleJoyButtonDown/handleJoyButtonUp to deal with the joystick buttons on GPH devices */
bool OSystem_GPH::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) {
- _stickBtn[ev.jbutton.button] = 1;
- if (ev.jbutton.button == BUTTON_B) {
- event.type = Common::EVENT_LBUTTONDOWN;
- fillMouseEvent(event, _km.x, _km.y);
- } else if (ev.jbutton.button == BUTTON_CLICK) {
- event.type = Common::EVENT_LBUTTONDOWN;
- fillMouseEvent(event, _km.x, _km.y);
- } else if (ev.jbutton.button == BUTTON_X) {
- event.type = Common::EVENT_RBUTTONDOWN;
- fillMouseEvent(event, _km.x, _km.y);
- } else if (_stickBtn[BUTTON_L] && (ev.jbutton.button == BUTTON_SELECT)) {
- event.type = Common::EVENT_QUIT;
-#if !defined (CAANOO)
- } else if (ev.jbutton.button < 8) {
- moveStick();
- event.type = Common::EVENT_MOUSEMOVE;
- fillMouseEvent(event, _km.x, _km.y);
-#endif
- } else {
- event.type = Common::EVENT_KEYDOWN;
- event.kbd.flags = 0;
- switch (ev.jbutton.button) {
- case BUTTON_L:
- BUTTON_STATE_L = true;
- break;
- case BUTTON_R:
- if (BUTTON_STATE_L == true) {
+ switch (ev.jbutton.button) {
+ case BUTTON_UP:
+ case BUTTON_UPLEFT:
+ case BUTTON_LEFT:
+ case BUTTON_DOWNLEFT:
+ case BUTTON_DOWN:
+ case BUTTON_DOWNRIGHT:
+ case BUTTON_RIGHT:
+ case BUTTON_UPRIGHT:
+ moveStick();
+ event.type = Common::EVENT_MOUSEMOVE;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_B:
+ case BUTTON_CLICK:
+ event.type = Common::EVENT_LBUTTONDOWN;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_X:
+ event.type = Common::EVENT_RBUTTONDOWN;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_L:
+ BUTTON_STATE_L = true;
+ break;
+ case BUTTON_R:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
#ifdef ENABLE_VKEYBD
- event.kbd.keycode = Common::KEYCODE_F7;
- event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
+ event.kbd.keycode = Common::KEYCODE_F7;
+ event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
#else
- event.kbd.keycode = Common::KEYCODE_0;
- event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
+ event.kbd.keycode = Common::KEYCODE_0;
+ event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
#endif
- } else {
- event.kbd.keycode = Common::KEYCODE_RETURN;
- event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_SELECT:
- case BUTTON_HELP2:
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_QUIT;
- } else {
- event.kbd.keycode = Common::KEYCODE_ESCAPE;
- event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_A:
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_PREDICTIVE_DIALOG;
- } else {
- event.kbd.keycode = Common::KEYCODE_PERIOD;
- event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_Y:
- if (BUTTON_STATE_L == true) {
- GPH::ToggleTapMode();
- if (GPH::tapmodeLevel == TAPMODE_LEFT) {
- displayMessageOnOSD("Touchscreen 'Tap Mode': Left Click");
- } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
- displayMessageOnOSD("Touchscreen 'Tap Mode': Right Click");
- } else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
- displayMessageOnOSD("Touchscreen 'Tap Mode': Hover (No Click)");
- }
- } else {
- event.kbd.keycode = Common::KEYCODE_SPACE;
- event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_MENU:
- case BUTTON_HELP:
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_MAINMENU;
- } else {
- event.kbd.keycode = Common::KEYCODE_F5;
- event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_VOLUP:
- WIZ_HW::mixerMoveVolume(2);
- if (WIZ_HW::volumeLevel == 100) {
- displayMessageOnOSD("Maximum Volume");
- } else {
- displayMessageOnOSD("Increasing Volume");
- }
- break;
- case BUTTON_VOLDOWN:
- WIZ_HW::mixerMoveVolume(1);
- if (WIZ_HW::volumeLevel == 0) {
- displayMessageOnOSD("Minimal Volume");
- } else {
- displayMessageOnOSD("Decreasing Volume");
- }
- break;
- case BUTTON_HOLD:
- event.type = Common::EVENT_QUIT;
- break;
- case BUTTON_HOME:
- GPH::ToggleTapMode();
- if (GPH::tapmodeLevel == TAPMODE_LEFT) {
- displayMessageOnOSD("Touchscreen 'Tap Mode': Left Click");
- } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
- displayMessageOnOSD("Touchscreen 'Tap Mode': Right Click");
- } else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
- displayMessageOnOSD("Touchscreen 'Tap Mode': Hover (No Click)");
- }
- break;
+ } else {
+ event.kbd.keycode = Common::KEYCODE_RETURN;
+ event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_SELECT:
+ case BUTTON_HOME:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
+ event.type = Common::EVENT_QUIT;
+ } else {
+ event.kbd.keycode = Common::KEYCODE_ESCAPE;
+ event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_A:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
+ event.type = Common::EVENT_PREDICTIVE_DIALOG;
+ } else {
+ event.kbd.keycode = Common::KEYCODE_PERIOD;
+ event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_Y:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
+ GPH::ToggleTapMode();
+ if (GPH::tapmodeLevel == TAPMODE_LEFT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode' - Left Click");
+ } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode' - Right Click");
+ } else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode' - Hover (No Click)");
}
+ } else {
+ event.kbd.keycode = Common::KEYCODE_SPACE;
+ event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_MENU:
+ case BUTTON_HELP:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
+ event.type = Common::EVENT_MAINMENU;
+ } else {
+ event.kbd.keycode = Common::KEYCODE_F5;
+ event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
}
- return true;
+ break;
+ case BUTTON_VOLUP:
+ WIZ_HW::mixerMoveVolume(2);
+ if (WIZ_HW::volumeLevel == 100) {
+ displayMessageOnOSD("Maximum Volume");
+ } else {
+ displayMessageOnOSD("Increasing Volume");
+ }
+ break;
+ case BUTTON_VOLDOWN:
+ WIZ_HW::mixerMoveVolume(1);
+ if (WIZ_HW::volumeLevel == 0) {
+ displayMessageOnOSD("Minimal Volume");
+ } else {
+ displayMessageOnOSD("Decreasing Volume");
+ }
+ break;
+ case BUTTON_HOLD:
+ event.type = Common::EVENT_QUIT;
+ break;
+ case BUTTON_HELP2:
+ GPH::ToggleTapMode();
+ if (GPH::tapmodeLevel == TAPMODE_LEFT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode': Left Click");
+ } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode': Right Click");
+ } else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode': Hover (No Click)");
+ }
+ break;
+ }
+ return true;
}
bool OSystem_GPH::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) {
- _stickBtn[ev.jbutton.button] = 0;
- if (ev.jbutton.button == BUTTON_B) {
- event.type = Common::EVENT_LBUTTONUP;
- fillMouseEvent(event, _km.x, _km.y);
- } else if (ev.jbutton.button == BUTTON_CLICK) {
- event.type = Common::EVENT_LBUTTONUP;
- fillMouseEvent(event, _km.x, _km.y);
- } else if (ev.jbutton.button == BUTTON_X) {
- event.type = Common::EVENT_RBUTTONUP;
- fillMouseEvent(event, _km.x, _km.y);
-#if !defined (CAANOO)
- } else if (ev.jbutton.button < 8) {
- moveStick();
- event.type = Common::EVENT_MOUSEMOVE;
- fillMouseEvent(event, _km.x, _km.y);
-#endif
+ switch (ev.jbutton.button) {
+ case BUTTON_UP:
+ case BUTTON_UPLEFT:
+ case BUTTON_LEFT:
+ case BUTTON_DOWNLEFT:
+ case BUTTON_DOWN:
+ case BUTTON_DOWNRIGHT:
+ case BUTTON_RIGHT:
+ case BUTTON_UPRIGHT:
+ moveStick();
+ event.type = Common::EVENT_MOUSEMOVE;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_B:
+ case BUTTON_CLICK:
+ event.type = Common::EVENT_LBUTTONUP;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_X:
+ event.type = Common::EVENT_RBUTTONUP;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_L:
+ BUTTON_STATE_L = true;
+ break;
+ case BUTTON_SELECT:
+ case BUTTON_HOME:
+ event.type = Common::EVENT_KEYUP;
+ event.kbd.keycode = Common::KEYCODE_ESCAPE;
+ event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
+ break;
+ case BUTTON_A:
+ event.type = Common::EVENT_KEYUP;
+ event.kbd.keycode = Common::KEYCODE_PERIOD;
+ event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
+ break;
+ case BUTTON_Y:
+ event.type = Common::EVENT_KEYUP;
+ event.kbd.keycode = Common::KEYCODE_SPACE;
+ event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
+ break;
+ case BUTTON_MENU:
+ case BUTTON_HELP:
+ event.type = Common::EVENT_KEYUP;
+ if (BUTTON_STATE_L == true) {
+ event.type = Common::EVENT_MAINMENU;
} else {
- event.type = Common::EVENT_KEYUP;
- event.kbd.flags = 0;
- switch (ev.jbutton.button) {
- case BUTTON_SELECT:
- case BUTTON_HELP2:
- event.kbd.keycode = Common::KEYCODE_ESCAPE;
- event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
- break;
- case BUTTON_A:
- event.kbd.keycode = Common::KEYCODE_PERIOD;
- event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
- break;
- case BUTTON_Y:
- event.kbd.keycode = Common::KEYCODE_SPACE;
- event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
- break;
- case BUTTON_MENU:
- case BUTTON_HELP:
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_MAINMENU;
- } else {
- event.kbd.keycode = Common::KEYCODE_F5;
- event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_L:
- BUTTON_STATE_L = false;
- break;
- case BUTTON_R:
- if (BUTTON_STATE_L == true) {
+ event.kbd.keycode = Common::KEYCODE_F5;
+ event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_R:
+ event.type = Common::EVENT_KEYUP;
+ if (BUTTON_STATE_L == true) {
#ifdef ENABLE_VKEYBD
- event.kbd.keycode = Common::KEYCODE_F7;
- event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
+ event.kbd.keycode = Common::KEYCODE_F7;
+ event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
#else
- event.kbd.keycode = Common::KEYCODE_0;
- event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
+ event.kbd.keycode = Common::KEYCODE_0;
+ event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
#endif
- } else {
- event.kbd.keycode = Common::KEYCODE_RETURN;
- event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_VOLUP:
- break;
- case BUTTON_VOLDOWN:
- break;
- case BUTTON_HOLD:
- break;
- case BUTTON_HOME:
- break;
- }
+ } else {
+ event.kbd.keycode = Common::KEYCODE_RETURN;
+ event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
}
- return true;
+ break;
+ case BUTTON_VOLUP:
+ break;
+ case BUTTON_VOLDOWN:
+ break;
+ case BUTTON_HOLD:
+ break;
+ case BUTTON_HELP2:
+ break;
+ }
+ return true;
}
bool OSystem_GPH::remapKey(SDL_Event &ev,Common::Event &event) {
--
cgit v1.2.3
From 4c107cc97a0d393508d570d7374a3304f564defe Mon Sep 17 00:00:00 2001
From: John Willis
Date: Tue, 7 Sep 2010 20:14:05 +0000
Subject: GP2XWIZ: Reformat switches to code guidelines.
svn-id: r52630
---
backends/platform/gp2xwiz/gp2xwiz-events.cpp | 356 ++++++++++++++-------------
1 file changed, 182 insertions(+), 174 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/gp2xwiz/gp2xwiz-events.cpp b/backends/platform/gp2xwiz/gp2xwiz-events.cpp
index 84c3006d6e..b226dbddb0 100644
--- a/backends/platform/gp2xwiz/gp2xwiz-events.cpp
+++ b/backends/platform/gp2xwiz/gp2xwiz-events.cpp
@@ -272,199 +272,207 @@ bool OSystem_GPH::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
/* Custom handleJoyButtonDown/handleJoyButtonUp to deal with the joystick buttons on GPH devices */
bool OSystem_GPH::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) {
+
+ _stickBtn[ev.jbutton.button] = 1;
+ event.kbd.flags = 0;
+
switch (ev.jbutton.button) {
- case BUTTON_UP:
- case BUTTON_UPLEFT:
- case BUTTON_LEFT:
- case BUTTON_DOWNLEFT:
- case BUTTON_DOWN:
- case BUTTON_DOWNRIGHT:
- case BUTTON_RIGHT:
- case BUTTON_UPRIGHT:
- moveStick();
- event.type = Common::EVENT_MOUSEMOVE;
- fillMouseEvent(event, _km.x, _km.y);
- break;
- case BUTTON_B:
- case BUTTON_CLICK:
- event.type = Common::EVENT_LBUTTONDOWN;
- fillMouseEvent(event, _km.x, _km.y);
- break;
- case BUTTON_X:
- event.type = Common::EVENT_RBUTTONDOWN;
- fillMouseEvent(event, _km.x, _km.y);
- break;
- case BUTTON_L:
- BUTTON_STATE_L = true;
- break;
- case BUTTON_R:
- event.type = Common::EVENT_KEYDOWN;
- if (BUTTON_STATE_L == true) {
+ case BUTTON_UP:
+ case BUTTON_UPLEFT:
+ case BUTTON_LEFT:
+ case BUTTON_DOWNLEFT:
+ case BUTTON_DOWN:
+ case BUTTON_DOWNRIGHT:
+ case BUTTON_RIGHT:
+ case BUTTON_UPRIGHT:
+ moveStick();
+ event.type = Common::EVENT_MOUSEMOVE;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_B:
+ case BUTTON_CLICK:
+ event.type = Common::EVENT_LBUTTONDOWN;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_X:
+ event.type = Common::EVENT_RBUTTONDOWN;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_L:
+ BUTTON_STATE_L = true;
+ break;
+ case BUTTON_R:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
#ifdef ENABLE_VKEYBD
- event.kbd.keycode = Common::KEYCODE_F7;
- event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
+ event.kbd.keycode = Common::KEYCODE_F7;
+ event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
#else
- event.kbd.keycode = Common::KEYCODE_0;
- event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
+ event.kbd.keycode = Common::KEYCODE_0;
+ event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
#endif
- } else {
- event.kbd.keycode = Common::KEYCODE_RETURN;
- event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_SELECT:
- case BUTTON_HOME:
- event.type = Common::EVENT_KEYDOWN;
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_QUIT;
- } else {
- event.kbd.keycode = Common::KEYCODE_ESCAPE;
- event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_A:
- event.type = Common::EVENT_KEYDOWN;
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_PREDICTIVE_DIALOG;
- } else {
- event.kbd.keycode = Common::KEYCODE_PERIOD;
- event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_Y:
- event.type = Common::EVENT_KEYDOWN;
- if (BUTTON_STATE_L == true) {
- GPH::ToggleTapMode();
- if (GPH::tapmodeLevel == TAPMODE_LEFT) {
- displayMessageOnOSD("Touchscreen 'Tap Mode' - Left Click");
- } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
- displayMessageOnOSD("Touchscreen 'Tap Mode' - Right Click");
- } else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
- displayMessageOnOSD("Touchscreen 'Tap Mode' - Hover (No Click)");
- }
- } else {
- event.kbd.keycode = Common::KEYCODE_SPACE;
- event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_MENU:
- case BUTTON_HELP:
- event.type = Common::EVENT_KEYDOWN;
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_MAINMENU;
- } else {
- event.kbd.keycode = Common::KEYCODE_F5;
- event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_VOLUP:
- WIZ_HW::mixerMoveVolume(2);
- if (WIZ_HW::volumeLevel == 100) {
- displayMessageOnOSD("Maximum Volume");
- } else {
- displayMessageOnOSD("Increasing Volume");
- }
- break;
- case BUTTON_VOLDOWN:
- WIZ_HW::mixerMoveVolume(1);
- if (WIZ_HW::volumeLevel == 0) {
- displayMessageOnOSD("Minimal Volume");
- } else {
- displayMessageOnOSD("Decreasing Volume");
- }
- break;
- case BUTTON_HOLD:
+ } else {
+ event.kbd.keycode = Common::KEYCODE_RETURN;
+ event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_SELECT:
+ case BUTTON_HOME:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
event.type = Common::EVENT_QUIT;
- break;
- case BUTTON_HELP2:
+ } else {
+ event.kbd.keycode = Common::KEYCODE_ESCAPE;
+ event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_A:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
+ event.type = Common::EVENT_PREDICTIVE_DIALOG;
+ } else {
+ event.kbd.keycode = Common::KEYCODE_PERIOD;
+ event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_Y:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
GPH::ToggleTapMode();
if (GPH::tapmodeLevel == TAPMODE_LEFT) {
- displayMessageOnOSD("Touchscreen 'Tap Mode': Left Click");
+ displayMessageOnOSD("Touchscreen 'Tap Mode' - Left Click");
} else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
- displayMessageOnOSD("Touchscreen 'Tap Mode': Right Click");
+ displayMessageOnOSD("Touchscreen 'Tap Mode' - Right Click");
} else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
- displayMessageOnOSD("Touchscreen 'Tap Mode': Hover (No Click)");
+ displayMessageOnOSD("Touchscreen 'Tap Mode' - Hover (No Click)");
}
- break;
+ } else {
+ event.kbd.keycode = Common::KEYCODE_SPACE;
+ event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_MENU:
+ case BUTTON_HELP:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
+ event.type = Common::EVENT_MAINMENU;
+ } else {
+ event.kbd.keycode = Common::KEYCODE_F5;
+ event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_VOLUP:
+ WIZ_HW::mixerMoveVolume(2);
+ if (WIZ_HW::volumeLevel == 100) {
+ displayMessageOnOSD("Maximum Volume");
+ } else {
+ displayMessageOnOSD("Increasing Volume");
+ }
+ break;
+ case BUTTON_VOLDOWN:
+ WIZ_HW::mixerMoveVolume(1);
+ if (WIZ_HW::volumeLevel == 0) {
+ displayMessageOnOSD("Minimal Volume");
+ } else {
+ displayMessageOnOSD("Decreasing Volume");
+ }
+ break;
+ case BUTTON_HOLD:
+ event.type = Common::EVENT_QUIT;
+ break;
+ case BUTTON_HELP2:
+ GPH::ToggleTapMode();
+ if (GPH::tapmodeLevel == TAPMODE_LEFT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode': Left Click");
+ } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode': Right Click");
+ } else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode': Hover (No Click)");
+ }
+ break;
}
return true;
}
bool OSystem_GPH::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) {
+
+ _stickBtn[ev.jbutton.button] = 0;
+ event.kbd.flags = 0;
+
switch (ev.jbutton.button) {
- case BUTTON_UP:
- case BUTTON_UPLEFT:
- case BUTTON_LEFT:
- case BUTTON_DOWNLEFT:
- case BUTTON_DOWN:
- case BUTTON_DOWNRIGHT:
- case BUTTON_RIGHT:
- case BUTTON_UPRIGHT:
- moveStick();
- event.type = Common::EVENT_MOUSEMOVE;
- fillMouseEvent(event, _km.x, _km.y);
- break;
- case BUTTON_B:
- case BUTTON_CLICK:
- event.type = Common::EVENT_LBUTTONUP;
- fillMouseEvent(event, _km.x, _km.y);
- break;
- case BUTTON_X:
- event.type = Common::EVENT_RBUTTONUP;
- fillMouseEvent(event, _km.x, _km.y);
- break;
- case BUTTON_L:
- BUTTON_STATE_L = true;
- break;
- case BUTTON_SELECT:
- case BUTTON_HOME:
- event.type = Common::EVENT_KEYUP;
- event.kbd.keycode = Common::KEYCODE_ESCAPE;
- event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
- break;
- case BUTTON_A:
- event.type = Common::EVENT_KEYUP;
- event.kbd.keycode = Common::KEYCODE_PERIOD;
- event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
- break;
- case BUTTON_Y:
- event.type = Common::EVENT_KEYUP;
- event.kbd.keycode = Common::KEYCODE_SPACE;
- event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
- break;
- case BUTTON_MENU:
- case BUTTON_HELP:
- event.type = Common::EVENT_KEYUP;
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_MAINMENU;
- } else {
- event.kbd.keycode = Common::KEYCODE_F5;
- event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_R:
- event.type = Common::EVENT_KEYUP;
- if (BUTTON_STATE_L == true) {
+ case BUTTON_UP:
+ case BUTTON_UPLEFT:
+ case BUTTON_LEFT:
+ case BUTTON_DOWNLEFT:
+ case BUTTON_DOWN:
+ case BUTTON_DOWNRIGHT:
+ case BUTTON_RIGHT:
+ case BUTTON_UPRIGHT:
+ moveStick();
+ event.type = Common::EVENT_MOUSEMOVE;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_B:
+ case BUTTON_CLICK:
+ event.type = Common::EVENT_LBUTTONUP;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_X:
+ event.type = Common::EVENT_RBUTTONUP;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_L:
+ BUTTON_STATE_L = false;
+ break;
+ case BUTTON_SELECT:
+ case BUTTON_HOME:
+ event.type = Common::EVENT_KEYUP;
+ event.kbd.keycode = Common::KEYCODE_ESCAPE;
+ event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
+ break;
+ case BUTTON_A:
+ event.type = Common::EVENT_KEYUP;
+ event.kbd.keycode = Common::KEYCODE_PERIOD;
+ event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
+ break;
+ case BUTTON_Y:
+ event.type = Common::EVENT_KEYUP;
+ event.kbd.keycode = Common::KEYCODE_SPACE;
+ event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
+ break;
+ case BUTTON_MENU:
+ case BUTTON_HELP:
+ event.type = Common::EVENT_KEYUP;
+ if (BUTTON_STATE_L == true) {
+ event.type = Common::EVENT_MAINMENU;
+ } else {
+ event.kbd.keycode = Common::KEYCODE_F5;
+ event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_R:
+ event.type = Common::EVENT_KEYUP;
+ if (BUTTON_STATE_L == true) {
#ifdef ENABLE_VKEYBD
- event.kbd.keycode = Common::KEYCODE_F7;
- event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
+ event.kbd.keycode = Common::KEYCODE_F7;
+ event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
#else
- event.kbd.keycode = Common::KEYCODE_0;
- event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
+ event.kbd.keycode = Common::KEYCODE_0;
+ event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
#endif
- } else {
- event.kbd.keycode = Common::KEYCODE_RETURN;
- event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_VOLUP:
- break;
- case BUTTON_VOLDOWN:
- break;
- case BUTTON_HOLD:
- break;
- case BUTTON_HELP2:
- break;
+ } else {
+ event.kbd.keycode = Common::KEYCODE_RETURN;
+ event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_VOLUP:
+ break;
+ case BUTTON_VOLDOWN:
+ break;
+ case BUTTON_HOLD:
+ break;
+ case BUTTON_HELP2:
+ break;
}
return true;
}
--
cgit v1.2.3
From 690fea29333daadd79d7bc305ee7fff040613b9f Mon Sep 17 00:00:00 2001
From: Fabio Battaglia
Date: Wed, 8 Sep 2010 08:26:20 +0000
Subject: DINGUX: Add dingux.mk with specific 'dist' targets
svn-id: r52632
---
backends/platform/dingux/dingux.mk | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
create mode 100644 backends/platform/dingux/dingux.mk
(limited to 'backends/platform')
diff --git a/backends/platform/dingux/dingux.mk b/backends/platform/dingux/dingux.mk
new file mode 100644
index 0000000000..cf18a680e7
--- /dev/null
+++ b/backends/platform/dingux/dingux.mk
@@ -0,0 +1,27 @@
+DINGUX_EXE_STRIPPED := scummvm_stripped$(EXEEXT)
+
+bundle_name = dingux-dist/scummvm
+
+all: $(DINGUX_EXE_STRIPPED)
+
+$(DINGUX_EXE_STRIPPED): $(EXECUTABLE)
+ $(STRIP) $< -o $@
+
+dingux-distclean:
+ rm -rf $(bundle_name)
+ rm $(DINGUX_EXE_STRIPPED)
+
+dingux-dist: all
+ $(MKDIR) $(bundle_name)
+ $(MKDIR) $(bundle_name)/saves
+ $(STRIP) $(EXECUTABLE) -o $(bundle_name)/scummvm.elf
+ $(CP) $(DIST_FILES_THEMES) $(bundle_name)/
+ $(CP) $(DIST_FILES_ENGINEDATA) $(bundle_name)/
+ $(CP) $(DIST_FILES_DOCS) $(bundle_name)/
+ifdef DYNAMIC_MODULES
+ $(MKDIR) $(bundle_name)/plugins
+ $(CP) $(PLUGINS) $(bundle_name)/plugins
+ $(STRIP) $(bundle_name)/plugins/*
+endif
+ $(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)/
+
--
cgit v1.2.3
From f3a9828d3683ed9ace360adb2b37459fbc28f98b Mon Sep 17 00:00:00 2001
From: Andre Heider
Date: Wed, 8 Sep 2010 17:41:31 +0000
Subject: WII: Fix typo, update translations.
svn-id: r52640
---
backends/platform/wii/options.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'backends/platform')
diff --git a/backends/platform/wii/options.cpp b/backends/platform/wii/options.cpp
index 0a21b45561..2a47958e3b 100644
--- a/backends/platform/wii/options.cpp
+++ b/backends/platform/wii/options.cpp
@@ -183,7 +183,7 @@ void WiiOptionsDialog::handleTickle() {
break;
default:
- label = String::printf(_("Network not initialsed (%d)"), status);
+ label = String::printf(_("Network not initialised (%d)"), status);
break;
}
--
cgit v1.2.3
From 0288f60f1972b5c5a7d719a8114fdeae32024cb2 Mon Sep 17 00:00:00 2001
From: Fabio Battaglia
Date: Wed, 8 Sep 2010 18:04:38 +0000
Subject: CONFIGURE and N64: add n64.mk with nintendo64 specific dist targets
svn-id: r52641
---
backends/platform/n64/Makefile | 4 ++--
backends/platform/n64/n64.mk | 27 +++++++++++++++++++++++++++
backends/platform/n64/pad_rom.sh | 6 +++---
3 files changed, 32 insertions(+), 5 deletions(-)
create mode 100644 backends/platform/n64/n64.mk
(limited to 'backends/platform')
diff --git a/backends/platform/n64/Makefile b/backends/platform/n64/Makefile
index b8b2e61f77..f80aa29262 100644
--- a/backends/platform/n64/Makefile
+++ b/backends/platform/n64/Makefile
@@ -49,7 +49,7 @@ USE_RGB_COLOR=0
ENABLED=STATIC_PLUGIN
-ENABLE_SCUMM = $(ENABLED)
+#ENABLE_SCUMM = $(ENABLED)
#ENABLE_SCI = $(ENABLED)
#ENABLE_GOB = $(ENABLED)
#ENABLE_PARALLACTION = $(ENABLED)
@@ -74,7 +74,7 @@ all: $(TARGET).v64
$(TARGET).v64: $(TARGET).bin ROMFS.img bootcode
cat bootcode $(TARGET).bin ROMFS.img > $(TARGET).v64
- ./pad_rom.sh
+ ./pad_rom.sh $(TARGET).v64
ROMFS.img:
genromfs -f ./ROMFS.img -d ./ROMFS -V romtest
diff --git a/backends/platform/n64/n64.mk b/backends/platform/n64/n64.mk
new file mode 100644
index 0000000000..580bdce7ce
--- /dev/null
+++ b/backends/platform/n64/n64.mk
@@ -0,0 +1,27 @@
+N64_EXE_STRIPPED := scummvm_stripped$(EXEEXT)
+
+bundle_name = n64-dist/scummvm
+BASESIZE = 2097152
+
+all: $(N64_EXE_STRIPPED)
+
+$(N64_EXE_STRIPPED): $(EXECUTABLE)
+ $(STRIP) $< -o $@
+
+n64-distclean:
+ rm -rf $(bundle_name)
+ rm $(N64_EXE_STRIPPED)
+
+n64-dist: all
+ $(MKDIR) $(bundle_name)
+ $(MKDIR) $(bundle_name)/romfs
+ $(CP) $(DIST_FILES_ENGINEDATA) $(bundle_name)/romfs
+ $(CP) $(DIST_FILES_DOCS) $(bundle_name)/
+ $(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)/romfs
+ genromfs -f $(bundle_name)/romfs.img -d $(bundle_name)/romfs -V scummvmn64
+ mips64-objcopy $(EXECUTABLE) $(bundle_name)/scummvm.elf -O binary
+ cat $(N64SDK)/hkz-libn64/bootcode $(bundle_name)/scummvm.elf $(bundle_name)/romfs.img > scummvm.v64
+ $(srcdir)/backends/platform/n64/pad_rom.sh scummvm.v64
+ rm scummvm.bak
+ mv scummvm.v64 $(bundle_name)/scummvm.v64
+
diff --git a/backends/platform/n64/pad_rom.sh b/backends/platform/n64/pad_rom.sh
index 0660f6c204..085203306f 100644
--- a/backends/platform/n64/pad_rom.sh
+++ b/backends/platform/n64/pad_rom.sh
@@ -1,13 +1,13 @@
#!/bin/bash
-TARGET="scummvm"
+TARGET=$1
BASESIZE=2097152
-CARTSIZE=`ls -l $TARGET.v64 | cut -d" " -f5`
+CARTSIZE=`ls -l $1 | cut -d" " -f5`
REMAINDER=`echo $CARTSIZE % $BASESIZE | bc`
REMAINDER=`echo $BASESIZE - $REMAINDER | bc`
CARTSIZE=`echo $CARTSIZE + $REMAINDER | bc`
-ucon64 -q --n64 --v64 --chk --padn=$CARTSIZE $TARGET.v64
+ucon64 -q --n64 --v64 --chk --padn=$CARTSIZE $1
--
cgit v1.2.3
From 43a142bbff3ddd976637408e3345bdbb9c394f46 Mon Sep 17 00:00:00 2001
From: Fabio Battaglia
Date: Wed, 8 Sep 2010 21:18:22 +0000
Subject: N64: saner fake date in getDateAndTime - Set the fake date in 2010
instead of year 3800
svn-id: r52644
---
backends/platform/n64/osys_n64_base.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'backends/platform')
diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp
index 06ff38e586..5288ddbfce 100644
--- a/backends/platform/n64/osys_n64_base.cpp
+++ b/backends/platform/n64/osys_n64_base.cpp
@@ -867,7 +867,7 @@ void OSystem_N64::getTimeAndDate(TimeDate &t) const {
t.tm_hour = (((now / 1000) / 60) / 60) % 24;
t.tm_mday = 1;
t.tm_mon = 0;
- t.tm_year = 1900;
+ t.tm_year = 110;
return;
}
--
cgit v1.2.3
From 39899e51d0e8386b9d1d55d94603aedfaef89076 Mon Sep 17 00:00:00 2001
From: John Willis
Date: Wed, 8 Sep 2010 21:43:46 +0000
Subject: GP2X: Clean up input code a little.
* Match the GP2XWiz input code.
svn-id: r52645
---
backends/platform/gp2x/events.cpp | 855 ++++++++++++++++++++---------------
backends/platform/gp2x/gp2x-common.h | 25 +-
backends/platform/gp2x/gp2x-hw.cpp | 25 +
backends/platform/gp2x/gp2x-hw.h | 8 +
backends/platform/gp2x/graphics.cpp | 30 +-
5 files changed, 562 insertions(+), 381 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/gp2x/events.cpp b/backends/platform/gp2x/events.cpp
index a40967743c..08553968d2 100644
--- a/backends/platform/gp2x/events.cpp
+++ b/backends/platform/gp2x/events.cpp
@@ -30,7 +30,6 @@
#include "backends/platform/gp2x/gp2x-common.h"
#include "backends/platform/gp2x/gp2x-hw.h"
-#include "backends/keymapper/keymapper.h"
#include "common/util.h"
#include "common/events.h"
#include "graphics/scaler/aspect.h" // for aspect2Real
@@ -42,27 +41,46 @@
#define JOY_XAXIS 0
#define JOY_YAXIS 1
-/* GP2X Wiz: Main Joystick Mappings */
+/* Quick default button states for modifiers. */
+int BUTTON_STATE_L = false;
+
+enum {
+ /* DPAD/Stick */
+ BUTTON_UP = 0,
+ BUTTON_UPLEFT = 1,
+ BUTTON_LEFT = 2,
+ BUTTON_DOWNLEFT = 3,
+ BUTTON_DOWN = 4,
+ BUTTON_DOWNRIGHT = 5,
+ BUTTON_RIGHT = 6,
+ BUTTON_UPRIGHT = 7,
+ /* Joystick Buttons */
+ BUTTON_MENU = 8, // Start on F100 GP2X
+ BUTTON_SELECT = 9,
+ BUTTON_L = 10,
+ BUTTON_R = 11,
+ BUTTON_A = 12,
+ BUTTON_B = 13,
+ BUTTON_X = 14,
+ BUTTON_Y = 15,
+ BUTTON_VOLUP = 16,
+ BUTTON_VOLDOWN = 17,
+ BUTTON_CLICK = 18
+};
+
enum {
- GP2X_BUTTON_UP = 0,
- GP2X_BUTTON_UPLEFT = 1,
- GP2X_BUTTON_LEFT = 2,
- GP2X_BUTTON_DOWNLEFT = 3,
- GP2X_BUTTON_DOWN = 4,
- GP2X_BUTTON_DOWNRIGHT = 5,
- GP2X_BUTTON_RIGHT = 6,
- GP2X_BUTTON_UPRIGHT = 7,
- GP2X_BUTTON_START = 8,
- GP2X_BUTTON_SELECT = 9,
- GP2X_BUTTON_L = 10,
- GP2X_BUTTON_R = 11,
- GP2X_BUTTON_A = 12,
- GP2X_BUTTON_B = 13,
- GP2X_BUTTON_X = 14,
- GP2X_BUTTON_Y = 15,
- GP2X_BUTTON_VOLUP = 16,
- GP2X_BUTTON_VOLDOWN = 17,
- GP2X_BUTTON_CLICK = 18
+ /* Unused Joystick Buttons on the GP2X */
+ BUTTON_HOME = 51,
+ BUTTON_HOLD = 52,
+ BUTTON_HELP = 53,
+ BUTTON_HELP2 = 54
+};
+
+enum {
+ /* Touchscreen TapMode */
+ TAPMODE_LEFT = 0,
+ TAPMODE_RIGHT = 1,
+ TAPMODE_HOVER = 2
};
static int mapKey(SDLKey key, SDLMod mod, Uint16 unicode) {
@@ -168,16 +186,22 @@ void OSystem_GP2X::handleKbdMouse() {
}
}
-static byte SDLModToOSystemKeyFlags(SDLMod mod) {
- byte b = 0;
+static void SDLModToOSystemKeyFlags(SDLMod mod, Common::Event &event) {
+
+ event.kbd.flags = 0;
+
if (mod & KMOD_SHIFT)
- b |= Common::KBD_SHIFT;
+ event.kbd.flags |= Common::KBD_SHIFT;
if (mod & KMOD_ALT)
- b |= Common::KBD_ALT;
+ event.kbd.flags |= Common::KBD_ALT;
if (mod & KMOD_CTRL)
- b |= Common::KBD_CTRL;
+ event.kbd.flags |= Common::KBD_CTRL;
- return b;
+ // Sticky flags
+ if (mod & KMOD_NUM)
+ event.kbd.flags |= Common::KBD_NUM;
+ if (mod & KMOD_CAPS)
+ event.kbd.flags |= Common::KBD_CAPS;
}
void OSystem_GP2X::moveStick() {
@@ -205,7 +229,6 @@ void OSystem_GP2X::moveStick() {
_km.x_down_count = 0;
}
-
if ((stickBtn[0])||(stickBtn[1])||(stickBtn[7])){
if (_km.y_down_count!=2){
_km.y_vel = -1;
@@ -224,14 +247,9 @@ void OSystem_GP2X::moveStick() {
}
}
-/* Quick default button states for modifiers. */
-int GP2X_BUTTON_STATE_L = false;
-
bool OSystem_GP2X::pollEvent(Common::Event &event) {
SDL_Event ev;
ev.type = SDL_NOEVENT;
- int axis;
- byte b = 0;
handleKbdMouse();
@@ -242,398 +260,483 @@ bool OSystem_GP2X::pollEvent(Common::Event &event) {
return true;
}
- // GP2X Input mappings.
+ while (SDL_PollEvent(&ev)) {
+ preprocessEvents(&ev);
+ if (dispatchSDLEvent(ev, event))
+ return true;
+ }
+ return false;
+}
+
+bool OSystem_GP2X::dispatchSDLEvent(SDL_Event &ev, Common::Event &event) {
+ switch (ev.type) {
+ case SDL_KEYDOWN:
+ return handleKeyDown(ev, event);
+ case SDL_KEYUP:
+ return handleKeyUp(ev, event);
+ case SDL_MOUSEMOTION:
+ return handleMouseMotion(ev, event);
+ case SDL_MOUSEBUTTONDOWN:
+ return handleMouseButtonDown(ev, event);
+ case SDL_MOUSEBUTTONUP:
+ return handleMouseButtonUp(ev, event);
+ case SDL_JOYBUTTONDOWN:
+ return handleJoyButtonDown(ev, event);
+ case SDL_JOYBUTTONUP:
+ return handleJoyButtonUp(ev, event);
+ case SDL_JOYAXISMOTION:
+ return handleJoyAxisMotion(ev, event);
+
+ case SDL_VIDEOEXPOSE:
+ _forceFull = true;
+ break;
+
+ case SDL_QUIT:
+ event.type = Common::EVENT_QUIT;
+ return true;
- /*
- Single Button
+ }
- Movement:
+ return false;
+}
- GP2X_BUTTON_UP Cursor Up
- GP2X_BUTTON_DOWN Cursor Down
- GP2X_BUTTON_LEFT Cursor Left
- GP2X_BUTTON_RIGHT Cursor Right
+bool OSystem_GP2X::handleKeyDown(SDL_Event &ev, Common::Event &event) {
- GP2X_BUTTON_UPLEFT Cursor Up Left
- GP2X_BUTTON_UPRIGHT Cursor Up Right
- GP2X_BUTTON_DOWNLEFT Cursor Down Left
- GP2X_BUTTON_DOWNRIGHT Cursor Down Right
+ SDLModToOSystemKeyFlags(SDL_GetModState(), event);
- Button Emulation:
+ // Handle scroll lock as a key modifier
+ if (ev.key.keysym.sym == SDLK_SCROLLOCK)
+ _scrollLock = !_scrollLock;
- GP2X_BUTTON_CLICK Left Mouse Click
- GP2X_BUTTON_A . (Period)
- GP2X_BUTTON_B Left Mouse Click
- GP2X_BUTTON_Y Space Bar
- GP2X_BUTTON_X Right Mouse Click
- GP2X_BUTTON_L Combo Modifier (Left Trigger)
- GP2X_BUTTON_R Return (Right Trigger)
- GP2X_BUTTON_START F5 (Game Menu)
- GP2X_BUTTON_SELECT Escape
- GP2X_BUTTON_VOLUP /dev/mixer Global Volume Up
- GP2X_BUTTON_VOLDOWN /dev/mixer Global Volume Down
+ if (_scrollLock)
+ event.kbd.flags |= Common::KBD_SCRL;
- Combos:
+ // Alt-Return and Alt-Enter toggle full screen mode
+ if (event.kbd.hasFlags(Common::KBD_ALT) && (ev.key.keysym.sym == SDLK_RETURN || ev.key.keysym.sym == SDLK_KP_ENTER)) {
+ beginGFXTransaction();
+ setFullscreenMode(!_videoMode.fullscreen);
+ endGFXTransaction();
+#ifdef USE_OSD
+ if (_videoMode.fullscreen)
+ displayMessageOnOSD("Fullscreen mode");
+ else
+ displayMessageOnOSD("Windowed mode");
+#endif
- GP2X_BUTTON_VOLUP & GP2X_BUTTON_VOLDOWN 0 (For Monkey 2 CP) or Virtual Keyboard if enabled
- GP2X_BUTTON_L & GP2X_BUTTON_SELECT Common::EVENT_QUIT (Calls Sync() to make sure SD is flushed)
- GP2X_BUTTON_L & GP2X_BUTTON_Y Toggles setZoomOnMouse() for larger then 320*240 games to scale to the point + raduis.
- GP2X_BUTTON_L & GP2X_BUTTON_START Common::EVENT_MAINMENU (ScummVM Global Main Menu)
- GP2X_BUTTON_L & GP2X_BUTTON_A Common::EVENT_PREDICTIVE_DIALOG for predictive text entry box (AGI games)
- */
+ return false;
+ }
- while (SDL_PollEvent(&ev)) {
+ // Alt-S: Create a screenshot
+ if (event.kbd.hasFlags(Common::KBD_ALT) && ev.key.keysym.sym == 's') {
+ char filename[20];
- switch (ev.type) {
- case SDL_KEYDOWN:{
- b = event.kbd.flags = SDLModToOSystemKeyFlags(SDL_GetModState());
+ for (int n = 0;; n++) {
+ SDL_RWops *file;
- const bool event_complete = remapKey(ev,event);
+ sprintf(filename, "scummvm%05d.bmp", n);
+ file = SDL_RWFromFile(filename, "r");
+ if (!file)
+ break;
+ SDL_RWclose(file);
+ }
+ if (saveScreenshot(filename))
+ printf("Saved '%s'\n", filename);
+ else
+ printf("Could not save screenshot!\n");
+ return false;
+ }
- if (event_complete)
- return true;
+ // Ctrl-m toggles mouse capture
+ if (event.kbd.hasFlags(Common::KBD_CTRL) && ev.key.keysym.sym == 'm') {
+ toggleMouseGrab();
+ return false;
+ }
- event.type = Common::EVENT_KEYDOWN;
- event.kbd.keycode = (Common::KeyCode)ev.key.keysym.sym;
- event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
+ if ((ev.key.keysym.mod & KMOD_CTRL) && ev.key.keysym.sym == 'q') {
+ event.type = Common::EVENT_QUIT;
+ return true;
+ }
- return true;
- }
- case SDL_KEYUP:
- {
- const bool event_complete = remapKey(ev,event);
+ if ((ev.key.keysym.mod & KMOD_CTRL) && ev.key.keysym.sym == 'u') {
+ event.type = Common::EVENT_MUTE;
+ return true;
+ }
- if (event_complete)
- return true;
+ // Ctrl-Alt- will change the GFX mode
+ if ((event.kbd.flags & (Common::KBD_CTRL|Common::KBD_ALT)) == (Common::KBD_CTRL|Common::KBD_ALT)) {
+ if (handleScalerHotkeys(ev.key))
+ return false;
+ }
- event.type = Common::EVENT_KEYUP;
- event.kbd.keycode = (Common::KeyCode)ev.key.keysym.sym;
- event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
- b = event.kbd.flags = SDLModToOSystemKeyFlags(SDL_GetModState());
+ if (remapKey(ev, event))
+ return true;
- // Ctrl-Alt- will change the GFX mode
- if ((b & (Common::KBD_CTRL|Common::KBD_ALT)) == (Common::KBD_CTRL|Common::KBD_ALT)) {
- // Swallow these key up events
- break;
- }
+ event.type = Common::EVENT_KEYDOWN;
+ event.kbd.keycode = (Common::KeyCode)ev.key.keysym.sym;
+ event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
- return true;
- }
- case SDL_MOUSEMOTION:
- event.type = Common::EVENT_MOUSEMOVE;
- fillMouseEvent(event, ev.motion.x, ev.motion.y);
+ return true;
+}
- setMousePos(event.mouse.x, event.mouse.y);
- return true;
+bool OSystem_GP2X::handleKeyUp(SDL_Event &ev, Common::Event &event) {
+ if (remapKey(ev, event))
+ return true;
+
+ event.type = Common::EVENT_KEYUP;
+ event.kbd.keycode = (Common::KeyCode)ev.key.keysym.sym;
+ event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
+
+ // Ctrl-Alt- will change the GFX mode
+ SDLModToOSystemKeyFlags(SDL_GetModState(), event);
+
+ // Set the scroll lock sticky flag
+ if (_scrollLock)
+ event.kbd.flags |= Common::KBD_SCRL;
+
+ if (isScalerHotkey(event))
+ // Swallow these key up events
+ return false;
+
+ return true;
+}
+
+bool OSystem_GP2X::handleMouseMotion(SDL_Event &ev, Common::Event &event) {
+ event.type = Common::EVENT_MOUSEMOVE;
+ fillMouseEvent(event, ev.motion.x, ev.motion.y);
- case SDL_MOUSEBUTTONDOWN:
- if (ev.button.button == SDL_BUTTON_LEFT)
- event.type = Common::EVENT_LBUTTONDOWN;
- else if (ev.button.button == SDL_BUTTON_RIGHT)
- event.type = Common::EVENT_RBUTTONDOWN;
+ setMousePos(event.mouse.x, event.mouse.y);
+ return true;
+}
+
+/* Custom handleMouseButtonDown/handleMouseButtonUp to deal with 'Tap Mode' for the touchscreen */
+
+bool OSystem_GP2X::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
+ if (ev.button.button == SDL_BUTTON_LEFT){
+ if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */
+ event.type = Common::EVENT_RBUTTONDOWN;
+ else if (GPH::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
+ event.type = Common::EVENT_LBUTTONDOWN;
+ else if (GPH::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */
+ event.type = Common::EVENT_RBUTTONDOWN;
+ else if (GPH::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
+ event.type = Common::EVENT_MOUSEMOVE;
+ else
+ event.type = Common::EVENT_LBUTTONDOWN; /* For normal mice etc. */
+ }
+ else if (ev.button.button == SDL_BUTTON_RIGHT)
+ event.type = Common::EVENT_RBUTTONDOWN;
#if defined(SDL_BUTTON_WHEELUP) && defined(SDL_BUTTON_WHEELDOWN)
- else if (ev.button.button == SDL_BUTTON_WHEELUP)
- event.type = Common::EVENT_WHEELUP;
- else if (ev.button.button == SDL_BUTTON_WHEELDOWN)
- event.type = Common::EVENT_WHEELDOWN;
+ else if (ev.button.button == SDL_BUTTON_WHEELUP)
+ event.type = Common::EVENT_WHEELUP;
+ else if (ev.button.button == SDL_BUTTON_WHEELDOWN)
+ event.type = Common::EVENT_WHEELDOWN;
#endif
#if defined(SDL_BUTTON_MIDDLE)
- else if (ev.button.button == SDL_BUTTON_MIDDLE)
- event.type = Common::EVENT_MBUTTONDOWN;
+ else if (ev.button.button == SDL_BUTTON_MIDDLE)
+ event.type = Common::EVENT_MBUTTONDOWN;
#endif
- else
- break;
+ else
+ return false;
- fillMouseEvent(event, ev.button.x, ev.button.y);
+ fillMouseEvent(event, ev.button.x, ev.button.y);
- return true;
+ return true;
+}
- case SDL_MOUSEBUTTONUP:
- if (ev.button.button == SDL_BUTTON_LEFT)
- event.type = Common::EVENT_LBUTTONUP;
- else if (ev.button.button == SDL_BUTTON_RIGHT)
- event.type = Common::EVENT_RBUTTONUP;
+bool OSystem_GP2X::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
+ if (ev.button.button == SDL_BUTTON_LEFT){
+ if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */
+ event.type = Common::EVENT_RBUTTONUP;
+ else if (GPH::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
+ event.type = Common::EVENT_LBUTTONUP;
+ else if (GPH::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */
+ event.type = Common::EVENT_RBUTTONUP;
+ else if (GPH::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
+ event.type = Common::EVENT_MOUSEMOVE;
+ else
+ event.type = Common::EVENT_LBUTTONUP; /* For normal mice etc. */
+
+ }
+ else if (ev.button.button == SDL_BUTTON_RIGHT)
+ event.type = Common::EVENT_RBUTTONUP;
#if defined(SDL_BUTTON_MIDDLE)
- else if (ev.button.button == SDL_BUTTON_MIDDLE)
- event.type = Common::EVENT_MBUTTONUP;
+ else if (ev.button.button == SDL_BUTTON_MIDDLE)
+ event.type = Common::EVENT_MBUTTONUP;
#endif
- else
- break;
- fillMouseEvent(event, ev.button.x, ev.button.y);
+ else
+ return false;
- return true;
+ fillMouseEvent(event, ev.button.x, ev.button.y);
+
+ return true;
+}
- // GP2X Button mapings. Main code
-
- case SDL_JOYBUTTONDOWN:
- _stickBtn[ev.jbutton.button] = 1;
- if (ev.jbutton.button == GP2X_BUTTON_B) {
- event.type = Common::EVENT_LBUTTONDOWN;
- fillMouseEvent(event, _km.x, _km.y);
- } else if (ev.jbutton.button == GP2X_BUTTON_CLICK) {
- event.type = Common::EVENT_LBUTTONDOWN;
- fillMouseEvent(event, _km.x, _km.y);
- } else if (ev.jbutton.button == GP2X_BUTTON_X) {
- event.type = Common::EVENT_RBUTTONDOWN;
- fillMouseEvent(event, _km.x, _km.y);
- } else if (_stickBtn[GP2X_BUTTON_L] && (ev.jbutton.button == GP2X_BUTTON_SELECT)) {
- event.type = Common::EVENT_QUIT;
- } else if (ev.jbutton.button < 8) {
- moveStick();
- event.type = Common::EVENT_MOUSEMOVE;
- fillMouseEvent(event, _km.x, _km.y);
- } else {
- event.type = Common::EVENT_KEYDOWN;
- event.kbd.flags = 0;
- switch (ev.jbutton.button) {
- case GP2X_BUTTON_L:
- GP2X_BUTTON_STATE_L = true;
- break;
- case GP2X_BUTTON_R:
- if (GP2X_BUTTON_STATE_L == true) {
+/* Custom handleJoyButtonDown/handleJoyButtonUp to deal with the joystick buttons on GPH devices */
+
+bool OSystem_GP2X::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) {
+
+ _stickBtn[ev.jbutton.button] = 1;
+ event.kbd.flags = 0;
+
+ switch (ev.jbutton.button) {
+ case BUTTON_UP:
+ case BUTTON_UPLEFT:
+ case BUTTON_LEFT:
+ case BUTTON_DOWNLEFT:
+ case BUTTON_DOWN:
+ case BUTTON_DOWNRIGHT:
+ case BUTTON_RIGHT:
+ case BUTTON_UPRIGHT:
+ moveStick();
+ event.type = Common::EVENT_MOUSEMOVE;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_B:
+ case BUTTON_CLICK:
+ if (BUTTON_STATE_L == true) {
+ setZoomOnMouse();
+ fillMouseEvent(event, _km.x, _km.y);
+ } else {
+ event.type = Common::EVENT_LBUTTONDOWN;
+ fillMouseEvent(event, _km.x, _km.y);
+ }
+ break;
+ case BUTTON_X:
+ event.type = Common::EVENT_RBUTTONDOWN;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_L:
+ BUTTON_STATE_L = true;
+ break;
+ case BUTTON_R:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
#ifdef ENABLE_VKEYBD
- event.kbd.keycode = Common::KEYCODE_F7;
- event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
+ event.kbd.keycode = Common::KEYCODE_F7;
+ event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
#else
- event.kbd.keycode = Common::KEYCODE_0;
- event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
+ event.kbd.keycode = Common::KEYCODE_0;
+ event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
#endif
- } else {
- event.kbd.keycode = Common::KEYCODE_RETURN;
- event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
- }
- break;
- case GP2X_BUTTON_SELECT:
- if (GP2X_BUTTON_STATE_L == true) {
- event.type = Common::EVENT_QUIT;
- } else {
- event.kbd.keycode = Common::KEYCODE_ESCAPE;
- event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
- }
- break;
- case GP2X_BUTTON_A:
- if (GP2X_BUTTON_STATE_L == true) {
- event.type = Common::EVENT_PREDICTIVE_DIALOG;
- } else {
- event.kbd.keycode = Common::KEYCODE_PERIOD;
- event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
- }
- break;
- case GP2X_BUTTON_Y:
- if (GP2X_BUTTON_STATE_L == true) {
- setZoomOnMouse();
- } else {
- event.kbd.keycode = Common::KEYCODE_SPACE;
- event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
- }
- break;
- case GP2X_BUTTON_START:
- if (GP2X_BUTTON_STATE_L == true) {
- event.type = Common::EVENT_MAINMENU;
- } else {
- event.kbd.keycode = Common::KEYCODE_F5;
- event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
- }
- break;
- case GP2X_BUTTON_VOLUP:
- GP2X_HW::mixerMoveVolume(2);
- if (GP2X_HW::volumeLevel == 100) {
- displayMessageOnOSD("Maximum Volume");
- } else {
- displayMessageOnOSD("Increasing Volume");
- }
- break;
-
- case GP2X_BUTTON_VOLDOWN:
- GP2X_HW::mixerMoveVolume(1);
- if (GP2X_HW::volumeLevel == 0) {
- displayMessageOnOSD("Minimal Volume");
- } else {
- displayMessageOnOSD("Decreasing Volume");
- }
- break;
- }
+ } else {
+ event.kbd.keycode = Common::KEYCODE_RETURN;
+ event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_SELECT:
+ case BUTTON_HOME:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
+ event.type = Common::EVENT_QUIT;
+ } else {
+ event.kbd.keycode = Common::KEYCODE_ESCAPE;
+ event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_A:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
+ event.type = Common::EVENT_PREDICTIVE_DIALOG;
+ } else {
+ event.kbd.keycode = Common::KEYCODE_PERIOD;
+ event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_Y:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
+ GPH::ToggleTapMode();
+ if (GPH::tapmodeLevel == TAPMODE_LEFT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode' - Left Click");
+ } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode' - Right Click");
+ } else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode' - Hover (No Click)");
}
- return true;
+ } else {
+ event.kbd.keycode = Common::KEYCODE_SPACE;
+ event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_MENU:
+ case BUTTON_HELP:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
+ event.type = Common::EVENT_MAINMENU;
+ } else {
+ event.kbd.keycode = Common::KEYCODE_F5;
+ event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_VOLUP:
+ GP2X_HW::mixerMoveVolume(2);
+ if (GP2X_HW::volumeLevel == 100) {
+ displayMessageOnOSD("Maximum Volume");
+ } else {
+ displayMessageOnOSD("Increasing Volume");
+ }
+ break;
+
+ case BUTTON_VOLDOWN:
+ GP2X_HW::mixerMoveVolume(1);
+ if (GP2X_HW::volumeLevel == 0) {
+ displayMessageOnOSD("Minimal Volume");
+ } else {
+ displayMessageOnOSD("Decreasing Volume");
+ }
+ break;
+ case BUTTON_HOLD:
+ event.type = Common::EVENT_QUIT;
+ break;
+ case BUTTON_HELP2:
+ GPH::ToggleTapMode();
+ if (GPH::tapmodeLevel == TAPMODE_LEFT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode': Left Click");
+ } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode': Right Click");
+ } else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode': Hover (No Click)");
+ }
+ break;
+ }
+ return true;
+}
- case SDL_JOYBUTTONUP:
- _stickBtn[ev.jbutton.button] = 0;
- if (ev.jbutton.button == GP2X_BUTTON_B) {
- event.type = Common::EVENT_LBUTTONUP;
- fillMouseEvent(event, _km.x, _km.y);
- } else if (ev.jbutton.button == GP2X_BUTTON_CLICK) {
- event.type = Common::EVENT_LBUTTONUP;
- fillMouseEvent(event, _km.x, _km.y);
- } else if (ev.jbutton.button == GP2X_BUTTON_X) {
- event.type = Common::EVENT_RBUTTONUP;
- fillMouseEvent(event, _km.x, _km.y);
- } else if (ev.jbutton.button < 8) {
- moveStick();
- event.type = Common::EVENT_MOUSEMOVE;
- fillMouseEvent(event, _km.x, _km.y);
- } else {
- event.type = Common::EVENT_KEYUP;
- event.kbd.flags = 0;
- switch (ev.jbutton.button) {
- case GP2X_BUTTON_SELECT:
- event.kbd.keycode = Common::KEYCODE_ESCAPE;
- event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
- break;
- case GP2X_BUTTON_A:
- event.kbd.keycode = Common::KEYCODE_PERIOD;
- event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
- break;
- case GP2X_BUTTON_Y:
- event.kbd.keycode = Common::KEYCODE_SPACE;
- event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
- break;
- case GP2X_BUTTON_START:
- if (GP2X_BUTTON_STATE_L == true) {
- event.type = Common::EVENT_MAINMENU;
- } else {
- event.kbd.keycode = Common::KEYCODE_F5;
- event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
- }
- break;
- case GP2X_BUTTON_L:
- GP2X_BUTTON_STATE_L = false;
- break;
- case GP2X_BUTTON_R:
- if (GP2X_BUTTON_STATE_L == true) {
+bool OSystem_GP2X::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) {
+ _stickBtn[ev.jbutton.button] = 0;
+ event.kbd.flags = 0;
+
+ switch (ev.jbutton.button) {
+ case BUTTON_UP:
+ case BUTTON_UPLEFT:
+ case BUTTON_LEFT:
+ case BUTTON_DOWNLEFT:
+ case BUTTON_DOWN:
+ case BUTTON_DOWNRIGHT:
+ case BUTTON_RIGHT:
+ case BUTTON_UPRIGHT:
+ moveStick();
+ event.type = Common::EVENT_MOUSEMOVE;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_B:
+ case BUTTON_CLICK:
+ if (BUTTON_STATE_L == true) {
+ break;
+ } else {
+ event.type = Common::EVENT_LBUTTONUP;
+ fillMouseEvent(event, _km.x, _km.y);
+ }
+ break;
+ case BUTTON_X:
+ event.type = Common::EVENT_RBUTTONUP;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_L:
+ BUTTON_STATE_L = false;
+ break;
+ case BUTTON_SELECT:
+ case BUTTON_HOME:
+ event.type = Common::EVENT_KEYUP;
+ event.kbd.keycode = Common::KEYCODE_ESCAPE;
+ event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
+ break;
+ case BUTTON_A:
+ event.type = Common::EVENT_KEYUP;
+ event.kbd.keycode = Common::KEYCODE_PERIOD;
+ event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
+ break;
+ case BUTTON_Y:
+ event.type = Common::EVENT_KEYUP;
+ event.kbd.keycode = Common::KEYCODE_SPACE;
+ event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
+ break;
+ case BUTTON_MENU:
+ case BUTTON_HELP:
+ event.type = Common::EVENT_KEYUP;
+ if (BUTTON_STATE_L == true) {
+ event.type = Common::EVENT_MAINMENU;
+ } else {
+ event.kbd.keycode = Common::KEYCODE_F5;
+ event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_R:
+ event.type = Common::EVENT_KEYUP;
+ if (BUTTON_STATE_L == true) {
#ifdef ENABLE_VKEYBD
- event.kbd.keycode = Common::KEYCODE_F7;
- event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
+ event.kbd.keycode = Common::KEYCODE_F7;
+ event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
#else
- event.kbd.keycode = Common::KEYCODE_0;
- event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
+ event.kbd.keycode = Common::KEYCODE_0;
+ event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
#endif
- } else {
- event.kbd.keycode = Common::KEYCODE_RETURN;
- event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
- }
- break;
- case GP2X_BUTTON_VOLUP:
- break;
- case GP2X_BUTTON_VOLDOWN:
- break;
- }
- }
- return true;
+ } else {
+ event.kbd.keycode = Common::KEYCODE_RETURN;
+ event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_VOLUP:
+ break;
+ case BUTTON_VOLDOWN:
+ break;
+ case BUTTON_HOLD:
+ break;
+ case BUTTON_HELP2:
+ break;
+ }
+return true;
+}
- case SDL_JOYAXISMOTION:
- axis = ev.jaxis.value;
- if ( axis > JOY_DEADZONE) {
- axis -= JOY_DEADZONE;
- event.type = Common::EVENT_MOUSEMOVE;
- } else if ( axis < -JOY_DEADZONE ) {
- axis += JOY_DEADZONE;
- event.type = Common::EVENT_MOUSEMOVE;
- } else
- axis = 0;
-
- if ( ev.jaxis.axis == JOY_XAXIS) {
- if (axis != 0) {
- _km.x_vel = (axis > 0) ? 1:-1;
- _km.x_down_count = 1;
- } else {
- _km.x_vel = 0;
- _km.x_down_count = 0;
- }
+bool OSystem_GP2X::handleJoyAxisMotion(SDL_Event &ev, Common::Event &event) {
+ int axis = ev.jaxis.value;
+ if ( axis > JOY_DEADZONE) {
+ axis -= JOY_DEADZONE;
+ event.type = Common::EVENT_MOUSEMOVE;
+ } else if ( axis < -JOY_DEADZONE ) {
+ axis += JOY_DEADZONE;
+ event.type = Common::EVENT_MOUSEMOVE;
+ } else
+ axis = 0;
+
+ if ( ev.jaxis.axis == JOY_XAXIS) {
+#ifdef JOY_ANALOG
+ _km.x_vel = axis/2000;
+ _km.x_down_count = 0;
+#else
+ if (axis != 0) {
+ _km.x_vel = (axis > 0) ? 1:-1;
+ _km.x_down_count = 1;
+ } else {
+ _km.x_vel = 0;
+ _km.x_down_count = 0;
+ }
+#endif
- } else if (ev.jaxis.axis == JOY_YAXIS) {
+ } else if (ev.jaxis.axis == JOY_YAXIS) {
#ifndef JOY_INVERT_Y
- axis = -axis;
+ axis = -axis;
#endif
#ifdef JOY_ANALOG
- _km.y_vel = -axis / 2000;
- _km.y_down_count = 0;
+ _km.y_vel = -axis / 2000;
+ _km.y_down_count = 0;
#else
- if (axis != 0) {
- _km.y_vel = (-axis > 0) ? 1: -1;
- _km.y_down_count = 1;
- } else {
- _km.y_vel = 0;
- _km.y_down_count = 0;
- }
-#endif
- }
-
- fillMouseEvent(event, _km.x, _km.y);
-
- return true;
-
- case SDL_VIDEOEXPOSE:
- _forceFull = true;
- break;
-
- case SDL_QUIT:
- event.type = Common::EVENT_QUIT;
- return true;
+ if (axis != 0) {
+ _km.y_vel = (-axis > 0) ? 1: -1;
+ _km.y_down_count = 1;
+ } else {
+ _km.y_vel = 0;
+ _km.y_down_count = 0;
}
+#endif
}
- return false;
-}
-
-bool OSystem_GP2X::remapKey(SDL_Event &ev,Common::Event &event) {
- return false;
-}
-
-void OSystem_GP2X::setupKeymapper() {
-#ifdef ENABLE_KEYMAPPER
- using namespace Common;
- Keymapper *mapper = getEventManager()->getKeymapper();
-
- HardwareKeySet *keySet = new HardwareKeySet();
- keySet->addHardwareKey(new HardwareKey( "a", KeyState(KEYCODE_a), "a", kActionKeyType ));
- keySet->addHardwareKey(new HardwareKey( "s", KeyState(KEYCODE_s), "s", kActionKeyType ));
- keySet->addHardwareKey(new HardwareKey( "d", KeyState(KEYCODE_d), "d", kActionKeyType ));
- keySet->addHardwareKey(new HardwareKey( "f", KeyState(KEYCODE_f), "f", kActionKeyType ));
- keySet->addHardwareKey(new HardwareKey( "n", KeyState(KEYCODE_n), "n (vk)", kTriggerLeftKeyType, kVirtualKeyboardActionType ));
- keySet->addHardwareKey(new HardwareKey( "m", KeyState(KEYCODE_m), "m (remap)", kTriggerRightKeyType, kKeyRemapActionType ));
- keySet->addHardwareKey(new HardwareKey( "[", KeyState(KEYCODE_LEFTBRACKET), "[ (select)", kSelectKeyType ));
- keySet->addHardwareKey(new HardwareKey( "]", KeyState(KEYCODE_RIGHTBRACKET), "] (start)", kStartKeyType ));
- mapper->registerHardwareKeySet(keySet);
-
- Keymap *globalMap = new Keymap("global");
- Keymap *guiMap = new Keymap("gui");
- Action *act;
- Event evt ;
-
- act = new Action(globalMap, "MENU", "Menu", kGenericActionType, kSelectKeyType);
- act->addKeyEvent(KeyState(KEYCODE_F5, ASCII_F5, 0));
-
- act = new Action(globalMap, "SKCT", "Skip", kGenericActionType, kActionKeyType);
- act->addKeyEvent(KeyState(KEYCODE_ESCAPE, ASCII_ESCAPE, 0));
-
- act = new Action(globalMap, "PAUS", "Pause", kGenericActionType, kStartKeyType);
- act->addKeyEvent(KeyState(KEYCODE_SPACE, ' ', 0));
-
- act = new Action(globalMap, "SKLI", "Skip line", kGenericActionType, kActionKeyType);
- act->addKeyEvent(KeyState(KEYCODE_PERIOD, '.', 0));
-
- act = new Action(globalMap, "VIRT", "Display keyboard", kVirtualKeyboardActionType);
- act->addKeyEvent(KeyState(KEYCODE_F6, ASCII_F6, 0));
- act = new Action(globalMap, "REMP", "Remap keys", kKeyRemapActionType);
- act->addKeyEvent(KeyState(KEYCODE_F7, ASCII_F7, 0));
+ fillMouseEvent(event, _km.x, _km.y);
- mapper->addGlobalKeymap(globalMap);
-
- act = new Action(guiMap, "CLOS", "Close", kGenericActionType, kStartKeyType);
- act->addKeyEvent(KeyState(KEYCODE_ESCAPE, ASCII_ESCAPE, 0));
-
- act = new Action(guiMap, "CLIK", "Mouse click");
- act->addLeftClickEvent();
-
- act = new Action(guiMap, "VIRT", "Display keyboard", kVirtualKeyboardActionType);
- act->addKeyEvent(KeyState(KEYCODE_F6, ASCII_F6, 0));
-
- act = new Action(guiMap, "REMP", "Remap keys", kKeyRemapActionType);
- act->addKeyEvent(KeyState(KEYCODE_F7, ASCII_F7, 0));
+ return true;
+}
- mapper->addGlobalKeymap(guiMap);
- mapper->pushKeymap("global");
-#endif
+bool OSystem_GP2X::remapKey(SDL_Event &ev, Common::Event &event) {
+ return false;
}
-
diff --git a/backends/platform/gp2x/gp2x-common.h b/backends/platform/gp2x/gp2x-common.h
index b54e2d4d4f..96d88b8fd4 100644
--- a/backends/platform/gp2x/gp2x-common.h
+++ b/backends/platform/gp2x/gp2x-common.h
@@ -113,6 +113,24 @@ public:
// Sets up the keymapper with the backends hardware key set
void setupKeymapper();
+protected:
+ virtual bool dispatchSDLEvent(SDL_Event &ev, Common::Event &event);
+
+ // Handlers for specific SDL events, called by pollEvent.
+ // This way, if a backend inherits fromt the SDL backend, it can
+ // change the behavior of only a single event, without having to override all
+ // of pollEvent.
+ virtual bool handleKeyDown(SDL_Event &ev, Common::Event &event);
+ virtual bool handleKeyUp(SDL_Event &ev, Common::Event &event);
+ virtual bool handleMouseMotion(SDL_Event &ev, Common::Event &event);
+ virtual bool handleMouseButtonDown(SDL_Event &ev, Common::Event &event);
+ virtual bool handleMouseButtonUp(SDL_Event &ev, Common::Event &event);
+ virtual bool handleJoyButtonDown(SDL_Event &ev, Common::Event &event);
+ virtual bool handleJoyButtonUp(SDL_Event &ev, Common::Event &event);
+ virtual bool handleJoyAxisMotion(SDL_Event &ev, Common::Event &event);
+
+public:
+
// Set function that generates samples
void setupMixer();
static void mixCallback(void *s, byte *samples, int len);
@@ -153,6 +171,7 @@ public:
bool hasFeature(Feature f);
void setFeatureState(Feature f, bool enable);
bool getFeatureState(Feature f);
+ void preprocessEvents(SDL_Event *event) {}
void displayMessageOnOSD(const char *msg);
@@ -297,6 +316,9 @@ protected:
kMouseColorKey = 1
};
+ // Scroll lock state - since SDL doesn't track it
+ bool _scrollLock;
+
// joystick
SDL_Joystick *_joystick;
bool _stickBtn[32];
@@ -374,7 +396,8 @@ protected:
virtual bool remapKey(SDL_Event &ev, Common::Event &event);
- void handleScalerHotkeys(const SDL_KeyboardEvent &key);
+ bool handleScalerHotkeys(const SDL_KeyboardEvent &key);
+ bool isScalerHotkey(const Common::Event &event);
void moveStick();
int _gp2xInputType;
diff --git a/backends/platform/gp2x/gp2x-hw.cpp b/backends/platform/gp2x/gp2x-hw.cpp
index 2dc5b4f579..75e4ca6471 100644
--- a/backends/platform/gp2x/gp2x-hw.cpp
+++ b/backends/platform/gp2x/gp2x-hw.cpp
@@ -197,3 +197,28 @@ void gp2x_video_wait_vsync(void)
} /* namespace GP2X_HW */
+namespace GPH {
+
+enum {
+ /* Touchscreen TapMode */
+ TAPMODE_LEFT = 0,
+ TAPMODE_RIGHT = 1,
+ TAPMODE_HOVER = 2
+};
+
+int tapmodeLevel = TAPMODE_LEFT;
+
+void ToggleTapMode() {
+ if (tapmodeLevel == TAPMODE_LEFT) {
+ tapmodeLevel = TAPMODE_RIGHT;
+ } else if (tapmodeLevel == TAPMODE_RIGHT) {
+ tapmodeLevel = TAPMODE_HOVER;
+ } else if (tapmodeLevel == TAPMODE_HOVER) {
+ tapmodeLevel = TAPMODE_LEFT;
+ } else {
+ tapmodeLevel = TAPMODE_LEFT;
+ }
+}
+
+
+} /* namespace GPH */
diff --git a/backends/platform/gp2x/gp2x-hw.h b/backends/platform/gp2x/gp2x-hw.h
index 7e72812cc4..872c44f118 100644
--- a/backends/platform/gp2x/gp2x-hw.h
+++ b/backends/platform/gp2x/gp2x-hw.h
@@ -54,4 +54,12 @@ extern void gp2x_video_wait_vsync(void);
} /* namespace GP2X_HW */
+namespace GPH {
+
+extern int tapmodeLevel;
+
+extern void ToggleTapMode();
+
+} /* namespace GPH */
+
#endif //GP2X_HW_H
diff --git a/backends/platform/gp2x/graphics.cpp b/backends/platform/gp2x/graphics.cpp
index 4a3c668c52..d776db218e 100644
--- a/backends/platform/gp2x/graphics.cpp
+++ b/backends/platform/gp2x/graphics.cpp
@@ -1601,7 +1601,7 @@ void OSystem_GP2X::displayMessageOnOSD(const char *msg) {
#pragma mark --- Misc ---
#pragma mark -
-void OSystem_GP2X::handleScalerHotkeys(const SDL_KeyboardEvent &key) {
+bool OSystem_GP2X::handleScalerHotkeys(const SDL_KeyboardEvent &key) {
// Ctrl-Alt-a toggles aspect ratio correction
if (key.keysym.sym == 'a') {
beginGFXTransaction();
@@ -1620,8 +1620,8 @@ void OSystem_GP2X::handleScalerHotkeys(const SDL_KeyboardEvent &key) {
);
displayMessageOnOSD(buffer);
-
- return;
+ internUpdateScreen();
+ return true;
}
int newMode = -1;
@@ -1641,7 +1641,7 @@ void OSystem_GP2X::handleScalerHotkeys(const SDL_KeyboardEvent &key) {
if (isNormalNumber || isKeypadNumber) {
_scalerType = key.keysym.sym - (isNormalNumber ? SDLK_1 : SDLK_KP1);
if (_scalerType >= ARRAYSIZE(s_gfxModeSwitchTable))
- return;
+ return false;
while (s_gfxModeSwitchTable[_scalerType][factor] < 0) {
assert(factor > 0);
@@ -1675,5 +1675,27 @@ void OSystem_GP2X::handleScalerHotkeys(const SDL_KeyboardEvent &key) {
displayMessageOnOSD(buffer);
}
}
+ internUpdateScreen();
+
+ return true;
+ } else {
+ return false;
+ }
+}
+
+bool OSystem_GP2X::isScalerHotkey(const Common::Event &event) {
+ if ((event.kbd.flags & (Common::KBD_CTRL|Common::KBD_ALT)) == (Common::KBD_CTRL|Common::KBD_ALT)) {
+ const bool isNormalNumber = (Common::KEYCODE_1 <= event.kbd.keycode && event.kbd.keycode <= Common::KEYCODE_9);
+ const bool isKeypadNumber = (Common::KEYCODE_KP1 <= event.kbd.keycode && event.kbd.keycode <= Common::KEYCODE_KP9);
+ const bool isScaleKey = (event.kbd.keycode == Common::KEYCODE_EQUALS || event.kbd.keycode == Common::KEYCODE_PLUS || event.kbd.keycode == Common::KEYCODE_MINUS ||
+ event.kbd.keycode == Common::KEYCODE_KP_PLUS || event.kbd.keycode == Common::KEYCODE_KP_MINUS);
+
+ if (isNormalNumber || isKeypadNumber) {
+ int keyValue = event.kbd.keycode - (isNormalNumber ? Common::KEYCODE_1 : Common::KEYCODE_KP1);
+ if (keyValue >= ARRAYSIZE(s_gfxModeSwitchTable))
+ return false;
+ }
+ return (isScaleKey || event.kbd.keycode == 'a');
}
+ return false;
}
--
cgit v1.2.3
From 9307304d7eb6acbd2351355a30d24cb95a259db7 Mon Sep 17 00:00:00 2001
From: John Willis
Date: Thu, 9 Sep 2010 09:48:32 +0000
Subject: GP2XWIZ: Rename GP2XWIZ backend to GPH.
* This better reflects the supported devices
from GPH (GamePark Holdings), namely the
GP2XWiz, Caanoo and merging in of the old
GP2X backend.
svn-id: r52648
---
backends/platform/gp2xwiz/build/README-GP2XWIZ | 140 -------
backends/platform/gp2xwiz/build/build.sh | 19 -
backends/platform/gp2xwiz/build/bundle-debug.sh | 9 -
backends/platform/gp2xwiz/build/bundle.sh | 9 -
backends/platform/gp2xwiz/build/clean.sh | 8 -
backends/platform/gp2xwiz/build/config-alleng.sh | 22 -
backends/platform/gp2xwiz/build/config.sh | 22 -
backends/platform/gp2xwiz/build/scummvm-gdb.gpe | 16 -
backends/platform/gp2xwiz/build/scummvm.gpe | 15 -
backends/platform/gp2xwiz/build/scummvm.ini | 5 -
backends/platform/gp2xwiz/build/scummvm.png | Bin 2656 -> 0 bytes
backends/platform/gp2xwiz/build/scummvmb.png | Bin 34274 -> 0 bytes
backends/platform/gp2xwiz/caanoo/build.sh | 12 -
backends/platform/gp2xwiz/caanoo/bundle-debug.sh | 9 -
backends/platform/gp2xwiz/caanoo/bundle.sh | 9 -
backends/platform/gp2xwiz/caanoo/caanoo-bundle.mk | 69 ----
backends/platform/gp2xwiz/caanoo/clean.sh | 8 -
backends/platform/gp2xwiz/caanoo/config-alleng.sh | 16 -
backends/platform/gp2xwiz/caanoo/config.sh | 16 -
backends/platform/gp2xwiz/caanoo/scummvm-gdb.gpe | 16 -
backends/platform/gp2xwiz/caanoo/scummvm.gpe | 15 -
backends/platform/gp2xwiz/gp2xwiz-bundle.mk | 75 ----
backends/platform/gp2xwiz/gp2xwiz-events.cpp | 482 ----------------------
backends/platform/gp2xwiz/gp2xwiz-graphics.cpp | 470 ---------------------
backends/platform/gp2xwiz/gp2xwiz-hw.cpp | 109 -----
backends/platform/gp2xwiz/gp2xwiz-hw.h | 61 ---
backends/platform/gp2xwiz/gp2xwiz-main.cpp | 213 ----------
backends/platform/gp2xwiz/gp2xwiz-sdl.h | 81 ----
backends/platform/gp2xwiz/module.mk | 15 -
backends/platform/gph/build/README-GP2XWIZ | 140 +++++++
backends/platform/gph/build/build.sh | 19 +
backends/platform/gph/build/bundle-debug.sh | 9 +
backends/platform/gph/build/bundle.sh | 9 +
backends/platform/gph/build/clean.sh | 8 +
backends/platform/gph/build/config-alleng.sh | 22 +
backends/platform/gph/build/config.sh | 22 +
backends/platform/gph/build/scummvm-gdb.gpe | 16 +
backends/platform/gph/build/scummvm.gpe | 15 +
backends/platform/gph/build/scummvm.ini | 5 +
backends/platform/gph/build/scummvm.png | Bin 0 -> 2656 bytes
backends/platform/gph/build/scummvmb.png | Bin 0 -> 34274 bytes
backends/platform/gph/caanoo-bundle.mk | 69 ++++
backends/platform/gph/caanoo/build.sh | 12 +
backends/platform/gph/caanoo/bundle-debug.sh | 9 +
backends/platform/gph/caanoo/bundle.sh | 9 +
backends/platform/gph/caanoo/clean.sh | 8 +
backends/platform/gph/caanoo/config-alleng.sh | 16 +
backends/platform/gph/caanoo/config.sh | 16 +
backends/platform/gph/caanoo/scummvm-gdb.gpe | 16 +
backends/platform/gph/caanoo/scummvm.gpe | 15 +
backends/platform/gph/gp2xwiz-bundle.mk | 75 ++++
backends/platform/gph/gph-events.cpp | 482 ++++++++++++++++++++++
backends/platform/gph/gph-graphics.cpp | 470 +++++++++++++++++++++
backends/platform/gph/gph-hw.cpp | 109 +++++
backends/platform/gph/gph-hw.h | 52 +++
backends/platform/gph/gph-main.cpp | 213 ++++++++++
backends/platform/gph/gph-sdl.h | 81 ++++
backends/platform/gph/module.mk | 15 +
58 files changed, 1932 insertions(+), 1941 deletions(-)
delete mode 100644 backends/platform/gp2xwiz/build/README-GP2XWIZ
delete mode 100755 backends/platform/gp2xwiz/build/build.sh
delete mode 100755 backends/platform/gp2xwiz/build/bundle-debug.sh
delete mode 100755 backends/platform/gp2xwiz/build/bundle.sh
delete mode 100755 backends/platform/gp2xwiz/build/clean.sh
delete mode 100755 backends/platform/gp2xwiz/build/config-alleng.sh
delete mode 100755 backends/platform/gp2xwiz/build/config.sh
delete mode 100755 backends/platform/gp2xwiz/build/scummvm-gdb.gpe
delete mode 100755 backends/platform/gp2xwiz/build/scummvm.gpe
delete mode 100644 backends/platform/gp2xwiz/build/scummvm.ini
delete mode 100644 backends/platform/gp2xwiz/build/scummvm.png
delete mode 100644 backends/platform/gp2xwiz/build/scummvmb.png
delete mode 100755 backends/platform/gp2xwiz/caanoo/build.sh
delete mode 100755 backends/platform/gp2xwiz/caanoo/bundle-debug.sh
delete mode 100755 backends/platform/gp2xwiz/caanoo/bundle.sh
delete mode 100755 backends/platform/gp2xwiz/caanoo/caanoo-bundle.mk
delete mode 100755 backends/platform/gp2xwiz/caanoo/clean.sh
delete mode 100755 backends/platform/gp2xwiz/caanoo/config-alleng.sh
delete mode 100755 backends/platform/gp2xwiz/caanoo/config.sh
delete mode 100755 backends/platform/gp2xwiz/caanoo/scummvm-gdb.gpe
delete mode 100755 backends/platform/gp2xwiz/caanoo/scummvm.gpe
delete mode 100755 backends/platform/gp2xwiz/gp2xwiz-bundle.mk
delete mode 100644 backends/platform/gp2xwiz/gp2xwiz-events.cpp
delete mode 100644 backends/platform/gp2xwiz/gp2xwiz-graphics.cpp
delete mode 100644 backends/platform/gp2xwiz/gp2xwiz-hw.cpp
delete mode 100644 backends/platform/gp2xwiz/gp2xwiz-hw.h
delete mode 100644 backends/platform/gp2xwiz/gp2xwiz-main.cpp
delete mode 100644 backends/platform/gp2xwiz/gp2xwiz-sdl.h
delete mode 100644 backends/platform/gp2xwiz/module.mk
create mode 100644 backends/platform/gph/build/README-GP2XWIZ
create mode 100755 backends/platform/gph/build/build.sh
create mode 100755 backends/platform/gph/build/bundle-debug.sh
create mode 100755 backends/platform/gph/build/bundle.sh
create mode 100755 backends/platform/gph/build/clean.sh
create mode 100755 backends/platform/gph/build/config-alleng.sh
create mode 100755 backends/platform/gph/build/config.sh
create mode 100755 backends/platform/gph/build/scummvm-gdb.gpe
create mode 100755 backends/platform/gph/build/scummvm.gpe
create mode 100644 backends/platform/gph/build/scummvm.ini
create mode 100644 backends/platform/gph/build/scummvm.png
create mode 100644 backends/platform/gph/build/scummvmb.png
create mode 100755 backends/platform/gph/caanoo-bundle.mk
create mode 100755 backends/platform/gph/caanoo/build.sh
create mode 100755 backends/platform/gph/caanoo/bundle-debug.sh
create mode 100755 backends/platform/gph/caanoo/bundle.sh
create mode 100755 backends/platform/gph/caanoo/clean.sh
create mode 100755 backends/platform/gph/caanoo/config-alleng.sh
create mode 100755 backends/platform/gph/caanoo/config.sh
create mode 100755 backends/platform/gph/caanoo/scummvm-gdb.gpe
create mode 100755 backends/platform/gph/caanoo/scummvm.gpe
create mode 100755 backends/platform/gph/gp2xwiz-bundle.mk
create mode 100644 backends/platform/gph/gph-events.cpp
create mode 100644 backends/platform/gph/gph-graphics.cpp
create mode 100644 backends/platform/gph/gph-hw.cpp
create mode 100644 backends/platform/gph/gph-hw.h
create mode 100644 backends/platform/gph/gph-main.cpp
create mode 100644 backends/platform/gph/gph-sdl.h
create mode 100644 backends/platform/gph/module.mk
(limited to 'backends/platform')
diff --git a/backends/platform/gp2xwiz/build/README-GP2XWIZ b/backends/platform/gp2xwiz/build/README-GP2XWIZ
deleted file mode 100644
index ec8142a6f3..0000000000
--- a/backends/platform/gp2xwiz/build/README-GP2XWIZ
+++ /dev/null
@@ -1,140 +0,0 @@
-ScummVM - GP2X WIZ SPECIFIC README - HEAD SVN
-------------------------------------------------------------------------
-
-Contents:
-
- * About the backend/port <#About_the_backendport>
- * Game compatability <#Game_compatibility>
- * Included engines <#Included_engines>
- * Supported audio options <#Supported_audio_options>
- * Supported cut-scene options <#Supported_cut-scene_options>
- * Recent changes <#Recent_changes>
- * How to save <#How_to_save>
- * Controller mappings <#Controller_mappings>
- * Known issues <#Knonw_issues>
- * Additional resources/links <#Additional_resourceslinks>
- * Credits <#Credits>
-
-------------------------------------------------------------------------
-
-Please refer to the:
-
-GP2X/GP2XWiz ScummVM Forum:
-WiKi:
-
-for the most current information on the port and any updates to this
-documentation.
-
-------------------------------------------------------------------------
-About the backend/port
-
-This is the readme for the official GP2XWiz ScummVM backend (also known as
-the GP2XWiz port).
-
-This is an SVN test release of ScummVM for the GP2XWiz, it would be
-appreciated if this SVN test distribution was not mirrored and that
-people be directed to http://scummvm.distant-earth.com/ instead for
-updated SVN builds.
-
-Full supported official releases of the GP2X WIZ ScummVM backend are made in
-line with main official releases and are avalalble from the ScummVM
-downloads page .
-
-This build is in an active state of development and as such no
-"expected" behavior can be guaranteed ;).
-
-------------------------------------------------------------------------
-Game compatibility
-
-For information on the compatability of a specific game please refer to
-the GP2XWiz compatability section of the ScummVM WiKi
-.
-
-Please note the version and date of the ScummVM build you are running
-when reviewing the above list.
-
-------------------------------------------------------------------------
-Supported audio options
-
-Raw audio.
-MP3 audio.
-OGG Vorbis audio.
-
-FLAC audio is currently unsupported.
-
-For best results use uncompressed audio in games.
-
-------------------------------------------------------------------------
-How to save
-
-NOTE: Everything is saved to the SD card, saves are stored in the saves
-folder under your main ScummVM executable unless you set another save
-location.
-
-The configiration file for ScummVM (.scummvmrc) is stored in the same
-place as the ScummVM executable.
-
-The save process below is for Scumm engine games but the principle is
-the same for all.
-
-In Game.
-
-1. Menu Button
-2. Select SAVE with B
-3. Select a position with B
-4. Right trigger puts 0 in the name box for some text.
-5. Press B to save
-
-Basically the emulated keys you can use are equivelent to the values
-buttons are mapped to,
-
-------------------------------------------------------------------------
-Controller mappings
-
-Touch screen:
-Touch: Move Pointer and Left click
-
-Mouse emulation:
-
-dPad: Move Pointer
-B: Left click
-X: Right click
-
-Keyboard emulation:
-
-Right Trigger: Return
-Select: Escape
-Y: Space Bar (Pause)
-Menu: Game Menu (Save, Load, Quit etc.)
-Volume Buttons: Increase and Decrease volume
-
-Fancy button combos:
-
-NOTE: To use button combos press and hold the Left Trigger then...
-
-Right Trigger: Display Virtual Keyboard
-Menu: Bring up the Global main menu for ScummVM
-Select: Exit ScummVM completely (and gracefully)
-
-------------------------------------------------------------------------
-Known issues
-
-No major known issues
-
-------------------------------------------------------------------------
-Additional resources/links
-
- * ScummVM WiKi GP2X page
- * ScummVM forums GP2X forum
-
- * My own ScummVM page (for
- SVN/test builds)
- * Main ScummVM site (for official supported
- release builds)
-
-------------------------------------------------------------------------
-Credits
-
-Core ScummVM code (c) The ScummVM Team
-GP2X Wiz backend (c) John Willis
-Detailed (c) information can be found within the source code
diff --git a/backends/platform/gp2xwiz/build/build.sh b/backends/platform/gp2xwiz/build/build.sh
deleted file mode 100755
index 876c3e378a..0000000000
--- a/backends/platform/gp2xwiz/build/build.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-
-echo Quick script to make building all the time less painful.
-
-# Set the paths up here to support the build.
-
-export PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin:$PATH
-export PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin:$PATH
-export CXX=arm-open2x-linux-g++
-export CC=arm-open2x-linux-gcc
-export CXXFLAGS="-mcpu=arm926ej-s -mtune=arm926ej-s"
-export ASFLAGS=-mfloat-abi=soft
-
-cd ../../../..
-
-echo Building ScummVM for GP2X Wiz.
-make
-
-echo Build for GP2X Wiz - complete - Please check build logs.
diff --git a/backends/platform/gp2xwiz/build/bundle-debug.sh b/backends/platform/gp2xwiz/build/bundle-debug.sh
deleted file mode 100755
index cd5145b31d..0000000000
--- a/backends/platform/gp2xwiz/build/bundle-debug.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-echo Quick script to make building a distribution of the GP2X Wiz backend more consistent.
-
-cd ../../../..
-
-echo Building ScummVM for GP2X Wiz.
-
-make gp2xwiz-bundle-debug
diff --git a/backends/platform/gp2xwiz/build/bundle.sh b/backends/platform/gp2xwiz/build/bundle.sh
deleted file mode 100755
index 579e2dc77b..0000000000
--- a/backends/platform/gp2xwiz/build/bundle.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-echo Quick script to make building a distribution of the GP2X Wiz backend more consistent.
-
-cd ../../../..
-
-echo Building ScummVM for GP2X Wiz.
-
-make gp2xwiz-bundle
diff --git a/backends/platform/gp2xwiz/build/clean.sh b/backends/platform/gp2xwiz/build/clean.sh
deleted file mode 100755
index 5ec1b9e62c..0000000000
--- a/backends/platform/gp2xwiz/build/clean.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-echo Quick script to make building all the time less painful.
-
-cd ../../../..
-
-echo Cleaning ScummVM for the GP2X Wiz.
-make clean
diff --git a/backends/platform/gp2xwiz/build/config-alleng.sh b/backends/platform/gp2xwiz/build/config-alleng.sh
deleted file mode 100755
index cfed463edf..0000000000
--- a/backends/platform/gp2xwiz/build/config-alleng.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-
-echo Quick script to make running configure all the time less painful
-echo and let all the build work be done from the backend/build folder.
-
-# Set the paths up here to generate the config.
-
-PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin:$PATH
-PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin:$PATH
-
-# Export the tool names for cross-compiling
-export CXX=arm-open2x-linux-g++
-export CXXFLAGS="-mcpu=arm926ej-s -mtune=arm926ej-s"
-export CPPFLAGS=-I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include
-export LDFLAGS=-L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib
-export DEFINES=-DNDEBUG
-
-# Edit the configure line to suit.
-cd ../../../..
-./configure --backend=gp2xwiz --disable-mt32emu --host=gp2xwiz --disable-flac --disable-nasm --disable-hq-scalers --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-all-engines --enable-vkeybd --enable-plugins --default-dynamic
-
-echo Generating config for GP2X Wiz complete. Check for errors.
diff --git a/backends/platform/gp2xwiz/build/config.sh b/backends/platform/gp2xwiz/build/config.sh
deleted file mode 100755
index 54c4795298..0000000000
--- a/backends/platform/gp2xwiz/build/config.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-
-echo Quick script to make running configure all the time less painful
-echo and let all the build work be done from the backend/build folder.
-
-# Set the paths up here to generate the config.
-
-PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin:$PATH
-PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin:$PATH
-
-# Export the tool names for cross-compiling
-export CXX=arm-open2x-linux-g++
-export CXXFLAGS="-mcpu=arm926ej-s -mtune=arm926ej-s"
-export CPPFLAGS=-I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include
-export LDFLAGS=-L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib
-export DEFINES=-DNDEBUG
-
-# Edit the configure line to suit.
-cd ../../../..
-./configure --backend=gp2xwiz --disable-mt32emu --host=gp2xwiz --disable-flac --disable-nasm --disable-hq-scalers --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-vkeybd --enable-plugins --default-dynamic
-
-echo Generating config for GP2X Wiz complete. Check for errors.
diff --git a/backends/platform/gp2xwiz/build/scummvm-gdb.gpe b/backends/platform/gp2xwiz/build/scummvm-gdb.gpe
deleted file mode 100755
index 64b6c8b974..0000000000
--- a/backends/platform/gp2xwiz/build/scummvm-gdb.gpe
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-# Export the location of any libs ScummVM depends on
-# (to avoid installing to the NAND and overwriting the broken ones there).
-export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH
-
-# Run ScummVM via GDB (so make sure you have a terminal open or serial).
-# Oh, and GDB installed of course ;)
-gdb --args ./scummvm.wiz --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
-
-# Sync the SD card to check that everything is written.
-sync
-
-# Return to the GPH menu screen
-cd /usr/gp2x
-exec /usr/gp2x/gp2xmenu
diff --git a/backends/platform/gp2xwiz/build/scummvm.gpe b/backends/platform/gp2xwiz/build/scummvm.gpe
deleted file mode 100755
index 42cc00a22a..0000000000
--- a/backends/platform/gp2xwiz/build/scummvm.gpe
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-# Export the location of any libs ScummVM depends on
-# (to avoid installing to the NAND and overwriting the broken ones there).
-export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH
-
-# Run ScummVM, important this bit.
-./scummvm.wiz --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
-
-# Sync the SD card to check that everything is written.
-sync
-
-# Return to the GPH menu screen
-cd /usr/gp2x
-exec /usr/gp2x/gp2xmenu
diff --git a/backends/platform/gp2xwiz/build/scummvm.ini b/backends/platform/gp2xwiz/build/scummvm.ini
deleted file mode 100644
index c9cce92379..0000000000
--- a/backends/platform/gp2xwiz/build/scummvm.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[info]
-name="ScummVM"
-path="/scummvm/scummvm.gpe"
-icon="/scummvm/scummvm.png"
-title="/scummvm/scummvmb.png"
diff --git a/backends/platform/gp2xwiz/build/scummvm.png b/backends/platform/gp2xwiz/build/scummvm.png
deleted file mode 100644
index 128e59efc4..0000000000
Binary files a/backends/platform/gp2xwiz/build/scummvm.png and /dev/null differ
diff --git a/backends/platform/gp2xwiz/build/scummvmb.png b/backends/platform/gp2xwiz/build/scummvmb.png
deleted file mode 100644
index 24a27bc0e1..0000000000
Binary files a/backends/platform/gp2xwiz/build/scummvmb.png and /dev/null differ
diff --git a/backends/platform/gp2xwiz/caanoo/build.sh b/backends/platform/gp2xwiz/caanoo/build.sh
deleted file mode 100755
index 8000d2595d..0000000000
--- a/backends/platform/gp2xwiz/caanoo/build.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-
-echo Quick script to make building all the time less painful.
-
-# Set the paths up here to support the build.
-
-cd ../../../..
-
-echo Building ScummVM for GP2X Caanoo.
-make
-
-echo Build for GP2X Caanoo - complete - Please check build logs.
diff --git a/backends/platform/gp2xwiz/caanoo/bundle-debug.sh b/backends/platform/gp2xwiz/caanoo/bundle-debug.sh
deleted file mode 100755
index 2d5cefe80e..0000000000
--- a/backends/platform/gp2xwiz/caanoo/bundle-debug.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-echo Quick script to make building a distribution of the GP2X Caanoo backend more consistent.
-
-cd ../../../..
-
-echo Building ScummVM for GP2X Caanoo.
-
-make caanoo-bundle-debug
diff --git a/backends/platform/gp2xwiz/caanoo/bundle.sh b/backends/platform/gp2xwiz/caanoo/bundle.sh
deleted file mode 100755
index 76fd31cec6..0000000000
--- a/backends/platform/gp2xwiz/caanoo/bundle.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-echo Quick script to make building a distribution of the GP2X Caanoo backend more consistent.
-
-cd ../../../..
-
-echo Building ScummVM for GP2X Caanoo.
-
-make caanoo-bundle
diff --git a/backends/platform/gp2xwiz/caanoo/caanoo-bundle.mk b/backends/platform/gp2xwiz/caanoo/caanoo-bundle.mk
deleted file mode 100755
index d02ed5fe16..0000000000
--- a/backends/platform/gp2xwiz/caanoo/caanoo-bundle.mk
+++ /dev/null
@@ -1,69 +0,0 @@
-# Special target to create bundles for the GP2X Caanoo.
-
-#bundle_name = release/scummvm-caanoo-`date '+%Y-%m-%d'`
-bundle_name = release/scummvm-caanoo
-f=$(shell which $(STRIP))
-libloc = $(shell dirname $(f))
-
-caanoo-bundle: $(EXECUTABLE)
- $(MKDIR) "$(bundle_name)"
- $(MKDIR) "$(bundle_name)/scummvm"
- $(MKDIR) "$(bundle_name)/scummvm/saves"
- $(MKDIR) "$(bundle_name)/scummvm/engine-data"
- $(MKDIR) "$(bundle_name)/scummvm/lib"
-
- echo "Please put your save games in this dir" >> "$(bundle_name)/scummvm/saves/PUT_SAVES_IN_THIS_DIR"
-
- $(CP) $(srcdir)/backends/platform/gp2xwiz/caanoo/scummvm.gpe $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.png $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvmb.png $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gp2xwiz/build/README-GP2XWIZ $(bundle_name)/scummvm/README-CAANOO
- $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.ini $(bundle_name)/
-
- $(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
- $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/
- $(INSTALL) -c -m 644 $(DIST_FILES_ENGINEDATA) $(bundle_name)/scummvm/engine-data
- $(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)/scummvm/
-
- $(STRIP) $(EXECUTABLE) -o $(bundle_name)/scummvm/$(EXECUTABLE)
-
-ifdef DYNAMIC_MODULES
- $(INSTALL) -d "$(bundle_name)/scummvm/plugins"
- $(INSTALL) -c -m 644 $(PLUGINS) "$(bundle_name)/scummvm/plugins"
- $(STRIP) $(bundle_name)/scummvm/plugins/*
-endif
-
- tar -C $(bundle_name) -cvjf $(bundle_name).tar.bz2 .
- rm -R ./$(bundle_name)
-
-caanoo-bundle-debug: $(EXECUTABLE)
- $(MKDIR) "$(bundle_name)"
- $(MKDIR) "$(bundle_name)/scummvm"
- $(MKDIR) "$(bundle_name)/scummvm/saves"
- $(MKDIR) "$(bundle_name)/scummvm/engine-data"
- $(MKDIR) "$(bundle_name)/scummvm/lib"
-
- echo "Please put your save games in this dir" >> "$(bundle_name)/scummvm/saves/PUT_SAVES_IN_THIS_DIR"
-
- $(CP) $(srcdir)/backends/platform/gp2xwiz/caanoo/scummvm-gdb.gpe $(bundle_name)/scummvm/scummvm.gpe
- $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.png $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvmb.png $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gp2xwiz/build/README-GP2XWIZ $(bundle_name)/scummvm/README-CAANOO
- $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.ini $(bundle_name)/
-
- $(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
- $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/
- $(INSTALL) -c -m 644 $(DIST_FILES_ENGINEDATA) $(bundle_name)/scummvm/engine-data
- $(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)/scummvm/
-
- $(INSTALL) -c -m 777 $(srcdir)/$(EXECUTABLE) $(bundle_name)/scummvm/$(EXECUTABLE)
-
-ifdef DYNAMIC_MODULES
- $(INSTALL) -d "$(bundle_name)/scummvm/plugins"
- $(INSTALL) -c -m 644 $(PLUGINS) "$(bundle_name)/scummvm/plugins"
-endif
-
- tar -C $(bundle_name) -cvjf $(bundle_name)-debug.tar.bz2 .
- rm -R ./$(bundle_name)
-
-.PHONY: caanoo-bundle caanoo-bundle-debug
diff --git a/backends/platform/gp2xwiz/caanoo/clean.sh b/backends/platform/gp2xwiz/caanoo/clean.sh
deleted file mode 100755
index 5ec1b9e62c..0000000000
--- a/backends/platform/gp2xwiz/caanoo/clean.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-echo Quick script to make building all the time less painful.
-
-cd ../../../..
-
-echo Cleaning ScummVM for the GP2X Wiz.
-make clean
diff --git a/backends/platform/gp2xwiz/caanoo/config-alleng.sh b/backends/platform/gp2xwiz/caanoo/config-alleng.sh
deleted file mode 100755
index 7a097c268b..0000000000
--- a/backends/platform/gp2xwiz/caanoo/config-alleng.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-echo Quick script to make running configure all the time less painful
-echo and let all the build work be done from the backend/build folder.
-
-# Assume Caanoo toolchain/build env.
-. /opt/arm-caanoo/environment-setup
-
-# Export the tool names for cross-compiling
-export DEFINES=-DNDEBUG
-
-# Edit the configure line to suit.
-cd ../../../..
-./configure --backend=caanoo --disable-mt32emu --host=caanoo --disable-alsa --disable-flac --disable-nasm --disable-vorbis --disable-hq-scalers --with-sdl-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/bin --with-mpeg2-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --enable-tremor --with-tremor-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --enable-zlib --with-zlib-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --enable-mad --with-mad-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr --enable-all-engines --enable-vkeybd --enable-plugins --default-dynamic
-
-echo Generating config for GP2X Caanoo complete. Check for errors.
diff --git a/backends/platform/gp2xwiz/caanoo/config.sh b/backends/platform/gp2xwiz/caanoo/config.sh
deleted file mode 100755
index 73ce5da624..0000000000
--- a/backends/platform/gp2xwiz/caanoo/config.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-echo Quick script to make running configure all the time less painful
-echo and let all the build work be done from the backend/build folder.
-
-# Assume Caanoo toolchain/build env.
-. /opt/arm-caanoo/environment-setup
-
-# Export the tool names for cross-compiling
-export DEFINES=-DNDEBUG
-
-# Edit the configure line to suit.
-cd ../../../..
-./configure --backend=caanoo --disable-mt32emu --host=caanoo --disable-alsa --disable-flac --disable-nasm --disable-vorbis --disable-hq-scalers --with-sdl-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr/bin --with-mpeg2-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr --enable-tremor --with-tremor-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr --enable-zlib --with-zlib-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr --enable-mad --with-mad-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr --enable-vkeybd --enable-plugins --default-dynamic
-
-echo Generating config for GP2X Caanoo complete. Check for errors.
diff --git a/backends/platform/gp2xwiz/caanoo/scummvm-gdb.gpe b/backends/platform/gp2xwiz/caanoo/scummvm-gdb.gpe
deleted file mode 100755
index a8f2aae0fe..0000000000
--- a/backends/platform/gp2xwiz/caanoo/scummvm-gdb.gpe
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-# Export the location of any libs ScummVM depends on
-# (to avoid installing to the NAND and overwriting the broken ones there).
-export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH
-
-# Run ScummVM via GDB (so make sure you have a terminal open or serial).
-# Oh, and GDB installed of course ;)
-gdb --args ./scummvm.caanoo --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
-
-# Sync the SD card to check that everything is written.
-sync
-
-# Return to the GPH menu screen
-cd /usr/gp2x
-exec /usr/gp2x/gp2xmenu
diff --git a/backends/platform/gp2xwiz/caanoo/scummvm.gpe b/backends/platform/gp2xwiz/caanoo/scummvm.gpe
deleted file mode 100755
index 8341ffc3d7..0000000000
--- a/backends/platform/gp2xwiz/caanoo/scummvm.gpe
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-# Export the location of any libs ScummVM depends on
-# (to avoid installing to the NAND and overwriting the broken ones there).
-export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH
-
-# Run ScummVM, important this bit.
-./scummvm.caanoo --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
-
-# Sync the SD card to check that everything is written.
-sync
-
-# Return to the GPH menu screen
-cd /usr/gp2x
-exec /usr/gp2x/gp2xmenu
diff --git a/backends/platform/gp2xwiz/gp2xwiz-bundle.mk b/backends/platform/gp2xwiz/gp2xwiz-bundle.mk
deleted file mode 100755
index c572b86939..0000000000
--- a/backends/platform/gp2xwiz/gp2xwiz-bundle.mk
+++ /dev/null
@@ -1,75 +0,0 @@
-# Special target to create bundles for the GP2X Wiz.
-
-#bundle_name = release/scummvm-wiz-`date '+%Y-%m-%d'`
-bundle_name = release/scummvm-gp2xwiz
-f=$(shell which $(STRIP))
-libloc = $(shell dirname $(f))
-
-gp2xwiz-bundle: $(EXECUTABLE)
- $(MKDIR) "$(bundle_name)"
- $(MKDIR) "$(bundle_name)/scummvm"
- $(MKDIR) "$(bundle_name)/scummvm/saves"
- $(MKDIR) "$(bundle_name)/scummvm/engine-data"
- $(MKDIR) "$(bundle_name)/scummvm/lib"
-
- echo "Please put your save games in this dir" >> "$(bundle_name)/scummvm/saves/PUT_SAVES_IN_THIS_DIR"
-
- $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.gpe $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.png $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvmb.png $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gp2xwiz/build/README-GP2XWIZ $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.ini $(bundle_name)/
-
- $(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
- $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/
- $(INSTALL) -c -m 644 $(DIST_FILES_ENGINEDATA) $(bundle_name)/scummvm/engine-data
- $(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)/scummvm/
-
- $(STRIP) $(EXECUTABLE) -o $(bundle_name)/scummvm/$(EXECUTABLE)
-
-ifdef DYNAMIC_MODULES
- $(INSTALL) -d "$(bundle_name)/scummvm/plugins"
- $(INSTALL) -c -m 644 $(PLUGINS) "$(bundle_name)/scummvm/plugins"
- $(STRIP) $(bundle_name)/scummvm/plugins/*
-endif
-
- $(CP) $(libloc)/../lib/libz.so.1.2.3 $(bundle_name)/scummvm/lib/libz.so.1
- $(CP) $(libloc)/../lib/libvorbisidec.so.1.0.2 $(bundle_name)/scummvm/lib/libvorbisidec.so.1
-
- tar -C $(bundle_name) -cvjf $(bundle_name).tar.bz2 .
- rm -R ./$(bundle_name)
-
-gp2xwiz-bundle-debug: $(EXECUTABLE)
- $(MKDIR) "$(bundle_name)"
- $(MKDIR) "$(bundle_name)/scummvm"
- $(MKDIR) "$(bundle_name)/scummvm/saves"
- $(MKDIR) "$(bundle_name)/scummvm/engine-data"
- $(MKDIR) "$(bundle_name)/scummvm/lib"
-
- echo "Please put your save games in this dir" >> "$(bundle_name)/scummvm/saves/PUT_SAVES_IN_THIS_DIR"
-
- $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm-gdb.gpe $(bundle_name)/scummvm/scummvm.gpe
- $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.png $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvmb.png $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gp2xwiz/build/README-GP2XWIZ $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.ini $(bundle_name)/
-
- $(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
- $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/
- $(INSTALL) -c -m 644 $(DIST_FILES_ENGINEDATA) $(bundle_name)/scummvm/engine-data
- $(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)/scummvm/
-
- $(INSTALL) -c -m 777 $(srcdir)/$(EXECUTABLE) $(bundle_name)/scummvm/$(EXECUTABLE)
-
-ifdef DYNAMIC_MODULES
- $(INSTALL) -d "$(bundle_name)/scummvm/plugins"
- $(INSTALL) -c -m 644 $(PLUGINS) "$(bundle_name)/scummvm/plugins"
-endif
-
- $(CP) $(libloc)/../lib/libz.so.1.2.3 $(bundle_name)/scummvm/lib/libz.so.1
- $(CP) $(libloc)/../lib/libvorbisidec.so.1.0.2 $(bundle_name)/scummvm/lib/libvorbisidec.so.1
-
- tar -C $(bundle_name) -cvjf $(bundle_name)-debug.tar.bz2 .
- rm -R ./$(bundle_name)
-
-.PHONY: gp2xwiz-bundle gp2xwiz-bundle-debug
diff --git a/backends/platform/gp2xwiz/gp2xwiz-events.cpp b/backends/platform/gp2xwiz/gp2xwiz-events.cpp
deleted file mode 100644
index b226dbddb0..0000000000
--- a/backends/platform/gp2xwiz/gp2xwiz-events.cpp
+++ /dev/null
@@ -1,482 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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.
- *
- * $URL$
- * $Id$
- *
- */
-
-/*
- * GPH: Device Specific Event Handling.
- *
- */
-
-#include "backends/platform/gp2xwiz/gp2xwiz-sdl.h"
-#include "backends/platform/gp2xwiz/gp2xwiz-hw.h"
-#include "graphics/scaler/aspect.h"
-
-#include "common/util.h"
-#include "common/events.h"
-
-#define JOY_DEADZONE 2200
-
-#define JOY_XAXIS 0
-#define JOY_YAXIS 1
-
-/* Quick default button states for modifiers. */
-int BUTTON_STATE_L = false;
-
-#if defined(CAANOO)
-
- /* Caanoo: Main Joystick Button Mappings */
- /* The Caanoo has an analogue stick so no digital DPAD */
- enum {
- /* Joystick Buttons */
- BUTTON_A = 0,
- BUTTON_X = 1,
- BUTTON_B = 2,
- BUTTON_Y = 3,
- BUTTON_L = 4,
- BUTTON_R = 5,
- BUTTON_HOME = 6, // Home
- BUTTON_HOLD = 7, // Hold (on Power)
- BUTTON_HELP = 8, // Help I
- BUTTON_HELP2 = 9, // Help II
- BUTTON_CLICK = 10 // Stick Click
- };
-
- enum {
- /* Unused Joystick Buttons on the Caanoo */
- BUTTON_VOLUP = 51,
- BUTTON_VOLDOWN = 52,
- BUTTON_UP = 53,
- BUTTON_UPLEFT = 54,
- BUTTON_LEFT = 55,
- BUTTON_DOWNLEFT = 56,
- BUTTON_DOWN = 57,
- BUTTON_DOWNRIGHT = 58,
- BUTTON_RIGHT = 59,
- BUTTON_UPRIGHT = 60,
- BUTTON_MENU = 61,
- BUTTON_SELECT = 62
- };
-
-#else
-
- /* Wiz: Main Joystick Mappings */
- enum {
- /* DPAD */
- BUTTON_UP = 0,
- BUTTON_UPLEFT = 1,
- BUTTON_LEFT = 2,
- BUTTON_DOWNLEFT = 3,
- BUTTON_DOWN = 4,
- BUTTON_DOWNRIGHT = 5,
- BUTTON_RIGHT = 6,
- BUTTON_UPRIGHT = 7,
- /* Joystick Buttons */
- BUTTON_MENU = 8,
- BUTTON_SELECT = 9,
- BUTTON_L = 10,
- BUTTON_R = 11,
- BUTTON_A = 12,
- BUTTON_B = 13,
- BUTTON_X = 14,
- BUTTON_Y = 15,
- BUTTON_VOLUP = 16,
- BUTTON_VOLDOWN = 17
- };
-
- enum {
- /* Unused Joystick Buttons on the Wiz */
- BUTTON_HOME = 51,
- BUTTON_HOLD = 52,
- BUTTON_CLICK = 53,
- BUTTON_HELP = 54,
- BUTTON_HELP2 = 55
- };
-
-#endif
-
-enum {
- /* Touchscreen TapMode */
- TAPMODE_LEFT = 0,
- TAPMODE_RIGHT = 1,
- TAPMODE_HOVER = 2
-};
-
-static int mapKey(SDLKey key, SDLMod mod, Uint16 unicode) {
- if (key >= SDLK_F1 && key <= SDLK_F9) {
- return key - SDLK_F1 + Common::ASCII_F1;
- } else if (key >= SDLK_KP0 && key <= SDLK_KP9) {
- return key - SDLK_KP0 + '0';
- } else if (key >= SDLK_UP && key <= SDLK_PAGEDOWN) {
- return key;
- } else if (unicode) {
- return unicode;
- } else if (key >= 'a' && key <= 'z' && (mod & KMOD_SHIFT)) {
- return key & ~0x20;
- } else if (key >= SDLK_NUMLOCK && key <= SDLK_EURO) {
- return 0;
- }
- return key;
-}
-
-
-void OSystem_GPH::fillMouseEvent(Common::Event &event, int x, int y) {
- if (_videoMode.mode == GFX_HALF && !_overlayVisible){
- event.mouse.x = x*2;
- event.mouse.y = y*2;
- } else {
- event.mouse.x = x;
- event.mouse.y = y;
- }
-
- // Update the "keyboard mouse" coords
- _km.x = x;
- _km.y = y;
-
- // Adjust for the screen scaling
- if (!_overlayVisible) {
- event.mouse.x /= _videoMode.scaleFactor;
- event.mouse.y /= _videoMode.scaleFactor;
- if (_videoMode.aspectRatioCorrection)
- event.mouse.y = aspect2Real(event.mouse.y);
- }
-}
-
-
-void OSystem_GPH::moveStick() {
- bool stickBtn[32];
-
- memcpy(stickBtn, _stickBtn, sizeof(stickBtn));
-
- if ((stickBtn[0])||(stickBtn[2])||(stickBtn[4])||(stickBtn[6]))
- stickBtn[1] = stickBtn[3] = stickBtn[5] = stickBtn[7] = 0;
-
- if ((stickBtn[1])||(stickBtn[2])||(stickBtn[3])) {
- if (_km.x_down_count!=2) {
- _km.x_vel = -1;
- _km.x_down_count = 1;
- } else
- _km.x_vel = -4;
- } else if ((stickBtn[5])||(stickBtn[6])||(stickBtn[7])) {
- if (_km.x_down_count!=2) {
- _km.x_vel = 1;
- _km.x_down_count = 1;
- } else
- _km.x_vel = 4;
- } else {
- _km.x_vel = 0;
- _km.x_down_count = 0;
- }
-
- if ((stickBtn[0])||(stickBtn[1])||(stickBtn[7])) {
- if (_km.y_down_count!=2) {
- _km.y_vel = -1;
- _km.y_down_count = 1;
- } else
- _km.y_vel = -4;
- } else if ((stickBtn[3])||(stickBtn[4])||(stickBtn[5])) {
- if (_km.y_down_count!=2) {
- _km.y_vel = 1;
- _km.y_down_count = 1;
- } else
- _km.y_vel = 4;
- } else {
- _km.y_vel = 0;
- _km.y_down_count = 0;
- }
-}
-
-/* Custom handleMouseButtonDown/handleMouseButtonUp to deal with 'Tap Mode' for the touchscreen */
-
-bool OSystem_GPH::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
- if (ev.button.button == SDL_BUTTON_LEFT){
- if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */
- event.type = Common::EVENT_RBUTTONDOWN;
- else if (GPH::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
- event.type = Common::EVENT_LBUTTONDOWN;
- else if (GPH::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */
- event.type = Common::EVENT_RBUTTONDOWN;
- else if (GPH::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
- event.type = Common::EVENT_MOUSEMOVE;
- else
- event.type = Common::EVENT_LBUTTONDOWN; /* For normal mice etc. */
- }
- else if (ev.button.button == SDL_BUTTON_RIGHT)
- event.type = Common::EVENT_RBUTTONDOWN;
-#if defined(SDL_BUTTON_WHEELUP) && defined(SDL_BUTTON_WHEELDOWN)
- else if (ev.button.button == SDL_BUTTON_WHEELUP)
- event.type = Common::EVENT_WHEELUP;
- else if (ev.button.button == SDL_BUTTON_WHEELDOWN)
- event.type = Common::EVENT_WHEELDOWN;
-#endif
-#if defined(SDL_BUTTON_MIDDLE)
- else if (ev.button.button == SDL_BUTTON_MIDDLE)
- event.type = Common::EVENT_MBUTTONDOWN;
-#endif
- else
- return false;
-
- fillMouseEvent(event, ev.button.x, ev.button.y);
-
- return true;
-}
-
-bool OSystem_GPH::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
- if (ev.button.button == SDL_BUTTON_LEFT){
- if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */
- event.type = Common::EVENT_RBUTTONUP;
- else if (GPH::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
- event.type = Common::EVENT_LBUTTONUP;
- else if (GPH::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */
- event.type = Common::EVENT_RBUTTONUP;
- else if (GPH::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
- event.type = Common::EVENT_MOUSEMOVE;
- else
- event.type = Common::EVENT_LBUTTONUP; /* For normal mice etc. */
-
- }
- else if (ev.button.button == SDL_BUTTON_RIGHT)
- event.type = Common::EVENT_RBUTTONUP;
-#if defined(SDL_BUTTON_MIDDLE)
- else if (ev.button.button == SDL_BUTTON_MIDDLE)
- event.type = Common::EVENT_MBUTTONUP;
-#endif
- else
- return false;
-
- fillMouseEvent(event, ev.button.x, ev.button.y);
-
- return true;
-}
-
-/* Custom handleJoyButtonDown/handleJoyButtonUp to deal with the joystick buttons on GPH devices */
-
-bool OSystem_GPH::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) {
-
- _stickBtn[ev.jbutton.button] = 1;
- event.kbd.flags = 0;
-
- switch (ev.jbutton.button) {
- case BUTTON_UP:
- case BUTTON_UPLEFT:
- case BUTTON_LEFT:
- case BUTTON_DOWNLEFT:
- case BUTTON_DOWN:
- case BUTTON_DOWNRIGHT:
- case BUTTON_RIGHT:
- case BUTTON_UPRIGHT:
- moveStick();
- event.type = Common::EVENT_MOUSEMOVE;
- fillMouseEvent(event, _km.x, _km.y);
- break;
- case BUTTON_B:
- case BUTTON_CLICK:
- event.type = Common::EVENT_LBUTTONDOWN;
- fillMouseEvent(event, _km.x, _km.y);
- break;
- case BUTTON_X:
- event.type = Common::EVENT_RBUTTONDOWN;
- fillMouseEvent(event, _km.x, _km.y);
- break;
- case BUTTON_L:
- BUTTON_STATE_L = true;
- break;
- case BUTTON_R:
- event.type = Common::EVENT_KEYDOWN;
- if (BUTTON_STATE_L == true) {
-#ifdef ENABLE_VKEYBD
- event.kbd.keycode = Common::KEYCODE_F7;
- event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
-#else
- event.kbd.keycode = Common::KEYCODE_0;
- event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
-#endif
- } else {
- event.kbd.keycode = Common::KEYCODE_RETURN;
- event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_SELECT:
- case BUTTON_HOME:
- event.type = Common::EVENT_KEYDOWN;
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_QUIT;
- } else {
- event.kbd.keycode = Common::KEYCODE_ESCAPE;
- event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_A:
- event.type = Common::EVENT_KEYDOWN;
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_PREDICTIVE_DIALOG;
- } else {
- event.kbd.keycode = Common::KEYCODE_PERIOD;
- event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_Y:
- event.type = Common::EVENT_KEYDOWN;
- if (BUTTON_STATE_L == true) {
- GPH::ToggleTapMode();
- if (GPH::tapmodeLevel == TAPMODE_LEFT) {
- displayMessageOnOSD("Touchscreen 'Tap Mode' - Left Click");
- } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
- displayMessageOnOSD("Touchscreen 'Tap Mode' - Right Click");
- } else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
- displayMessageOnOSD("Touchscreen 'Tap Mode' - Hover (No Click)");
- }
- } else {
- event.kbd.keycode = Common::KEYCODE_SPACE;
- event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_MENU:
- case BUTTON_HELP:
- event.type = Common::EVENT_KEYDOWN;
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_MAINMENU;
- } else {
- event.kbd.keycode = Common::KEYCODE_F5;
- event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_VOLUP:
- WIZ_HW::mixerMoveVolume(2);
- if (WIZ_HW::volumeLevel == 100) {
- displayMessageOnOSD("Maximum Volume");
- } else {
- displayMessageOnOSD("Increasing Volume");
- }
- break;
- case BUTTON_VOLDOWN:
- WIZ_HW::mixerMoveVolume(1);
- if (WIZ_HW::volumeLevel == 0) {
- displayMessageOnOSD("Minimal Volume");
- } else {
- displayMessageOnOSD("Decreasing Volume");
- }
- break;
- case BUTTON_HOLD:
- event.type = Common::EVENT_QUIT;
- break;
- case BUTTON_HELP2:
- GPH::ToggleTapMode();
- if (GPH::tapmodeLevel == TAPMODE_LEFT) {
- displayMessageOnOSD("Touchscreen 'Tap Mode': Left Click");
- } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
- displayMessageOnOSD("Touchscreen 'Tap Mode': Right Click");
- } else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
- displayMessageOnOSD("Touchscreen 'Tap Mode': Hover (No Click)");
- }
- break;
- }
- return true;
-}
-
-bool OSystem_GPH::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) {
-
- _stickBtn[ev.jbutton.button] = 0;
- event.kbd.flags = 0;
-
- switch (ev.jbutton.button) {
- case BUTTON_UP:
- case BUTTON_UPLEFT:
- case BUTTON_LEFT:
- case BUTTON_DOWNLEFT:
- case BUTTON_DOWN:
- case BUTTON_DOWNRIGHT:
- case BUTTON_RIGHT:
- case BUTTON_UPRIGHT:
- moveStick();
- event.type = Common::EVENT_MOUSEMOVE;
- fillMouseEvent(event, _km.x, _km.y);
- break;
- case BUTTON_B:
- case BUTTON_CLICK:
- event.type = Common::EVENT_LBUTTONUP;
- fillMouseEvent(event, _km.x, _km.y);
- break;
- case BUTTON_X:
- event.type = Common::EVENT_RBUTTONUP;
- fillMouseEvent(event, _km.x, _km.y);
- break;
- case BUTTON_L:
- BUTTON_STATE_L = false;
- break;
- case BUTTON_SELECT:
- case BUTTON_HOME:
- event.type = Common::EVENT_KEYUP;
- event.kbd.keycode = Common::KEYCODE_ESCAPE;
- event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
- break;
- case BUTTON_A:
- event.type = Common::EVENT_KEYUP;
- event.kbd.keycode = Common::KEYCODE_PERIOD;
- event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
- break;
- case BUTTON_Y:
- event.type = Common::EVENT_KEYUP;
- event.kbd.keycode = Common::KEYCODE_SPACE;
- event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
- break;
- case BUTTON_MENU:
- case BUTTON_HELP:
- event.type = Common::EVENT_KEYUP;
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_MAINMENU;
- } else {
- event.kbd.keycode = Common::KEYCODE_F5;
- event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_R:
- event.type = Common::EVENT_KEYUP;
- if (BUTTON_STATE_L == true) {
-#ifdef ENABLE_VKEYBD
- event.kbd.keycode = Common::KEYCODE_F7;
- event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
-#else
- event.kbd.keycode = Common::KEYCODE_0;
- event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
-#endif
- } else {
- event.kbd.keycode = Common::KEYCODE_RETURN;
- event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_VOLUP:
- break;
- case BUTTON_VOLDOWN:
- break;
- case BUTTON_HOLD:
- break;
- case BUTTON_HELP2:
- break;
- }
- return true;
-}
-
-bool OSystem_GPH::remapKey(SDL_Event &ev,Common::Event &event) {
- return false;
-}
diff --git a/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp b/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp
deleted file mode 100644
index 92329d7c40..0000000000
--- a/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp
+++ /dev/null
@@ -1,470 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "backends/platform/gp2xwiz/gp2xwiz-sdl.h"
-
-#include "common/mutex.h"
-#include "graphics/font.h"
-#include "graphics/fontman.h"
-#include "graphics/scaler.h"
-#include "graphics/scaler/aspect.h"
-#include "graphics/scaler/downscaler.h"
-#include "graphics/surface.h"
-
-static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
- {"1x", "Fullscreen", GFX_NORMAL},
- {0, 0, 0}
-};
-
-const OSystem::GraphicsMode *OSystem_GPH::getSupportedGraphicsModes() const {
- return s_supportedGraphicsModes;
-}
-
-int OSystem_GPH::getDefaultGraphicsMode() const {
- return GFX_NORMAL;
-}
-
-bool OSystem_GPH::setGraphicsMode(int mode) {
- Common::StackLock lock(_graphicsMutex);
-
- assert(_transactionMode == kTransactionActive);
-
- if (_oldVideoMode.setup && _oldVideoMode.mode == mode)
- return true;
-
- int newScaleFactor = 1;
-
- switch (mode) {
- case GFX_NORMAL:
- newScaleFactor = 1;
- break;
- case GFX_HALF:
- newScaleFactor = 1;
- break;
- default:
- warning("unknown gfx mode %d", mode);
- return false;
- }
-
- _transactionDetails.normal1xScaler = (mode == GFX_NORMAL);
- if (_oldVideoMode.setup && _oldVideoMode.scaleFactor != newScaleFactor)
- _transactionDetails.needHotswap = true;
-
- _transactionDetails.needUpdatescreen = true;
-
- _videoMode.mode = mode;
- _videoMode.scaleFactor = newScaleFactor;
-
- return true;
-}
-
-void OSystem_GPH::setGraphicsModeIntern() {
- Common::StackLock lock(_graphicsMutex);
- ScalerProc *newScalerProc = 0;
-
- switch (_videoMode.mode) {
- case GFX_NORMAL:
- newScalerProc = Normal1x;
- break;
- case GFX_HALF:
- newScalerProc = DownscaleAllByHalf;
- break;
-
- default:
- error("Unknown gfx mode %d", _videoMode.mode);
- }
-
- _scalerProc = newScalerProc;
-
- if (!_screen || !_hwscreen)
- return;
-
- // Blit everything to the screen
- _forceFull = true;
-
- // Even if the old and new scale factors are the same, we may have a
- // different scaler for the cursor now.
- blitCursor();
-}
-
-void OSystem_GPH::initSize(uint w, uint h) {
- assert(_transactionMode == kTransactionActive);
-
- // Avoid redundant res changes
- if ((int)w == _videoMode.screenWidth && (int)h == _videoMode.screenHeight)
- return;
-
- _videoMode.screenWidth = w;
- _videoMode.screenHeight = h;
- if (w > 320 || h > 240){
- setGraphicsMode(GFX_HALF);
- setGraphicsModeIntern();
- toggleMouseGrab();
- }
-
- _transactionDetails.sizeChanged = true;
-}
-
-bool OSystem_GPH::loadGFXMode() {
- if (_videoMode.screenWidth > 320 || _videoMode.screenHeight > 240) {
- _videoMode.aspectRatioCorrection = false;
- setGraphicsMode(GFX_HALF);
- printf("GFX_HALF\n");
- } else {
- setGraphicsMode(GFX_NORMAL);
- printf("GFX_NORMAL\n");
- }
-
- if ((_videoMode.mode == GFX_HALF) && !_overlayVisible) {
- _videoMode.overlayWidth = _videoMode.screenWidth / 2;
- _videoMode.overlayHeight = _videoMode.screenHeight / 2;
- _videoMode.fullscreen = true;
- } else {
-
- _videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
- _videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
-
- if (_videoMode.aspectRatioCorrection)
- _videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight);
-
- _videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
- _videoMode.hardwareHeight = effectiveScreenHeight();
- }
- return OSystem_SDL::loadGFXMode();
-}
-
-void OSystem_GPH::drawMouse() {
- if (!_mouseVisible || !_mouseSurface) {
- _mouseBackup.x = _mouseBackup.y = _mouseBackup.w = _mouseBackup.h = 0;
- return;
- }
-
- SDL_Rect dst;
- int scale;
- int width, height;
- int hotX, hotY;
-
- if (_videoMode.mode == GFX_HALF && !_overlayVisible){
- dst.x = _mouseCurState.x/2;
- dst.y = _mouseCurState.y/2;
- } else {
- dst.x = _mouseCurState.x;
- dst.y = _mouseCurState.y;
- }
-
- if (!_overlayVisible) {
- scale = _videoMode.scaleFactor;
- width = _videoMode.screenWidth;
- height = _videoMode.screenHeight;
- dst.w = _mouseCurState.vW;
- dst.h = _mouseCurState.vH;
- hotX = _mouseCurState.vHotX;
- hotY = _mouseCurState.vHotY;
- } else {
- scale = 1;
- width = _videoMode.overlayWidth;
- height = _videoMode.overlayHeight;
- dst.w = _mouseCurState.rW;
- dst.h = _mouseCurState.rH;
- hotX = _mouseCurState.rHotX;
- hotY = _mouseCurState.rHotY;
- }
-
- // The mouse is undrawn using virtual coordinates, i.e. they may be
- // scaled and aspect-ratio corrected.
-
- _mouseBackup.x = dst.x - hotX;
- _mouseBackup.y = dst.y - hotY;
- _mouseBackup.w = dst.w;
- _mouseBackup.h = dst.h;
-
- // We draw the pre-scaled cursor image, so now we need to adjust for
- // scaling, shake position and aspect ratio correction manually.
-
- if (!_overlayVisible) {
- dst.y += _currentShakePos;
- }
-
- if (_videoMode.aspectRatioCorrection && !_overlayVisible)
- dst.y = real2Aspect(dst.y);
-
- dst.x = scale * dst.x - _mouseCurState.rHotX;
- dst.y = scale * dst.y - _mouseCurState.rHotY;
- dst.w = _mouseCurState.rW;
- dst.h = _mouseCurState.rH;
-
- // Note that SDL_BlitSurface() and addDirtyRect() will both perform any
- // clipping necessary
-
- if (SDL_BlitSurface(_mouseSurface, NULL, _hwscreen, &dst) != 0)
- error("SDL_BlitSurface failed: %s", SDL_GetError());
-
- // The screen will be updated using real surface coordinates, i.e.
- // they will not be scaled or aspect-ratio corrected.
- addDirtyRect(dst.x, dst.y, dst.w, dst.h, true);
-}
-
-void OSystem_GPH::undrawMouse() {
- const int x = _mouseBackup.x;
- const int y = _mouseBackup.y;
-
- // When we switch bigger overlay off mouse jumps. Argh!
- // This is intended to prevent undrawing offscreen mouse
- if (!_overlayVisible && (x >= _videoMode.screenWidth || y >= _videoMode.screenHeight))
- return;
-
- if (_mouseBackup.w != 0 && _mouseBackup.h != 0){
- if (_videoMode.mode == GFX_HALF && !_overlayVisible){
- addDirtyRect(x*2, y*2, _mouseBackup.w*2, _mouseBackup.h*2);
- } else {
- addDirtyRect(x, y, _mouseBackup.w, _mouseBackup.h);
- }
- }
-}
-
-void OSystem_GPH::internUpdateScreen() {
- SDL_Surface *srcSurf, *origSurf;
- int height, width;
- ScalerProc *scalerProc;
- int scale1;
-
-#if defined (DEBUG)
- assert(_hwscreen != NULL);
- assert(_hwscreen->map->sw_data != NULL);
-#endif
-
- // If the shake position changed, fill the dirty area with blackness
- if (_currentShakePos != _newShakePos ||
- (_mouseNeedsRedraw && _mouseBackup.y <= _currentShakePos)) {
- SDL_Rect blackrect = {0, 0, _videoMode.screenWidth * _videoMode.scaleFactor, _newShakePos * _videoMode.scaleFactor};
-
- if (_videoMode.aspectRatioCorrection && !_overlayVisible)
- blackrect.h = real2Aspect(blackrect.h - 1) + 1;
-
- SDL_FillRect(_hwscreen, &blackrect, 0);
-
- _currentShakePos = _newShakePos;
-
- _forceFull = true;
- }
-
- // Check whether the palette was changed in the meantime and update the
- // screen surface accordingly.
- if (_screen && _paletteDirtyEnd != 0) {
- SDL_SetColors(_screen, _currentPalette + _paletteDirtyStart,
- _paletteDirtyStart,
- _paletteDirtyEnd - _paletteDirtyStart);
-
- _paletteDirtyEnd = 0;
-
- _forceFull = true;
- }
-
-#ifdef USE_OSD
- // OSD visible (i.e. non-transparent)?
- if (_osdAlpha != SDL_ALPHA_TRANSPARENT) {
- // Updated alpha value
- const int diff = SDL_GetTicks() - _osdFadeStartTime;
- if (diff > 0) {
- if (diff >= kOSDFadeOutDuration) {
- // Back to full transparency
- _osdAlpha = SDL_ALPHA_TRANSPARENT;
- } else {
- // Do a linear fade out...
- const int startAlpha = SDL_ALPHA_TRANSPARENT + kOSDInitialAlpha * (SDL_ALPHA_OPAQUE - SDL_ALPHA_TRANSPARENT) / 100;
- _osdAlpha = startAlpha + diff * (SDL_ALPHA_TRANSPARENT - startAlpha) / kOSDFadeOutDuration;
- }
- SDL_SetAlpha(_osdSurface, SDL_RLEACCEL | SDL_SRCCOLORKEY | SDL_SRCALPHA, _osdAlpha);
- _forceFull = true;
- }
- }
-#endif
-
- if (!_overlayVisible) {
- origSurf = _screen;
- srcSurf = _tmpscreen;
- width = _videoMode.screenWidth;
- height = _videoMode.screenHeight;
- scalerProc = _scalerProc;
- scale1 = _videoMode.scaleFactor;
- } else {
- origSurf = _overlayscreen;
- srcSurf = _tmpscreen2;
- width = _videoMode.overlayWidth;
- height = _videoMode.overlayHeight;
- scalerProc = Normal1x;
-
- scale1 = 1;
- }
-
- // Add the area covered by the mouse cursor to the list of dirty rects if
- // we have to redraw the mouse.
- if (_mouseNeedsRedraw)
- undrawMouse();
-
- // Force a full redraw if requested
- if (_forceFull) {
- _numDirtyRects = 1;
- _dirtyRectList[0].x = 0;
- _dirtyRectList[0].y = 0;
- _dirtyRectList[0].w = width;
- _dirtyRectList[0].h = height;
- }
-
- // Only draw anything if necessary
- if (_numDirtyRects > 0 || _mouseNeedsRedraw) {
- SDL_Rect *r;
- SDL_Rect dst;
- uint32 srcPitch, dstPitch;
- SDL_Rect *lastRect = _dirtyRectList + _numDirtyRects;
-
- for (r = _dirtyRectList; r != lastRect; ++r) {
- dst = *r;
- dst.x++; // Shift rect by one since 2xSai needs to access the data around
- dst.y++; // any pixel to scale it, and we want to avoid mem access crashes.
-
- if (SDL_BlitSurface(origSurf, r, srcSurf, &dst) != 0)
- error("SDL_BlitSurface failed: %s", SDL_GetError());
- }
-
- SDL_LockSurface(srcSurf);
- SDL_LockSurface(_hwscreen);
-
- srcPitch = srcSurf->pitch;
- dstPitch = _hwscreen->pitch;
-
- for (r = _dirtyRectList; r != lastRect; ++r) {
- register int dst_y = r->y + _currentShakePos;
- register int dst_h = 0;
- register int dst_w = r->w;
- register int orig_dst_y = 0;
- register int dst_x = r->x;
- register int src_y;
- register int src_x;
-
- if (dst_y < height) {
- dst_h = r->h;
- if (dst_h > height - dst_y)
- dst_h = height - dst_y;
-
- orig_dst_y = dst_y;
- src_x = dst_x;
- src_y = dst_y;
-
- if (_videoMode.aspectRatioCorrection && !_overlayVisible)
- dst_y = real2Aspect(dst_y);
-
- assert(scalerProc != NULL);
-
- if ((_videoMode.mode == GFX_HALF) && (scalerProc == DownscaleAllByHalf)) {
- if (dst_x%2==1){
- dst_x--;
- dst_w++;
- }
- if (dst_y%2==1){
- dst_y--;
- dst_h++;
- }
- src_x = dst_x;
- src_y = dst_y;
- dst_x = dst_x / 2;
- dst_y = dst_y / 2;
-
- scalerProc((byte *)srcSurf->pixels + (src_x * 2 + 2) + (src_y + 1) * srcPitch, srcPitch,
- (byte *)_hwscreen->pixels + dst_x * 2 + dst_y * dstPitch, dstPitch, dst_w, dst_h);
- } else {
- scalerProc((byte *)srcSurf->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch,
- (byte *)_hwscreen->pixels + r->x * 2 + dst_y * dstPitch, dstPitch, r->w, dst_h);
- }
- }
-
- if (_videoMode.mode == GFX_HALF && scalerProc == DownscaleAllByHalf){
- r->w = r->w / 2;
- r->h = dst_h / 2;
- } else {
- r->w = r->w;
- r->h = dst_h;
- }
-
- r->x = dst_x;
- r->y = dst_y;
-
-
-#ifdef USE_SCALERS
- if (_videoMode.aspectRatioCorrection && orig_dst_y < height && !_overlayVisible)
- r->h = stretch200To240((uint8 *) _hwscreen->pixels, dstPitch, r->w, r->h, r->x, r->y, orig_dst_y * scale1);
-#endif
- }
- SDL_UnlockSurface(srcSurf);
- SDL_UnlockSurface(_hwscreen);
-
- // Readjust the dirty rect list in case we are doing a full update.
- // This is necessary if shaking is active.
- if (_forceFull) {
- _dirtyRectList[0].y = 0;
- _dirtyRectList[0].h = (_videoMode.mode == GFX_HALF) ? effectiveScreenHeight()/2 : effectiveScreenHeight();
- }
-
- drawMouse();
-
-#ifdef USE_OSD
- if (_osdAlpha != SDL_ALPHA_TRANSPARENT) {
- SDL_BlitSurface(_osdSurface, 0, _hwscreen, 0);
- }
-#endif
- // Finally, blit all our changes to the screen
- SDL_UpdateRects(_hwscreen, _numDirtyRects, _dirtyRectList);
- }
-
- _numDirtyRects = 0;
- _forceFull = false;
- _mouseNeedsRedraw = false;
-}
-
-void OSystem_GPH::showOverlay() {
- if (_videoMode.mode == GFX_HALF){
- _mouseCurState.x = _mouseCurState.x / 2;
- _mouseCurState.y = _mouseCurState.y / 2;
- }
- OSystem_SDL::showOverlay();
-}
-
-void OSystem_GPH::hideOverlay() {
- if (_videoMode.mode == GFX_HALF){
- _mouseCurState.x = _mouseCurState.x * 2;
- _mouseCurState.y = _mouseCurState.y * 2;
- }
- OSystem_SDL::hideOverlay();
-}
-
-void OSystem_GPH::warpMouse(int x, int y) {
- if (_mouseCurState.x != x || _mouseCurState.y != y) {
- if (_videoMode.mode == GFX_HALF && !_overlayVisible){
- x = x / 2;
- y = y / 2;
- }
- }
- OSystem_SDL::warpMouse(x, y);
-}
diff --git a/backends/platform/gp2xwiz/gp2xwiz-hw.cpp b/backends/platform/gp2xwiz/gp2xwiz-hw.cpp
deleted file mode 100644
index f7cc716df0..0000000000
--- a/backends/platform/gp2xwiz/gp2xwiz-hw.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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.
- *
- * $URL$
- * $Id$
- *
- */
-
-/*
- * GP2X Wiz: Hardware Stuff.
- *
- */
-
-#include "backends/platform/gp2xwiz/gp2xwiz-hw.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-namespace WIZ_HW {
-
-enum {
- VOLUME_NOCHG = 0,
- VOLUME_DOWN = 1,
- VOLUME_UP = 2,
- VOLUME_CHANGE_RATE = 8,
- VOLUME_MIN = 0,
- VOLUME_INITIAL = 60,
- VOLUME_MAX = 100
-};
-
-int volumeLevel = VOLUME_INITIAL;
-
-void deviceInit() {
-}
-
-void deviceDeinit() {
-}
-
-void mixerMoveVolume(int direction) {
- if (volumeLevel <= 10) {
- if (direction == VOLUME_UP) volumeLevel += VOLUME_CHANGE_RATE/2;
- if (direction == VOLUME_DOWN) volumeLevel -= VOLUME_CHANGE_RATE/2;
- } else {
- if (direction == VOLUME_UP) volumeLevel += VOLUME_CHANGE_RATE;
- if (direction == VOLUME_DOWN) volumeLevel -= VOLUME_CHANGE_RATE;
- }
-
- if (volumeLevel < VOLUME_MIN) volumeLevel = VOLUME_MIN;
- if (volumeLevel > VOLUME_MAX) volumeLevel = VOLUME_MAX;
-
- unsigned long soundDev = open("/dev/mixer", O_RDWR);
-
- if (soundDev) {
- int vol = ((volumeLevel << 8) | volumeLevel);
- ioctl(soundDev, SOUND_MIXER_WRITE_PCM, &vol);
- close(soundDev);
- }
-}
-
-} /* namespace WIZ_HW */
-
-namespace GPH {
-
-enum {
- /* Touchscreen TapMode */
- TAPMODE_LEFT = 0,
- TAPMODE_RIGHT = 1,
- TAPMODE_HOVER = 2
-};
-
-int tapmodeLevel = TAPMODE_LEFT;
-
-void ToggleTapMode() {
- if (tapmodeLevel == TAPMODE_LEFT) {
- tapmodeLevel = TAPMODE_RIGHT;
- } else if (tapmodeLevel == TAPMODE_RIGHT) {
- tapmodeLevel = TAPMODE_HOVER;
- } else if (tapmodeLevel == TAPMODE_HOVER) {
- tapmodeLevel = TAPMODE_LEFT;
- } else {
- tapmodeLevel = TAPMODE_LEFT;
- }
-}
-
-} /* namespace GPH */
diff --git a/backends/platform/gp2xwiz/gp2xwiz-hw.h b/backends/platform/gp2xwiz/gp2xwiz-hw.h
deleted file mode 100644
index 2fc7a85f5c..0000000000
--- a/backends/platform/gp2xwiz/gp2xwiz-hw.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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.
- *
- * $URL$
- * $Id$
- *
- */
-
-/*
- * GP2X Wiz: Hardware Stuff.
- *
- */
-
-#ifndef GP2XWIZ_HW_H
-#define GP2XWIZ_HW_H
-
-#if defined (CAANOO)
- /* Vibrate features that GPH put in the */
- /* SDL port but did not define */
- extern void SDL_VibrateInit();
- extern void SDL_VibrateQuit();
- extern void SDL_VibratePlay(int);
-#endif
-
-namespace WIZ_HW {
-
-extern int volumeLevel;
-
-extern void deviceInit();
-extern void deviceDeinit();
-extern void mixerMoveVolume(int);
-
-} /* namespace WIZ_HW */
-
-namespace GPH {
-
-extern int tapmodeLevel;
-
-extern void ToggleTapMode();
-extern int GetTapMode();
-
-} /* namespace GPH */
-
-#endif //GP2XWIZ_HW_H
diff --git a/backends/platform/gp2xwiz/gp2xwiz-main.cpp b/backends/platform/gp2xwiz/gp2xwiz-main.cpp
deleted file mode 100644
index a40b49ae18..0000000000
--- a/backends/platform/gp2xwiz/gp2xwiz-main.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "common/scummsys.h"
-#include
-
-#include "backends/platform/gp2xwiz/gp2xwiz-sdl.h"
-#include "backends/platform/gp2xwiz/gp2xwiz-hw.h"
-#include "backends/plugins/posix/posix-provider.h"
-#include "base/main.h"
-
-#include "common/archive.h"
-#include "common/config-manager.h"
-#include "common/debug.h"
-#include "common/events.h"
-#include "common/util.h"
-
-#include "common/file.h"
-#include "base/main.h"
-
-#include "backends/saves/default/default-saves.h"
-
-#include "backends/timer/default/default-timer.h"
-#include "sound/mixer_intern.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include // for getTimeAndDate()
-
-/* Dump console info to files. */
-#define DUMP_STDOUT
-
-int main(int argc, char *argv[]) {
- g_system = new OSystem_GPH();
- assert(g_system);
-#ifdef DYNAMIC_MODULES
- PluginManager::instance().addPluginProvider(new POSIXPluginProvider());
-#endif
-
- // Invoke the actual ScummVM main entry point:
- int res = scummvm_main(argc, argv);
- g_system->quit();
-
- return res;
-}
-
-void OSystem_GPH::initBackend() {
-
- /* Setup default save path to be workingdir/saves */
-
- char savePath[PATH_MAX+1];
- char workDirName[PATH_MAX+1];
-
- if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Could not obtain current working directory.");
- } else {
- printf("Current working directory: %s\n", workDirName);
- }
-
- strcpy(savePath, workDirName);
- strcat(savePath, "/saves");
- printf("Current save directory: %s\n", savePath);
- struct stat sb;
- if (stat(savePath, &sb) == -1)
- if (errno == ENOENT) // Create the dir if it does not exist
- if (mkdir(savePath, 0755) != 0)
- warning("mkdir for '%s' failed!", savePath);
-
- _savefile = new DefaultSaveFileManager(savePath);
-
- #ifdef DUMP_STDOUT
- // The GP2X Wiz has a serial console on the breakout board but most users do not use this so we
- // output all our STDOUT and STDERR to files for debug purposes.
- char STDOUT_FILE[PATH_MAX+1];
- char STDERR_FILE[PATH_MAX+1];
-
- strcpy(STDOUT_FILE, workDirName);
- strcpy(STDERR_FILE, workDirName);
- strcat(STDOUT_FILE, "/scummvm.stdout.txt");
- strcat(STDERR_FILE, "/scummvm.stderr.txt");
-
- // Flush the output in case anything is queued
- fclose(stdout);
- fclose(stderr);
-
- // Redirect standard input and standard output
- FILE *newfp = freopen(STDOUT_FILE, "w", stdout);
- if (newfp == NULL) {
- #if !defined(stdout)
- stdout = fopen(STDOUT_FILE, "w");
- #else
- newfp = fopen(STDOUT_FILE, "w");
- if (newfp) {
- *stdout = *newfp;
- }
- #endif
- }
-
- newfp = freopen(STDERR_FILE, "w", stderr);
- if (newfp == NULL) {
- #if !defined(stderr)
- stderr = fopen(STDERR_FILE, "w");
- #else
- newfp = fopen(STDERR_FILE, "w");
- if (newfp) {
- *stderr = *newfp;
- }
- #endif
- }
-
- setbuf(stderr, NULL);
- printf("%s\n", "Debug: STDOUT and STDERR redirected to text files.");
- #endif /* DUMP_STDOUT */
-
- /* Initialise any GP2X Wiz specific stuff we may want (Batt Status, scaler etc.) */
- WIZ_HW::deviceInit();
-
- /* Set Default hardware mixer volume to a preset level (VOLUME_INITIAL). This is done to 'reset' volume level if set by other apps. */
- WIZ_HW::mixerMoveVolume(0);
-
- /* Up default volume values as we use a seperate system level volume anyway. */
- ConfMan.registerDefault("music_volume", 192);
- ConfMan.registerDefault("sfx_volume", 192);
- ConfMan.registerDefault("speech_volume", 192);
-
- /* Trigger autosave every 4 minutes - On low batts 5 mins is about your warning time. */
- ConfMan.registerDefault("autosave_period", 4 * 60);
-
- /* Make sure that aspect ratio correction is enabled on the 1st run to stop users asking me what the 'wasted space' is ;-). */
- ConfMan.registerDefault("aspect_ratio", true);
-
- /* Make sure SDL knows that we have a joystick we want to use. */
- ConfMan.setInt("joystick_num", 0);
-
- printf("%s\n", "Passing to OSystem::SDL initBackend.");
-
- /* Pass to SDL backend to do the heavy lifting */
- OSystem_SDL::initBackend();
-}
-
-void OSystem_GPH::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
-
- /* Setup default extra data paths for engine data files and plugins */
- char workDirName[PATH_MAX+1];
-
- if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Error: Could not obtain current working directory.");
- }
-
- Common::FSNode workdirNode(workDirName);
- if (workdirNode.exists() && workdirNode.isDirectory()) {
- s.add("__GP2XWIZ_WORKDIR__", new Common::FSDirectory(workDirName), priority);
- }
-
- char enginedataPath[PATH_MAX+1];
-
- strcpy(enginedataPath, workDirName);
- strcat(enginedataPath, "/engine-data");
-
- Common::FSNode engineNode(enginedataPath);
- if (engineNode.exists() && engineNode.isDirectory()) {
- s.add("__GP2XWIZ_ENGDATA__", new Common::FSDirectory(enginedataPath), priority);
- }
-
- char pluginsPath[PATH_MAX+1];
-
- strcpy(pluginsPath, workDirName);
- strcat(pluginsPath, "/plugins");
-
- Common::FSNode pluginsNode(pluginsPath);
- if (pluginsNode.exists() && pluginsNode.isDirectory()) {
- s.add("__GP2XWIZ_PLUGINS__", new Common::FSDirectory(pluginsPath), priority);
- }
-}
-
-void OSystem_GPH::quit() {
-
- WIZ_HW::deviceDeinit();
-
- #ifdef DUMP_STDOUT
- printf("%s\n", "Debug: STDOUT and STDERR text files closed.");
- fclose(stdout);
- fclose(stderr);
- #endif /* DUMP_STDOUT */
-
- OSystem_SDL::quit();
-}
diff --git a/backends/platform/gp2xwiz/gp2xwiz-sdl.h b/backends/platform/gp2xwiz/gp2xwiz-sdl.h
deleted file mode 100644
index bae9a87771..0000000000
--- a/backends/platform/gp2xwiz/gp2xwiz-sdl.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef GP2XWIZ_SDL_H
-#define GP2XWIZ_SDL_H
-
-#include "backends/platform/sdl/sdl.h"
-
-// FIXME: For now keep hacks in this header to save polluting the SDL backend.
-enum {
- GFX_HALF = 12
-};
-
-#define __GP2XWIZ__
-#define MIXER_DOUBLE_BUFFERING 1
-
-#ifndef PATH_MAX
- #define PATH_MAX 255
-#endif
-
-class OSystem_GPH : public OSystem_SDL {
-public:
- OSystem_GPH() {}
-
- /* Graphics */
- void initSize(uint w, uint h);
- void setGraphicsModeIntern();
- bool setGraphicsMode(int mode);
- void internUpdateScreen();
- const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
- bool setGraphicsMode(const char *name);
- int getDefaultGraphicsMode() const;
- bool loadGFXMode();
- void drawMouse();
- void undrawMouse();
- void showOverlay();
- void hideOverlay();
-
- /* Event Stuff */
- void moveStick();
- void fillMouseEvent(Common::Event&, int, int);
- void warpMouse(int, int);
- bool remapKey(SDL_Event&, Common::Event&);
-
- /* Platform Setup Stuff */
- void addSysArchivesToSearchSet(Common::SearchSet &s, int priority);
- void initBackend();
- void quit();
-
-protected:
- bool _stickBtn[32];
-
- bool handleMouseButtonDown(SDL_Event &ev, Common::Event &event);
- bool handleMouseButtonUp(SDL_Event &ev, Common::Event &event);
- bool handleJoyButtonDown(SDL_Event &ev, Common::Event &event);
- bool handleJoyButtonUp(SDL_Event &ev, Common::Event &event);
-};
-
-#endif
diff --git a/backends/platform/gp2xwiz/module.mk b/backends/platform/gp2xwiz/module.mk
deleted file mode 100644
index edf2f2a717..0000000000
--- a/backends/platform/gp2xwiz/module.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-MODULE := backends/platform/gp2xwiz
-
-MODULE_OBJS := \
- gp2xwiz-events.o \
- gp2xwiz-graphics.o \
- gp2xwiz-hw.o \
- gp2xwiz-main.o
-
-# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
-MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
-OBJS := $(MODULE_OBJS) $(OBJS)
-MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))
-
-# Hack to ensure the SDL backend is built so we can use OSystem_SDL.
--include $(srcdir)/backends/platform/sdl/module.mk
\ No newline at end of file
diff --git a/backends/platform/gph/build/README-GP2XWIZ b/backends/platform/gph/build/README-GP2XWIZ
new file mode 100644
index 0000000000..ec8142a6f3
--- /dev/null
+++ b/backends/platform/gph/build/README-GP2XWIZ
@@ -0,0 +1,140 @@
+ScummVM - GP2X WIZ SPECIFIC README - HEAD SVN
+------------------------------------------------------------------------
+
+Contents:
+
+ * About the backend/port <#About_the_backendport>
+ * Game compatability <#Game_compatibility>
+ * Included engines <#Included_engines>
+ * Supported audio options <#Supported_audio_options>
+ * Supported cut-scene options <#Supported_cut-scene_options>
+ * Recent changes <#Recent_changes>
+ * How to save <#How_to_save>
+ * Controller mappings <#Controller_mappings>
+ * Known issues <#Knonw_issues>
+ * Additional resources/links <#Additional_resourceslinks>
+ * Credits <#Credits>
+
+------------------------------------------------------------------------
+
+Please refer to the:
+
+GP2X/GP2XWiz ScummVM Forum:
+WiKi:
+
+for the most current information on the port and any updates to this
+documentation.
+
+------------------------------------------------------------------------
+About the backend/port
+
+This is the readme for the official GP2XWiz ScummVM backend (also known as
+the GP2XWiz port).
+
+This is an SVN test release of ScummVM for the GP2XWiz, it would be
+appreciated if this SVN test distribution was not mirrored and that
+people be directed to http://scummvm.distant-earth.com/ instead for
+updated SVN builds.
+
+Full supported official releases of the GP2X WIZ ScummVM backend are made in
+line with main official releases and are avalalble from the ScummVM
+downloads page .
+
+This build is in an active state of development and as such no
+"expected" behavior can be guaranteed ;).
+
+------------------------------------------------------------------------
+Game compatibility
+
+For information on the compatability of a specific game please refer to
+the GP2XWiz compatability section of the ScummVM WiKi
+.
+
+Please note the version and date of the ScummVM build you are running
+when reviewing the above list.
+
+------------------------------------------------------------------------
+Supported audio options
+
+Raw audio.
+MP3 audio.
+OGG Vorbis audio.
+
+FLAC audio is currently unsupported.
+
+For best results use uncompressed audio in games.
+
+------------------------------------------------------------------------
+How to save
+
+NOTE: Everything is saved to the SD card, saves are stored in the saves
+folder under your main ScummVM executable unless you set another save
+location.
+
+The configiration file for ScummVM (.scummvmrc) is stored in the same
+place as the ScummVM executable.
+
+The save process below is for Scumm engine games but the principle is
+the same for all.
+
+In Game.
+
+1. Menu Button
+2. Select SAVE with B
+3. Select a position with B
+4. Right trigger puts 0 in the name box for some text.
+5. Press B to save
+
+Basically the emulated keys you can use are equivelent to the values
+buttons are mapped to,
+
+------------------------------------------------------------------------
+Controller mappings
+
+Touch screen:
+Touch: Move Pointer and Left click
+
+Mouse emulation:
+
+dPad: Move Pointer
+B: Left click
+X: Right click
+
+Keyboard emulation:
+
+Right Trigger: Return
+Select: Escape
+Y: Space Bar (Pause)
+Menu: Game Menu (Save, Load, Quit etc.)
+Volume Buttons: Increase and Decrease volume
+
+Fancy button combos:
+
+NOTE: To use button combos press and hold the Left Trigger then...
+
+Right Trigger: Display Virtual Keyboard
+Menu: Bring up the Global main menu for ScummVM
+Select: Exit ScummVM completely (and gracefully)
+
+------------------------------------------------------------------------
+Known issues
+
+No major known issues
+
+------------------------------------------------------------------------
+Additional resources/links
+
+ * ScummVM WiKi GP2X page
+ * ScummVM forums GP2X forum
+
+ * My own ScummVM page (for
+ SVN/test builds)
+ * Main ScummVM site (for official supported
+ release builds)
+
+------------------------------------------------------------------------
+Credits
+
+Core ScummVM code (c) The ScummVM Team
+GP2X Wiz backend (c) John Willis
+Detailed (c) information can be found within the source code
diff --git a/backends/platform/gph/build/build.sh b/backends/platform/gph/build/build.sh
new file mode 100755
index 0000000000..876c3e378a
--- /dev/null
+++ b/backends/platform/gph/build/build.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+echo Quick script to make building all the time less painful.
+
+# Set the paths up here to support the build.
+
+export PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin:$PATH
+export PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin:$PATH
+export CXX=arm-open2x-linux-g++
+export CC=arm-open2x-linux-gcc
+export CXXFLAGS="-mcpu=arm926ej-s -mtune=arm926ej-s"
+export ASFLAGS=-mfloat-abi=soft
+
+cd ../../../..
+
+echo Building ScummVM for GP2X Wiz.
+make
+
+echo Build for GP2X Wiz - complete - Please check build logs.
diff --git a/backends/platform/gph/build/bundle-debug.sh b/backends/platform/gph/build/bundle-debug.sh
new file mode 100755
index 0000000000..cd5145b31d
--- /dev/null
+++ b/backends/platform/gph/build/bundle-debug.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+echo Quick script to make building a distribution of the GP2X Wiz backend more consistent.
+
+cd ../../../..
+
+echo Building ScummVM for GP2X Wiz.
+
+make gp2xwiz-bundle-debug
diff --git a/backends/platform/gph/build/bundle.sh b/backends/platform/gph/build/bundle.sh
new file mode 100755
index 0000000000..579e2dc77b
--- /dev/null
+++ b/backends/platform/gph/build/bundle.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+echo Quick script to make building a distribution of the GP2X Wiz backend more consistent.
+
+cd ../../../..
+
+echo Building ScummVM for GP2X Wiz.
+
+make gp2xwiz-bundle
diff --git a/backends/platform/gph/build/clean.sh b/backends/platform/gph/build/clean.sh
new file mode 100755
index 0000000000..5ec1b9e62c
--- /dev/null
+++ b/backends/platform/gph/build/clean.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+echo Quick script to make building all the time less painful.
+
+cd ../../../..
+
+echo Cleaning ScummVM for the GP2X Wiz.
+make clean
diff --git a/backends/platform/gph/build/config-alleng.sh b/backends/platform/gph/build/config-alleng.sh
new file mode 100755
index 0000000000..cfed463edf
--- /dev/null
+++ b/backends/platform/gph/build/config-alleng.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+echo Quick script to make running configure all the time less painful
+echo and let all the build work be done from the backend/build folder.
+
+# Set the paths up here to generate the config.
+
+PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin:$PATH
+PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin:$PATH
+
+# Export the tool names for cross-compiling
+export CXX=arm-open2x-linux-g++
+export CXXFLAGS="-mcpu=arm926ej-s -mtune=arm926ej-s"
+export CPPFLAGS=-I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include
+export LDFLAGS=-L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib
+export DEFINES=-DNDEBUG
+
+# Edit the configure line to suit.
+cd ../../../..
+./configure --backend=gp2xwiz --disable-mt32emu --host=gp2xwiz --disable-flac --disable-nasm --disable-hq-scalers --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-all-engines --enable-vkeybd --enable-plugins --default-dynamic
+
+echo Generating config for GP2X Wiz complete. Check for errors.
diff --git a/backends/platform/gph/build/config.sh b/backends/platform/gph/build/config.sh
new file mode 100755
index 0000000000..54c4795298
--- /dev/null
+++ b/backends/platform/gph/build/config.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+echo Quick script to make running configure all the time less painful
+echo and let all the build work be done from the backend/build folder.
+
+# Set the paths up here to generate the config.
+
+PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin:$PATH
+PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin:$PATH
+
+# Export the tool names for cross-compiling
+export CXX=arm-open2x-linux-g++
+export CXXFLAGS="-mcpu=arm926ej-s -mtune=arm926ej-s"
+export CPPFLAGS=-I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include
+export LDFLAGS=-L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib
+export DEFINES=-DNDEBUG
+
+# Edit the configure line to suit.
+cd ../../../..
+./configure --backend=gp2xwiz --disable-mt32emu --host=gp2xwiz --disable-flac --disable-nasm --disable-hq-scalers --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-vkeybd --enable-plugins --default-dynamic
+
+echo Generating config for GP2X Wiz complete. Check for errors.
diff --git a/backends/platform/gph/build/scummvm-gdb.gpe b/backends/platform/gph/build/scummvm-gdb.gpe
new file mode 100755
index 0000000000..64b6c8b974
--- /dev/null
+++ b/backends/platform/gph/build/scummvm-gdb.gpe
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# Export the location of any libs ScummVM depends on
+# (to avoid installing to the NAND and overwriting the broken ones there).
+export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH
+
+# Run ScummVM via GDB (so make sure you have a terminal open or serial).
+# Oh, and GDB installed of course ;)
+gdb --args ./scummvm.wiz --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
+
+# Sync the SD card to check that everything is written.
+sync
+
+# Return to the GPH menu screen
+cd /usr/gp2x
+exec /usr/gp2x/gp2xmenu
diff --git a/backends/platform/gph/build/scummvm.gpe b/backends/platform/gph/build/scummvm.gpe
new file mode 100755
index 0000000000..42cc00a22a
--- /dev/null
+++ b/backends/platform/gph/build/scummvm.gpe
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Export the location of any libs ScummVM depends on
+# (to avoid installing to the NAND and overwriting the broken ones there).
+export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH
+
+# Run ScummVM, important this bit.
+./scummvm.wiz --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
+
+# Sync the SD card to check that everything is written.
+sync
+
+# Return to the GPH menu screen
+cd /usr/gp2x
+exec /usr/gp2x/gp2xmenu
diff --git a/backends/platform/gph/build/scummvm.ini b/backends/platform/gph/build/scummvm.ini
new file mode 100644
index 0000000000..c9cce92379
--- /dev/null
+++ b/backends/platform/gph/build/scummvm.ini
@@ -0,0 +1,5 @@
+[info]
+name="ScummVM"
+path="/scummvm/scummvm.gpe"
+icon="/scummvm/scummvm.png"
+title="/scummvm/scummvmb.png"
diff --git a/backends/platform/gph/build/scummvm.png b/backends/platform/gph/build/scummvm.png
new file mode 100644
index 0000000000..128e59efc4
Binary files /dev/null and b/backends/platform/gph/build/scummvm.png differ
diff --git a/backends/platform/gph/build/scummvmb.png b/backends/platform/gph/build/scummvmb.png
new file mode 100644
index 0000000000..24a27bc0e1
Binary files /dev/null and b/backends/platform/gph/build/scummvmb.png differ
diff --git a/backends/platform/gph/caanoo-bundle.mk b/backends/platform/gph/caanoo-bundle.mk
new file mode 100755
index 0000000000..84b99c5c53
--- /dev/null
+++ b/backends/platform/gph/caanoo-bundle.mk
@@ -0,0 +1,69 @@
+# Special target to create bundles for the GP2X Caanoo.
+
+#bundle_name = release/scummvm-caanoo-`date '+%Y-%m-%d'`
+bundle_name = release/scummvm-caanoo
+f=$(shell which $(STRIP))
+libloc = $(shell dirname $(f))
+
+caanoo-bundle: $(EXECUTABLE)
+ $(MKDIR) "$(bundle_name)"
+ $(MKDIR) "$(bundle_name)/scummvm"
+ $(MKDIR) "$(bundle_name)/scummvm/saves"
+ $(MKDIR) "$(bundle_name)/scummvm/engine-data"
+ $(MKDIR) "$(bundle_name)/scummvm/lib"
+
+ echo "Please put your save games in this dir" >> "$(bundle_name)/scummvm/saves/PUT_SAVES_IN_THIS_DIR"
+
+ $(CP) $(srcdir)/backends/platform/gph/caanoo/scummvm.gpe $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/build/scummvm.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/build/scummvmb.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/build/README-GP2XWIZ $(bundle_name)/scummvm/README-CAANOO
+ $(CP) $(srcdir)/backends/platform/gph/build/scummvm.ini $(bundle_name)/
+
+ $(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
+ $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/
+ $(INSTALL) -c -m 644 $(DIST_FILES_ENGINEDATA) $(bundle_name)/scummvm/engine-data
+ $(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)/scummvm/
+
+ $(STRIP) $(EXECUTABLE) -o $(bundle_name)/scummvm/$(EXECUTABLE)
+
+ifdef DYNAMIC_MODULES
+ $(INSTALL) -d "$(bundle_name)/scummvm/plugins"
+ $(INSTALL) -c -m 644 $(PLUGINS) "$(bundle_name)/scummvm/plugins"
+ $(STRIP) $(bundle_name)/scummvm/plugins/*
+endif
+
+ tar -C $(bundle_name) -cvjf $(bundle_name).tar.bz2 .
+ rm -R ./$(bundle_name)
+
+caanoo-bundle-debug: $(EXECUTABLE)
+ $(MKDIR) "$(bundle_name)"
+ $(MKDIR) "$(bundle_name)/scummvm"
+ $(MKDIR) "$(bundle_name)/scummvm/saves"
+ $(MKDIR) "$(bundle_name)/scummvm/engine-data"
+ $(MKDIR) "$(bundle_name)/scummvm/lib"
+
+ echo "Please put your save games in this dir" >> "$(bundle_name)/scummvm/saves/PUT_SAVES_IN_THIS_DIR"
+
+ $(CP) $(srcdir)/backends/platform/gph/caanoo/scummvm-gdb.gpe $(bundle_name)/scummvm/scummvm.gpe
+ $(CP) $(srcdir)/backends/platform/gph/build/scummvm.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/build/scummvmb.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/build/README-GP2XWIZ $(bundle_name)/scummvm/README-CAANOO
+ $(CP) $(srcdir)/backends/platform/gph/build/scummvm.ini $(bundle_name)/
+
+ $(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
+ $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/
+ $(INSTALL) -c -m 644 $(DIST_FILES_ENGINEDATA) $(bundle_name)/scummvm/engine-data
+ $(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)/scummvm/
+
+ $(INSTALL) -c -m 777 $(srcdir)/$(EXECUTABLE) $(bundle_name)/scummvm/$(EXECUTABLE)
+
+ifdef DYNAMIC_MODULES
+ $(INSTALL) -d "$(bundle_name)/scummvm/plugins"
+ $(INSTALL) -c -m 644 $(PLUGINS) "$(bundle_name)/scummvm/plugins"
+endif
+
+ tar -C $(bundle_name) -cvjf $(bundle_name)-debug.tar.bz2 .
+ rm -R ./$(bundle_name)
+
+.PHONY: caanoo-bundle caanoo-bundle-debug
diff --git a/backends/platform/gph/caanoo/build.sh b/backends/platform/gph/caanoo/build.sh
new file mode 100755
index 0000000000..8000d2595d
--- /dev/null
+++ b/backends/platform/gph/caanoo/build.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+echo Quick script to make building all the time less painful.
+
+# Set the paths up here to support the build.
+
+cd ../../../..
+
+echo Building ScummVM for GP2X Caanoo.
+make
+
+echo Build for GP2X Caanoo - complete - Please check build logs.
diff --git a/backends/platform/gph/caanoo/bundle-debug.sh b/backends/platform/gph/caanoo/bundle-debug.sh
new file mode 100755
index 0000000000..2d5cefe80e
--- /dev/null
+++ b/backends/platform/gph/caanoo/bundle-debug.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+echo Quick script to make building a distribution of the GP2X Caanoo backend more consistent.
+
+cd ../../../..
+
+echo Building ScummVM for GP2X Caanoo.
+
+make caanoo-bundle-debug
diff --git a/backends/platform/gph/caanoo/bundle.sh b/backends/platform/gph/caanoo/bundle.sh
new file mode 100755
index 0000000000..76fd31cec6
--- /dev/null
+++ b/backends/platform/gph/caanoo/bundle.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+echo Quick script to make building a distribution of the GP2X Caanoo backend more consistent.
+
+cd ../../../..
+
+echo Building ScummVM for GP2X Caanoo.
+
+make caanoo-bundle
diff --git a/backends/platform/gph/caanoo/clean.sh b/backends/platform/gph/caanoo/clean.sh
new file mode 100755
index 0000000000..5ec1b9e62c
--- /dev/null
+++ b/backends/platform/gph/caanoo/clean.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+echo Quick script to make building all the time less painful.
+
+cd ../../../..
+
+echo Cleaning ScummVM for the GP2X Wiz.
+make clean
diff --git a/backends/platform/gph/caanoo/config-alleng.sh b/backends/platform/gph/caanoo/config-alleng.sh
new file mode 100755
index 0000000000..7a097c268b
--- /dev/null
+++ b/backends/platform/gph/caanoo/config-alleng.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+echo Quick script to make running configure all the time less painful
+echo and let all the build work be done from the backend/build folder.
+
+# Assume Caanoo toolchain/build env.
+. /opt/arm-caanoo/environment-setup
+
+# Export the tool names for cross-compiling
+export DEFINES=-DNDEBUG
+
+# Edit the configure line to suit.
+cd ../../../..
+./configure --backend=caanoo --disable-mt32emu --host=caanoo --disable-alsa --disable-flac --disable-nasm --disable-vorbis --disable-hq-scalers --with-sdl-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/bin --with-mpeg2-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --enable-tremor --with-tremor-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --enable-zlib --with-zlib-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --enable-mad --with-mad-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr --enable-all-engines --enable-vkeybd --enable-plugins --default-dynamic
+
+echo Generating config for GP2X Caanoo complete. Check for errors.
diff --git a/backends/platform/gph/caanoo/config.sh b/backends/platform/gph/caanoo/config.sh
new file mode 100755
index 0000000000..73ce5da624
--- /dev/null
+++ b/backends/platform/gph/caanoo/config.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+echo Quick script to make running configure all the time less painful
+echo and let all the build work be done from the backend/build folder.
+
+# Assume Caanoo toolchain/build env.
+. /opt/arm-caanoo/environment-setup
+
+# Export the tool names for cross-compiling
+export DEFINES=-DNDEBUG
+
+# Edit the configure line to suit.
+cd ../../../..
+./configure --backend=caanoo --disable-mt32emu --host=caanoo --disable-alsa --disable-flac --disable-nasm --disable-vorbis --disable-hq-scalers --with-sdl-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr/bin --with-mpeg2-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr --enable-tremor --with-tremor-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr --enable-zlib --with-zlib-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr --enable-mad --with-mad-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr --enable-vkeybd --enable-plugins --default-dynamic
+
+echo Generating config for GP2X Caanoo complete. Check for errors.
diff --git a/backends/platform/gph/caanoo/scummvm-gdb.gpe b/backends/platform/gph/caanoo/scummvm-gdb.gpe
new file mode 100755
index 0000000000..a8f2aae0fe
--- /dev/null
+++ b/backends/platform/gph/caanoo/scummvm-gdb.gpe
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# Export the location of any libs ScummVM depends on
+# (to avoid installing to the NAND and overwriting the broken ones there).
+export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH
+
+# Run ScummVM via GDB (so make sure you have a terminal open or serial).
+# Oh, and GDB installed of course ;)
+gdb --args ./scummvm.caanoo --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
+
+# Sync the SD card to check that everything is written.
+sync
+
+# Return to the GPH menu screen
+cd /usr/gp2x
+exec /usr/gp2x/gp2xmenu
diff --git a/backends/platform/gph/caanoo/scummvm.gpe b/backends/platform/gph/caanoo/scummvm.gpe
new file mode 100755
index 0000000000..8341ffc3d7
--- /dev/null
+++ b/backends/platform/gph/caanoo/scummvm.gpe
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Export the location of any libs ScummVM depends on
+# (to avoid installing to the NAND and overwriting the broken ones there).
+export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH
+
+# Run ScummVM, important this bit.
+./scummvm.caanoo --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
+
+# Sync the SD card to check that everything is written.
+sync
+
+# Return to the GPH menu screen
+cd /usr/gp2x
+exec /usr/gp2x/gp2xmenu
diff --git a/backends/platform/gph/gp2xwiz-bundle.mk b/backends/platform/gph/gp2xwiz-bundle.mk
new file mode 100755
index 0000000000..21fd0c74de
--- /dev/null
+++ b/backends/platform/gph/gp2xwiz-bundle.mk
@@ -0,0 +1,75 @@
+# Special target to create bundles for the GP2X Wiz.
+
+#bundle_name = release/scummvm-wiz-`date '+%Y-%m-%d'`
+bundle_name = release/scummvm-gp2xwiz
+f=$(shell which $(STRIP))
+libloc = $(shell dirname $(f))
+
+gp2xwiz-bundle: $(EXECUTABLE)
+ $(MKDIR) "$(bundle_name)"
+ $(MKDIR) "$(bundle_name)/scummvm"
+ $(MKDIR) "$(bundle_name)/scummvm/saves"
+ $(MKDIR) "$(bundle_name)/scummvm/engine-data"
+ $(MKDIR) "$(bundle_name)/scummvm/lib"
+
+ echo "Please put your save games in this dir" >> "$(bundle_name)/scummvm/saves/PUT_SAVES_IN_THIS_DIR"
+
+ $(CP) $(srcdir)/backends/platform/gph/build/scummvm.gpe $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/build/scummvm.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/build/scummvmb.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/build/README-GP2XWIZ $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/build/scummvm.ini $(bundle_name)/
+
+ $(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
+ $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/
+ $(INSTALL) -c -m 644 $(DIST_FILES_ENGINEDATA) $(bundle_name)/scummvm/engine-data
+ $(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)/scummvm/
+
+ $(STRIP) $(EXECUTABLE) -o $(bundle_name)/scummvm/$(EXECUTABLE)
+
+ifdef DYNAMIC_MODULES
+ $(INSTALL) -d "$(bundle_name)/scummvm/plugins"
+ $(INSTALL) -c -m 644 $(PLUGINS) "$(bundle_name)/scummvm/plugins"
+ $(STRIP) $(bundle_name)/scummvm/plugins/*
+endif
+
+ $(CP) $(libloc)/../lib/libz.so.1.2.3 $(bundle_name)/scummvm/lib/libz.so.1
+ $(CP) $(libloc)/../lib/libvorbisidec.so.1.0.2 $(bundle_name)/scummvm/lib/libvorbisidec.so.1
+
+ tar -C $(bundle_name) -cvjf $(bundle_name).tar.bz2 .
+ rm -R ./$(bundle_name)
+
+gp2xwiz-bundle-debug: $(EXECUTABLE)
+ $(MKDIR) "$(bundle_name)"
+ $(MKDIR) "$(bundle_name)/scummvm"
+ $(MKDIR) "$(bundle_name)/scummvm/saves"
+ $(MKDIR) "$(bundle_name)/scummvm/engine-data"
+ $(MKDIR) "$(bundle_name)/scummvm/lib"
+
+ echo "Please put your save games in this dir" >> "$(bundle_name)/scummvm/saves/PUT_SAVES_IN_THIS_DIR"
+
+ $(CP) $(srcdir)/backends/platform/gph/build/scummvm-gdb.gpe $(bundle_name)/scummvm/scummvm.gpe
+ $(CP) $(srcdir)/backends/platform/gph/build/scummvm.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/build/scummvmb.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/build/README-GP2XWIZ $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/build/scummvm.ini $(bundle_name)/
+
+ $(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
+ $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/
+ $(INSTALL) -c -m 644 $(DIST_FILES_ENGINEDATA) $(bundle_name)/scummvm/engine-data
+ $(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)/scummvm/
+
+ $(INSTALL) -c -m 777 $(srcdir)/$(EXECUTABLE) $(bundle_name)/scummvm/$(EXECUTABLE)
+
+ifdef DYNAMIC_MODULES
+ $(INSTALL) -d "$(bundle_name)/scummvm/plugins"
+ $(INSTALL) -c -m 644 $(PLUGINS) "$(bundle_name)/scummvm/plugins"
+endif
+
+ $(CP) $(libloc)/../lib/libz.so.1.2.3 $(bundle_name)/scummvm/lib/libz.so.1
+ $(CP) $(libloc)/../lib/libvorbisidec.so.1.0.2 $(bundle_name)/scummvm/lib/libvorbisidec.so.1
+
+ tar -C $(bundle_name) -cvjf $(bundle_name)-debug.tar.bz2 .
+ rm -R ./$(bundle_name)
+
+.PHONY: gp2xwiz-bundle gp2xwiz-bundle-debug
diff --git a/backends/platform/gph/gph-events.cpp b/backends/platform/gph/gph-events.cpp
new file mode 100644
index 0000000000..91ea30bdc9
--- /dev/null
+++ b/backends/platform/gph/gph-events.cpp
@@ -0,0 +1,482 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+/*
+ * GPH: Device Specific Event Handling.
+ *
+ */
+
+#include "backends/platform/gph/gph-sdl.h"
+#include "backends/platform/gph/gph-hw.h"
+#include "graphics/scaler/aspect.h"
+
+#include "common/util.h"
+#include "common/events.h"
+
+#define JOY_DEADZONE 2200
+
+#define JOY_XAXIS 0
+#define JOY_YAXIS 1
+
+/* Quick default button states for modifiers. */
+int BUTTON_STATE_L = false;
+
+#if defined(CAANOO)
+
+ /* Caanoo: Main Joystick Button Mappings */
+ /* The Caanoo has an analogue stick so no digital DPAD */
+ enum {
+ /* Joystick Buttons */
+ BUTTON_A = 0,
+ BUTTON_X = 1,
+ BUTTON_B = 2,
+ BUTTON_Y = 3,
+ BUTTON_L = 4,
+ BUTTON_R = 5,
+ BUTTON_HOME = 6, // Home
+ BUTTON_HOLD = 7, // Hold (on Power)
+ BUTTON_HELP = 8, // Help I
+ BUTTON_HELP2 = 9, // Help II
+ BUTTON_CLICK = 10 // Stick Click
+ };
+
+ enum {
+ /* Unused Joystick Buttons on the Caanoo */
+ BUTTON_VOLUP = 51,
+ BUTTON_VOLDOWN = 52,
+ BUTTON_UP = 53,
+ BUTTON_UPLEFT = 54,
+ BUTTON_LEFT = 55,
+ BUTTON_DOWNLEFT = 56,
+ BUTTON_DOWN = 57,
+ BUTTON_DOWNRIGHT = 58,
+ BUTTON_RIGHT = 59,
+ BUTTON_UPRIGHT = 60,
+ BUTTON_MENU = 61,
+ BUTTON_SELECT = 62
+ };
+
+#else
+
+ /* Wiz: Main Joystick Mappings */
+ enum {
+ /* DPAD */
+ BUTTON_UP = 0,
+ BUTTON_UPLEFT = 1,
+ BUTTON_LEFT = 2,
+ BUTTON_DOWNLEFT = 3,
+ BUTTON_DOWN = 4,
+ BUTTON_DOWNRIGHT = 5,
+ BUTTON_RIGHT = 6,
+ BUTTON_UPRIGHT = 7,
+ /* Joystick Buttons */
+ BUTTON_MENU = 8,
+ BUTTON_SELECT = 9,
+ BUTTON_L = 10,
+ BUTTON_R = 11,
+ BUTTON_A = 12,
+ BUTTON_B = 13,
+ BUTTON_X = 14,
+ BUTTON_Y = 15,
+ BUTTON_VOLUP = 16,
+ BUTTON_VOLDOWN = 17
+ };
+
+ enum {
+ /* Unused Joystick Buttons on the Wiz */
+ BUTTON_HOME = 51,
+ BUTTON_HOLD = 52,
+ BUTTON_CLICK = 53,
+ BUTTON_HELP = 54,
+ BUTTON_HELP2 = 55
+ };
+
+#endif
+
+enum {
+ /* Touchscreen TapMode */
+ TAPMODE_LEFT = 0,
+ TAPMODE_RIGHT = 1,
+ TAPMODE_HOVER = 2
+};
+
+static int mapKey(SDLKey key, SDLMod mod, Uint16 unicode) {
+ if (key >= SDLK_F1 && key <= SDLK_F9) {
+ return key - SDLK_F1 + Common::ASCII_F1;
+ } else if (key >= SDLK_KP0 && key <= SDLK_KP9) {
+ return key - SDLK_KP0 + '0';
+ } else if (key >= SDLK_UP && key <= SDLK_PAGEDOWN) {
+ return key;
+ } else if (unicode) {
+ return unicode;
+ } else if (key >= 'a' && key <= 'z' && (mod & KMOD_SHIFT)) {
+ return key & ~0x20;
+ } else if (key >= SDLK_NUMLOCK && key <= SDLK_EURO) {
+ return 0;
+ }
+ return key;
+}
+
+
+void OSystem_GPH::fillMouseEvent(Common::Event &event, int x, int y) {
+ if (_videoMode.mode == GFX_HALF && !_overlayVisible){
+ event.mouse.x = x*2;
+ event.mouse.y = y*2;
+ } else {
+ event.mouse.x = x;
+ event.mouse.y = y;
+ }
+
+ // Update the "keyboard mouse" coords
+ _km.x = x;
+ _km.y = y;
+
+ // Adjust for the screen scaling
+ if (!_overlayVisible) {
+ event.mouse.x /= _videoMode.scaleFactor;
+ event.mouse.y /= _videoMode.scaleFactor;
+ if (_videoMode.aspectRatioCorrection)
+ event.mouse.y = aspect2Real(event.mouse.y);
+ }
+}
+
+
+void OSystem_GPH::moveStick() {
+ bool stickBtn[32];
+
+ memcpy(stickBtn, _stickBtn, sizeof(stickBtn));
+
+ if ((stickBtn[0])||(stickBtn[2])||(stickBtn[4])||(stickBtn[6]))
+ stickBtn[1] = stickBtn[3] = stickBtn[5] = stickBtn[7] = 0;
+
+ if ((stickBtn[1])||(stickBtn[2])||(stickBtn[3])) {
+ if (_km.x_down_count!=2) {
+ _km.x_vel = -1;
+ _km.x_down_count = 1;
+ } else
+ _km.x_vel = -4;
+ } else if ((stickBtn[5])||(stickBtn[6])||(stickBtn[7])) {
+ if (_km.x_down_count!=2) {
+ _km.x_vel = 1;
+ _km.x_down_count = 1;
+ } else
+ _km.x_vel = 4;
+ } else {
+ _km.x_vel = 0;
+ _km.x_down_count = 0;
+ }
+
+ if ((stickBtn[0])||(stickBtn[1])||(stickBtn[7])) {
+ if (_km.y_down_count!=2) {
+ _km.y_vel = -1;
+ _km.y_down_count = 1;
+ } else
+ _km.y_vel = -4;
+ } else if ((stickBtn[3])||(stickBtn[4])||(stickBtn[5])) {
+ if (_km.y_down_count!=2) {
+ _km.y_vel = 1;
+ _km.y_down_count = 1;
+ } else
+ _km.y_vel = 4;
+ } else {
+ _km.y_vel = 0;
+ _km.y_down_count = 0;
+ }
+}
+
+/* Custom handleMouseButtonDown/handleMouseButtonUp to deal with 'Tap Mode' for the touchscreen */
+
+bool OSystem_GPH::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
+ if (ev.button.button == SDL_BUTTON_LEFT){
+ if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */
+ event.type = Common::EVENT_RBUTTONDOWN;
+ else if (GPH::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
+ event.type = Common::EVENT_LBUTTONDOWN;
+ else if (GPH::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */
+ event.type = Common::EVENT_RBUTTONDOWN;
+ else if (GPH::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
+ event.type = Common::EVENT_MOUSEMOVE;
+ else
+ event.type = Common::EVENT_LBUTTONDOWN; /* For normal mice etc. */
+ }
+ else if (ev.button.button == SDL_BUTTON_RIGHT)
+ event.type = Common::EVENT_RBUTTONDOWN;
+#if defined(SDL_BUTTON_WHEELUP) && defined(SDL_BUTTON_WHEELDOWN)
+ else if (ev.button.button == SDL_BUTTON_WHEELUP)
+ event.type = Common::EVENT_WHEELUP;
+ else if (ev.button.button == SDL_BUTTON_WHEELDOWN)
+ event.type = Common::EVENT_WHEELDOWN;
+#endif
+#if defined(SDL_BUTTON_MIDDLE)
+ else if (ev.button.button == SDL_BUTTON_MIDDLE)
+ event.type = Common::EVENT_MBUTTONDOWN;
+#endif
+ else
+ return false;
+
+ fillMouseEvent(event, ev.button.x, ev.button.y);
+
+ return true;
+}
+
+bool OSystem_GPH::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
+ if (ev.button.button == SDL_BUTTON_LEFT){
+ if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */
+ event.type = Common::EVENT_RBUTTONUP;
+ else if (GPH::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
+ event.type = Common::EVENT_LBUTTONUP;
+ else if (GPH::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */
+ event.type = Common::EVENT_RBUTTONUP;
+ else if (GPH::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
+ event.type = Common::EVENT_MOUSEMOVE;
+ else
+ event.type = Common::EVENT_LBUTTONUP; /* For normal mice etc. */
+
+ }
+ else if (ev.button.button == SDL_BUTTON_RIGHT)
+ event.type = Common::EVENT_RBUTTONUP;
+#if defined(SDL_BUTTON_MIDDLE)
+ else if (ev.button.button == SDL_BUTTON_MIDDLE)
+ event.type = Common::EVENT_MBUTTONUP;
+#endif
+ else
+ return false;
+
+ fillMouseEvent(event, ev.button.x, ev.button.y);
+
+ return true;
+}
+
+/* Custom handleJoyButtonDown/handleJoyButtonUp to deal with the joystick buttons on GPH devices */
+
+bool OSystem_GPH::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) {
+
+ _stickBtn[ev.jbutton.button] = 1;
+ event.kbd.flags = 0;
+
+ switch (ev.jbutton.button) {
+ case BUTTON_UP:
+ case BUTTON_UPLEFT:
+ case BUTTON_LEFT:
+ case BUTTON_DOWNLEFT:
+ case BUTTON_DOWN:
+ case BUTTON_DOWNRIGHT:
+ case BUTTON_RIGHT:
+ case BUTTON_UPRIGHT:
+ moveStick();
+ event.type = Common::EVENT_MOUSEMOVE;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_B:
+ case BUTTON_CLICK:
+ event.type = Common::EVENT_LBUTTONDOWN;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_X:
+ event.type = Common::EVENT_RBUTTONDOWN;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_L:
+ BUTTON_STATE_L = true;
+ break;
+ case BUTTON_R:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
+#ifdef ENABLE_VKEYBD
+ event.kbd.keycode = Common::KEYCODE_F7;
+ event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
+#else
+ event.kbd.keycode = Common::KEYCODE_0;
+ event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
+#endif
+ } else {
+ event.kbd.keycode = Common::KEYCODE_RETURN;
+ event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_SELECT:
+ case BUTTON_HOME:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
+ event.type = Common::EVENT_QUIT;
+ } else {
+ event.kbd.keycode = Common::KEYCODE_ESCAPE;
+ event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_A:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
+ event.type = Common::EVENT_PREDICTIVE_DIALOG;
+ } else {
+ event.kbd.keycode = Common::KEYCODE_PERIOD;
+ event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_Y:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
+ GPH::ToggleTapMode();
+ if (GPH::tapmodeLevel == TAPMODE_LEFT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode' - Left Click");
+ } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode' - Right Click");
+ } else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode' - Hover (No Click)");
+ }
+ } else {
+ event.kbd.keycode = Common::KEYCODE_SPACE;
+ event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_MENU:
+ case BUTTON_HELP:
+ event.type = Common::EVENT_KEYDOWN;
+ if (BUTTON_STATE_L == true) {
+ event.type = Common::EVENT_MAINMENU;
+ } else {
+ event.kbd.keycode = Common::KEYCODE_F5;
+ event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_VOLUP:
+ WIZ_HW::mixerMoveVolume(2);
+ if (WIZ_HW::volumeLevel == 100) {
+ displayMessageOnOSD("Maximum Volume");
+ } else {
+ displayMessageOnOSD("Increasing Volume");
+ }
+ break;
+ case BUTTON_VOLDOWN:
+ WIZ_HW::mixerMoveVolume(1);
+ if (WIZ_HW::volumeLevel == 0) {
+ displayMessageOnOSD("Minimal Volume");
+ } else {
+ displayMessageOnOSD("Decreasing Volume");
+ }
+ break;
+ case BUTTON_HOLD:
+ event.type = Common::EVENT_QUIT;
+ break;
+ case BUTTON_HELP2:
+ GPH::ToggleTapMode();
+ if (GPH::tapmodeLevel == TAPMODE_LEFT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode': Left Click");
+ } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode': Right Click");
+ } else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode': Hover (No Click)");
+ }
+ break;
+ }
+ return true;
+}
+
+bool OSystem_GPH::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) {
+
+ _stickBtn[ev.jbutton.button] = 0;
+ event.kbd.flags = 0;
+
+ switch (ev.jbutton.button) {
+ case BUTTON_UP:
+ case BUTTON_UPLEFT:
+ case BUTTON_LEFT:
+ case BUTTON_DOWNLEFT:
+ case BUTTON_DOWN:
+ case BUTTON_DOWNRIGHT:
+ case BUTTON_RIGHT:
+ case BUTTON_UPRIGHT:
+ moveStick();
+ event.type = Common::EVENT_MOUSEMOVE;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_B:
+ case BUTTON_CLICK:
+ event.type = Common::EVENT_LBUTTONUP;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_X:
+ event.type = Common::EVENT_RBUTTONUP;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_L:
+ BUTTON_STATE_L = false;
+ break;
+ case BUTTON_SELECT:
+ case BUTTON_HOME:
+ event.type = Common::EVENT_KEYUP;
+ event.kbd.keycode = Common::KEYCODE_ESCAPE;
+ event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
+ break;
+ case BUTTON_A:
+ event.type = Common::EVENT_KEYUP;
+ event.kbd.keycode = Common::KEYCODE_PERIOD;
+ event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
+ break;
+ case BUTTON_Y:
+ event.type = Common::EVENT_KEYUP;
+ event.kbd.keycode = Common::KEYCODE_SPACE;
+ event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
+ break;
+ case BUTTON_MENU:
+ case BUTTON_HELP:
+ event.type = Common::EVENT_KEYUP;
+ if (BUTTON_STATE_L == true) {
+ event.type = Common::EVENT_MAINMENU;
+ } else {
+ event.kbd.keycode = Common::KEYCODE_F5;
+ event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_R:
+ event.type = Common::EVENT_KEYUP;
+ if (BUTTON_STATE_L == true) {
+#ifdef ENABLE_VKEYBD
+ event.kbd.keycode = Common::KEYCODE_F7;
+ event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
+#else
+ event.kbd.keycode = Common::KEYCODE_0;
+ event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
+#endif
+ } else {
+ event.kbd.keycode = Common::KEYCODE_RETURN;
+ event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
+ }
+ break;
+ case BUTTON_VOLUP:
+ break;
+ case BUTTON_VOLDOWN:
+ break;
+ case BUTTON_HOLD:
+ break;
+ case BUTTON_HELP2:
+ break;
+ }
+ return true;
+}
+
+bool OSystem_GPH::remapKey(SDL_Event &ev,Common::Event &event) {
+ return false;
+}
diff --git a/backends/platform/gph/gph-graphics.cpp b/backends/platform/gph/gph-graphics.cpp
new file mode 100644
index 0000000000..8fada7e40a
--- /dev/null
+++ b/backends/platform/gph/gph-graphics.cpp
@@ -0,0 +1,470 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "backends/platform/gph/gph-sdl.h"
+
+#include "common/mutex.h"
+#include "graphics/font.h"
+#include "graphics/fontman.h"
+#include "graphics/scaler.h"
+#include "graphics/scaler/aspect.h"
+#include "graphics/scaler/downscaler.h"
+#include "graphics/surface.h"
+
+static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
+ {"1x", "Fullscreen", GFX_NORMAL},
+ {0, 0, 0}
+};
+
+const OSystem::GraphicsMode *OSystem_GPH::getSupportedGraphicsModes() const {
+ return s_supportedGraphicsModes;
+}
+
+int OSystem_GPH::getDefaultGraphicsMode() const {
+ return GFX_NORMAL;
+}
+
+bool OSystem_GPH::setGraphicsMode(int mode) {
+ Common::StackLock lock(_graphicsMutex);
+
+ assert(_transactionMode == kTransactionActive);
+
+ if (_oldVideoMode.setup && _oldVideoMode.mode == mode)
+ return true;
+
+ int newScaleFactor = 1;
+
+ switch (mode) {
+ case GFX_NORMAL:
+ newScaleFactor = 1;
+ break;
+ case GFX_HALF:
+ newScaleFactor = 1;
+ break;
+ default:
+ warning("unknown gfx mode %d", mode);
+ return false;
+ }
+
+ _transactionDetails.normal1xScaler = (mode == GFX_NORMAL);
+ if (_oldVideoMode.setup && _oldVideoMode.scaleFactor != newScaleFactor)
+ _transactionDetails.needHotswap = true;
+
+ _transactionDetails.needUpdatescreen = true;
+
+ _videoMode.mode = mode;
+ _videoMode.scaleFactor = newScaleFactor;
+
+ return true;
+}
+
+void OSystem_GPH::setGraphicsModeIntern() {
+ Common::StackLock lock(_graphicsMutex);
+ ScalerProc *newScalerProc = 0;
+
+ switch (_videoMode.mode) {
+ case GFX_NORMAL:
+ newScalerProc = Normal1x;
+ break;
+ case GFX_HALF:
+ newScalerProc = DownscaleAllByHalf;
+ break;
+
+ default:
+ error("Unknown gfx mode %d", _videoMode.mode);
+ }
+
+ _scalerProc = newScalerProc;
+
+ if (!_screen || !_hwscreen)
+ return;
+
+ // Blit everything to the screen
+ _forceFull = true;
+
+ // Even if the old and new scale factors are the same, we may have a
+ // different scaler for the cursor now.
+ blitCursor();
+}
+
+void OSystem_GPH::initSize(uint w, uint h) {
+ assert(_transactionMode == kTransactionActive);
+
+ // Avoid redundant res changes
+ if ((int)w == _videoMode.screenWidth && (int)h == _videoMode.screenHeight)
+ return;
+
+ _videoMode.screenWidth = w;
+ _videoMode.screenHeight = h;
+ if (w > 320 || h > 240){
+ setGraphicsMode(GFX_HALF);
+ setGraphicsModeIntern();
+ toggleMouseGrab();
+ }
+
+ _transactionDetails.sizeChanged = true;
+}
+
+bool OSystem_GPH::loadGFXMode() {
+ if (_videoMode.screenWidth > 320 || _videoMode.screenHeight > 240) {
+ _videoMode.aspectRatioCorrection = false;
+ setGraphicsMode(GFX_HALF);
+ printf("GFX_HALF\n");
+ } else {
+ setGraphicsMode(GFX_NORMAL);
+ printf("GFX_NORMAL\n");
+ }
+
+ if ((_videoMode.mode == GFX_HALF) && !_overlayVisible) {
+ _videoMode.overlayWidth = _videoMode.screenWidth / 2;
+ _videoMode.overlayHeight = _videoMode.screenHeight / 2;
+ _videoMode.fullscreen = true;
+ } else {
+
+ _videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
+ _videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
+
+ if (_videoMode.aspectRatioCorrection)
+ _videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight);
+
+ _videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
+ _videoMode.hardwareHeight = effectiveScreenHeight();
+ }
+ return OSystem_SDL::loadGFXMode();
+}
+
+void OSystem_GPH::drawMouse() {
+ if (!_mouseVisible || !_mouseSurface) {
+ _mouseBackup.x = _mouseBackup.y = _mouseBackup.w = _mouseBackup.h = 0;
+ return;
+ }
+
+ SDL_Rect dst;
+ int scale;
+ int width, height;
+ int hotX, hotY;
+
+ if (_videoMode.mode == GFX_HALF && !_overlayVisible){
+ dst.x = _mouseCurState.x/2;
+ dst.y = _mouseCurState.y/2;
+ } else {
+ dst.x = _mouseCurState.x;
+ dst.y = _mouseCurState.y;
+ }
+
+ if (!_overlayVisible) {
+ scale = _videoMode.scaleFactor;
+ width = _videoMode.screenWidth;
+ height = _videoMode.screenHeight;
+ dst.w = _mouseCurState.vW;
+ dst.h = _mouseCurState.vH;
+ hotX = _mouseCurState.vHotX;
+ hotY = _mouseCurState.vHotY;
+ } else {
+ scale = 1;
+ width = _videoMode.overlayWidth;
+ height = _videoMode.overlayHeight;
+ dst.w = _mouseCurState.rW;
+ dst.h = _mouseCurState.rH;
+ hotX = _mouseCurState.rHotX;
+ hotY = _mouseCurState.rHotY;
+ }
+
+ // The mouse is undrawn using virtual coordinates, i.e. they may be
+ // scaled and aspect-ratio corrected.
+
+ _mouseBackup.x = dst.x - hotX;
+ _mouseBackup.y = dst.y - hotY;
+ _mouseBackup.w = dst.w;
+ _mouseBackup.h = dst.h;
+
+ // We draw the pre-scaled cursor image, so now we need to adjust for
+ // scaling, shake position and aspect ratio correction manually.
+
+ if (!_overlayVisible) {
+ dst.y += _currentShakePos;
+ }
+
+ if (_videoMode.aspectRatioCorrection && !_overlayVisible)
+ dst.y = real2Aspect(dst.y);
+
+ dst.x = scale * dst.x - _mouseCurState.rHotX;
+ dst.y = scale * dst.y - _mouseCurState.rHotY;
+ dst.w = _mouseCurState.rW;
+ dst.h = _mouseCurState.rH;
+
+ // Note that SDL_BlitSurface() and addDirtyRect() will both perform any
+ // clipping necessary
+
+ if (SDL_BlitSurface(_mouseSurface, NULL, _hwscreen, &dst) != 0)
+ error("SDL_BlitSurface failed: %s", SDL_GetError());
+
+ // The screen will be updated using real surface coordinates, i.e.
+ // they will not be scaled or aspect-ratio corrected.
+ addDirtyRect(dst.x, dst.y, dst.w, dst.h, true);
+}
+
+void OSystem_GPH::undrawMouse() {
+ const int x = _mouseBackup.x;
+ const int y = _mouseBackup.y;
+
+ // When we switch bigger overlay off mouse jumps. Argh!
+ // This is intended to prevent undrawing offscreen mouse
+ if (!_overlayVisible && (x >= _videoMode.screenWidth || y >= _videoMode.screenHeight))
+ return;
+
+ if (_mouseBackup.w != 0 && _mouseBackup.h != 0){
+ if (_videoMode.mode == GFX_HALF && !_overlayVisible){
+ addDirtyRect(x*2, y*2, _mouseBackup.w*2, _mouseBackup.h*2);
+ } else {
+ addDirtyRect(x, y, _mouseBackup.w, _mouseBackup.h);
+ }
+ }
+}
+
+void OSystem_GPH::internUpdateScreen() {
+ SDL_Surface *srcSurf, *origSurf;
+ int height, width;
+ ScalerProc *scalerProc;
+ int scale1;
+
+#if defined (DEBUG)
+ assert(_hwscreen != NULL);
+ assert(_hwscreen->map->sw_data != NULL);
+#endif
+
+ // If the shake position changed, fill the dirty area with blackness
+ if (_currentShakePos != _newShakePos ||
+ (_mouseNeedsRedraw && _mouseBackup.y <= _currentShakePos)) {
+ SDL_Rect blackrect = {0, 0, _videoMode.screenWidth * _videoMode.scaleFactor, _newShakePos * _videoMode.scaleFactor};
+
+ if (_videoMode.aspectRatioCorrection && !_overlayVisible)
+ blackrect.h = real2Aspect(blackrect.h - 1) + 1;
+
+ SDL_FillRect(_hwscreen, &blackrect, 0);
+
+ _currentShakePos = _newShakePos;
+
+ _forceFull = true;
+ }
+
+ // Check whether the palette was changed in the meantime and update the
+ // screen surface accordingly.
+ if (_screen && _paletteDirtyEnd != 0) {
+ SDL_SetColors(_screen, _currentPalette + _paletteDirtyStart,
+ _paletteDirtyStart,
+ _paletteDirtyEnd - _paletteDirtyStart);
+
+ _paletteDirtyEnd = 0;
+
+ _forceFull = true;
+ }
+
+#ifdef USE_OSD
+ // OSD visible (i.e. non-transparent)?
+ if (_osdAlpha != SDL_ALPHA_TRANSPARENT) {
+ // Updated alpha value
+ const int diff = SDL_GetTicks() - _osdFadeStartTime;
+ if (diff > 0) {
+ if (diff >= kOSDFadeOutDuration) {
+ // Back to full transparency
+ _osdAlpha = SDL_ALPHA_TRANSPARENT;
+ } else {
+ // Do a linear fade out...
+ const int startAlpha = SDL_ALPHA_TRANSPARENT + kOSDInitialAlpha * (SDL_ALPHA_OPAQUE - SDL_ALPHA_TRANSPARENT) / 100;
+ _osdAlpha = startAlpha + diff * (SDL_ALPHA_TRANSPARENT - startAlpha) / kOSDFadeOutDuration;
+ }
+ SDL_SetAlpha(_osdSurface, SDL_RLEACCEL | SDL_SRCCOLORKEY | SDL_SRCALPHA, _osdAlpha);
+ _forceFull = true;
+ }
+ }
+#endif
+
+ if (!_overlayVisible) {
+ origSurf = _screen;
+ srcSurf = _tmpscreen;
+ width = _videoMode.screenWidth;
+ height = _videoMode.screenHeight;
+ scalerProc = _scalerProc;
+ scale1 = _videoMode.scaleFactor;
+ } else {
+ origSurf = _overlayscreen;
+ srcSurf = _tmpscreen2;
+ width = _videoMode.overlayWidth;
+ height = _videoMode.overlayHeight;
+ scalerProc = Normal1x;
+
+ scale1 = 1;
+ }
+
+ // Add the area covered by the mouse cursor to the list of dirty rects if
+ // we have to redraw the mouse.
+ if (_mouseNeedsRedraw)
+ undrawMouse();
+
+ // Force a full redraw if requested
+ if (_forceFull) {
+ _numDirtyRects = 1;
+ _dirtyRectList[0].x = 0;
+ _dirtyRectList[0].y = 0;
+ _dirtyRectList[0].w = width;
+ _dirtyRectList[0].h = height;
+ }
+
+ // Only draw anything if necessary
+ if (_numDirtyRects > 0 || _mouseNeedsRedraw) {
+ SDL_Rect *r;
+ SDL_Rect dst;
+ uint32 srcPitch, dstPitch;
+ SDL_Rect *lastRect = _dirtyRectList + _numDirtyRects;
+
+ for (r = _dirtyRectList; r != lastRect; ++r) {
+ dst = *r;
+ dst.x++; // Shift rect by one since 2xSai needs to access the data around
+ dst.y++; // any pixel to scale it, and we want to avoid mem access crashes.
+
+ if (SDL_BlitSurface(origSurf, r, srcSurf, &dst) != 0)
+ error("SDL_BlitSurface failed: %s", SDL_GetError());
+ }
+
+ SDL_LockSurface(srcSurf);
+ SDL_LockSurface(_hwscreen);
+
+ srcPitch = srcSurf->pitch;
+ dstPitch = _hwscreen->pitch;
+
+ for (r = _dirtyRectList; r != lastRect; ++r) {
+ register int dst_y = r->y + _currentShakePos;
+ register int dst_h = 0;
+ register int dst_w = r->w;
+ register int orig_dst_y = 0;
+ register int dst_x = r->x;
+ register int src_y;
+ register int src_x;
+
+ if (dst_y < height) {
+ dst_h = r->h;
+ if (dst_h > height - dst_y)
+ dst_h = height - dst_y;
+
+ orig_dst_y = dst_y;
+ src_x = dst_x;
+ src_y = dst_y;
+
+ if (_videoMode.aspectRatioCorrection && !_overlayVisible)
+ dst_y = real2Aspect(dst_y);
+
+ assert(scalerProc != NULL);
+
+ if ((_videoMode.mode == GFX_HALF) && (scalerProc == DownscaleAllByHalf)) {
+ if (dst_x%2==1){
+ dst_x--;
+ dst_w++;
+ }
+ if (dst_y%2==1){
+ dst_y--;
+ dst_h++;
+ }
+ src_x = dst_x;
+ src_y = dst_y;
+ dst_x = dst_x / 2;
+ dst_y = dst_y / 2;
+
+ scalerProc((byte *)srcSurf->pixels + (src_x * 2 + 2) + (src_y + 1) * srcPitch, srcPitch,
+ (byte *)_hwscreen->pixels + dst_x * 2 + dst_y * dstPitch, dstPitch, dst_w, dst_h);
+ } else {
+ scalerProc((byte *)srcSurf->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch,
+ (byte *)_hwscreen->pixels + r->x * 2 + dst_y * dstPitch, dstPitch, r->w, dst_h);
+ }
+ }
+
+ if (_videoMode.mode == GFX_HALF && scalerProc == DownscaleAllByHalf){
+ r->w = r->w / 2;
+ r->h = dst_h / 2;
+ } else {
+ r->w = r->w;
+ r->h = dst_h;
+ }
+
+ r->x = dst_x;
+ r->y = dst_y;
+
+
+#ifdef USE_SCALERS
+ if (_videoMode.aspectRatioCorrection && orig_dst_y < height && !_overlayVisible)
+ r->h = stretch200To240((uint8 *) _hwscreen->pixels, dstPitch, r->w, r->h, r->x, r->y, orig_dst_y * scale1);
+#endif
+ }
+ SDL_UnlockSurface(srcSurf);
+ SDL_UnlockSurface(_hwscreen);
+
+ // Readjust the dirty rect list in case we are doing a full update.
+ // This is necessary if shaking is active.
+ if (_forceFull) {
+ _dirtyRectList[0].y = 0;
+ _dirtyRectList[0].h = (_videoMode.mode == GFX_HALF) ? effectiveScreenHeight()/2 : effectiveScreenHeight();
+ }
+
+ drawMouse();
+
+#ifdef USE_OSD
+ if (_osdAlpha != SDL_ALPHA_TRANSPARENT) {
+ SDL_BlitSurface(_osdSurface, 0, _hwscreen, 0);
+ }
+#endif
+ // Finally, blit all our changes to the screen
+ SDL_UpdateRects(_hwscreen, _numDirtyRects, _dirtyRectList);
+ }
+
+ _numDirtyRects = 0;
+ _forceFull = false;
+ _mouseNeedsRedraw = false;
+}
+
+void OSystem_GPH::showOverlay() {
+ if (_videoMode.mode == GFX_HALF){
+ _mouseCurState.x = _mouseCurState.x / 2;
+ _mouseCurState.y = _mouseCurState.y / 2;
+ }
+ OSystem_SDL::showOverlay();
+}
+
+void OSystem_GPH::hideOverlay() {
+ if (_videoMode.mode == GFX_HALF){
+ _mouseCurState.x = _mouseCurState.x * 2;
+ _mouseCurState.y = _mouseCurState.y * 2;
+ }
+ OSystem_SDL::hideOverlay();
+}
+
+void OSystem_GPH::warpMouse(int x, int y) {
+ if (_mouseCurState.x != x || _mouseCurState.y != y) {
+ if (_videoMode.mode == GFX_HALF && !_overlayVisible){
+ x = x / 2;
+ y = y / 2;
+ }
+ }
+ OSystem_SDL::warpMouse(x, y);
+}
diff --git a/backends/platform/gph/gph-hw.cpp b/backends/platform/gph/gph-hw.cpp
new file mode 100644
index 0000000000..b43324b547
--- /dev/null
+++ b/backends/platform/gph/gph-hw.cpp
@@ -0,0 +1,109 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+/*
+ * GP2X Wiz: Hardware Stuff.
+ *
+ */
+
+#include "backends/platform/gph/gph-hw.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace WIZ_HW {
+
+enum {
+ VOLUME_NOCHG = 0,
+ VOLUME_DOWN = 1,
+ VOLUME_UP = 2,
+ VOLUME_CHANGE_RATE = 8,
+ VOLUME_MIN = 0,
+ VOLUME_INITIAL = 60,
+ VOLUME_MAX = 100
+};
+
+int volumeLevel = VOLUME_INITIAL;
+
+void deviceInit() {
+}
+
+void deviceDeinit() {
+}
+
+void mixerMoveVolume(int direction) {
+ if (volumeLevel <= 10) {
+ if (direction == VOLUME_UP) volumeLevel += VOLUME_CHANGE_RATE/2;
+ if (direction == VOLUME_DOWN) volumeLevel -= VOLUME_CHANGE_RATE/2;
+ } else {
+ if (direction == VOLUME_UP) volumeLevel += VOLUME_CHANGE_RATE;
+ if (direction == VOLUME_DOWN) volumeLevel -= VOLUME_CHANGE_RATE;
+ }
+
+ if (volumeLevel < VOLUME_MIN) volumeLevel = VOLUME_MIN;
+ if (volumeLevel > VOLUME_MAX) volumeLevel = VOLUME_MAX;
+
+ unsigned long soundDev = open("/dev/mixer", O_RDWR);
+
+ if (soundDev) {
+ int vol = ((volumeLevel << 8) | volumeLevel);
+ ioctl(soundDev, SOUND_MIXER_WRITE_PCM, &vol);
+ close(soundDev);
+ }
+}
+
+} /* namespace WIZ_HW */
+
+namespace GPH {
+
+enum {
+ /* Touchscreen TapMode */
+ TAPMODE_LEFT = 0,
+ TAPMODE_RIGHT = 1,
+ TAPMODE_HOVER = 2
+};
+
+int tapmodeLevel = TAPMODE_LEFT;
+
+void ToggleTapMode() {
+ if (tapmodeLevel == TAPMODE_LEFT) {
+ tapmodeLevel = TAPMODE_RIGHT;
+ } else if (tapmodeLevel == TAPMODE_RIGHT) {
+ tapmodeLevel = TAPMODE_HOVER;
+ } else if (tapmodeLevel == TAPMODE_HOVER) {
+ tapmodeLevel = TAPMODE_LEFT;
+ } else {
+ tapmodeLevel = TAPMODE_LEFT;
+ }
+}
+
+} /* namespace GPH */
diff --git a/backends/platform/gph/gph-hw.h b/backends/platform/gph/gph-hw.h
new file mode 100644
index 0000000000..7276276608
--- /dev/null
+++ b/backends/platform/gph/gph-hw.h
@@ -0,0 +1,52 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+/*
+ * GP2X Wiz: Hardware Stuff.
+ *
+ */
+
+#ifndef GPH_HW_H
+#define GPH_HW_H
+
+namespace WIZ_HW {
+
+extern int volumeLevel;
+
+extern void deviceInit();
+extern void deviceDeinit();
+extern void mixerMoveVolume(int);
+
+} /* namespace WIZ_HW */
+
+namespace GPH {
+
+extern int tapmodeLevel;
+
+extern void ToggleTapMode();
+
+} /* namespace GPH */
+
+#endif //GPH_HW_H
diff --git a/backends/platform/gph/gph-main.cpp b/backends/platform/gph/gph-main.cpp
new file mode 100644
index 0000000000..adc79b186c
--- /dev/null
+++ b/backends/platform/gph/gph-main.cpp
@@ -0,0 +1,213 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "common/scummsys.h"
+#include
+
+#include "backends/platform/gph/gph-sdl.h"
+#include "backends/platform/gph/gph-hw.h"
+#include "backends/plugins/posix/posix-provider.h"
+#include "base/main.h"
+
+#include "common/archive.h"
+#include "common/config-manager.h"
+#include "common/debug.h"
+#include "common/events.h"
+#include "common/util.h"
+
+#include "common/file.h"
+#include "base/main.h"
+
+#include "backends/saves/default/default-saves.h"
+
+#include "backends/timer/default/default-timer.h"
+#include "sound/mixer_intern.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include // for getTimeAndDate()
+
+/* Dump console info to files. */
+#define DUMP_STDOUT
+
+int main(int argc, char *argv[]) {
+ g_system = new OSystem_GPH();
+ assert(g_system);
+#ifdef DYNAMIC_MODULES
+ PluginManager::instance().addPluginProvider(new POSIXPluginProvider());
+#endif
+
+ // Invoke the actual ScummVM main entry point:
+ int res = scummvm_main(argc, argv);
+ g_system->quit();
+
+ return res;
+}
+
+void OSystem_GPH::initBackend() {
+
+ /* Setup default save path to be workingdir/saves */
+
+ char savePath[PATH_MAX+1];
+ char workDirName[PATH_MAX+1];
+
+ if (getcwd(workDirName, PATH_MAX) == NULL) {
+ error("Could not obtain current working directory.");
+ } else {
+ printf("Current working directory: %s\n", workDirName);
+ }
+
+ strcpy(savePath, workDirName);
+ strcat(savePath, "/saves");
+ printf("Current save directory: %s\n", savePath);
+ struct stat sb;
+ if (stat(savePath, &sb) == -1)
+ if (errno == ENOENT) // Create the dir if it does not exist
+ if (mkdir(savePath, 0755) != 0)
+ warning("mkdir for '%s' failed!", savePath);
+
+ _savefile = new DefaultSaveFileManager(savePath);
+
+ #ifdef DUMP_STDOUT
+ // The GP2X Wiz has a serial console on the breakout board but most users do not use this so we
+ // output all our STDOUT and STDERR to files for debug purposes.
+ char STDOUT_FILE[PATH_MAX+1];
+ char STDERR_FILE[PATH_MAX+1];
+
+ strcpy(STDOUT_FILE, workDirName);
+ strcpy(STDERR_FILE, workDirName);
+ strcat(STDOUT_FILE, "/scummvm.stdout.txt");
+ strcat(STDERR_FILE, "/scummvm.stderr.txt");
+
+ // Flush the output in case anything is queued
+ fclose(stdout);
+ fclose(stderr);
+
+ // Redirect standard input and standard output
+ FILE *newfp = freopen(STDOUT_FILE, "w", stdout);
+ if (newfp == NULL) {
+ #if !defined(stdout)
+ stdout = fopen(STDOUT_FILE, "w");
+ #else
+ newfp = fopen(STDOUT_FILE, "w");
+ if (newfp) {
+ *stdout = *newfp;
+ }
+ #endif
+ }
+
+ newfp = freopen(STDERR_FILE, "w", stderr);
+ if (newfp == NULL) {
+ #if !defined(stderr)
+ stderr = fopen(STDERR_FILE, "w");
+ #else
+ newfp = fopen(STDERR_FILE, "w");
+ if (newfp) {
+ *stderr = *newfp;
+ }
+ #endif
+ }
+
+ setbuf(stderr, NULL);
+ printf("%s\n", "Debug: STDOUT and STDERR redirected to text files.");
+ #endif /* DUMP_STDOUT */
+
+ /* Initialise any GP2X Wiz specific stuff we may want (Batt Status, scaler etc.) */
+ WIZ_HW::deviceInit();
+
+ /* Set Default hardware mixer volume to a preset level (VOLUME_INITIAL). This is done to 'reset' volume level if set by other apps. */
+ WIZ_HW::mixerMoveVolume(0);
+
+ /* Up default volume values as we use a seperate system level volume anyway. */
+ ConfMan.registerDefault("music_volume", 192);
+ ConfMan.registerDefault("sfx_volume", 192);
+ ConfMan.registerDefault("speech_volume", 192);
+
+ /* Trigger autosave every 4 minutes - On low batts 5 mins is about your warning time. */
+ ConfMan.registerDefault("autosave_period", 4 * 60);
+
+ /* Make sure that aspect ratio correction is enabled on the 1st run to stop users asking me what the 'wasted space' is ;-). */
+ ConfMan.registerDefault("aspect_ratio", true);
+
+ /* Make sure SDL knows that we have a joystick we want to use. */
+ ConfMan.setInt("joystick_num", 0);
+
+ printf("%s\n", "Passing to OSystem::SDL initBackend.");
+
+ /* Pass to SDL backend to do the heavy lifting */
+ OSystem_SDL::initBackend();
+}
+
+void OSystem_GPH::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
+
+ /* Setup default extra data paths for engine data files and plugins */
+ char workDirName[PATH_MAX+1];
+
+ if (getcwd(workDirName, PATH_MAX) == NULL) {
+ error("Error: Could not obtain current working directory.");
+ }
+
+ Common::FSNode workdirNode(workDirName);
+ if (workdirNode.exists() && workdirNode.isDirectory()) {
+ s.add("__GP2XWIZ_WORKDIR__", new Common::FSDirectory(workDirName), priority);
+ }
+
+ char enginedataPath[PATH_MAX+1];
+
+ strcpy(enginedataPath, workDirName);
+ strcat(enginedataPath, "/engine-data");
+
+ Common::FSNode engineNode(enginedataPath);
+ if (engineNode.exists() && engineNode.isDirectory()) {
+ s.add("__GP2XWIZ_ENGDATA__", new Common::FSDirectory(enginedataPath), priority);
+ }
+
+ char pluginsPath[PATH_MAX+1];
+
+ strcpy(pluginsPath, workDirName);
+ strcat(pluginsPath, "/plugins");
+
+ Common::FSNode pluginsNode(pluginsPath);
+ if (pluginsNode.exists() && pluginsNode.isDirectory()) {
+ s.add("__GP2XWIZ_PLUGINS__", new Common::FSDirectory(pluginsPath), priority);
+ }
+}
+
+void OSystem_GPH::quit() {
+
+ WIZ_HW::deviceDeinit();
+
+ #ifdef DUMP_STDOUT
+ printf("%s\n", "Debug: STDOUT and STDERR text files closed.");
+ fclose(stdout);
+ fclose(stderr);
+ #endif /* DUMP_STDOUT */
+
+ OSystem_SDL::quit();
+}
diff --git a/backends/platform/gph/gph-sdl.h b/backends/platform/gph/gph-sdl.h
new file mode 100644
index 0000000000..136363f9a0
--- /dev/null
+++ b/backends/platform/gph/gph-sdl.h
@@ -0,0 +1,81 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef GPH_SDL_H
+#define GPH_SDL_H
+
+#include "backends/platform/sdl/sdl.h"
+
+// FIXME: For now keep hacks in this header to save polluting the SDL backend.
+enum {
+ GFX_HALF = 12
+};
+
+#define __GP2XWIZ__
+#define MIXER_DOUBLE_BUFFERING 1
+
+#ifndef PATH_MAX
+ #define PATH_MAX 255
+#endif
+
+class OSystem_GPH : public OSystem_SDL {
+public:
+ OSystem_GPH() {}
+
+ /* Graphics */
+ void initSize(uint w, uint h);
+ void setGraphicsModeIntern();
+ bool setGraphicsMode(int mode);
+ void internUpdateScreen();
+ const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
+ bool setGraphicsMode(const char *name);
+ int getDefaultGraphicsMode() const;
+ bool loadGFXMode();
+ void drawMouse();
+ void undrawMouse();
+ void showOverlay();
+ void hideOverlay();
+
+ /* Event Stuff */
+ void moveStick();
+ void fillMouseEvent(Common::Event&, int, int);
+ void warpMouse(int, int);
+ bool remapKey(SDL_Event&, Common::Event&);
+
+ /* Platform Setup Stuff */
+ void addSysArchivesToSearchSet(Common::SearchSet &s, int priority);
+ void initBackend();
+ void quit();
+
+protected:
+ bool _stickBtn[32];
+
+ bool handleMouseButtonDown(SDL_Event &ev, Common::Event &event);
+ bool handleMouseButtonUp(SDL_Event &ev, Common::Event &event);
+ bool handleJoyButtonDown(SDL_Event &ev, Common::Event &event);
+ bool handleJoyButtonUp(SDL_Event &ev, Common::Event &event);
+};
+
+#endif //GPH_SDL_H
diff --git a/backends/platform/gph/module.mk b/backends/platform/gph/module.mk
new file mode 100644
index 0000000000..f5567f581e
--- /dev/null
+++ b/backends/platform/gph/module.mk
@@ -0,0 +1,15 @@
+MODULE := backends/platform/gph
+
+MODULE_OBJS := \
+ gph-events.o \
+ gph-graphics.o \
+ gph-hw.o \
+ gph-main.o
+
+# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
+MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
+OBJS := $(MODULE_OBJS) $(OBJS)
+MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))
+
+# Hack to ensure the SDL backend is built so we can use OSystem_SDL.
+-include $(srcdir)/backends/platform/sdl/module.mk
\ No newline at end of file
--
cgit v1.2.3
From 68dd99643c63a20baec740923f69a470615eae38 Mon Sep 17 00:00:00 2001
From: Fabio Battaglia
Date: Thu, 9 Sep 2010 13:30:15 +0000
Subject: DINGUX and N64: changes to dists targets
Run instructions to copy engine data only if there is really some
datafiles to copy for the built engines.
svn-id: r52656
---
backends/platform/dingux/dingux.mk | 2 ++
backends/platform/n64/n64.mk | 2 ++
2 files changed, 4 insertions(+)
(limited to 'backends/platform')
diff --git a/backends/platform/dingux/dingux.mk b/backends/platform/dingux/dingux.mk
index cf18a680e7..9ccbcfade3 100644
--- a/backends/platform/dingux/dingux.mk
+++ b/backends/platform/dingux/dingux.mk
@@ -16,7 +16,9 @@ dingux-dist: all
$(MKDIR) $(bundle_name)/saves
$(STRIP) $(EXECUTABLE) -o $(bundle_name)/scummvm.elf
$(CP) $(DIST_FILES_THEMES) $(bundle_name)/
+ifdef DIST_FILES_ENGINEDATA
$(CP) $(DIST_FILES_ENGINEDATA) $(bundle_name)/
+endif
$(CP) $(DIST_FILES_DOCS) $(bundle_name)/
ifdef DYNAMIC_MODULES
$(MKDIR) $(bundle_name)/plugins
diff --git a/backends/platform/n64/n64.mk b/backends/platform/n64/n64.mk
index 580bdce7ce..2e383e670d 100644
--- a/backends/platform/n64/n64.mk
+++ b/backends/platform/n64/n64.mk
@@ -15,7 +15,9 @@ n64-distclean:
n64-dist: all
$(MKDIR) $(bundle_name)
$(MKDIR) $(bundle_name)/romfs
+ifdef DIST_FILES_ENGINEDATA
$(CP) $(DIST_FILES_ENGINEDATA) $(bundle_name)/romfs
+endif
$(CP) $(DIST_FILES_DOCS) $(bundle_name)/
$(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)/romfs
genromfs -f $(bundle_name)/romfs.img -d $(bundle_name)/romfs -V scummvmn64
--
cgit v1.2.3
From 7fea0c00b9a5d7ca66a6baedb2011969030a3963 Mon Sep 17 00:00:00 2001
From: Fabio Battaglia
Date: Thu, 16 Sep 2010 09:32:10 +0000
Subject: DINGUX: add exec wrapper for scummvm.elf
Add a wrapper to set HOME var when running scummvm on dingux.
svn-id: r52744
---
backends/platform/dingux/dingux.mk | 2 +-
backends/platform/dingux/scummvm.gpe | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
create mode 100644 backends/platform/dingux/scummvm.gpe
(limited to 'backends/platform')
diff --git a/backends/platform/dingux/dingux.mk b/backends/platform/dingux/dingux.mk
index 9ccbcfade3..47c60ac990 100644
--- a/backends/platform/dingux/dingux.mk
+++ b/backends/platform/dingux/dingux.mk
@@ -26,4 +26,4 @@ ifdef DYNAMIC_MODULES
$(STRIP) $(bundle_name)/plugins/*
endif
$(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)/
-
+ $(CP) $(srcdir)/backends/platform/dingux/scummvm.gpe $(bundle_name)/
diff --git a/backends/platform/dingux/scummvm.gpe b/backends/platform/dingux/scummvm.gpe
new file mode 100644
index 0000000000..84ab0c6b95
--- /dev/null
+++ b/backends/platform/dingux/scummvm.gpe
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+HOME=`pwd`
+$HOME/scummvm.elf
+
--
cgit v1.2.3
From 59823374852d92cfe4400b5b5fcef5b06e3f5344 Mon Sep 17 00:00:00 2001
From: Fabio Battaglia
Date: Thu, 16 Sep 2010 09:37:15 +0000
Subject: DINGUX: Add placeholder for dingux specific readme
Add an almost empty readme for dingux, to be filled soon.
svn-id: r52745
---
backends/platform/dingux/README.DINGUX | 10 ++++++++++
backends/platform/dingux/dingux.mk | 1 +
2 files changed, 11 insertions(+)
create mode 100644 backends/platform/dingux/README.DINGUX
(limited to 'backends/platform')
diff --git a/backends/platform/dingux/README.DINGUX b/backends/platform/dingux/README.DINGUX
new file mode 100644
index 0000000000..bda3e51c73
--- /dev/null
+++ b/backends/platform/dingux/README.DINGUX
@@ -0,0 +1,10 @@
+ScummVM-DINGUX README
+==============================================================================
+
+Requirements
+============
+- Dingoo A320/A330
+- Dingux installed on SD card
+- Fixed Tremor libs in dingux rootfs (see below)
+
+* To Be Filled *
diff --git a/backends/platform/dingux/dingux.mk b/backends/platform/dingux/dingux.mk
index 47c60ac990..0505dbdfd3 100644
--- a/backends/platform/dingux/dingux.mk
+++ b/backends/platform/dingux/dingux.mk
@@ -27,3 +27,4 @@ ifdef DYNAMIC_MODULES
endif
$(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)/
$(CP) $(srcdir)/backends/platform/dingux/scummvm.gpe $(bundle_name)/
+ $(CP) $(srcdir)/backends/platform/dingux/README.DINGUX $(bundle_name)/
--
cgit v1.2.3
From 9efa316a61575bb8c9df0b74880ecb0a786e314c Mon Sep 17 00:00:00 2001
From: Eugene Sandulenko
Date: Fri, 17 Sep 2010 19:13:47 +0000
Subject: RELEASE: This is 1.3.0svn
svn-id: r52773
---
backends/platform/psp/README.PSP | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'backends/platform')
diff --git a/backends/platform/psp/README.PSP b/backends/platform/psp/README.PSP
index f4d5bae6d6..ebafdb0b17 100644
--- a/backends/platform/psp/README.PSP
+++ b/backends/platform/psp/README.PSP
@@ -1,4 +1,4 @@
-ScummVM-PSP 1.2.0svn README
+ScummVM-PSP 1.3.0svn README
==============================================================================
Installation
--
cgit v1.2.3
From c91a07229a8bd841e6b6e77d977254c388a2e407 Mon Sep 17 00:00:00 2001
From: Torbjörn Andersson
Date: Sat, 18 Sep 2010 10:55:16 +0000
Subject: JANITORIAL: Removed most punctuation at end of warning() and error()
Our warning() and error() functions always add an exclamation mark
to the end of the message anyway.
svn-id: r52791
---
backends/platform/android/android.cpp | 10 +++++-----
backends/platform/gp2x/gp2x.cpp | 4 ++--
backends/platform/gph/gph-main.cpp | 4 ++--
backends/platform/openpandora/op-main.cpp | 4 ++--
backends/platform/sdl/graphics.cpp | 2 +-
backends/platform/wince/wince-sdl.cpp | 2 +-
6 files changed, 13 insertions(+), 13 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index f6af0fcff5..449d27561e 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -400,7 +400,7 @@ static void ScummVM_audioMixCallback(JNIEnv* env, jobject self,
jsize len = env->GetArrayLength(jbuf);
jbyte* buf = env->GetByteArrayElements(jbuf, NULL);
if (buf == NULL) {
- warning("Unable to get Java audio byte array. Skipping.");
+ warning("Unable to get Java audio byte array. Skipping");
return;
}
Audio::MixerImpl* mixer =
@@ -1135,7 +1135,7 @@ OSystem::MutexRef OSystem_Android::createMutex() {
pthread_mutex_t *mutex = new pthread_mutex_t;
if (pthread_mutex_init(mutex, &attr) != 0) {
- warning("pthread_mutex_init() failed!");
+ warning("pthread_mutex_init() failed");
delete mutex;
return NULL;
}
@@ -1144,18 +1144,18 @@ OSystem::MutexRef OSystem_Android::createMutex() {
void OSystem_Android::lockMutex(MutexRef mutex) {
if (pthread_mutex_lock((pthread_mutex_t*)mutex) != 0)
- warning("pthread_mutex_lock() failed!");
+ warning("pthread_mutex_lock() failed");
}
void OSystem_Android::unlockMutex(MutexRef mutex) {
if (pthread_mutex_unlock((pthread_mutex_t*)mutex) != 0)
- warning("pthread_mutex_unlock() failed!");
+ warning("pthread_mutex_unlock() failed");
}
void OSystem_Android::deleteMutex(MutexRef mutex) {
pthread_mutex_t* m = (pthread_mutex_t*)mutex;
if (pthread_mutex_destroy(m) != 0)
- warning("pthread_mutex_destroy() failed!");
+ warning("pthread_mutex_destroy() failed");
else
delete m;
}
diff --git a/backends/platform/gp2x/gp2x.cpp b/backends/platform/gp2x/gp2x.cpp
index 88d4f9d632..5bd106e72c 100644
--- a/backends/platform/gp2x/gp2x.cpp
+++ b/backends/platform/gp2x/gp2x.cpp
@@ -115,7 +115,7 @@ void OSystem_GP2X::initBackend() {
char workDirName[PATH_MAX+1];
if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Could not obtain current working directory.");
+ error("Could not obtain current working directory");
} else {
printf("Current working directory: %s\n", workDirName);
}
@@ -328,7 +328,7 @@ void OSystem_GP2X::addSysArchivesToSearchSet(Common::SearchSet &s, int priority)
char workDirName[PATH_MAX+1];
if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Error: Could not obtain current working directory.");
+ error("Error: Could not obtain current working directory");
}
Common::FSNode workdirNode(workDirName);
diff --git a/backends/platform/gph/gph-main.cpp b/backends/platform/gph/gph-main.cpp
index adc79b186c..727d599cc8 100644
--- a/backends/platform/gph/gph-main.cpp
+++ b/backends/platform/gph/gph-main.cpp
@@ -78,7 +78,7 @@ void OSystem_GPH::initBackend() {
char workDirName[PATH_MAX+1];
if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Could not obtain current working directory.");
+ error("Could not obtain current working directory");
} else {
printf("Current working directory: %s\n", workDirName);
}
@@ -170,7 +170,7 @@ void OSystem_GPH::addSysArchivesToSearchSet(Common::SearchSet &s, int priority)
char workDirName[PATH_MAX+1];
if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Error: Could not obtain current working directory.");
+ error("Error: Could not obtain current working directory");
}
Common::FSNode workdirNode(workDirName);
diff --git a/backends/platform/openpandora/op-main.cpp b/backends/platform/openpandora/op-main.cpp
index 71aa0b99f6..a6f20369af 100755
--- a/backends/platform/openpandora/op-main.cpp
+++ b/backends/platform/openpandora/op-main.cpp
@@ -79,7 +79,7 @@ void OSystem_OP::initBackend() {
char workDirName[PATH_MAX+1];
if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Could not obtain current working directory.");
+ error("Could not obtain current working directory");
} else {
printf("Current working directory: %s\n", workDirName);
}
@@ -165,7 +165,7 @@ void OSystem_OP::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
char workDirName[PATH_MAX+1];
if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Error: Could not obtain current working directory.");
+ error("Error: Could not obtain current working directory");
}
Common::FSNode workdirNode(workDirName);
diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp
index 69144dcc01..0b96ef24ec 100644
--- a/backends/platform/sdl/graphics.cpp
+++ b/backends/platform/sdl/graphics.cpp
@@ -527,7 +527,7 @@ static void fixupResolutionForAspectRatio(AspectRatio desiredAspectRatio, int &w
}
if (!bestMode) {
- warning("Unable to enforce the desired aspect ratio!");
+ warning("Unable to enforce the desired aspect ratio");
return;
}
//printf("%d %d\n", bestMode->w, bestMode->h);
diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp
index aef2117bd7..d68cbd5d0b 100644
--- a/backends/platform/wince/wince-sdl.cpp
+++ b/backends/platform/wince/wince-sdl.cpp
@@ -429,7 +429,7 @@ void OSystem_WINCE3::initBackend() {
GUI::Actions::init();
GUI_Actions::Instance()->initInstanceMain(this);
if (!GUI_Actions::Instance()->loadMapping()) { // error during loading means not present/wrong version
- warning("Setting default action mappings.");
+ warning("Setting default action mappings");
GUI_Actions::Instance()->saveMapping(); // write defaults
}
--
cgit v1.2.3
From b006082cf18120185a9ae18a2d926fddde76b941 Mon Sep 17 00:00:00 2001
From: Yotam Barnoy
Date: Mon, 20 Sep 2010 14:05:32 +0000
Subject: PSP: moved VramAllocator to display_manager.cpp.
It didn't really belong in memory.cpp and we're going to want to include memory.h everywhere.
* * *
PSP: more Vram Allocator cleanup
svn-id: r52815
---
backends/platform/psp/display_manager.cpp | 65 ++++++++++++++++++++++++++
backends/platform/psp/display_manager.h | 42 +++++++++++++++++
backends/platform/psp/memory.cpp | 77 -------------------------------
backends/platform/psp/memory.h | 43 +----------------
4 files changed, 108 insertions(+), 119 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/psp/display_manager.cpp b/backends/platform/psp/display_manager.cpp
index 9f58a64ee3..72a0acb632 100644
--- a/backends/platform/psp/display_manager.cpp
+++ b/backends/platform/psp/display_manager.cpp
@@ -59,6 +59,71 @@ const OSystem::GraphicsMode DisplayManager::_supportedModes[] = {
{0, 0, 0}
};
+
+// Class VramAllocator -----------------------------------
+
+DECLARE_SINGLETON(VramAllocator)
+
+//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */
+//#define __PSP_DEBUG_PRINT__
+
+#include "backends/platform/psp/trace.h"
+
+
+void *VramAllocator::allocate(int32 size, bool smallAllocation /* = false */) {
+ DEBUG_ENTER_FUNC();
+ assert(size > 0);
+
+ byte *lastAddress = smallAllocation ? (byte *)VRAM_SMALL_ADDRESS : (byte *)VRAM_START_ADDRESS;
+ Common::List::iterator i;
+
+ // Find a block that fits, starting from the beginning
+ for (i = _allocList.begin(); i != _allocList.end(); ++i) {
+ byte *currAddress = (*i).address;
+
+ if (currAddress - lastAddress >= size) // We found a match
+ break;
+
+ if ((*i).getEnd() > lastAddress)
+ lastAddress = (byte *)(*i).getEnd();
+ }
+
+ if (lastAddress + size > (byte *)VRAM_END_ADDRESS) {
+ PSP_DEBUG_PRINT("No space for allocation of %d bytes. %d bytes already allocated.\n",
+ size, _bytesAllocated);
+ return NULL;
+ }
+
+ _allocList.insert(i, Allocation(lastAddress, size));
+ _bytesAllocated += size;
+
+ PSP_DEBUG_PRINT("Allocated in VRAM, size %u at %p.\n", size, lastAddress);
+ PSP_DEBUG_PRINT("Total allocated %u, remaining %u.\n", _bytesAllocated, (2 * 1024 * 1024) - _bytesAllocated);
+
+ return lastAddress;
+}
+
+// Deallocate a block from VRAM
+void VramAllocator::deallocate(void *address) {
+ DEBUG_ENTER_FUNC();
+ address = (byte *)CACHED(address); // Make sure all addresses are the same
+
+ Common::List::iterator i;
+
+ // Find the Allocator to deallocate
+ for (i = _allocList.begin(); i != _allocList.end(); ++i) {
+ if ((*i).address == address) {
+ _bytesAllocated -= (*i).size;
+ _allocList.erase(i);
+ PSP_DEBUG_PRINT("Deallocated address[%p], size[%u]\n", (*i).address, (*i).size);
+ return;
+ }
+ }
+
+ PSP_DEBUG_PRINT("Address[%p] not allocated.\n", address);
+}
+
+
// Class MasterGuRenderer ----------------------------------------------
void MasterGuRenderer::setupCallbackThread() {
diff --git a/backends/platform/psp/display_manager.h b/backends/platform/psp/display_manager.h
index f52541e615..fa31fbcd40 100644
--- a/backends/platform/psp/display_manager.h
+++ b/backends/platform/psp/display_manager.h
@@ -27,6 +27,48 @@
#define PSP_DISPLAY_MAN_H
#include "backends/platform/psp/thread.h"
+#include "common/list.h"
+
+#define UNCACHED(x) ((byte *)(((uint32)(x)) | 0x40000000)) /* make an uncached access */
+#define CACHED(x) ((byte *)(((uint32)(x)) & 0xBFFFFFFF)) /* make an uncached access into a cached one */
+
+/**
+ * Class that allocates memory in the VRAM
+ */
+class VramAllocator : public Common::Singleton {
+public:
+ VramAllocator() : _bytesAllocated(0) {}
+ void *allocate(int32 size, bool smallAllocation = false); // smallAllocation e.g. palettes
+ void deallocate(void *pointer);
+
+ static inline bool isAddressInVram(void *address) {
+ if ((uint32)(CACHED(address)) >= VRAM_START_ADDRESS && (uint32)(CACHED(address)) < VRAM_END_ADDRESS)
+ return true;
+ return false;
+ }
+
+
+private:
+ /**
+ * Used to allocate in VRAM
+ */
+ struct Allocation {
+ byte *address;
+ uint32 size;
+ void *getEnd() { return address + size; }
+ Allocation(void *Address, uint32 Size) : address((byte *)Address), size(Size) {}
+ Allocation() : address(0), size(0) {}
+ };
+
+ enum {
+ VRAM_START_ADDRESS = 0x04000000,
+ VRAM_END_ADDRESS = 0x04200000,
+ VRAM_SMALL_ADDRESS = VRAM_END_ADDRESS - (4 * 1024) // 4K in the end for small allocations
+ };
+ Common::List _allocList; // List of allocations
+ uint32 _bytesAllocated;
+};
+
/**
* Class used only by DisplayManager to start/stop GU rendering
diff --git a/backends/platform/psp/memory.cpp b/backends/platform/psp/memory.cpp
index 29d0482d9a..0dfc15f293 100644
--- a/backends/platform/psp/memory.cpp
+++ b/backends/platform/psp/memory.cpp
@@ -25,7 +25,6 @@
#include "common/scummsys.h"
#include "common/singleton.h"
-#include "common/list.h"
#include "backends/platform/psp/psppixelformat.h"
#include "backends/platform/psp/memory.h"
@@ -424,79 +423,3 @@ void PspMemory::swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32 byte
*((uint16 *)dst32) = format.swapRedBlue16((uint16)(srcWord >> shiftValue));
}
}
-
-inline void PspMemory::copy16(uint16 *dst16, const uint16 *src16, uint32 bytes) {
- PSP_DEBUG_PRINT("copy16(): dst16[%p], src16[%p], bytes[%d]\n", dst16, src16, bytes);
-
- uint32 shorts = bytes >> 1;
- uint32 remainingBytes = bytes & 1;
-
- for (; shorts > 0 ; shorts--) {
- *dst16++ = *src16++;
- }
- if (remainingBytes)
- *(byte *)dst16 = *(byte *)src16;
-}
-
-// Class VramAllocator -----------------------------------
-
-DECLARE_SINGLETON(VramAllocator)
-
-//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */
-//#define __PSP_DEBUG_PRINT__
-
-#include "backends/platform/psp/trace.h"
-
-
-void *VramAllocator::allocate(int32 size, bool smallAllocation /* = false */) {
- DEBUG_ENTER_FUNC();
- assert(size > 0);
-
- byte *lastAddress = smallAllocation ? (byte *)VRAM_SMALL_ADDRESS : (byte *)VRAM_START_ADDRESS;
- Common::List::iterator i;
-
- // Find a block that fits, starting from the beginning
- for (i = _allocList.begin(); i != _allocList.end(); ++i) {
- byte *currAddress = (*i).address;
-
- if (currAddress - lastAddress >= size) // We found a match
- break;
-
- if ((*i).getEnd() > lastAddress)
- lastAddress = (byte *)(*i).getEnd();
- }
-
- if (lastAddress + size > (byte *)VRAM_END_ADDRESS) {
- PSP_DEBUG_PRINT("No space for allocation of %d bytes. %d bytes already allocated.\n",
- size, _bytesAllocated);
- return NULL;
- }
-
- _allocList.insert(i, Allocation(lastAddress, size));
- _bytesAllocated += size;
-
- PSP_DEBUG_PRINT("Allocated in VRAM, size %u at %p.\n", size, lastAddress);
- PSP_DEBUG_PRINT("Total allocated %u, remaining %u.\n", _bytesAllocated, (2 * 1024 * 1024) - _bytesAllocated);
-
- return lastAddress;
-}
-
-// Deallocate a block from VRAM
-void VramAllocator::deallocate(void *address) {
- DEBUG_ENTER_FUNC();
- address = (byte *)CACHED(address); // Make sure all addresses are the same
-
- Common::List::iterator i;
-
- // Find the Allocator to deallocate
- for (i = _allocList.begin(); i != _allocList.end(); ++i) {
- if ((*i).address == address) {
- _bytesAllocated -= (*i).size;
- _allocList.erase(i);
- PSP_DEBUG_PRINT("Deallocated address[%p], size[%u]\n", (*i).address, (*i).size);
- return;
- }
- }
-
- PSP_DEBUG_PRINT("Address[%p] not allocated.\n", address);
-}
diff --git a/backends/platform/psp/memory.h b/backends/platform/psp/memory.h
index 793bc94888..6d2d927b1b 100644
--- a/backends/platform/psp/memory.h
+++ b/backends/platform/psp/memory.h
@@ -27,12 +27,6 @@
#ifndef PSP_MEMORY_H
#define PSP_MEMORY_H
-#include "backends/platform/psp/psppixelformat.h"
-#include "common/list.h"
-
-#define UNCACHED(x) ((byte *)(((uint32)(x)) | 0x40000000)) /* make an uncached access */
-#define CACHED(x) ((byte *)(((uint32)(x)) & 0xBFFFFFFF)) /* make an uncached access into a cached one */
-
#define MIN_AMOUNT_FOR_COMPLEX_COPY 8
#define MIN_AMOUNT_FOR_MISALIGNED_COPY 8
@@ -91,41 +85,6 @@ public:
}
};
-/**
- * Class that allocates memory in the VRAM
- */
-class VramAllocator : public Common::Singleton {
-public:
- VramAllocator() : _bytesAllocated(0) {}
- void *allocate(int32 size, bool smallAllocation = false); // smallAllocation e.g. palettes
- void deallocate(void *pointer);
-
- static inline bool isAddressInVram(void *address) {
- if ((uint32)(CACHED(address)) >= VRAM_START_ADDRESS && (uint32)(CACHED(address)) < VRAM_END_ADDRESS)
- return true;
- return false;
- }
-
-
-private:
- /**
- * Used to allocate in VRAM
- */
- struct Allocation {
- byte *address;
- uint32 size;
- void *getEnd() { return address + size; }
- Allocation(void *Address, uint32 Size) : address((byte *)Address), size(Size) {}
- Allocation() : address(0), size(0) {}
- };
+#endif /* PSP_MEMORY_H */
- enum {
- VRAM_START_ADDRESS = 0x04000000,
- VRAM_END_ADDRESS = 0x04200000,
- VRAM_SMALL_ADDRESS = VRAM_END_ADDRESS - (4 * 1024) // 4K in the end for small allocations
- };
- Common::List _allocList; // List of allocations
- uint32 _bytesAllocated;
-};
-#endif /* PSP_MEMORY_H */
--
cgit v1.2.3
From 05f0ebf2620969277ff94ce486e13b19eb46c1c9 Mon Sep 17 00:00:00 2001
From: Yotam Barnoy
Date: Mon, 20 Sep 2010 14:09:39 +0000
Subject: PSP: Split up PspMemory class.
PspMemorySwap is more specific ie. it only needs to be known by PSP files. It could be put in another file, but not worth the effort.
svn-id: r52816
---
backends/platform/psp/display_client.cpp | 7 +-
backends/platform/psp/memory.cpp | 251 +++++++++++++++----------------
backends/platform/psp/memory.h | 48 +++---
3 files changed, 158 insertions(+), 148 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/psp/display_client.cpp b/backends/platform/psp/display_client.cpp
index 71b505ec7c..6cec6ad231 100644
--- a/backends/platform/psp/display_client.cpp
+++ b/backends/platform/psp/display_client.cpp
@@ -32,6 +32,7 @@
#include "backends/platform/psp/psppixelformat.h"
#include "backends/platform/psp/display_client.h"
#include "backends/platform/psp/display_manager.h"
+#define PSP_INCLUDE_SWAP
#include "backends/platform/psp/memory.h"
//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */
@@ -341,14 +342,14 @@ void Buffer::copyFromRect(const byte *buf, uint32 pitch, int destX, int destY, u
if (pitch == realWidthInBytes && pitch == recWidthInBytes) {
//memcpy(dst, buf, _pixelFormat.pixelsToBytes(recHeight * recWidth));
if (_pixelFormat.swapRB)
- PspMemory::fastSwap(dst, buf, _pixelFormat.pixelsToBytes(recHeight * recWidth), _pixelFormat);
+ PspMemorySwap::fastSwap(dst, buf, _pixelFormat.pixelsToBytes(recHeight * recWidth), _pixelFormat);
else
PspMemory::fastCopy(dst, buf, _pixelFormat.pixelsToBytes(recHeight * recWidth));
} else {
do {
//memcpy(dst, buf, recWidthInBytes);
if (_pixelFormat.swapRB)
- PspMemory::fastSwap(dst, buf, recWidthInBytes, _pixelFormat);
+ PspMemorySwap::fastSwap(dst, buf, recWidthInBytes, _pixelFormat);
else
PspMemory::fastCopy(dst, buf, recWidthInBytes);
buf += pitch;
@@ -370,7 +371,7 @@ void Buffer::copyToArray(byte *dst, int pitch) {
do {
//memcpy(dst, src, sourceWidthInBytes);
if (_pixelFormat.swapRB)
- PspMemory::fastSwap(dst, src, sourceWidthInBytes, _pixelFormat);
+ PspMemorySwap::fastSwap(dst, src, sourceWidthInBytes, _pixelFormat);
else
PspMemory::fastCopy(dst, src, sourceWidthInBytes);
src += realWidthInBytes;
diff --git a/backends/platform/psp/memory.cpp b/backends/platform/psp/memory.cpp
index 0dfc15f293..83ba36767a 100644
--- a/backends/platform/psp/memory.cpp
+++ b/backends/platform/psp/memory.cpp
@@ -26,6 +26,7 @@
#include "common/scummsys.h"
#include "common/singleton.h"
#include "backends/platform/psp/psppixelformat.h"
+#define PSP_INCLUDE_SWAP
#include "backends/platform/psp/memory.h"
// Class Copier --------------------------------------------------------------------------
@@ -99,96 +100,6 @@ void PspMemory::copy(byte *dst, const byte *src, uint32 bytes) {
#endif
}
-void PspMemory::testCopy(const byte *debugDst, const byte *debugSrc, uint32 debugBytes) {
-
- bool mismatch = false;
- PSP_INFO_PRINT("testing fastCopy...");
-
- for (uint32 i = 0; i < debugBytes; i++) {
- if (debugDst[i] != debugSrc[i]) {
- if (!mismatch) {
- PSP_INFO_PRINT("**** mismatch in copy! ****\n");
- PSP_INFO_PRINT("dst[%p], src[%p], bytes[%u]\n", debugDst, debugSrc, debugBytes);
- mismatch = true;
- }
- PSP_INFO_PRINT("[%d]%x!=%x ", i, debugSrc[i], debugDst[i]);
- }
- }
- if (mismatch) {
- PSP_INFO_PRINT("\n");
- } else {
- PSP_INFO_PRINT("ok\n");
- }
-}
-
-//
-// used to swap red and blue
-void PspMemory::swap(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) {
- DEBUG_ENTER_FUNC();
-
-#ifdef TEST_MEMORY_COPY
- uint32 debugBytes = bytes;
- const uint16 *debugDst = dst16, *debugSrc = src16;
-#endif
-
- // align the destination pointer first
- uint32 prefixDst = (((uint32)dst16) & 0x3); // for swap, we can only have 2 or 0 as our prefix
-
- if (prefixDst) {
- bytes -= prefixDst; // remember we assume bytes > 4
- *dst16++ = format.swapRedBlue16(*src16++);
-
- if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) { // check if it's worthwhile to continue
- swap16(dst16, src16, bytes, format);
-
-#ifdef TEST_MEMORY_COPY
- testSwap(debugDst, debugSrc, debugBytes, format);
-#endif
- return;
- }
- }
-
- // check the source pointer alignment now
- uint32 alignSrc = (((uint32)src16) & 0x3);
-
- if (alignSrc) { // we'll need to realign our reads
- PSP_DEBUG_PRINT("misaligned copy of %u bytes from %p to %p\n", bytes, src16, dst16);
- swap32Misaligned((uint32 *)dst16, src16, bytes, format);
- } else {
- swap32Aligned((uint32 *)dst16, (const uint32 *)src16, bytes, format);
- }
-
-#ifdef TEST_MEMORY_COPY
- testSwap(debugDst, debugSrc, debugBytes, format);
-#endif
-
-}
-
-void PspMemory::testSwap(const uint16 *debugDst, const uint16 *debugSrc, uint32 debugBytes, PSPPixelFormat &format) {
-
- bool mismatch = false;
- PSP_INFO_PRINT("testing fastSwap...");
-
- uint32 shorts = debugBytes >> 1;
-
- for (uint32 i = 0; i < shorts; i++) {
- if (debugDst[i] != format.swapRedBlue16(debugSrc[i])) {
- if (!mismatch) {
- PSP_INFO_PRINT("**** mismatch in swap! ****\n");
- PSP_INFO_PRINT("dst[%p], src[%p], bytes[%u]\n", debugDst, debugSrc, debugBytes);
- mismatch = true;
- }
- PSP_INFO_PRINT("[%d]%x!=%x ", i<<1, format.swapRedBlue16(debugSrc[i]), debugDst[i]);
- }
- }
- if (mismatch) {
- PSP_INFO_PRINT("\n");
- } else {
- PSP_INFO_PRINT("ok\n");
- }
-}
-
-
void PspMemory::copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes) {
PSP_DEBUG_PRINT("copy32Aligned(): dst32[%p], src32[%p], bytes[%d]\n", dst32, src32, bytes);
@@ -257,41 +168,6 @@ void PspMemory::copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes)
}
}
-void PspMemory::swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes, PSPPixelFormat &format) {
- DEBUG_ENTER_FUNC();
- int words4 = bytes >> 4;
-
- // try blocks of 4 words at a time
- while (words4--) {
- uint32 a, b, c, d;
- a = format.swapRedBlue32(src32[0]);
- b = format.swapRedBlue32(src32[1]);
- c = format.swapRedBlue32(src32[2]);
- d = format.swapRedBlue32(src32[3]);
- dst32[0] = a;
- dst32[1] = b;
- dst32[2] = c;
- dst32[3] = d;
- dst32 += 4;
- src32 += 4;
- }
-
- uint32 bytesLeft = bytes & 0xF;
- uint32 words = bytesLeft >> 2;
-
- // now just do words
- while (words--) {
- *dst32++ = format.swapRedBlue32(*src32++);
- }
-
- bytesLeft = bytes & 0x3;
-
- if (bytesLeft) { // for swap, can only be 1 short left
- *((uint16 *)dst32) = format.swapRedBlue16(*((uint16 *)src32));
- }
-}
-
-
// More challenging -- need to shift
// Assume dst is aligned
void PspMemory::copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, uint32 alignSrc) {
@@ -368,9 +244,132 @@ void PspMemory::copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, u
}
}
+void PspMemory::testCopy(const byte *debugDst, const byte *debugSrc, uint32 debugBytes) {
+
+ bool mismatch = false;
+ PSP_INFO_PRINT("testing fastCopy...");
+
+ for (uint32 i = 0; i < debugBytes; i++) {
+ if (debugDst[i] != debugSrc[i]) {
+ if (!mismatch) {
+ PSP_INFO_PRINT("**** mismatch in copy! ****\n");
+ PSP_INFO_PRINT("dst[%p], src[%p], bytes[%u]\n", debugDst, debugSrc, debugBytes);
+ mismatch = true;
+ }
+ PSP_INFO_PRINT("[%d]%x!=%x ", i, debugSrc[i], debugDst[i]);
+ }
+ }
+ if (mismatch) {
+ PSP_INFO_PRINT("\n");
+ } else {
+ PSP_INFO_PRINT("ok\n");
+ }
+}
+
+//
+// used to swap red and blue
+void PspMemorySwap::swap(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) {
+ DEBUG_ENTER_FUNC();
+
+#ifdef TEST_MEMORY_COPY
+ uint32 debugBytes = bytes;
+ const uint16 *debugDst = dst16, *debugSrc = src16;
+#endif
+
+ // align the destination pointer first
+ uint32 prefixDst = (((uint32)dst16) & 0x3); // for swap, we can only have 2 or 0 as our prefix
+
+ if (prefixDst) {
+ bytes -= prefixDst; // remember we assume bytes > 4
+ *dst16++ = format.swapRedBlue16(*src16++);
+
+ if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) { // check if it's worthwhile to continue
+ swap16(dst16, src16, bytes, format);
+
+#ifdef TEST_MEMORY_COPY
+ testSwap(debugDst, debugSrc, debugBytes, format);
+#endif
+ return;
+ }
+ }
+
+ // check the source pointer alignment now
+ uint32 alignSrc = (((uint32)src16) & 0x3);
+
+ if (alignSrc) { // we'll need to realign our reads
+ PSP_DEBUG_PRINT("misaligned copy of %u bytes from %p to %p\n", bytes, src16, dst16);
+ swap32Misaligned((uint32 *)dst16, src16, bytes, format);
+ } else {
+ swap32Aligned((uint32 *)dst16, (const uint32 *)src16, bytes, format);
+ }
+
+#ifdef TEST_MEMORY_COPY
+ testSwap(debugDst, debugSrc, debugBytes, format);
+#endif
+
+}
+
+void PspMemorySwap::testSwap(const uint16 *debugDst, const uint16 *debugSrc, uint32 debugBytes, PSPPixelFormat &format) {
+
+ bool mismatch = false;
+ PSP_INFO_PRINT("testing fastSwap...");
+
+ uint32 shorts = debugBytes >> 1;
+
+ for (uint32 i = 0; i < shorts; i++) {
+ if (debugDst[i] != format.swapRedBlue16(debugSrc[i])) {
+ if (!mismatch) {
+ PSP_INFO_PRINT("**** mismatch in swap! ****\n");
+ PSP_INFO_PRINT("dst[%p], src[%p], bytes[%u]\n", debugDst, debugSrc, debugBytes);
+ mismatch = true;
+ }
+ PSP_INFO_PRINT("[%d]%x!=%x ", i<<1, format.swapRedBlue16(debugSrc[i]), debugDst[i]);
+ }
+ }
+ if (mismatch) {
+ PSP_INFO_PRINT("\n");
+ } else {
+ PSP_INFO_PRINT("ok\n");
+ }
+}
+
+void PspMemorySwap::swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes, PSPPixelFormat &format) {
+ DEBUG_ENTER_FUNC();
+ int words4 = bytes >> 4;
+
+ // try blocks of 4 words at a time
+ while (words4--) {
+ uint32 a, b, c, d;
+ a = format.swapRedBlue32(src32[0]);
+ b = format.swapRedBlue32(src32[1]);
+ c = format.swapRedBlue32(src32[2]);
+ d = format.swapRedBlue32(src32[3]);
+ dst32[0] = a;
+ dst32[1] = b;
+ dst32[2] = c;
+ dst32[3] = d;
+ dst32 += 4;
+ src32 += 4;
+ }
+
+ uint32 bytesLeft = bytes & 0xF;
+ uint32 words = bytesLeft >> 2;
+
+ // now just do words
+ while (words--) {
+ *dst32++ = format.swapRedBlue32(*src32++);
+ }
+
+ bytesLeft = bytes & 0x3;
+
+ if (bytesLeft) { // for swap, can only be 1 short left
+ *((uint16 *)dst32) = format.swapRedBlue16(*((uint16 *)src32));
+ }
+}
+
// More challenging -- need to shift
// We assume dst is aligned
-void PspMemory::swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) {
+void PspMemorySwap::swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) {
DEBUG_ENTER_FUNC();
const uint32 shiftValue = 16;
diff --git a/backends/platform/psp/memory.h b/backends/platform/psp/memory.h
index 6d2d927b1b..3cd441a69f 100644
--- a/backends/platform/psp/memory.h
+++ b/backends/platform/psp/memory.h
@@ -40,28 +40,13 @@
class PspMemory {
private:
static void testCopy(const byte *debugDst, const byte *debugSrc, uint32 debugBytes);
- static void testSwap(const uint16 *debugDst, const uint16 *debugSrc, uint32 debugBytes, PSPPixelFormat &format);
static void copy(byte *dst, const byte *src, uint32 bytes);
- static void swap(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format);
static void copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes);
- static void swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes, PSPPixelFormat &format);
static void copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, uint32 alignSrc);
- static void swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32 bytes, PSPPixelFormat &format);
- static void copy16(uint16 *dst, const uint16 *src, uint32 bytes);
-
- // For swapping, we know that we have multiples of 16 bits
- static void swap16(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) {
- PSP_DEBUG_PRINT("swap16 called with dst16[%p], src16[%p], bytes[%d]\n", dst16, src16, bytes);
- uint32 shorts = bytes >> 1;
-
- while (shorts--) {
- *dst16++ = format.swapRedBlue16(*src16++);
- }
- }
- static void copy8(byte *dst, const byte *src, uint32 bytes) {
- PSP_DEBUG_PRINT("copy8 called with dst[%p], src[%p], bytes[%d]\n", dst, src, bytes);
- while (bytes--) {
+ static inline void copy8(byte *dst, const byte *src, int32 bytes) {
+ //PSP_DEBUG_PRINT("copy8 called with dst[%p], src[%p], bytes[%d]\n", dst, src, bytes);
+ for (;bytes; bytes--) {
*dst++ = *src++;
}
}
@@ -75,7 +60,32 @@ public:
copy(dst, src, bytes);
}
}
+};
+
+#endif /* PSP_MEMORY_H */
+
+#if defined(PSP_INCLUDE_SWAP) && !defined(PSP_MEMORY_SWAP_H)
+#define PSP_MEMORY_SWAP_H
+
+//#include "backends/platform/psp/psppixelformat.h"
+
+class PspMemorySwap {
+private:
+ static void testSwap(const uint16 *debugDst, const uint16 *debugSrc, uint32 debugBytes, PSPPixelFormat &format);
+ static void swap(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format);
+ static void swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes, PSPPixelFormat &format);
+ static void swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32 bytes, PSPPixelFormat &format);
+ // For swapping, we know that we have multiples of 16 bits
+ static void swap16(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) {
+ PSP_DEBUG_PRINT("swap16 called with dst16[%p], src16[%p], bytes[%d]\n", dst16, src16, bytes);
+ uint32 shorts = bytes >> 1;
+
+ while (shorts--) {
+ *dst16++ = format.swapRedBlue16(*src16++);
+ }
+}
+public:
static void fastSwap(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat &format) {
if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY * 2) {
swap16((uint16 *)dst, (uint16 *)src, bytes, format);
@@ -85,6 +95,6 @@ public:
}
};
-#endif /* PSP_MEMORY_H */
+#endif /* PSP_INCLUDE_SWAP */
--
cgit v1.2.3
From f7f743ac31d0ec5af6d21aa217dae7387498af42 Mon Sep 17 00:00:00 2001
From: Yotam Barnoy
Date: Mon, 20 Sep 2010 14:10:44 +0000
Subject: PSP: switch from wrapping memcpy to defining our own memcpy
The advantage is that we get to do inlining and even use lwl and lwr instructions where appropriate. We have to do it ourselves because the PSP doesn't tolerate built-in instructions, but also we have a more efficient memcpy than the lib's.
svn-id: r52817
---
backends/platform/psp/memory.cpp | 17 -----------------
backends/platform/psp/memory.h | 35 ++++++++++++++++++++++++++++++++---
2 files changed, 32 insertions(+), 20 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/psp/memory.cpp b/backends/platform/psp/memory.cpp
index 83ba36767a..1e08173286 100644
--- a/backends/platform/psp/memory.cpp
+++ b/backends/platform/psp/memory.cpp
@@ -37,23 +37,6 @@
//#define TEST_MEMORY_COPY
-extern "C" {
-
-#ifdef TEST_MEMORY_COPY /* we won't be able to run in this case b/c of printouts */
-extern void *__real_memcpy(void *dst, void *src, size_t bytes);
-#endif
-
-void *__wrap_memcpy(void *dst, void *src, size_t bytes) {
-#ifdef TEST_MEMORY_COPY /* we won't be able to run in this case */
- return __real_memcpy(dst, src, bytes);
-#else
- PspMemory::fastCopy((byte *)dst, (byte *)src, bytes);
- return dst;
-#endif
-}
-
-}
-
void PspMemory::copy(byte *dst, const byte *src, uint32 bytes) {
DEBUG_ENTER_FUNC();
diff --git a/backends/platform/psp/memory.h b/backends/platform/psp/memory.h
index 3cd441a69f..f54436fb99 100644
--- a/backends/platform/psp/memory.h
+++ b/backends/platform/psp/memory.h
@@ -32,7 +32,19 @@
//#define __PSP_DEBUG_PRINT__
-#include "backends/platform/psp/trace.h"
+//#include "backends/platform/psp/trace.h"
+
+// These instructions don't generate automatically but are faster then copying byte by byte
+inline void lwl_copy(byte *dst, const byte *src) {
+ register uint32 data;
+ asm volatile ("lwr %0,0(%1)\n\t"
+ "lwl %0,3(%1)\n\t"
+ : "=&r" (data) : "r" (src), "m" (*src));
+
+ asm volatile ("swr %1,0(%2)\n\t"
+ "swl %1,3(%2)\n\t"
+ : "=m" (*dst) : "r" (data), "r" (dst));
+}
/**
* Class that does memory copying and swapping if needed
@@ -46,22 +58,39 @@ private:
static inline void copy8(byte *dst, const byte *src, int32 bytes) {
//PSP_DEBUG_PRINT("copy8 called with dst[%p], src[%p], bytes[%d]\n", dst, src, bytes);
- for (;bytes; bytes--) {
+ uint32 words = bytes >> 2;
+ for (; words; words--) {
+ lwl_copy(dst, src);
+ dst += 4;
+ src += 4;
+ }
+
+ uint32 bytesLeft = bytes & 0x3;
+ for (; bytesLeft; bytesLeft--) {
*dst++ = *src++;
}
}
public:
// This is the interface to the outside world
- static void fastCopy(byte *dst, const byte *src, uint32 bytes) {
+ static void *fastCopy(void *dstv, const void *srcv, int32 bytes) {
+ byte *dst = (byte *)dstv;
+ byte *src = (byte *)srcv;
+
if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) {
copy8(dst, src, bytes);
} else { // go to more powerful copy
copy(dst, src, bytes);
}
+
+ return dstv;
}
};
+inline void *psp_memcpy(void *dst, const void *src, int32 bytes) {
+ return PspMemory::fastCopy(dst, src, bytes);
+}
+
#endif /* PSP_MEMORY_H */
#if defined(PSP_INCLUDE_SWAP) && !defined(PSP_MEMORY_SWAP_H)
--
cgit v1.2.3
From c586517b94efa6509a378d38f5f7353d1f53e363 Mon Sep 17 00:00:00 2001
From: Lars Persson
Date: Tue, 21 Sep 2010 06:50:29 +0000
Subject: ADded translations.dat to pkg files
svn-id: r52840
---
backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg | 1 +
backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3.pkg | 2 ++
2 files changed, 3 insertions(+)
(limited to 'backends/platform')
diff --git a/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg b/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg
index a2c43d94e6..b6da9a77f2 100644
--- a/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg
+++ b/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg
@@ -68,6 +68,7 @@
"..\..\..\..\dists\engine-data\m4.dat"-"c:\data\scummvm\m4.dat"
"..\..\..\..\dists\engine-data\teenagent.dat"-"c:\data\scummvm\teenagent.dat"
"..\..\..\vkeybd\packs\vkeybd_default.zip"-"c:\data\scummvm\vkeybd_default.zip"
+"..\..\..\..\gui\themes\translations.dat"-"c:\data\scummvm\translations.dat"
; Config/log files: 'empty' will automagically be removed on uninstall
""-"c:\data\scummvm\scummvm.ini",FILENULL
diff --git a/backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3.pkg b/backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3.pkg
index 7e620485d5..94a8003a92 100644
--- a/backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3.pkg
+++ b/backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3.pkg
@@ -65,6 +65,8 @@
"..\..\..\..\dists\engine-data\m4.dat"-"c:\shared\scummvm\m4.dat"
"..\..\..\..\dists\engine-data\teenagent.dat"-"c:\shared\scummvm\teenagent.dat"
"..\..\..\vkeybd\packs\vkeybd_default.zip"-"c:\shared\scummvm\vkeybd_default.zip"
+"..\..\..\..\gui\themes\translations.dat"-"c:\shared\scummvm\translations.dat"
+
; Config/log files: 'empty' will automagically be removed on uninstall
""-"c:\shared\scummvm\scummvm.ini",FILENULL
""-"c:\shared\scummvm\scummvm.stdout.txt",FILENULL
--
cgit v1.2.3
From 3518a3d18fe7c946df055f2e6b8569a482b6176d Mon Sep 17 00:00:00 2001
From: Lars Persson
Date: Wed, 22 Sep 2010 09:56:03 +0000
Subject: Added include paths for Symbian^3 SDK support
svn-id: r52853
---
backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in | 3 +++
backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in | 3 +++
2 files changed, 6 insertions(+)
(limited to 'backends/platform')
diff --git a/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in b/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in
index 2916d73938..2ba609fef2 100644
--- a/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in
+++ b/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in
@@ -97,6 +97,9 @@ SYSTEMINCLUDE \epoc32\include\ESDL
SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version
SYSTEMINCLUDE \epoc32\include\libc
SYSTEMINCLUDE \epoc32\include
+SYSTEMINCLUDE \epoc32\include\mw
+SYSTEMINCLUDE \epoc32\include\platform
+SYSTEMINCLUDE \epoc32\include\platform\mw
SYSTEMINCLUDE ..\src // for portdefs.h
// *** SOURCE files
diff --git a/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in b/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in
index e95bb9ee21..713d73bdb9 100644
--- a/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in
+++ b/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in
@@ -97,6 +97,9 @@ SYSTEMINCLUDE \epoc32\include\ESDL
SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version
SYSTEMINCLUDE \epoc32\include\libc
SYSTEMINCLUDE \epoc32\include
+SYSTEMINCLUDE \epoc32\include\mw
+SYSTEMINCLUDE \epoc32\include\platform
+SYSTEMINCLUDE \epoc32\include\platform\mw
SYSTEMINCLUDE ..\src // for portdefs.h
// *** SOURCE files
--
cgit v1.2.3
From f155d902c71aa79bccb81bc7dbfddfbe57107ff5 Mon Sep 17 00:00:00 2001
From: Lars Persson
Date: Wed, 22 Sep 2010 10:27:09 +0000
Subject: Additional include paths for Symbian^3
svn-id: r52854
---
backends/platform/symbian/mmp/scummvm_base.mmp.in | 3 +++
1 file changed, 3 insertions(+)
(limited to 'backends/platform')
diff --git a/backends/platform/symbian/mmp/scummvm_base.mmp.in b/backends/platform/symbian/mmp/scummvm_base.mmp.in
index ceb62ec843..8f51e3c7b5 100644
--- a/backends/platform/symbian/mmp/scummvm_base.mmp.in
+++ b/backends/platform/symbian/mmp/scummvm_base.mmp.in
@@ -59,6 +59,9 @@ SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian alr
SYSTEMINCLUDE \epoc32\include\libc
SYSTEMINCLUDE \epoc32\include\tremor
SYSTEMINCLUDE \epoc32\include
+SYSTEMINCLUDE \epoc32\include\mw
+SYSTEMINCLUDE \epoc32\include\platform
+SYSTEMINCLUDE \epoc32\include\platform\mw
SYSTEMINCLUDE ..\src // for portdefs.h
// *** SOURCE files
--
cgit v1.2.3
From 86a7d4382e65632c2b304d503a48ffaa4ab15415 Mon Sep 17 00:00:00 2001
From: Lars Persson
Date: Thu, 23 Sep 2010 10:34:00 +0000
Subject: SYMBIAN : Updated define for S60v3 detection
svn-id: r52862
---
backends/platform/symbian/src/ScummApp.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'backends/platform')
diff --git a/backends/platform/symbian/src/ScummApp.cpp b/backends/platform/symbian/src/ScummApp.cpp
index a3ce692368..01af5e7fd9 100644
--- a/backends/platform/symbian/src/ScummApp.cpp
+++ b/backends/platform/symbian/src/ScummApp.cpp
@@ -27,7 +27,7 @@
#define _PAGESIZE_ 0x1000
-#if defined (__WINS__) && !defined (__SERIES60_30__) && !defined (UIQ3)
+#if defined (__WINS__) && !defined (S60V3) && !defined (UIQ3)
extern "C" int _chkstk(int /*a*/) {
_asm {
push ecx
--
cgit v1.2.3
From 9e4dff91641e32c83f4eb0da4858ea467e634a5b Mon Sep 17 00:00:00 2001
From: Lars Persson
Date: Thu, 23 Sep 2010 10:34:45 +0000
Subject: SYMBIAN : Remove application resource include not used.
svn-id: r52863
---
backends/platform/symbian/res/scummvm.rss | 1 -
1 file changed, 1 deletion(-)
(limited to 'backends/platform')
diff --git a/backends/platform/symbian/res/scummvm.rss b/backends/platform/symbian/res/scummvm.rss
index 0bb5dff058..f7daf9bfc1 100644
--- a/backends/platform/symbian/res/scummvm.rss
+++ b/backends/platform/symbian/res/scummvm.rss
@@ -35,7 +35,6 @@ NAME SCUM
#include
#include "..\src\Scummvm.hrh"
// Include the standard Eikon resource ids
-#include
RESOURCE RSS_SIGNATURE
--
cgit v1.2.3
From 3a3b2cf8623b0da297a0dca906ca032379b202ff Mon Sep 17 00:00:00 2001
From: Lars Persson
Date: Thu, 23 Sep 2010 10:37:10 +0000
Subject: SYMBIAN : Add addSysArchivesToSearchSet to support local data files
properly. (Instead of using extrapath)
svn-id: r52864
---
backends/platform/symbian/src/SymbianOS.cpp | 10 +++++++---
backends/platform/symbian/src/SymbianOS.h | 2 ++
2 files changed, 9 insertions(+), 3 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp
index d63c9fe044..50ab7e00b1 100644
--- a/backends/platform/symbian/src/SymbianOS.cpp
+++ b/backends/platform/symbian/src/SymbianOS.cpp
@@ -140,9 +140,6 @@ OSystem_SDL_Symbian::OSystem_SDL_Symbian() :_channels(0),_stereo_mix_buffer(0) {
}
void OSystem_SDL_Symbian::initBackend() {
- // First set the extrapath (for installed dat files etc)
- ConfMan.set("extrapath", Symbian::GetExecutablePath());
-
// Calculate the default savepath
Common::String savePath;
savePath = Symbian::GetExecutablePath();
@@ -183,6 +180,13 @@ void OSystem_SDL_Symbian::initBackend() {
initZones();
}
+void OSystem_SDL_Symbian::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
+ Common::FSNode pluginsNode(Symbian::GetExecutablePath());
+ if (pluginsNode.exists() && pluginsNode.isDirectory()) {
+ s.add("SYMBIAN_DATAFOLDER", new Common::FSDirectory(Symbian::GetExecutablePath()), priority);
+ }
+}
+
OSystem_SDL_Symbian::~OSystem_SDL_Symbian() {
delete[] _stereo_mix_buffer;
}
diff --git a/backends/platform/symbian/src/SymbianOS.h b/backends/platform/symbian/src/SymbianOS.h
index 42929f8029..72ff70c25e 100644
--- a/backends/platform/symbian/src/SymbianOS.h
+++ b/backends/platform/symbian/src/SymbianOS.h
@@ -61,6 +61,8 @@ public:
// Returns reference to File session
RFs& FsSession();
+
+ void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
protected:
//
// The mixer callback function.
--
cgit v1.2.3
From 4807fdb4c70bd21c412914089b493cc190c50fb5 Mon Sep 17 00:00:00 2001
From: Yotam Barnoy
Date: Thu, 23 Sep 2010 21:03:20 +0000
Subject: PSP: fix issue in ME MP3 code. Release and init the ME when seeking.
Without this fix, the ME allocates more and more memory with every seek until it can't work.
svn-id: r52868
---
backends/platform/psp/mp3.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
(limited to 'backends/platform')
diff --git a/backends/platform/psp/mp3.cpp b/backends/platform/psp/mp3.cpp
index 98e8a0404b..da189c532c 100644
--- a/backends/platform/psp/mp3.cpp
+++ b/backends/platform/psp/mp3.cpp
@@ -415,10 +415,13 @@ bool Mp3PspStream::seek(const Timestamp &where) {
mad_timer_t destination;
mad_timer_set(&destination, time / 1000, time % 1000, 1000);
+ // Important to release and re-init the ME
+ releaseStreamME();
+ initStreamME();
+
// Check if we need to rewind
if (_state != MP3_STATE_READY || mad_timer_compare(destination, _totalTime) < 0) {
initStream();
- initStreamME();
}
// Skip ahead
--
cgit v1.2.3
From 744b301b22cf7145245c1ffc5ea8bab2ae3aa305 Mon Sep 17 00:00:00 2001
From: Lars Persson
Date: Sat, 25 Sep 2010 14:59:24 +0000
Subject: SYMBIAN : Updated version nr to 1.13 in package file
svn-id: r52882
---
backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg | 2 +-
backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3.pkg | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg b/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg
index b6da9a77f2..3f0fbbc5f1 100644
--- a/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg
+++ b/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg
@@ -36,7 +36,7 @@
:"ScummVM"
; UID is the app's UID
-#{"ScummVM S60v3"},(0xA0000657),1,12,0
+#{"ScummVM S60v3"},(0xA0000657),1,13,0
;Supports Series 60 v 3.0
[0x101F7961], 0, 0, 0, {"Series60ProductID"}
diff --git a/backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3.pkg b/backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3.pkg
index 94a8003a92..a55f4b6e37 100644
--- a/backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3.pkg
+++ b/backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3.pkg
@@ -35,7 +35,7 @@
:"ScummVM"
; UID is the app's UID
-#{"ScummVM UIQ3"},(0xA0000657),1,12,0
+#{"ScummVM UIQ3"},(0xA0000657),1,13,0
; ProductID for UIQ 3.0
; Product/platform version UID, Major, Minor, Build, Product ID
--
cgit v1.2.3
From 73c5895ed26d49ae04600be8bf1247335e89fb4d Mon Sep 17 00:00:00 2001
From: Yotam Barnoy
Date: Sat, 25 Sep 2010 20:38:40 +0000
Subject: PSP: ME MP3: cache stereo status
Bad timing can cause stereo status not to be picked up if at some point a MAD _header is not initialized.
svn-id: r52890
---
backends/platform/psp/mp3.cpp | 1 +
backends/platform/psp/mp3.h | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
(limited to 'backends/platform')
diff --git a/backends/platform/psp/mp3.cpp b/backends/platform/psp/mp3.cpp
index da189c532c..574cf0d719 100644
--- a/backends/platform/psp/mp3.cpp
+++ b/backends/platform/psp/mp3.cpp
@@ -190,6 +190,7 @@ Mp3PspStream::Mp3PspStream(Common::SeekableReadStream *inStream, DisposeAfterUse
findValidHeader(); // get a first header so we can read basic stuff
_sampleRate = _header.samplerate; // copy it before it gets destroyed
+ _stereo = (MAD_NCHANNELS(&_header) == 2);
while (_state != MP3_STATE_EOS)
findValidHeader(); // get a first header so we can read basic stuff
diff --git a/backends/platform/psp/mp3.h b/backends/platform/psp/mp3.h
index 983f4cb7f4..71a248ad78 100644
--- a/backends/platform/psp/mp3.h
+++ b/backends/platform/psp/mp3.h
@@ -61,6 +61,7 @@ protected:
Timestamp _length;
uint32 _sampleRate;
+ bool _stereo;
mad_timer_t _totalTime;
mad_stream _stream; //
@@ -110,7 +111,7 @@ public:
int readBuffer(int16 *buffer, const int numSamples);
bool endOfData() const { return _state == MP3_STATE_EOS; }
- bool isStereo() const { return MAD_NCHANNELS(&_header) == 2; }
+ bool isStereo() const { return _stereo; }
int getRate() const { return _sampleRate; }
bool seek(const Timestamp &where);
--
cgit v1.2.3
From 76992402d7d11ced3c0a676774bb768cc4454d10 Mon Sep 17 00:00:00 2001
From: Fabio Battaglia
Date: Sat, 25 Sep 2010 21:54:41 +0000
Subject: DINGUX: remove wrong comment and fill the readme with some infos
svn-id: r52894
---
backends/platform/dingux/README.DINGUX | 60 +++++++++++++++++++++++++++++-
backends/platform/dingux/dingux-events.cpp | 2 +-
2 files changed, 60 insertions(+), 2 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/dingux/README.DINGUX b/backends/platform/dingux/README.DINGUX
index bda3e51c73..12289388de 100644
--- a/backends/platform/dingux/README.DINGUX
+++ b/backends/platform/dingux/README.DINGUX
@@ -7,4 +7,62 @@ Requirements
- Dingux installed on SD card
- Fixed Tremor libs in dingux rootfs (see below)
-* To Be Filled *
+Controls
+============
+- Dpad: move mouse cursor
+- Y: left mouse button click
+- A: '0' key
+- B: right mouse button click
+- X: '.' key (skips dialogue line in some engines)
+- Left Trigger: open global menu
+- Right Trigger: ESC button, scene skip in some engines
+- Select: opens virtual keyboard
+- Start: F5 key, game menu in some engines
+
+Installation from binaries
+==============================
+Mount your dingux SD card in your pc, then copy the directory "scummvm" found in
+the release package to a directory inside /pathtosdcard/local/dirofyourchoice
+(on windows it would be SDLETTER:\local\dirofyourchoice).
+At this point is sufficient to point your launcher (eg. gmenu2x) to scummvm.gpe
+file included into the scummvm directory you copied to the SD card, and then launch it.
+
+Building from binaries
+==============================
+* ToDO *
+
+Kernel and rootfs WARNINGS
+==============================
+All the dingux root images (rootfs) i found floating on the net have
+broken tremor libraries, which make scummvm crash in a bad way.
+One solution is to replace the libraries in your rootfs by injecting these fixed ones:
+http://hkzlab.ipv7.net/files/misc/dingux/dingux_fixed_tremor_libs.zip
+After having added these libs, scummvm should work on your standard dingux kernel,
+but this doesn't mean it will work perfectly:
+non-opendingux kernels doesn't have lcd double buffering leading to a lot of annoying
+tearing on screen.
+
+The best way to address all the problems in one shot, is to use an opendingux kernel for
+your dingoo, which has some interesting advantages:
+- The kernel gets updated and kept in sync with main linux tree
+- Double buffering and centering of screen image
+- Support for swap on compressed ram
+I have prepared a rootfs image with fixed libs and swap-on-zram to use together with opendingux kernels:
+http://hkzlab.ipv7.net/files/misc/dingux/opendingux/opendingux_kernel_rootfs.zip
+The kernel and rootfs images in the zip file is what i use for developing scummvm on dingux.
+
+BTW, i have built images for the A330 and A320 with ILI9325 controllers too,
+but these version aren't tested (i have an A320 with ILI9331, but if someone wants to
+donate an A330 to a poor scummvm developer so i can try the port there too... :P)
+
+If you need a launcher with opendingux cpu frequency scaler support, you can find gmenu2x here:
+http://www.treewalker.org/dingux/cpufreq.html
+
+I've also prepared a rootfs image for use on normal dingux kernels (non-opendingux ones).
+It's based on elta's rootfs image with just the fixed libs replaced.
+http://hkzlab.ipv7.net/files/misc/dingux/normal_dingux/rootfs_elta_fixtremor.zip
+I still raccomand the use of opendingux kernel + rootfs, but if you don't, this roofs
+image plus another kernel (eg. SiENcE's one) should be do the job.
+
+Enjoy
+
diff --git a/backends/platform/dingux/dingux-events.cpp b/backends/platform/dingux/dingux-events.cpp
index b6070f68ca..f9b519623d 100644
--- a/backends/platform/dingux/dingux-events.cpp
+++ b/backends/platform/dingux/dingux-events.cpp
@@ -149,7 +149,7 @@ bool OSystem_SDL_Dingux::remapKey(SDL_Event &ev, Common::Event &event) {
}
return true;
- } else if (ev.key.keysym.sym == BUT_A) { // virtual keyboard
+ } else if (ev.key.keysym.sym == BUT_A) { // key '0'
ev.key.keysym.sym = SDLK_0;
event.kbd.keycode = Common::KEYCODE_0;
--
cgit v1.2.3
From 1d3ce126eac4a7fa479df79009fd0b15ca081109 Mon Sep 17 00:00:00 2001
From: Max Horn
Date: Tue, 28 Sep 2010 20:29:25 +0000
Subject: SDL: Fix for 32 bit mode support (untested; might be good for
backporting, not sure, somebody should verify)
svn-id: r52934
---
backends/platform/sdl/graphics.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp
index 0b96ef24ec..6ee10119cc 100644
--- a/backends/platform/sdl/graphics.cpp
+++ b/backends/platform/sdl/graphics.cpp
@@ -237,7 +237,7 @@ void OSystem_SDL::detectSupportedFormats() {
// available format, it will get one that is "cheap" to
// use.
const Graphics::PixelFormat RGBList[] = {
-#ifdef ENABLE_32BIT
+#ifdef USE_RGB_COLOR
// RGBA8888, ARGB8888, RGB888
Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0),
Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24),
@@ -251,7 +251,7 @@ void OSystem_SDL::detectSupportedFormats() {
Graphics::PixelFormat(2, 4, 4, 4, 4, 8, 4, 0, 12)
};
const Graphics::PixelFormat BGRList[] = {
-#ifdef ENABLE_32BIT
+#ifdef USE_RGB_COLOR
// ABGR8888, BGRA8888, BGR888
Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24),
Graphics::PixelFormat(4, 8, 8, 8, 8, 8, 16, 24, 0),
--
cgit v1.2.3
From 484bf9c269889f205d7db58e88518e55ea615675 Mon Sep 17 00:00:00 2001
From: Max Horn
Date: Tue, 28 Sep 2010 20:30:50 +0000
Subject: ALL: Fixup some #define names
svn-id: r52935
---
backends/platform/symbian/src/ScummApp.h | 4 ++--
backends/platform/symbian/src/ScummVMApp.h | 4 ++--
backends/platform/symbian/src/SymbianOS.h | 4 ++--
backends/platform/wince/CEActionsPocket.h | 4 ++--
backends/platform/wince/CEActionsSmartphone.h | 4 ++--
backends/platform/wince/CEDevice.h | 4 ++--
backends/platform/wince/CELauncherDialog.h | 4 ++--
backends/platform/wince/CEScaler.h | 4 ++--
backends/platform/wince/CEgui/GUIElement.h | 4 ++--
backends/platform/wince/CEgui/ItemAction.h | 4 ++--
backends/platform/wince/CEgui/ItemSwitch.h | 4 ++--
backends/platform/wince/CEgui/Panel.h | 4 ++--
backends/platform/wince/CEgui/PanelItem.h | 4 ++--
backends/platform/wince/CEgui/PanelKeyboard.h | 4 ++--
backends/platform/wince/CEgui/SDL_ImageResource.h | 4 ++--
backends/platform/wince/CEgui/Toolbar.h | 4 ++--
backends/platform/wince/CEgui/ToolbarHandler.h | 4 ++--
backends/platform/wince/CEkeys/EventsBuffer.h | 4 ++--
18 files changed, 36 insertions(+), 36 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/symbian/src/ScummApp.h b/backends/platform/symbian/src/ScummApp.h
index 8cfdbdb92f..cca8e2a7c9 100644
--- a/backends/platform/symbian/src/ScummApp.h
+++ b/backends/platform/symbian/src/ScummApp.h
@@ -22,8 +22,8 @@
* $Id$
*/
-#ifndef ScummAPPH
-#define ScummAPPH
+#ifndef SCUMMAPP_H
+#define SCUMMAPP_H
#include
#include
diff --git a/backends/platform/symbian/src/ScummVMApp.h b/backends/platform/symbian/src/ScummVMApp.h
index 6796024e1e..aee098f989 100644
--- a/backends/platform/symbian/src/ScummVMApp.h
+++ b/backends/platform/symbian/src/ScummVMApp.h
@@ -23,8 +23,8 @@
*
*/
-#ifndef ScummVMapph
-#define ScummVMapph
+#ifndef SCUMMVMAPP_H
+#define SCUMMVMAPP_H
#include
#include
diff --git a/backends/platform/symbian/src/SymbianOS.h b/backends/platform/symbian/src/SymbianOS.h
index 72ff70c25e..85b5e131da 100644
--- a/backends/platform/symbian/src/SymbianOS.h
+++ b/backends/platform/symbian/src/SymbianOS.h
@@ -22,8 +22,8 @@
* $Id$
*/
-#ifndef SDLSYMBIANH
-#define SDLSYMBIANH
+#ifndef SDLSYMBIAN_H
+#define SDLSYMBIAN_H
#include "backends/platform/sdl/sdl.h"
diff --git a/backends/platform/wince/CEActionsPocket.h b/backends/platform/wince/CEActionsPocket.h
index ae0ed19975..0fe29a9e86 100644
--- a/backends/platform/wince/CEActionsPocket.h
+++ b/backends/platform/wince/CEActionsPocket.h
@@ -23,8 +23,8 @@
*
*/
-#ifndef CEACTIONSPOCKET
-#define CEACTIONSPOCKET
+#ifndef CEACTIONSPOCKET_H
+#define CEACTIONSPOCKET_H
#include "common/scummsys.h"
#include "common/system.h"
diff --git a/backends/platform/wince/CEActionsSmartphone.h b/backends/platform/wince/CEActionsSmartphone.h
index eacc571a67..36797cd2c8 100644
--- a/backends/platform/wince/CEActionsSmartphone.h
+++ b/backends/platform/wince/CEActionsSmartphone.h
@@ -23,8 +23,8 @@
*
*/
-#ifndef CEACTIONSSMARTPHONE
-#define CEACTIONSSMARTPHONE
+#ifndef CEACTIONSSMARTPHONE_H
+#define CEACTIONSSMARTPHONE_H
#include "common/scummsys.h"
#include "common/system.h"
diff --git a/backends/platform/wince/CEDevice.h b/backends/platform/wince/CEDevice.h
index 9fee8497c2..ca2f908c6d 100644
--- a/backends/platform/wince/CEDevice.h
+++ b/backends/platform/wince/CEDevice.h
@@ -23,8 +23,8 @@
*
*/
-#ifndef CEDEVICE
-#define CEDEVICE
+#ifndef CEDEVICE_H
+#define CEDEVICE_H
#include "common/scummsys.h"
#include "common/system.h"
diff --git a/backends/platform/wince/CELauncherDialog.h b/backends/platform/wince/CELauncherDialog.h
index 7e86f808fc..7755e33dcc 100644
--- a/backends/platform/wince/CELauncherDialog.h
+++ b/backends/platform/wince/CELauncherDialog.h
@@ -23,8 +23,8 @@
*
*/
-#ifndef CELAUNCHERDIALOG
-#define CELAUNCHERDIALOG
+#ifndef CELAUNCHERDIALOG_H
+#define CELAUNCHERDIALOG_H
#include "base/plugins.h"
#include "common/fs.h"
diff --git a/backends/platform/wince/CEScaler.h b/backends/platform/wince/CEScaler.h
index c93e1c66ca..4711f94bba 100644
--- a/backends/platform/wince/CEScaler.h
+++ b/backends/platform/wince/CEScaler.h
@@ -23,8 +23,8 @@
*
*/
-#ifndef CESCALER
-#define CESCALER
+#ifndef CESCALER_H
+#define CESCALER_H
#include "common/scummsys.h"
#include "common/system.h"
diff --git a/backends/platform/wince/CEgui/GUIElement.h b/backends/platform/wince/CEgui/GUIElement.h
index beb9d95047..7e4572d377 100644
--- a/backends/platform/wince/CEgui/GUIElement.h
+++ b/backends/platform/wince/CEgui/GUIElement.h
@@ -23,8 +23,8 @@
*
*/
-#ifndef CEGUI_GUIELEMENT
-#define CEGUI_GUIELEMENT
+#ifndef CEGUI_GUIELEMENT_H
+#define CEGUI_GUIELEMENT_H
#include "common/scummsys.h"
#include "common/system.h"
diff --git a/backends/platform/wince/CEgui/ItemAction.h b/backends/platform/wince/CEgui/ItemAction.h
index e2cd5b2367..74ed6bec4d 100644
--- a/backends/platform/wince/CEgui/ItemAction.h
+++ b/backends/platform/wince/CEgui/ItemAction.h
@@ -23,8 +23,8 @@
*
*/
-#ifndef CEGUI_ITEMACTION
-#define CEGUI_ITEMACTION
+#ifndef CEGUI_ITEMACTION_H
+#define CEGUI_ITEMACTION_H
#include "common/scummsys.h"
#include "common/system.h"
diff --git a/backends/platform/wince/CEgui/ItemSwitch.h b/backends/platform/wince/CEgui/ItemSwitch.h
index 1fa5732b6a..8d03ee77cb 100644
--- a/backends/platform/wince/CEgui/ItemSwitch.h
+++ b/backends/platform/wince/CEgui/ItemSwitch.h
@@ -23,8 +23,8 @@
*
*/
-#ifndef CEGUI_ITEMSWITCH
-#define CEGUI_ITEMSWITCH
+#ifndef CEGUI_ITEMSWITCH_H
+#define CEGUI_ITEMSWITCH_H
#include "common/scummsys.h"
#include "common/system.h"
diff --git a/backends/platform/wince/CEgui/Panel.h b/backends/platform/wince/CEgui/Panel.h
index 0b55c00dee..6626e41866 100644
--- a/backends/platform/wince/CEgui/Panel.h
+++ b/backends/platform/wince/CEgui/Panel.h
@@ -23,8 +23,8 @@
*
*/
-#ifndef CEGUI_PANEL
-#define CEGUI_PANEL
+#ifndef CEGUI_PANEL_H
+#define CEGUI_PANEL_H
#include "common/scummsys.h"
#include "common/system.h"
diff --git a/backends/platform/wince/CEgui/PanelItem.h b/backends/platform/wince/CEgui/PanelItem.h
index 82e9b03e22..55920c304a 100644
--- a/backends/platform/wince/CEgui/PanelItem.h
+++ b/backends/platform/wince/CEgui/PanelItem.h
@@ -23,8 +23,8 @@
*
*/
-#ifndef CEGUI_PANELITEM
-#define CEGUI_PANELITEM
+#ifndef CEGUI_PANELITEM_H
+#define CEGUI_PANELITEM_H
#include "common/scummsys.h"
#include "common/system.h"
diff --git a/backends/platform/wince/CEgui/PanelKeyboard.h b/backends/platform/wince/CEgui/PanelKeyboard.h
index 5ef4adc73e..f441e14771 100644
--- a/backends/platform/wince/CEgui/PanelKeyboard.h
+++ b/backends/platform/wince/CEgui/PanelKeyboard.h
@@ -23,8 +23,8 @@
*
*/
-#ifndef CEGUI_PANELKEYBOARD
-#define CEGUI_PANELKEYBOARD
+#ifndef CEGUI_PANELKEYBOARD_H
+#define CEGUI_PANELKEYBOARD_H
#include "common/scummsys.h"
#include "common/system.h"
diff --git a/backends/platform/wince/CEgui/SDL_ImageResource.h b/backends/platform/wince/CEgui/SDL_ImageResource.h
index 140a11c356..454237dd15 100644
--- a/backends/platform/wince/CEgui/SDL_ImageResource.h
+++ b/backends/platform/wince/CEgui/SDL_ImageResource.h
@@ -23,8 +23,8 @@
*
*/
-#ifndef CEGUI_SDL_IMAGERESOURCE
-#define CEGUI_SDL_IMAGERESOURCE
+#ifndef CEGUI_SDL_IMAGERESOURCE_H
+#define CEGUI_SDL_IMAGERESOURCE_H
#include "common/scummsys.h"
#include "common/system.h"
diff --git a/backends/platform/wince/CEgui/Toolbar.h b/backends/platform/wince/CEgui/Toolbar.h
index c23559d315..3c48e6188a 100644
--- a/backends/platform/wince/CEgui/Toolbar.h
+++ b/backends/platform/wince/CEgui/Toolbar.h
@@ -23,8 +23,8 @@
*
*/
-#ifndef CEGUI_TOOLBAR
-#define CEGUI_TOOLBAR
+#ifndef CEGUI_TOOLBAR_H
+#define CEGUI_TOOLBAR_H
#include "common/scummsys.h"
#include "common/system.h"
diff --git a/backends/platform/wince/CEgui/ToolbarHandler.h b/backends/platform/wince/CEgui/ToolbarHandler.h
index 30a299d153..4a79ed1609 100644
--- a/backends/platform/wince/CEgui/ToolbarHandler.h
+++ b/backends/platform/wince/CEgui/ToolbarHandler.h
@@ -23,8 +23,8 @@
*
*/
-#ifndef CEGUI_TOOLBARHANDLER
-#define CEGUI_TOOLBARHANDLER
+#ifndef CEGUI_TOOLBARHANDLER_H
+#define CEGUI_TOOLBARHANDLER_H
#include "common/scummsys.h"
#include "common/system.h"
diff --git a/backends/platform/wince/CEkeys/EventsBuffer.h b/backends/platform/wince/CEkeys/EventsBuffer.h
index 2e13770d25..44e1c66e47 100644
--- a/backends/platform/wince/CEkeys/EventsBuffer.h
+++ b/backends/platform/wince/CEkeys/EventsBuffer.h
@@ -23,8 +23,8 @@
*
*/
-#ifndef CEKEYS_EVENTSBUFFER
-#define CEKEYS_EVENTSBUFFER
+#ifndef CEKEYS_EVENTSBUFFER_H
+#define CEKEYS_EVENTSBUFFER_H
#include "common/scummsys.h"
#include "common/system.h"
--
cgit v1.2.3
From ab01f42a4bf33192c43bdae49ddfa9040d013c68 Mon Sep 17 00:00:00 2001
From: Oystein Eftevaag
Date: Wed, 29 Sep 2010 00:19:13 +0000
Subject: IPHONE: The overlay will now always be in the native device
resolution
svn-id: r52939
---
backends/platform/iphone/iphone_common.h | 9 +-
backends/platform/iphone/iphone_main.m | 15 +-
backends/platform/iphone/iphone_video.h | 7 +
backends/platform/iphone/iphone_video.m | 292 +++++++++++++++++++++++++------
backends/platform/iphone/osys_events.cpp | 38 ++--
backends/platform/iphone/osys_main.cpp | 6 +-
backends/platform/iphone/osys_main.h | 5 +-
backends/platform/iphone/osys_video.cpp | 99 +++++++----
8 files changed, 370 insertions(+), 101 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/iphone/iphone_common.h b/backends/platform/iphone/iphone_common.h
index 1f5ed01982..7c7770f443 100644
--- a/backends/platform/iphone/iphone_common.h
+++ b/backends/platform/iphone/iphone_common.h
@@ -67,12 +67,19 @@ void iphone_main(int argc, char *argv[]);
#endif
// On the ObjC side
-void iPhone_updateScreen();
+void iPhone_updateScreen(int mouseX, int mouseY);
void iPhone_updateScreenRect(unsigned short* screen, int x1, int y1, int x2, int y2);
+void iPhone_updateOverlayRect(unsigned short* screen, int x1, int y1, int x2, int y2);
void iPhone_initSurface(int width, int height);
bool iPhone_fetchEvent(int *outEvent, float *outX, float *outY);
const char* iPhone_getDocumentsDir();
bool iPhone_isHighResDevice();
+int iPhone_getScreenHeight();
+int iPhone_getScreenWidth();
+void iPhone_enableOverlay(int state);
+void iPhone_setMouseCursor(short* buffer, int width, int height);
+
+uint getSizeNextPOT(uint size);
#ifdef __cplusplus
}
diff --git a/backends/platform/iphone/iphone_main.m b/backends/platform/iphone/iphone_main.m
index d8992de5bb..5a5ec95090 100644
--- a/backends/platform/iphone/iphone_main.m
+++ b/backends/platform/iphone/iphone_main.m
@@ -103,15 +103,26 @@ int main(int argc, char** argv) {
[NSThread detachNewThreadSelector:@selector(mainLoop:) toTarget:self withObject:nil];
}
+- (void)applicationDidResume
+{
+}
+
+- (void)applicationWillSuspend
+{
+}
+
+- (void)applicationWillTerminate
+{
+}
+
- (void)applicationSuspend:(struct __GSEvent *)event {
//[self setApplicationBadge:NSLocalizedString(@"ON", nil)];
[_view applicationSuspend];
}
- (void)applicationResume:(struct __GSEvent *)event {
- [self removeApplicationBadge];
[_view applicationResume];
-
+
// Workaround, need to "hide" and unhide the statusbar to properly remove it,
// since the Springboard has put it back without apparently flagging our application.
[self setStatusBarHidden:YES animated:YES];
diff --git a/backends/platform/iphone/iphone_video.h b/backends/platform/iphone/iphone_video.h
index 1060a2a223..aed15ecfd5 100644
--- a/backends/platform/iphone/iphone_video.h
+++ b/backends/platform/iphone/iphone_video.h
@@ -54,6 +54,8 @@
GLint _visibleWidth;
GLint _visibleHeight;
GLuint _screenTexture;
+ GLuint _overlayTexture;
+ GLuint _mouseCursorTexture;
}
- (id)initWithFrame:(struct CGRect)frame;
@@ -65,6 +67,11 @@
- (void)initSurface;
- (void)updateSurface;
+- (void)updateMainSurface;
+- (void)updateOverlaySurface;
+- (void)updateMouseSurface;
+
+-(void)updateMouseCursor;
- (id)getEvent;
diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m
index cd8b38acb3..9704b302fb 100644
--- a/backends/platform/iphone/iphone_video.m
+++ b/backends/platform/iphone/iphone_video.m
@@ -32,23 +32,88 @@ static int _height = 0;
static int _fullWidth;
static int _fullHeight;
static CGRect _screenRect;
+
static char* _textureBuffer = 0;
static int _textureWidth = 0;
static int _textureHeight = 0;
+
+static char* _overlayTexBuffer = 0;
+static int _overlayTexWidth = 0;
+static int _overlayTexHeight = 0;
+static int _overlayWidth = 0;
+static int _overlayHeight = 0;
+static float _overlayPortraitRatio = 1.0f;
+
NSLock* _lock = nil;
static int _needsScreenUpdate = 0;
+static int _overlayIsEnabled = 0;
static UITouch* _firstTouch = NULL;
static UITouch* _secondTouch = NULL;
+static short* _mouseCursor = NULL;
+static int _mouseCursorHeight = 0;
+static int _mouseCursorWidth = 0;
+static int _mouseX = 0;
+static int _mouseY = 0;
+
// static long lastTick = 0;
// static int frames = 0;
+#define printOpenGLError() printOglError(__FILE__, __LINE__)
+
+int printOglError(const char *file, int line)
+{
+ int retCode = 0;
+
+ // returns 1 if an OpenGL error occurred, 0 otherwise.
+ GLenum glErr = glGetError();
+ while( glErr != GL_NO_ERROR)
+ {
+ fprintf(stderr, "glError: %u (%s: %d)\n", glErr, file, line );
+ retCode = 1;
+ glErr = glGetError();
+ }
+ return retCode;
+}
+
+void iPhone_setMouseCursor(short* buffer, int width, int height) {
+ _mouseCursor = buffer;
+
+ _mouseCursorWidth = width;
+ _mouseCursorHeight = height;
+
+ [sharedInstance performSelectorOnMainThread:@selector(updateMouseCursor) withObject:nil waitUntilDone: YES];
+}
+
+void iPhone_enableOverlay(int state) {
+ _overlayIsEnabled = state;
+}
+
+int iPhone_getScreenHeight() {
+ return _overlayHeight;
+}
+
+int iPhone_getScreenWidth() {
+ return _overlayWidth;
+}
+
bool iPhone_isHighResDevice() {
return _fullHeight > 480;
}
-void iPhone_updateScreen() {
+void iPhone_updateScreen(int mouseX, int mouseY) {
+ //printf("Mouse: (%i, %i)\n", mouseX, mouseY);
+
+ //_mouseX = _overlayHeight - (float)mouseX / _width * _overlayHeight;
+ //_mouseY = (float)mouseY / _height * _overlayWidth;
+
+ //_mouseX = _overlayHeight - mouseX;
+ //_mouseY = mouseY;
+
+ _mouseX = (_overlayWidth - mouseX) / (float)_overlayWidth * _overlayHeight;
+ _mouseY = mouseY / (float)_overlayHeight * _overlayWidth;
+
if (!_needsScreenUpdate) {
_needsScreenUpdate = 1;
[sharedInstance performSelectorOnMainThread:@selector(updateSurface) withObject:nil waitUntilDone: NO];
@@ -56,16 +121,17 @@ void iPhone_updateScreen() {
}
void iPhone_updateScreenRect(unsigned short* screen, int x1, int y1, int x2, int y2) {
- //[_lock lock];
-
int y;
- for (y = y1; y < y2; ++y) {
+ for (y = y1; y < y2; ++y)
memcpy(&_textureBuffer[(y * _textureWidth + x1 )* 2], &screen[y * _width + x1], (x2 - x1) * 2);
- }
-
- //[_lock unlock];
}
+void iPhone_updateOverlayRect(unsigned short* screen, int x1, int y1, int x2, int y2) {
+ int y;
+ //printf("Overlaywidth: %u, fullwidth %u\n", _overlayWidth, _fullWidth);
+ for (y = y1; y < y2; ++y)
+ memcpy(&_overlayTexBuffer[(y * _overlayTexWidth + x1 )* 2], &screen[y * _overlayWidth + x1], (x2 - x1) * 2);
+}
void iPhone_initSurface(int width, int height) {
_width = width;
@@ -92,6 +158,19 @@ bool iPhone_fetchEvent(int *outEvent, float *outX, float *outY) {
return true;
}
+uint getSizeNextPOT(uint size) {
+ if ((size & (size - 1)) || !size) {
+ int log = 0;
+
+ while (size >>= 1)
+ ++log;
+
+ size = (2 << log);
+ }
+
+ return size;
+}
+
const char* iPhone_getDocumentsDir() {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
@@ -110,18 +189,6 @@ bool getLocalMouseCoords(CGPoint *point) {
return true;
}
-uint getSizeNextPOT(uint size) {
- if ((size & (size - 1)) || !size) {
- int log = 0;
-
- while (size >>= 1)
- ++log;
-
- size = (2 << log);
- }
-
- return size;
-}
@implementation iPhoneView
@@ -131,7 +198,15 @@ uint getSizeNextPOT(uint size) {
}
- (id)initWithFrame:(struct CGRect)frame {
- [super initWithFrame: frame];
+ self = [super initWithFrame: frame];
+
+ if([[UIScreen mainScreen] respondsToSelector: NSSelectorFromString(@"scale")])
+ {
+ if([self respondsToSelector: NSSelectorFromString(@"contentScaleFactor")])
+ {
+ //self.contentScaleFactor = [[UIScreen mainScreen] scale];
+ }
+ }
_fullWidth = frame.size.width;
_fullHeight = frame.size.height;
@@ -143,6 +218,8 @@ uint getSizeNextPOT(uint size) {
_keyboardView = nil;
_context = nil;
_screenTexture = 0;
+ _overlayTexture = 0;
+ _mouseCursorTexture = 0;
return self;
}
@@ -156,6 +233,8 @@ uint getSizeNextPOT(uint size) {
if (_screenTexture)
free(_textureBuffer);
+
+ free(_overlayTexBuffer);
}
- (void *)getSurface {
@@ -181,6 +260,38 @@ uint getSizeNextPOT(uint size) {
}
_needsScreenUpdate = 0;
+ if (_overlayIsEnabled) {
+ glClear(GL_COLOR_BUFFER_BIT); printOpenGLError();
+ }
+
+ [self updateMainSurface];
+
+ if (_overlayIsEnabled) {
+ [self updateOverlaySurface];
+ [self updateMouseSurface];
+ }
+
+ glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError();
+ [_context presentRenderbuffer:GL_RENDERBUFFER_OES];
+
+}
+
+-(void)updateMouseCursor {
+ if (_mouseCursorTexture == 0) {
+ glGenTextures(1, &_mouseCursorTexture); printOpenGLError();
+ glBindTexture(GL_TEXTURE_2D, _mouseCursorTexture); printOpenGLError();
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); printOpenGLError();
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); printOpenGLError();
+ }
+
+ glBindTexture(GL_TEXTURE_2D, _mouseCursorTexture); printOpenGLError();
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, getSizeNextPOT(_mouseCursorWidth), getSizeNextPOT(_mouseCursorHeight), 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, _mouseCursor); printOpenGLError();
+
+ free(_mouseCursor);
+ _mouseCursor = NULL;
+}
+
+- (void)updateMainSurface {
GLfloat vertices[] = {
0.0f + _heightOffset, 0.0f + _widthOffset,
_visibleWidth - _heightOffset, 0.0f + _widthOffset,
@@ -198,20 +309,76 @@ uint getSizeNextPOT(uint size) {
0.0f, texHeight
};
- glVertexPointer(2, GL_FLOAT, 0, vertices);
- glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
+ glVertexPointer(2, GL_FLOAT, 0, vertices); printOpenGLError();
+ glTexCoordPointer(2, GL_FLOAT, 0, texCoords); printOpenGLError();
+
+ glBindTexture(GL_TEXTURE_2D, _screenTexture); printOpenGLError();
- //[_lock lock];
// Unfortunately we have to update the whole texture every frame, since glTexSubImage2D is actually slower in all cases
// due to the iPhone internals having to convert the whole texture back from its internal format when used.
// In the future we could use several tiled textures instead.
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _textureWidth, _textureHeight, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, _textureBuffer);
- //[_lock unlock];
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _textureWidth, _textureHeight, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, _textureBuffer); printOpenGLError();
+ glDisable(GL_BLEND);
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError();
+}
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
- glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer);
- [_context presentRenderbuffer:GL_RENDERBUFFER_OES];
+- (void)updateOverlaySurface {
+ GLfloat vertices[] = {
+ 0.0f, 0.0f,
+ _overlayHeight, 0.0f,
+ 0.0f, _overlayWidth * _overlayPortraitRatio,
+ _overlayHeight, _overlayWidth * _overlayPortraitRatio
+ };
+
+ float texWidth = _overlayWidth / (float)_overlayTexWidth;
+ float texHeight = _overlayHeight / (float)_overlayTexHeight;
+
+ const GLfloat texCoords[] = {
+ texWidth, 0.0f,
+ 0.0f, 0.0f,
+ texWidth, texHeight,
+ 0.0f, texHeight
+ };
+
+ glVertexPointer(2, GL_FLOAT, 0, vertices); printOpenGLError();
+ glTexCoordPointer(2, GL_FLOAT, 0, texCoords); printOpenGLError();
+ glBindTexture(GL_TEXTURE_2D, _overlayTexture); printOpenGLError();
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _overlayTexWidth, _overlayTexHeight, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, _overlayTexBuffer); printOpenGLError();
+ glEnable(GL_BLEND);
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError();
+}
+
+- (void)updateMouseSurface {
+
+ int width = _mouseCursorWidth / (float)_backingWidth * _backingHeight;
+ int height = _mouseCursorHeight / (float)_backingHeight * _backingWidth;
+
+ GLfloat vertices[] = {
+ _mouseX, _mouseY,
+ _mouseX + height, _mouseY,
+ _mouseX, _mouseY + width,
+ _mouseX + height, _mouseY + width
+ };
+
+ //printf("Cursor: width %u height %u\n", _mouseCursorWidth, _mouseCursorHeight);
+
+ float texWidth = _mouseCursorWidth / (float)getSizeNextPOT(_mouseCursorWidth);
+ float texHeight = _mouseCursorHeight / (float)getSizeNextPOT(_mouseCursorHeight);
+
+ const GLfloat texCoords[] = {
+ texWidth, 0.0f,
+ 0.0f, 0.0f,
+ texWidth, texHeight,
+ 0.0f, texHeight
+ };
+
+ glVertexPointer(2, GL_FLOAT, 0, vertices); printOpenGLError();
+ glTexCoordPointer(2, GL_FLOAT, 0, texCoords); printOpenGLError();
+
+ glBindTexture(GL_TEXTURE_2D, _mouseCursorTexture); printOpenGLError();
+ glEnable(GL_BLEND);
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError();
}
- (void)initSurface {
@@ -232,28 +399,39 @@ uint getSizeNextPOT(uint size) {
_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
if (!_context || [EAGLContext setCurrentContext:_context]) {
- glGenFramebuffersOES(1, &_viewFramebuffer);
- glGenRenderbuffersOES(1, &_viewRenderbuffer);
+ glGenFramebuffersOES(1, &_viewFramebuffer); printOpenGLError();
+ glGenRenderbuffersOES(1, &_viewRenderbuffer); printOpenGLError();
- glBindFramebufferOES(GL_FRAMEBUFFER_OES, _viewFramebuffer);
- glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer);
+ glBindFramebufferOES(GL_FRAMEBUFFER_OES, _viewFramebuffer); printOpenGLError();
+ glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError();
[_context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(id)self.layer];
- glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, _viewRenderbuffer);
+ glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError();
- glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &_backingWidth);
- glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &_backingHeight);
+ glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &_backingWidth); printOpenGLError();
+ glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &_backingHeight); printOpenGLError();
if (glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) != GL_FRAMEBUFFER_COMPLETE_OES) {
NSLog(@"Failed to make complete framebuffer object %x.", glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES));
return;
}
- glViewport(0, 0, _backingWidth, _backingHeight);
- glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
+ _overlayHeight = _backingWidth;
+ _overlayWidth = _backingHeight;
+ _overlayTexWidth = getSizeNextPOT(_overlayHeight);
+ _overlayTexHeight = getSizeNextPOT(_overlayWidth);
+
+ int textureSize = _overlayTexWidth * _overlayTexHeight * 2;
+ _overlayTexBuffer = (char *)malloc(textureSize);
+ memset(_overlayTexBuffer, 0, textureSize);
- glEnable(GL_TEXTURE_2D);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glEnableClientState(GL_VERTEX_ARRAY);
+ glViewport(0, 0, _backingWidth, _backingHeight); printOpenGLError();
+ glClearColor(0.0f, 0.0f, 0.0f, 1.0f); printOpenGLError();
+
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ glEnable(GL_TEXTURE_2D); printOpenGLError();
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY); printOpenGLError();
+ glEnableClientState(GL_VERTEX_ARRAY); printOpenGLError();
}
}
@@ -261,22 +439,32 @@ uint getSizeNextPOT(uint size) {
glLoadIdentity();
if (orientation == UIDeviceOrientationLandscapeRight) {
- glRotatef(-90, 0, 0, 1);
+ glRotatef(-90, 0, 0, 1); printOpenGLError();
} else if (orientation == UIDeviceOrientationLandscapeLeft) {
- glRotatef(90, 0, 0, 1);
+ glRotatef(90, 0, 0, 1); printOpenGLError();
} else {
- glRotatef(180, 0, 0, 1);
+ glRotatef(180, 0, 0, 1); printOpenGLError();
}
- glOrthof(0, _backingWidth, 0, _backingHeight, 0, 1);
+ glOrthof(0, _backingWidth, 0, _backingHeight, 0, 1); printOpenGLError();
if (_screenTexture > 0) {
- glDeleteTextures(1, &_screenTexture);
+ glDeleteTextures(1, &_screenTexture); printOpenGLError();
+ }
+
+ glGenTextures(1, &_screenTexture); printOpenGLError();
+ glBindTexture(GL_TEXTURE_2D, _screenTexture); printOpenGLError();
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); printOpenGLError();
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); printOpenGLError();
+
+ if (_overlayTexture > 0) {
+ glDeleteTextures(1, &_overlayTexture); printOpenGLError();
}
- glGenTextures(1, &_screenTexture);
- glBindTexture(GL_TEXTURE_2D, _screenTexture);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glGenTextures(1, &_overlayTexture); printOpenGLError();
+ glBindTexture(GL_TEXTURE_2D, _overlayTexture); printOpenGLError();
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); printOpenGLError();
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); printOpenGLError();
if (_textureBuffer) {
free(_textureBuffer);
@@ -286,12 +474,12 @@ uint getSizeNextPOT(uint size) {
_textureBuffer = (char*)malloc(textureSize);
memset(_textureBuffer, 0, textureSize);
- glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer);
+ glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError();
// The color buffer is triple-buffered, so we clear it multiple times right away to avid doing any glClears later.
int clearCount = 5;
while (clearCount-- > 0) {
- glClear(GL_COLOR_BUFFER_BIT);
+ glClear(GL_COLOR_BUFFER_BIT); printOpenGLError();
[_context presentRenderbuffer:GL_RENDERBUFFER_OES];
}
@@ -320,6 +508,7 @@ uint getSizeNextPOT(uint size) {
//printf("Rect: %i, %i, %i, %i\n", _widthOffset, _heightOffset, rectWidth, rectHeight);
_screenRect = CGRectMake(_widthOffset, _heightOffset, rectWidth, rectHeight);
+ _overlayPortraitRatio = 1.0f;
} else {
float ratio = (float)_height / (float)_width;
int height = _fullWidth * ratio;
@@ -340,6 +529,7 @@ uint getSizeNextPOT(uint size) {
[self addSubview:[_keyboardView inputView]];
[self addSubview: _keyboardView];
[[_keyboardView inputView] becomeFirstResponder];
+ _overlayPortraitRatio = (_overlayHeight * ratio) / _overlayWidth;
}
}
@@ -421,7 +611,7 @@ uint getSizeNextPOT(uint size) {
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
- NSSet *allTouches = [event allTouches];
+ //NSSet *allTouches = [event allTouches];
for (UITouch* touch in touches) {
if (touch == _firstTouch) {
diff --git a/backends/platform/iphone/osys_events.cpp b/backends/platform/iphone/osys_events.cpp
index c1c7ffdc0c..f1e3b9ba62 100644
--- a/backends/platform/iphone/osys_events.cpp
+++ b/backends/platform/iphone/osys_events.cpp
@@ -60,16 +60,31 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) {
int y = 0;
switch (_screenOrientation) {
case kScreenOrientationPortrait:
- x = (int)(xUnit * _screenWidth);
- y = (int)(yUnit * _screenHeight);
+ if (_overlayVisible) {
+ x = (int)(xUnit * _overlayWidth);
+ y = (int)(yUnit * _overlayHeight);
+ } else {
+ x = (int)(xUnit * _screenWidth);
+ y = (int)(yUnit * _screenHeight);
+ }
break;
case kScreenOrientationLandscape:
- x = (int)(yUnit * _screenWidth);
- y = (int)((1.0 - xUnit) * _screenHeight);
+ if (_overlayVisible) {
+ x = (int)(yUnit * _overlayWidth);
+ y = (int)((1.0 - xUnit) * _overlayHeight);
+ } else {
+ x = (int)(yUnit * _screenWidth);
+ y = (int)((1.0 - xUnit) * _screenHeight);
+ }
break;
case kScreenOrientationFlippedLandscape:
- x = (int)((1.0 - yUnit) * _screenWidth);
- y = (int)(xUnit * _screenHeight);
+ if (_overlayVisible) {
+ x = (int)((1.0 - yUnit) * _overlayWidth);
+ y = (int)(xUnit * _overlayHeight);
+ } else {
+ x = (int)((1.0 - yUnit) * _screenWidth);
+ y = (int)(xUnit * _screenHeight);
+ }
break;
}
@@ -262,15 +277,18 @@ bool OSystem_IPHONE::handleEvent_mouseDragged(Common::Event &event, int x, int y
mouseNewPosX = (int)(_mouseX - deltaX / 0.5f);
mouseNewPosY = (int)(_mouseY - deltaY / 0.5f);
+ int widthCap = _overlayVisible ? _overlayWidth : _screenWidth;
+ int heightCap = _overlayVisible ? _overlayHeight : _screenHeight;
+
if (mouseNewPosX < 0)
mouseNewPosX = 0;
- else if (mouseNewPosX > _screenWidth)
- mouseNewPosX = _screenWidth;
+ else if (mouseNewPosX > widthCap)
+ mouseNewPosX = widthCap;
if (mouseNewPosY < 0)
mouseNewPosY = 0;
- else if (mouseNewPosY > _screenHeight)
- mouseNewPosY = _screenHeight;
+ else if (mouseNewPosY > heightCap)
+ mouseNewPosY = heightCap;
} else {
mouseNewPosX = x;
diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp
index 6c26b6ca8d..a1fb8f0d5e 100644
--- a/backends/platform/iphone/osys_main.cpp
+++ b/backends/platform/iphone/osys_main.cpp
@@ -54,13 +54,13 @@ void *OSystem_IPHONE::s_soundParam = NULL;
OSystem_IPHONE::OSystem_IPHONE() :
_savefile(NULL), _mixer(NULL), _timer(NULL), _offscreen(NULL),
- _overlayVisible(false), _overlayBuffer(NULL), _fullscreen(NULL),
+ _overlayVisible(false), _fullscreen(NULL),
_mouseHeight(0), _mouseWidth(0), _mouseBuf(NULL), _lastMouseTap(0),
_secondaryTapped(false), _lastSecondaryTap(0), _screenOrientation(kScreenOrientationFlippedLandscape),
_needEventRestPeriod(false), _mouseClickAndDragEnabled(false),
_gestureStartX(-1), _gestureStartY(-1), _fullScreenIsDirty(false), _fullScreenOverlayIsDirty(false),
- _mouseDirty(false), _timeSuspended(0), _lastDragPosX(-1), _lastDragPosY(-1), _screenChangeCount(0)
-
+ _mouseDirty(false), _timeSuspended(0), _lastDragPosX(-1), _lastDragPosY(-1), _screenChangeCount(0),
+ _overlayHeight(0), _overlayWidth(0), _overlayBuffer(0)
{
_queuedInputEvent.type = (Common::EventType)0;
_lastDrawnMouseRect = Common::Rect(0, 0, 0, 0);
diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index 3c80c83998..c925078b46 100644
--- a/backends/platform/iphone/osys_main.h
+++ b/backends/platform/iphone/osys_main.h
@@ -66,6 +66,9 @@ protected:
Graphics::Surface _framebuffer;
byte *_offscreen;
OverlayColor *_overlayBuffer;
+ uint16 _overlayHeight;
+ uint16 _overlayWidth;
+
uint16 *_fullscreen;
uint16 _palette[256];
@@ -144,7 +147,7 @@ public:
virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
virtual int16 getOverlayHeight();
virtual int16 getOverlayWidth();
- virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<565>(); }
+ virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<5551>(); }
virtual bool showMouse(bool visible);
diff --git a/backends/platform/iphone/osys_video.cpp b/backends/platform/iphone/osys_video.cpp
index 76c2031758..18acb77524 100644
--- a/backends/platform/iphone/osys_video.cpp
+++ b/backends/platform/iphone/osys_video.cpp
@@ -57,10 +57,10 @@ void OSystem_IPHONE::initSize(uint width, uint height, const Graphics::PixelForm
_offscreen = (byte *)malloc(width * height);
bzero(_offscreen, width * height);
- free(_overlayBuffer);
+ //free(_overlayBuffer);
int fullSize = _screenWidth * _screenHeight * sizeof(OverlayColor);
- _overlayBuffer = (OverlayColor *)malloc(fullSize);
+ //_overlayBuffer = (OverlayColor *)malloc(fullSize);
clearOverlay();
free(_fullscreen);
@@ -70,6 +70,14 @@ void OSystem_IPHONE::initSize(uint width, uint height, const Graphics::PixelForm
iPhone_initSurface(width, height);
+ if (_overlayBuffer == NULL) {
+ _overlayHeight = iPhone_getScreenHeight();
+ _overlayWidth = iPhone_getScreenWidth();
+
+ printf("Overlay: (%u x %u)\n", _overlayWidth, _overlayHeight);
+ _overlayBuffer = new OverlayColor[_overlayHeight * _overlayWidth];
+ }
+
_fullScreenIsDirty = false;
dirtyFullScreen();
_mouseVisible = false;
@@ -187,7 +195,7 @@ void OSystem_IPHONE::updateScreen() {
_fullScreenIsDirty = false;
_fullScreenOverlayIsDirty = false;
- iPhone_updateScreen();
+ iPhone_updateScreen(_mouseX - _mouseHotspotX, _mouseY - _mouseHotspotY);
}
void OSystem_IPHONE::internUpdateScreen() {
@@ -222,8 +230,9 @@ void OSystem_IPHONE::internUpdateScreen() {
if (_overlayVisible)
drawDirtyOverlayRect(dirtyRect);
+ else
+ drawMouseCursorOnRectUpdate(dirtyRect, mouseRect);
- drawMouseCursorOnRectUpdate(dirtyRect, mouseRect);
updateHardwareSurfaceForRect(dirtyRect);
}
@@ -234,8 +243,8 @@ void OSystem_IPHONE::internUpdateScreen() {
//printf("Drawing: (%i, %i) -> (%i, %i)\n", dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom);
drawDirtyOverlayRect(dirtyRect);
- drawMouseCursorOnRectUpdate(dirtyRect, mouseRect);
- updateHardwareSurfaceForRect(dirtyRect);
+ //drawMouseCursorOnRectUpdate(dirtyRect, mouseRect);
+ //updateHardwareSurfaceForRect(dirtyRect);
}
}
}
@@ -256,16 +265,17 @@ void OSystem_IPHONE::drawDirtyRect(const Common::Rect& dirtyRect) {
}
void OSystem_IPHONE::drawDirtyOverlayRect(const Common::Rect& dirtyRect) {
- int h = dirtyRect.bottom - dirtyRect.top;
-
- uint16 *src = (uint16 *)&_overlayBuffer[dirtyRect.top * _screenWidth + dirtyRect.left];
- uint16 *dst = &_fullscreen[dirtyRect.top * _screenWidth + dirtyRect.left];
- int x = (dirtyRect.right - dirtyRect.left) * 2;
- for (int y = h; y > 0; y--) {
- memcpy(dst, src, x);
- src += _screenWidth;
- dst += _screenWidth;
- }
+ // int h = dirtyRect.bottom - dirtyRect.top;
+ //
+ // uint16 *src = (uint16 *)&_overlayBuffer[dirtyRect.top * _screenWidth + dirtyRect.left];
+ // uint16 *dst = &_fullscreen[dirtyRect.top * _screenWidth + dirtyRect.left];
+ // int x = (dirtyRect.right - dirtyRect.left) * 2;
+ // for (int y = h; y > 0; y--) {
+ // memcpy(dst, src, x);
+ // src += _screenWidth;
+ // dst += _screenWidth;
+ // }
+ iPhone_updateOverlayRect(_overlayBuffer, dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom );
}
void OSystem_IPHONE::drawMouseCursorOnRectUpdate(const Common::Rect& updatedRect, const Common::Rect& mouseRect) {
@@ -283,16 +293,19 @@ void OSystem_IPHONE::drawMouseCursorOnRectUpdate(const Common::Rect& updatedRect
srcY -= top;
top = 0;
}
- //int right = left + _mouseWidth;
+
int bottom = top + _mouseHeight;
if (bottom > _screenWidth)
bottom = _screenWidth;
- int displayWidth = _mouseWidth;
+
+ int displayWidth = _mouseWidth;
if (_mouseWidth + left > _screenWidth)
displayWidth = _screenWidth - left;
- int displayHeight = _mouseHeight;
+
+ int displayHeight = _mouseHeight;
if (_mouseHeight + top > _screenHeight)
displayHeight = _screenHeight - top;
+
byte *src = &_mouseBuf[srcY * _mouseWidth + srcX];
uint16 *dst = &_fullscreen[top * _screenWidth + left];
for (int y = displayHeight; y > srcY; y--) {
@@ -337,6 +350,7 @@ void OSystem_IPHONE::showOverlay() {
//printf("showOverlay()\n");
_overlayVisible = true;
dirtyFullOverlayScreen();
+ iPhone_enableOverlay(true);
}
void OSystem_IPHONE::hideOverlay() {
@@ -344,11 +358,12 @@ void OSystem_IPHONE::hideOverlay() {
_overlayVisible = false;
_dirtyOverlayRects.clear();
dirtyFullScreen();
+ iPhone_enableOverlay(false);
}
void OSystem_IPHONE::clearOverlay() {
//printf("clearOverlay()\n");
- bzero(_overlayBuffer, _screenWidth * _screenHeight * sizeof(OverlayColor));
+ bzero(_overlayBuffer, _overlayWidth * _overlayHeight * sizeof(OverlayColor));
dirtyFullOverlayScreen();
}
@@ -358,8 +373,8 @@ void OSystem_IPHONE::grabOverlay(OverlayColor *buf, int pitch) {
OverlayColor *src = _overlayBuffer;
do {
- memcpy(buf, src, _screenWidth * sizeof(OverlayColor));
- src += _screenWidth;
+ memcpy(buf, src, _overlayWidth * sizeof(OverlayColor));
+ src += _overlayWidth;
buf += pitch;
} while (--h);
}
@@ -380,11 +395,11 @@ void OSystem_IPHONE::copyRectToOverlay(const OverlayColor *buf, int pitch, int x
y = 0;
}
- if (w > _screenWidth - x)
- w = _screenWidth - x;
+ if (w > _overlayWidth - x)
+ w = _overlayWidth - x;
- if (h > _screenHeight - y)
- h = _screenHeight - y;
+ if (h > _overlayHeight - y)
+ h = _overlayHeight - y;
if (w <= 0 || h <= 0)
return;
@@ -393,24 +408,24 @@ void OSystem_IPHONE::copyRectToOverlay(const OverlayColor *buf, int pitch, int x
_dirtyOverlayRects.push_back(Common::Rect(x, y, x + w, y + h));
}
- OverlayColor *dst = _overlayBuffer + (y * _screenWidth + x);
- if (_screenWidth == pitch && pitch == w)
+ OverlayColor *dst = _overlayBuffer + (y * _overlayWidth + x);
+ if (_overlayWidth == pitch && pitch == w)
memcpy(dst, buf, h * w * sizeof(OverlayColor));
else {
do {
memcpy(dst, buf, w * sizeof(OverlayColor));
buf += pitch;
- dst += _screenWidth;
+ dst += _overlayWidth;
} while (--h);
}
}
int16 OSystem_IPHONE::getOverlayHeight() {
- return _screenHeight;
+ return _overlayHeight;
}
int16 OSystem_IPHONE::getOverlayWidth() {
- return _screenWidth;
+ return _overlayWidth;
}
bool OSystem_IPHONE::showMouse(bool visible) {
@@ -440,13 +455,31 @@ void OSystem_IPHONE::dirtyFullScreen() {
void OSystem_IPHONE::dirtyFullOverlayScreen() {
if (!_fullScreenOverlayIsDirty) {
_dirtyOverlayRects.clear();
- _dirtyOverlayRects.push_back(Common::Rect(0, 0, _screenWidth, _screenHeight));
+ _dirtyOverlayRects.push_back(Common::Rect(0, 0, _overlayWidth, _overlayHeight));
_fullScreenOverlayIsDirty = true;
}
}
void OSystem_IPHONE::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {
- //printf("setMouseCursor(%i, %i)\n", hotspotX, hotspotY);
+ //printf("setMouseCursor(%i, %i, scale %u)\n", hotspotX, hotspotY, cursorTargetScale);
+
+ int texWidth = getSizeNextPOT(w);
+ int texHeight = getSizeNextPOT(h);
+ int bufferSize = texWidth * texHeight * sizeof(int16);
+ int16* mouseBuf = (int16*)malloc(bufferSize);
+ memset(mouseBuf, 0, bufferSize);
+
+ for (int x = 0; x < w; ++x) {
+ for (int y = 0; y < h; ++y) {
+ byte color = buf[y * w + x];
+ if (color != keycolor)
+ mouseBuf[y * texWidth + x] = _palette[color] | 0x1;
+ else
+ mouseBuf[y * texWidth + x] = 0x0;
+ }
+ }
+
+ iPhone_setMouseCursor(mouseBuf, w, h);
if (_mouseBuf != NULL && (_mouseWidth != w || _mouseHeight != h)) {
free(_mouseBuf);
--
cgit v1.2.3
From 7296a2d8d03b7358bdef0e9217f53eb4ee81ce9e Mon Sep 17 00:00:00 2001
From: Thierry Crozat
Date: Thu, 30 Sep 2010 18:09:01 +0000
Subject: I18N: Add translation for wince specific titles for key mapping
dialog
Also backport fix from branch on translation of default title for key mapping
dialog.
svn-id: r52959
---
backends/platform/wince/wince-sdl.cpp | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp
index d68cbd5d0b..ac9be5df48 100644
--- a/backends/platform/wince/wince-sdl.cpp
+++ b/backends/platform/wince/wince-sdl.cpp
@@ -987,11 +987,11 @@ void OSystem_WINCE3::check_mappings() {
// Some games need to map the right click button, signal it here if it wasn't done
if (instance->needsRightClickMapping()) {
- GUI::KeysDialog *keysDialog = new GUI::KeysDialog("Map right click action");
+ GUI::KeysDialog *keysDialog = new GUI::KeysDialog(_("Map right click action"));
while (!instance->getMapping(POCKET_ACTION_RIGHTCLICK)) {
keysDialog->runModal();
if (!instance->getMapping(POCKET_ACTION_RIGHTCLICK)) {
- GUI::MessageDialog alert("You must map a key to the 'Right Click' action to play this game");
+ GUI::MessageDialog alert(_("You must map a key to the 'Right Click' action to play this game"));
alert.runModal();
}
}
@@ -1000,11 +1000,11 @@ void OSystem_WINCE3::check_mappings() {
// Map the "hide toolbar" action if needed
if (instance->needsHideToolbarMapping()) {
- GUI::KeysDialog *keysDialog = new GUI::KeysDialog("Map hide toolbar action");
+ GUI::KeysDialog *keysDialog = new GUI::KeysDialog(_("Map hide toolbar action"));
while (!instance->getMapping(POCKET_ACTION_HIDE)) {
keysDialog->runModal();
if (!instance->getMapping(POCKET_ACTION_HIDE)) {
- GUI::MessageDialog alert("You must map a key to the 'Hide toolbar' action to play this game");
+ GUI::MessageDialog alert(_("You must map a key to the 'Hide toolbar' action to play this game"));
alert.runModal();
}
}
@@ -1013,10 +1013,10 @@ void OSystem_WINCE3::check_mappings() {
// Map the "zoom" actions if needed
if (instance->needsZoomMapping()) {
- GUI::KeysDialog *keysDialog = new GUI::KeysDialog("Map Zoom Up action (optional)");
+ GUI::KeysDialog *keysDialog = new GUI::KeysDialog(_("Map Zoom Up action (optional)"));
keysDialog->runModal();
delete keysDialog;
- keysDialog = new GUI::KeysDialog("Map Zoom Down action (optional)");
+ keysDialog = new GUI::KeysDialog(_("Map Zoom Down action (optional)"));
keysDialog->runModal();
delete keysDialog;
}
@@ -1024,7 +1024,7 @@ void OSystem_WINCE3::check_mappings() {
// Extra warning for Zak Mc Kracken
if (strncmp(gameid.c_str(), "zak", 3) == 0 &&
!GUI_Actions::Instance()->getMapping(POCKET_ACTION_HIDE)) {
- GUI::MessageDialog alert("Don't forget to map a key to 'Hide Toolbar' action to see the whole inventory");
+ GUI::MessageDialog alert(_("Don't forget to map a key to 'Hide Toolbar' action to see the whole inventory"));
alert.runModal();
}
--
cgit v1.2.3
From e47e474cff9823c789626f4b0b26ff69257b5263 Mon Sep 17 00:00:00 2001
From: Yotam Barnoy
Date: Wed, 6 Oct 2010 21:26:45 +0000
Subject: PSP: rewrote input code and added an input mode
The old input code was getting too messy. A redesign made it easier to modify and add several modes and combos, including one for 1st person games which benefit from a different control scheme. A combo switches between the modes. I also added directional support while the virtual keyboard is visible, using the nub. This allows moving around in the text in some games, and moving the character while typing for others (e.g. AGI)
svn-id: r53042
---
backends/platform/psp/README.PSP | 136 ++++----
backends/platform/psp/README.PSP.in | 136 ++++----
backends/platform/psp/cursor.h | 2 +
backends/platform/psp/display_client.h | 1 +
backends/platform/psp/input.cpp | 583 ++++++++++++++++++++++-----------
backends/platform/psp/input.h | 154 ++++++++-
backends/platform/psp/pspkeyboard.cpp | 22 +-
backends/platform/psp/pspkeyboard.h | 8 +-
8 files changed, 702 insertions(+), 340 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/psp/README.PSP b/backends/platform/psp/README.PSP
index ebafdb0b17..fc49f3fd60 100644
--- a/backends/platform/psp/README.PSP
+++ b/backends/platform/psp/README.PSP
@@ -3,79 +3,95 @@ ScummVM-PSP 1.3.0svn README
Installation
============
- - Copy the relevant game datafiles to your memory stick (location
- doesn't matter).
- - Install ScummVM like any other homebrew
- - Run ScummVM and use the launcher to add games and run them
-
+ - Copy the relevant game datafiles to your memory stick (location doesn't matter).
+ - Install ScummVM like any other homebrew.
+ - Run ScummVM and use the launcher to add games and run them.
Controls
========
-
-Left trigger - ESC
Right trigger - Modifier key (see below for uses)
+Left trigger - ESC (Usually skips cutscenes. Depends on game)
Analog - Mouse movement
-Right trigger + Analog - Fine control mouse
-Directions - Arrow keys
-Directions + Right Trigger - Diagonal arrow keys
-Triangle - Enter
-Cross - Mouse button 1
-Circle - Mouse button 2
-Square - '.' (skip dialogue in some games)
-Start - F5 (Main Menu)
-Right trigger + Start - Return-To-Launcher menu
-
-Virtual Keyboard
-================
-
-Select - Show/Hide Virtual Keyboard. Hold down to move keyboard onscreen.
-Start - Enter
-Right trigger - Switch to/between letter modes
-Left trigger - Switch to/between numbers and symbols
-D-Pad - Select square of characters
-Buttons/Triggers - Choose a specific character
-
+Right trigger + Analog - Fine mouse movement
+D-Pad - Arrow keys (useful mostly in SCI and AGI games)
+D-Pad + Right Trigger - Diagonal arrow keys (it's hard to input diagonals on some PSPs)
+Triangle - Enter (useful for some dialogs)
+Cross - Left Mouse Button (usually the main button)
+Circle - Right Mouse Button (secondary button in some games)
+Square - '.' (skip dialogue in some games e.g. Scumm)
+Right trigger + Square - Spacebar (useful in Gobli*ns and SCI games)
+Start - Global Menu. Allows you to 'Return To Launcher' to play another game
+Right trigger + Start - F5 (Main Menu in some games)
+Select - Show/Hide Virtual Keyboard. Hold down to move keyboard onscreen (with D-Pad).
+
+Virtual Keyboard Mode
+=====================
+Start - Enter key. Also exits virtual keyboard mode
+Select - Exit the virtual keyboard mode
+Right trigger - Input letters: lowercase/uppercase (press to toggle)
+Left trigger - Input numbers/symbols (press to toggle)
+D-Pad - Select square of characters (up, down, left or right)
+Buttons/Triggers - Choose a specific character in the square. The four center characters are chosen
+ by the button in the corresponding position. The 2 top characters are chosen by the
+ triggers.
+Analog - Moves in a direction (left/right/up/down) (Useful to keep moving
+ while typing in AGI games among other things)
+
+1st Person Game Mode (Can be ignored by most users)
+====================
+This is a special mode built for 1st person games like Lands of Lore. If you don't have these games you can
+safely ignore this mode. To enter or leave this mode, use the combo:
+
+Right Trigger + Left Trigger + Square
+
+Some buttons have been switched around to make these games more playable:
+Square - Is the modifier key instead of Right Trigger.
+Left/Right Trigger - Strafe left/right
+D-Pad Left/Right - Turn left/right
+Square + D-Pad - F1/F2/F3/F4
+Square + Start - Esc (shows game menu)
+
+
Notes
=====
-
-- Plugin files are NOT interchangeable between versions! You must copy ALL the
- plugin files that come with every version of scummvm. They sit in the /plugin
+- Notice that you can switch between games! This is much faster than quitting
+ and having to start ScummVM all over again. Go to the global menu and choose 'Return To Launcher'.
+ (Some games may not have the Return To Launcher option available yet.)
+
+- The PSP version of ScummVM uses the Media Engine to accelerate decoding of MP3 files. This means
+ that if you have the choice of compressing using Ogg files or MP3 files, choose MP3 -- the game
+ will generally run faster.
+
+- Plugin files are NOT interchangeable between ScummVM versions! You must copy ALL the
+ plugin files that come with every version of ScummVM. They sit in the /plugin
subdirectory. If you get a crash upon startup, try deleting all the existing
plugin files in the plugin directory and copying the new ones over again.
-- While it's possible to compress certain game resources to reduce their size,
- this can (and usually will) cause games (especially animation) to be choppy
- sometimes, as it ofcourse needs extra CPU power to decode these files.
- As such, it is recommended to play games in their original, uncompressed,
- form whenever possible.
-
- This README may be outdated, for more up-to-date instructions and notes see
the PSP Port Wiki: http://wiki.scummvm.org/index.php/PlayStation_Portable
Frequently Asked Questions
==========================
-Q: Pressing select doesn't make the virtual keyboard show up on screen!
-A: You need to make sure that the kbd.zip file is in the same directory as the scummvm executable.
-
Q: Scummvm crashes upon starting up!
A: See the first note above.
+Q: Pressing select doesn't make the virtual keyboard show up on screen!
+A: You need to make sure that the kbd.zip file is in the same directory as the ScummVM executable.
+
Q: What do I need to run the games?
-A: A 1.00 or 1.50 firmware PSP (or an EBOOT loader on firmware 2.00 or
- higher), and the necessary datafiles for the game you want to play and
- obviously this ScummVM port.
+A: A PSP that can run homebrew and the necessary datafiles for the game you want to play.
Q: Can I run game X with this?
A: You can find the list of supported games on the compatibility page
- on http://www.scummvm.org.
- Note that ScummVM is NOT a 'DOS (game) emulator', but written
- specifically for certain games/engines.
+ at http://www.scummvm.org
+ Note that ScummVM is NOT an emulator. The supported games engines have been painstakingly rewritten.
+ It's not easy to add support for a game you want that currently isn't supported.
Q: My Monkey Island 1 doesn't have any music, what gives?
A: If your version of Monkey Island came on a CD then it has the music
- as CD Audio tracks. You need to rip those to MP3/Ogg and copy them
- to the same directory as the game datafiles for music to work.
+ as CD Audio tracks. You need to rip those to MP3/Ogg (MP3 is preferred), naming them track1.mp3 track2.mp3
+ etc. and copy them to the same directory as the game datafiles for music to work.
Q: Game X crashes, or feature Y doesn't work. Can you fix this?
A: Possibly.
@@ -83,21 +99,23 @@ A: Possibly.
played them all start-to-finish on the PSP, so it's possible there
are bugs or issues that we're not aware of.
When you encounter such a bug, please use the "Bug Tracker" you find linked
- on the ScummVM website, and mention all relevant info (i.e. that you're
+ on the ScummVM website, and mention all relevant info i.e. that you're
using the PSP version, which ScummVM version it is, if the problem exists
- in a recent PC SVN version, a detailed description of the problem,
- and if at all possible a nearby savegame), this will make it much easier
+ in a recent PC version, a detailed description of the problem,
+ and if at all possible a nearby savegame. This will make it much easier
for us to reproduce (and hopefully fix) the problem.
Building the source code
========================
To build ScummVM for PSP you need:
+- ScummVM source code (svn co https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk)
+
- PSP toolchain (svn co svn://svn.pspdev.org/psp/trunk/psptoolchain)
- PSPSDK (svn co svn://svn.pspdev.org/psp/trunk/pspsdk)
- Note: This usually gets installed by the PSP toolchain,
- so you don't have to do it manually.
+ Note: This usually gets installed by the PSP toolchain,
+ so you don't have to do it manually.
- zlib (svn co svn://svn.pspdev.org/psp/trunk/zlib)
@@ -107,21 +125,15 @@ To build ScummVM for PSP you need:
- libTremor(*) (svn co svn://svn.pspdev.org/psp/trunk/libTremor)
-
-
(*) = optional
-When you've installed these libraries (read their README.PSP for instructions),
-type "make" in the backends/platform/psp directory to build a 1.00 firmware
-EBOOT.PBP, or "make kxploit" to build the 1.50/kxploit EBOOT.PBPs
-
-You can control most of the build process (engines and libraries used) from
-the Makefile.
-
+Once you've installed these libraries (read their README.PSP for instructions),
+create a subdirectory in your ScummVM folder called 'builds/psp'. Then, in this folder, type
+'../../configure --host=psp --enable-plugins --default-dynamic'. If everything is installed
+correctly, ScummVM will inform you as it finds the right components. Finally type 'make' to build.
Port Authors
============
-
Joost Peters (joostp@scummvm.org)
Paolo Costabel (paoloc@pacbell.net)
Thomas Mayer (tommybear@internode.on.net)
diff --git a/backends/platform/psp/README.PSP.in b/backends/platform/psp/README.PSP.in
index 2d53fd3b47..1d48780d3c 100644
--- a/backends/platform/psp/README.PSP.in
+++ b/backends/platform/psp/README.PSP.in
@@ -3,79 +3,95 @@ ScummVM-PSP @VERSION@ README
Installation
============
- - Copy the relevant game datafiles to your memory stick (location
- doesn't matter).
- - Install ScummVM like any other homebrew
- - Run ScummVM and use the launcher to add games and run them
-
+ - Copy the relevant game datafiles to your memory stick (location doesn't matter).
+ - Install ScummVM like any other homebrew.
+ - Run ScummVM and use the launcher to add games and run them.
Controls
========
-
-Left trigger - ESC
Right trigger - Modifier key (see below for uses)
+Left trigger - ESC (Usually skips cutscenes. Depends on game)
Analog - Mouse movement
-Right trigger + Analog - Fine control mouse
-Directions - Arrow keys
-Directions + Right Trigger - Diagonal arrow keys
-Triangle - Enter
-Cross - Mouse button 1
-Circle - Mouse button 2
-Square - '.' (skip dialogue in some games)
-Start - F5 (Main Menu)
-Right trigger + Start - Return-To-Launcher menu
-
-Virtual Keyboard
-================
-
-Select - Show/Hide Virtual Keyboard. Hold down to move keyboard onscreen.
-Start - Enter
-Right trigger - Switch to/between letter modes
-Left trigger - Switch to/between numbers and symbols
-D-Pad - Select square of characters
-Buttons/Triggers - Choose a specific character
-
+Right trigger + Analog - Fine mouse movement
+D-Pad - Arrow keys (useful mostly in SCI and AGI games)
+D-Pad + Right Trigger - Diagonal arrow keys (it's hard to input diagonals on some PSPs)
+Triangle - Enter (useful for some dialogs)
+Cross - Left Mouse Button (usually the main button)
+Circle - Right Mouse Button (secondary button in some games)
+Square - '.' (skip dialogue in some games e.g. Scumm)
+Right trigger + Square - Spacebar (useful in Gobli*ns and SCI games)
+Start - Global Menu. Allows you to 'Return To Launcher' to play another game
+Right trigger + Start - F5 (Main Menu in some games)
+Select - Show/Hide Virtual Keyboard. Hold down to move keyboard onscreen (with D-Pad).
+
+Virtual Keyboard Mode
+=====================
+Start - Enter key. Also exits virtual keyboard mode
+Select - Exit the virtual keyboard mode
+Right trigger - Input letters: lowercase/uppercase (press to toggle)
+Left trigger - Input numbers/symbols (press to toggle)
+D-Pad - Select square of characters (up, down, left or right)
+Buttons/Triggers - Choose a specific character in the square. The four center characters are chosen
+ by the button in the corresponding position. The 2 top characters are chosen by the
+ triggers.
+Analog - Moves in a direction (left/right/up/down) (Useful to keep moving
+ while typing in AGI games among other things)
+
+1st Person Game Mode (Can be ignored by most users)
+====================
+This is a special mode built for 1st person games like Lands of Lore. If you don't have these games you can
+safely ignore this mode. To enter or leave this mode, use the combo:
+
+Right Trigger + Left Trigger + Square
+
+Some buttons have been switched around to make these games more playable:
+Square - Is the modifier key instead of Right Trigger.
+Left/Right Trigger - Strafe left/right
+D-Pad Left/Right - Turn left/right
+Square + D-Pad - F1/F2/F3/F4
+Square + Start - Esc (shows game menu)
+
+
Notes
=====
-
-- Plugin files are NOT interchangeable between versions! You must copy ALL the
- plugin files that come with every version of scummvm. They sit in the /plugin
+- Notice that you can switch between games! This is much faster than quitting
+ and having to start ScummVM all over again. Go to the global menu and choose 'Return To Launcher'.
+ (Some games may not have the Return To Launcher option available yet.)
+
+- The PSP version of ScummVM uses the Media Engine to accelerate decoding of MP3 files. This means
+ that if you have the choice of compressing using Ogg files or MP3 files, choose MP3 -- the game
+ will generally run faster.
+
+- Plugin files are NOT interchangeable between ScummVM versions! You must copy ALL the
+ plugin files that come with every version of ScummVM. They sit in the /plugin
subdirectory. If you get a crash upon startup, try deleting all the existing
plugin files in the plugin directory and copying the new ones over again.
-- While it's possible to compress certain game resources to reduce their size,
- this can (and usually will) cause games (especially animation) to be choppy
- sometimes, as it ofcourse needs extra CPU power to decode these files.
- As such, it is recommended to play games in their original, uncompressed,
- form whenever possible.
-
- This README may be outdated, for more up-to-date instructions and notes see
the PSP Port Wiki: http://wiki.scummvm.org/index.php/PlayStation_Portable
Frequently Asked Questions
==========================
-Q: Pressing select doesn't make the virtual keyboard show up on screen!
-A: You need to make sure that the kbd.zip file is in the same directory as the scummvm executable.
-
Q: Scummvm crashes upon starting up!
A: See the first note above.
+Q: Pressing select doesn't make the virtual keyboard show up on screen!
+A: You need to make sure that the kbd.zip file is in the same directory as the ScummVM executable.
+
Q: What do I need to run the games?
-A: A 1.00 or 1.50 firmware PSP (or an EBOOT loader on firmware 2.00 or
- higher), and the necessary datafiles for the game you want to play and
- obviously this ScummVM port.
+A: A PSP that can run homebrew and the necessary datafiles for the game you want to play.
Q: Can I run game X with this?
A: You can find the list of supported games on the compatibility page
- on http://www.scummvm.org.
- Note that ScummVM is NOT a 'DOS (game) emulator', but written
- specifically for certain games/engines.
+ at http://www.scummvm.org
+ Note that ScummVM is NOT an emulator. The supported games engines have been painstakingly rewritten.
+ It's not easy to add support for a game you want that currently isn't supported.
Q: My Monkey Island 1 doesn't have any music, what gives?
A: If your version of Monkey Island came on a CD then it has the music
- as CD Audio tracks. You need to rip those to MP3/Ogg and copy them
- to the same directory as the game datafiles for music to work.
+ as CD Audio tracks. You need to rip those to MP3/Ogg (MP3 is preferred), naming them track1.mp3 track2.mp3
+ etc. and copy them to the same directory as the game datafiles for music to work.
Q: Game X crashes, or feature Y doesn't work. Can you fix this?
A: Possibly.
@@ -83,21 +99,23 @@ A: Possibly.
played them all start-to-finish on the PSP, so it's possible there
are bugs or issues that we're not aware of.
When you encounter such a bug, please use the "Bug Tracker" you find linked
- on the ScummVM website, and mention all relevant info (i.e. that you're
+ on the ScummVM website, and mention all relevant info i.e. that you're
using the PSP version, which ScummVM version it is, if the problem exists
- in a recent PC SVN version, a detailed description of the problem,
- and if at all possible a nearby savegame), this will make it much easier
+ in a recent PC version, a detailed description of the problem,
+ and if at all possible a nearby savegame. This will make it much easier
for us to reproduce (and hopefully fix) the problem.
Building the source code
========================
To build ScummVM for PSP you need:
+- ScummVM source code (svn co https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk)
+
- PSP toolchain (svn co svn://svn.pspdev.org/psp/trunk/psptoolchain)
- PSPSDK (svn co svn://svn.pspdev.org/psp/trunk/pspsdk)
- Note: This usually gets installed by the PSP toolchain,
- so you don't have to do it manually.
+ Note: This usually gets installed by the PSP toolchain,
+ so you don't have to do it manually.
- zlib (svn co svn://svn.pspdev.org/psp/trunk/zlib)
@@ -107,21 +125,15 @@ To build ScummVM for PSP you need:
- libTremor(*) (svn co svn://svn.pspdev.org/psp/trunk/libTremor)
-
-
(*) = optional
-When you've installed these libraries (read their README.PSP for instructions),
-type "make" in the backends/platform/psp directory to build a 1.00 firmware
-EBOOT.PBP, or "make kxploit" to build the 1.50/kxploit EBOOT.PBPs
-
-You can control most of the build process (engines and libraries used) from
-the Makefile.
-
+Once you've installed these libraries (read their README.PSP for instructions),
+create a subdirectory in your ScummVM folder called 'builds/psp'. Then, in this folder, type
+'../../configure --host=psp --enable-plugins --default-dynamic'. If everything is installed
+correctly, ScummVM will inform you as it finds the right components. Finally type 'make' to build.
Port Authors
============
-
Joost Peters (joostp@scummvm.org)
Paolo Costabel (paoloc@pacbell.net)
Thomas Mayer (tommybear@internode.on.net)
diff --git a/backends/platform/psp/cursor.h b/backends/platform/psp/cursor.h
index c3d4d76803..2ff0415c6c 100644
--- a/backends/platform/psp/cursor.h
+++ b/backends/platform/psp/cursor.h
@@ -26,6 +26,8 @@
#ifndef MOUSE_H
#define MOUSE_H
+#include "backends/platform/psp/default_display_client.h"
+
class Cursor : public DefaultDisplayClient {
private:
int _hotspotX, _hotspotY;
diff --git a/backends/platform/psp/display_client.h b/backends/platform/psp/display_client.h
index d05b0b046c..feec477282 100644
--- a/backends/platform/psp/display_client.h
+++ b/backends/platform/psp/display_client.h
@@ -30,6 +30,7 @@
#include "graphics/surface.h"
#include "common/system.h"
#include "backends/platform/psp/memory.h"
+#include "backends/platform/psp/psppixelformat.h"
#define MAX_TEXTURE_SIZE 512
diff --git a/backends/platform/psp/input.cpp b/backends/platform/psp/input.cpp
index 4fe7cb3f92..3ea2d4365d 100644
--- a/backends/platform/psp/input.cpp
+++ b/backends/platform/psp/input.cpp
@@ -23,238 +23,272 @@
*
*/
-// Todo: handle events that should fire because of shift going off
-// Solution: handle shift on a button-by-button basis, only allowing it when the button is up. Also a inputmap-wide button. At buttonup, shiftstate is inspected per button.
+#include
+#include "gui/message.h"
+#include "backends/platform/psp/input.h"
//#define __PSP_DEBUG_FUNCS__ /* Uncomment for debugging the stack */
//#define __PSP_DEBUG_PRINT__ /* Uncomment for debug prints */
-
#include "backends/platform/psp/trace.h"
-#include "backends/platform/psp/psppixelformat.h"
-#include "backends/platform/psp/input.h"
-
// Defines for working with PSP buttons
-#define CHANGED(x) (_buttonsChanged & (x))
-#define PRESSED(x) ((_buttonsChanged & (x)) && (pad.Buttons & (x)))
-#define UNPRESSED(x) ((_buttonsChanged & (x)) && !(pad.Buttons & (x)))
-#define DOWN(x) (pad.Buttons & (x))
+#define DOWN(x) ((pad.Buttons & (x)) == (x))
#define UP(x) (!(pad.Buttons & (x)))
#define PSP_DPAD (PSP_CTRL_DOWN|PSP_CTRL_UP|PSP_CTRL_LEFT|PSP_CTRL_RIGHT)
#define PSP_4BUTTONS (PSP_CTRL_CROSS | PSP_CTRL_CIRCLE | PSP_CTRL_TRIANGLE | PSP_CTRL_SQUARE)
#define PSP_TRIGGERS (PSP_CTRL_LTRIGGER | PSP_CTRL_RTRIGGER)
+#define PSP_ALL_BUTTONS (PSP_DPAD | PSP_4BUTTONS | PSP_TRIGGERS | PSP_CTRL_START | PSP_CTRL_SELECT)
#define PAD_CHECK_TIME 53
-void InputHandler::init() {
- sceCtrlSetSamplingCycle(0); // set sampling to vsync. n = n usecs
- sceCtrlSetSamplingMode(1); // analog
+Button::Button() {
+ clear();
}
-bool InputHandler::getAllInputs(Common::Event &event) {
- DEBUG_ENTER_FUNC();
-
- uint32 time = g_system->getMillis(); // may not be necessary with read
- if (time - _lastPadCheckTime < PAD_CHECK_TIME) {
- return false;
- }
-
- _lastPadCheckTime = time;
- SceCtrlData pad;
-
- sceCtrlPeekBufferPositive(&pad, 1); // Peek ignores sleep. Read sleeps thread
-
- bool haveEvent;
-
- memset(&event, 0, sizeof(event));
-
- if (_keyboard->isVisible())
- haveEvent = _keyboard->processInput(event, pad);
- else
- haveEvent = getEvent(event, pad);
+inline void Button::clear() {
+ _key = Common::KEYCODE_INVALID;
+ _ascii = 0;
+ _flag = 0;
+ _pspEventDown.clear();
+ _pspEventUp.clear();
+}
- if (haveEvent) {
- PSP_DEBUG_PRINT("Have event[%s]\n", haveEvent ? "true" : "false");
- PSP_DEBUG_PRINT("event.type[%d]\n", event.type);
+inline bool Button::getEvent(Common::Event &event, PspEvent &pspEvent, bool down) {
+ if (down) {
+ if (!_pspEventDown.isEmpty())
+ pspEvent = _pspEventDown;
+ } else { // up
+ if (!_pspEventUp.isEmpty())
+ pspEvent = _pspEventUp;
+ }
+ if (_key != Common::KEYCODE_INVALID) {
+ event.type = down ? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP;
+ event.kbd.keycode = _key;
+ event.kbd.ascii = _ascii;
+ event.kbd.flags |= _flag;
+ return true;
+ } else if (_flag) { // handle flag only events
+ event.type = down ? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP;
+ event.kbd.flags |= down ? _flag : 0;
+ return true;
}
-
- return haveEvent;
+ return false;
}
-bool InputHandler::getEvent(Common::Event &event, SceCtrlData &pad) {
- DEBUG_ENTER_FUNC();
-
- _buttonsChanged = pad.Buttons ^ _prevButtons;
- bool haveEvent = false;
-
- // Collect events from different sources
- haveEvent = getDpadEvent(event, pad);
-
- if (!haveEvent)
- haveEvent = getButtonEvent(event, pad);
-
- if (!haveEvent)
- haveEvent = getNubEvent(event, pad);
-
- _prevButtons = pad.Buttons;
-
- return haveEvent;
+void Button::setPspEvent(PspEventType typeDown, uint32 dataDown, PspEventType typeUp, uint32 dataUp) {
+ _pspEventDown.type = typeDown;
+ _pspEventDown.data = dataDown;
+ _pspEventUp.type = typeUp;
+ _pspEventUp.data = dataUp;
+}
+
+// Translates bitfields to our constants
+// We put combined bitfields first to make sure we pick up diagonals
+const uint32 ButtonPad::_buttonMap[] = {
+ PSP_CTRL_UP | PSP_CTRL_LEFT,
+ PSP_CTRL_UP | PSP_CTRL_RIGHT,
+ PSP_CTRL_DOWN | PSP_CTRL_RIGHT,
+ PSP_CTRL_DOWN | PSP_CTRL_LEFT,
+ PSP_CTRL_RIGHT, PSP_CTRL_DOWN, PSP_CTRL_LEFT, PSP_CTRL_UP,
+ PSP_CTRL_CROSS, PSP_CTRL_CIRCLE, PSP_CTRL_TRIANGLE, PSP_CTRL_SQUARE,
+ PSP_CTRL_LTRIGGER, PSP_CTRL_RTRIGGER, PSP_CTRL_START, PSP_CTRL_SELECT
+};
+
+ButtonPad::ButtonPad() : _prevButtonState(0), _shifted(UNSHIFTED), _padMode(PAD_MODE_NORMAL),
+ _comboMode(false) {
+ for (int i = UNSHIFTED; i < SHIFTED_MODE_LAST; i++)
+ _buttonsChanged[i] = 0;
+ clearButtons();
}
-bool InputHandler::getDpadEvent(Common::Event &event, SceCtrlData &pad) {
- DEBUG_ENTER_FUNC();
-
- int newDpadX = 0, newDpadY = 0;
- bool haveEvent = false;
-
- if (DOWN(PSP_CTRL_UP)) {
- newDpadY++;
- if (DOWN(PSP_CTRL_RTRIGGER)) // Shifting causes diagonals
- newDpadX++;
- }
- if (DOWN(PSP_CTRL_RIGHT)) {
- newDpadX++;
- if (DOWN(PSP_CTRL_RTRIGGER))
- newDpadY--;
+void ButtonPad::clearButtons() {
+ for (int i = BTN_UP_LEFT; i < BTN_LAST; i++) {
+ _button[i][UNSHIFTED].clear();
+ _button[i][SHIFTED].clear();
}
- if (DOWN(PSP_CTRL_DOWN)) {
- newDpadY--;
- if (DOWN(PSP_CTRL_RTRIGGER))
- newDpadX--;
- }
- if (DOWN(PSP_CTRL_LEFT)) {
- newDpadX--;
- if (DOWN(PSP_CTRL_RTRIGGER))
- newDpadY++;
- }
-
- if (newDpadX != _dpadX || newDpadY != _dpadY) {
- if (_dpadX == 0 && _dpadY == 0) { // We were in the middle so we pressed dpad
- event.type = Common::EVENT_KEYDOWN;
- event.kbd.keycode = translateDpad(newDpadX, newDpadY);
- event.kbd.ascii = event.kbd.keycode - Common::KEYCODE_KP0 + '0'; // Get ascii
- _dpadX = newDpadX;
- _dpadY = newDpadY;
- } else if (newDpadX == 0 && newDpadY == 0) {// We're now centered so we unpressed dpad
- event.type = Common::EVENT_KEYUP;
- event.kbd.keycode = translateDpad(_dpadX, _dpadY);
- event.kbd.ascii = event.kbd.keycode - Common::KEYCODE_KP0 + '0';
- _dpadX = newDpadX;
- _dpadY = newDpadY;
- } else { // we moved from one pressed dpad direction to another one
- event.type = Common::EVENT_KEYUP; // first release the last dpad direction
- event.kbd.keycode = translateDpad(_dpadX, _dpadY);
- event.kbd.ascii = event.kbd.keycode - Common::KEYCODE_KP0 + '0';
- _dpadX = 0; // so that we'll pick up a new dpad movement the next round
- _dpadY = 0;
- }
+}
- PSP_DEBUG_PRINT("Keypad event. DpadX[%d], DpadY[%d]\n", _dpadX, _dpadY);
- haveEvent = true;
+void ButtonPad::initButtons() {
+ switch (_padMode) {
+ case PAD_MODE_NORMAL:
+ initButtonsNormalMode();
+ break;
+ case PAD_MODE_LOL:
+ initButtonsLolMode();
+ break;
+ default:
+ break;
}
-
- return haveEvent;
}
-inline Common::KeyCode InputHandler::translateDpad(int x, int y) {
+void ButtonPad::initButtonsNormalMode() {
DEBUG_ENTER_FUNC();
- Common::KeyCode key;
-
- if (x == -1) {
- if (y == -1)
- key = Common::KEYCODE_KP1;
- else if (y == 0)
- key = Common::KEYCODE_KP4;
- else /* y == 1 */
- key = Common::KEYCODE_KP7;
- } else if (x == 0) {
- if (y == -1)
- key = Common::KEYCODE_KP2;
- else /* y == 1 */
- key = Common::KEYCODE_KP8;
- } else {/* x == 1 */
- if (y == -1)
- key = Common::KEYCODE_KP3;
- else if (y == 0)
- key = Common::KEYCODE_KP6;
- else /* y == 1 */
- key = Common::KEYCODE_KP9;
- }
-
- return key;
+ PSP_DEBUG_PRINT("initializing buttons for normal mode\n");
+ clearButtons();
+
+ // Dpad
+ _button[BTN_UP_LEFT][UNSHIFTED].setKey(Common::KEYCODE_KP7, '7');
+ _button[BTN_LEFT][SHIFTED].setKey(Common::KEYCODE_KP7, '7'); // same as up_left
+ _button[BTN_UP][UNSHIFTED].setKey(Common::KEYCODE_KP8, '8');
+ _button[BTN_UP_RIGHT][UNSHIFTED].setKey(Common::KEYCODE_KP9, '9');
+ _button[BTN_UP][SHIFTED].setKey(Common::KEYCODE_KP9, '9'); // same as up_right
+ _button[BTN_LEFT][UNSHIFTED].setKey(Common::KEYCODE_KP4, '4');
+ _button[BTN_RIGHT][UNSHIFTED].setKey(Common::KEYCODE_KP6, '6');
+ _button[BTN_DOWN_LEFT][UNSHIFTED].setKey(Common::KEYCODE_KP1, '1');
+ _button[BTN_DOWN][SHIFTED].setKey(Common::KEYCODE_KP1, '1'); // same as down_left
+ _button[BTN_DOWN][UNSHIFTED].setKey(Common::KEYCODE_KP2, '2');
+ _button[BTN_DOWN_RIGHT][UNSHIFTED].setKey(Common::KEYCODE_KP3, '3');
+ _button[BTN_RIGHT][SHIFTED].setKey(Common::KEYCODE_KP3, '3'); // same as down_right
+
+ // Other buttons
+ _button[BTN_CROSS][UNSHIFTED].setPspEvent(PSP_EVENT_LBUTTON, true, PSP_EVENT_LBUTTON, false);
+ _button[BTN_CIRCLE][UNSHIFTED].setPspEvent(PSP_EVENT_RBUTTON, true, PSP_EVENT_RBUTTON, false);
+ _button[BTN_TRIANGLE][UNSHIFTED].setKey(Common::KEYCODE_RETURN, '\r');
+ _button[BTN_SQUARE][UNSHIFTED].setKey(Common::KEYCODE_PERIOD, '.');
+ _button[BTN_SQUARE][SHIFTED].setKey(Common::KEYCODE_SPACE, ' ');
+ _button[BTN_LTRIGGER][UNSHIFTED].setKey(Common::KEYCODE_ESCAPE, 27);
+ _button[BTN_RTRIGGER][SHIFTED].setPspEvent(PSP_EVENT_SHIFT, true, PSP_EVENT_SHIFT, false);
+ _button[BTN_RTRIGGER][UNSHIFTED].setPspEvent(PSP_EVENT_SHIFT, true, PSP_EVENT_SHIFT, false);
+ _button[BTN_RTRIGGER][SHIFTED].setKey(Common::KEYCODE_INVALID, 0, Common::KBD_SHIFT);
+ _button[BTN_RTRIGGER][UNSHIFTED].setKey(Common::KEYCODE_INVALID, 0, Common::KBD_SHIFT);
+ _button[BTN_START][SHIFTED].setKey(Common::KEYCODE_F5, Common::ASCII_F5);
+ _button[BTN_START][UNSHIFTED].setKey(Common::KEYCODE_F5, Common::ASCII_F5, Common::KBD_CTRL);
+ _button[BTN_SELECT][UNSHIFTED].setPspEvent(PSP_EVENT_SHOW_VIRTUAL_KB, true, PSP_EVENT_NONE, 0);
+}
+
+void ButtonPad::initButtonsLolMode() {
+ DEBUG_ENTER_FUNC();
+ initButtonsNormalMode(); // set normal button configuration
+ PSP_DEBUG_PRINT("initializing buttons for LOL mode\n");
+
+ // Square is our new shift button
+ _button[BTN_SQUARE][UNSHIFTED].clear();
+ _button[BTN_SQUARE][UNSHIFTED].setPspEvent(PSP_EVENT_SHIFT, true, PSP_EVENT_SHIFT, false);
+ _button[BTN_SQUARE][SHIFTED].clear();
+ _button[BTN_SQUARE][SHIFTED].setPspEvent(PSP_EVENT_SHIFT, true, PSP_EVENT_SHIFT, false);
+
+ // Dpad
+ _button[BTN_LEFT][UNSHIFTED].clear();
+ _button[BTN_LEFT][UNSHIFTED].setKey(Common::KEYCODE_KP7, '7');
+ _button[BTN_LEFT][SHIFTED].clear();
+ _button[BTN_LEFT][SHIFTED].setKey(Common::KEYCODE_F1, Common::ASCII_F1);
+ _button[BTN_UP][SHIFTED].clear();
+ _button[BTN_UP][SHIFTED].setKey(Common::KEYCODE_F2, Common::ASCII_F2);
+ _button[BTN_RIGHT][UNSHIFTED].clear();
+ _button[BTN_RIGHT][UNSHIFTED].setKey(Common::KEYCODE_KP9, '9');
+ _button[BTN_RIGHT][SHIFTED].clear();
+ _button[BTN_RIGHT][SHIFTED].setKey(Common::KEYCODE_F3, Common::ASCII_F3);
+ _button[BTN_DOWN][SHIFTED].clear();
+ _button[BTN_DOWN][SHIFTED].setKey(Common::KEYCODE_F4, Common::ASCII_F4);
+
+ // Buttons
+ _button[BTN_LTRIGGER][UNSHIFTED].clear();
+ _button[BTN_LTRIGGER][SHIFTED].clear();
+ _button[BTN_LTRIGGER][UNSHIFTED].setKey(Common::KEYCODE_KP4, '4'); // Triggers turn
+ _button[BTN_RTRIGGER][UNSHIFTED].clear();
+ _button[BTN_RTRIGGER][SHIFTED].clear();
+ _button[BTN_RTRIGGER][UNSHIFTED].setKey(Common::KEYCODE_KP6, '6');
+ _button[BTN_START][SHIFTED].clear();
+ _button[BTN_START][SHIFTED].setKey(Common::KEYCODE_ESCAPE, 27);
}
-
-bool InputHandler::getButtonEvent(Common::Event &event, SceCtrlData &pad) {
+bool ButtonPad::getEvent(Common::Event &event, PspEvent &pspEvent, SceCtrlData &pad) {
DEBUG_ENTER_FUNC();
- bool haveEvent = false;
+
+ //PSP_DEBUG_PRINT("buttons[%x]\n", pad.Buttons);
+
+ uint32 curButtonState = PSP_ALL_BUTTONS & pad.Buttons; // we only care about these
+
+ modifyButtonsForCombos(pad); // change buttons for combos
+
+ return getEventFromButtonState(event, pspEvent, curButtonState);
+}
- if (PRESSED(PSP_CTRL_SELECT))
- _keyboard->setVisible(true);
-
- else if (CHANGED(PSP_4BUTTONS | PSP_TRIGGERS | PSP_CTRL_START)) {
- if (CHANGED(PSP_CTRL_CROSS)) {
- event.type = DOWN(PSP_CTRL_CROSS) ? Common::EVENT_LBUTTONDOWN : Common::EVENT_LBUTTONUP;
- event.mouse.x = _cursor->getX(); // Could this have to do with SCI enter problem?
- event.mouse.y = _cursor->getY();
- PSP_DEBUG_PRINT("%s\n", event.type == Common::EVENT_LBUTTONDOWN ? "LButtonDown" : "LButtonUp");
- } else if (CHANGED(PSP_CTRL_CIRCLE)) {
- event.type = DOWN(PSP_CTRL_CIRCLE) ? Common::EVENT_RBUTTONDOWN : Common::EVENT_RBUTTONUP;
- event.mouse.x = _cursor->getX();
- event.mouse.y = _cursor->getY();
- PSP_DEBUG_PRINT("%s\n", event.type == Common::EVENT_LBUTTONDOWN ? "RButtonDown" : "RButtonUp");
- } else {
- //any of the other buttons.
- event.type = _buttonsChanged & pad.Buttons ? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP;
- event.kbd.ascii = 0;
- event.kbd.flags = 0;
-
- if (CHANGED(PSP_CTRL_LTRIGGER)) {
- event.kbd.keycode = Common::KEYCODE_ESCAPE;
- event.kbd.ascii = 27;
- } else if (CHANGED(PSP_CTRL_START)) {
- event.kbd.keycode = Common::KEYCODE_F5;
- event.kbd.ascii = Common::ASCII_F5;
- if (DOWN(PSP_CTRL_RTRIGGER)) {
- event.kbd.flags |= Common::KBD_CTRL; // Main menu to allow RTL
+bool ButtonPad::getEventFromButtonState(Common::Event &event, PspEvent &pspEvent, uint32 buttonState) {
+ DEBUG_ENTER_FUNC();
+ _buttonsChanged[_shifted] |= buttonState ^ _prevButtonState; // add any buttons that changed
+ _prevButtonState = buttonState;
+
+ for (int shiftState = UNSHIFTED; shiftState < SHIFTED_MODE_LAST; shiftState++) {
+ if (_buttonsChanged[shiftState]) { // any button to address?
+ PSP_DEBUG_PRINT("found changed buttons\n");
+ ButtonType buttonType = BTN_LAST;
+ bool buttonDown = false; // normally we release a button (as in when we're in a different shiftmode)
+
+ for (int i = BTN_UP_LEFT; i < BTN_LAST; i++) {
+ uint32 buttonCode = _buttonMap[i];
+ if ((_buttonsChanged[shiftState] & buttonCode) == buttonCode) { // check for this changed button
+ buttonType = (ButtonType)i; // we know which button changed
+ _buttonsChanged[shiftState] &= ~buttonCode; // save the fact that we treated this button
+ if (shiftState == _shifted)
+ buttonDown = buttonState & buttonCode ? true : false; // pressed or released?
+
+ PSP_DEBUG_PRINT("button[%i] pressed\n", i);
+ break;
}
- } else if (CHANGED(PSP_CTRL_SQUARE)) {
- event.kbd.keycode = Common::KEYCODE_PERIOD;
- event.kbd.ascii = '.';
- } else if (CHANGED(PSP_CTRL_TRIANGLE)) {
- event.kbd.keycode = Common::KEYCODE_RETURN;
- event.kbd.ascii = '\r';
- } else if (DOWN(PSP_CTRL_RTRIGGER)) { // An event
- event.kbd.flags |= Common::KBD_SHIFT;
}
- PSP_DEBUG_PRINT("Ascii[%d]. Key %s.\n", event.kbd.ascii, event.type == Common::EVENT_KEYDOWN ? "down" : "up");
+
+ assert (buttonType < BTN_LAST);
+ bool haveEvent = _button[buttonType][shiftState].getEvent(event, pspEvent, buttonDown);
+ if (haveEvent)
+ PSP_DEBUG_PRINT("have event. key[%d] flag[%x] %s\n", event.kbd.ascii, event.kbd.flags, buttonDown ? "down" : "up");
+ return haveEvent;
}
-
- haveEvent = true;
- }
-
- return haveEvent;
+ }
+
+ return false;
}
-
-bool InputHandler::getNubEvent(Common::Event &event, SceCtrlData &pad) {
+
+void ButtonPad::modifyButtonsForCombos(SceCtrlData &pad) {
+ if (DOWN(PSP_CTRL_RTRIGGER | PSP_CTRL_LTRIGGER)) {
+ if (!_comboMode) { // we're entering combo mode
+ PSP_DEBUG_PRINT("entering combo mode\n");
+ _button[BTN_SQUARE][UNSHIFTED].clear();
+ _button[BTN_SQUARE][SHIFTED].clear();
+ _button[BTN_DOWN][SHIFTED].clear();
+ _button[BTN_DOWN][UNSHIFTED].clear();
+ _button[BTN_UP][SHIFTED].clear();
+ _button[BTN_UP][UNSHIFTED].clear();
+ _button[BTN_SQUARE][UNSHIFTED].setPspEvent(PSP_EVENT_MODE_SWITCH, true, PSP_EVENT_NONE, true);
+ _button[BTN_SQUARE][SHIFTED].setPspEvent(PSP_EVENT_MODE_SWITCH, true, PSP_EVENT_NONE, true);
+ _button[BTN_DOWN][UNSHIFTED].setPspEvent(PSP_EVENT_CHANGE_SPEED, false, PSP_EVENT_NONE, true);
+ _button[BTN_DOWN][SHIFTED].setPspEvent(PSP_EVENT_CHANGE_SPEED, false, PSP_EVENT_NONE, true);
+ _button[BTN_UP][UNSHIFTED].setPspEvent(PSP_EVENT_CHANGE_SPEED, true, PSP_EVENT_NONE, true);
+ _button[BTN_UP][SHIFTED].setPspEvent(PSP_EVENT_CHANGE_SPEED, true, PSP_EVENT_NONE, true);
+ _comboMode = true;
+ }
+ } else { // no combo buttons are pressed now
+ if (_comboMode) { // we have been running in combo mode
+ initButtons(); // reset the button configuration
+ _comboMode = false;
+ }
+ }
+}
+
+bool Nub::getEvent(Common::Event &event, PspEvent &pspEvent, SceCtrlData &pad) {
DEBUG_ENTER_FUNC();
-
- bool haveEvent = false;
+
+ if (_dpadMode) { // Convert the nub to a D-Pad
+ uint32 buttonState;
+ translateToDpadState(pad.Lx, pad.Ly, buttonState);
+ return _buttonPad.getEventFromButtonState(event, pspEvent, buttonState);
+ }
+
int32 analogStepX = pad.Lx; // Goes up to 255.
int32 analogStepY = pad.Ly;
- int32 oldX = _cursor->getX();
- int32 oldY = _cursor->getY();
-
analogStepX = modifyNubAxisMotion(analogStepX);
analogStepY = modifyNubAxisMotion(analogStepY);
+
+ int32 oldX = _cursor->getX();
+ int32 oldY = _cursor->getY();
if (analogStepX != 0 || analogStepY != 0) {
PSP_DEBUG_PRINT("raw x[%d], y[%d]\n", analogStepX, analogStepY);
// If no movement then this has no effect
- if (DOWN(PSP_CTRL_RTRIGGER)) {
+ if (_shifted) {
// Fine control mode for analog
if (analogStepX != 0) {
if (analogStepX > 0)
@@ -281,15 +315,29 @@ bool InputHandler::getNubEvent(Common::Event &event, SceCtrlData &pad) {
event.type = Common::EVENT_MOUSEMOVE;
event.mouse.x = newX;
event.mouse.y = newY;
- haveEvent = true;
-
PSP_DEBUG_PRINT("Nub event. X[%d], Y[%d]\n", newX, newY);
+ return true;
}
}
- return haveEvent;
+ return false;
+}
+
+void Nub::translateToDpadState(int dpadX, int dpadY, uint32 &buttonState) {
+ #define MIN_NUB_POSITION 70
+ buttonState = 0;
+
+ if (dpadX > 127 + MIN_NUB_POSITION)
+ buttonState |= PSP_CTRL_RIGHT;
+ else if (dpadX < 127 - MIN_NUB_POSITION)
+ buttonState |= PSP_CTRL_LEFT;
+
+ if (dpadY > 127 + MIN_NUB_POSITION)
+ buttonState |= PSP_CTRL_DOWN;
+ else if (dpadY < 127 - MIN_NUB_POSITION)
+ buttonState |= PSP_CTRL_UP;
}
-inline int32 InputHandler::modifyNubAxisMotion(int32 input) {
+inline int32 Nub::modifyNubAxisMotion(int32 input) {
DEBUG_ENTER_FUNC();
const int MIN_NUB_MOTION = 30;
@@ -304,3 +352,160 @@ inline int32 InputHandler::modifyNubAxisMotion(int32 input) {
return input;
}
+
+inline bool Nub::isButtonDown() {
+ if (_dpadMode) // only relevant in dpad mode
+ return _buttonPad.isButtonDown();
+ return false;
+}
+
+const char *InputHandler::_padModeText[] = {
+ "Normal Button Mode",
+ "1st Person RPG Button Mode"
+};
+
+void InputHandler::init() {
+ sceCtrlSetSamplingCycle(0); // set sampling to vsync. n = n usecs
+ sceCtrlSetSamplingMode(1); // analog
+
+ _buttonPad.initButtons();
+}
+
+bool InputHandler::getAllInputs(Common::Event &event) {
+ DEBUG_ENTER_FUNC();
+
+ uint32 time = g_system->getMillis(); // may not be necessary with read
+ if (time - _lastPadCheckTime < PAD_CHECK_TIME) {
+ return false;
+ }
+
+ _lastPadCheckTime = time;
+ SceCtrlData pad;
+
+ sceCtrlPeekBufferPositive(&pad, 1); // Peek doesn't sleep. Read sleeps the thread
+
+ bool haveEvent;
+ //memset(&event, 0, sizeof(event));
+
+ haveEvent = getEvent(event, pad);
+
+ if (haveEvent) {
+ PSP_DEBUG_PRINT("Have event[%s]. Type[%d]\n", haveEvent ? "true" : "false", event.type);
+ }
+
+ return haveEvent;
+}
+
+bool InputHandler::getEvent(Common::Event &event, SceCtrlData &pad) {
+ DEBUG_ENTER_FUNC();
+
+ PspEvent pspEvent;
+ bool haveEvent = false;
+
+ if (_keyboard->isVisible()) {
+ haveEvent = _keyboard->processInput(event, pspEvent, pad);
+ } else { // only process buttonpad if keyboard invisible
+ haveEvent = _buttonPad.getEvent(event, pspEvent, pad);
+ }
+
+ if (!haveEvent && pspEvent.isEmpty())
+ haveEvent = _nub.getEvent(event, pspEvent, pad);
+
+ // handle any pending PSP events
+ if (!haveEvent && pspEvent.isEmpty()) {
+ if (!_pendingPspEvent.isEmpty()) {
+ pspEvent = _pendingPspEvent;
+ _pendingPspEvent.clear();
+ }
+ }
+
+ // handle any PSP events we might have
+ if (!pspEvent.isEmpty())
+ haveEvent |= handlePspEvent(event, pspEvent); // overrides any event we might have
+
+ return haveEvent;
+}
+
+bool InputHandler::handlePspEvent(Common::Event &event, PspEvent &pspEvent) {
+ bool haveEvent = false;
+
+ PSP_DEBUG_PRINT("have pspEvent[%d] data[%d]\n", pspEvent.type, pspEvent.data);
+
+ switch (pspEvent.type) {
+ case PSP_EVENT_SHIFT:
+ handleShiftEvent((ShiftMode)pspEvent.data);
+ break;
+ case PSP_EVENT_SHOW_VIRTUAL_KB:
+ _keyboard->setVisible((bool)pspEvent.data);
+ if ((pspEvent.data && _keyboard->isVisible()) || !pspEvent.data) // don't change mode if keyboard didn't load
+ _nub.setDpadMode((bool)pspEvent.data); // set nub to keypad/regular mode
+ break;
+ case PSP_EVENT_LBUTTON:
+ haveEvent = true;
+ if (pspEvent.data) // down
+ handleMouseEvent(event, Common::EVENT_LBUTTONDOWN, "LButtonDown");
+ else
+ handleMouseEvent(event, Common::EVENT_LBUTTONUP, "LButtonUp");
+ break;
+ case PSP_EVENT_RBUTTON:
+ haveEvent = true;
+ if (pspEvent.data) // down
+ handleMouseEvent(event, Common::EVENT_RBUTTONDOWN, "RButtonDown");
+ else
+ handleMouseEvent(event, Common::EVENT_RBUTTONUP, "RButtonUp");
+ break;
+ case PSP_EVENT_MODE_SWITCH:
+ handleModeSwitchEvent();
+ break;
+ /*case PSP_EVENT_CHANGE_SPEED:
+ handleSpeedChange(pspEvent.data);
+ break;*/
+ default:
+ PSP_ERROR("Unhandled PSP Event[%d]\n", pspEvent.type);
+ break;
+ }
+
+ return haveEvent;
+}
+
+void InputHandler::handleMouseEvent(Common::Event &event, Common::EventType type, const char *string) {
+ event.type = type;
+ event.mouse.x = _cursor->getX();
+ event.mouse.y = _cursor->getY();
+ PSP_DEBUG_PRINT("%s event, x[%d], y[%d]\n", string, event.mouse.x, event.mouse.y);
+}
+
+void InputHandler::handleShiftEvent(ShiftMode shifted) {
+ _buttonPad.setShifted(shifted);
+ _nub.setShifted(shifted);
+}
+
+void InputHandler::handleModeSwitchEvent() {
+ // check if we can't switch modes right now
+ if (_buttonPad.isButtonDown() || _nub.isButtonDown()) { // can't switch yet
+ PSP_DEBUG_PRINT("postponing mode switch event\n");
+ _pendingPspEvent.type = PSP_EVENT_MODE_SWITCH; // queue it to be done later
+ } else { // we can switch
+ PSP_DEBUG_PRINT("mode switch event\n");
+ _padMode = (PspPadMode)(_padMode + 1);
+ if (_padMode >= PAD_MODE_LAST)
+ _padMode = PAD_MODE_NORMAL;
+
+ GUI::TimedMessageDialog dialog(_padModeText[_padMode], 1500);
+ dialog.runModal();
+
+ _buttonPad.setPadMode(_padMode);
+ _buttonPad.initButtons();
+ }
+}
+
+/*
+void InputHandler::handleSpeedChange(bool up) {
+ char *dialogMsg;
+
+ if (up) {
+ dialogMsg = "
+
+ GUI::TimedMessageDialog dialog(_padModeText[_padMode], 1500);
+ dialog.runModal();
+}*/
diff --git a/backends/platform/psp/input.h b/backends/platform/psp/input.h
index cd686d9e02..6991c50533 100644
--- a/backends/platform/psp/input.h
+++ b/backends/platform/psp/input.h
@@ -28,36 +28,154 @@
#include "common/scummsys.h"
#include "common/events.h"
-#include "backends/platform/psp/display_client.h"
-#include "backends/platform/psp/default_display_client.h"
#include "backends/platform/psp/pspkeyboard.h"
#include "backends/platform/psp/cursor.h"
#include
-class InputHandler {
+enum PspEventType {
+ PSP_EVENT_NONE = 0,
+ PSP_EVENT_SHIFT,
+ PSP_EVENT_SHOW_VIRTUAL_KB,
+ PSP_EVENT_LBUTTON,
+ PSP_EVENT_RBUTTON,
+ PSP_EVENT_MODE_SWITCH,
+ PSP_EVENT_CHANGE_SPEED,
+ PSP_EVENT_LAST
+};
+
+
+struct PspEvent {
+ PspEventType type;
+ uint32 data;
+ PspEvent() { clear(); }
+ void clear() {
+ type = PSP_EVENT_NONE;
+ data = 0;
+ }
+ bool isEmpty() { return type == PSP_EVENT_NONE; }
+};
+
+enum PspPadMode {
+ PAD_MODE_NORMAL,
+ PAD_MODE_LOL,
+ PAD_MODE_LAST
+};
+
+enum ShiftMode {
+ UNSHIFTED = 0,
+ SHIFTED = 1,
+ SHIFTED_MODE_LAST
+};
+
+
+class Button {
+private:
+ Common::KeyCode _key;
+ uint32 _ascii;
+ uint32 _flag;
+ PspEvent _pspEventDown; // event when we press
+ PspEvent _pspEventUp; // event when we release
+public:
+ Button();
+ void clear();
+ bool getEvent(Common::Event &event, PspEvent &pspEvent, bool buttonDown);
+ void setKey(Common::KeyCode key, uint32 ascii = 0, uint32 flag = 0) { _key = key; _ascii = ascii; _flag = flag; }
+ void setPspEvent(PspEventType typeDown, uint32 dataDown, PspEventType typeUp, uint32 dataUp);
+};
+
+class ButtonPad {
public:
- InputHandler() : _cursor(0), _keyboard(0), _prevButtons(0), _lastPadCheckTime(0), _buttonsChanged(0), _dpadX(0), _dpadY(0) {}
+ enum ButtonType { // must match the buttonMap
+ BTN_UP_LEFT,
+ BTN_UP_RIGHT,
+ BTN_DOWN_RIGHT,
+ BTN_DOWN_LEFT,
+ BTN_RIGHT,
+ BTN_DOWN,
+ BTN_LEFT,
+ BTN_UP,
+ BTN_CROSS,
+ BTN_CIRCLE,
+ BTN_TRIANGLE,
+ BTN_SQUARE,
+ BTN_LTRIGGER,
+ BTN_RTRIGGER,
+ BTN_START,
+ BTN_SELECT,
+ BTN_LAST
+ };
- void init();
- bool getAllInputs(Common::Event &event);
- void setKeyboard(PSPKeyboard *keyboard) { _keyboard = keyboard; }
- void setCursor(Cursor *cursor) { _cursor = cursor; }
+private:
+ Button _button[BTN_LAST][SHIFTED_MODE_LAST];
+ uint32 _buttonsChanged[SHIFTED_MODE_LAST]; // normal and shifted
+ uint32 _prevButtonState;
+ ShiftMode _shifted;
+ PspPadMode _padMode;
+ bool _comboMode; // are we in the middle of combos
+ static const uint32 _buttonMap[]; // maps the buttons to their values
+ void initButtonsNormalMode();
+ void initButtonsLolMode();
+ void modifyButtonsForCombos(SceCtrlData &pad);
+ void clearButtons();
+
+public:
+ ButtonPad();
+ bool getEvent(Common::Event &event, PspEvent &pspEvent, SceCtrlData &pad);
+ bool getEventFromButtonState(Common::Event &event, PspEvent &pspEvent, uint32 buttonState);
+ void setShifted(ShiftMode shifted) { _shifted = shifted; }
+ void setPadMode(PspPadMode mode) { _padMode = mode; }
+ bool isButtonDown() { return _prevButtonState; }
+ void initButtons();
+};
+
+class Nub {
+private:
+ Cursor *_cursor; // to enable changing/getting cursor position
+
+ ButtonPad _buttonPad; // private buttonpad for dpad mode
+ ShiftMode _shifted;
+ bool _dpadMode;
+
+public:
+ Nub() : _shifted(UNSHIFTED), _dpadMode(false) { _buttonPad.initButtons(); }
+
+ void setCursor(Cursor *cursor) { _cursor = cursor; }
+ void setDpadMode(bool active) { _dpadMode = active; }
+ void setShifted(ShiftMode shifted) { _shifted = shifted; }
+ bool isButtonDown();
+
+ bool getEvent(Common::Event &event, PspEvent &pspEvent, SceCtrlData &pad);
+ int32 modifyNubAxisMotion(int32 input);
+ void translateToDpadState(int dpadX, int dpadY, uint32 &buttonState); // convert nub data to dpad data
+};
+
+class InputHandler {
+public:
+ InputHandler() : _keyboard(0), _cursor(0), _padMode(PAD_MODE_NORMAL), _lastPadCheckTime(0) {}
+ void setKeyboard(PSPKeyboard *keyboard) { _keyboard = keyboard; }
+ void setCursor(Cursor *cursor) { _cursor = cursor; _nub.setCursor(cursor); }
+
+ void init();
+ bool getAllInputs(Common::Event &event);
+
private:
- Cursor *_cursor;
PSPKeyboard *_keyboard;
- uint32 _prevButtons;
+ Cursor *_cursor;
+
+ Nub _nub;
+ ButtonPad _buttonPad;
+
+ PspPadMode _padMode; // whice mode we're in
+ PspEvent _pendingPspEvent; // an event that can't be handled yet
uint32 _lastPadCheckTime;
- uint32 _buttonsChanged;
- int32 _dpadX, _dpadY;
- int32 _accelX, _accelY;
+ static const char *_padModeText[];
bool getEvent(Common::Event &event, SceCtrlData &pad);
- bool getDpadEvent(Common::Event &event, SceCtrlData &pad);
- bool getButtonEvent(Common::Event &event, SceCtrlData &pad);
- bool getNubEvent(Common::Event &event, SceCtrlData &pad);
- int32 modifyNubAxisMotion(int32 input);
- Common::KeyCode translateDpad(int x, int y);
+ bool handlePspEvent(Common::Event &event, PspEvent &pspEvent);
+ void handleMouseEvent(Common::Event &event, Common::EventType type, const char *string);
+ void handleShiftEvent(ShiftMode shifted);
+ void handleModeSwitchEvent();
};
#endif /* PSP_INPUT_H */
diff --git a/backends/platform/psp/pspkeyboard.cpp b/backends/platform/psp/pspkeyboard.cpp
index eb081fc5f4..b83b1c873a 100644
--- a/backends/platform/psp/pspkeyboard.cpp
+++ b/backends/platform/psp/pspkeyboard.cpp
@@ -26,7 +26,7 @@
//#define PSP_KB_SHELL /* Need a hack to properly load the keyboard from the PSP shell */
#ifdef PSP_KB_SHELL
-#define PSP_KB_SHELL_PATH "ms0:/psp/game4xx/scummvm-solid/" /* path to kbd.zip */
+#define PSP_KB_SHELL_PATH "ms0:/psp/game5xx/scummvm-solid/" /* path to kbd.zip */
#endif
@@ -36,6 +36,7 @@
#include "backends/platform/psp/psppixelformat.h"
#include "backends/platform/psp/pspkeyboard.h"
+#include "backends/platform/psp/input.h"
#include "common/keyboard.h"
#include "common/fs.h"
#include "common/unzip.h"
@@ -508,10 +509,11 @@ int PSPKeyboard::loadPngImage(Common::SeekableReadStream *file, Buffer &buffer,
* Uses the state machine.
* returns whether we have an event
*/
-bool PSPKeyboard::processInput(Common::Event &event, SceCtrlData &pad) {
+bool PSPKeyboard::processInput(Common::Event &event, PspEvent &pspEvent, SceCtrlData &pad) {
DEBUG_ENTER_FUNC();
bool haveEvent = false; // Whether we have an event for the event manager to process
+ bool havePspEvent = false;
event.kbd.flags = 0;
_buttonsChanged = _prevButtons ^ pad.Buttons;
@@ -529,12 +531,12 @@ bool PSPKeyboard::processInput(Common::Event &event, SceCtrlData &pad) {
event.type = DOWN(PSP_CTRL_START) ? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP;
haveEvent = true;
_dirty = true;
- if (UP(PSP_CTRL_START))
- _state = kInvisible; // Make us invisible if unpressed
+ if (UP(PSP_CTRL_START))
+ havePspEvent = true;
}
// Check for being in state of moving the keyboard onscreen or pressing select
else if (_state == kMove)
- handleMoveState(pad);
+ havePspEvent = handleMoveState(pad);
else if (_state == kDefault)
haveEvent = handleDefaultState(event, pad);
else if (_state == kCornersSelected)
@@ -544,12 +546,16 @@ bool PSPKeyboard::processInput(Common::Event &event, SceCtrlData &pad) {
else if (_state == kLTriggerDown)
handleLTriggerDownState(pad); // Deal with trigger states
+ if (havePspEvent) {
+ pspEvent.type = PSP_EVENT_SHOW_VIRTUAL_KB; // tell the input handler we're off
+ pspEvent.data = false;
+ }
_prevButtons = pad.Buttons;
return haveEvent;
}
-void PSPKeyboard::handleMoveState(SceCtrlData &pad) {
+bool PSPKeyboard::handleMoveState(SceCtrlData &pad) {
DEBUG_ENTER_FUNC();
if (UP(PSP_CTRL_SELECT)) {
// Toggle between visible and invisible
@@ -560,6 +566,9 @@ void PSPKeyboard::handleMoveState(SceCtrlData &pad) {
_state = kDefault;
_moved = false; // reset moved flag
}
+ if (_state == kInvisible) {
+ return true; // we become invisible
+ }
} else if (DOWN(PSP_DPAD)) { // How we move the KB onscreen
_moved = true;
_dirty = true;
@@ -573,6 +582,7 @@ void PSPKeyboard::handleMoveState(SceCtrlData &pad) {
else /* DOWN(PSP_CTRL_RIGHT) */
increaseKeyboardLocationX(5);
}
+ return false;
}
bool PSPKeyboard::handleDefaultState(Common::Event &event, SceCtrlData &pad) {
diff --git a/backends/platform/psp/pspkeyboard.h b/backends/platform/psp/pspkeyboard.h
index a30e7d0f32..1bd394c15a 100644
--- a/backends/platform/psp/pspkeyboard.h
+++ b/backends/platform/psp/pspkeyboard.h
@@ -29,12 +29,15 @@
#include "common/events.h"
#include "common/stream.h"
#include "backends/platform/psp/display_client.h"
+//#include "backends/platform/psp/input.h"
#include
//number of modes
#define MODE_COUNT 4
#define guiStringsSize 8 /* size of guistrings array */
+class PspEvent;
+
class PSPKeyboard : public DisplayClient {
private:
@@ -58,10 +61,9 @@ public:
void setClean() { _dirty = false; }
bool isVisible() const { return _state != kInvisible; } // Check if visible
void setVisible(bool val);
- bool processInput(Common::Event &event, SceCtrlData &pad); // Process input
+ bool processInput(Common::Event &event, PspEvent &pspEvent, SceCtrlData &pad); // Process input
void moveTo(const int newX, const int newY); // Move keyboard
void render(); // Draw the keyboard onscreen
-
private:
enum CursorDirections {
kUp = 0,
@@ -82,7 +84,7 @@ private:
void increaseKeyboardLocationY(int amount);
void convertCursorToXY(CursorDirections cur, int &x, int &y);
- void handleMoveState(SceCtrlData &pad);
+ bool handleMoveState(SceCtrlData &pad);
bool handleDefaultState(Common::Event &event, SceCtrlData &pad);
bool handleCornersSelectedState(Common::Event &event, SceCtrlData &pad);
bool getInputChoice(Common::Event &event, SceCtrlData &pad);
--
cgit v1.2.3
From 178c46c0388c76bd46515aa4d37f681105dafa1e Mon Sep 17 00:00:00 2001
From: Yotam Barnoy
Date: Sun, 10 Oct 2010 08:30:18 +0000
Subject: PSP: factored PngLoader out of virtual keyboard for further use
svn-id: r53108
---
backends/platform/psp/Makefile | 1 +
backends/platform/psp/module.mk | 1 +
backends/platform/psp/png_loader.cpp | 187 ++++++++++++++++++++++++++++++++++
backends/platform/psp/png_loader.h | 70 +++++++++++++
backends/platform/psp/pspkeyboard.cpp | 183 ++-------------------------------
backends/platform/psp/pspkeyboard.h | 3 -
6 files changed, 270 insertions(+), 175 deletions(-)
create mode 100644 backends/platform/psp/png_loader.cpp
create mode 100644 backends/platform/psp/png_loader.h
(limited to 'backends/platform')
diff --git a/backends/platform/psp/Makefile b/backends/platform/psp/Makefile
index 617ef7c8cc..b9a2b45013 100644
--- a/backends/platform/psp/Makefile
+++ b/backends/platform/psp/Makefile
@@ -148,6 +148,7 @@ OBJS := powerman.o \
thread.o \
rtc.o \
mp3.o \
+ png_loader.o \
tests.o
BACKEND := psp
diff --git a/backends/platform/psp/module.mk b/backends/platform/psp/module.mk
index 4652189ab4..f96c4ef583 100644
--- a/backends/platform/psp/module.mk
+++ b/backends/platform/psp/module.mk
@@ -17,6 +17,7 @@ MODULE_OBJS := powerman.o \
thread.o \
rtc.o \
mp3.o \
+ png_loader.o \
tests.o
# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
diff --git a/backends/platform/psp/png_loader.cpp b/backends/platform/psp/png_loader.cpp
new file mode 100644
index 0000000000..417c502e54
--- /dev/null
+++ b/backends/platform/psp/png_loader.cpp
@@ -0,0 +1,187 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "common/scummsys.h"
+#include "common/stream.h"
+#include "backends/platform/psp/psppixelformat.h"
+#include "backends/platform/psp/display_client.h"
+#include "backends/platform/psp/png_loader.h"
+
+PngLoader::Status PngLoader::allocate() {
+ if (!findImageDimensions()) {
+ PSP_ERROR("failed to get image dimensions\n");
+ return BAD_FILE;
+ }
+
+ PSP_DEBUG_PRINT("width[%d], height[%d], paletteSize[%d], bitDepth[%d]\n", _width, _height, _paletteSize, _bitDepth);
+ _buffer->setSize(_width, _height, _sizeBy);
+
+ if (_paletteSize) { // 8 or 4-bit image
+ if (_paletteSize <= 16) { // 4 bit
+ _buffer->setPixelFormat(PSPPixelFormat::Type_Palette_4bit);
+ _palette->setPixelFormats(PSPPixelFormat::Type_4444, PSPPixelFormat::Type_Palette_4bit);
+ _paletteSize = 16;
+ } else if (_paletteSize <= 256) { // 8-bit image
+ _paletteSize = 256;
+ _buffer->setPixelFormat(PSPPixelFormat::Type_Palette_8bit);
+ _palette->setPixelFormats(PSPPixelFormat::Type_4444, PSPPixelFormat::Type_Palette_8bit);
+ } else {
+ PSP_ERROR("palette of %d too big!\n", _paletteSize);
+ return BAD_FILE;
+ }
+
+ } else { // 32-bit image
+ _buffer->setPixelFormat(PSPPixelFormat::Type_8888);
+ }
+
+ if (!_buffer->allocate()) {
+ PSP_ERROR("failed to allocate buffer\n");
+ return OUT_OF_MEMORY;
+ }
+ if (!_palette->allocate()) {
+ PSP_ERROR("failed to allocate palette\n");
+ return OUT_OF_MEMORY;
+ }
+ return OK;
+}
+
+bool PngLoader::load() {
+ // Try to load the image
+ _file->seek(0); // Go back to start
+
+ if (!loadImageIntoBuffer()) {
+ PSP_DEBUG_PRINT("failed to load image\n");
+ return false;
+ }
+
+ PSP_DEBUG_PRINT("succeded in loading image\n");
+
+ if (_paletteSize == 16) // 4-bit
+ _buffer->flipNibbles(); // required because of PNG 4-bit format
+ return true;
+}
+
+void PngLoader::warningFn(png_structp png_ptr, png_const_charp warning_msg) {
+ // ignore PNG warnings
+}
+
+// Read function for png library to be able to read from our SeekableReadStream
+//
+void PngLoader::libReadFunc(png_structp pngPtr, png_bytep data, png_size_t length) {
+ Common::SeekableReadStream *file;
+
+ file = (Common::SeekableReadStream *)pngPtr->io_ptr;
+
+ file->read(data, length);
+}
+
+bool PngLoader::basicImageLoad() {
+ _pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+ if (!_pngPtr)
+ return false;
+
+ png_set_error_fn(_pngPtr, (png_voidp) NULL, (png_error_ptr) NULL, warningFn);
+
+ _infoPtr = png_create_info_struct(_pngPtr);
+ if (!_infoPtr) {
+ png_destroy_read_struct(&_pngPtr, png_infopp_NULL, png_infopp_NULL);
+ return false;
+ }
+ // Set the png lib to use our read function
+ png_set_read_fn(_pngPtr, (void *)_file, libReadFunc);
+
+ unsigned int sig_read = 0;
+
+ png_set_sig_bytes(_pngPtr, sig_read);
+ png_read_info(_pngPtr, _infoPtr);
+ int interlaceType;
+ png_get_IHDR(_pngPtr, _infoPtr, (png_uint_32 *)&_width, (png_uint_32 *)&_height, &_bitDepth,
+ &_colorType, &interlaceType, int_p_NULL, int_p_NULL);
+
+ if (_colorType & PNG_COLOR_MASK_PALETTE)
+ _paletteSize = _infoPtr->num_palette;
+
+ return true;
+}
+
+/* Get the width and height of a png image */
+bool PngLoader::findImageDimensions() {
+ DEBUG_ENTER_FUNC();
+
+ if (!basicImageLoad())
+ return false;
+
+ png_destroy_read_struct(&_pngPtr, &_infoPtr, png_infopp_NULL);
+ return true;
+}
+
+//
+// Load a texture from a png image
+//
+bool PngLoader::loadImageIntoBuffer() {
+ DEBUG_ENTER_FUNC();
+
+ if (!basicImageLoad())
+ return false;
+
+ // Strip off 16 bit channels. Not really needed but whatever
+ png_set_strip_16(_pngPtr);
+
+ if (_paletteSize) {
+ // Copy the palette
+ png_colorp srcPal = _infoPtr->palette;
+ for (int i = 0; i < (int)_paletteSize; i++) {
+ unsigned char alphaVal = (i < _infoPtr->num_trans) ? _infoPtr->trans[i] : 0xFF; // Load alpha if it's there
+ _palette->setSingleColorRGBA(i, srcPal->red, srcPal->green, srcPal->blue, alphaVal);
+ srcPal++;
+ }
+ } else { // Not a palettized image
+ if (_colorType == PNG_COLOR_TYPE_GRAY && _bitDepth < 8)
+ png_set_gray_1_2_4_to_8(_pngPtr); // Round up grayscale images
+ if (png_get_valid(_pngPtr, _infoPtr, PNG_INFO_tRNS))
+ png_set_tRNS_to_alpha(_pngPtr); // Convert trans channel to alpha for 32 bits
+
+ png_set_filler(_pngPtr, 0xff, PNG_FILLER_AFTER); // Filler for alpha?
+ }
+
+ unsigned char *line = (unsigned char*) malloc(_infoPtr->rowbytes);
+ if (!line) {
+ png_destroy_read_struct(&_pngPtr, png_infopp_NULL, png_infopp_NULL);
+ PSP_ERROR("Couldn't allocate line\n");
+ return false;
+ }
+
+ for (size_t y = 0; y < _height; y++) {
+ png_read_row(_pngPtr, line, png_bytep_NULL);
+ _buffer->copyFromRect(line, _infoPtr->rowbytes, 0, y, _width, 1); // Copy into buffer
+ }
+
+ free(line);
+
+ png_read_end(_pngPtr, _infoPtr);
+ png_destroy_read_struct(&_pngPtr, &_infoPtr, png_infopp_NULL);
+
+ return true;
+}
diff --git a/backends/platform/psp/png_loader.h b/backends/platform/psp/png_loader.h
new file mode 100644
index 0000000000..5f2064bf96
--- /dev/null
+++ b/backends/platform/psp/png_loader.h
@@ -0,0 +1,70 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef PSP_PNG_IMAGE_H
+#define PSP_PNG_IMAGE_H
+
+#include
+
+class PngLoader {
+private:
+ bool basicImageLoad(); // common operation
+ bool findImageDimensions(); // find dimensions of a given PNG file
+ bool loadImageIntoBuffer();
+
+ static void warningFn(png_structp png_ptr, png_const_charp warning_msg);
+ static void libReadFunc(png_structp pngPtr, png_bytep data, png_size_t length);
+
+ Common::SeekableReadStream *_file;
+ Buffer *_buffer;
+ Palette *_palette;
+
+ uint32 _width;
+ uint32 _height;
+ uint32 _paletteSize;
+ int _bitDepth;
+ Buffer::HowToSize _sizeBy;
+ png_structp _pngPtr;
+ png_infop _infoPtr;
+ int _colorType;
+
+public:
+ enum Status {
+ OK,
+ OUT_OF_MEMORY,
+ BAD_FILE
+ };
+
+ PngLoader(Common::SeekableReadStream *file, Buffer &buffer, Palette &palette,
+ Buffer::HowToSize sizeBy = Buffer::kSizeByTextureSize) :
+ _file(file), _buffer(&buffer), _palette(&palette),
+ _width(0), _height(0), _paletteSize(0),
+ _bitDepth(0), _sizeBy(sizeBy), _pngPtr(0), _infoPtr(0), _colorType(0) {}
+
+ PngLoader::Status allocate();
+ bool load();
+};
+
+#endif /* PSP_PNG_IMAGE_H */
diff --git a/backends/platform/psp/pspkeyboard.cpp b/backends/platform/psp/pspkeyboard.cpp
index b83b1c873a..be084d4d38 100644
--- a/backends/platform/psp/pspkeyboard.cpp
+++ b/backends/platform/psp/pspkeyboard.cpp
@@ -32,10 +32,10 @@
#include
#include
-#include
#include "backends/platform/psp/psppixelformat.h"
#include "backends/platform/psp/pspkeyboard.h"
+#include "backends/platform/psp/png_loader.h"
#include "backends/platform/psp/input.h"
#include "common/keyboard.h"
#include "common/fs.h"
@@ -92,16 +92,6 @@ short PSPKeyboard::_modeChar[MODE_COUNT][5][6] = {
}
};
-// Read function for png library to be able to read from our SeekableReadStream
-//
-void pngReadStreamRead(png_structp png_ptr, png_bytep data, png_size_t length) {
- Common::SeekableReadStream *file;
-
- file = (Common::SeekableReadStream *)png_ptr->io_ptr;
-
- file->read(data, length);
-}
-
// Array with file names
const char *PSPKeyboard::_guiStrings[] = {
"keys4.png", "keys_s4.png",
@@ -282,8 +272,6 @@ bool PSPKeyboard::load() {
// Loop through all png images
for (i = 0; i < guiStringsSize; i++) {
- uint32 height = 0, width = 0, paletteSize = 0;
-
PSP_DEBUG_PRINT("Opening %s.\n", _guiStrings[i]);
// Look for the file in the kbd directory
@@ -310,49 +298,18 @@ bool PSPKeyboard::load() {
goto ERROR;
}
- if (getPngImageSize(file, &width, &height, &paletteSize) == 0) { // Check image size and palette size
- // Allocate memory for image
- PSP_DEBUG_PRINT("width[%d], height[%d], paletteSize[%d]\n", width, height, paletteSize);
- _buffers[i].setSize(width, height, Buffer::kSizeByTextureSize);
-
- if (paletteSize) { // 8 or 4-bit image
- if (paletteSize <= 16) { // 4 bit
- _buffers[i].setPixelFormat(PSPPixelFormat::Type_Palette_4bit);
- _palettes[i].setPixelFormats(PSPPixelFormat::Type_4444, PSPPixelFormat::Type_Palette_4bit);
- paletteSize = 16;
- } else if (paletteSize <= 256) { // 8-bit image
- paletteSize = 256;
- _buffers[i].setPixelFormat(PSPPixelFormat::Type_Palette_8bit);
- _palettes[i].setPixelFormats(PSPPixelFormat::Type_4444, PSPPixelFormat::Type_Palette_8bit);
- } else {
- PSP_ERROR("palette of %d too big!\n", paletteSize);
- goto ERROR;
- }
-
- } else { // 32-bit image
- _buffers[i].setPixelFormat(PSPPixelFormat::Type_8888);
- }
-
- _buffers[i].allocate();
- _palettes[i].allocate();
-
- // Try to load the image
- file->seek(0); // Go back to start
-
- if (loadPngImage(file, _buffers[i], _palettes[i]) != 0)
- goto ERROR;
- else { // Success
- PSP_DEBUG_PRINT("Managed to load the image\n");
-
- if (paletteSize == 16) // 4-bit
- _buffers[i].flipNibbles();
-
- delete file;
- }
- } else {
- PSP_ERROR("couldn't obtain PNG image size\n");
+ PngLoader image(file, _buffers[i], _palettes[i]);
+
+ if (image.allocate() != PngLoader::OK) {
+ PSP_ERROR("Failed to allocate memory for keyboard image %s\n", _guiStrings[i]);
+ goto ERROR;
+ }
+ if (!image.load()) {
+ PSP_ERROR("Failed to load image from file %s\n", _guiStrings[i]);
goto ERROR;
}
+
+ delete file;
} /* for loop */
_init = true;
@@ -377,124 +334,6 @@ ERROR:
return false;
}
-static void user_warning_fn(png_structp png_ptr, png_const_charp warning_msg) {
- // ignore PNG warnings
-}
-
-/* Get the width and height of a png image */
-int PSPKeyboard::getPngImageSize(Common::SeekableReadStream *file, uint32 *png_width, uint32 *png_height, u32 *paletteSize) {
- DEBUG_ENTER_FUNC();
-
- png_structp png_ptr;
- png_infop info_ptr;
- unsigned int sig_read = 0;
- png_uint_32 width, height;
- int bit_depth, color_type, interlace_type;
-
- png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
- if (png_ptr == NULL) {
- return -1;
- }
- png_set_error_fn(png_ptr, (png_voidp) NULL, (png_error_ptr) NULL, user_warning_fn);
- info_ptr = png_create_info_struct(png_ptr);
- if (info_ptr == NULL) {
- png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
- return -1;
- }
- // Set the png lib to use our read function
- png_set_read_fn(png_ptr, (void *)file, pngReadStreamRead);
-
- png_set_sig_bytes(png_ptr, sig_read);
- png_read_info(png_ptr, info_ptr);
- png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, int_p_NULL, int_p_NULL);
- if (color_type & PNG_COLOR_MASK_PALETTE)
- *paletteSize = info_ptr->num_palette;
- else
- *paletteSize = 0;
-
- png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
-
- *png_width = width;
- *png_height = height;
-
- return 0;
-}
-
-// Load a texture from a png image
-//
-int PSPKeyboard::loadPngImage(Common::SeekableReadStream *file, Buffer &buffer, Palette &palette) {
- DEBUG_ENTER_FUNC();
-
- png_structp png_ptr;
- png_infop info_ptr;
- unsigned int sig_read = 0;
- png_uint_32 width, height;
- int bit_depth, color_type, interlace_type;
- size_t y;
-
- png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
- if (png_ptr == NULL) {
- PSP_ERROR("Couldn't create read struct to load keyboard\n");
- return -1;
- }
- // Use dummy error function
- png_set_error_fn(png_ptr, (png_voidp) NULL, (png_error_ptr) NULL, user_warning_fn);
-
- info_ptr = png_create_info_struct(png_ptr);
- if (info_ptr == NULL) {
- PSP_ERROR("Couldn't create info struct to load keyboard\n");
- png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
- return -1;
- }
-
- // Set the png lib to use our customized read function
- png_set_read_fn(png_ptr, (void *)file, pngReadStreamRead);
-
- png_set_sig_bytes(png_ptr, sig_read);
- png_read_info(png_ptr, info_ptr);
- png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, int_p_NULL, int_p_NULL);
-
- // Strip off 16 bit channels. Not really needed but whatever
- png_set_strip_16(png_ptr);
-
- if (color_type == PNG_COLOR_TYPE_PALETTE) {
- // Copy the palette
- png_colorp srcPal = info_ptr->palette;
- for (int i = 0; i < info_ptr->num_palette; i++) {
- unsigned char alphaVal = (i < info_ptr->num_trans) ? info_ptr->trans[i] : 0xFF; // Load alpha if it's there
- palette.setSingleColorRGBA(i, srcPal->red, srcPal->green, srcPal->blue, alphaVal);
- srcPal++;
- }
- } else { // Not a palettized image
- // Round up grayscale images
- if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) png_set_gray_1_2_4_to_8(png_ptr);
- // Convert trans channel to alpha for 32 bits
- if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr);
- // Filler for alpha?
- png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
- }
-
- unsigned char *line = (unsigned char*) malloc(info_ptr->rowbytes);
- if (!line) {
- png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
- PSP_ERROR("Couldn't allocate line\n");
- return -1;
- }
-
- for (y = 0; y < height; y++) {
- png_read_row(png_ptr, line, png_bytep_NULL);
- buffer.copyFromRect(line, info_ptr->rowbytes, 0, y, width, 1); // Copy into buffer
- //memcpy(buffer.getPixels()[y * buffer.getWidthInBytes()], line, info_ptr->rowbytes);
- }
-
- free(line);
-
- png_read_end(png_ptr, info_ptr);
- png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
-
- return 0;
-}
-
// Defines for working with PSP buttons
#define CHANGED(x) (_buttonsChanged & (x))
#define PRESSED(x) ((_buttonsChanged & (x)) && (pad.Buttons & (x)))
diff --git a/backends/platform/psp/pspkeyboard.h b/backends/platform/psp/pspkeyboard.h
index 1bd394c15a..ebf21cfd54 100644
--- a/backends/platform/psp/pspkeyboard.h
+++ b/backends/platform/psp/pspkeyboard.h
@@ -77,9 +77,6 @@ private:
Palette _palettes[guiStringsSize];
GuRenderer _renderer;
- int loadPngImage(Common::SeekableReadStream *file, Buffer &buffer, Palette &palette);
- int getPngImageSize(Common::SeekableReadStream *, uint32 *png_width, uint32 *png_height, uint32 *paletteSize);
- uint32 convert_pow2(uint32 size);
void increaseKeyboardLocationX(int amount); // Move keyboard onscreen
void increaseKeyboardLocationY(int amount);
void convertCursorToXY(CursorDirections cur, int &x, int &y);
--
cgit v1.2.3
From 8388e0dfea4ae0d80e51368acd12685c740c5bb5 Mon Sep 17 00:00:00 2001
From: Jordi Vilalta Prat
Date: Tue, 12 Oct 2010 02:18:11 +0000
Subject: JANITORAL: Clean trailing whitespaces.
svn-id: r53160
---
backends/platform/android/android.cpp | 2 +-
backends/platform/dc/selector.cpp | 2 +-
backends/platform/dingux/README.DINGUX | 16 +-
backends/platform/dingux/dingux.mk | 2 +-
backends/platform/ds/arm9/makefile | 2 +-
backends/platform/ds/arm9/source/touchkeyboard.cpp | 8 +-
backends/platform/gp2x/build/README-GP2X | 6 +-
backends/platform/gp2x/gp2x-bundle.mk | 12 +-
backends/platform/gp2x/gp2x-common.h | 2 +-
backends/platform/gph/build/README-GP2XWIZ | 8 +-
backends/platform/gph/build/config.sh | 2 +-
backends/platform/gph/build/scummvm-gdb.gpe | 2 +-
backends/platform/gph/build/scummvm.gpe | 2 +-
backends/platform/gph/caanoo-bundle.mk | 14 +-
backends/platform/gph/caanoo/config.sh | 2 +-
backends/platform/gph/caanoo/scummvm-gdb.gpe | 2 +-
backends/platform/gph/caanoo/scummvm.gpe | 2 +-
backends/platform/gph/gp2xwiz-bundle.mk | 16 +-
backends/platform/iphone/iphone_main.m | 2 +-
backends/platform/iphone/iphone_video.m | 10 +-
backends/platform/iphone/osys_events.cpp | 4 +-
backends/platform/iphone/osys_video.cpp | 4 +-
backends/platform/linuxmoto/linuxmoto-events.cpp | 2 +-
backends/platform/n64/Makefile | 4 +-
backends/platform/n64/README.N64 | 6 +-
backends/platform/n64/module.mk | 2 +-
backends/platform/n64/osys_n64_base.cpp | 2 +-
backends/platform/openpandora/build/PXML.xml | 12 +-
.../platform/openpandora/build/README-OPENPANDORA | 8 +-
backends/platform/openpandora/build/README-PND.txt | 14 +-
backends/platform/openpandora/build/pnd_make.sh | 24 +-
backends/platform/openpandora/module.mk | 4 +-
backends/platform/openpandora/op-bundle.mk | 22 +-
backends/platform/ps2/Makefile.gdb | 8 +-
backends/platform/ps2/Makefile.ps2 | 12 +-
backends/platform/ps2/iop/CoDyVDfs/iop/imports.lst | 10 +-
backends/platform/psp/Makefile | 2 +-
backends/platform/psp/README.PSP | 14 +-
backends/platform/psp/README.PSP.in | 14 +-
backends/platform/psp/audio.cpp | 38 ++--
backends/platform/psp/audio.h | 8 +-
backends/platform/psp/display_client.cpp | 4 +-
backends/platform/psp/display_manager.cpp | 38 ++--
backends/platform/psp/display_manager.h | 4 +-
backends/platform/psp/input.cpp | 106 ++++-----
backends/platform/psp/input.h | 30 +--
backends/platform/psp/memory.cpp | 100 ++++-----
backends/platform/psp/memory.h | 10 +-
backends/platform/psp/mp3.cpp | 86 +++----
backends/platform/psp/mp3.h | 20 +-
backends/platform/psp/osys_psp.cpp | 40 ++--
backends/platform/psp/plugin.ld | 4 +-
backends/platform/psp/png_loader.cpp | 32 +--
backends/platform/psp/png_loader.h | 16 +-
backends/platform/psp/powerman.cpp | 52 ++---
backends/platform/psp/psp_main.cpp | 6 +-
backends/platform/psp/pspkeyboard.cpp | 10 +-
backends/platform/psp/rtc.cpp | 30 +--
backends/platform/psp/rtc.h | 4 +-
backends/platform/psp/tests.cpp | 248 ++++++++++-----------
backends/platform/psp/tests.h | 6 +-
backends/platform/psp/thread.cpp | 60 ++---
backends/platform/psp/thread.h | 6 +-
backends/platform/sdl/sdl.h | 2 +-
backends/platform/symbian/AdaptAllMMPs.pl | 136 +++++------
.../symbian/BuildPackageUpload_AllVersions.pl | 88 ++++----
.../symbian/BuildPackageUpload_LocalSettings.pl | 50 ++---
backends/platform/symbian/README | 4 +-
backends/platform/symbian/S60/BLD.INF.in | 2 +-
backends/platform/symbian/S60v3/BLD.INF.in | 2 +-
.../symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in | 4 +-
.../platform/symbian/S60v3/ScummVM_S60v3.mmp.in | 4 +-
backends/platform/symbian/S80/BLD.INF.in | 2 +-
backends/platform/symbian/S90/BLD.INF.in | 2 +-
backends/platform/symbian/UIQ2/BLD.INF.in | 2 +-
backends/platform/symbian/UIQ3/BLD.INF.in | 4 +-
.../symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in | 2 +-
backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in | 2 +-
78 files changed, 773 insertions(+), 773 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index 449d27561e..dcc4e37458 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -1330,7 +1330,7 @@ static void ScummVM_enableZoning(JNIEnv* env, jobject self, jboolean enable) {
static void ScummVM_setSurfaceSize(JNIEnv* env, jobject self,
jint width, jint height) {
OSystem_Android* cpp_obj = OSystem_Android::fromJavaObject(env, self);
- cpp_obj->setSurfaceSize(width, height);
+ cpp_obj->setSurfaceSize(width, height);
}
const static JNINativeMethod gMethods[] = {
diff --git a/backends/platform/dc/selector.cpp b/backends/platform/dc/selector.cpp
index 0d9b931d2c..8fd12d66bf 100644
--- a/backends/platform/dc/selector.cpp
+++ b/backends/platform/dc/selector.cpp
@@ -272,7 +272,7 @@ static int findGames(Game *games, int max, bool use_ini)
games[curr_game].dir,
games[curr_game].language,
games[curr_game].platform, games, curr_game)) {
-
+
strcpy(games[curr_game].text, ge->description().c_str());
#if 0
printf("Registered game <%s> (l:%d p:%d) in <%s> <%s> because of <%s> <*>\n",
diff --git a/backends/platform/dingux/README.DINGUX b/backends/platform/dingux/README.DINGUX
index 12289388de..d867e02f03 100644
--- a/backends/platform/dingux/README.DINGUX
+++ b/backends/platform/dingux/README.DINGUX
@@ -21,10 +21,10 @@ Controls
Installation from binaries
==============================
-Mount your dingux SD card in your pc, then copy the directory "scummvm" found in
-the release package to a directory inside /pathtosdcard/local/dirofyourchoice
+Mount your dingux SD card in your pc, then copy the directory "scummvm" found in
+the release package to a directory inside /pathtosdcard/local/dirofyourchoice
(on windows it would be SDLETTER:\local\dirofyourchoice).
-At this point is sufficient to point your launcher (eg. gmenu2x) to scummvm.gpe
+At this point is sufficient to point your launcher (eg. gmenu2x) to scummvm.gpe
file included into the scummvm directory you copied to the SD card, and then launch it.
Building from binaries
@@ -33,7 +33,7 @@ Building from binaries
Kernel and rootfs WARNINGS
==============================
-All the dingux root images (rootfs) i found floating on the net have
+All the dingux root images (rootfs) i found floating on the net have
broken tremor libraries, which make scummvm crash in a bad way.
One solution is to replace the libraries in your rootfs by injecting these fixed ones:
http://hkzlab.ipv7.net/files/misc/dingux/dingux_fixed_tremor_libs.zip
@@ -42,7 +42,7 @@ but this doesn't mean it will work perfectly:
non-opendingux kernels doesn't have lcd double buffering leading to a lot of annoying
tearing on screen.
-The best way to address all the problems in one shot, is to use an opendingux kernel for
+The best way to address all the problems in one shot, is to use an opendingux kernel for
your dingoo, which has some interesting advantages:
- The kernel gets updated and kept in sync with main linux tree
- Double buffering and centering of screen image
@@ -52,16 +52,16 @@ http://hkzlab.ipv7.net/files/misc/dingux/opendingux/opendingux_kernel_rootfs.zip
The kernel and rootfs images in the zip file is what i use for developing scummvm on dingux.
BTW, i have built images for the A330 and A320 with ILI9325 controllers too,
-but these version aren't tested (i have an A320 with ILI9331, but if someone wants to
+but these version aren't tested (i have an A320 with ILI9331, but if someone wants to
donate an A330 to a poor scummvm developer so i can try the port there too... :P)
If you need a launcher with opendingux cpu frequency scaler support, you can find gmenu2x here:
http://www.treewalker.org/dingux/cpufreq.html
-I've also prepared a rootfs image for use on normal dingux kernels (non-opendingux ones).
+I've also prepared a rootfs image for use on normal dingux kernels (non-opendingux ones).
It's based on elta's rootfs image with just the fixed libs replaced.
http://hkzlab.ipv7.net/files/misc/dingux/normal_dingux/rootfs_elta_fixtremor.zip
-I still raccomand the use of opendingux kernel + rootfs, but if you don't, this roofs
+I still raccomand the use of opendingux kernel + rootfs, but if you don't, this roofs
image plus another kernel (eg. SiENcE's one) should be do the job.
Enjoy
diff --git a/backends/platform/dingux/dingux.mk b/backends/platform/dingux/dingux.mk
index 0505dbdfd3..882078fe46 100644
--- a/backends/platform/dingux/dingux.mk
+++ b/backends/platform/dingux/dingux.mk
@@ -15,7 +15,7 @@ dingux-dist: all
$(MKDIR) $(bundle_name)
$(MKDIR) $(bundle_name)/saves
$(STRIP) $(EXECUTABLE) -o $(bundle_name)/scummvm.elf
- $(CP) $(DIST_FILES_THEMES) $(bundle_name)/
+ $(CP) $(DIST_FILES_THEMES) $(bundle_name)/
ifdef DIST_FILES_ENGINEDATA
$(CP) $(DIST_FILES_ENGINEDATA) $(bundle_name)/
endif
diff --git a/backends/platform/ds/arm9/makefile b/backends/platform/ds/arm9/makefile
index 42cc6b13c9..bf9fc1d826 100644
--- a/backends/platform/ds/arm9/makefile
+++ b/backends/platform/ds/arm9/makefile
@@ -66,7 +66,7 @@ else
# TODO: Inherit the earth uses so much RAM that I have removed libmad in order to
# claw some back.
-
+
else
ifdef DS_BUILD_I
diff --git a/backends/platform/ds/arm9/source/touchkeyboard.cpp b/backends/platform/ds/arm9/source/touchkeyboard.cpp
index 71f4f93c27..581509f939 100644
--- a/backends/platform/ds/arm9/source/touchkeyboard.cpp
+++ b/backends/platform/ds/arm9/source/touchkeyboard.cpp
@@ -177,7 +177,7 @@ void drawText(int tx, int ty, const char *string, bool highlight) {
baseAddress[ty * 32 + tx + p] = baseValue | tile;
}
}
-
+
}
@@ -292,7 +292,7 @@ void drawAutoComplete() {
// When there's no completions on the bottom of the screen, it acts like a mouse pad
// so this text indicates that
drawText(11, 18, "MOUSE AREA", true);
-
+
} else {
@@ -303,10 +303,10 @@ void drawAutoComplete() {
for (int r = 0; r < autoCompleteCount; r++) {
int y = 12 + (r % 6) * 2;
int x = 0 + ((r / 6) * 16);
-
+
drawText(x, y, autoCompleteWord[r], selectedCompletion == r);
}
-
+
}
}
diff --git a/backends/platform/gp2x/build/README-GP2X b/backends/platform/gp2x/build/README-GP2X
index f95a974230..dc93a9f1c9 100644
--- a/backends/platform/gp2x/build/README-GP2X
+++ b/backends/platform/gp2x/build/README-GP2X
@@ -20,10 +20,10 @@ Contents:
Please refer to the:
-GP2X/GP2XWiz ScummVM Forum:
-WiKi:
+GP2X/GP2XWiz ScummVM Forum:
+WiKi:
-for the most current information on the port and any updates to this
+for the most current information on the port and any updates to this
documentation.
------------------------------------------------------------------------
diff --git a/backends/platform/gp2x/gp2x-bundle.mk b/backends/platform/gp2x/gp2x-bundle.mk
index c6fb72c1c3..67d22d1889 100755
--- a/backends/platform/gp2x/gp2x-bundle.mk
+++ b/backends/platform/gp2x/gp2x-bundle.mk
@@ -6,7 +6,7 @@ gp2x-bundle: $(EXECUTABLE)
$(MKDIR) "$(bundle_name)"
$(MKDIR) "$(bundle_name)/saves"
$(MKDIR) "$(bundle_name)/engine-data"
-
+
echo "Please put your save games in this dir" >> "$(bundle_name)/saves/PUT_SAVES_IN_THIS_DIR"
$(CP) $(srcdir)/backends/platform/gp2x/build/scummvm.gpe $(bundle_name)/
@@ -28,13 +28,13 @@ ifdef DYNAMIC_MODULES
endif
tar -C $(bundle_name) -cvjf $(bundle_name).tar.bz2 .
- rm -R ./$(bundle_name)
+ rm -R ./$(bundle_name)
gp2x-bundle-debug: $(EXECUTABLE)
$(MKDIR) "$(bundle_name)"
$(MKDIR) "$(bundle_name)/saves"
$(MKDIR) "$(bundle_name)/engine-data"
-
+
echo "Please put your save games in this dir" >> "$(bundle_name)/saves/PUT_SAVES_IN_THIS_DIR"
$(CP) $(srcdir)/backends/platform/gp2x/build/scummvm.gpe $(bundle_name)/
@@ -46,15 +46,15 @@ gp2x-bundle-debug: $(EXECUTABLE)
$(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/
$(INSTALL) -c -m 644 $(DIST_FILES_ENGINEDATA) $(bundle_name)/engine-data
$(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)/
-
+
$(INSTALL) -c -m 777 $(srcdir)/$(EXECUTABLE) $(bundle_name)/$(EXECUTABLE)
ifdef DYNAMIC_MODULES
$(INSTALL) -d "$(bundle_name)/scummvm/plugins"
$(INSTALL) -c -m 644 $(PLUGINS) "$(bundle_name)/scummvm/plugins"
endif
-
+
tar -C $(bundle_name) -cvjf $(bundle_name)-debug.tar.bz2 .
- rm -R ./$(bundle_name)
+ rm -R ./$(bundle_name)
.PHONY: gp2x-bundle gp2x-bundle-debug
diff --git a/backends/platform/gp2x/gp2x-common.h b/backends/platform/gp2x/gp2x-common.h
index 96d88b8fd4..1c8708a8b1 100644
--- a/backends/platform/gp2x/gp2x-common.h
+++ b/backends/platform/gp2x/gp2x-common.h
@@ -318,7 +318,7 @@ protected:
// Scroll lock state - since SDL doesn't track it
bool _scrollLock;
-
+
// joystick
SDL_Joystick *_joystick;
bool _stickBtn[32];
diff --git a/backends/platform/gph/build/README-GP2XWIZ b/backends/platform/gph/build/README-GP2XWIZ
index ec8142a6f3..269fa901c9 100644
--- a/backends/platform/gph/build/README-GP2XWIZ
+++ b/backends/platform/gph/build/README-GP2XWIZ
@@ -19,10 +19,10 @@ Contents:
Please refer to the:
-GP2X/GP2XWiz ScummVM Forum:
-WiKi:
+GP2X/GP2XWiz ScummVM Forum:
+WiKi:
-for the most current information on the port and any updates to this
+for the most current information on the port and any updates to this
documentation.
------------------------------------------------------------------------
@@ -112,7 +112,7 @@ Fancy button combos:
NOTE: To use button combos press and hold the Left Trigger then...
-Right Trigger: Display Virtual Keyboard
+Right Trigger: Display Virtual Keyboard
Menu: Bring up the Global main menu for ScummVM
Select: Exit ScummVM completely (and gracefully)
diff --git a/backends/platform/gph/build/config.sh b/backends/platform/gph/build/config.sh
index 54c4795298..25c3a83da0 100755
--- a/backends/platform/gph/build/config.sh
+++ b/backends/platform/gph/build/config.sh
@@ -17,6 +17,6 @@ export DEFINES=-DNDEBUG
# Edit the configure line to suit.
cd ../../../..
-./configure --backend=gp2xwiz --disable-mt32emu --host=gp2xwiz --disable-flac --disable-nasm --disable-hq-scalers --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-vkeybd --enable-plugins --default-dynamic
+./configure --backend=gp2xwiz --disable-mt32emu --host=gp2xwiz --disable-flac --disable-nasm --disable-hq-scalers --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-vkeybd --enable-plugins --default-dynamic
echo Generating config for GP2X Wiz complete. Check for errors.
diff --git a/backends/platform/gph/build/scummvm-gdb.gpe b/backends/platform/gph/build/scummvm-gdb.gpe
index 64b6c8b974..f486c288ee 100755
--- a/backends/platform/gph/build/scummvm-gdb.gpe
+++ b/backends/platform/gph/build/scummvm-gdb.gpe
@@ -6,7 +6,7 @@ export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH
# Run ScummVM via GDB (so make sure you have a terminal open or serial).
# Oh, and GDB installed of course ;)
-gdb --args ./scummvm.wiz --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
+gdb --args ./scummvm.wiz --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
# Sync the SD card to check that everything is written.
sync
diff --git a/backends/platform/gph/build/scummvm.gpe b/backends/platform/gph/build/scummvm.gpe
index 42cc00a22a..2866825e91 100755
--- a/backends/platform/gph/build/scummvm.gpe
+++ b/backends/platform/gph/build/scummvm.gpe
@@ -5,7 +5,7 @@
export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH
# Run ScummVM, important this bit.
-./scummvm.wiz --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
+./scummvm.wiz --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
# Sync the SD card to check that everything is written.
sync
diff --git a/backends/platform/gph/caanoo-bundle.mk b/backends/platform/gph/caanoo-bundle.mk
index 84b99c5c53..c411310688 100755
--- a/backends/platform/gph/caanoo-bundle.mk
+++ b/backends/platform/gph/caanoo-bundle.mk
@@ -11,14 +11,14 @@ caanoo-bundle: $(EXECUTABLE)
$(MKDIR) "$(bundle_name)/scummvm/saves"
$(MKDIR) "$(bundle_name)/scummvm/engine-data"
$(MKDIR) "$(bundle_name)/scummvm/lib"
-
+
echo "Please put your save games in this dir" >> "$(bundle_name)/scummvm/saves/PUT_SAVES_IN_THIS_DIR"
$(CP) $(srcdir)/backends/platform/gph/caanoo/scummvm.gpe $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gph/build/scummvm.png $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gph/build/scummvmb.png $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gph/build/README-GP2XWIZ $(bundle_name)/scummvm/README-CAANOO
- $(CP) $(srcdir)/backends/platform/gph/build/scummvm.ini $(bundle_name)/
+ $(CP) $(srcdir)/backends/platform/gph/build/scummvm.ini $(bundle_name)/
$(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
$(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/
@@ -32,9 +32,9 @@ ifdef DYNAMIC_MODULES
$(INSTALL) -c -m 644 $(PLUGINS) "$(bundle_name)/scummvm/plugins"
$(STRIP) $(bundle_name)/scummvm/plugins/*
endif
-
+
tar -C $(bundle_name) -cvjf $(bundle_name).tar.bz2 .
- rm -R ./$(bundle_name)
+ rm -R ./$(bundle_name)
caanoo-bundle-debug: $(EXECUTABLE)
$(MKDIR) "$(bundle_name)"
@@ -42,14 +42,14 @@ caanoo-bundle-debug: $(EXECUTABLE)
$(MKDIR) "$(bundle_name)/scummvm/saves"
$(MKDIR) "$(bundle_name)/scummvm/engine-data"
$(MKDIR) "$(bundle_name)/scummvm/lib"
-
+
echo "Please put your save games in this dir" >> "$(bundle_name)/scummvm/saves/PUT_SAVES_IN_THIS_DIR"
$(CP) $(srcdir)/backends/platform/gph/caanoo/scummvm-gdb.gpe $(bundle_name)/scummvm/scummvm.gpe
$(CP) $(srcdir)/backends/platform/gph/build/scummvm.png $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gph/build/scummvmb.png $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gph/build/README-GP2XWIZ $(bundle_name)/scummvm/README-CAANOO
- $(CP) $(srcdir)/backends/platform/gph/build/scummvm.ini $(bundle_name)/
+ $(CP) $(srcdir)/backends/platform/gph/build/scummvm.ini $(bundle_name)/
$(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
$(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/
@@ -64,6 +64,6 @@ ifdef DYNAMIC_MODULES
endif
tar -C $(bundle_name) -cvjf $(bundle_name)-debug.tar.bz2 .
- rm -R ./$(bundle_name)
+ rm -R ./$(bundle_name)
.PHONY: caanoo-bundle caanoo-bundle-debug
diff --git a/backends/platform/gph/caanoo/config.sh b/backends/platform/gph/caanoo/config.sh
index 73ce5da624..82e3774dbf 100755
--- a/backends/platform/gph/caanoo/config.sh
+++ b/backends/platform/gph/caanoo/config.sh
@@ -11,6 +11,6 @@ export DEFINES=-DNDEBUG
# Edit the configure line to suit.
cd ../../../..
-./configure --backend=caanoo --disable-mt32emu --host=caanoo --disable-alsa --disable-flac --disable-nasm --disable-vorbis --disable-hq-scalers --with-sdl-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr/bin --with-mpeg2-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr --enable-tremor --with-tremor-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr --enable-zlib --with-zlib-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr --enable-mad --with-mad-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr --enable-vkeybd --enable-plugins --default-dynamic
+./configure --backend=caanoo --disable-mt32emu --host=caanoo --disable-alsa --disable-flac --disable-nasm --disable-vorbis --disable-hq-scalers --with-sdl-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr/bin --with-mpeg2-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr --enable-tremor --with-tremor-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr --enable-zlib --with-zlib-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr --enable-mad --with-mad-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr --enable-vkeybd --enable-plugins --default-dynamic
echo Generating config for GP2X Caanoo complete. Check for errors.
diff --git a/backends/platform/gph/caanoo/scummvm-gdb.gpe b/backends/platform/gph/caanoo/scummvm-gdb.gpe
index a8f2aae0fe..2d776f1bc3 100755
--- a/backends/platform/gph/caanoo/scummvm-gdb.gpe
+++ b/backends/platform/gph/caanoo/scummvm-gdb.gpe
@@ -6,7 +6,7 @@ export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH
# Run ScummVM via GDB (so make sure you have a terminal open or serial).
# Oh, and GDB installed of course ;)
-gdb --args ./scummvm.caanoo --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
+gdb --args ./scummvm.caanoo --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
# Sync the SD card to check that everything is written.
sync
diff --git a/backends/platform/gph/caanoo/scummvm.gpe b/backends/platform/gph/caanoo/scummvm.gpe
index 8341ffc3d7..52bb7a98cd 100755
--- a/backends/platform/gph/caanoo/scummvm.gpe
+++ b/backends/platform/gph/caanoo/scummvm.gpe
@@ -5,7 +5,7 @@
export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH
# Run ScummVM, important this bit.
-./scummvm.caanoo --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
+./scummvm.caanoo --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
# Sync the SD card to check that everything is written.
sync
diff --git a/backends/platform/gph/gp2xwiz-bundle.mk b/backends/platform/gph/gp2xwiz-bundle.mk
index 21fd0c74de..5ca6c0a9c7 100755
--- a/backends/platform/gph/gp2xwiz-bundle.mk
+++ b/backends/platform/gph/gp2xwiz-bundle.mk
@@ -11,14 +11,14 @@ gp2xwiz-bundle: $(EXECUTABLE)
$(MKDIR) "$(bundle_name)/scummvm/saves"
$(MKDIR) "$(bundle_name)/scummvm/engine-data"
$(MKDIR) "$(bundle_name)/scummvm/lib"
-
+
echo "Please put your save games in this dir" >> "$(bundle_name)/scummvm/saves/PUT_SAVES_IN_THIS_DIR"
$(CP) $(srcdir)/backends/platform/gph/build/scummvm.gpe $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gph/build/scummvm.png $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gph/build/scummvmb.png $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gph/build/README-GP2XWIZ $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/build/scummvm.ini $(bundle_name)/
+ $(CP) $(srcdir)/backends/platform/gph/build/scummvm.ini $(bundle_name)/
$(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
$(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/
@@ -32,12 +32,12 @@ ifdef DYNAMIC_MODULES
$(INSTALL) -c -m 644 $(PLUGINS) "$(bundle_name)/scummvm/plugins"
$(STRIP) $(bundle_name)/scummvm/plugins/*
endif
-
+
$(CP) $(libloc)/../lib/libz.so.1.2.3 $(bundle_name)/scummvm/lib/libz.so.1
$(CP) $(libloc)/../lib/libvorbisidec.so.1.0.2 $(bundle_name)/scummvm/lib/libvorbisidec.so.1
tar -C $(bundle_name) -cvjf $(bundle_name).tar.bz2 .
- rm -R ./$(bundle_name)
+ rm -R ./$(bundle_name)
gp2xwiz-bundle-debug: $(EXECUTABLE)
$(MKDIR) "$(bundle_name)"
@@ -45,14 +45,14 @@ gp2xwiz-bundle-debug: $(EXECUTABLE)
$(MKDIR) "$(bundle_name)/scummvm/saves"
$(MKDIR) "$(bundle_name)/scummvm/engine-data"
$(MKDIR) "$(bundle_name)/scummvm/lib"
-
+
echo "Please put your save games in this dir" >> "$(bundle_name)/scummvm/saves/PUT_SAVES_IN_THIS_DIR"
$(CP) $(srcdir)/backends/platform/gph/build/scummvm-gdb.gpe $(bundle_name)/scummvm/scummvm.gpe
$(CP) $(srcdir)/backends/platform/gph/build/scummvm.png $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gph/build/scummvmb.png $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gph/build/README-GP2XWIZ $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/build/scummvm.ini $(bundle_name)/
+ $(CP) $(srcdir)/backends/platform/gph/build/scummvm.ini $(bundle_name)/
$(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
$(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/
@@ -65,11 +65,11 @@ ifdef DYNAMIC_MODULES
$(INSTALL) -d "$(bundle_name)/scummvm/plugins"
$(INSTALL) -c -m 644 $(PLUGINS) "$(bundle_name)/scummvm/plugins"
endif
-
+
$(CP) $(libloc)/../lib/libz.so.1.2.3 $(bundle_name)/scummvm/lib/libz.so.1
$(CP) $(libloc)/../lib/libvorbisidec.so.1.0.2 $(bundle_name)/scummvm/lib/libvorbisidec.so.1
tar -C $(bundle_name) -cvjf $(bundle_name)-debug.tar.bz2 .
- rm -R ./$(bundle_name)
+ rm -R ./$(bundle_name)
.PHONY: gp2xwiz-bundle gp2xwiz-bundle-debug
diff --git a/backends/platform/iphone/iphone_main.m b/backends/platform/iphone/iphone_main.m
index 5a5ec95090..1fb2cc3788 100644
--- a/backends/platform/iphone/iphone_main.m
+++ b/backends/platform/iphone/iphone_main.m
@@ -122,7 +122,7 @@ int main(int argc, char** argv) {
- (void)applicationResume:(struct __GSEvent *)event {
[_view applicationResume];
-
+
// Workaround, need to "hide" and unhide the statusbar to properly remove it,
// since the Springboard has put it back without apparently flagging our application.
[self setStatusBarHidden:YES animated:YES];
diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m
index 9704b302fb..821d3de634 100644
--- a/backends/platform/iphone/iphone_video.m
+++ b/backends/platform/iphone/iphone_video.m
@@ -233,7 +233,7 @@ bool getLocalMouseCoords(CGPoint *point) {
if (_screenTexture)
free(_textureBuffer);
-
+
free(_overlayTexBuffer);
}
@@ -265,9 +265,9 @@ bool getLocalMouseCoords(CGPoint *point) {
}
[self updateMainSurface];
-
+
if (_overlayIsEnabled) {
- [self updateOverlaySurface];
+ [self updateOverlaySurface];
[self updateMouseSurface];
}
@@ -350,7 +350,7 @@ bool getLocalMouseCoords(CGPoint *point) {
}
- (void)updateMouseSurface {
-
+
int width = _mouseCursorWidth / (float)_backingWidth * _backingHeight;
int height = _mouseCursorHeight / (float)_backingHeight * _backingWidth;
@@ -378,7 +378,7 @@ bool getLocalMouseCoords(CGPoint *point) {
glBindTexture(GL_TEXTURE_2D, _mouseCursorTexture); printOpenGLError();
glEnable(GL_BLEND);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError();
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError();
}
- (void)initSurface {
diff --git a/backends/platform/iphone/osys_events.cpp b/backends/platform/iphone/osys_events.cpp
index f1e3b9ba62..22f529dfac 100644
--- a/backends/platform/iphone/osys_events.cpp
+++ b/backends/platform/iphone/osys_events.cpp
@@ -74,7 +74,7 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) {
y = (int)((1.0 - xUnit) * _overlayHeight);
} else {
x = (int)(yUnit * _screenWidth);
- y = (int)((1.0 - xUnit) * _screenHeight);
+ y = (int)((1.0 - xUnit) * _screenHeight);
}
break;
case kScreenOrientationFlippedLandscape:
@@ -279,7 +279,7 @@ bool OSystem_IPHONE::handleEvent_mouseDragged(Common::Event &event, int x, int y
int widthCap = _overlayVisible ? _overlayWidth : _screenWidth;
int heightCap = _overlayVisible ? _overlayHeight : _screenHeight;
-
+
if (mouseNewPosX < 0)
mouseNewPosX = 0;
else if (mouseNewPosX > widthCap)
diff --git a/backends/platform/iphone/osys_video.cpp b/backends/platform/iphone/osys_video.cpp
index 18acb77524..d30a412a9f 100644
--- a/backends/platform/iphone/osys_video.cpp
+++ b/backends/platform/iphone/osys_video.cpp
@@ -266,7 +266,7 @@ void OSystem_IPHONE::drawDirtyRect(const Common::Rect& dirtyRect) {
void OSystem_IPHONE::drawDirtyOverlayRect(const Common::Rect& dirtyRect) {
// int h = dirtyRect.bottom - dirtyRect.top;
- //
+ //
// uint16 *src = (uint16 *)&_overlayBuffer[dirtyRect.top * _screenWidth + dirtyRect.left];
// uint16 *dst = &_fullscreen[dirtyRect.top * _screenWidth + dirtyRect.left];
// int x = (dirtyRect.right - dirtyRect.left) * 2;
@@ -275,7 +275,7 @@ void OSystem_IPHONE::drawDirtyOverlayRect(const Common::Rect& dirtyRect) {
// src += _screenWidth;
// dst += _screenWidth;
// }
- iPhone_updateOverlayRect(_overlayBuffer, dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom );
+ iPhone_updateOverlayRect(_overlayBuffer, dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom);
}
void OSystem_IPHONE::drawMouseCursorOnRectUpdate(const Common::Rect& updatedRect, const Common::Rect& mouseRect) {
diff --git a/backends/platform/linuxmoto/linuxmoto-events.cpp b/backends/platform/linuxmoto/linuxmoto-events.cpp
index 379e34b7ac..eb1bbc9394 100644
--- a/backends/platform/linuxmoto/linuxmoto-events.cpp
+++ b/backends/platform/linuxmoto/linuxmoto-events.cpp
@@ -128,7 +128,7 @@ bool OSystem_LINUXMOTO::remapKey(SDL_Event &ev, Common::Event &event) {
// VirtualKeyboard - Right Soft key
else if (ev.key.keysym.sym == SDLK_F11) {
ev.key.keysym.sym = SDLK_F7;
- }
+ }
#endif
// Joystick to Mouse
diff --git a/backends/platform/n64/Makefile b/backends/platform/n64/Makefile
index f80aa29262..cffe277312 100644
--- a/backends/platform/n64/Makefile
+++ b/backends/platform/n64/Makefile
@@ -15,7 +15,7 @@ AR = $(GCCN64PREFIX)ar cru
RANLIB = $(GCCN64PREFIX)ranlib
DEFINES += -D__N64__ -DLIMIT_FPS -DNONSTANDARD_PORT -DDISABLE_DEFAULT_SAVEFILEMANAGER -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE -DDISABLE_FANCY_THEMES -DDISABLE_DOSBOX_OPL -DENABLE_VKEYBD -DUSE_ZLIB
-LIBS += -lpakfs -lframfs -ln64 -ln64utils -lromfs
+LIBS += -lpakfs -lframfs -ln64 -ln64utils -lromfs
#DEFINES += -D_ENABLE_DEBUG_
@@ -31,7 +31,7 @@ DEFINES += -DUSE_VORBIS -DUSE_TREMOR
LIBS += -lvorbisidec
endif
-LIBS += -lm -lstdc++ -lc -lgcc -lz -lnosys
+LIBS += -lm -lstdc++ -lc -lgcc -lz -lnosys
CXXFLAGS = -g -mno-extern-sdata -O2 --param max-inline-insns-auto=20 -fomit-frame-pointer -march=vr4300 -mtune=vr4300 -mhard-float -fno-rtti -fno-exceptions -Wno-multichar -Wshadow -I$(LIBN64PATH) -I$(TOOLPATH)/include -I./ -I$(srcdir) -I$(srcdir)/engines
LDFLAGS = -g -march=vr4300 -mtune=vr4300 -nodefaultlibs -nostartfiles -mno-crt0 -L$(LIBN64PATH) -L$(TOOLPATH)/lib $(LIBS) -T n64ld_cpp.x -Xlinker -Map -Xlinker scummvm.map
diff --git a/backends/platform/n64/README.N64 b/backends/platform/n64/README.N64
index c6ae6f021e..b47b239658 100644
--- a/backends/platform/n64/README.N64
+++ b/backends/platform/n64/README.N64
@@ -97,15 +97,15 @@ A - '.' / Skip dialogues in some games
C buttons - Numeric keypad keys
* Using a N64 Mouse:
-Used like a normal PC mouse.
+Used like a normal PC mouse.
Notes
=====
-- If virtual keyboard doesn't show up, you need to make sure you included
+- If virtual keyboard doesn't show up, you need to make sure you included
'vkeybd_default.zip' in the root of your romfs image.
-- In some games (mostly gob) cursor movement might be choppy, it's a known
+- In some games (mostly gob) cursor movement might be choppy, it's a known
problem and related on how N64 port manages screen updates.
diff --git a/backends/platform/n64/module.mk b/backends/platform/n64/module.mk
index 429b63802e..c8ceb32701 100644
--- a/backends/platform/n64/module.mk
+++ b/backends/platform/n64/module.mk
@@ -6,7 +6,7 @@ MODULE_OBJS := \
osys_n64_events.o \
osys_n64_utilities.o \
pakfs_save_manager.o \
- framfs_save_manager.o
+ framfs_save_manager.o
# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp
index 5288ddbfce..8862693138 100644
--- a/backends/platform/n64/osys_n64_base.cpp
+++ b/backends/platform/n64/osys_n64_base.cpp
@@ -859,7 +859,7 @@ void OSystem_N64::getTimeAndDate(TimeDate &t) const {
// No RTC inside the N64, read mips timer to simulate
// passing of time, not a perfect solution, but can't think
// of anything better.
-
+
uint32 now = getMilliTick();
t.tm_sec = (now / 1000) % 60;
diff --git a/backends/platform/openpandora/build/PXML.xml b/backends/platform/openpandora/build/PXML.xml
index 57299a6cbd..f4d2e2a595 100755
--- a/backends/platform/openpandora/build/PXML.xml
+++ b/backends/platform/openpandora/build/PXML.xml
@@ -4,7 +4,7 @@
ScummVM
-
+
@@ -13,20 +13,20 @@
-
+
Point & click game interpreter.
-
+
-
+
-
+
-
+
diff --git a/backends/platform/openpandora/build/README-OPENPANDORA b/backends/platform/openpandora/build/README-OPENPANDORA
index 18bfd3be21..c909ed56a6 100755
--- a/backends/platform/openpandora/build/README-OPENPANDORA
+++ b/backends/platform/openpandora/build/README-OPENPANDORA
@@ -19,10 +19,10 @@ Contents:
Please refer to the:
-ScummVM Forum:
-WiKi:
+ScummVM Forum:
+WiKi:
-for the most current information on the port and any updates to this
+for the most current information on the port and any updates to this
documentation.
------------------------------------------------------------------------
@@ -112,7 +112,7 @@ Fancy button combos:
NOTE: To use button combos press and hold the Left Trigger then...
-Right Trigger: Display Virtual Keyboard
+Right Trigger: Display Virtual Keyboard
Menu: Bring up the Global main menu for ScummVM
Select: Exit ScummVM completely (and gracefully)
diff --git a/backends/platform/openpandora/build/README-PND.txt b/backends/platform/openpandora/build/README-PND.txt
index 38b22fc38d..942c3a43e2 100755
--- a/backends/platform/openpandora/build/README-PND.txt
+++ b/backends/platform/openpandora/build/README-PND.txt
@@ -3,16 +3,16 @@ ScummVM - OPENPANDORA README - HOW TO INSTALL
Please refer to the:
-ScummVM Forum:
-WiKi:
+ScummVM Forum:
+WiKi:
-for the most current information on the port and any updates to this
+for the most current information on the port and any updates to this
documentation.
------------------------------------------------------------------------
Installing:
-This archive contains ScummVM in a PND format ready to be copied to the
+This archive contains ScummVM in a PND format ready to be copied to the
OpenPandora and used.
To install just copy the .pnd file from this archive to your device.
@@ -20,13 +20,13 @@ To install just copy the .pnd file from this archive to your device.
You will need to place the .pnd file in a suitable location on your SD
card.
-/pandora/desktop <- place here if you wish the icon to show on the
+/pandora/desktop <- place here if you wish the icon to show on the
desktop. Documentation will show in the menu.
-/pandora/menu <- place here if you wish the icon to show on the
+/pandora/menu <- place here if you wish the icon to show on the
Xfce menu. Documentation will show in the menu.
-/pandora/apps <- place here if you wish the icon to show on the
+/pandora/apps <- place here if you wish the icon to show on the
desktop and in the menu. Documentation will show
in the menu.
diff --git a/backends/platform/openpandora/build/pnd_make.sh b/backends/platform/openpandora/build/pnd_make.sh
index dcdcaceecd..b19de87bb4 100755
--- a/backends/platform/openpandora/build/pnd_make.sh
+++ b/backends/platform/openpandora/build/pnd_make.sh
@@ -1,11 +1,11 @@
#!/bin/sh
-
+
######adjust path of genpxml.sh if you want to use that "feture"#####
-
+
TEMP=`getopt -o p:d:x:i:c -- "$@"`
-
+
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
-
+
eval set -- "$TEMP"
while true ; do
case "$1" in
@@ -18,25 +18,25 @@ while true ; do
*) echo "Error while parsing arguments! $2" ; exit 1 ;;
esac
done
-
+
rnd=$RANDOM; # random number for genpxml and index$rnd.xml
-
+
#generate pxml if guess or empty
if [ ! $PXML ] || [ $PXML = "guess" ] && [ $PNDNAME ] && [ $FOLDER ]; then
PXMLtxt=$(/home/user/libpnd/pandora-libraries/testdata/scripts/genpxml.sh $FOLDER $ICON)
PXML=$FOLDER/PXML.xml
echo "$PXMLtxt" > $FOLDER/PXML.xml
fi
-
+
#check arguments
if [ ! $PNDNAME ] || [ ! $FOLDER ] || [ ! $PXML ]; then
- echo " Usage: pnd_make.sh -p your.pnd -d folder/containing/your/app/ -x
+ echo " Usage: pnd_make.sh -p your.pnd -d folder/containing/your/app/ -x
your.pxml (or \"guess\" to try to generate it from the folder) -i icon.png"
exit 1
fi
if [ ! -d $FOLDER ]; then echo "$FOLDER doesnt exist"; exit 1; fi #check if folder actually exists
if [ ! -f $PXML ]; then echo "$PXML doesnt exist"; exit 1; fi #check if pxml actually exists
-
+
#make iso from folder
if [ ! $SQUASH ]; then
mkisofs -o $PNDNAME.iso -R $FOLDER
@@ -45,12 +45,12 @@ else
echo "your squashfs version is older then version 4, please upgrade to 4.0 or later"
exit 1
fi
- mksquashfs -no-recovery -nopad $FOLDER $PNDNAME.iso
+ mksquashfs -no-recovery -nopad $FOLDER $PNDNAME.iso
fi
#append pxml to iso
cat $PNDNAME.iso $PXML > $PNDNAME
rm $PNDNAME.iso #cleanup
-
+
#append icon if specified
if [ $ICON ]; then # check if we want to add an icon
if [ ! -f $ICON ]; then #does the icon actually exist?
@@ -61,5 +61,5 @@ if [ $ICON ]; then # check if we want to add an icon
rm $PNDNAME.tmp #cleanup
fi
fi
-
+
if [ $PXML = "guess" ];then rm $FOLDER/PXML.xml; fi #cleanup
diff --git a/backends/platform/openpandora/module.mk b/backends/platform/openpandora/module.mk
index c8a4b1b32d..867908c840 100755
--- a/backends/platform/openpandora/module.mk
+++ b/backends/platform/openpandora/module.mk
@@ -6,10 +6,10 @@ MODULE_OBJS := \
op-main.o
MODULE_DIRS += \
- backends/platform/openpandora/
+ backends/platform/openpandora/
# We don't use the rules.mk here on purpose
OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)
# Hack to ensure the SDL backend is built so we can use OSystem_SDL.
--include $(srcdir)/backends/platform/sdl/module.mk
\ No newline at end of file
+-include $(srcdir)/backends/platform/sdl/module.mk
diff --git a/backends/platform/openpandora/op-bundle.mk b/backends/platform/openpandora/op-bundle.mk
index a08d64a643..163f4711ce 100755
--- a/backends/platform/openpandora/op-bundle.mk
+++ b/backends/platform/openpandora/op-bundle.mk
@@ -22,10 +22,10 @@ op-bundle: $(EXECUTABLE)
$(CP) $(srcdir)/backends/platform/openpandora/build/README-OPENPANDORA $(bundle_name)/scummvm/docs/
- $(CP) $(srcdir)/backends/platform/openpandora/build/index.html $(bundle_name)/scummvm/docs/
+ $(CP) $(srcdir)/backends/platform/openpandora/build/index.html $(bundle_name)/scummvm/docs/
$(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/docs/
-
+
$(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/data/
$(INSTALL) -c -m 644 $(DIST_FILES_ENGINEDATA) $(bundle_name)/scummvm/data/
@@ -36,10 +36,10 @@ ifdef DYNAMIC_MODULES
$(INSTALL) -c -m 644 $(PLUGINS) "$(bundle_name)/scummvm/plugins"
$(STRIP) $(bundle_name)/scummvm/plugins/*
endif
-
+
$(CP) $(libloc)/../arm-angstrom-linux-gnueabi/usr/lib/libFLAC.so.8.2.0 $(bundle_name)/scummvm/lib/libFLAC.so.8
tar -C $(bundle_name) -cvjf $(bundle_name).tar.bz2 .
- rm -R ./$(bundle_name)
+ rm -R ./$(bundle_name)
op-pnd: $(EXECUTABLE)
$(MKDIR) "$(bundle_name)"
@@ -58,10 +58,10 @@ op-pnd: $(EXECUTABLE)
$(CP) $(srcdir)/backends/platform/openpandora/build/README-OPENPANDORA $(bundle_name)/scummvm/docs/
- $(CP) $(srcdir)/backends/platform/openpandora/build/index.html $(bundle_name)/scummvm/docs/
+ $(CP) $(srcdir)/backends/platform/openpandora/build/index.html $(bundle_name)/scummvm/docs/
$(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/docs/
-
+
$(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/data/
$(INSTALL) -c -m 644 $(DIST_FILES_ENGINEDATA) $(bundle_name)/scummvm/data/
@@ -72,14 +72,14 @@ ifdef DYNAMIC_MODULES
$(INSTALL) -c -m 644 $(PLUGINS) "$(bundle_name)/scummvm/plugins"
$(STRIP) $(bundle_name)/scummvm/plugins/*
endif
-
+
$(CP) $(libloc)/../arm-angstrom-linux-gnueabi/usr/lib/libFLAC.so.8.2.0 $(bundle_name)/scummvm/lib/libFLAC.so.8
-
+
$(srcdir)/backends/platform/openpandora/build/pnd_make.sh -p $(bundle_name).pnd -d $(bundle_name)/scummvm -x $(bundle_name)/scummvm/data/PXML.xml -i $(bundle_name)/scummvm/icon/scummvm.png
-
- $(CP) $(srcdir)/backends/platform/openpandora/build/README-PND.txt $(bundle_name)
+
+ $(CP) $(srcdir)/backends/platform/openpandora/build/README-PND.txt $(bundle_name)
tar -cvjf $(bundle_name)-pnd.tar.bz2 $(bundle_name).pnd $(bundle_name)/README-PND.txt
- rm -R ./$(bundle_name)
+ rm -R ./$(bundle_name)
# rm $(bundle_name).pnd
.PHONY: op-bundle op-pnd
diff --git a/backends/platform/ps2/Makefile.gdb b/backends/platform/ps2/Makefile.gdb
index 53646a9546..48dcebc1d4 100644
--- a/backends/platform/ps2/Makefile.gdb
+++ b/backends/platform/ps2/Makefile.gdb
@@ -51,7 +51,7 @@ INCDIR = ../../../
DEFINES = -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_ZLIB -DFORCE_RTL -D_EE -D__PLAYSTATION2__ -D__PS2_DEBUG__ -g -Wall -Wno-multichar
-INCLUDES = $(addprefix -I$(PS2_EXTRA),$(PS2_EXTRA_INCS))
+INCLUDES = $(addprefix -I$(PS2_EXTRA),$(PS2_EXTRA_INCS))
INCLUDES += -I $(PS2GDB)/ee -I $(PS2SDK)/ee/include -I $(PS2SDK)/common/include -I ./common -I . -I $(srcdir) -I $(srcdir)/engines
TARGET = elf/scummvm.elf
@@ -72,16 +72,16 @@ OBJS := backends/platform/ps2/DmaPipe.o \
backends/platform/ps2/ps2mutex.o \
backends/platform/ps2/ps2time.o \
backends/platform/ps2/ps2debug.o
-
+
MODULE_DIRS += .
BACKEND := ps2
include $(srcdir)/Makefile.common
-LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -T $(PS2SDK)/ee/startup/linkfile
+LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -T $(PS2SDK)/ee/startup/linkfile
LDFLAGS += -L $(PS2GDB)/lib -L $(PS2SDK)/ee/lib -L .
-LDFLAGS += $(addprefix -L$(PS2_EXTRA),$(PS2_EXTRA_LIBS))
+LDFLAGS += $(addprefix -L$(PS2_EXTRA),$(PS2_EXTRA_LIBS))
LDFLAGS += -lmc -lpad -lmouse -lhdd -lpoweroff -lsjpcm -lmad -ltremor -lz -lm -lc -lfileXio -lps2gdbStub -lps2ip -ldebug -lkernel -lstdc++
all: $(TARGET)
diff --git a/backends/platform/ps2/Makefile.ps2 b/backends/platform/ps2/Makefile.ps2
index d2a8d210e4..472ba5ec3a 100644
--- a/backends/platform/ps2/Makefile.ps2
+++ b/backends/platform/ps2/Makefile.ps2
@@ -51,7 +51,7 @@ INCDIR = ../../../
DEFINES = -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_ZLIB -DFORCE_RTL -D_EE -D__PLAYSTATION2__ -O2 -Wall -Wno-multichar
-INCLUDES = $(addprefix -I$(PS2_EXTRA),$(PS2_EXTRA_INCS))
+INCLUDES = $(addprefix -I$(PS2_EXTRA),$(PS2_EXTRA_INCS))
INCLUDES += -I $(PS2SDK)/ee/include -I $(PS2SDK)/common/include -I ./common -I . -I $(srcdir) -I $(srcdir)/engines
TARGET = elf/scummvm.elf
@@ -72,18 +72,18 @@ OBJS := backends/platform/ps2/DmaPipe.o \
backends/platform/ps2/ps2mutex.o \
backends/platform/ps2/ps2time.o \
backends/platform/ps2/ps2debug.o
-
+
MODULE_DIRS += .
BACKEND := ps2
include $(srcdir)/Makefile.common
-LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -T $(PS2SDK)/ee/startup/linkfile
+LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -T $(PS2SDK)/ee/startup/linkfile
LDFLAGS += -L $(PS2SDK)/ee/lib -L .
-LDFLAGS += $(addprefix -L$(PS2_EXTRA),$(PS2_EXTRA_LIBS))
-LDFLAGS += -lmc -lpad -lmouse -lhdd -lpoweroff -lsjpcm -lmad -ltremor -lz -lm -lc -lfileXio -lkernel -lstdc++
-LDFLAGS += -s
+LDFLAGS += $(addprefix -L$(PS2_EXTRA),$(PS2_EXTRA_LIBS))
+LDFLAGS += -lmc -lpad -lmouse -lhdd -lpoweroff -lsjpcm -lmad -ltremor -lz -lm -lc -lfileXio -lkernel -lstdc++
+LDFLAGS += -s
all: $(TARGET)
diff --git a/backends/platform/ps2/iop/CoDyVDfs/iop/imports.lst b/backends/platform/ps2/iop/CoDyVDfs/iop/imports.lst
index d3ed3b0442..eb85e04462 100644
--- a/backends/platform/ps2/iop/CoDyVDfs/iop/imports.lst
+++ b/backends/platform/ps2/iop/CoDyVDfs/iop/imports.lst
@@ -24,10 +24,10 @@ I_DelDrv
iomanX_IMPORTS_end
sifcmd_IMPORTS_start
-I_sceSifInitRpc
-I_sceSifSetRpcQueue
-I_sceSifRegisterRpc
-I_sceSifRpcLoop
+I_sceSifInitRpc
+I_sceSifSetRpcQueue
+I_sceSifRegisterRpc
+I_sceSifRpcLoop
sifcmd_IMPORTS_end
stdio_IMPORTS_start
@@ -59,7 +59,7 @@ thbase_IMPORTS_start
I_CreateThread
I_StartThread
I_GetThreadId
-I_DelayThread
+I_DelayThread
thbase_IMPORTS_end
diff --git a/backends/platform/psp/Makefile b/backends/platform/psp/Makefile
index b9a2b45013..7f9ae153eb 100644
--- a/backends/platform/psp/Makefile
+++ b/backends/platform/psp/Makefile
@@ -200,4 +200,4 @@ SCEkxploit: $(TARGET).elf $(PSP_EBOOT_SFO)
$(PACK_PBP) "%__SCE__$(TARGET)/$(PSP_EBOOT)" $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON) \
$(PSP_EBOOT_ICON1) $(PSP_EBOOT_PIC0) $(PSP_EBOOT_PIC1) \
$(PSP_EBOOT_SND0) NULL $(PSP_EBOOT_PSAR)
-
+
diff --git a/backends/platform/psp/README.PSP b/backends/platform/psp/README.PSP
index fc49f3fd60..0849d68c78 100644
--- a/backends/platform/psp/README.PSP
+++ b/backends/platform/psp/README.PSP
@@ -32,9 +32,9 @@ Right trigger - Input letters: lowercase/uppercase (press to toggle)
Left trigger - Input numbers/symbols (press to toggle)
D-Pad - Select square of characters (up, down, left or right)
Buttons/Triggers - Choose a specific character in the square. The four center characters are chosen
- by the button in the corresponding position. The 2 top characters are chosen by the
+ by the button in the corresponding position. The 2 top characters are chosen by the
triggers.
-Analog - Moves in a direction (left/right/up/down) (Useful to keep moving
+Analog - Moves in a direction (left/right/up/down) (Useful to keep moving
while typing in AGI games among other things)
1st Person Game Mode (Can be ignored by most users)
@@ -49,9 +49,9 @@ Square - Is the modifier key instead of Right Trigger.
Left/Right Trigger - Strafe left/right
D-Pad Left/Right - Turn left/right
Square + D-Pad - F1/F2/F3/F4
-Square + Start - Esc (shows game menu)
+Square + Start - Esc (shows game menu)
+
-
Notes
=====
- Notice that you can switch between games! This is much faster than quitting
@@ -61,7 +61,7 @@ Notes
- The PSP version of ScummVM uses the Media Engine to accelerate decoding of MP3 files. This means
that if you have the choice of compressing using Ogg files or MP3 files, choose MP3 -- the game
will generally run faster.
-
+
- Plugin files are NOT interchangeable between ScummVM versions! You must copy ALL the
plugin files that come with every version of ScummVM. They sit in the /plugin
subdirectory. If you get a crash upon startup, try deleting all the existing
@@ -85,7 +85,7 @@ A: A PSP that can run homebrew and the necessary datafiles for the game you wan
Q: Can I run game X with this?
A: You can find the list of supported games on the compatibility page
at http://www.scummvm.org
- Note that ScummVM is NOT an emulator. The supported games engines have been painstakingly rewritten.
+ Note that ScummVM is NOT an emulator. The supported games engines have been painstakingly rewritten.
It's not easy to add support for a game you want that currently isn't supported.
Q: My Monkey Island 1 doesn't have any music, what gives?
@@ -128,7 +128,7 @@ To build ScummVM for PSP you need:
(*) = optional
Once you've installed these libraries (read their README.PSP for instructions),
-create a subdirectory in your ScummVM folder called 'builds/psp'. Then, in this folder, type
+create a subdirectory in your ScummVM folder called 'builds/psp'. Then, in this folder, type
'../../configure --host=psp --enable-plugins --default-dynamic'. If everything is installed
correctly, ScummVM will inform you as it finds the right components. Finally type 'make' to build.
diff --git a/backends/platform/psp/README.PSP.in b/backends/platform/psp/README.PSP.in
index 1d48780d3c..57058abd85 100644
--- a/backends/platform/psp/README.PSP.in
+++ b/backends/platform/psp/README.PSP.in
@@ -32,9 +32,9 @@ Right trigger - Input letters: lowercase/uppercase (press to toggle)
Left trigger - Input numbers/symbols (press to toggle)
D-Pad - Select square of characters (up, down, left or right)
Buttons/Triggers - Choose a specific character in the square. The four center characters are chosen
- by the button in the corresponding position. The 2 top characters are chosen by the
+ by the button in the corresponding position. The 2 top characters are chosen by the
triggers.
-Analog - Moves in a direction (left/right/up/down) (Useful to keep moving
+Analog - Moves in a direction (left/right/up/down) (Useful to keep moving
while typing in AGI games among other things)
1st Person Game Mode (Can be ignored by most users)
@@ -49,9 +49,9 @@ Square - Is the modifier key instead of Right Trigger.
Left/Right Trigger - Strafe left/right
D-Pad Left/Right - Turn left/right
Square + D-Pad - F1/F2/F3/F4
-Square + Start - Esc (shows game menu)
+Square + Start - Esc (shows game menu)
+
-
Notes
=====
- Notice that you can switch between games! This is much faster than quitting
@@ -61,7 +61,7 @@ Notes
- The PSP version of ScummVM uses the Media Engine to accelerate decoding of MP3 files. This means
that if you have the choice of compressing using Ogg files or MP3 files, choose MP3 -- the game
will generally run faster.
-
+
- Plugin files are NOT interchangeable between ScummVM versions! You must copy ALL the
plugin files that come with every version of ScummVM. They sit in the /plugin
subdirectory. If you get a crash upon startup, try deleting all the existing
@@ -85,7 +85,7 @@ A: A PSP that can run homebrew and the necessary datafiles for the game you wan
Q: Can I run game X with this?
A: You can find the list of supported games on the compatibility page
at http://www.scummvm.org
- Note that ScummVM is NOT an emulator. The supported games engines have been painstakingly rewritten.
+ Note that ScummVM is NOT an emulator. The supported games engines have been painstakingly rewritten.
It's not easy to add support for a game you want that currently isn't supported.
Q: My Monkey Island 1 doesn't have any music, what gives?
@@ -128,7 +128,7 @@ To build ScummVM for PSP you need:
(*) = optional
Once you've installed these libraries (read their README.PSP for instructions),
-create a subdirectory in your ScummVM folder called 'builds/psp'. Then, in this folder, type
+create a subdirectory in your ScummVM folder called 'builds/psp'. Then, in this folder, type
'../../configure --host=psp --enable-plugins --default-dynamic'. If everything is installed
correctly, ScummVM will inform you as it finds the right components. Finally type 'make' to build.
diff --git a/backends/platform/psp/audio.cpp b/backends/platform/psp/audio.cpp
index e540733162..d7487b0c1a 100644
--- a/backends/platform/psp/audio.cpp
+++ b/backends/platform/psp/audio.cpp
@@ -23,10 +23,10 @@
*
*/
-#include
+#include
#include
-
-#include "common/scummsys.h"
+
+#include "common/scummsys.h"
#include "backends/platform/psp/audio.h"
//#define __PSP_DEBUG_FUNCS__ /* For debugging function calls */
@@ -39,37 +39,37 @@ bool PspAudio::open(uint32 freq, uint32 numOfChannels, uint32 numOfSamples, call
if (_init) {
PSP_ERROR("audio device already initialized\n");
return true;
- }
+ }
- PSP_DEBUG_PRINT("freq[%d], numOfChannels[%d], numOfSamples[%d], callback[%p], userData[%x]\n",
+ PSP_DEBUG_PRINT("freq[%d], numOfChannels[%d], numOfSamples[%d], callback[%p], userData[%x]\n",
freq, numOfChannels, numOfSamples, callback, (uint32)userData);
-
+
numOfSamples = PSP_AUDIO_SAMPLE_ALIGN(numOfSamples);
uint32 bufLen = numOfSamples * numOfChannels * NUM_BUFFERS * sizeof(uint16);
-
+
PSP_DEBUG_PRINT("total buffer size[%d]\n", bufLen);
-
+
_buffers[0] = (byte *)memalign(64, bufLen);
if (!_buffers[0]) {
PSP_ERROR("failed to allocate memory for audio buffers\n");
return false;
}
memset(_buffers[0], 0, bufLen); // clean the buffer
-
+
// Fill in the rest of the buffer pointers
byte *pBuffer = _buffers[0];
for (int i = 1; i < NUM_BUFFERS; i++) {
pBuffer += numOfSamples * numOfChannels * sizeof(uint16);
_buffers[i] = pBuffer;
}
-
+
// Reserve a HW channel for our audio
_pspChannel = sceAudioChReserve(PSP_AUDIO_NEXT_CHANNEL, numOfSamples, numOfChannels == 2 ? PSP_AUDIO_FORMAT_STEREO : PSP_AUDIO_FORMAT_MONO);
if (_pspChannel < 0) {
PSP_ERROR("failed to reserve audio channel\n");
return false;
}
-
+
PSP_DEBUG_PRINT("reserved channel[%d] for audio\n", _pspChannel);
// Save our data
@@ -80,17 +80,17 @@ bool PspAudio::open(uint32 freq, uint32 numOfChannels, uint32 numOfSamples, call
_userData = userData;
_bufferToFill = 0;
_bufferToPlay = 0;
-
+
_init = true;
_paused = true; // start in paused mode
-
+
threadCreateAndStart("audioThread", PRIORITY_AUDIO_THREAD, STACK_AUDIO_THREAD); // start the consumer thread
-
+
return true;
}
// The real thread function
-void PspAudio::threadFunction() {
+void PspAudio::threadFunction() {
assert(_callback);
PSP_DEBUG_PRINT_FUNC("audio thread started\n");
@@ -108,12 +108,12 @@ void PspAudio::threadFunction() {
PSP_DEBUG_PRINT("filling buffer[%d]\n", _bufferToFill);
_callback(_userData, _buffers[_bufferToFill], _bufferSize); // ask mixer to fill in data
nextBuffer(_bufferToFill);
-
+
PSP_DEBUG_PRINT("playing buffer[%d].\n", _bufferToPlay);
playBuffer();
nextBuffer(_bufferToPlay);
} // while _init
-
+
// destroy everything
free(_buffers[0]);
sceAudioChRelease(_pspChannel);
@@ -136,7 +136,7 @@ inline bool PspAudio::playBuffer() {
ret = sceAudioOutputBlocking(_pspChannel, PSP_AUDIO_VOLUME_MAX, _buffers[_bufferToPlay]);
else
ret = sceAudioOutputPannedBlocking(_pspChannel, PSP_AUDIO_VOLUME_MAX, PSP_AUDIO_VOLUME_MAX, _buffers[_bufferToPlay]);
-
+
if (ret < 0) {
PSP_ERROR("failed to output audio. Error[%d]\n", ret);
return false;
@@ -146,5 +146,5 @@ inline bool PspAudio::playBuffer() {
void PspAudio::close() {
PSP_DEBUG_PRINT("close has been called ***************\n");
- _init = false;
+ _init = false;
}
diff --git a/backends/platform/psp/audio.h b/backends/platform/psp/audio.h
index eeba598fed..ec9801185f 100644
--- a/backends/platform/psp/audio.h
+++ b/backends/platform/psp/audio.h
@@ -35,9 +35,9 @@ public:
FREQUENCY = 44100 /* only frequency we allow */
};
typedef void (* callbackFunc)(void *userData, byte *samples, int len); // audio callback to call
- PspAudio() : _pspChannel(0),
- _numOfChannels(0), _numOfSamples(0), _callback(0),
- _bufferToPlay(0), _bufferToFill(0),
+ PspAudio() : _pspChannel(0),
+ _numOfChannels(0), _numOfSamples(0), _callback(0),
+ _bufferToPlay(0), _bufferToFill(0),
_init(false), _paused(true) {
for (int i=0; i_renderFinished = true; // Only this thread can set the variable to true
-
+
return 0;
}
@@ -214,7 +214,7 @@ inline void MasterGuRenderer::guPreRender() {
DEBUG_ENTER_FUNC();
_renderFinished = false; // set to synchronize with callback thread
-
+
#ifdef ENABLE_RENDER_MEASURE
_lastRenderTime = g_system->getMillis();
#endif /* ENABLE_RENDER_MEASURE */
@@ -243,7 +243,7 @@ inline void MasterGuRenderer::guPostRender() {
else
sceKernelNotifyCallback(_callbackId, 0); // notify the callback. Nothing extra to pass
#else
- sceGuSync(0, 0);
+ sceGuSync(0, 0);
#ifdef ENABLE_RENDER_MEASURE
uint32 now = g_system->getMillis();
@@ -253,7 +253,7 @@ inline void MasterGuRenderer::guPostRender() {
sceDisplayWaitVblankStart();
sceGuSwapBuffers();
_renderFinished = true;
-#endif /* !USE_DISPLAY_CALLBACK */
+#endif /* !USE_DISPLAY_CALLBACK */
}
void MasterGuRenderer::guShutDown() {
@@ -281,7 +281,7 @@ void DisplayManager::init() {
#ifdef USE_DISPLAY_CALLBACK
_masterGuRenderer.setupCallbackThread();
#endif
-
+
}
void DisplayManager::setSizeAndPixelFormat(uint width, uint height, const Graphics::PixelFormat *format) {
@@ -351,10 +351,10 @@ void DisplayManager::calculateScaleParams() {
break;
case KEEP_ASPECT_RATIO: { // maximize the height while keeping aspect ratio
float aspectRatio = (float)_displayParams.screenSource.width / (float)_displayParams.screenSource.height;
-
+
_displayParams.screenOutput.height = PSP_SCREEN_HEIGHT; // always full height
_displayParams.screenOutput.width = (uint32)(PSP_SCREEN_HEIGHT * aspectRatio);
-
+
if (_displayParams.screenOutput.width > PSP_SCREEN_WIDTH) // we can't have wider than the screen
_displayParams.screenOutput.width = PSP_SCREEN_WIDTH;
}
@@ -366,7 +366,7 @@ void DisplayManager::calculateScaleParams() {
default:
PSP_ERROR("Unsupported graphics mode[%d].\n", _graphicsMode);
}
-
+
// calculate scale factors for X and Y
_displayParams.scaleX = ((float)_displayParams.screenOutput.width) / _displayParams.screenSource.width;
_displayParams.scaleY = ((float)_displayParams.screenOutput.height) / _displayParams.screenSource.height;
@@ -381,9 +381,9 @@ bool DisplayManager::renderAll() {
if (!_masterGuRenderer.isRenderFinished()) {
PSP_DEBUG_PRINT("Callback render not finished.\n");
return false; // didn't render
- }
+ }
#endif /* USE_DISPLAY_CALLBACK */
-
+
// This is cheaper than checking time, so we do it first
if (!_screen->isDirty() &&
(!_overlay->isDirty()) &&
@@ -393,7 +393,7 @@ bool DisplayManager::renderAll() {
return true; // nothing to render
}
- if (!isTimeToUpdate())
+ if (!isTimeToUpdate())
return false; // didn't render
PSP_DEBUG_PRINT("screen[%s], overlay[%s], cursor[%s], keyboard[%s]\n",
@@ -425,7 +425,7 @@ bool DisplayManager::renderAll() {
_keyboard->setClean();
_masterGuRenderer.guPostRender();
-
+
return true; // rendered successfully
}
diff --git a/backends/platform/psp/display_manager.h b/backends/platform/psp/display_manager.h
index fa31fbcd40..00d3851243 100644
--- a/backends/platform/psp/display_manager.h
+++ b/backends/platform/psp/display_manager.h
@@ -81,7 +81,7 @@ public:
void guPostRender();
void guShutDown();
bool isRenderFinished() { return _renderFinished; }
- void setupCallbackThread();
+ void setupCallbackThread();
private:
virtual void threadFunction(); // for the display callback thread
static uint32 _displayList[];
@@ -89,7 +89,7 @@ private:
void guProgramDisplayBufferSizes();
static int guCallback(int, int, void *__this); // for the display callback
bool _renderFinished; // for sync with render callback
- int _callbackId; // to keep track of render callback
+ int _callbackId; // to keep track of render callback
};
class Screen;
diff --git a/backends/platform/psp/input.cpp b/backends/platform/psp/input.cpp
index 3ea2d4365d..ed868ef375 100644
--- a/backends/platform/psp/input.cpp
+++ b/backends/platform/psp/input.cpp
@@ -50,17 +50,17 @@ inline void Button::clear() {
_ascii = 0;
_flag = 0;
_pspEventDown.clear();
- _pspEventUp.clear();
+ _pspEventUp.clear();
}
-inline bool Button::getEvent(Common::Event &event, PspEvent &pspEvent, bool down) {
+inline bool Button::getEvent(Common::Event &event, PspEvent &pspEvent, bool down) {
if (down) {
if (!_pspEventDown.isEmpty())
pspEvent = _pspEventDown;
} else { // up
if (!_pspEventUp.isEmpty())
pspEvent = _pspEventUp;
- }
+ }
if (_key != Common::KEYCODE_INVALID) {
event.type = down ? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP;
event.kbd.keycode = _key;
@@ -79,19 +79,19 @@ void Button::setPspEvent(PspEventType typeDown, uint32 dataDown, PspEventType ty
_pspEventDown.type = typeDown;
_pspEventDown.data = dataDown;
_pspEventUp.type = typeUp;
- _pspEventUp.data = dataUp;
-}
+ _pspEventUp.data = dataUp;
+}
// Translates bitfields to our constants
// We put combined bitfields first to make sure we pick up diagonals
const uint32 ButtonPad::_buttonMap[] = {
- PSP_CTRL_UP | PSP_CTRL_LEFT,
- PSP_CTRL_UP | PSP_CTRL_RIGHT,
+ PSP_CTRL_UP | PSP_CTRL_LEFT,
+ PSP_CTRL_UP | PSP_CTRL_RIGHT,
PSP_CTRL_DOWN | PSP_CTRL_RIGHT,
PSP_CTRL_DOWN | PSP_CTRL_LEFT,
PSP_CTRL_RIGHT, PSP_CTRL_DOWN, PSP_CTRL_LEFT, PSP_CTRL_UP,
- PSP_CTRL_CROSS, PSP_CTRL_CIRCLE, PSP_CTRL_TRIANGLE, PSP_CTRL_SQUARE,
- PSP_CTRL_LTRIGGER, PSP_CTRL_RTRIGGER, PSP_CTRL_START, PSP_CTRL_SELECT
+ PSP_CTRL_CROSS, PSP_CTRL_CIRCLE, PSP_CTRL_TRIANGLE, PSP_CTRL_SQUARE,
+ PSP_CTRL_LTRIGGER, PSP_CTRL_RTRIGGER, PSP_CTRL_START, PSP_CTRL_SELECT
};
ButtonPad::ButtonPad() : _prevButtonState(0), _shifted(UNSHIFTED), _padMode(PAD_MODE_NORMAL),
@@ -125,7 +125,7 @@ void ButtonPad::initButtonsNormalMode() {
DEBUG_ENTER_FUNC();
PSP_DEBUG_PRINT("initializing buttons for normal mode\n");
clearButtons();
-
+
// Dpad
_button[BTN_UP_LEFT][UNSHIFTED].setKey(Common::KEYCODE_KP7, '7');
_button[BTN_LEFT][SHIFTED].setKey(Common::KEYCODE_KP7, '7'); // same as up_left
@@ -139,7 +139,7 @@ void ButtonPad::initButtonsNormalMode() {
_button[BTN_DOWN][UNSHIFTED].setKey(Common::KEYCODE_KP2, '2');
_button[BTN_DOWN_RIGHT][UNSHIFTED].setKey(Common::KEYCODE_KP3, '3');
_button[BTN_RIGHT][SHIFTED].setKey(Common::KEYCODE_KP3, '3'); // same as down_right
-
+
// Other buttons
_button[BTN_CROSS][UNSHIFTED].setPspEvent(PSP_EVENT_LBUTTON, true, PSP_EVENT_LBUTTON, false);
_button[BTN_CIRCLE][UNSHIFTED].setPspEvent(PSP_EVENT_RBUTTON, true, PSP_EVENT_RBUTTON, false);
@@ -153,8 +153,8 @@ void ButtonPad::initButtonsNormalMode() {
_button[BTN_RTRIGGER][UNSHIFTED].setKey(Common::KEYCODE_INVALID, 0, Common::KBD_SHIFT);
_button[BTN_START][SHIFTED].setKey(Common::KEYCODE_F5, Common::ASCII_F5);
_button[BTN_START][UNSHIFTED].setKey(Common::KEYCODE_F5, Common::ASCII_F5, Common::KBD_CTRL);
- _button[BTN_SELECT][UNSHIFTED].setPspEvent(PSP_EVENT_SHOW_VIRTUAL_KB, true, PSP_EVENT_NONE, 0);
-}
+ _button[BTN_SELECT][UNSHIFTED].setPspEvent(PSP_EVENT_SHOW_VIRTUAL_KB, true, PSP_EVENT_NONE, 0);
+}
void ButtonPad::initButtonsLolMode() {
DEBUG_ENTER_FUNC();
@@ -166,12 +166,12 @@ void ButtonPad::initButtonsLolMode() {
_button[BTN_SQUARE][UNSHIFTED].setPspEvent(PSP_EVENT_SHIFT, true, PSP_EVENT_SHIFT, false);
_button[BTN_SQUARE][SHIFTED].clear();
_button[BTN_SQUARE][SHIFTED].setPspEvent(PSP_EVENT_SHIFT, true, PSP_EVENT_SHIFT, false);
-
+
// Dpad
_button[BTN_LEFT][UNSHIFTED].clear();
_button[BTN_LEFT][UNSHIFTED].setKey(Common::KEYCODE_KP7, '7');
_button[BTN_LEFT][SHIFTED].clear();
- _button[BTN_LEFT][SHIFTED].setKey(Common::KEYCODE_F1, Common::ASCII_F1);
+ _button[BTN_LEFT][SHIFTED].setKey(Common::KEYCODE_F1, Common::ASCII_F1);
_button[BTN_UP][SHIFTED].clear();
_button[BTN_UP][SHIFTED].setKey(Common::KEYCODE_F2, Common::ASCII_F2);
_button[BTN_RIGHT][UNSHIFTED].clear();
@@ -194,13 +194,13 @@ void ButtonPad::initButtonsLolMode() {
bool ButtonPad::getEvent(Common::Event &event, PspEvent &pspEvent, SceCtrlData &pad) {
DEBUG_ENTER_FUNC();
-
+
//PSP_DEBUG_PRINT("buttons[%x]\n", pad.Buttons);
uint32 curButtonState = PSP_ALL_BUTTONS & pad.Buttons; // we only care about these
-
- modifyButtonsForCombos(pad); // change buttons for combos
-
+
+ modifyButtonsForCombos(pad); // change buttons for combos
+
return getEventFromButtonState(event, pspEvent, curButtonState);
}
@@ -208,13 +208,13 @@ bool ButtonPad::getEventFromButtonState(Common::Event &event, PspEvent &pspEvent
DEBUG_ENTER_FUNC();
_buttonsChanged[_shifted] |= buttonState ^ _prevButtonState; // add any buttons that changed
_prevButtonState = buttonState;
-
+
for (int shiftState = UNSHIFTED; shiftState < SHIFTED_MODE_LAST; shiftState++) {
if (_buttonsChanged[shiftState]) { // any button to address?
PSP_DEBUG_PRINT("found changed buttons\n");
- ButtonType buttonType = BTN_LAST;
+ ButtonType buttonType = BTN_LAST;
bool buttonDown = false; // normally we release a button (as in when we're in a different shiftmode)
-
+
for (int i = BTN_UP_LEFT; i < BTN_LAST; i++) {
uint32 buttonCode = _buttonMap[i];
if ((_buttonsChanged[shiftState] & buttonCode) == buttonCode) { // check for this changed button
@@ -222,23 +222,23 @@ bool ButtonPad::getEventFromButtonState(Common::Event &event, PspEvent &pspEvent
_buttonsChanged[shiftState] &= ~buttonCode; // save the fact that we treated this button
if (shiftState == _shifted)
buttonDown = buttonState & buttonCode ? true : false; // pressed or released?
-
- PSP_DEBUG_PRINT("button[%i] pressed\n", i);
+
+ PSP_DEBUG_PRINT("button[%i] pressed\n", i);
break;
}
}
-
+
assert (buttonType < BTN_LAST);
bool haveEvent = _button[buttonType][shiftState].getEvent(event, pspEvent, buttonDown);
if (haveEvent)
PSP_DEBUG_PRINT("have event. key[%d] flag[%x] %s\n", event.kbd.ascii, event.kbd.flags, buttonDown ? "down" : "up");
return haveEvent;
}
- }
-
+ }
+
return false;
}
-
+
void ButtonPad::modifyButtonsForCombos(SceCtrlData &pad) {
if (DOWN(PSP_CTRL_RTRIGGER | PSP_CTRL_LTRIGGER)) {
if (!_comboMode) { // we're entering combo mode
@@ -262,24 +262,24 @@ void ButtonPad::modifyButtonsForCombos(SceCtrlData &pad) {
initButtons(); // reset the button configuration
_comboMode = false;
}
- }
+ }
}
-
+
bool Nub::getEvent(Common::Event &event, PspEvent &pspEvent, SceCtrlData &pad) {
DEBUG_ENTER_FUNC();
-
+
if (_dpadMode) { // Convert the nub to a D-Pad
uint32 buttonState;
translateToDpadState(pad.Lx, pad.Ly, buttonState);
return _buttonPad.getEventFromButtonState(event, pspEvent, buttonState);
}
-
+
int32 analogStepX = pad.Lx; // Goes up to 255.
int32 analogStepY = pad.Ly;
analogStepX = modifyNubAxisMotion(analogStepX);
analogStepY = modifyNubAxisMotion(analogStepY);
-
+
int32 oldX = _cursor->getX();
int32 oldY = _cursor->getY();
@@ -316,7 +316,7 @@ bool Nub::getEvent(Common::Event &event, PspEvent &pspEvent, SceCtrlData &pad) {
event.mouse.x = newX;
event.mouse.y = newY;
PSP_DEBUG_PRINT("Nub event. X[%d], Y[%d]\n", newX, newY);
- return true;
+ return true;
}
}
return false;
@@ -325,12 +325,12 @@ bool Nub::getEvent(Common::Event &event, PspEvent &pspEvent, SceCtrlData &pad) {
void Nub::translateToDpadState(int dpadX, int dpadY, uint32 &buttonState) {
#define MIN_NUB_POSITION 70
buttonState = 0;
-
+
if (dpadX > 127 + MIN_NUB_POSITION)
buttonState |= PSP_CTRL_RIGHT;
else if (dpadX < 127 - MIN_NUB_POSITION)
buttonState |= PSP_CTRL_LEFT;
-
+
if (dpadY > 127 + MIN_NUB_POSITION)
buttonState |= PSP_CTRL_DOWN;
else if (dpadY < 127 - MIN_NUB_POSITION)
@@ -353,11 +353,11 @@ inline int32 Nub::modifyNubAxisMotion(int32 input) {
return input;
}
-inline bool Nub::isButtonDown() {
+inline bool Nub::isButtonDown() {
if (_dpadMode) // only relevant in dpad mode
return _buttonPad.isButtonDown();
return false;
-}
+}
const char *InputHandler::_padModeText[] = {
"Normal Button Mode",
@@ -367,7 +367,7 @@ const char *InputHandler::_padModeText[] = {
void InputHandler::init() {
sceCtrlSetSamplingCycle(0); // set sampling to vsync. n = n usecs
sceCtrlSetSamplingMode(1); // analog
-
+
_buttonPad.initButtons();
}
@@ -386,7 +386,7 @@ bool InputHandler::getAllInputs(Common::Event &event) {
bool haveEvent;
//memset(&event, 0, sizeof(event));
-
+
haveEvent = getEvent(event, pad);
if (haveEvent) {
@@ -407,7 +407,7 @@ bool InputHandler::getEvent(Common::Event &event, SceCtrlData &pad) {
} else { // only process buttonpad if keyboard invisible
haveEvent = _buttonPad.getEvent(event, pspEvent, pad);
}
-
+
if (!haveEvent && pspEvent.isEmpty())
haveEvent = _nub.getEvent(event, pspEvent, pad);
@@ -417,20 +417,20 @@ bool InputHandler::getEvent(Common::Event &event, SceCtrlData &pad) {
pspEvent = _pendingPspEvent;
_pendingPspEvent.clear();
}
- }
-
+ }
+
// handle any PSP events we might have
if (!pspEvent.isEmpty())
haveEvent |= handlePspEvent(event, pspEvent); // overrides any event we might have
-
+
return haveEvent;
}
bool InputHandler::handlePspEvent(Common::Event &event, PspEvent &pspEvent) {
bool haveEvent = false;
-
+
PSP_DEBUG_PRINT("have pspEvent[%d] data[%d]\n", pspEvent.type, pspEvent.data);
-
+
switch (pspEvent.type) {
case PSP_EVENT_SHIFT:
handleShiftEvent((ShiftMode)pspEvent.data);
@@ -449,11 +449,11 @@ bool InputHandler::handlePspEvent(Common::Event &event, PspEvent &pspEvent) {
break;
case PSP_EVENT_RBUTTON:
haveEvent = true;
- if (pspEvent.data) // down
+ if (pspEvent.data) // down
handleMouseEvent(event, Common::EVENT_RBUTTONDOWN, "RButtonDown");
else
handleMouseEvent(event, Common::EVENT_RBUTTONUP, "RButtonUp");
- break;
+ break;
case PSP_EVENT_MODE_SWITCH:
handleModeSwitchEvent();
break;
@@ -464,7 +464,7 @@ bool InputHandler::handlePspEvent(Common::Event &event, PspEvent &pspEvent) {
PSP_ERROR("Unhandled PSP Event[%d]\n", pspEvent.type);
break;
}
-
+
return haveEvent;
}
@@ -490,10 +490,10 @@ void InputHandler::handleModeSwitchEvent() {
_padMode = (PspPadMode)(_padMode + 1);
if (_padMode >= PAD_MODE_LAST)
_padMode = PAD_MODE_NORMAL;
-
+
GUI::TimedMessageDialog dialog(_padModeText[_padMode], 1500);
dialog.runModal();
-
+
_buttonPad.setPadMode(_padMode);
_buttonPad.initButtons();
}
@@ -502,10 +502,10 @@ void InputHandler::handleModeSwitchEvent() {
/*
void InputHandler::handleSpeedChange(bool up) {
char *dialogMsg;
-
+
if (up) {
dialogMsg = "
-
+
GUI::TimedMessageDialog dialog(_padModeText[_padMode], 1500);
dialog.runModal();
}*/
diff --git a/backends/platform/psp/input.h b/backends/platform/psp/input.h
index 6991c50533..acca04f376 100644
--- a/backends/platform/psp/input.h
+++ b/backends/platform/psp/input.h
@@ -48,11 +48,11 @@ struct PspEvent {
PspEventType type;
uint32 data;
PspEvent() { clear(); }
- void clear() {
+ void clear() {
type = PSP_EVENT_NONE;
data = 0;
}
- bool isEmpty() { return type == PSP_EVENT_NONE; }
+ bool isEmpty() { return type == PSP_EVENT_NONE; }
};
enum PspPadMode {
@@ -75,7 +75,7 @@ private:
uint32 _flag;
PspEvent _pspEventDown; // event when we press
PspEvent _pspEventUp; // event when we release
-public:
+public:
Button();
void clear();
bool getEvent(Common::Event &event, PspEvent &pspEvent, bool buttonDown);
@@ -105,7 +105,7 @@ public:
BTN_LAST
};
-private:
+private:
Button _button[BTN_LAST][SHIFTED_MODE_LAST];
uint32 _buttonsChanged[SHIFTED_MODE_LAST]; // normal and shifted
uint32 _prevButtonState;
@@ -128,7 +128,7 @@ public:
bool isButtonDown() { return _prevButtonState; }
void initButtons();
};
-
+
class Nub {
private:
Cursor *_cursor; // to enable changing/getting cursor position
@@ -137,35 +137,35 @@ private:
ShiftMode _shifted;
bool _dpadMode;
-public:
+public:
Nub() : _shifted(UNSHIFTED), _dpadMode(false) { _buttonPad.initButtons(); }
- void setCursor(Cursor *cursor) { _cursor = cursor; }
+ void setCursor(Cursor *cursor) { _cursor = cursor; }
void setDpadMode(bool active) { _dpadMode = active; }
void setShifted(ShiftMode shifted) { _shifted = shifted; }
bool isButtonDown();
-
+
bool getEvent(Common::Event &event, PspEvent &pspEvent, SceCtrlData &pad);
int32 modifyNubAxisMotion(int32 input);
void translateToDpadState(int dpadX, int dpadY, uint32 &buttonState); // convert nub data to dpad data
-};
+};
class InputHandler {
public:
InputHandler() : _keyboard(0), _cursor(0), _padMode(PAD_MODE_NORMAL), _lastPadCheckTime(0) {}
void setKeyboard(PSPKeyboard *keyboard) { _keyboard = keyboard; }
void setCursor(Cursor *cursor) { _cursor = cursor; _nub.setCursor(cursor); }
-
- void init();
+
+ void init();
bool getAllInputs(Common::Event &event);
-
+
private:
PSPKeyboard *_keyboard;
Cursor *_cursor;
-
- Nub _nub;
+
+ Nub _nub;
ButtonPad _buttonPad;
-
+
PspPadMode _padMode; // whice mode we're in
PspEvent _pendingPspEvent; // an event that can't be handled yet
uint32 _lastPadCheckTime;
diff --git a/backends/platform/psp/memory.cpp b/backends/platform/psp/memory.cpp
index 1e08173286..924ab356e8 100644
--- a/backends/platform/psp/memory.cpp
+++ b/backends/platform/psp/memory.cpp
@@ -49,29 +49,29 @@ void PspMemory::copy(byte *dst, const byte *src, uint32 bytes) {
// align the destination pointer first
uint32 prefixDst = (((uint32)dst) & 0x3);
-
+
if (prefixDst) {
- prefixDst = 4 - prefixDst; // prefix only if we have address % 4 != 0
+ prefixDst = 4 - prefixDst; // prefix only if we have address % 4 != 0
PSP_DEBUG_PRINT("prefixDst[%d]\n", prefixDst);
bytes -= prefixDst; // remember we assume bytes >= 4
-
+
if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) { // check if it's worthwhile to continue
copy8(dst, src, bytes + prefixDst);
#ifdef TEST_MEMORY_COPY
testCopy(debugDst, debugSrc, debugBytes);
-#endif
+#endif
return;
}
-
+
while (prefixDst--) {
*dst++ = *src++;
- }
+ }
}
-
+
// check the source pointer alignment now
uint32 alignSrc = (((uint32)src) & 0x3);
-
+
if (alignSrc) { // we'll need to realign our reads
copy32Misaligned((uint32 *)dst, src, bytes, alignSrc);
} else {
@@ -80,14 +80,14 @@ void PspMemory::copy(byte *dst, const byte *src, uint32 bytes) {
#ifdef TEST_MEMORY_COPY
testCopy(debugDst, debugSrc, debugBytes);
-#endif
+#endif
}
void PspMemory::copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes) {
PSP_DEBUG_PRINT("copy32Aligned(): dst32[%p], src32[%p], bytes[%d]\n", dst32, src32, bytes);
int words8 = bytes >> 5;
-
+
// try blocks of 8 words at a time
if (words8) {
while (words8--) {
@@ -110,11 +110,11 @@ void PspMemory::copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes)
dst32[7] = d;
dst32 += 8;
src32 += 8;
- }
+ }
}
-
+
int words4 = (bytes & 0x1F) >> 4;
-
+
// try blocks of 4 words at a time
if (words4) {
uint32 a, b, c, d;
@@ -129,10 +129,10 @@ void PspMemory::copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes)
dst32 += 4;
src32 += 4;
}
-
+
int bytesLeft = (bytes & 0xF); // only look at bytes left after we did the above
int wordsLeft = bytesLeft >> 2;
-
+
// now just do single words
while (wordsLeft) {
*dst32++ = *src32++;
@@ -145,7 +145,7 @@ void PspMemory::copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes)
byte *dst = (byte *)dst32;
byte *src = (byte *)src32;
-
+
while (bytesLeft--) {
*dst++ = *src++;
}
@@ -155,10 +155,10 @@ void PspMemory::copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes)
// Assume dst is aligned
void PspMemory::copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, uint32 alignSrc) {
PSP_DEBUG_PRINT("copy32Misaligned: dst32[%p], src[%p], bytes[%d], alignSrc[%d]\n", dst32, src, bytes, alignSrc);
-
+
uint32 *src32 = (uint32 *)(((uint32)src) & 0xFFFFFFFC); // remove misalignment
uint32 shiftValue, lastShiftValue;
-
+
switch (alignSrc) {
case 1:
shiftValue = 8;
@@ -178,9 +178,9 @@ void PspMemory::copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, u
// Try to do groups of 4 words
uint32 words4 = bytes >> 4;
-
+
srcWord = *src32; // preload 1st word so we read ahead
-
+
for (; words4; words4--) {
dstWord = srcWord >> shiftValue;
srcWord = src32[1];
@@ -201,12 +201,12 @@ void PspMemory::copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, u
src32 += 4;
dst32 += 4;
}
-
+
uint32 words = (bytes & 0xF) >> 2; // now get remaining words
-
+
// we read one word ahead of what we write
// setup the first read
-
+
for (; words ;words--) {
dstWord = srcWord >> shiftValue;
srcWord = src32[1]; // we still go one ahead
@@ -214,9 +214,9 @@ void PspMemory::copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, u
dstWord |= srcWord << lastShiftValue;
*dst32++ = dstWord;
}
-
+
uint32 bytesLeft = bytes & 3; // and remaining bytes
-
+
if (bytesLeft) {
byte *dst8 = (byte *)dst32;
byte *src8 = ((byte *)src32) + ((uint32)src & 0x3); // get exact location we should be at
@@ -228,7 +228,7 @@ void PspMemory::copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, u
}
void PspMemory::testCopy(const byte *debugDst, const byte *debugSrc, uint32 debugBytes) {
-
+
bool mismatch = false;
PSP_INFO_PRINT("testing fastCopy...");
@@ -246,10 +246,10 @@ void PspMemory::testCopy(const byte *debugDst, const byte *debugSrc, uint32 debu
PSP_INFO_PRINT("\n");
} else {
PSP_INFO_PRINT("ok\n");
- }
+ }
}
-//
+//
// used to swap red and blue
void PspMemorySwap::swap(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) {
DEBUG_ENTER_FUNC();
@@ -258,45 +258,45 @@ void PspMemorySwap::swap(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPi
uint32 debugBytes = bytes;
const uint16 *debugDst = dst16, *debugSrc = src16;
#endif
-
+
// align the destination pointer first
uint32 prefixDst = (((uint32)dst16) & 0x3); // for swap, we can only have 2 or 0 as our prefix
-
+
if (prefixDst) {
bytes -= prefixDst; // remember we assume bytes > 4
*dst16++ = format.swapRedBlue16(*src16++);
-
+
if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) { // check if it's worthwhile to continue
swap16(dst16, src16, bytes, format);
#ifdef TEST_MEMORY_COPY
testSwap(debugDst, debugSrc, debugBytes, format);
-#endif
+#endif
return;
}
}
-
+
// check the source pointer alignment now
uint32 alignSrc = (((uint32)src16) & 0x3);
-
+
if (alignSrc) { // we'll need to realign our reads
PSP_DEBUG_PRINT("misaligned copy of %u bytes from %p to %p\n", bytes, src16, dst16);
swap32Misaligned((uint32 *)dst16, src16, bytes, format);
} else {
swap32Aligned((uint32 *)dst16, (const uint32 *)src16, bytes, format);
}
-
+
#ifdef TEST_MEMORY_COPY
testSwap(debugDst, debugSrc, debugBytes, format);
-#endif
-
+#endif
+
}
void PspMemorySwap::testSwap(const uint16 *debugDst, const uint16 *debugSrc, uint32 debugBytes, PSPPixelFormat &format) {
-
+
bool mismatch = false;
PSP_INFO_PRINT("testing fastSwap...");
-
+
uint32 shorts = debugBytes >> 1;
for (uint32 i = 0; i < shorts; i++) {
@@ -313,13 +313,13 @@ void PspMemorySwap::testSwap(const uint16 *debugDst, const uint16 *debugSrc, uin
PSP_INFO_PRINT("\n");
} else {
PSP_INFO_PRINT("ok\n");
- }
+ }
}
void PspMemorySwap::swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes, PSPPixelFormat &format) {
DEBUG_ENTER_FUNC();
int words4 = bytes >> 4;
-
+
// try blocks of 4 words at a time
while (words4--) {
uint32 a, b, c, d;
@@ -337,14 +337,14 @@ void PspMemorySwap::swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 byt
uint32 bytesLeft = bytes & 0xF;
uint32 words = bytesLeft >> 2;
-
+
// now just do words
while (words--) {
*dst32++ = format.swapRedBlue32(*src32++);
- }
+ }
bytesLeft = bytes & 0x3;
-
+
if (bytesLeft) { // for swap, can only be 1 short left
*((uint16 *)dst32) = format.swapRedBlue16(*((uint16 *)src32));
}
@@ -357,7 +357,7 @@ void PspMemorySwap::swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32
const uint32 shiftValue = 16;
uint32 *src32 = (uint32 *)(((uint32)src16) & 0xFFFFFFFC); // remove misalignment
-
+
// Try to do groups of 4 words
uint32 words4 = bytes >> 4;
uint32 srcWord = src32[0]; // preload
@@ -382,15 +382,15 @@ void PspMemorySwap::swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32
src32 += 4;
dst32 += 4;
}
-
+
uint32 words = (bytes & 0xF) >> 2;
-
+
// we read one word ahead of what we write
// setup the first read
if (words) {
//srcWord = *src32++; // don't need this. already loaded
src32++; // we already have the value loaded in
-
+
while (words--) {
uint32 dstWord = srcWord >> shiftValue;
srcWord = *src32++;
@@ -398,9 +398,9 @@ void PspMemorySwap::swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32
*dst32++ = format.swapRedBlue32(dstWord);
}
}
-
+
uint32 bytesLeft = bytes & 3;
-
+
if (bytesLeft) { // for swap, can only be 1 short left
*((uint16 *)dst32) = format.swapRedBlue16((uint16)(srcWord >> shiftValue));
}
diff --git a/backends/platform/psp/memory.h b/backends/platform/psp/memory.h
index f54436fb99..54e9225b2e 100644
--- a/backends/platform/psp/memory.h
+++ b/backends/platform/psp/memory.h
@@ -40,7 +40,7 @@ inline void lwl_copy(byte *dst, const byte *src) {
asm volatile ("lwr %0,0(%1)\n\t"
"lwl %0,3(%1)\n\t"
: "=&r" (data) : "r" (src), "m" (*src));
-
+
asm volatile ("swr %1,0(%2)\n\t"
"swl %1,3(%2)\n\t"
: "=m" (*dst) : "r" (data), "r" (dst));
@@ -55,7 +55,7 @@ private:
static void copy(byte *dst, const byte *src, uint32 bytes);
static void copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes);
static void copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, uint32 alignSrc);
-
+
static inline void copy8(byte *dst, const byte *src, int32 bytes) {
//PSP_DEBUG_PRINT("copy8 called with dst[%p], src[%p], bytes[%d]\n", dst, src, bytes);
uint32 words = bytes >> 2;
@@ -71,18 +71,18 @@ private:
}
}
-public:
+public:
// This is the interface to the outside world
static void *fastCopy(void *dstv, const void *srcv, int32 bytes) {
byte *dst = (byte *)dstv;
byte *src = (byte *)srcv;
-
+
if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) {
copy8(dst, src, bytes);
} else { // go to more powerful copy
copy(dst, src, bytes);
}
-
+
return dstv;
}
};
diff --git a/backends/platform/psp/mp3.cpp b/backends/platform/psp/mp3.cpp
index 574cf0d719..0e88418f13 100644
--- a/backends/platform/psp/mp3.cpp
+++ b/backends/platform/psp/mp3.cpp
@@ -38,13 +38,13 @@
#include
#include
#include
-#include
+#include
#include "backends/platform/psp/mp3.h"
//#define DISABLE_PSP_MP3 // to make us use the regular MAD decoder instead
//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */
-//#define __PSP_DEBUG_PRINT__
+//#define __PSP_DEBUG_PRINT__
#include "backends/platform/psp/trace.h"
//#define PRINT_BUFFERS /* to debug MP3 buffers */
@@ -77,7 +77,7 @@ enum {
bool Mp3PspStream::initDecoder() {
DEBUG_ENTER_FUNC();
-
+
if (_decoderInit) {
PSP_ERROR("Already initialized!");
return true;
@@ -97,15 +97,15 @@ bool Mp3PspStream::initDecoder() {
PSP_ERROR("failed to load audiocodec.prx. ME cannot start.\n");
_decoderFail = true;
return false;
- }
- } else {
+ }
+ } else {
if (sceUtilityLoadAvModule(PSP_AV_MODULE_AVCODEC) < 0) {
PSP_ERROR("failed to load AVCODEC module. ME cannot start.\n");
_decoderFail = true;
return false;
}
}
-
+
PSP_DEBUG_PRINT("Using PSP's ME for MP3\n"); // important to know this is happening
_decoderInit = true;
@@ -114,10 +114,10 @@ bool Mp3PspStream::initDecoder() {
bool Mp3PspStream::stopDecoder() {
DEBUG_ENTER_FUNC();
-
+
if (!_decoderInit)
return true;
-
+
// Based on PSP firmware version, we need to do different things to do Media Engine processing
if (sceKernelDevkitVersion() == 0x01050001){ // TODO: how do we unload?
/* if (!unloadAudioModule("flash0:/kd/me_for_vsh.prx", PSP_MEMORY_PARTITION_KERNEL) ||
@@ -130,10 +130,10 @@ bool Mp3PspStream::stopDecoder() {
if (sceUtilityUnloadModule(PSP_MODULE_AV_AVCODEC) < 0) {
PSP_ERROR("failed to unload avcodec module\n");
return false;
- }
+ }
}
-
- _decoderInit = false;
+
+ _decoderInit = false;
return true;
}
@@ -176,27 +176,27 @@ Mp3PspStream::Mp3PspStream(Common::SeekableReadStream *inStream, DisposeAfterUse
_length(0, 1000),
_sampleRate(0),
_totalTime(mad_timer_zero) {
-
+
DEBUG_ENTER_FUNC();
assert(_decoderInit); // must be initialized by now
-
+
// let's leave the buffer guard -- who knows, it may be good?
memset(_buf, 0, sizeof(_buf));
memset(_codecInBuffer, 0, sizeof(_codecInBuffer));
-
+
initStream(); // init needed stuff for the stream
findValidHeader(); // get a first header so we can read basic stuff
-
+
_sampleRate = _header.samplerate; // copy it before it gets destroyed
_stereo = (MAD_NCHANNELS(&_header) == 2);
-
+
while (_state != MP3_STATE_EOS)
findValidHeader(); // get a first header so we can read basic stuff
-
+
_length = Timestamp(mad_timer_count(_totalTime, MAD_UNITS_MILLISECONDS), getRate());
-
+
deinitStream();
_state = MP3_STATE_INIT;
@@ -222,7 +222,7 @@ int Mp3PspStream::initStream() {
// Read the first few sample bytes into the buffer
readMP3DataIntoBuffer();
-
+
return true;
}
@@ -230,7 +230,7 @@ bool Mp3PspStream::initStreamME() {
// The following will eventually go into the thread
memset(_codecParams, 0, sizeof(_codecParams));
-
+
// Init the MP3 hardware
int ret = 0;
ret = sceAudiocodecCheckNeedMem(_codecParams, 0x1002);
@@ -245,22 +245,22 @@ bool Mp3PspStream::initStreamME() {
return false;
}
PSP_DEBUG_PRINT("sceAudioCodecGetEDRAM returned %d\n", ret);
-
+
PSP_DEBUG_PRINT("samplerate[%d]\n", _sampleRate);
_codecParams[10] = _sampleRate;
-
+
ret = sceAudiocodecInit(_codecParams, 0x1002);
if (ret < 0) {
PSP_ERROR("failed to init MP3 ME module. sceAudiocodecInit returned 0x%x.\n", ret);
return false;
}
-
+
return true;
}
Mp3PspStream::~Mp3PspStream() {
DEBUG_ENTER_FUNC();
-
+
deinitStream();
releaseStreamME(); // free the memory used for this stream
@@ -277,17 +277,17 @@ void Mp3PspStream::deinitStream() {
// Deinit MAD
mad_header_finish(&_header);
mad_stream_finish(&_stream);
-
+
_state = MP3_STATE_EOS;
}
void Mp3PspStream::releaseStreamME() {
sceAudiocodecReleaseEDRAM(_codecParams);
-}
+}
void Mp3PspStream::decodeMP3Data() {
DEBUG_ENTER_FUNC();
-
+
do {
if (_state == MP3_STATE_INIT) {
initStream();
@@ -296,17 +296,17 @@ void Mp3PspStream::decodeMP3Data() {
if (_state == MP3_STATE_EOS)
return;
-
+
findValidHeader(); // seach for next valid header
while (_state == MP3_STATE_READY) { // not a real 'while'. Just for easy flow
_stream.error = MAD_ERROR_NONE;
uint32 frame_size = _stream.next_frame - _stream.this_frame;
-
- updatePcmLength(); // Retrieve the number of PCM samples.
+
+ updatePcmLength(); // Retrieve the number of PCM samples.
// We seem to change this, so it needs to be dynamic
-
+
PSP_DEBUG_PRINT("MP3 frame size[%d]. pcmLength[%d]\n", frame_size, _pcmLength);
memcpy(_codecInBuffer, _stream.this_frame, frame_size); // we need it aligned
@@ -316,7 +316,7 @@ void Mp3PspStream::decodeMP3Data() {
_codecParams[8] = (unsigned long)_pcmSamples;
_codecParams[7] = frame_size;
_codecParams[9] = _pcmLength * 2; // x2 for stereo, though this one's not so important
-
+
// debug
#ifdef PRINT_BUFFERS
PSP_DEBUG_PRINT("mp3 frame:\n");
@@ -419,7 +419,7 @@ bool Mp3PspStream::seek(const Timestamp &where) {
// Important to release and re-init the ME
releaseStreamME();
initStreamME();
-
+
// Check if we need to rewind
if (_state != MP3_STATE_READY || mad_timer_compare(destination, _totalTime) < 0) {
initStream();
@@ -473,38 +473,38 @@ int Mp3PspStream::readBuffer(int16 *buffer, const int numSamples) {
DEBUG_ENTER_FUNC();
int samples = 0;
-#ifdef PRINT_BUFFERS
+#ifdef PRINT_BUFFERS
int16 *debugBuffer = buffer;
-#endif
-
+#endif
+
// Keep going as long as we have input available
while (samples < numSamples && _state != MP3_STATE_EOS) {
const int len = MIN(numSamples, samples + (int)(_pcmLength - _posInFrame) * MAD_NCHANNELS(&_header));
-
+
while (samples < len) {
*buffer++ = _pcmSamples[_posInFrame << 1];
samples++;
if (MAD_NCHANNELS(&_header) == 2) {
*buffer++ = _pcmSamples[(_posInFrame << 1) + 1];
samples++;
- }
+ }
_posInFrame++; // always skip an extra sample since ME always outputs stereo
}
-
+
if (_posInFrame >= _pcmLength) {
// We used up all PCM data in the current frame -- read & decode more
decodeMP3Data();
}
}
-
+
#ifdef PRINT_BUFFERS
PSP_INFO_PRINT("buffer:\n");
for (int i = 0; i> 1, PSP_SCREEN_HEIGHT >> 1); // Mouse in the middle of the screen
@@ -148,7 +148,7 @@ Common::List OSystem_PSP::getSupportedFormats() const {
void OSystem_PSP::initSize(uint width, uint height, const Graphics::PixelFormat *format) {
DEBUG_ENTER_FUNC();
- _pendingUpdate = false;
+ _pendingUpdate = false;
_displayManager.setSizeAndPixelFormat(width, height, format);
_cursor.setVisible(false);
@@ -167,7 +167,7 @@ int16 OSystem_PSP::getHeight() {
void OSystem_PSP::setPalette(const byte *colors, uint start, uint num) {
DEBUG_ENTER_FUNC();
- _pendingUpdate = false;
+ _pendingUpdate = false;
_screen.setPartialPalette(colors, start, num);
_cursor.setScreenPalette(colors, start, num);
_cursor.clearKeyColor();
@@ -175,7 +175,7 @@ void OSystem_PSP::setPalette(const byte *colors, uint start, uint num) {
void OSystem_PSP::setCursorPalette(const byte *colors, uint start, uint num) {
DEBUG_ENTER_FUNC();
- _pendingUpdate = false;
+ _pendingUpdate = false;
_cursor.setCursorPalette(colors, start, num);
_cursor.enableCursorPalette(true);
_cursor.clearKeyColor(); // Do we need this?
@@ -183,25 +183,25 @@ void OSystem_PSP::setCursorPalette(const byte *colors, uint start, uint num) {
void OSystem_PSP::disableCursorPalette(bool disable) {
DEBUG_ENTER_FUNC();
- _pendingUpdate = false;
+ _pendingUpdate = false;
_cursor.enableCursorPalette(!disable);
}
void OSystem_PSP::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
DEBUG_ENTER_FUNC();
- _pendingUpdate = false;
+ _pendingUpdate = false;
_screen.copyFromRect(buf, pitch, x, y, w, h);
}
Graphics::Surface *OSystem_PSP::lockScreen() {
DEBUG_ENTER_FUNC();
- _pendingUpdate = false;
+ _pendingUpdate = false;
return _screen.lockAndGetForEditing();
}
void OSystem_PSP::unlockScreen() {
DEBUG_ENTER_FUNC();
- _pendingUpdate = false;
+ _pendingUpdate = false;
// The screen is always completely updated anyway, so we don't have to force a full update here.
_screen.unlock();
}
@@ -219,7 +219,7 @@ void OSystem_PSP::setShakePos(int shakeOffset) {
void OSystem_PSP::showOverlay() {
DEBUG_ENTER_FUNC();
- _pendingUpdate = false;
+ _pendingUpdate = false;
_overlay.setVisible(true);
_cursor.setLimits(_overlay.getWidth(), _overlay.getHeight());
_cursor.useGlobalScaler(false); // mouse with overlay is 1:1
@@ -227,7 +227,7 @@ void OSystem_PSP::showOverlay() {
void OSystem_PSP::hideOverlay() {
DEBUG_ENTER_FUNC();
- _pendingUpdate = false;
+ _pendingUpdate = false;
_overlay.setVisible(false);
_cursor.setLimits(_screen.getWidth(), _screen.getHeight());
_cursor.useGlobalScaler(true); // mouse needs to be scaled with screen
@@ -235,7 +235,7 @@ void OSystem_PSP::hideOverlay() {
void OSystem_PSP::clearOverlay() {
DEBUG_ENTER_FUNC();
- _pendingUpdate = false;
+ _pendingUpdate = false;
_overlay.clearBuffer();
}
@@ -246,7 +246,7 @@ void OSystem_PSP::grabOverlay(OverlayColor *buf, int pitch) {
void OSystem_PSP::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
DEBUG_ENTER_FUNC();
- _pendingUpdate = false;
+ _pendingUpdate = false;
_overlay.copyFromRect(buf, pitch, x, y, w, h);
}
@@ -266,7 +266,7 @@ void OSystem_PSP::grabPalette(byte *colors, uint start, uint num) {
bool OSystem_PSP::showMouse(bool v) {
DEBUG_ENTER_FUNC();
_pendingUpdate = false;
-
+
PSP_DEBUG_PRINT("%s\n", v ? "true" : "false");
bool last = _cursor.isVisible();
_cursor.setVisible(v);
@@ -276,14 +276,14 @@ bool OSystem_PSP::showMouse(bool v) {
void OSystem_PSP::warpMouse(int x, int y) {
DEBUG_ENTER_FUNC();
- _pendingUpdate = false;
+ _pendingUpdate = false;
_cursor.setXY(x, y);
}
void OSystem_PSP::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {
DEBUG_ENTER_FUNC();
- _pendingUpdate = false;
-
+ _pendingUpdate = false;
+
PSP_DEBUG_PRINT("pbuf[%p], w[%u], h[%u], hotspot:X[%d], Y[%d], keycolor[%d], scale[%d], pformat[%p]\n", buf, w, h, hotspotX, hotspotY, keycolor, cursorTargetScale, format);
if (format) {
PSP_DEBUG_PRINT("format: bpp[%d], rLoss[%d], gLoss[%d], bLoss[%d], aLoss[%d], rShift[%d], gShift[%d], bShift[%d], aShift[%d]\n", format->bytesPerPixel, format->rLoss, format->gLoss, format->bLoss, format->aLoss, format->rShift, format->gShift, format->bShift, format->aShift);
@@ -310,16 +310,16 @@ bool OSystem_PSP::pollEvent(Common::Event &event) {
// Time between event polls is usually 5-10ms, so waiting for 4 calls before checking to update the screen should be fine
if (_pendingUpdate) {
_pendingUpdateCounter++;
-
+
if (_pendingUpdateCounter >= 4) {
PSP_DEBUG_PRINT("servicing pending update\n");
updateScreen();
if (!_pendingUpdate) // we handled the update
- _pendingUpdateCounter = 0;
+ _pendingUpdateCounter = 0;
}
- } else
+ } else
_pendingUpdateCounter = 0; // reset the counter, no pending
-
+
return _inputHandler.getAllInputs(event);
}
diff --git a/backends/platform/psp/plugin.ld b/backends/platform/psp/plugin.ld
index db4df45264..7534c15290 100644
--- a/backends/platform/psp/plugin.ld
+++ b/backends/platform/psp/plugin.ld
@@ -208,7 +208,7 @@ SECTIONS
.debug_varnames 0 : { *(.debug_varnames) }
/DISCARD/ : { *(.comment) *(.pdr) }
/DISCARD/ : { *(.note.GNU-stack) }
-
+
. = __plugin_hole_start;
.got : { *(.got.plt) *(.got) } : shorts
/* We want the small data sections together, so single-instruction offsets
@@ -235,5 +235,5 @@ SECTIONS
PROVIDE (___sbss_end = .);
}
-
+
}
diff --git a/backends/platform/psp/png_loader.cpp b/backends/platform/psp/png_loader.cpp
index 417c502e54..978db3eaf9 100644
--- a/backends/platform/psp/png_loader.cpp
+++ b/backends/platform/psp/png_loader.cpp
@@ -33,7 +33,7 @@ PngLoader::Status PngLoader::allocate() {
if (!findImageDimensions()) {
PSP_ERROR("failed to get image dimensions\n");
return BAD_FILE;
- }
+ }
PSP_DEBUG_PRINT("width[%d], height[%d], paletteSize[%d], bitDepth[%d]\n", _width, _height, _paletteSize, _bitDepth);
_buffer->setSize(_width, _height, _sizeBy);
@@ -65,7 +65,7 @@ PngLoader::Status PngLoader::allocate() {
return OUT_OF_MEMORY;
}
return OK;
-}
+}
bool PngLoader::load() {
// Try to load the image
@@ -74,8 +74,8 @@ bool PngLoader::load() {
if (!loadImageIntoBuffer()) {
PSP_DEBUG_PRINT("failed to load image\n");
return false;
- }
-
+ }
+
PSP_DEBUG_PRINT("succeded in loading image\n");
if (_paletteSize == 16) // 4-bit
@@ -99,11 +99,11 @@ void PngLoader::libReadFunc(png_structp pngPtr, png_bytep data, png_size_t lengt
bool PngLoader::basicImageLoad() {
_pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
- if (!_pngPtr)
+ if (!_pngPtr)
return false;
-
+
png_set_error_fn(_pngPtr, (png_voidp) NULL, (png_error_ptr) NULL, warningFn);
-
+
_infoPtr = png_create_info_struct(_pngPtr);
if (!_infoPtr) {
png_destroy_read_struct(&_pngPtr, png_infopp_NULL, png_infopp_NULL);
@@ -113,16 +113,16 @@ bool PngLoader::basicImageLoad() {
png_set_read_fn(_pngPtr, (void *)_file, libReadFunc);
unsigned int sig_read = 0;
-
+
png_set_sig_bytes(_pngPtr, sig_read);
png_read_info(_pngPtr, _infoPtr);
int interlaceType;
- png_get_IHDR(_pngPtr, _infoPtr, (png_uint_32 *)&_width, (png_uint_32 *)&_height, &_bitDepth,
+ png_get_IHDR(_pngPtr, _infoPtr, (png_uint_32 *)&_width, (png_uint_32 *)&_height, &_bitDepth,
&_colorType, &interlaceType, int_p_NULL, int_p_NULL);
if (_colorType & PNG_COLOR_MASK_PALETTE)
_paletteSize = _infoPtr->num_palette;
-
+
return true;
}
@@ -132,7 +132,7 @@ bool PngLoader::findImageDimensions() {
if (!basicImageLoad())
return false;
-
+
png_destroy_read_struct(&_pngPtr, &_infoPtr, png_infopp_NULL);
return true;
}
@@ -145,7 +145,7 @@ bool PngLoader::loadImageIntoBuffer() {
if (!basicImageLoad())
return false;
-
+
// Strip off 16 bit channels. Not really needed but whatever
png_set_strip_16(_pngPtr);
@@ -158,11 +158,11 @@ bool PngLoader::loadImageIntoBuffer() {
srcPal++;
}
} else { // Not a palettized image
- if (_colorType == PNG_COLOR_TYPE_GRAY && _bitDepth < 8)
+ if (_colorType == PNG_COLOR_TYPE_GRAY && _bitDepth < 8)
png_set_gray_1_2_4_to_8(_pngPtr); // Round up grayscale images
- if (png_get_valid(_pngPtr, _infoPtr, PNG_INFO_tRNS))
+ if (png_get_valid(_pngPtr, _infoPtr, PNG_INFO_tRNS))
png_set_tRNS_to_alpha(_pngPtr); // Convert trans channel to alpha for 32 bits
-
+
png_set_filler(_pngPtr, 0xff, PNG_FILLER_AFTER); // Filler for alpha?
}
@@ -172,7 +172,7 @@ bool PngLoader::loadImageIntoBuffer() {
PSP_ERROR("Couldn't allocate line\n");
return false;
}
-
+
for (size_t y = 0; y < _height; y++) {
png_read_row(_pngPtr, line, png_bytep_NULL);
_buffer->copyFromRect(line, _infoPtr->rowbytes, 0, y, _width, 1); // Copy into buffer
diff --git a/backends/platform/psp/png_loader.h b/backends/platform/psp/png_loader.h
index 5f2064bf96..6b0282621a 100644
--- a/backends/platform/psp/png_loader.h
+++ b/backends/platform/psp/png_loader.h
@@ -36,11 +36,11 @@ private:
static void warningFn(png_structp png_ptr, png_const_charp warning_msg);
static void libReadFunc(png_structp pngPtr, png_bytep data, png_size_t length);
-
+
Common::SeekableReadStream *_file;
Buffer *_buffer;
Palette *_palette;
-
+
uint32 _width;
uint32 _height;
uint32 _paletteSize;
@@ -49,7 +49,7 @@ private:
png_structp _pngPtr;
png_infop _infoPtr;
int _colorType;
-
+
public:
enum Status {
OK,
@@ -57,14 +57,14 @@ public:
BAD_FILE
};
- PngLoader(Common::SeekableReadStream *file, Buffer &buffer, Palette &palette,
+ PngLoader(Common::SeekableReadStream *file, Buffer &buffer, Palette &palette,
Buffer::HowToSize sizeBy = Buffer::kSizeByTextureSize) :
- _file(file), _buffer(&buffer), _palette(&palette),
- _width(0), _height(0), _paletteSize(0),
+ _file(file), _buffer(&buffer), _palette(&palette),
+ _width(0), _height(0), _paletteSize(0),
_bitDepth(0), _sizeBy(sizeBy), _pngPtr(0), _infoPtr(0), _colorType(0) {}
-
+
PngLoader::Status allocate();
- bool load();
+ bool load();
};
#endif /* PSP_PNG_IMAGE_H */
diff --git a/backends/platform/psp/powerman.cpp b/backends/platform/psp/powerman.cpp
index eaadad16c5..869d9b3023 100644
--- a/backends/platform/psp/powerman.cpp
+++ b/backends/platform/psp/powerman.cpp
@@ -84,7 +84,7 @@ bool PowerManager::unregisterForSuspend(Suspendable *item) {
// Unregister from stream list
_listMutex.lock();
-
+
_suspendList.remove(item);
_listCounter--;
@@ -114,11 +114,11 @@ PowerManager::~PowerManager() {
********************************************/
void PowerManager::pollPauseEngine() {
DEBUG_ENTER_FUNC();
-
-
+
+
bool pause = _pauseFlag; // We copy so as not to have multiple values
- if (pause != _pauseFlagOld) {
+ if (pause != _pauseFlagOld) {
if (g_engine) { // Check to see if we have an engine
if (pause && _pauseClientState == UNPAUSED) {
_pauseClientState = PAUSING; // Tell PM we're in the middle of pausing
@@ -147,7 +147,7 @@ bool PowerManager::beginCriticalSection() {
DEBUG_ENTER_FUNC();
bool ret = false;
-
+
_flagMutex.lock();
// Check the access flag
@@ -156,7 +156,7 @@ bool PowerManager::beginCriticalSection() {
PSP_DEBUG_PRINT("I got blocked. ThreadId[%x]\n", sceKernelGetThreadId());
debugPM();
-
+
_threadSleep.wait(_flagMutex);
PSP_DEBUG_PRINT_FUNC("I got released. ThreadId[%x]\n", sceKernelGetThreadId());
@@ -184,11 +184,11 @@ void PowerManager::endCriticalSection() {
if (_suspendFlag) { // If the PM is sleeping, this flag must be set
PSP_DEBUG_PRINT_FUNC("PM is asleep. Waking it up.\n");
debugPM();
-
+
_pmSleep.releaseAll();
-
+
PSP_DEBUG_PRINT_FUNC("Woke up the PM\n");
-
+
debugPM();
}
@@ -198,7 +198,7 @@ void PowerManager::endCriticalSection() {
}
}
- _flagMutex.unlock();
+ _flagMutex.unlock();
}
/*******************************************
@@ -209,7 +209,7 @@ void PowerManager::endCriticalSection() {
void PowerManager::suspend() {
DEBUG_ENTER_FUNC();
- if (_pauseFlag)
+ if (_pauseFlag)
return; // Very important - make sure we only suspend once
scePowerLock(0); // Also critical to make sure PSP doesn't suspend before we're done
@@ -232,9 +232,9 @@ void PowerManager::suspend() {
PspThread::delayMicros(50000); // We wait 50 msec at a time
}
- // It's possible that the polling thread missed our pause event, but there's
+ // It's possible that the polling thread missed our pause event, but there's
// nothing we can do about that.
- // We can't know if there's polling going on or not.
+ // We can't know if there's polling going on or not.
// It's usually not a critical thing anyway.
_PMStatus = kGettingFlagMutexSuspend;
@@ -249,12 +249,12 @@ void PowerManager::suspend() {
// Check if anyone is in a critical section. If so, we'll wait for them
if (_criticalCounter > 0) {
_PMStatus = kWaitCritSectionSuspend;
-
+
_pmSleep.wait(_flagMutex);
-
+
_PMStatus = kDoneWaitingCritSectionSuspend;
- }
-
+ }
+
_flagMutex.unlock();
_PMStatus = kGettingListMutexSuspend;
@@ -275,7 +275,7 @@ void PowerManager::suspend() {
_PMStatus = kDoneSuspend;
scePowerUnlock(0); // Allow the PSP to go to sleep now
-
+
_PMStatus = kDonePowerUnlock;
}
@@ -286,22 +286,22 @@ void PowerManager::suspend() {
********************************************/
void PowerManager::resume() {
DEBUG_ENTER_FUNC();
-
+
_PMStatus = kBeginResume;
// Make sure we can't get another suspend
scePowerLock(0);
_PMStatus = kCheckingPauseFlag;
-
- if (!_pauseFlag)
+
+ if (!_pauseFlag)
return; // Make sure we can only resume once
_PMStatus = kGettingListMutexResume;
// First we notify our Suspendables. Loop over list, calling resume()
_listMutex.lock();
-
+
_PMStatus = kIteratingListResume;
// Iterate
@@ -314,12 +314,12 @@ void PowerManager::resume() {
_PMStatus = kDoneIteratingListResume;
_listMutex.unlock();
-
+
_PMStatus = kGettingFlagMutexResume;
// Now we set the suspend flag to false
_flagMutex.lock();
-
+
_PMStatus = kGotFlagMutexResume;
_suspendFlag = false;
@@ -328,11 +328,11 @@ void PowerManager::resume() {
// Signal the threads to wake up
_threadSleep.releaseAll();
-
+
_PMStatus = kDoneSignallingSuspendedThreadsResume;
_flagMutex.unlock();
-
+
_PMStatus = kDoneResume;
_pauseFlag = false; // Signal engine to unpause -- no mutex needed
diff --git a/backends/platform/psp/psp_main.cpp b/backends/platform/psp/psp_main.cpp
index dba9a8fc2b..d24c614e33 100644
--- a/backends/platform/psp/psp_main.cpp
+++ b/backends/platform/psp/psp_main.cpp
@@ -104,7 +104,7 @@ int exit_callback(void) {
#ifdef ENABLE_PROFILING
gprof_cleanup();
-#endif
+#endif
sceKernelExitGame();
return 0;
@@ -171,12 +171,12 @@ int main(void) {
#endif
/* unit/speed tests */
-#if defined (PSP_ENABLE_UNIT_TESTS) || defined (PSP_ENABLE_SPEED_TESTS)
+#if defined (PSP_ENABLE_UNIT_TESTS) || defined (PSP_ENABLE_SPEED_TESTS)
PSP_INFO_PRINT("running tests\n");
psp_tests();
sceKernelSleepThread(); // that's it. That's all we're doing
#endif
-
+
int res = scummvm_main(argc, argv);
g_system->quit(); // TODO: Consider removing / replacing this!
diff --git a/backends/platform/psp/pspkeyboard.cpp b/backends/platform/psp/pspkeyboard.cpp
index be084d4d38..3dd5e9789b 100644
--- a/backends/platform/psp/pspkeyboard.cpp
+++ b/backends/platform/psp/pspkeyboard.cpp
@@ -299,7 +299,7 @@ bool PSPKeyboard::load() {
}
PngLoader image(file, _buffers[i], _palettes[i]);
-
+
if (image.allocate() != PngLoader::OK) {
PSP_ERROR("Failed to allocate memory for keyboard image %s\n", _guiStrings[i]);
goto ERROR;
@@ -308,7 +308,7 @@ bool PSPKeyboard::load() {
PSP_ERROR("Failed to load image from file %s\n", _guiStrings[i]);
goto ERROR;
}
-
+
delete file;
} /* for loop */
@@ -370,7 +370,7 @@ bool PSPKeyboard::processInput(Common::Event &event, PspEvent &pspEvent, SceCtrl
event.type = DOWN(PSP_CTRL_START) ? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP;
haveEvent = true;
_dirty = true;
- if (UP(PSP_CTRL_START))
+ if (UP(PSP_CTRL_START))
havePspEvent = true;
}
// Check for being in state of moving the keyboard onscreen or pressing select
@@ -385,10 +385,10 @@ bool PSPKeyboard::processInput(Common::Event &event, PspEvent &pspEvent, SceCtrl
else if (_state == kLTriggerDown)
handleLTriggerDownState(pad); // Deal with trigger states
- if (havePspEvent) {
+ if (havePspEvent) {
pspEvent.type = PSP_EVENT_SHOW_VIRTUAL_KB; // tell the input handler we're off
pspEvent.data = false;
- }
+ }
_prevButtons = pad.Buttons;
return haveEvent;
diff --git a/backends/platform/psp/rtc.cpp b/backends/platform/psp/rtc.cpp
index 57edea7e49..f26e5770a6 100644
--- a/backends/platform/psp/rtc.cpp
+++ b/backends/platform/psp/rtc.cpp
@@ -23,13 +23,13 @@
*
*/
-#include
+#include
#include
#include
-
-#include "common/scummsys.h"
-#include "backends/platform/psp/rtc.h"
-
+
+#include "common/scummsys.h"
+#include "backends/platform/psp/rtc.h"
+
//#define __PSP_DEBUG_FUNCS__ /* For debugging function calls */
//#define __PSP_DEBUG_PRINT__ /* For debug printouts */
@@ -51,13 +51,13 @@ void PspRtc::init() { // init our starting ticks
#define MS_LOOP_AROUND 4294967 /* We loop every 2^32 / 1000 = 71 minutes */
#define MS_LOOP_CHECK 60000 /* Threading can cause weird mixups without this */
-// Note that after we fill up 32 bits ie 50 days we'll loop back to 0, which may cause
+// Note that after we fill up 32 bits ie 50 days we'll loop back to 0, which may cause
// unpredictable results
uint32 PspRtc::getMillis() {
uint32 ticks[2];
-
+
sceRtcGetCurrentTick((u64 *)ticks); // can introduce weird thread delays
-
+
uint32 millis = ticks[0]/1000;
millis -= _startMillis; // get ms since start of program
@@ -66,22 +66,22 @@ uint32 PspRtc::getMillis() {
_looped = true;
_milliOffset += MS_LOOP_AROUND; // add the needed offset
PSP_DEBUG_PRINT("looping around. last ms[%d], curr ms[%d]\n", _lastMillis, millis);
- }
+ }
} else {
_looped = false;
}
-
- _lastMillis = millis;
-
+
+ _lastMillis = millis;
+
return millis + _milliOffset;
}
uint32 PspRtc::getMicros() {
uint32 ticks[2];
-
+
sceRtcGetCurrentTick((u64 *)ticks);
ticks[0] -= _startMicros;
-
- return ticks[0];
+
+ return ticks[0];
}
diff --git a/backends/platform/psp/rtc.h b/backends/platform/psp/rtc.h
index 7c1a28474d..841d636e2b 100644
--- a/backends/platform/psp/rtc.h
+++ b/backends/platform/psp/rtc.h
@@ -27,7 +27,7 @@
#define _PSP_RTC_H_
#include "common/singleton.h"
-
+
class PspRtc : public Common::Singleton {
private:
uint32 _startMillis;
@@ -47,4 +47,4 @@ public:
uint32 getMicros();
};
-#endif
\ No newline at end of file
+#endif
diff --git a/backends/platform/psp/tests.cpp b/backends/platform/psp/tests.cpp
index f65c13ae83..4064ee1d98 100644
--- a/backends/platform/psp/tests.cpp
+++ b/backends/platform/psp/tests.cpp
@@ -23,13 +23,13 @@
*
*/
-// PSP speed and unit tests. Activate in tests.h
-// You may also want to build without any engines.
-
+// PSP speed and unit tests. Activate in tests.h
+// You may also want to build without any engines.
+
#include "backends/platform/psp/tests.h"
-#if defined (PSP_ENABLE_UNIT_TESTS) || defined (PSP_ENABLE_SPEED_TESTS)
-
+#if defined (PSP_ENABLE_UNIT_TESTS) || defined (PSP_ENABLE_SPEED_TESTS)
+
#include "common/scummsys.h"
#include
#include
@@ -49,16 +49,16 @@
#define UNCACHED(x) ((byte *)(((uint32)(x)) | 0x40000000)) /* make an uncached access */
#define CACHED(x) ((byte *)(((uint32)(x)) & 0xBFFFFFFF)) /* make an uncached access into a cached one */
-
+
//#define __PSP_DEBUG_FUNCS__
//#define __PSP_DEBUG_PRINT__
-
+
// Results: (333Mhz/222Mhz)
// Getting a tick: 1-2 us
// Getting a time structure: 9/14us
// ie. using a tick and just dividing by 1000 saves us time.
-
-#include "backends/platform/psp/trace.h"
+
+#include "backends/platform/psp/trace.h"
class PspSpeedTests {
public:
@@ -67,11 +67,11 @@ public:
void seekSpeed();
void msReadSpeed();
void threadFunctionsSpeed();
- void semaphoreSpeed();
+ void semaphoreSpeed();
static int threadFunc(SceSize args, void *argp);
void semaphoreManyThreadSpeed();
void fastCopySpeed();
-
+
private:
enum {
MEMCPY_BUFFER_SIZE = 8192
@@ -95,16 +95,16 @@ void PspSpeedTests::tickSpeed() {
uint32 currentTicks1[2];
uint32 currentTicks2[2];
-
+
sceRtcGetCurrentTick((u64 *)currentTicks1);
sceRtcGetCurrentTick((u64 *)currentTicks2);
PSP_INFO_PRINT("current tick[%x %x][%u %u]\n", currentTicks1[0], currentTicks1[1], currentTicks1[0], currentTicks1[1]);
PSP_INFO_PRINT("current tick[%x %x][%u %u]\n", currentTicks2[0], currentTicks2[1], currentTicks2[0], currentTicks2[1]);
-
+
pspTime time;
sceRtcSetTick(&time, (u64 *)currentTicks2);
- PSP_INFO_PRINT("current tick in time, year[%d] month[%d] day[%d] hour[%d] minutes[%d] seconds[%d] us[%d]\n", time.year, time.month, time.day, time.hour, time.minutes, time.seconds, time.microseconds);
-
+ PSP_INFO_PRINT("current tick in time, year[%d] month[%d] day[%d] hour[%d] minutes[%d] seconds[%d] us[%d]\n", time.year, time.month, time.day, time.hour, time.minutes, time.seconds, time.microseconds);
+
pspTime time1;
pspTime time2;
sceRtcGetCurrentClockLocalTime(&time1);
@@ -119,7 +119,7 @@ void PspSpeedTests::getMicrosSpeed() {
time2 = PspRtc::instance().getMicros();
time3 = PspRtc::instance().getMicros();
time4 = PspRtc::instance().getMicros();
-
+
PSP_INFO_PRINT("getMicros() times: %d, %d, %d\n", time4-time3, time3-time2, time2-time1);
}
@@ -128,8 +128,8 @@ void PspSpeedTests::readAndTime(uint32 bytes, char *buffer, FILE *file) {
// test minimal read
fread(buffer, bytes, 1, file);
uint32 time2 = PspRtc::instance().getMicros();
-
- PSP_INFO_PRINT("Reading %d byte takes %dus\n", bytes, time2-time1);
+
+ PSP_INFO_PRINT("Reading %d byte takes %dus\n", bytes, time2-time1);
}
/*
@@ -158,7 +158,7 @@ void PspSpeedTests::msReadSpeed() {
file = fopen("ms0:/psp/music/track1.mp3", "r");
char *buffer = (char *)malloc(2 * 1024 * 1024);
-
+
readAndTime(1, buffer, file);
readAndTime(10, buffer, file);
readAndTime(50, buffer, file);
@@ -170,32 +170,32 @@ void PspSpeedTests::msReadSpeed() {
readAndTime(6000, buffer, file);
readAndTime(7000, buffer, file);
readAndTime(8000, buffer, file);
- readAndTime(9000, buffer, file);
+ readAndTime(9000, buffer, file);
readAndTime(10000, buffer, file);
readAndTime(30000, buffer, file);
readAndTime(50000, buffer, file);
readAndTime(80000, buffer, file);
readAndTime(100000, buffer, file);
-
+
fclose(file);
- free(buffer);
+ free(buffer);
}
-
+
void PspSpeedTests::seekAndTime(int bytes, int origin, FILE *file) {
char buffer[1000];
-
+
uint32 time1 = PspRtc::instance().getMicros();
// test minimal read
fseek(file, bytes, origin);
uint32 time2 = PspRtc::instance().getMicros();
-
+
PSP_INFO_PRINT("Seeking %d byte from %d took %dus\n", bytes, origin, time2-time1);
time1 = PspRtc::instance().getMicros();
// test minimal read
fread(buffer, 1000, 1, file);
time2 = PspRtc::instance().getMicros();
-
+
PSP_INFO_PRINT("Reading 1000 bytes took %dus\n", time2-time1);
}
@@ -246,9 +246,9 @@ int PspSpeedTests::getThreadIdSpeed() {
uint32 time1 = PspRtc::instance().getMicros();
int threadId = sceKernelGetThreadId();
uint32 time2 = PspRtc::instance().getMicros();
-
+
PSP_INFO_PRINT("Getting thread ID %d took %dus\n", threadId, time2-time1);
-
+
return threadId;
}
@@ -257,7 +257,7 @@ void PspSpeedTests::getPrioritySpeed() {
uint32 time1 = PspRtc::instance().getMicros();
int priority = sceKernelGetThreadCurrentPriority();
uint32 time2 = PspRtc::instance().getMicros();
-
+
PSP_INFO_PRINT("Getting thread priority %d took %dus\n", priority, time2-time1);
}
@@ -266,7 +266,7 @@ void PspSpeedTests::changePrioritySpeed(int id, int priority) {
uint32 time1 = PspRtc::instance().getMicros();
sceKernelChangeThreadPriority(id, priority);
uint32 time2 = PspRtc::instance().getMicros();
-
+
PSP_INFO_PRINT("Changing thread priority to %d for id %d took %dus\n", priority, id, time2-time1);
}
@@ -280,53 +280,53 @@ void PspSpeedTests::threadFunctionsSpeed() {
changePrioritySpeed(id, 30);
changePrioritySpeed(id, 35);
changePrioritySpeed(id, 25);
-
+
// test context switch time
for (int i=0; i<10; i++) {
uint time1 = PspRtc::instance().getMicros();
PspThread::delayMicros(0);
uint time2 = PspRtc::instance().getMicros();
- PSP_INFO_PRINT("poll %d. context switch Time = %dus\n", i, time2-time1); // 10-15us
- }
+ PSP_INFO_PRINT("poll %d. context switch Time = %dus\n", i, time2-time1); // 10-15us
+ }
}
-
-void PspSpeedTests::semaphoreSpeed() {
+
+void PspSpeedTests::semaphoreSpeed() {
PspSemaphore sem(1);
-
+
uint32 time1 = PspRtc::instance().getMicros();
-
+
sem.take();
-
+
uint32 time2 = PspRtc::instance().getMicros();
-
+
PSP_INFO_PRINT("taking semaphore took %d us\n", time2-time1); // 10us
-
+
uint32 time3 = PspRtc::instance().getMicros();
-
+
sem.give();
-
+
uint32 time4 = PspRtc::instance().getMicros();
PSP_INFO_PRINT("releasing semaphore took %d us\n", time4-time3); //10us-55us
}
int PspSpeedTests::threadFunc(SceSize args, void *argp) {
PSP_INFO_PRINT("thread %x created.\n", sceKernelGetThreadId());
-
+
_sem.take();
-
+
PSP_INFO_PRINT("grabbed semaphore. Quitting thread\n");
-
+
return 0;
}
-void PspSpeedTests::semaphoreManyThreadSpeed() {
-
+void PspSpeedTests::semaphoreManyThreadSpeed() {
+
// create 4 threads
for (int i=0; i<4; i++) {
int thid = sceKernelCreateThread("my_thread", PspSpeedTests::threadFunc, 0x18, 0x10000, THREAD_ATTR_USER, NULL);
sceKernelStartThread(thid, 0, 0);
}
-
+
PSP_INFO_PRINT("main thread. created threads\n");
uint32 threads = _sem.numOfWaitingThreads();
@@ -334,10 +334,10 @@ void PspSpeedTests::semaphoreManyThreadSpeed() {
threads = _sem.numOfWaitingThreads();
PSP_INFO_PRINT("main thread: waiting threads[%d]\n", threads);
}
-
+
PSP_INFO_PRINT("main: semaphore value[%d]\n", _sem.getValue());
PSP_INFO_PRINT("main thread: waiting threads[%d]\n", _sem.numOfWaitingThreads());
-
+
_sem.give(4);
}
@@ -346,31 +346,31 @@ void PspSpeedTests::fastCopySpecificSize(byte *dst, byte *src, uint32 bytes) {
uint32 fastcopyTime, memcpyTime;
const int iterations = 2000;
int intc;
-
+
intc = pspSdkDisableInterrupts();
-
+
time1 = PspRtc::instance().getMicros();
for (int i=0; i 0) {
if ((int)wrStream->write(index, curLength) != curLength) {
PSP_ERROR("couldn't write %d bytes\n", curLength);
@@ -595,22 +595,22 @@ bool PspUnitTests::testFileSystem() {
PSP_ERROR("couldn't write %d bytes\n", curLength);
return false;
}
-
+
delete wrStream;
-
+
PSP_INFO_PRINT("reading...\n");
-
+
rdStream = file.createReadStream();
if (!rdStream) {
PSP_ERROR("%s couldn't be created.\n", path);
return false;
}
-
+
// seek to beginning
if (!rdStream->seek(0, SEEK_SET)) {
PSP_ERROR("couldn't seek to the beginning after writing the file\n");
return false;
- }
+ }
// read the contents
char *readBuffer = new char[BufSize + 4];
@@ -619,96 +619,96 @@ bool PspUnitTests::testFileSystem() {
while (rdStream->read(index, 100) == 100) {
index += 100;
}
-
+
if (!rdStream->eos()) {
PSP_ERROR("didn't find EOS at end of stream\n");
- return false;
+ return false;
}
-
+
// compare
for (i=0; i<(int)BufSize; i++)
if (buffer[i] != readBuffer[i]) {
PSP_ERROR("reading/writing mistake at %x. Got %x instead of %x\n", i, readBuffer[i], buffer[i]);
return false;
}
-
+
// Check for exceeding limit
for (i=0; i<4; i++) {
if (readBuffer[BufSize + i]) {
PSP_ERROR("read exceeded limits. %d = %x\n", BufSize + i, readBuffer[BufSize + i]);
}
- }
-
+ }
+
delete rdStream;
-
+
PSP_INFO_PRINT("writing...\n");
-
+
wrStream = file.createWriteStream();
if (!wrStream) {
PSP_ERROR("%s couldn't be created.\n", path);
return false;
}
-
+
const char *phrase = "Jello is really fabulous";
uint32 phraseLen = strlen(phrase);
-
+
int ret;
if ((ret = wrStream->write(phrase, phraseLen)) != (int)phraseLen) {
PSP_ERROR("couldn't write phrase. Got %d instead of %d\n", ret, phraseLen);
return false;
}
-
+
PSP_INFO_PRINT("reading...\n");
-
+
delete wrStream;
rdStream = file.createReadStream();
if (!rdStream) {
PSP_ERROR("%s couldn't be created.\n", path);
return false;
}
-
+
char *readPhrase = new char[phraseLen + 2];
memset(readPhrase, 0, phraseLen + 2);
-
+
if ((ret = rdStream->read(readPhrase, phraseLen) != phraseLen)) {
PSP_ERROR("read error on phrase. Got %d instead of %d\n", ret, phraseLen);
return false;
}
-
+
for (i=0; i<(int)phraseLen; i++) {
if (readPhrase[i] != phrase[i]) {
PSP_ERROR("bad read/write in phrase. At %d, %x != %x\n", i, readPhrase[i], phrase[i]);
return false;
}
- }
-
+ }
+
// check for exceeding
if (readPhrase[i] != 0) {
PSP_ERROR("found excessive copy in phrase. %c at %d\n", readPhrase[i], i);
return false;
}
-
+
PSP_INFO_PRINT("trying to read end...\n");
-
+
// seek to end
if (!rdStream->seek(0, SEEK_END)) {
PSP_ERROR("couldn't seek to end for append\n");
return false;
};
-
+
// try to read
if (rdStream->read(readPhrase, 2) || !rdStream->eos()) {
PSP_ERROR("was able to read at end of file\n");
return false;
}
-
+
PSP_INFO_PRINT("ok\n");
return true;
}
void psp_tests() {
PSP_INFO_PRINT("in tests\n");
-
+
#ifdef PSP_ENABLE_SPEED_TESTS
// Speed tests
PspSpeedTests speedTests;
@@ -718,18 +718,18 @@ void psp_tests() {
speedTests.seekSpeed();
speedTests.msReadSpeed();
speedTests.threadFunctionsSpeed();
- speedTests.semaphoreSpeed();
+ speedTests.semaphoreSpeed();
speedTests.semaphoreManyThreadSpeed();
speedTests.fastCopySpeed();
-#endif
-
+#endif
+
#ifdef PSP_ENABLE_UNIT_TESTS
// Unit tests
PspUnitTests unitTests;
-
+
//unitTests.testFastCopy();
unitTests.testFileSystem();
-#endif
-}
+#endif
+}
-#endif /* (PSP_ENABLE_UNIT_TESTS) || defined (PSP_ENABLE_SPEED_TESTS) */
\ No newline at end of file
+#endif /* (PSP_ENABLE_UNIT_TESTS) || defined (PSP_ENABLE_SPEED_TESTS) */
diff --git a/backends/platform/psp/tests.h b/backends/platform/psp/tests.h
index 1518acfb4c..9af7ba8d7d 100644
--- a/backends/platform/psp/tests.h
+++ b/backends/platform/psp/tests.h
@@ -23,14 +23,14 @@
*
*/
-#ifndef _PSP_TESTS_H_
+#ifndef _PSP_TESTS_H_
#define _PSP_TESTS_H_
//#define PSP_ENABLE_UNIT_TESTS // run unit tests
//#define PSP_ENABLE_SPEED_TESTS // run speed tests
-#if defined (PSP_ENABLE_UNIT_TESTS) || defined (PSP_ENABLE_SPEED_TESTS)
+#if defined (PSP_ENABLE_UNIT_TESTS) || defined (PSP_ENABLE_SPEED_TESTS)
void psp_tests();
#endif
-#endif /* _PSP_TESTS_H_ */
\ No newline at end of file
+#endif /* _PSP_TESTS_H_ */
diff --git a/backends/platform/psp/thread.cpp b/backends/platform/psp/thread.cpp
index 916b1e553b..f9e497a342 100644
--- a/backends/platform/psp/thread.cpp
+++ b/backends/platform/psp/thread.cpp
@@ -23,12 +23,12 @@
*
*/
-#include
+#include
#include "backends/platform/psp/thread.h"
#include "backends/platform/psp/trace.h"
-
-// Class PspThreadable --------------------------------------------------
+
+// Class PspThreadable --------------------------------------------------
// Inherit this to create C++ threads easily
bool PspThreadable::threadCreateAndStart(const char *threadName, int priority, int stackSize, bool useVfpu /*= false*/) {
@@ -38,41 +38,41 @@ bool PspThreadable::threadCreateAndStart(const char *threadName, int priority, i
PSP_ERROR("thread already created!\n");
return false;
}
-
+
_threadId = sceKernelCreateThread(threadName, __threadCallback, priority, stackSize, THREAD_ATTR_USER, 0); // add VFPU support
if (_threadId < 0) {
PSP_ERROR("failed to create %s thread. Error code %d\n", threadName, _threadId);
return false;
}
-
+
// We want to pass the pointer to this, but we'll have to take address of this so use a little trick
PspThreadable *_this = this;
-
+
if (sceKernelStartThread(_threadId, sizeof(uint32 *), &_this) < 0) {
PSP_ERROR("failed to start %s thread id[%d]\n", threadName, _threadId);
return false;
}
-
- PSP_DEBUG_PRINT("Started %s thread with id[%x]\n", threadName, _threadId);
-
+
+ PSP_DEBUG_PRINT("Started %s thread with id[%x]\n", threadName, _threadId);
+
return true;
}
// Callback function to be called by PSP kernel
int PspThreadable::__threadCallback(SceSize, void *__this) {
DEBUG_ENTER_FUNC();
-
+
PspThreadable *_this = *(PspThreadable **)__this; // Dereference the copied value which was 'this'
-
+
_this->threadFunction(); // call the virtual function
-
+
return 0;
}
// PspThread class
// Utilities to access general thread functions
-
+
void PspThread::delayMillis(uint32 ms) {
sceKernelDelayThread(ms * 1000);
}
@@ -90,8 +90,8 @@ void PspThread::delayMicros(uint32 us) {
PspSemaphore::PspSemaphore(int initialValue, int maxValue/*=255*/) {
DEBUG_ENTER_FUNC();
_handle = 0;
- _handle = (uint32)sceKernelCreateSema("ScummVM Sema", 0 /* attr */,
- initialValue, maxValue,
+ _handle = (uint32)sceKernelCreateSema("ScummVM Sema", 0 /* attr */,
+ initialValue, maxValue,
0 /*option*/);
if (!_handle)
PSP_ERROR("failed to create semaphore.\n");
@@ -108,10 +108,10 @@ int PspSemaphore::numOfWaitingThreads() {
DEBUG_ENTER_FUNC();
SceKernelSemaInfo info;
info.numWaitThreads = 0;
-
+
if (sceKernelReferSemaStatus((SceUID)_handle, &info) < 0)
PSP_ERROR("failed to retrieve semaphore info for handle %d\n", _handle);
-
+
return info.numWaitThreads;
}
@@ -119,10 +119,10 @@ int PspSemaphore::getValue() {
DEBUG_ENTER_FUNC();
SceKernelSemaInfo info;
info.currentCount = 0;
-
+
if (sceKernelReferSemaStatus((SceUID)_handle, &info) < 0)
PSP_ERROR("failed to retrieve semaphore info for handle %d\n", _handle);
-
+
return info.currentCount;
}
@@ -130,18 +130,18 @@ bool PspSemaphore::pollForValue(int value) {
DEBUG_ENTER_FUNC();
if (sceKernelPollSema((SceUID)_handle, value) < 0)
return false;
-
+
return true;
}
// false: timeout or error
bool PspSemaphore::takeWithTimeOut(uint32 timeOut) {
DEBUG_ENTER_FUNC();
-
+
uint32 *pTimeOut = 0;
- if (timeOut)
+ if (timeOut)
pTimeOut = &timeOut;
-
+
if (sceKernelWaitSema(_handle, 1, pTimeOut) < 0) // we always wait for 1
return false;
return true;
@@ -149,9 +149,9 @@ bool PspSemaphore::takeWithTimeOut(uint32 timeOut) {
bool PspSemaphore::give(int num /*=1*/) {
DEBUG_ENTER_FUNC();
-
+
if (sceKernelSignalSema((SceUID)_handle, num) < 0)
- return false;
+ return false;
return true;
}
@@ -161,7 +161,7 @@ bool PspMutex::lock() {
DEBUG_ENTER_FUNC();
int threadId = sceKernelGetThreadId();
bool ret = true;
-
+
if (_ownerId == threadId) {
_recursiveCount++;
} else {
@@ -176,19 +176,19 @@ bool PspMutex::unlock() {
DEBUG_ENTER_FUNC();
int threadId = sceKernelGetThreadId();
bool ret = true;
-
+
if (_ownerId != threadId) {
PSP_ERROR("attempt to unlock mutex by thread[%x] as opposed to owner[%x]\n",
threadId, _ownerId);
return false;
}
-
+
if (_recursiveCount) {
_recursiveCount--;
} else {
_ownerId = 0;
ret = _semaphore.give(1);
- }
+ }
return ret;
}
@@ -200,7 +200,7 @@ void PspCondition::releaseAll() {
if (_waitingThreads > _signaledThreads) { // we have signals to issue
int numWaiting = _waitingThreads - _signaledThreads; // threads we haven't signaled
_signaledThreads = _waitingThreads;
-
+
_waitSem.give(numWaiting);
_mutex.unlock();
for (int i=0; i;
close FILE;
-
+
my $onestr = join("",@lines);
-
+
if ($onestr =~ /$n/)
{
print " - $name @ $n updating ... ";
-
+
$onestr =~ s/$a.*$b/$a$updated\n$output$b/s;
open FILE, ">$file";
print FILE $onestr;
close FILE;
-
+
print "done.\n";
}
}
-
+
$output = "";
}
@@ -328,7 +328,7 @@ sub UpdateSlaveMacros
{
my $updated = " Updated @ ".localtime();
- my $name = "mmp/scummvm_base.mmp";
+ my $name = "mmp/scummvm_base.mmp";
my $file = "$buildDir/$name";
print "Reading master MACROS from backends/symbian/$name ... ";
@@ -342,7 +342,7 @@ sub UpdateSlaveMacros
my $b = "\/\/STOP_$n\/\/";
$onestr =~ /$a(.*)$b/s;
my $macros = $1;
-
+
my $libs_first = "\n// automagically enabled static libs from macros above\n";
my $libs_second = "STATICLIBRARY scummvm_base.lib // must be above USE_* .libs\n";
my $macro_counter = 0;
@@ -355,7 +355,7 @@ sub UpdateSlaveMacros
if ($line =~ /^.*MACRO\s*([0-9A-Z_]*)\s*\/\/\s*LIB\:(.*)$/)
{
my $macro = $1; my $lib = $2;
-
+
# this macro enabled? then also add the .lib
if ($line =~ /^\s*MACRO\s*$macro/m)
{
@@ -366,7 +366,7 @@ sub UpdateSlaveMacros
if ($macro =~ /^ENABLE_/)
{
$libs_first .= "STATICLIBRARY $lib\n";
-
+
# add projects for BLD.INF's
my $projectname = substr("$lib",0,-4);
$projects .= "..\\mmp\\$projectname.mmp\n";
@@ -393,7 +393,7 @@ sub UpdateSlaveMacros
push @DisabledDefines, $macro; # used in CheckForModuleMK()!!
}
}
- }
+ }
print "$macro_counter macro lines.\n";
@@ -404,23 +404,23 @@ sub UpdateSlaveMacros
$m = "AUTO_PROJECTS";
$p = "\/\/START_$m\/\/";
$q = "\/\/STOP_$m\/\/";
-
+
foreach $name (@mmp_files)
{
$file = "$buildDir/$name";
$fileBLDINF = $buildDir .'/'. substr($name, 0, rindex($name, "/")) . "/BLD.INF";
print "Updating macros in $file ... ";
#print "Updating macros in backends/symbian/$name ... ";
-
+
open FILE, "$file"; @lines = ; close FILE;
$onestr = join("",@lines);
-
+
my $extralibs = ""; # output
# slash in name means it's a phone specific build file: add LIBs
$extralibs .= "$libs_first$libs_second" if (-e $fileBLDINF);
-
+
$onestr =~ s/$a.*$b/$a$updated$macros2$extralibs$b/s;
-
+
open FILE, ">$file"; print FILE $onestr; close FILE;
my $count = @lines;
@@ -434,13 +434,13 @@ sub UpdateSlaveMacros
open FILE, "$fileBLDINF"; @lines = ; close FILE;
$onestr = join("",@lines);
-
+
$onestr =~ s/$p.*$q/$p$updated$projects$q/s;
-
+
open FILE, ">$fileBLDINF"; print FILE $onestr; close FILE;
}
}
-}
+}
##################################################################################################################
@@ -448,10 +448,10 @@ sub ResetProjectFiles()
{
my $onestr, @lines;
my @mmp_files_plus_one = @mmp_files;
-# unshift @mmp_files_plus_one, "mmp/scummvm_base.mmp";
-
+# unshift @mmp_files_plus_one, "mmp/scummvm_base.mmp";
+
print "Resetting project files: ";
-
+
# we don't need to do mmp/scummvm_base.mmp", it was done in BuildPackageUpload.pl before the call to this script
foreach $name (@mmp_files_plus_one)
{
@@ -471,7 +471,7 @@ sub ResetProjectFiles()
$onestr = join("",@lines);
open FILE, ">$fileBLDINF"; print FILE $onestr; close FILE;
}
- }
+ }
print "... done.\n";
}
diff --git a/backends/platform/symbian/BuildPackageUpload_AllVersions.pl b/backends/platform/symbian/BuildPackageUpload_AllVersions.pl
index 62fcef0275..3bdcede76a 100644
--- a/backends/platform/symbian/BuildPackageUpload_AllVersions.pl
+++ b/backends/platform/symbian/BuildPackageUpload_AllVersions.pl
@@ -17,7 +17,7 @@ $SDK_BuildDirs{'S60v3'} = "S60v3";
$SDK_BuildDirs{'S80'} = "S80";
$SDK_BuildDirs{'S90'} = "S90";
-# the target name inserted here: 'abld BUILD $SDK_TargetName UREL'
+# the target name inserted here: 'abld BUILD $SDK_TargetName UREL'
$SDK_TargetName{'UIQ2'} = "armi";
$SDK_TargetName{'UIQ3'} = "gcce";
$SDK_TargetName{'S60v1'}= "armi";
@@ -117,7 +117,7 @@ foreach $Library (sort keys(%PresentLibs))
# push @Packages, sprintf($file_tpl_sis, $version_tpl_sis, $SDK2, $Extra);
# $PackagesQueued++;
# }
-# }
+# }
# }
# else
# {
@@ -144,7 +144,7 @@ while( ($SDK, $Value) = each(%VariationSets) )
push @Packages, sprintf($file_tpl_sis, $version_tpl_sis, $SDK2, $Extra);
$PackagesQueued++;
}
- }
+ }
}
else
{
@@ -170,7 +170,7 @@ Preparing to Build, Package & Upload $PackagesQueued SymbianOS ScummVM variation
SDKs inst'd \t$SDKs ".( %SDK_LibraryDirs ? "
LIBs inst'd \t$LIBs " : "" )."
- $PackagesQueued Variations \t$PackagesStr
+ $PackagesQueued Variations \t$PackagesStr
DIR base \t$base_dir
build \t$build_dir
output \t$output_dir
@@ -178,7 +178,7 @@ Preparing to Build, Package & Upload $PackagesQueued SymbianOS ScummVM variation
FTP host \t$FTP_Host
user \t$FTP_User
pass \t"."*" x length($FTP_Pass)."
- dir \t$FTP_Dir
+ dir \t$FTP_Dir
" : "" )."
=======================================================================================
Press Ctrl-C to abort or enter to continue Build, Package & Upload $PackagesQueued Variations...
@@ -194,7 +194,7 @@ unlink($build_log_out);
unlink($build_log_err);
# init _base.mmp now, so we can start changing it without affecting the CVS version _base.mmp.in!
-my $name = "mmp/scummvm_base.mmp";
+my $name = "mmp/scummvm_base.mmp";
my $file = "$build_dir/$name";
open FILE, "$file.in"; @lines = ; close FILE;
my $onestr = join("",@lines);
@@ -219,7 +219,7 @@ while( ($SDK, $Value) = each(%SDK_LibraryDirs) )
$LibrariesQueued++;
DoLibrary($SDK2, $Library, $Path);
}
- }
+ }
}
else
{
@@ -252,7 +252,7 @@ while( ($SDK, $VariationsHash) = each(%SDK_Variations) )
{
DoVariation($SDK2, $Variation, $MacroBlock);
}
- }
+ }
}
else
{
@@ -277,7 +277,7 @@ while( ($SDK, $VariationsHash) = each(%VariationSets) )
{
DoVariation($SDK2, $Variation, $MacroBlock);
}
- }
+ }
}
else
{
@@ -335,7 +335,7 @@ print " SumthinWicked wishes you a ridiculously good and optimally happy d
sub MakeMppMacroDefs
{
my ($features) = @_;
-
+
my %EnabledFeatures = ();
foreach (split(/\W|\r|\n/, $features))
{
@@ -398,14 +398,14 @@ sub MakeMppMacroDefs
$MacroDefs .= "//MACRO ENABLE_$E\n";
}
}
-
+
#print "\n\n'$features' ==> $MacroDefs\n\n\n";
return $MacroDefs;
}
##################################################################################################################
-# Build, Package & Upload a single Variation
+# Build, Package & Upload a single Variation
sub DoLibrary
{
my ($SDK, $Library, $Path) = @_;
@@ -435,23 +435,23 @@ my $header = "
my $OK = 1;
PrepSdkPaths($SDK);
-
+
chdir($Path) or $OK=0;
PrintErrorMessage("Changing to $Path failed!") if (!$OK);
- return 0 if (!$OK);
+ return 0 if (!$OK);
PrintMessage("Cleaning for $Target") if (!$ReallyQuiet);
system("bldmake bldfiles > NUL 2> NUL");
PrintErrorMessage("'bldmake bldfiles' exited with value " . ($? >> 8)) if ($? >> 8);
system("abld MAKEFILE $TargetName > NUL 2> NUL");
- PrintErrorMessage("'abld MAKEFILE $TargetName' exited with value " . ($? >> 8)) if ($? >> 8);
+ PrintErrorMessage("'abld MAKEFILE $TargetName' exited with value " . ($? >> 8)) if ($? >> 8);
system("abld CLEAN $TargetName UREL > NUL 2> NUL");
- PrintErrorMessage("'abld CLEAN $TargetName urel' exited with value " . ($? >> 8)) if ($? >> 8);
+ PrintErrorMessage("'abld CLEAN $TargetName urel' exited with value " . ($? >> 8)) if ($? >> 8);
# remove file so we are sure that after .lib generation we have a fresh copy!
if (-e $TargetFilePath) { unlink($TargetFilePath) or PrintErrorMessage("Removing $TargetFilePath"); }
-
+
my $Redirection = "OUT:file, ERR:".($RedirectSTDERR ? "file" : "screen");
my $Message = "Building $Target ($Redirection)";
PrintMessage($Message) if (!$ReallyQuiet);
@@ -463,14 +463,14 @@ my $header = "
$OK = 0 if ($? >> 8);
# print " STDERR: ".((-s $build_log_err)-$OldSize)." bytes output written to $build_log_err\n+--------------------------------------------------------------------------------------\n" if ($OldSize != (-s $build_log_err));
PrintErrorMessage("'abld TARGET $TargetName UREL' exited with value " . ($? >> 8)) if ($? >> 8);
- return 0 if (!$OK); # ABLD always returns ok :( grr
+ return 0 if (!$OK); # ABLD always returns ok :( grr
PrintMessage("Done.") if (!$ReallyQuiet);
# did it work? :)
if (-e $TargetFilePath)
{
$LibrariesSucceeded++;
-
+
if ($TargetIntermediatePath ne '' && $TargetIntermediatePath =~ /\\EPOC32\\BUILD\\/i) # make really sure it's a valid path!
{
system("del /S /Q $TargetIntermediatePath > NUL");
@@ -491,12 +491,12 @@ my $header = "
##################################################################################################################
-# Build, Package & Upload a single Variation
+# Build, Package & Upload a single Variation
sub DoVariation
{
my ($SDK, $Variation, $MacroBlock) = @_;
my $Extra = ($Variation ne '' ? "_$Variation" : "");
- my $Package = sprintf($file_tpl_sis, $version_tpl_sis, $SDK, $Extra);
+ my $Package = sprintf($file_tpl_sis, $version_tpl_sis, $SDK, $Extra);
if ($SkipExistingPackages && -f "$output_dir/$Package")
{
@@ -527,7 +527,7 @@ my $header = "
if ($OK)
{
$OK = BuildVariation($SDK, $Variation, $Package, $MacroBlock);
-
+
if ($OK && $FTP_Host ne '')
{
UploadVariation($SDK, $Variation, $Package);
@@ -543,17 +543,17 @@ sub PrepVariation()
my $OK = 1;
PrepSdkPaths($SDK);
-
+
chdir($build_dir) or $OK=0;
PrintErrorMessage("Changing to $build_dir failed!") if (!$OK);
- return 0 if (!$OK);
+ return 0 if (!$OK);
# insert $MacroBlock into AUTO_MACRO_MASTER in scummvm_base.mmp
PrintMessage("Setting new AUTO_MACROS_MASTER in scummvm_base.mmp for '$Variation'") if (!$ReallyQuiet);
my $n = "AUTO_MACROS_MASTER";
my $a = "\/\/START_$n\/\/";
my $b = "\/\/STOP_$n\/\/";
- my $name = "scummvm_base.mmp";
+ my $name = "scummvm_base.mmp";
my $file = "$build_dir/mmp/$name";
my $updated = " Updated @ ".localtime();
@@ -562,11 +562,11 @@ sub PrepVariation()
return 0 if (!$OK);
my @lines = ;
close FILE;
-
+
my $onestr = join("",@lines);
$MacroBlock =~ s/^\s*//gm;
$onestr =~ s/$a(.*)$b/$a$updated\n$ExtraMacros$MacroBlock$b/s;
-
+
open FILE, ">$file" or $OK=0;
PrintErrorMessage("Writing file '$file'") if (!$OK);
return 0 if (!$OK);
@@ -579,7 +579,7 @@ sub PrepVariation()
$OK = 0 if ($? >> 8);
PrintErrorMessage("'AdaptAllMMPs.pl' exited with value " . ($? >> 8)) if ($? >> 8);
return 0 if (!$OK);
-
+
# we are here: so all is ok :)
return 1;
}
@@ -592,7 +592,7 @@ sub BuildVariation()
my $TargetName = $SDK_TargetName{$SDK};
my $TargetDir = $SDK_TargetDir{$SDK};
my $OK = 1;
-
+
my $dir = $build_dir."/".$SDK_BuildDirs{$SDK};
$dir =~ s#/#\\#g;
chdir($dir);
@@ -617,8 +617,8 @@ sub BuildVariation()
PrintErrorMessage("'bldmake bldfiles' exited with value " . ($? >> 8)) if ($? >> 8);
system("abld CLEAN $TargetName UREL 2> NUL > NUL");
- PrintErrorMessage("'abld CLEAN $TargetName UREL' exited with value " . ($? >> 8)) if ($? >> 8);
-
+ PrintErrorMessage("'abld CLEAN $TargetName UREL' exited with value " . ($? >> 8)) if ($? >> 8);
+
my $Redirection = "OUT:file, ERR:".($RedirectSTDERR ? "file" : "screen");
my $Message = "Building $Package ($Redirection)";
PrintMessage($Message) if (!$ReallyQuiet);
@@ -630,7 +630,7 @@ sub BuildVariation()
$OK = 0 if ($? >> 8);
print " STDERR: ".((-s $build_log_err)-$OldSize)." bytes output written to $build_log_err\n+--------------------------------------------------------------------------------------\n" if ($OldSize != (-s $build_log_err) && !$ReallyQuiet);
PrintErrorMessage("'abld BUILD $TargetName UREL' exited with value " . ($? >> 8)) if ($? >> 8);
- return 0 if (!$OK); # ABLD always returns ok :( grr
+ return 0 if (!$OK); # ABLD always returns ok :( grr
PrintMessage("Done.") if (!$ReallyQuiet);
# do we have an override suffix for the package name?
@@ -654,7 +654,7 @@ sub BuildVariation()
if (-e "$output_dir/$Package")
{
$PackagesCreated++;
-
+
if ($TargetIntermediatePath ne '' && $TargetIntermediatePath =~ /\\EPOC32\\BUILD\\/i) # make really sure it's a valid path!
{
#PrintMessage("Cleaning $TargetIntermediatePath");
@@ -677,7 +677,7 @@ sub UploadVariation()
use Net::FTP;
my $newerr;
-
+
PrintMessage("Connecting to FTP $FTP_Host") if (!$ReallyQuiet);
$ftp = Net::FTP->new($FTP_Host,Timeout=>240) or $newerr=1;
@@ -692,7 +692,7 @@ sub UploadVariation()
{
PrintMessage("Changing to dir $FTP_Dir");
$ftp->cwd($FTP_Dir) or $newerr=1;
-
+
if ($newerr)
{
PrintErrorMessage("Changing to dir $FTP_Dir! Aborting!");
@@ -704,20 +704,20 @@ sub UploadVariation()
# leave this for possible auto-deletion of old files?
# @files = $ftp->dir or $newerr=1;
# push @ERRORS, "Can't get file list $!\n" if $newerr;
-# print "Got file list\n";
+# print "Got file list\n";
# foreach(@files) {
# print "$_\n";
# }
-
+
PrintMessage("Uploading $Package (".(-s "$output_dir/$Package")." bytes)");
-
+
$ftp->binary;
$ftp->put("$output_dir/$Package") or $newerr=1;
PrintErrorMessage("Uploading package! Aborting!") if $newerr;
$PackagesUploaded++ if (!$newerr);
- }
+ }
- $ftp->quit;
+ $ftp->quit;
}
}
@@ -758,7 +758,7 @@ sub CleanupPath()
{
$path =~ s/\"\Q$ECompXL_BinDir\E\";//g;
}
-
+
while( ($SDK, $RootDir) = each(%SDK_RootDirs) )
{
if ($SDK_RootDirs{$SDK} ne '')
@@ -766,8 +766,8 @@ sub CleanupPath()
my $path_component = "\"".$SDK_RootDirs{$SDK}."\\epoc32\\";
$path =~ s/\Q$path_component\E.*?\";//g;
}
- }
-
+ }
+
return $path;
}
@@ -798,5 +798,5 @@ sub PrintMessage()
}
##################################################################################################################
-
+
diff --git a/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl b/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl
index b6ebbafe74..a0ec338ca0 100644
--- a/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl
+++ b/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl
@@ -2,26 +2,26 @@
##################################################################################################################
@WorkingEngines = qw(
- scumm agos sky queen gob groovie saga drascula
+ scumm agos sky queen gob groovie saga drascula
kyra lure agi touche parallaction cine
cruise made m4 tinsel tucker sword1 sword2 draci sci teenagent mohawk hugo
);
-
+
@WorkingEngines_1st = qw(
- scumm queen groovie saga drascula
+ scumm queen groovie saga drascula
touche parallaction cine
-? cruise made m4 tucker
+? cruise made m4 tucker
);
-
+
@WorkingEngines_2nd = qw(
- agos sky gob
+ agos sky gob
kyra lure agi tinsel
sword1 sword2 draci sci teenagent hugo
);
@TestingEngines = qw(
-
- );
+
+ );
@EnablableEngines = (@WorkingEngines, @TestingEngines);
@@ -36,16 +36,16 @@
#disabled subengines lol saga2 personal nightmare
%UseableFeatures = (
- 'zlib' => 'zlib.lib',
- 'mad' => 'libmad.lib',
+ 'zlib' => 'zlib.lib',
+ 'mad' => 'libmad.lib',
'tremor' => 'libtremor.lib',
'flac' => 'libflac.lib'
);
-
+
# these are normally enabled for each variation
#$DefaultFeatures = qw(zlib,mad);
- $DefaultFeatures = qw(zlib,mad,tremor,flac);
-
+ $DefaultFeatures = qw(zlib,mad,tremor,flac);
+
##################################################################################################################
##
## General system information, based on $COMPUTERNAME, so this way
@@ -62,13 +62,13 @@
$SkipExistingPackages = 0;
$ReallyQuiet = 0;
$DevBase = "C:\\S";
-
+
# specify an optional FTP server to upload to after each Build+Package (can leave empty)
#$FTP_Host = "host.com";
$FTP_User = "something";
$FTP_Pass = "password";
$FTP_Dir = "cvsbuilds";
-
+
# What Platform SDKs are installed on this machine?
# possible SDKs: ("UIQ2", UIQ3", "S60v1", "S60v2", "S60v3", "S80", "S90")
# Note1: the \epoc32 directory needs to be in these rootdirs
@@ -93,10 +93,10 @@
$SDK_LibraryDirs{'ALL'}{'zlib.lib'} = "$DevBase\\zlib-1.2.2\\epoc";
#$SDK_LibraryDirs{'ALL'}{'libmad.lib'} = "$DevBase\\libmad-0.15.1b\\group";
$SDK_LibraryDirs{'ALL'}{'libtremor.lib'}= "$DevBase\\tremor\\epoc";
-
+
## SDL 1.2.12 / AnotherGuest / Symbian version
my $SdlBase = "$DevBase\\SDL-1.2.12-ag\\Symbian";
- #$SDK_LibraryDirs{'S60v1'}{'esdl.lib'} = "$SdlBase\\S60"; // unsupported?
+ #$SDK_LibraryDirs{'S60v1'}{'esdl.lib'} = "$SdlBase\\S60"; // unsupported?
#$SDK_LibraryDirs{'S60v2'}{'esdl.lib'} = "$SdlBase\\S60v2";
$SDK_LibraryDirs{'S60v3'}{'esdl.lib'} = "$SdlBase\\S60v3";
#$SDK_LibraryDirs{'S80'}{'esdl.lib'} = "$SdlBase\\S80";
@@ -107,7 +107,7 @@
## HardlySupported(TM) :P
#$SDK_LibraryDirs{'ALL'}{'libmpeg2.lib'} = "$DevBase\\mpeg2dec-0.4.0\\epoc";
}
-
+
# now you can add $VariationSets only built on this PC below this line :)
#$VariationSets{'ALL'}{'scumm'} = "$DefaultFeatures scumm scumm_7_8 he";
@@ -296,11 +296,11 @@
# scummvm-051101-SymbianS90_queen.sis
# NOTE: empty $VariationSets{''} string instead of 'ALL' = easy way to disable pkg!
-
+
if (1) # all regular combo's
{
# the first one includes all SDKs & release-ready engines
-
+
$VariationSets{'ALL'}{'all'} = "$DefaultFeatures @WorkingEngines @EnablableSubEngines";
$VariationSets{'ALL'}{'1St'} = "$DefaultFeatures @WorkingEngines_1st @EnablableSubEngines";
$VariationSets{'ALL'}{'2nd'} = "$DefaultFeatures @WorkingEngines_2nd @EnablableSubEngines";
@@ -324,16 +324,16 @@
}
}
# below here you could specify weird & experimental combinations, non-ready engines
-
+
# Separate version for the broken sword engines (1&2)
#$VariationSets{'ALL'}{'brokensword'} = "$DefaultFeatures sword1 sword2";
-
+
# Separate version for Scumm games (COMI) since memory usage might be high
- #$VariationSets{'ALL'}{'scumm'} = "$DefaultFeatures scumm scumm_7_8 he";
-
+ #$VariationSets{'ALL'}{'scumm'} = "$DefaultFeatures scumm scumm_7_8 he";
+
# for mega-fast-testing only plz! Warning: contains to engines!
#$VariationSets{'ALL'}{'fast_empty'} = "";
-
+
} # end quick-n-fast if (1|0)
diff --git a/backends/platform/symbian/README b/backends/platform/symbian/README
index 630b539a5f..ba7099ba32 100644
--- a/backends/platform/symbian/README
+++ b/backends/platform/symbian/README
@@ -24,7 +24,7 @@ About ScummVM
The original ports (uptil 0.7.1) were made by Andreas Karlsson and Lars Persson.
The main transition to 0.8.0CVS and all relevant changes were done by Jurgen Braam.
Jurgen and Lars have successfully transfered all needed changes into CVS/SVN, with additional helpful tools for Symbian OS
-
+
Release History:
Release version: 1.1.0
* Nothing significant in the Symbian port, except SDL improvements.
@@ -33,7 +33,7 @@ Release History:
Release version: 1.0.0
* Nothing significant in the Symbian port, except SDL improvements.
* See main readme for general ScummVM improvements, minor update
-
+
Release version: 0.13.1
* Nothing significant in the Symbian port, except SDL improvements.
* See main readme for general ScummVM improvements, minor update
diff --git a/backends/platform/symbian/S60/BLD.INF.in b/backends/platform/symbian/S60/BLD.INF.in
index b6cf8bbda6..c3c3decf1a 100644
--- a/backends/platform/symbian/S60/BLD.INF.in
+++ b/backends/platform/symbian/S60/BLD.INF.in
@@ -5,7 +5,7 @@ PRJ_MMPFILES
//START_AUTO_PROJECTS//
// empty base file, will be updated by Perl build scripts
-
+
//STOP_AUTO_PROJECTS//
.\ScummVM_S60.mmp
diff --git a/backends/platform/symbian/S60v3/BLD.INF.in b/backends/platform/symbian/S60v3/BLD.INF.in
index 10f46ced61..78d130cb08 100644
--- a/backends/platform/symbian/S60v3/BLD.INF.in
+++ b/backends/platform/symbian/S60v3/BLD.INF.in
@@ -5,7 +5,7 @@ PRJ_MMPFILES
//START_AUTO_PROJECTS//
// empty base file, will be updated by Perl build scripts
-
+
//STOP_AUTO_PROJECTS//
gnumakefile icons.mk
.\ScummVM_A0000658_S60v3.mmp
diff --git a/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in b/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in
index 2ba609fef2..d044b33bb0 100644
--- a/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in
+++ b/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in
@@ -129,7 +129,7 @@ SOURCE gui\KeysDialog.cpp
SOURCE gui\Actions.cpp
SOURCE gui\Dialog.cpp
-// Common error
+// Common error
source common\error.cpp
// Special for graphics
@@ -143,4 +143,4 @@ LIBRARY gdi.lib hal.lib bitgdi.lib
LIBRARY mediaclientaudiostream.lib efsrv.lib ws32.lib
library avkon.lib bafl.lib
-CAPABILITY LocalServices ReadUserData
\ No newline at end of file
+CAPABILITY LocalServices ReadUserData
diff --git a/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in b/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in
index 713d73bdb9..bcc00017ab 100644
--- a/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in
+++ b/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in
@@ -129,7 +129,7 @@ SOURCE gui\KeysDialog.cpp
SOURCE gui\Actions.cpp
SOURCE gui\Dialog.cpp
-// Common error
+// Common error
source common\error.cpp
// Special for graphics
@@ -143,4 +143,4 @@ LIBRARY gdi.lib hal.lib bitgdi.lib
LIBRARY mediaclientaudiostream.lib efsrv.lib ws32.lib
library avkon.lib bafl.lib
-CAPABILITY LocalServices ReadUserData
\ No newline at end of file
+CAPABILITY LocalServices ReadUserData
diff --git a/backends/platform/symbian/S80/BLD.INF.in b/backends/platform/symbian/S80/BLD.INF.in
index 75ef20be12..c25ee43a99 100644
--- a/backends/platform/symbian/S80/BLD.INF.in
+++ b/backends/platform/symbian/S80/BLD.INF.in
@@ -5,7 +5,7 @@ PRJ_MMPFILES
//START_AUTO_PROJECTS//
// empty base file, will be updated by Perl build scripts
-
+
//STOP_AUTO_PROJECTS//
.\ScummVM_S80.mmp
diff --git a/backends/platform/symbian/S90/BLD.INF.in b/backends/platform/symbian/S90/BLD.INF.in
index d6e1ece012..4e333e5dae 100644
--- a/backends/platform/symbian/S90/BLD.INF.in
+++ b/backends/platform/symbian/S90/BLD.INF.in
@@ -5,7 +5,7 @@ PRJ_MMPFILES
//START_AUTO_PROJECTS//
// empty base file, will be updated by Perl build scripts
-
+
//STOP_AUTO_PROJECTS//
.\ScummVM_S90.mmp
diff --git a/backends/platform/symbian/UIQ2/BLD.INF.in b/backends/platform/symbian/UIQ2/BLD.INF.in
index b607446a64..b8d8111e87 100644
--- a/backends/platform/symbian/UIQ2/BLD.INF.in
+++ b/backends/platform/symbian/UIQ2/BLD.INF.in
@@ -5,7 +5,7 @@ PRJ_MMPFILES
//START_AUTO_PROJECTS//
// empty base file, will be updated by Perl build scripts
-
+
//STOP_AUTO_PROJECTS//
.\ScummVM_UIQ2.mmp
diff --git a/backends/platform/symbian/UIQ3/BLD.INF.in b/backends/platform/symbian/UIQ3/BLD.INF.in
index e4b0bb306e..ff12dbdd75 100644
--- a/backends/platform/symbian/UIQ3/BLD.INF.in
+++ b/backends/platform/symbian/UIQ3/BLD.INF.in
@@ -1,11 +1,11 @@
PRJ_PLATFORMS
-GCCE WINSCW
+GCCE WINSCW
PRJ_MMPFILES
//START_AUTO_PROJECTS//
// empty base file, will be updated by Perl build scripts
-
+
//STOP_AUTO_PROJECTS//
.\ScummVM_A0000658_UIQ3.mmp
.\ScummVM_UIQ3.mmp
diff --git a/backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in b/backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in
index 99cbb264c2..83ce9bc599 100644
--- a/backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in
+++ b/backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in
@@ -127,7 +127,7 @@ SOURCE gui\KeysDialog.cpp
SOURCE gui\Actions.cpp
SOURCE gui\Dialog.cpp
-// Common error
+// Common error
source common\error.cpp
// Special for graphics
diff --git a/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in b/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in
index 3509714152..3c8e41784a 100644
--- a/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in
+++ b/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in
@@ -127,7 +127,7 @@ SOURCE gui\KeysDialog.cpp
SOURCE gui\Actions.cpp
SOURCE gui\Dialog.cpp
-// Common error
+// Common error
source common\error.cpp
// Special for graphics
--
cgit v1.2.3
From 4f4ade6276d3b3263b5f62534da4d208bbd5ca1f Mon Sep 17 00:00:00 2001
From: John Willis
Date: Tue, 12 Oct 2010 07:50:33 +0000
Subject: OPENPANDORA: Add latest backend code from branch-1-2-0.
* Ooops, forgot to sync this with HEAD. Sorry about that.
svn-id: r53162
---
.../platform/openpandora/build/README-OPENPANDORA | 127 +------------
backends/platform/openpandora/build/runscummvm.sh | 2 +-
backends/platform/openpandora/module.mk | 1 +
backends/platform/openpandora/op-events.cpp | 204 ++++++++++-----------
backends/platform/openpandora/op-graphics.cpp | 12 +-
backends/platform/openpandora/op-main.cpp | 117 +++++++++---
backends/platform/openpandora/op-options.cpp | 56 ++++++
backends/platform/openpandora/op-options.h | 42 +++++
backends/platform/openpandora/op-sdl.h | 18 +-
9 files changed, 303 insertions(+), 276 deletions(-)
create mode 100755 backends/platform/openpandora/op-options.cpp
create mode 100755 backends/platform/openpandora/op-options.h
(limited to 'backends/platform')
diff --git a/backends/platform/openpandora/build/README-OPENPANDORA b/backends/platform/openpandora/build/README-OPENPANDORA
index c909ed56a6..c3aa5e8ea9 100755
--- a/backends/platform/openpandora/build/README-OPENPANDORA
+++ b/backends/platform/openpandora/build/README-OPENPANDORA
@@ -1,22 +1,5 @@
ScummVM - OPENPANDORA SPECIFIC README - HEAD SVN
------------------------------------------------------------------------
-
-Contents:
-
- * About the backend/port <#About_the_backendport>
- * Game compatability <#Game_compatibility>
- * Included engines <#Included_engines>
- * Supported audio options <#Supported_audio_options>
- * Supported cut-scene options <#Supported_cut-scene_options>
- * Recent changes <#Recent_changes>
- * How to save <#How_to_save>
- * Controller mappings <#Controller_mappings>
- * Known issues <#Knonw_issues>
- * Additional resources/links <#Additional_resourceslinks>
- * Credits <#Credits>
-
-------------------------------------------------------------------------
-
Please refer to the:
ScummVM Forum:
@@ -25,116 +8,12 @@ WiKi:
for the most current information on the port and any updates to this
documentation.
-------------------------------------------------------------------------
-About the backend/port
-
-This is the readme for the official GP2XWiz ScummVM backend (also known as
-the GP2XWiz port).
-
-This is an SVN test release of ScummVM for the GP2XWiz, it would be
-appreciated if this SVN test distribution was not mirrored and that
-people be directed to http://scummvm.distant-earth.com/ instead for
-updated SVN builds.
-
-Full supported official releases of the GP2X WIZ ScummVM backend are made in
-line with main official releases and are avalalble from the ScummVM
-downloads page .
-
-This build is in an active state of development and as such no
-"expected" behavior can be guaranteed ;).
-
-------------------------------------------------------------------------
-Game compatibility
-
-For information on the compatability of a specific game please refer to
-the GP2XWiz compatability section of the ScummVM WiKi
-.
-
-Please note the version and date of the ScummVM build you are running
-when reviewing the above list.
-
-------------------------------------------------------------------------
-Supported audio options
-
-Raw audio.
-MP3 audio.
-OGG Vorbis audio.
-
-FLAC audio is currently unsupported.
-
-For best results use uncompressed audio in games.
-
-------------------------------------------------------------------------
-How to save
-
-NOTE: Everything is saved to the SD card, saves are stored in the saves
-folder under your main ScummVM executable unless you set another save
-location.
-
-The configiration file for ScummVM (.scummvmrc) is stored in the same
-place as the ScummVM executable.
-
-The save process below is for Scumm engine games but the principle is
-the same for all.
-
-In Game.
-
-1. Menu Button
-2. Select SAVE with B
-3. Select a position with B
-4. Right trigger puts 0 in the name box for some text.
-5. Press B to save
-
-Basically the emulated keys you can use are equivelent to the values
-buttons are mapped to,
-
-------------------------------------------------------------------------
-Controller mappings
-
-Touch screen:
-Touch: Move Pointer and Left click
-
-Mouse emulation:
-
-dPad: Move Pointer
-B: Left click
-X: Right click
-
-Keyboard emulation:
-
-Right Trigger: Return
-Select: Escape
-Y: Space Bar (Pause)
-Menu: Game Menu (Save, Load, Quit etc.)
-Volume Buttons: Increase and Decrease volume
-
-Fancy button combos:
-
-NOTE: To use button combos press and hold the Left Trigger then...
-
-Right Trigger: Display Virtual Keyboard
-Menu: Bring up the Global main menu for ScummVM
-Select: Exit ScummVM completely (and gracefully)
-
-------------------------------------------------------------------------
-Known issues
-
-No major known issues
-
-------------------------------------------------------------------------
-Additional resources/links
-
- * ScummVM WiKi GP2X page
- * ScummVM forums GP2X forum
-
- * My own ScummVM page (for
- SVN/test builds)
- * Main ScummVM site (for official supported
- release builds)
+The wiki includes detailed instructions on how to use the port and
+control information.
------------------------------------------------------------------------
Credits
Core ScummVM code (c) The ScummVM Team
-GP2X Wiz backend (c) John Willis
+OpenPandora backend (c) John Willis
Detailed (c) information can be found within the source code
diff --git a/backends/platform/openpandora/build/runscummvm.sh b/backends/platform/openpandora/build/runscummvm.sh
index 0745bb41fd..48d24a2b81 100755
--- a/backends/platform/openpandora/build/runscummvm.sh
+++ b/backends/platform/openpandora/build/runscummvm.sh
@@ -11,4 +11,4 @@ mkdir saves
mkdir runtime
cd runtime
-../bin/scummvm --fullscreen --gfx-mode=2x --config=scummvmrc --extrapath=../data --savepath=../saves
+../bin/scummvm --fullscreen --gfx-mode=2x --config=../scummvm.config
diff --git a/backends/platform/openpandora/module.mk b/backends/platform/openpandora/module.mk
index 867908c840..1e5f6bcd69 100755
--- a/backends/platform/openpandora/module.mk
+++ b/backends/platform/openpandora/module.mk
@@ -3,6 +3,7 @@ MODULE := backends/platform/openpandora
MODULE_OBJS := \
op-graphics.o \
op-events.o \
+ op-options.o \
op-main.o
MODULE_DIRS += \
diff --git a/backends/platform/openpandora/op-events.cpp b/backends/platform/openpandora/op-events.cpp
index b1caa7bb8a..24283aa8ba 100755
--- a/backends/platform/openpandora/op-events.cpp
+++ b/backends/platform/openpandora/op-events.cpp
@@ -29,16 +29,104 @@
*/
#include "backends/platform/openpandora/op-sdl.h"
+#include "backends/platform/openpandora/op-options.h"
+
+/* Quick default button states for modifiers. */
+int BUTTON_STATE_L = false;
+
+enum {
+ /* Touchscreen TapMode */
+ TAPMODE_LEFT = 0,
+ TAPMODE_RIGHT = 1,
+ TAPMODE_HOVER = 2
+};
+
+/* On the OpenPandora by default the ABXY and L/R Trigger buttons are returned by SDL as
+ (A): SDLK_HOME (B): SDLK_END (X): SDLK_PAGEDOWN (Y): SDLK_PAGEUP (L): SDLK_RSHIFT (R): SDLK_RCTRL
+*/
+
+bool OSystem_OP::handleKeyDown(SDL_Event &ev, Common::Event &event) {
+ switch (ev.key.keysym.sym) {
+ case SDLK_HOME:
+ event.type = Common::EVENT_LBUTTONDOWN;
+ fillMouseEvent(event, _km.x, _km.y);
+ return true;
+ break;
+ case SDLK_END:
+ event.type = Common::EVENT_RBUTTONDOWN;
+ fillMouseEvent(event, _km.x, _km.y);
+ return true;
+ break;
+ case SDLK_PAGEDOWN:
+ event.type = Common::EVENT_MAINMENU;
+ return true;
+ break;
+ case SDLK_PAGEUP:
+ OP::ToggleTapMode();
+ if (OP::tapmodeLevel == TAPMODE_LEFT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode' - Left Click");
+ } else if (OP::tapmodeLevel == TAPMODE_RIGHT) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode' - Right Click");
+ } else if (OP::tapmodeLevel == TAPMODE_HOVER) {
+ displayMessageOnOSD("Touchscreen 'Tap Mode' - Hover (No Click)");
+ }
+ break;
+ case SDLK_RSHIFT:
+ BUTTON_STATE_L = true;
+ break;
+ case SDLK_RCTRL:
+ break;
+ default:
+ return OSystem_SDL::handleKeyDown(ev, event);
+ break;
+ }
+ return false;
+}
+
+bool OSystem_OP::handleKeyUp(SDL_Event &ev, Common::Event &event) {
+ switch (ev.key.keysym.sym) {
+ case SDLK_HOME:
+ event.type = Common::EVENT_LBUTTONUP;
+ fillMouseEvent(event, _km.x, _km.y);
+ return true;
+ break;
+ case SDLK_END:
+ event.type = Common::EVENT_RBUTTONUP;
+ fillMouseEvent(event, _km.x, _km.y);
+ return true;
+ break;
+ case SDLK_PAGEDOWN:
+ event.type = Common::EVENT_MAINMENU;
+ return true;
+ break;
+ case SDLK_PAGEUP:
+ break;
+ case SDLK_RSHIFT:
+ BUTTON_STATE_L = false;
+ break;
+ case SDLK_RCTRL:
+ break;
+ default:
+ return OSystem_SDL::handleKeyUp(ev, event);
+ break;
+ }
+ return false;
+}
+
+/* Custom handleMouseButtonDown/handleMouseButtonUp to deal with 'Tap Mode' for the touchscreen */
bool OSystem_OP::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
if (ev.button.button == SDL_BUTTON_LEFT){
- SDLMod mod=SDL_GetModState();
- if (mod & KMOD_RCTRL) /* KMOD_RCTRL = Right Trigger */
+ if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */
event.type = Common::EVENT_RBUTTONDOWN;
- else if ( mod & KMOD_RSHIFT) /* KMOD_RSHIFT = Left Trigger */
+ else if (OP::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
+ event.type = Common::EVENT_LBUTTONDOWN;
+ else if (OP::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */
+ event.type = Common::EVENT_RBUTTONDOWN;
+ else if (OP::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
event.type = Common::EVENT_MOUSEMOVE;
else
- event.type = Common::EVENT_LBUTTONDOWN;
+ event.type = Common::EVENT_LBUTTONDOWN; /* For normal mice etc. */
}
else if (ev.button.button == SDL_BUTTON_RIGHT)
event.type = Common::EVENT_RBUTTONDOWN;
@@ -55,10 +143,6 @@ bool OSystem_OP::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
else
return false;
- // People can use the touchscreen so may have no mouse motion events between taps.
- // Not sure if this fixes anything ;).
- // setMousePos(event.mouse.x, event.mouse.y);
-
fillMouseEvent(event, ev.button.x, ev.button.y);
return true;
@@ -66,13 +150,16 @@ bool OSystem_OP::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
bool OSystem_OP::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
if (ev.button.button == SDL_BUTTON_LEFT){
- SDLMod mod=SDL_GetModState();
- if (mod & KMOD_RCTRL) /* KMOD_RCTRL = Right Trigger */
+ if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */
event.type = Common::EVENT_RBUTTONUP;
- else if ( mod & KMOD_RSHIFT) /* KMOD_RSHIFT = Left Trigger */
+ else if (OP::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
+ event.type = Common::EVENT_LBUTTONUP;
+ else if (OP::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */
+ event.type = Common::EVENT_RBUTTONUP;
+ else if (OP::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
event.type = Common::EVENT_MOUSEMOVE;
else
- event.type = Common::EVENT_LBUTTONUP;
+ event.type = Common::EVENT_LBUTTONUP; /* For normal mice etc. */
}
else if (ev.button.button == SDL_BUTTON_RIGHT)
event.type = Common::EVENT_RBUTTONUP;
@@ -87,96 +174,3 @@ bool OSystem_OP::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
return true;
}
-
-
-bool OSystem_OP::handleMouseMotion(SDL_Event &ev, Common::Event &event) {
- event.type = Common::EVENT_MOUSEMOVE;
- fillMouseEvent(event, ev.motion.x, ev.motion.y);
-
- setMousePos(event.mouse.x, event.mouse.y);
- return true;
-}
-
-void OSystem_OP::warpMouse(int x, int y) {
- if (_mouseCurState.x != x || _mouseCurState.y != y) {
- SDL_WarpMouse(x, y);
-
- // SDL_WarpMouse() generates a mouse movement event, so
- // set_mouse_pos() would be called eventually. However, the
- // cannon script in CoMI calls this function twice each time
- // the cannon is reloaded. Unless we update the mouse position
- // immediately the second call is ignored, causing the cannon
- // to change its aim.
-
- setMousePos(x, y);
- }
-}
-
-void OSystem_OP::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;
- }
- }
-
- _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((Uint16)_km.x, (Uint16)_km.y);
- }
- }
-}
diff --git a/backends/platform/openpandora/op-graphics.cpp b/backends/platform/openpandora/op-graphics.cpp
index 4abe034ae4..ef95f52e99 100755
--- a/backends/platform/openpandora/op-graphics.cpp
+++ b/backends/platform/openpandora/op-graphics.cpp
@@ -24,9 +24,19 @@
*/
#include "backends/platform/openpandora/op-sdl.h"
+#include "common/mutex.h"
+#include "common/translation.h"
+#include "common/util.h"
+
+#include "graphics/scaler/aspect.h"
+#include "graphics/surface.h"
bool OSystem_OP::loadGFXMode() {
- _videoMode.overlayWidth = 800;
+ /* FIXME: For now we just cheat and set the overlay to 640*480 not 800*480 and let SDL
+ deal with the boarders (it saves cleaning up the overlay when the game screen is
+ smaller than the overlay ;)
+ */
+ _videoMode.overlayWidth = 640;
_videoMode.overlayHeight = 480;
_videoMode.fullscreen = true;
diff --git a/backends/platform/openpandora/op-main.cpp b/backends/platform/openpandora/op-main.cpp
index a6f20369af..4febd404c3 100755
--- a/backends/platform/openpandora/op-main.cpp
+++ b/backends/platform/openpandora/op-main.cpp
@@ -55,8 +55,9 @@
/* Dump console info to files. */
#define DUMP_STDOUT
-int main(int argc, char *argv[]) {
+static SDL_Cursor *hiddenCursor;
+int main(int argc, char *argv[]) {
g_system = new OSystem_OP();
assert(g_system);
@@ -71,15 +72,39 @@ int main(int argc, char *argv[]) {
return res;
}
+static Uint32 timer_handler(Uint32 interval, void *param) {
+ ((DefaultTimerManager *)param)->handler();
+ return interval;
+}
+
void OSystem_OP::initBackend() {
+ assert(!_inited);
+
+ uint8_t hiddenCursorData = 0;
+
+ int joystick_num = ConfMan.getInt("joystick_num");
+ uint32 sdlFlags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
+
+ if (ConfMan.hasKey("disable_sdl_parachute"))
+ sdlFlags |= SDL_INIT_NOPARACHUTE;
+
+ if (joystick_num > -1)
+ sdlFlags |= SDL_INIT_JOYSTICK;
+
+ if (SDL_Init(sdlFlags) == -1) {
+ error("Could not initialize SDL: %s", SDL_GetError());
+ }
+
+ hiddenCursor = SDL_CreateCursor(&hiddenCursorData, &hiddenCursorData, 8, 1, 0, 0);
+
/* Setup default save path to be workingdir/saves */
char savePath[PATH_MAX+1];
char workDirName[PATH_MAX+1];
if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Could not obtain current working directory");
+ error("Could not obtain current working directory.");
} else {
printf("Current working directory: %s\n", workDirName);
}
@@ -103,8 +128,8 @@ void OSystem_OP::initBackend() {
strcpy(STDOUT_FILE, workDirName);
strcpy(STDERR_FILE, workDirName);
- strcat(STDOUT_FILE, "/../scummvm.stdout.txt");
- strcat(STDERR_FILE, "/../scummvm.stderr.txt");
+ strcat(STDOUT_FILE, "/scummvm.stdout.txt");
+ strcat(STDERR_FILE, "/scummvm.stderr.txt");
// Flush the output in case anything is queued
fclose(stdout);
@@ -142,60 +167,94 @@ void OSystem_OP::initBackend() {
/* Trigger autosave every 4 minutes. */
ConfMan.registerDefault("autosave_period", 4 * 60);
+ ConfMan.registerDefault("fullscreen", true);
+
/* Make sure that aspect ratio correction is enabled on the 1st run to stop
users asking me what the 'wasted space' at the bottom is ;-). */
ConfMan.registerDefault("aspect_ratio", true);
- /* Make sure that aspect ratio correction is enabled on the 1st run to stop
- users asking me what the 'wasted space' at the bottom is ;-). */
- ConfMan.registerDefault("desired_screen_aspect_ratio", "5/4" );
-
/* Make sure SDL knows that we have a joystick we want to use. */
ConfMan.setInt("joystick_num", 0);
- printf("%s\n", "Passing to OSystem::SDL initBackend.");
+ _graphicsMutex = createMutex();
+
+ /* On the OpenPandora we need to work around an SDL assumption that
+ returns relative mouse coordinates when you get to the screen
+ edges using the touchscreen. The workaround is to set a blank
+ SDL cursor and not disable it (Hackish I know).
+
+ The root issues likes in the Windows Manager GRAB code in SDL.
+ That is why the issue is not seen on framebuffer devices like the
+ GP2X (there is no X window manager ;)).
+ */
+ SDL_ShowCursor(SDL_ENABLE);
+ SDL_SetCursor(hiddenCursor);
- /* Pass to SDL backend to do the heavy lifting */
- OSystem_SDL::initBackend();
+ // Enable unicode support if possible
+ SDL_EnableUNICODE(1);
+
+ memset(&_oldVideoMode, 0, sizeof(_oldVideoMode));
+ memset(&_videoMode, 0, sizeof(_videoMode));
+ memset(&_transactionDetails, 0, sizeof(_transactionDetails));
+
+ _videoMode.mode = GFX_DOUBLESIZE;
+ _videoMode.scaleFactor = 2;
+ _videoMode.aspectRatioCorrection = ConfMan.getBool("aspect_ratio");
+ _scalerProc = Normal2x;
+ _scalerType = 0;
+
+ _videoMode.fullscreen = true;
+
+ // enable joystick
+ if (joystick_num > -1 && SDL_NumJoysticks() > 0) {
+ printf("Using joystick: %s\n", SDL_JoystickName(0));
+ _joystick = SDL_JoystickOpen(joystick_num);
+ }
+
+ setupMixer();
+
+ // Note: We could implement a custom SDLTimerManager by using
+ // SDL_AddTimer. That might yield better timer resolution, but it would
+ // also change the semantics of a timer: Right now, ScummVM timers
+ // *never* run in parallel, due to the way they are implemented. If we
+ // switched to SDL_AddTimer, each timer might run in a separate thread.
+ // However, not all our code is prepared for that, so we can't just
+ // switch. Still, it's a potential future change to keep in mind.
+ _timer = new DefaultTimerManager();
+ _timerID = SDL_AddTimer(10, &timer_handler, _timer);
+
+ // Invoke parent implementation of this method
+ OSystem::initBackend();
+
+ _inited = true;
}
void OSystem_OP::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
/* Setup default extra data paths for engine data files and plugins */
+
char workDirName[PATH_MAX+1];
if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Error: Could not obtain current working directory");
- }
-
- Common::FSNode workdirNode(workDirName);
- if (workdirNode.exists() && workdirNode.isDirectory()) {
- s.add("__OPENPANDORA_WORKDIR__", new Common::FSDirectory(workDirName), priority);
+ error("Error: Could not obtain current working directory.");
}
char enginedataPath[PATH_MAX+1];
strcpy(enginedataPath, workDirName);
- strcat(enginedataPath, "./../data");
+ strcat(enginedataPath, "/../data");
+ printf("Default engine data directory: %s\n", enginedataPath);
Common::FSNode engineNode(enginedataPath);
if (engineNode.exists() && engineNode.isDirectory()) {
- s.add("__OPENPANDORA_ENGDATA__", new Common::FSDirectory(enginedataPath), priority);
- }
-
- char pluginsPath[PATH_MAX+1];
-
- strcpy(pluginsPath, workDirName);
- strcat(pluginsPath, "./../plugins");
-
- Common::FSNode pluginsNode(pluginsPath);
- if (pluginsNode.exists() && pluginsNode.isDirectory()) {
- s.add("__OPENPANDORA_PLUGINS__", new Common::FSDirectory(pluginsPath), priority);
+ s.add("__OP_ENGDATA__", new Common::FSDirectory(enginedataPath), priority);
}
}
void OSystem_OP::quit() {
+ SDL_FreeCursor(hiddenCursor);
+
#ifdef DUMP_STDOUT
printf("%s\n", "Debug: STDOUT and STDERR text files closed.");
fclose(stdout);
diff --git a/backends/platform/openpandora/op-options.cpp b/backends/platform/openpandora/op-options.cpp
new file mode 100755
index 0000000000..f8711b868a
--- /dev/null
+++ b/backends/platform/openpandora/op-options.cpp
@@ -0,0 +1,56 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+/*
+ * OpenPandora: Options, custom code and hardware stuff.
+ *
+ */
+
+#include "backends/platform/openpandora/op-options.h"
+
+namespace OP {
+
+enum {
+ /* Touchscreen TapMode */
+ TAPMODE_LEFT = 0,
+ TAPMODE_RIGHT = 1,
+ TAPMODE_HOVER = 2
+};
+
+int tapmodeLevel = TAPMODE_LEFT;
+
+void ToggleTapMode() {
+ if (tapmodeLevel == TAPMODE_LEFT) {
+ tapmodeLevel = TAPMODE_RIGHT;
+ } else if (tapmodeLevel == TAPMODE_RIGHT) {
+ tapmodeLevel = TAPMODE_HOVER;
+ } else if (tapmodeLevel == TAPMODE_HOVER) {
+ tapmodeLevel = TAPMODE_LEFT;
+ } else {
+ tapmodeLevel = TAPMODE_LEFT;
+ }
+}
+
+} /* namespace OP */
diff --git a/backends/platform/openpandora/op-options.h b/backends/platform/openpandora/op-options.h
new file mode 100755
index 0000000000..8c2bb1cc89
--- /dev/null
+++ b/backends/platform/openpandora/op-options.h
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+/*
+ * OpenPandora: Options, custom code and hardware stuff.
+ *
+ */
+
+#ifndef OP_OPTIONS_H
+#define OP_OPTIONS_H
+
+namespace OP {
+
+extern int tapmodeLevel;
+
+extern void ToggleTapMode();
+
+} /* namespace OP */
+
+#endif //OP_OPTIONS_H
diff --git a/backends/platform/openpandora/op-sdl.h b/backends/platform/openpandora/op-sdl.h
index 5fd9bf4ed4..8561b42498 100755
--- a/backends/platform/openpandora/op-sdl.h
+++ b/backends/platform/openpandora/op-sdl.h
@@ -40,27 +40,13 @@ public:
OSystem_OP() {}
/* Events */
+ bool handleKeyDown(SDL_Event &ev, Common::Event &event);
+ bool handleKeyUp(SDL_Event &ev, Common::Event &event);
bool handleMouseButtonDown(SDL_Event &ev, Common::Event &event);
bool handleMouseButtonUp(SDL_Event &ev, Common::Event &event);
- bool handleMouseMotion(SDL_Event &ev, Common::Event &event);
- void warpMouse(int, int);
- void handleKbdMouse();
/* Graphics */
-// void initSize(uint w, uint h);
-// void setGraphicsModeIntern();
-// bool setGraphicsMode(int mode);
-// void internUpdateScreen();
-// const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
-// bool setGraphicsMode(const char *name);
-// int getDefaultGraphicsMode() const;
bool loadGFXMode();
-// void drawMouse();
-// void undrawMouse();
-// void showOverlay();
-// void hideOverlay();
-
-// void warpMouse(int, int);
/* Platform Setup Stuff */
void addSysArchivesToSearchSet(Common::SearchSet &s, int priority);
--
cgit v1.2.3
From 2dea84947eb9b78053946e61ff273dd562589388 Mon Sep 17 00:00:00 2001
From: Lars Persson
Date: Wed, 13 Oct 2010 19:02:24 +0000
Subject: SYMBIAN: Add makefiles for TOON Struck
svn-id: r53443
---
backends/platform/symbian/AdaptAllMMPs.pl | 2 +
.../symbian/BuildPackageUpload_LocalSettings.pl | 8 +--
backends/platform/symbian/mmp/scummvm_toon.mmp.in | 64 ++++++++++++++++++++++
3 files changed, 70 insertions(+), 4 deletions(-)
create mode 100644 backends/platform/symbian/mmp/scummvm_toon.mmp.in
(limited to 'backends/platform')
diff --git a/backends/platform/symbian/AdaptAllMMPs.pl b/backends/platform/symbian/AdaptAllMMPs.pl
index a81eab9af6..8786ecff32 100644
--- a/backends/platform/symbian/AdaptAllMMPs.pl
+++ b/backends/platform/symbian/AdaptAllMMPs.pl
@@ -34,6 +34,7 @@ chdir("../../../");
"mmp/scummvm_teenagent.mmp",
"mmp/scummvm_mohawk.mmp",
"mmp/scummvm_hugo.mmp",
+ "mmp/scummvm_toon.mmp",
# Target Platform Project Files
"S60/ScummVM_S60.mmp",
"S60v3/ScummVM_S60v3.mmp",
@@ -138,6 +139,7 @@ ParseModule("_draci", "draci", \@section_empty);
ParseModule("_teenagent","teenagent", \@section_empty);
ParseModule("_mohawk" ,"mohawk", \@section_empty);
ParseModule("_hugo" ,"hugo", \@section_empty);
+ParseModule("_toon" ,"toon", \@section_empty);
print "
=======================================================================================
Done. Enjoy :P
diff --git a/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl b/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl
index a0ec338ca0..bf80c36a0e 100644
--- a/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl
+++ b/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl
@@ -4,7 +4,7 @@
@WorkingEngines = qw(
scumm agos sky queen gob groovie saga drascula
kyra lure agi touche parallaction cine
- cruise made m4 tinsel tucker sword1 sword2 draci sci teenagent mohawk hugo
+ cruise made m4 tinsel tucker sword1 sword2 draci sci teenagent mohawk hugo toon
);
@WorkingEngines_1st = qw(
@@ -16,7 +16,7 @@
@WorkingEngines_2nd = qw(
agos sky gob
kyra lure agi tinsel
- sword1 sword2 draci sci teenagent hugo
+ sword1 sword2 draci sci teenagent hugo toon
);
@TestingEngines = qw(
@@ -302,8 +302,8 @@
# the first one includes all SDKs & release-ready engines
$VariationSets{'ALL'}{'all'} = "$DefaultFeatures @WorkingEngines @EnablableSubEngines";
- $VariationSets{'ALL'}{'1St'} = "$DefaultFeatures @WorkingEngines_1st @EnablableSubEngines";
- $VariationSets{'ALL'}{'2nd'} = "$DefaultFeatures @WorkingEngines_2nd @EnablableSubEngines";
+# $VariationSets{'ALL'}{'1St'} = "$DefaultFeatures @WorkingEngines_1st @EnablableSubEngines";
+# $VariationSets{'ALL'}{'2nd'} = "$DefaultFeatures @WorkingEngines_2nd @EnablableSubEngines";
# now one for each ready-for-release engine
if (0)
{
diff --git a/backends/platform/symbian/mmp/scummvm_toon.mmp.in b/backends/platform/symbian/mmp/scummvm_toon.mmp.in
new file mode 100644
index 0000000000..7b907fd92f
--- /dev/null
+++ b/backends/platform/symbian/mmp/scummvm_toon.mmp.in
@@ -0,0 +1,64 @@
+/* ScummVM - Graphic Adventure Engine
+ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL
+ * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System
+ * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer
+ * Copyright (C) 2005-2010 The ScummVM project
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+//
+// EPOC MMP makefile project for ScummVM
+//
+
+// *** Definitions
+
+TARGET scummvm_toon.lib
+TARGETTYPE lib
+OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
+OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
+ALWAYS_BUILD_AS_ARM
+
+//START_AUTO_MACROS_SLAVE//
+
+ // empty base file, will be updated by Perl build scripts
+
+//STOP_AUTO_MACROS_SLAVE//
+
+// *** SOURCE files
+
+SOURCEPATH ..\..\..\..\engines\toon
+
+//START_AUTO_OBJECTS_TOON_//
+
+ // empty base file, will be updated by Perl build scripts
+
+//STOP_AUTO_OBJECTS_TOON_//
+
+// *** Include paths
+
+USERINCLUDE ..\..\..\..\engines
+USERINCLUDE ..\..\..\.. ..\..\..\..\common ..\..\..\..\gui ..\..\..\..\sound ..\src
+SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version
+SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src
--
cgit v1.2.3
From 90e12a43fd8e0f6e94f59a52b6794e01200adcc7 Mon Sep 17 00:00:00 2001
From: Yotam Barnoy
Date: Thu, 14 Oct 2010 13:05:40 +0000
Subject: PSP: clarify and fix up display code
Also added support for stretching images, and fixed up displaying of large images as well as PNG files
svn-id: r53454
---
backends/platform/psp/display_client.cpp | 176 +++++++++++++++----------------
backends/platform/psp/display_client.h | 22 ++--
backends/platform/psp/png_loader.cpp | 47 ++++++---
3 files changed, 134 insertions(+), 111 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/psp/display_client.cpp b/backends/platform/psp/display_client.cpp
index 916b6c1aae..9d4f573e28 100644
--- a/backends/platform/psp/display_client.cpp
+++ b/backends/platform/psp/display_client.cpp
@@ -347,7 +347,6 @@ void Buffer::copyFromRect(const byte *buf, uint32 pitch, int destX, int destY, u
PspMemory::fastCopy(dst, buf, _pixelFormat.pixelsToBytes(recHeight * recWidth));
} else {
do {
- //memcpy(dst, buf, recWidthInBytes);
if (_pixelFormat.swapRB)
PspMemorySwap::fastSwap(dst, buf, recWidthInBytes, _pixelFormat);
else
@@ -379,45 +378,45 @@ void Buffer::copyToArray(byte *dst, int pitch) {
} while (--h);
}
-/* We can size the buffer either by texture size (multiple of 2^n) or source size. The GU can
- really handle both, but is supposed to get only 2^n size buffers */
void Buffer::setSize(uint32 width, uint32 height, HowToSize textureOrSource/*=kSizeByTextureSize*/) {
DEBUG_ENTER_FUNC();
- PSP_DEBUG_PRINT("w[%u], h[%u], %s\n", width, height, textureOrSource ? "size by source" : "size by texture");
-
+
+ // We can size the buffer either by texture size (multiple of 2^n) or source size.
+ // At higher sizes, increasing the texture size to 2^n is a waste of space. At these sizes kSizeBySourceSize should be used.
+
_sourceSize.width = width;
_sourceSize.height = height;
- _textureSize.width = scaleUpToPowerOfTwo(width);
+ _textureSize.width = scaleUpToPowerOfTwo(width); // can only scale up to 512
_textureSize.height = scaleUpToPowerOfTwo(height);
-
+
if (textureOrSource == kSizeByTextureSize) {
_width = _textureSize.width;
_height = _textureSize.height;
- } else { /* kSizeBySourceSize */
- _width = _sourceSize.width;
+ } else { // sizeBySourceSize
+ _width = _sourceSize.width;
_height = _sourceSize.height;
+
+ // adjust allocated width to be divisible by 32.
+ // The GU can only handle multiples of 16 bytes. A 4 bit image x 32 will give us 16 bytes
+ // We don't necessarily know the depth of the pixels here. So just make it divisible by 32.
+ uint32 checkDiv = _width & 31;
+ if (checkDiv)
+ _width += 32 - checkDiv;
}
+
+ PSP_DEBUG_PRINT("width[%u], height[%u], texW[%u], texH[%u], sourceW[%d], sourceH[%d] %s\n", _width, _height, _textureSize.width, _textureSize.height, _sourceSize.width, _sourceSize.height, textureOrSource ? "size by source" : "size by texture");
}
-/* Scale a dimension (width/height) up to power of 2 for the texture */
+// Scale a dimension (width/height) up to power of 2 for the texture
+// Will only go up to 512 since that's the maximum PSP texture size
uint32 Buffer::scaleUpToPowerOfTwo(uint32 size) {
- uint32 textureDimension = 0;
- if (size <= 16)
- textureDimension = 16;
- else if (size <= 32)
- textureDimension = 32;
- else if (size <= 64)
- textureDimension = 64;
- else if (size <= 128)
- textureDimension = 128;
- else if (size <= 256)
- textureDimension = 256;
- else
- textureDimension = 512;
+ uint32 textureDimension = 16;
+ while (size > textureDimension && textureDimension < 512)
+ textureDimension <<= 1;
- PSP_DEBUG_PRINT("power of 2 = %u\n", textureDimension);
+ PSP_DEBUG_PRINT("size[%u]. power of 2[%u]\n", size, textureDimension);
return textureDimension;
}
@@ -540,51 +539,41 @@ void GuRenderer::render() {
DEBUG_ENTER_FUNC();
PSP_DEBUG_PRINT("Buffer[%p] Palette[%p]\n", _buffer->getPixels(), _palette->getRawValues());
- setMaxTextureOffsetByIndex(0, 0);
-
guProgramDrawBehavior();
if (_buffer->hasPalette())
guLoadPalette();
guProgramTextureFormat();
- guLoadTexture();
-
- Vertex *vertices = guGetVertices();
- fillVertices(vertices);
-
- guDrawVertices(vertices);
-
- if (_buffer->getSourceWidth() > 512) {
- setMaxTextureOffsetByIndex(1, 0);
- guLoadTexture();
-
- vertices = guGetVertices();
- fillVertices(vertices);
-
- guDrawVertices(vertices);
+ // Loop over patches of 512x512 pixel textures and draw them
+ for (uint32 j = 0; j < _buffer->getSourceHeight(); j += 512) {
+ _textureLoadOffset.y = j;
+
+ for (uint32 i = 0; i < _buffer->getSourceWidth(); i += 512) {
+ _textureLoadOffset.x = i;
+
+ guLoadTexture();
+ Vertex *vertices = guGetVertices();
+ fillVertices(vertices);
+
+ guDrawVertices(vertices);
+ }
}
}
-inline void GuRenderer::setMaxTextureOffsetByIndex(uint32 x, uint32 y) {
- DEBUG_ENTER_FUNC();
- const uint32 maxTextureSizeShift = 9; /* corresponds to 512 = max texture size*/
-
- _maxTextureOffset.x = x << maxTextureSizeShift; /* x times 512 */
- _maxTextureOffset.y = y << maxTextureSizeShift; /* y times 512 */
-}
-
inline void GuRenderer::guProgramDrawBehavior() {
DEBUG_ENTER_FUNC();
- PSP_DEBUG_PRINT("blending[%s] colorTest[%s] reverseAlpha[%s] keyColor[%u]\n", _blending ? "on" : "off", _colorTest ? "on" : "off", _alphaReverse ? "on" : "off", _keyColor);
+ PSP_DEBUG_PRINT("blending[%s] colorTest[%s] reverseAlpha[%s] keyColor[%u]\n",
+ _blending ? "on" : "off", _colorTest ? "on" : "off",
+ _alphaReverse ? "on" : "off", _keyColor);
if (_blending) {
sceGuEnable(GU_BLEND);
- if (_alphaReverse) // Reverse the alpha value (0 is 1)
+ if (_alphaReverse) // Reverse the alpha value (ie. 0 is 1) easier to do in some cases
sceGuBlendFunc(GU_ADD, GU_ONE_MINUS_SRC_ALPHA, GU_SRC_ALPHA, 0, 0);
- else // Normal alpha values
+ else // Normal alpha values
sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0);
} else
@@ -592,7 +581,9 @@ inline void GuRenderer::guProgramDrawBehavior() {
if (_colorTest) {
sceGuEnable(GU_COLOR_TEST);
- sceGuColorFunc(GU_NOTEQUAL, _keyColor, 0x00ffffff);
+ sceGuColorFunc(GU_NOTEQUAL, // show only colors not equal to this color
+ _keyColor,
+ 0x00ffffff); // match everything but alpha
} else
sceGuDisable(GU_COLOR_TEST);
}
@@ -613,7 +604,8 @@ inline void GuRenderer::guLoadPalette() {
PSP_DEBUG_PRINT("bpp[%d], pixelformat[%d], mask[%x]\n", _buffer->getBitsPerPixel(), _palette->getPixelFormat(), mask);
sceGuClutMode(convertToGuPixelFormat(_palette->getPixelFormat()), 0, mask, 0);
- sceGuClutLoad(_palette->getNumOfEntries() >> 3, _palette->getRawValues());
+ sceGuClutLoad(_palette->getNumOfEntries() >> 3, // it's in batches of 8 for some reason
+ _palette->getRawValues());
}
inline void GuRenderer::guProgramTextureFormat() {
@@ -659,7 +651,17 @@ inline uint32 GuRenderer::convertToGuPixelFormat(PSPPixelFormat::Type format) {
inline void GuRenderer::guLoadTexture() {
DEBUG_ENTER_FUNC();
- sceGuTexImage(0, _buffer->getTextureWidth(), _buffer->getTextureHeight(), _buffer->getWidth(), _buffer->getPixels() + _buffer->_pixelFormat.pixelsToBytes(_maxTextureOffset.x));
+ byte *startPoint = _buffer->getPixels();
+ if (_textureLoadOffset.x)
+ startPoint += _buffer->_pixelFormat.pixelsToBytes(_textureLoadOffset.x);
+ if (_textureLoadOffset.y)
+ startPoint += _buffer->getWidthInBytes() * _textureLoadOffset.y;
+
+ sceGuTexImage(0,
+ _buffer->getTextureWidth(), // texture width (must be power of 2)
+ _buffer->getTextureHeight(), // texture height (must be power of 2)
+ _buffer->getWidth(), // width of a line of the image (to get to the next line)
+ startPoint); // where to start reading
}
inline Vertex *GuRenderer::guGetVertices() {
@@ -677,40 +679,40 @@ void GuRenderer::fillVertices(Vertex *vertices) {
uint32 outputWidth = _displayManager->getOutputWidth();
uint32 outputHeight = _displayManager->getOutputHeight();
- float textureStartX, textureStartY, textureEndX, textureEndY;
-
// Texture adjustments for eliminating half-pixel artifacts from scaling
// Not necessary if we don't scale
- float textureAdjustment = 0.0f;
+ float textureFix = 0.0f;
if (_useGlobalScaler &&
- (_displayManager->getScaleX() != 1.0f || _displayManager->getScaleX() != 1.0f))
- textureAdjustment = 0.5f;
-
- textureStartX = textureAdjustment + _offsetInBuffer.x; //debug
- textureStartY = textureAdjustment + _offsetInBuffer.y;
- // We subtract maxTextureOffset because our shifted texture starts at 512 and will go to 640
- textureEndX = _offsetInBuffer.x + _drawSize.width - textureAdjustment - _maxTextureOffset.x;
- textureEndY = _offsetInBuffer.y + _drawSize.height - textureAdjustment;
-
+ (_displayManager->getScaleX() != 1.0f || _displayManager->getScaleY() != 1.0f))
+ textureFix = 0.5f;
+
+ // These coordinates describe an area within the texture. ie. we already loaded a square of texture,
+ // now the coordinates within it are 0 to the edge of the area of the texture we want to draw
+ float textureStartX = textureFix + _offsetInBuffer.x;
+ float textureStartY = textureFix + _offsetInBuffer.y;
+ // even when we draw one of several textures, we use the whole drawsize of the image. The GU
+ // will draw what it can with the texture it has and scale it properly for us.
+ float textureEndX = -textureFix + _offsetInBuffer.x + _drawSize.width - _textureLoadOffset.x;
+ float textureEndY = -textureFix + _offsetInBuffer.y + _drawSize.height - _textureLoadOffset.y;
// For scaling to the final image size, calculate the gaps on both sides
uint32 gapX = _useGlobalScaler ? (PSP_SCREEN_WIDTH - outputWidth) >> 1 : 0;
uint32 gapY = _useGlobalScaler ? (PSP_SCREEN_HEIGHT - outputHeight) >> 1 : 0;
// Save scaled offset on screen
- float scaledOffsetOnScreenX = scaleSourceToOutputX(_offsetOnScreen.x);
- float scaledOffsetOnScreenY = scaleSourceToOutputY(_offsetOnScreen.y);
-
- float imageStartX, imageStartY, imageEndX, imageEndY;
+ float scaledOffsetOnScreenX = scaleSourceToOutput(true, _offsetOnScreen.x);
+ float scaledOffsetOnScreenY = scaleSourceToOutput(false, _offsetOnScreen.y);
- imageStartX = gapX + scaledOffsetOnScreenX + (scaleSourceToOutputX(_maxTextureOffset.x));
- imageStartY = gapY + scaledOffsetOnScreenY;
+ float imageStartX = gapX + scaledOffsetOnScreenX + (scaleSourceToOutput(true, stretch(true, _textureLoadOffset.x)));
+ float imageStartY = gapY + scaledOffsetOnScreenY + (scaleSourceToOutput(false, stretch(false, _textureLoadOffset.y)));
+ float imageEndX, imageEndY;
+
if (_fullScreen) { // shortcut
imageEndX = PSP_SCREEN_WIDTH - gapX + scaledOffsetOnScreenX;
imageEndY = PSP_SCREEN_HEIGHT - gapY + scaledOffsetOnScreenY; // needed for screen shake
} else { /* !fullScreen */
- imageEndX = imageStartX + scaleSourceToOutputX(_drawSize.width);
- imageEndY = imageStartY + scaleSourceToOutputY(_drawSize.height);
+ imageEndX = gapX + scaledOffsetOnScreenX + scaleSourceToOutput(true, stretch(true, _drawSize.width));
+ imageEndY = gapY + scaledOffsetOnScreenY + scaleSourceToOutput(false, stretch(false, _drawSize.height));
}
vertices[0].u = textureStartX;
@@ -729,8 +731,8 @@ void GuRenderer::fillVertices(Vertex *vertices) {
PSP_DEBUG_PRINT("ImageStart: X[%f] Y[%f] ImageEnd: X[%.1f] Y[%.1f]\n", imageStartX, imageStartY, imageEndX, imageEndY);
}
-/* Scale the input X offset to appear in proper position on the screen */
-inline float GuRenderer::scaleSourceToOutputX(float offset) {
+/* Scale the input X/Y offset to appear in proper position on the screen */
+inline float GuRenderer::scaleSourceToOutput(bool x, float offset) {
float result;
if (!_useGlobalScaler)
@@ -738,28 +740,22 @@ inline float GuRenderer::scaleSourceToOutputX(float offset) {
else if (!offset)
result = 0.0f;
else
- result = offset * _displayManager->getScaleX();
+ result = x ? offset * _displayManager->getScaleX() : offset * _displayManager->getScaleY();
return result;
}
-/* Scale the input Y offset to appear in proper position on the screen */
-inline float GuRenderer::scaleSourceToOutputY(float offset) {
- float result;
-
- if (!_useGlobalScaler)
- result = offset;
- else if (!offset)
- result = 0.0f;
- else
- result = offset * _displayManager->getScaleY();
-
- return result;
+/* Scale the input X/Y offset to appear in proper position on the screen */
+inline float GuRenderer::stretch(bool x, float size) {
+ if (!_stretch)
+ return size;
+ return (x ? size * _stretchX : size * _stretchY);
}
inline void GuRenderer::guDrawVertices(Vertex *vertices) {
DEBUG_ENTER_FUNC();
+ // This function shouldn't need changing. The '32' here refers to floating point vertices.
sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF | GU_VERTEX_32BITF | GU_TRANSFORM_2D, 2, 0, vertices);
}
diff --git a/backends/platform/psp/display_client.h b/backends/platform/psp/display_client.h
index feec477282..005fc76c7c 100644
--- a/backends/platform/psp/display_client.h
+++ b/backends/platform/psp/display_client.h
@@ -174,8 +174,13 @@ protected:
class GuRenderer {
public:
// Constructors
- GuRenderer() : _useGlobalScaler(false), _buffer(0), _palette(0), _blending(false), _alphaReverse(false), _colorTest(false), _keyColor(0), _fullScreen(false) {}
- GuRenderer(Buffer *buffer, Palette *palette) : _useGlobalScaler(false), _buffer(buffer), _palette(palette), _blending(false), _alphaReverse(false), _colorTest(false), _keyColor(0), _fullScreen(false) {}
+ GuRenderer() : _useGlobalScaler(false), _buffer(0), _palette(0),
+ _blending(false), _alphaReverse(false), _colorTest(false),
+ _keyColor(0), _fullScreen(false), _stretch(false), _stretchX(1.0f), _stretchY(1.0f) {}
+ GuRenderer(Buffer *buffer, Palette *palette) :
+ _useGlobalScaler(false), _buffer(buffer), _palette(palette),
+ _blending(false), _alphaReverse(false), _colorTest(false),
+ _keyColor(0), _fullScreen(false), _stretch(false), _stretchX(1.0f), _stretchY(1.0f) {}
static void setDisplayManager(DisplayManager *dm) { _displayManager = dm; } // Called by the Display Manager
// Setters
@@ -190,8 +195,7 @@ public:
}
void setBuffer(Buffer *buffer) { _buffer = buffer; }
void setPalette(Palette *palette) { _palette = palette; }
- void setMaxTextureOffsetByIndex(uint32 x, uint32 y); // For drawing multiple textures
- void setOffsetOnScreen(uint32 x, uint32 y) { _offsetOnScreen.x = x; _offsetOnScreen.y = y; }
+ void setOffsetOnScreen(int x, int y) { _offsetOnScreen.x = x; _offsetOnScreen.y = y; }
void setOffsetInBuffer(uint32 x, uint32 y) { _offsetInBuffer.x = x; _offsetInBuffer.y = y; }
void setColorTest(bool value) { _colorTest = value; }
void setKeyColor(uint32 value) { _keyColor = _buffer->_pixelFormat.convertTo32BitColor(value); }
@@ -199,6 +203,8 @@ public:
void setAlphaReverse(bool value) { _alphaReverse = value; }
void setFullScreen(bool value) { _fullScreen = value; } // Shortcut for rendering
void setUseGlobalScaler(bool value) { _useGlobalScaler = value; } // Scale to screen
+ void setStretch(bool active) { _stretch = active; }
+ void setStretchXY(float x, float y) { _stretchX = x; _stretchY = y; }
static void cacheInvalidate(void *pointer, uint32 size);
@@ -216,11 +222,11 @@ protected:
void guDrawVertices(Vertex *vertices);
uint32 convertToGuPixelFormat(PSPPixelFormat::Type format);
- float scaleSourceToOutputX(float offset);
- float scaleSourceToOutputY(float offset);
+ float scaleSourceToOutput(bool x, float offset);
+ float stretch(bool x, float size);
friend class MasterGuRenderer;
- Point _maxTextureOffset; ///> For rendering textures > 512 pixels
+ Point _textureLoadOffset; ///> For rendering textures > 512 pixels
Point _offsetOnScreen; ///> Where on screen to draw
Point _offsetInBuffer; ///> Where in the texture to draw
bool _useGlobalScaler; ///> Scale to the output size on screen
@@ -233,6 +239,8 @@ protected:
bool _colorTest;
uint32 _keyColor; ///> Color to test against for color test. in 32 bits.
bool _fullScreen; ///> Speeds up for fullscreen rendering
+ bool _stretch; ///> Whether zooming is activated
+ float _stretchX, _stretchY;
};
#endif /* PSP_SCREEN_H */
diff --git a/backends/platform/psp/png_loader.cpp b/backends/platform/psp/png_loader.cpp
index 978db3eaf9..64a89af5f9 100644
--- a/backends/platform/psp/png_loader.cpp
+++ b/backends/platform/psp/png_loader.cpp
@@ -29,13 +29,19 @@
#include "backends/platform/psp/display_client.h"
#include "backends/platform/psp/png_loader.h"
+//#define __PSP_DEBUG_FUNCS__ /* For debugging function calls */
+//#define __PSP_DEBUG_PRINT__ /* For debug printouts */
+
+#include "backends/platform/psp/trace.h"
+
PngLoader::Status PngLoader::allocate() {
+ DEBUG_ENTER_FUNC();
if (!findImageDimensions()) {
PSP_ERROR("failed to get image dimensions\n");
return BAD_FILE;
}
- PSP_DEBUG_PRINT("width[%d], height[%d], paletteSize[%d], bitDepth[%d]\n", _width, _height, _paletteSize, _bitDepth);
+
_buffer->setSize(_width, _height, _sizeBy);
if (_paletteSize) { // 8 or 4-bit image
@@ -60,7 +66,7 @@ PngLoader::Status PngLoader::allocate() {
PSP_ERROR("failed to allocate buffer\n");
return OUT_OF_MEMORY;
}
- if (!_palette->allocate()) {
+ if (_buffer->hasPalette() && !_palette->allocate()) {
PSP_ERROR("failed to allocate palette\n");
return OUT_OF_MEMORY;
}
@@ -68,6 +74,7 @@ PngLoader::Status PngLoader::allocate() {
}
bool PngLoader::load() {
+ DEBUG_ENTER_FUNC();
// Try to load the image
_file->seek(0); // Go back to start
@@ -98,6 +105,7 @@ void PngLoader::libReadFunc(png_structp pngPtr, png_bytep data, png_size_t lengt
}
bool PngLoader::basicImageLoad() {
+ DEBUG_ENTER_FUNC();
_pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (!_pngPtr)
return false;
@@ -130,11 +138,11 @@ bool PngLoader::basicImageLoad() {
bool PngLoader::findImageDimensions() {
DEBUG_ENTER_FUNC();
- if (!basicImageLoad())
- return false;
+ bool status = basicImageLoad();
+ PSP_DEBUG_PRINT("width[%d], height[%d], paletteSize[%d], bitDepth[%d], rowBytes[%d]\n", _width, _height, _paletteSize, _bitDepth, _infoPtr->rowbytes);
png_destroy_read_struct(&_pngPtr, &_infoPtr, png_infopp_NULL);
- return true;
+ return status;
}
//
@@ -143,11 +151,11 @@ bool PngLoader::findImageDimensions() {
bool PngLoader::loadImageIntoBuffer() {
DEBUG_ENTER_FUNC();
- if (!basicImageLoad())
+ if (!basicImageLoad()) {
+ png_destroy_read_struct(&_pngPtr, &_infoPtr, png_infopp_NULL);
return false;
-
- // Strip off 16 bit channels. Not really needed but whatever
- png_set_strip_16(_pngPtr);
+ }
+ png_set_strip_16(_pngPtr); // Strip off 16 bit channels in case they occur
if (_paletteSize) {
// Copy the palette
@@ -163,10 +171,23 @@ bool PngLoader::loadImageIntoBuffer() {
if (png_get_valid(_pngPtr, _infoPtr, PNG_INFO_tRNS))
png_set_tRNS_to_alpha(_pngPtr); // Convert trans channel to alpha for 32 bits
- png_set_filler(_pngPtr, 0xff, PNG_FILLER_AFTER); // Filler for alpha?
+ //png_set_filler(_pngPtr, 0xff, PNG_FILLER_AFTER); // Filler for alpha if none exists
+ png_set_add_alpha(_pngPtr, 0xff, PNG_FILLER_AFTER); // Filler for alpha if none exists
}
- unsigned char *line = (unsigned char*) malloc(_infoPtr->rowbytes);
+ uint32 rowBytes = png_get_rowbytes(_pngPtr, _infoPtr);
+ uint32 channels = png_get_channels(_pngPtr, _infoPtr);
+
+ // there seems to be a bug in libpng where it doesn't increase the rowbytes or the channel even after we add the
+ // alpha channel
+ if (channels == 3 && (rowBytes / _width) == 3) {
+ channels = 4;
+ rowBytes = _width * channels;
+ }
+
+ PSP_DEBUG_PRINT("rowBytes[%d], channels[%d]\n", rowBytes, channels);
+
+ unsigned char *line = (unsigned char*) malloc(rowBytes);
if (!line) {
png_destroy_read_struct(&_pngPtr, png_infopp_NULL, png_infopp_NULL);
PSP_ERROR("Couldn't allocate line\n");
@@ -175,11 +196,9 @@ bool PngLoader::loadImageIntoBuffer() {
for (size_t y = 0; y < _height; y++) {
png_read_row(_pngPtr, line, png_bytep_NULL);
- _buffer->copyFromRect(line, _infoPtr->rowbytes, 0, y, _width, 1); // Copy into buffer
+ _buffer->copyFromRect(line, rowBytes, 0, y, _width, 1); // Copy into buffer
}
-
free(line);
-
png_read_end(_pngPtr, _infoPtr);
png_destroy_read_struct(&_pngPtr, &_infoPtr, png_infopp_NULL);
--
cgit v1.2.3
From 7c2254589937d9f35d4779c270c9ef6f426e4b73 Mon Sep 17 00:00:00 2001
From: Yotam Barnoy
Date: Thu, 14 Oct 2010 13:19:32 +0000
Subject: PSP: added image viewer for viewing images during games
svn-id: r53455
---
backends/platform/psp/Makefile | 1 +
backends/platform/psp/README.PSP | 35 +++-
backends/platform/psp/display_manager.cpp | 26 +--
backends/platform/psp/display_manager.h | 9 +-
backends/platform/psp/image_viewer.cpp | 280 ++++++++++++++++++++++++++++++
backends/platform/psp/image_viewer.h | 92 ++++++++++
backends/platform/psp/input.cpp | 66 ++++++-
backends/platform/psp/input.h | 49 ++++--
backends/platform/psp/module.mk | 1 +
backends/platform/psp/osys_psp.cpp | 5 +
backends/platform/psp/osys_psp.h | 3 +
11 files changed, 537 insertions(+), 30 deletions(-)
create mode 100644 backends/platform/psp/image_viewer.cpp
create mode 100644 backends/platform/psp/image_viewer.h
(limited to 'backends/platform')
diff --git a/backends/platform/psp/Makefile b/backends/platform/psp/Makefile
index 7f9ae153eb..8ddf58ad88 100644
--- a/backends/platform/psp/Makefile
+++ b/backends/platform/psp/Makefile
@@ -149,6 +149,7 @@ OBJS := powerman.o \
rtc.o \
mp3.o \
png_loader.o \
+ image_viewer.o \
tests.o
BACKEND := psp
diff --git a/backends/platform/psp/README.PSP b/backends/platform/psp/README.PSP
index 0849d68c78..b83f1cab6d 100644
--- a/backends/platform/psp/README.PSP
+++ b/backends/platform/psp/README.PSP
@@ -6,6 +6,7 @@ Installation
- Copy the relevant game datafiles to your memory stick (location doesn't matter).
- Install ScummVM like any other homebrew.
- Run ScummVM and use the launcher to add games and run them.
+ - Press Start to return to the launcher and play another game.
Controls
========
@@ -20,9 +21,10 @@ Cross - Left Mouse Button (usually the main button)
Circle - Right Mouse Button (secondary button in some games)
Square - '.' (skip dialogue in some games e.g. Scumm)
Right trigger + Square - Spacebar (useful in Gobli*ns and SCI games)
-Start - Global Menu. Allows you to 'Return To Launcher' to play another game
Right trigger + Start - F5 (Main Menu in some games)
Select - Show/Hide Virtual Keyboard. Hold down to move keyboard onscreen (with D-Pad).
+Right trigger + Select - Show Image Viewer (see below)
+Start - Global Menu. Allows you to 'Return To Launcher' to play another game
Virtual Keyboard Mode
=====================
@@ -37,6 +39,34 @@ Buttons/Triggers - Choose a specific character in the square. The four center c
Analog - Moves in a direction (left/right/up/down) (Useful to keep moving
while typing in AGI games among other things)
+
+Image Viewer
+============
+For your convenience, I've included a simple image viewer in the PSP port.
+You can view anything you want while playing a game.
+There are a few simple rules to follow:
+
+- Images must be of PNG format. If you have images in another format, many
+ graphics utilities will convert them for you.
+- Images must be named psp_image1.png, psp_image2.png etc. This is to make
+ sure there's no possible conflict between image files and game files.
+- Images must be placed in the game directories. When using the image viewer,
+ only the images of the particular game being played will be available for viewing.
+- Don't place any images in the ScummVM directory, or you won't be able to see
+ the images in the game directories.
+- There's no guarantee that you'll be able to view your image. This is because
+ big images take a lot of memory (more than the size of the image on disk). If there
+ isn't enough memory left to show the image, ScummVM will tell you so. Try to make the
+ image smaller by either shrinking it or reducing the colors to 256 color palette mode.
+
+Image Viewer Controls:
+=====================
+Left/Right - previous/next image (e.g. go from psp_image1.png to psp_image2.png)
+Up/down - zoom in/out
+Analog - move around the image
+Triggers, Start: - exit image viewer
+
+
1st Person Game Mode (Can be ignored by most users)
====================
This is a special mode built for 1st person games like Lands of Lore. If you don't have these games you can
@@ -49,9 +79,12 @@ Square - Is the modifier key instead of Right Trigger.
Left/Right Trigger - Strafe left/right
D-Pad Left/Right - Turn left/right
Square + D-Pad - F1/F2/F3/F4
+Square + Select - Image Viewer
Square + Start - Esc (shows game menu)
+
+
Notes
=====
- Notice that you can switch between games! This is much faster than quitting
diff --git a/backends/platform/psp/display_manager.cpp b/backends/platform/psp/display_manager.cpp
index 5d75ac531e..2c94882a63 100644
--- a/backends/platform/psp/display_manager.cpp
+++ b/backends/platform/psp/display_manager.cpp
@@ -34,6 +34,7 @@
#include "backends/platform/psp/default_display_client.h"
#include "backends/platform/psp/cursor.h"
#include "backends/platform/psp/pspkeyboard.h"
+#include "backends/platform/psp/image_viewer.h"
#define USE_DISPLAY_CALLBACK // to use callback for finishing the render
#include "backends/platform/psp/display_manager.h"
@@ -385,10 +386,12 @@ bool DisplayManager::renderAll() {
#endif /* USE_DISPLAY_CALLBACK */
// This is cheaper than checking time, so we do it first
+ // Any one of these being dirty causes everything to draw
if (!_screen->isDirty() &&
- (!_overlay->isDirty()) &&
- (!_cursor->isDirty()) &&
- (!_keyboard->isDirty())) {
+ !_overlay->isDirty() &&
+ !_cursor->isDirty() &&
+ !_keyboard->isDirty() &&
+ !_imageViewer->isDirty()) {
PSP_DEBUG_PRINT("Nothing dirty\n");
return true; // nothing to render
}
@@ -396,34 +399,35 @@ bool DisplayManager::renderAll() {
if (!isTimeToUpdate())
return false; // didn't render
- PSP_DEBUG_PRINT("screen[%s], overlay[%s], cursor[%s], keyboard[%s]\n",
+ PSP_DEBUG_PRINT("dirty: screen[%s], overlay[%s], cursor[%s], keyboard[%s], imageViewer[%s]\n",
_screen->isDirty() ? "true" : "false",
_overlay->isDirty() ? "true" : "false",
_cursor->isDirty() ? "true" : "false",
- _keyboard->isDirty() ? "true" : "false"
+ _keyboard->isDirty() ? "true" : "false",
+ _imageViewer->isDirty() ? "true" : "false",
);
_masterGuRenderer.guPreRender(); // Set up rendering
_screen->render();
-
_screen->setClean(); // clean out dirty bit
+
+ if (_imageViewer->isVisible())
+ _imageViewer->render();
+ _imageViewer->setClean();
if (_overlay->isVisible())
- _overlay->render();
-
+ _overlay->render();
_overlay->setClean();
if (_cursor->isVisible())
_cursor->render();
-
_cursor->setClean();
if (_keyboard->isVisible())
_keyboard->render();
-
_keyboard->setClean();
-
+
_masterGuRenderer.guPostRender();
return true; // rendered successfully
diff --git a/backends/platform/psp/display_manager.h b/backends/platform/psp/display_manager.h
index 00d3851243..4537af0096 100644
--- a/backends/platform/psp/display_manager.h
+++ b/backends/platform/psp/display_manager.h
@@ -96,6 +96,7 @@ class Screen;
class Overlay;
class Cursor;
class PSPKeyboard;
+class ImageViewer;
/**
* Class that manages all display clients
@@ -107,7 +108,8 @@ public:
KEEP_ASPECT_RATIO,
STRETCHED_FULL_SCREEN
};
- DisplayManager() : _screen(0), _cursor(0), _overlay(0), _keyboard(0), _lastUpdateTime(0), _graphicsMode(0) {}
+ DisplayManager() : _screen(0), _cursor(0), _overlay(0), _keyboard(0),
+ _imageViewer(0), _lastUpdateTime(0), _graphicsMode(0) {}
~DisplayManager();
void init();
@@ -118,11 +120,13 @@ public:
uint32 getDefaultGraphicsMode() const { return STRETCHED_FULL_SCREEN; }
const OSystem::GraphicsMode* getSupportedGraphicsModes() const { return _supportedModes; }
- // Setters
+ // Setters for pointers
void setScreen(Screen *screen) { _screen = screen; }
void setCursor(Cursor *cursor) { _cursor = cursor; }
void setOverlay(Overlay *overlay) { _overlay = overlay; }
void setKeyboard(PSPKeyboard *keyboard) { _keyboard = keyboard; }
+ void setImageViewer(ImageViewer *imageViewer) { _imageViewer = imageViewer; }
+
void setSizeAndPixelFormat(uint width, uint height, const Graphics::PixelFormat *format);
// Getters
@@ -148,6 +152,7 @@ private:
Cursor *_cursor;
Overlay *_overlay;
PSPKeyboard *_keyboard;
+ ImageViewer *_imageViewer;
MasterGuRenderer _masterGuRenderer;
uint32 _lastUpdateTime; // For limiting FPS
diff --git a/backends/platform/psp/image_viewer.cpp b/backends/platform/psp/image_viewer.cpp
new file mode 100644
index 0000000000..66a5412034
--- /dev/null
+++ b/backends/platform/psp/image_viewer.cpp
@@ -0,0 +1,280 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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.
+ *
+ * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.cpp $
+ * $Id: osys_psp.cpp 46126 2009-11-24 14:18:46Z fingolfin $
+ *
+ */
+
+#include "common/scummsys.h"
+#include "common/str.h"
+#include "common/stream.h"
+#include "common/archive.h"
+#include "common/ptr.h"
+#include "gui/message.h"
+#include "engines/engine.h"
+#include "backends/platform/psp/input.h"
+#include "backends/platform/psp/display_client.h"
+#include "backends/platform/psp/image_viewer.h"
+#include "backends/platform/psp/png_loader.h"
+
+static const char *imageName = "psp_image";
+#define PSP_SCREEN_HEIGHT 272
+#define PSP_SCREEN_WIDTH 480
+
+bool ImageViewer::load(int imageNum) {
+ if (_init)
+ unload();
+
+ // build string
+ char number[8];
+ sprintf(number, "%d", imageNum);
+ Common::String imageNameStr(imageName);
+ Common::String specificImageName = imageNameStr + Common::String(number) + Common::String(".png");
+
+ // search for image file
+ if (!SearchMan.hasFile(specificImageName)) {
+ PSP_ERROR("file %s not found\n", specificImageName.c_str());
+ return false;
+ }
+
+ Common::ScopedPtr file(SearchMan.createReadStreamForMember(specificImageName));
+
+ _buffer = new Buffer();
+ _palette = new Palette();
+ _renderer = new GuRenderer();
+
+ assert(_buffer);
+ assert(_palette);
+ assert(_renderer);
+
+ // Load a PNG into our buffer and palette. Size it by the actual size of the image
+ PngLoader image(file, *_buffer, *_palette, Buffer::kSizeBySourceSize);
+
+ PngLoader::Status status = image.allocate(); // allocate the buffers for the file
+
+ char error[100];
+ if (status == PngLoader::BAD_FILE) {
+ sprintf(error, "Cannot display %s. Not a proper PNG file", specificImageName.c_str());
+ GUI::TimedMessageDialog dialog(error, 4000);
+ dialog.runModal();
+ } else if (status == PngLoader::OUT_OF_MEMORY) {
+ sprintf(error, "Out of memory loading %s. Try making the image smaller", specificImageName.c_str());
+ GUI::TimedMessageDialog dialog(error, 4000);
+ dialog.runModal();
+ }
+ // try to load the image file
+ if (!image.load()) {
+ sprintf(error, "Cannot display %s. Not a proper PNG file", specificImageName.c_str());
+ GUI::TimedMessageDialog dialog(error, 4000);
+ dialog.runModal();
+ }
+
+ setConstantRendererOptions();
+ setFullScreenImageParams(); // prepare renderer for full screen view
+
+ _imageNum = imageNum; // now we can say we displayed this image
+ _init = true;
+
+ return true;
+}
+
+void ImageViewer::setConstantRendererOptions() {
+ _renderer->setBuffer(_buffer);
+ _renderer->setPalette(_palette);
+
+ _renderer->setAlphaBlending(false);
+ _renderer->setColorTest(false);
+ _renderer->setUseGlobalScaler(false);
+ _renderer->setStretch(true);
+ _renderer->setOffsetInBuffer(0, 0);
+ _renderer->setDrawWholeBuffer();
+}
+
+void ImageViewer::unload() {
+ delete _buffer;
+ delete _palette;
+ delete _renderer;
+ _buffer = 0;
+ _palette = 0;
+ _renderer = 0;
+ _init = false;
+}
+
+void ImageViewer::setVisible(bool visible) {
+ DEBUG_ENTER_FUNC();
+ if (_visible == visible)
+ return;
+
+ if (!g_engine) // we can only run the image viewer when there's an engine
+ return; // otherwise we won't know where to open the image
+
+ // from here on, we're making the loader visible
+ if (visible && load(_imageNum ? _imageNum : 1)) { // load the 1st image or the current
+ g_engine->pauseEngine(true);
+ _visible = true;
+ setDirty();
+ setViewerButtons(true);
+
+ GUI::TimedMessageDialog dialog("Image Viewer", 1000);
+ dialog.runModal();
+ } else { // all other cases
+ _visible = false;
+ setDirty();
+ unload();
+ setViewerButtons(false);
+
+ if (g_engine->isPaused())
+ g_engine->pauseEngine(false);
+ }
+}
+
+void ImageViewer::setViewerButtons(bool active) {
+ _inputHandler->setImageViewerMode(active);
+}
+
+void ImageViewer::loadNextImage() {
+ if (!load(_imageNum+1)) { // try to load the next image
+ if (!load(_imageNum)) // we failed, so reload the current image
+ setVisible(false); // just hide
+ }
+}
+
+void ImageViewer::loadLastImage() {
+ if (_imageNum - 1 > 0) {
+ if (!load(_imageNum-1))
+ if (!load(_imageNum))
+ setVisible(false); // we can't even show the old image so hide
+ }
+}
+
+void ImageViewer::setFullScreenImageParams() {
+ // we try to fit the image fullscreen at least in one dimension
+ uint32 width = _buffer->getSourceWidth();
+ uint32 height = _buffer->getSourceHeight();
+
+ _centerX = PSP_SCREEN_WIDTH / 2.0f;
+ _centerY = PSP_SCREEN_HEIGHT / 2.0f;
+
+ // see if we fit width wise
+ if (PSP_SCREEN_HEIGHT >= (int)((height * PSP_SCREEN_WIDTH) / (float)width)) {
+ setZoom(PSP_SCREEN_WIDTH / (float)width);
+ } else {
+ setZoom(PSP_SCREEN_HEIGHT / (float)height);
+ }
+}
+
+void ImageViewer::render() {
+ assert(_buffer);
+ assert(_renderer);
+
+ _renderer->render();
+}
+
+void ImageViewer::modifyZoom(bool up) {
+ float factor = _zoomFactor;
+ if (up)
+ factor += 0.1f;
+ else // down
+ factor -= 0.1f;
+
+ setZoom(factor);
+}
+
+void ImageViewer::setZoom(float value) {
+ if (value <= 0.0f) // don't want 0 or negative zoom
+ return;
+
+ _zoomFactor = value;
+ _renderer->setStretchXY(value, value);
+ setOffsetParams();
+}
+
+void ImageViewer::moveImageX(int val) {
+ float newVal = _centerX + val;
+
+ if (newVal < 0 || newVal > PSP_SCREEN_WIDTH)
+ return;
+ _centerX = newVal;
+ setOffsetParams();
+}
+
+void ImageViewer::moveImageY(int val) {
+ float newVal = _centerY + val;
+
+ if (newVal < 0 || newVal > PSP_SCREEN_HEIGHT)
+ return;
+ _centerY = newVal;
+ setOffsetParams();
+}
+
+// Set the renderer with the proper offset on the screen
+//
+void ImageViewer::setOffsetParams() {
+ _visibleWidth = _zoomFactor * _buffer->getSourceWidth();
+ _visibleHeight = _zoomFactor * _buffer->getSourceHeight();
+
+ int offsetX = _centerX - (int)(_visibleWidth * 0.5f);
+ int offsetY = _centerY - (int)(_visibleHeight * 0.5f);
+
+ _renderer->setOffsetOnScreen(offsetX, offsetY);
+}
+
+// Handler events coming in from the inputHandler
+//
+void ImageViewer::handleEvent(uint32 event) {
+ DEBUG_ENTER_FUNC();
+
+ switch (event) {
+ case EVENT_HIDE:
+ setVisible(false);
+ break;
+ case EVENT_SHOW:
+ setVisible(true);
+ break;
+ case EVENT_ZOOM_IN:
+ modifyZoom(true);
+ break;
+ case EVENT_ZOOM_OUT:
+ modifyZoom(false);
+ break;
+ case EVENT_MOVE_LEFT:
+ moveImageX(-5);
+ break;
+ case EVENT_MOVE_UP:
+ moveImageY(-5);
+ break;
+ case EVENT_MOVE_RIGHT:
+ moveImageX(5);
+ break;
+ case EVENT_MOVE_DOWN:
+ moveImageY(5);
+ break;
+ case EVENT_NEXT_IMAGE:
+ loadNextImage();
+ break;
+ case EVENT_LAST_IMAGE:
+ loadLastImage();
+ break;
+ default:
+ PSP_ERROR("Unknown event %d\n", event);
+ break;
+ }
+}
\ No newline at end of file
diff --git a/backends/platform/psp/image_viewer.h b/backends/platform/psp/image_viewer.h
new file mode 100644
index 0000000000..3e2630a97e
--- /dev/null
+++ b/backends/platform/psp/image_viewer.h
@@ -0,0 +1,92 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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.
+ *
+ * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.cpp $
+ * $Id: osys_psp.cpp 46126 2009-11-24 14:18:46Z fingolfin $
+ *
+ */
+
+#ifndef PSP_IMAGE_VIEWER_H
+#define PSP_IMAGE_VIEWER_H
+
+class InputHandler;
+
+class ImageViewer : public DisplayClient {
+private:
+ Buffer *_buffer;
+ Palette *_palette;
+ GuRenderer *_renderer;
+ bool _visible;
+ bool _dirty;
+ bool _init;
+ uint32 _imageNum; // current image number
+ float _zoomFactor; // how much we're zooming in/out on the image
+ float _visibleHeight, _visibleWidth;
+ float _centerX, _centerY;
+
+ InputHandler *_inputHandler;
+
+ void setFullScreenImageParams();
+ void loadNextImage();
+ void loadLastImage();
+ void setViewerButtons(bool active);
+ void setConstantRendererOptions();
+ void moveImageX(int val);
+ void moveImageY(int val);
+ bool load(int imageNum);
+ void unload();
+
+ void setZoom(float value);
+ void setOffsetParams();
+ void modifyZoom(bool up); // up or down
+ void setVisible(bool visible);
+
+public:
+ enum Events {
+ EVENT_HIDE = 0,
+ EVENT_SHOW = 1,
+ EVENT_ZOOM_IN,
+ EVENT_ZOOM_OUT,
+ EVENT_MOVE_LEFT,
+ EVENT_MOVE_UP,
+ EVENT_MOVE_RIGHT,
+ EVENT_MOVE_DOWN,
+ EVENT_NEXT_IMAGE,
+ EVENT_LAST_IMAGE,
+ };
+
+ ImageViewer() : _buffer(0), _palette(0), _visible(false), _dirty(false), _init(false), _imageNum(0),
+ _zoomFactor(0.0f), _visibleHeight(0.0f), _visibleWidth(0.0f),
+ _centerX(0.0f), _centerY(0.0f) {}
+ ~ImageViewer() { unload(); } // deallocate images
+ bool load();
+ void render();
+ bool isVisible() { return _visible; }
+ bool isDirty() { return _dirty; }
+ void setDirty() { _dirty = true; }
+ void setClean() { _dirty = false; }
+
+ void handleEvent(uint32 event);
+
+ // pointer setters
+ void setInputHandler(InputHandler *inputHandler) { _inputHandler = inputHandler; }
+};
+
+#endif /* PSP_IMAGE_VIEWER_H */
\ No newline at end of file
diff --git a/backends/platform/psp/input.cpp b/backends/platform/psp/input.cpp
index ed868ef375..ba599cdac2 100644
--- a/backends/platform/psp/input.cpp
+++ b/backends/platform/psp/input.cpp
@@ -95,7 +95,7 @@ const uint32 ButtonPad::_buttonMap[] = {
};
ButtonPad::ButtonPad() : _prevButtonState(0), _shifted(UNSHIFTED), _padMode(PAD_MODE_NORMAL),
- _comboMode(false) {
+ _comboMode(false), _combosEnabled(true) {
for (int i = UNSHIFTED; i < SHIFTED_MODE_LAST; i++)
_buttonsChanged[i] = 0;
clearButtons();
@@ -154,6 +154,7 @@ void ButtonPad::initButtonsNormalMode() {
_button[BTN_START][SHIFTED].setKey(Common::KEYCODE_F5, Common::ASCII_F5);
_button[BTN_START][UNSHIFTED].setKey(Common::KEYCODE_F5, Common::ASCII_F5, Common::KBD_CTRL);
_button[BTN_SELECT][UNSHIFTED].setPspEvent(PSP_EVENT_SHOW_VIRTUAL_KB, true, PSP_EVENT_NONE, 0);
+ _button[BTN_SELECT][SHIFTED].setPspEvent(PSP_EVENT_IMAGE_VIEWER, true, PSP_EVENT_NONE, 0);
}
void ButtonPad::initButtonsLolMode() {
@@ -199,7 +200,8 @@ bool ButtonPad::getEvent(Common::Event &event, PspEvent &pspEvent, SceCtrlData &
uint32 curButtonState = PSP_ALL_BUTTONS & pad.Buttons; // we only care about these
- modifyButtonsForCombos(pad); // change buttons for combos
+ if (_combosEnabled)
+ modifyButtonsForCombos(pad); // change buttons for combos
return getEventFromButtonState(event, pspEvent, curButtonState);
}
@@ -369,6 +371,7 @@ void InputHandler::init() {
sceCtrlSetSamplingMode(1); // analog
_buttonPad.initButtons();
+ _nub.init();
}
bool InputHandler::getAllInputs(Common::Event &event) {
@@ -460,6 +463,12 @@ bool InputHandler::handlePspEvent(Common::Event &event, PspEvent &pspEvent) {
/*case PSP_EVENT_CHANGE_SPEED:
handleSpeedChange(pspEvent.data);
break;*/
+ case PSP_EVENT_IMAGE_VIEWER:
+ _imageViewer->handleEvent(pspEvent.data);
+ break;
+ case PSP_EVENT_IMAGE_VIEWER_SET_BUTTONS:
+ setImageViewerMode(pspEvent.data);
+ break;
default:
PSP_ERROR("Unhandled PSP Event[%d]\n", pspEvent.type);
break;
@@ -509,3 +518,56 @@ void InputHandler::handleSpeedChange(bool up) {
GUI::TimedMessageDialog dialog(_padModeText[_padMode], 1500);
dialog.runModal();
}*/
+
+void InputHandler::setImageViewerMode(bool active) {
+ if (_buttonPad.isButtonDown() || _nub.isButtonDown()) { // can't switch yet
+ PSP_DEBUG_PRINT("postponing image viewer on event\n");
+ _pendingPspEvent.type = PSP_EVENT_IMAGE_VIEWER_SET_BUTTONS; // queue it to be done later
+ _pendingPspEvent.data = active;
+ } else if (active) {
+ _nub.setDpadMode(true);
+ _buttonPad.enableCombos(false); // disable combos
+ setButtonsForImageViewer();
+ } else { // deactivate
+ _nub.setDpadMode(false);
+ _nub.init();
+ _buttonPad.enableCombos(true); // re-enable combos
+ _buttonPad.initButtons();
+ }
+}
+
+void InputHandler::setButtonsForImageViewer() {
+ DEBUG_ENTER_FUNC();
+
+ // Dpad
+ _buttonPad.clearButtons();
+ _buttonPad.getButton(ButtonPad::BTN_UP, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_ZOOM_IN,
+ PSP_EVENT_NONE, false);
+ _buttonPad.getButton(ButtonPad::BTN_DOWN, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_ZOOM_OUT,
+ PSP_EVENT_NONE, false);
+ _buttonPad.getButton(ButtonPad::BTN_LEFT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_LAST_IMAGE,
+ PSP_EVENT_NONE, false);
+ _buttonPad.getButton(ButtonPad::BTN_RIGHT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_NEXT_IMAGE,
+ PSP_EVENT_NONE, false);
+ _buttonPad.getButton(ButtonPad::BTN_LTRIGGER, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
+ PSP_EVENT_NONE, false);
+ _buttonPad.getButton(ButtonPad::BTN_RTRIGGER, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
+ PSP_EVENT_NONE, false);
+ _buttonPad.getButton(ButtonPad::BTN_START, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
+ PSP_EVENT_NONE, false);
+ _buttonPad.getButton(ButtonPad::BTN_SELECT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
+ PSP_EVENT_NONE, false);
+
+ //Nub
+ _nub.getPad().clearButtons();
+ _nub.getPad().getButton(ButtonPad::BTN_UP, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_UP,
+ PSP_EVENT_NONE, false);
+ _nub.getPad().getButton(ButtonPad::BTN_DOWN, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_DOWN,
+ PSP_EVENT_NONE, false);
+ _nub.getPad().getButton(ButtonPad::BTN_LEFT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_LEFT,
+ PSP_EVENT_NONE, false);
+ _nub.getPad().getButton(ButtonPad::BTN_RIGHT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_RIGHT,
+ PSP_EVENT_NONE, false);
+}
+
+
diff --git a/backends/platform/psp/input.h b/backends/platform/psp/input.h
index acca04f376..9a1ab6faab 100644
--- a/backends/platform/psp/input.h
+++ b/backends/platform/psp/input.h
@@ -30,6 +30,7 @@
#include "common/events.h"
#include "backends/platform/psp/pspkeyboard.h"
#include "backends/platform/psp/cursor.h"
+#include "backends/platform/psp/image_viewer.h"
#include
enum PspEventType {
@@ -40,10 +41,11 @@ enum PspEventType {
PSP_EVENT_RBUTTON,
PSP_EVENT_MODE_SWITCH,
PSP_EVENT_CHANGE_SPEED,
+ PSP_EVENT_IMAGE_VIEWER,
+ PSP_EVENT_IMAGE_VIEWER_SET_BUTTONS,
PSP_EVENT_LAST
};
-
struct PspEvent {
PspEventType type;
uint32 data;
@@ -112,59 +114,77 @@ private:
ShiftMode _shifted;
PspPadMode _padMode;
bool _comboMode; // are we in the middle of combos
- static const uint32 _buttonMap[]; // maps the buttons to their values
+ bool _combosEnabled; // can we do combos
+ static const uint32 _buttonMap[]; // maps the buttons to their values
void initButtonsNormalMode();
void initButtonsLolMode();
void modifyButtonsForCombos(SceCtrlData &pad);
- void clearButtons();
public:
ButtonPad();
+ void initButtons(); // set the buttons to the mode that's selected
+ void clearButtons(); // empty the buttons of all events
+
bool getEvent(Common::Event &event, PspEvent &pspEvent, SceCtrlData &pad);
bool getEventFromButtonState(Common::Event &event, PspEvent &pspEvent, uint32 buttonState);
+
void setShifted(ShiftMode shifted) { _shifted = shifted; }
void setPadMode(PspPadMode mode) { _padMode = mode; }
bool isButtonDown() { return _prevButtonState; }
- void initButtons();
+
+ void enableCombos(bool value) { _combosEnabled = value; }
+ Button &getButton(ButtonType type, ShiftMode mode) { return _button[type][mode]; }
};
class Nub {
private:
Cursor *_cursor; // to enable changing/getting cursor position
- ButtonPad _buttonPad; // private buttonpad for dpad mode
ShiftMode _shifted;
bool _dpadMode;
-
+
+ ButtonPad _buttonPad; // private buttonpad for dpad mode
+
+ int32 modifyNubAxisMotion(int32 input);
+ void translateToDpadState(int dpadX, int dpadY, uint32 &buttonState); // convert nub data to dpad data
public:
- Nub() : _shifted(UNSHIFTED), _dpadMode(false) { _buttonPad.initButtons(); }
+ Nub() : _shifted(UNSHIFTED), _dpadMode(false) { }
+ void init() { _buttonPad.initButtons(); }
void setCursor(Cursor *cursor) { _cursor = cursor; }
+
+ // setters
void setDpadMode(bool active) { _dpadMode = active; }
void setShifted(ShiftMode shifted) { _shifted = shifted; }
- bool isButtonDown();
+ // getters
+ bool isButtonDown();
bool getEvent(Common::Event &event, PspEvent &pspEvent, SceCtrlData &pad);
- int32 modifyNubAxisMotion(int32 input);
- void translateToDpadState(int dpadX, int dpadY, uint32 &buttonState); // convert nub data to dpad data
+ ButtonPad &getPad() { return _buttonPad; }
};
class InputHandler {
public:
- InputHandler() : _keyboard(0), _cursor(0), _padMode(PAD_MODE_NORMAL), _lastPadCheckTime(0) {}
+ InputHandler() : _keyboard(0), _cursor(0), _imageViewer(0), _padMode(PAD_MODE_NORMAL),
+ _lastPadCheckTime(0) {}
+ // pointer setters
void setKeyboard(PSPKeyboard *keyboard) { _keyboard = keyboard; }
void setCursor(Cursor *cursor) { _cursor = cursor; _nub.setCursor(cursor); }
+ void setImageViewer(ImageViewer *imageViewer) { _imageViewer = imageViewer; }
void init();
bool getAllInputs(Common::Event &event);
+ void setImageViewerMode(bool active);
private:
+ Nub _nub;
+ ButtonPad _buttonPad;
+
+ // Pointers to relevant other classes
PSPKeyboard *_keyboard;
Cursor *_cursor;
-
- Nub _nub;
- ButtonPad _buttonPad;
+ ImageViewer *_imageViewer;
PspPadMode _padMode; // whice mode we're in
PspEvent _pendingPspEvent; // an event that can't be handled yet
@@ -176,6 +196,7 @@ private:
void handleMouseEvent(Common::Event &event, Common::EventType type, const char *string);
void handleShiftEvent(ShiftMode shifted);
void handleModeSwitchEvent();
+ void setButtonsForImageViewer();
};
#endif /* PSP_INPUT_H */
diff --git a/backends/platform/psp/module.mk b/backends/platform/psp/module.mk
index f96c4ef583..26887761c8 100644
--- a/backends/platform/psp/module.mk
+++ b/backends/platform/psp/module.mk
@@ -18,6 +18,7 @@ MODULE_OBJS := powerman.o \
rtc.o \
mp3.o \
png_loader.o \
+ image_viewer.o \
tests.o
# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp
index 047ec1957f..4b6983785c 100644
--- a/backends/platform/psp/osys_psp.cpp
+++ b/backends/platform/psp/osys_psp.cpp
@@ -76,12 +76,17 @@ void OSystem_PSP::initBackend() {
_displayManager.setScreen(&_screen);
_displayManager.setOverlay(&_overlay);
_displayManager.setKeyboard(&_keyboard);
+ _displayManager.setImageViewer(&_imageViewer);
_displayManager.init();
// Set pointers for input handler
_inputHandler.setCursor(&_cursor);
_inputHandler.setKeyboard(&_keyboard);
+ _inputHandler.setImageViewer(&_imageViewer);
_inputHandler.init();
+
+ // Set pointers for image viewer
+ _imageViewer.setInputHandler(&_inputHandler);
_savefile = new PSPSaveFileManager;
diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h
index 5721296c94..d59951c94c 100644
--- a/backends/platform/psp/osys_psp.h
+++ b/backends/platform/psp/osys_psp.h
@@ -32,10 +32,12 @@
#include "sound/mixer_intern.h"
#include "backends/base-backend.h"
#include "backends/fs/psp/psp-fs-factory.h"
+
#include "backends/platform/psp/display_client.h"
#include "backends/platform/psp/default_display_client.h"
#include "backends/platform/psp/cursor.h"
#include "backends/platform/psp/pspkeyboard.h"
+#include "backends/platform/psp/image_viewer.h"
#include "backends/platform/psp/display_manager.h"
#include "backends/platform/psp/input.h"
#include "backends/platform/psp/audio.h"
@@ -60,6 +62,7 @@ private:
InputHandler _inputHandler;
PspAudio _audio;
PspTimer _pspTimer;
+ ImageViewer _imageViewer;
public:
OSystem_PSP() : _savefile(0), _mixer(0), _timer(0), _pendingUpdate(false), _pendingUpdateCounter(0) {}
--
cgit v1.2.3
From a4537b84bd19ede43c4882012be4d52f6347c189 Mon Sep 17 00:00:00 2001
From: Yotam Barnoy
Date: Thu, 14 Oct 2010 22:11:17 +0000
Subject: PSP: made image viewer reset to the first image between engine loads
svn-id: r53460
---
backends/platform/psp/image_viewer.cpp | 4 ++++
backends/platform/psp/image_viewer.h | 1 +
backends/platform/psp/osys_psp.cpp | 6 ++++++
backends/platform/psp/osys_psp.h | 1 +
4 files changed, 12 insertions(+)
(limited to 'backends/platform')
diff --git a/backends/platform/psp/image_viewer.cpp b/backends/platform/psp/image_viewer.cpp
index 66a5412034..e3fb786774 100644
--- a/backends/platform/psp/image_viewer.cpp
+++ b/backends/platform/psp/image_viewer.cpp
@@ -118,6 +118,10 @@ void ImageViewer::unload() {
_init = false;
}
+void ImageViewer::resetOnEngineDone() {
+ _imageNum = 0;
+}
+
void ImageViewer::setVisible(bool visible) {
DEBUG_ENTER_FUNC();
if (_visible == visible)
diff --git a/backends/platform/psp/image_viewer.h b/backends/platform/psp/image_viewer.h
index 3e2630a97e..2242ab198a 100644
--- a/backends/platform/psp/image_viewer.h
+++ b/backends/platform/psp/image_viewer.h
@@ -82,6 +82,7 @@ public:
bool isDirty() { return _dirty; }
void setDirty() { _dirty = true; }
void setClean() { _dirty = false; }
+ void resetOnEngineDone();
void handleEvent(uint32 event);
diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp
index 4b6983785c..8b490217a4 100644
--- a/backends/platform/psp/osys_psp.cpp
+++ b/backends/platform/psp/osys_psp.cpp
@@ -102,6 +102,12 @@ void OSystem_PSP::initBackend() {
OSystem::initBackend();
}
+// Let's us know an engine
+void OSystem_PSP::engineDone() {
+ // for now, all we need is to reset the image number on the viewer
+ _imageViewer.resetOnEngineDone();
+}
+
bool OSystem_PSP::hasFeature(Feature f) {
return (f == kFeatureOverlaySupportsAlpha || f == kFeatureCursorHasPalette);
}
diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h
index d59951c94c..52b8f4e887 100644
--- a/backends/platform/psp/osys_psp.h
+++ b/backends/platform/psp/osys_psp.h
@@ -149,6 +149,7 @@ public:
Common::SaveFileManager *getSavefileManager() { return _savefile; }
FilesystemFactory *getFilesystemFactory() { return &PSPFilesystemFactory::instance(); }
void getTimeAndDate(TimeDate &t) const;
+ virtual void engineDone();
void quit();
--
cgit v1.2.3
From 6fc10aeeac5551d9402456e4f1e4df7c9bb2ab2c Mon Sep 17 00:00:00 2001
From: Yotam Barnoy
Date: Thu, 14 Oct 2010 22:33:32 +0000
Subject: PSP: made image in viewer movable by pushing nub continuously
svn-id: r53462
---
backends/platform/psp/image_viewer.cpp | 31 ++++++++++++++++++++-------
backends/platform/psp/image_viewer.h | 38 ++++++++++++++++++++--------------
backends/platform/psp/input.cpp | 8 +++----
3 files changed, 50 insertions(+), 27 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/psp/image_viewer.cpp b/backends/platform/psp/image_viewer.cpp
index e3fb786774..f3bcd988a2 100644
--- a/backends/platform/psp/image_viewer.cpp
+++ b/backends/platform/psp/image_viewer.cpp
@@ -159,6 +159,7 @@ void ImageViewer::loadNextImage() {
if (!load(_imageNum)) // we failed, so reload the current image
setVisible(false); // just hide
}
+ setDirty();
}
void ImageViewer::loadLastImage() {
@@ -167,6 +168,7 @@ void ImageViewer::loadLastImage() {
if (!load(_imageNum))
setVisible(false); // we can't even show the old image so hide
}
+ setDirty();
}
void ImageViewer::setFullScreenImageParams() {
@@ -188,7 +190,24 @@ void ImageViewer::setFullScreenImageParams() {
void ImageViewer::render() {
assert(_buffer);
assert(_renderer);
-
+
+ // move the image slightly. Note that we count on the renderer's timing
+ switch (_movement) {
+ case EVENT_MOVE_LEFT:
+ moveImageX(-2);
+ break;
+ case EVENT_MOVE_UP:
+ moveImageY(-2);
+ break;
+ case EVENT_MOVE_RIGHT:
+ moveImageX(2);
+ break;
+ case EVENT_MOVE_DOWN:
+ moveImageY(2);
+ break;
+ default:
+ break;
+ }
_renderer->render();
}
@@ -239,6 +258,7 @@ void ImageViewer::setOffsetParams() {
int offsetY = _centerY - (int)(_visibleHeight * 0.5f);
_renderer->setOffsetOnScreen(offsetX, offsetY);
+ setDirty();
}
// Handler events coming in from the inputHandler
@@ -260,16 +280,11 @@ void ImageViewer::handleEvent(uint32 event) {
modifyZoom(false);
break;
case EVENT_MOVE_LEFT:
- moveImageX(-5);
- break;
case EVENT_MOVE_UP:
- moveImageY(-5);
- break;
case EVENT_MOVE_RIGHT:
- moveImageX(5);
- break;
case EVENT_MOVE_DOWN:
- moveImageY(5);
+ case EVENT_MOVE_STOP:
+ _movement = (Event)event;
break;
case EVENT_NEXT_IMAGE:
loadNextImage();
diff --git a/backends/platform/psp/image_viewer.h b/backends/platform/psp/image_viewer.h
index 2242ab198a..0e24ea496d 100644
--- a/backends/platform/psp/image_viewer.h
+++ b/backends/platform/psp/image_viewer.h
@@ -29,6 +29,22 @@
class InputHandler;
class ImageViewer : public DisplayClient {
+public:
+ enum Event {
+ EVENT_NONE = -1,
+ EVENT_HIDE = 0,
+ EVENT_SHOW = 1,
+ EVENT_ZOOM_IN,
+ EVENT_ZOOM_OUT,
+ EVENT_MOVE_LEFT,
+ EVENT_MOVE_UP,
+ EVENT_MOVE_RIGHT,
+ EVENT_MOVE_DOWN,
+ EVENT_MOVE_STOP,
+ EVENT_NEXT_IMAGE,
+ EVENT_LAST_IMAGE,
+ };
+
private:
Buffer *_buffer;
Palette *_palette;
@@ -40,6 +56,7 @@ private:
float _zoomFactor; // how much we're zooming in/out on the image
float _visibleHeight, _visibleWidth;
float _centerX, _centerY;
+ Event _movement;
InputHandler *_inputHandler;
@@ -59,29 +76,20 @@ private:
void setVisible(bool visible);
public:
- enum Events {
- EVENT_HIDE = 0,
- EVENT_SHOW = 1,
- EVENT_ZOOM_IN,
- EVENT_ZOOM_OUT,
- EVENT_MOVE_LEFT,
- EVENT_MOVE_UP,
- EVENT_MOVE_RIGHT,
- EVENT_MOVE_DOWN,
- EVENT_NEXT_IMAGE,
- EVENT_LAST_IMAGE,
- };
- ImageViewer() : _buffer(0), _palette(0), _visible(false), _dirty(false), _init(false), _imageNum(0),
+ ImageViewer() : _buffer(0), _palette(0), _visible(false),
+ _dirty(false), _init(false), _imageNum(0),
_zoomFactor(0.0f), _visibleHeight(0.0f), _visibleWidth(0.0f),
- _centerX(0.0f), _centerY(0.0f) {}
+ _centerX(0.0f), _centerY(0.0f), _movement(EVENT_MOVE_STOP) {}
~ImageViewer() { unload(); } // deallocate images
bool load();
void render();
bool isVisible() { return _visible; }
bool isDirty() { return _dirty; }
void setDirty() { _dirty = true; }
- void setClean() { _dirty = false; }
+ void setClean() { if (_movement == EVENT_MOVE_STOP) // otherwise we want to keep rendering
+ _dirty = false;
+ }
void resetOnEngineDone();
void handleEvent(uint32 event);
diff --git a/backends/platform/psp/input.cpp b/backends/platform/psp/input.cpp
index ba599cdac2..0dad31e5ae 100644
--- a/backends/platform/psp/input.cpp
+++ b/backends/platform/psp/input.cpp
@@ -561,13 +561,13 @@ void InputHandler::setButtonsForImageViewer() {
//Nub
_nub.getPad().clearButtons();
_nub.getPad().getButton(ButtonPad::BTN_UP, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_UP,
- PSP_EVENT_NONE, false);
+ PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_STOP);
_nub.getPad().getButton(ButtonPad::BTN_DOWN, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_DOWN,
- PSP_EVENT_NONE, false);
+ PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_STOP);
_nub.getPad().getButton(ButtonPad::BTN_LEFT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_LEFT,
- PSP_EVENT_NONE, false);
+ PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_STOP);
_nub.getPad().getButton(ButtonPad::BTN_RIGHT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_RIGHT,
- PSP_EVENT_NONE, false);
+ PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_STOP);
}
--
cgit v1.2.3
From 00bf6ab791f89db92052c62186465daf33f15e05 Mon Sep 17 00:00:00 2001
From: Yotam Barnoy
Date: Tue, 19 Oct 2010 07:37:50 +0000
Subject: PSP: add missing return statements to image viewer
svn-id: r53601
---
backends/platform/psp/image_viewer.cpp | 3 +++
1 file changed, 3 insertions(+)
(limited to 'backends/platform')
diff --git a/backends/platform/psp/image_viewer.cpp b/backends/platform/psp/image_viewer.cpp
index f3bcd988a2..791a5cc0e3 100644
--- a/backends/platform/psp/image_viewer.cpp
+++ b/backends/platform/psp/image_viewer.cpp
@@ -75,16 +75,19 @@ bool ImageViewer::load(int imageNum) {
sprintf(error, "Cannot display %s. Not a proper PNG file", specificImageName.c_str());
GUI::TimedMessageDialog dialog(error, 4000);
dialog.runModal();
+ return false;
} else if (status == PngLoader::OUT_OF_MEMORY) {
sprintf(error, "Out of memory loading %s. Try making the image smaller", specificImageName.c_str());
GUI::TimedMessageDialog dialog(error, 4000);
dialog.runModal();
+ return false;
}
// try to load the image file
if (!image.load()) {
sprintf(error, "Cannot display %s. Not a proper PNG file", specificImageName.c_str());
GUI::TimedMessageDialog dialog(error, 4000);
dialog.runModal();
+ return false;
}
setConstantRendererOptions();
--
cgit v1.2.3
From d305587495c3d0329fab989e5d2fd2cf3379a636 Mon Sep 17 00:00:00 2001
From: Yotam Barnoy
Date: Wed, 20 Oct 2010 05:59:11 +0000
Subject: PSP: added dummy function to allow BS2.5 to build
svn-id: r53635
---
backends/platform/psp/Makefile | 5 ++--
backends/platform/psp/dummy.cpp | 59 +++++++++++++++++++++++++++++++++++++++++
backends/platform/psp/module.mk | 3 ++-
backends/platform/psp/psp.spec | 2 +-
4 files changed, 65 insertions(+), 4 deletions(-)
create mode 100644 backends/platform/psp/dummy.cpp
(limited to 'backends/platform')
diff --git a/backends/platform/psp/Makefile b/backends/platform/psp/Makefile
index 8ddf58ad88..a104e3297a 100644
--- a/backends/platform/psp/Makefile
+++ b/backends/platform/psp/Makefile
@@ -126,7 +126,7 @@ endif
# PSP LIBS
PSPLIBS = -lpspprof -lpspvfpu -lpspdebug -lpspgu -lpspge -lpspdisplay -lpspctrl -lpspsdk \
-lpsputility -lpspuser -lpsppower -lpsphprm -lpspsdk -lpsprtc -lpspaudio -lpspaudiocodec \
- -lpspkernel
+ -lpspkernel -lpspnet_inet
# Add in PSPSDK includes and libraries.
LIBS += -lpng -lz -lstdc++ -lc -lm $(PSPLIBS)
@@ -150,7 +150,8 @@ OBJS := powerman.o \
mp3.o \
png_loader.o \
image_viewer.o \
- tests.o
+ tests.o \
+ dummy.o
BACKEND := psp
diff --git a/backends/platform/psp/dummy.cpp b/backends/platform/psp/dummy.cpp
new file mode 100644
index 0000000000..4236734d4b
--- /dev/null
+++ b/backends/platform/psp/dummy.cpp
@@ -0,0 +1,59 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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.
+ *
+ * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.cpp $
+ * $Id: osys_psp.cpp 46126 2009-11-24 14:18:46Z fingolfin $
+ *
+ */
+
+ //#include "common/scummsys.h"
+ #include
+ #include
+ #include
+ #include
+ #include
+
+//void userWriteFn(png_structp png_ptr, png_bytep data, png_size_t length) {
+//}
+
+//void userFlushFn(png_structp png_ptr) {
+//}
+
+ // Dummy functions are pulled in so that we don't need to build the plugins with certain libs
+
+ int dummyFunc() {
+
+ // For Broken Sword 2.5
+ volatile int i;
+ i = clock();
+ rename("dummyA", "dummyB");
+
+ png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+ png_set_write_fn(png_ptr, NULL, NULL, NULL);
+ png_infop info_ptr;
+ png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);
+ png_destroy_write_struct(&png_ptr, &info_ptr);
+
+ // For lua's usage of libc: very heavy usage so it pulls in sockets?
+ setsockopt(0, 0, 0, NULL, 0);
+ getsockopt(0, 0, 0, NULL, NULL);
+
+ return i;
+}
\ No newline at end of file
diff --git a/backends/platform/psp/module.mk b/backends/platform/psp/module.mk
index 26887761c8..cdd0fa0ef5 100644
--- a/backends/platform/psp/module.mk
+++ b/backends/platform/psp/module.mk
@@ -19,7 +19,8 @@ MODULE_OBJS := powerman.o \
mp3.o \
png_loader.o \
image_viewer.o \
- tests.o
+ tests.o \
+ dummy.o
# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
diff --git a/backends/platform/psp/psp.spec b/backends/platform/psp/psp.spec
index ac325b7fd6..7177413373 100644
--- a/backends/platform/psp/psp.spec
+++ b/backends/platform/psp/psp.spec
@@ -1,3 +1,3 @@
%rename lib old_lib
*lib:
-%(old_lib) -lz -lstdc++ -lc -lm -lpspprof -lpspvfpu -lpspdebug -lpspgu -lpspge -lpspdisplay -lpspctrl -lpspsdk -lpsputility -lpspuser -lpsppower -lpsphprm -lpsprtc -lpspaudio -lpspaudiocodec -lpspkernel
+%(old_lib) -lz -lstdc++ -lc -lm -lpspprof -lpspvfpu -lpspdebug -lpspgu -lpspge -lpspdisplay -lpspctrl -lpspsdk -lpsputility -lpspuser -lpsppower -lpsphprm -lpsprtc -lpspaudio -lpspaudiocodec -lpspkernel -lpspnet_inet
--
cgit v1.2.3
From 4e936522eeb0de8092ad74e8522b885550d934cb Mon Sep 17 00:00:00 2001
From: John Willis
Date: Wed, 20 Oct 2010 13:00:58 +0000
Subject: GPH: Cleanup Readme and support scripts.
GP2X: Cleanup Readme.
SDL: Change a few backend defines to GPH_DEVICE from the device name (blocking main and loadGFXMode so they can be written elsewhere).
svn-id: r53639
---
backends/platform/gp2x/build/README-GP2X | 144 ++-------------------------
backends/platform/gp2x/build/config.sh | 3 +-
backends/platform/gp2x/build/scummvm.gpe | 2 +-
backends/platform/gp2x/gp2x.cpp | 4 +-
backends/platform/gph/build/config-alleng.sh | 9 +-
backends/platform/gph/build/config.sh | 9 +-
backends/platform/gph/build/scummvm-gdb.gpe | 2 +-
backends/platform/gph/build/scummvm.gpe | 2 +-
backends/platform/gph/caanoo-bundle.mk | 4 +-
backends/platform/gph/caanoo/scummvm-gdb.gpe | 2 +-
backends/platform/gph/caanoo/scummvm.gpe | 2 +-
backends/platform/gph/gp2xwiz-bundle.mk | 4 +-
backends/platform/gph/gph-events.cpp | 1 -
backends/platform/gph/gph-main.cpp | 8 +-
backends/platform/sdl/graphics.cpp | 2 +-
backends/platform/sdl/main.cpp | 2 +-
16 files changed, 41 insertions(+), 159 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/gp2x/build/README-GP2X b/backends/platform/gp2x/build/README-GP2X
index dc93a9f1c9..3c6591d369 100644
--- a/backends/platform/gp2x/build/README-GP2X
+++ b/backends/platform/gp2x/build/README-GP2X
@@ -1,19 +1,10 @@
-ScummVM - GP2X SPECIFIC README - HEAD SVN
+ScummVM - GP2X SPECIFIC README
------------------------------------------------------------------------
Contents:
* About the backend/port <#About_the_backendport>
- * Game compatability <#Game_compatibility>
- * Included engines <#Included_engines>
* Supported audio options <#Supported_audio_options>
- * Supported cut-scene options <#Supported_cut-scene_options>
- * Recent changes <#Recent_changes>
- * How to save <#How_to_save>
- * Controller mappings <#Controller_mappings>
- * Know issues <#Know_issues>
- * TODO's <#Major_TODOs>
- * Additional resources/links <#Additional_resourceslinks>
* Credits <#Credits>
------------------------------------------------------------------------
@@ -26,47 +17,24 @@ WiKi:
for the most current information on the port and any updates to this
documentation.
+The wiki includes detailed instructions on how to use the port and
+control information.
+
------------------------------------------------------------------------
About the backend/port
-This is the readme for the offficial GP2X ScummVM backend (also known as
+This is the readme for the official GP2X ScummVM backend (also known as
the GP2X port).
This is an SVN test release of ScummVM for the GP2X, it would be
appreciated if this SVN test distribution was not mirrored and that
-people be directed to http://www.distant-earth.com/scummvm instead for
+people be directed to http://scummvm.distant-earth.com/ instead for
updated SVN builds.
Full supported official releases of the GP2X ScummVM backend are made in
line with main official releases and are avalalble from the ScummVM
downloads page .
-This build is in an active state of development and as such no
-?expected? behavior can be guaranteed ;).
-
-SVN builds are quickly tested with firmware 2.0.0 for reference.
-
-Please refer to the GP2X ScummVM forum
- and WiKi
- for the latest information on
-the port.
-
-------------------------------------------------------------------------
-Game compatibility
-
-For information on the compatability of a specific game please refer to
-the GP2X compatability section of the ScummVM WiKi
-.
-
-Please note the version and date of the ScummVM build you are running
-when reviewing the above list.
-
-------------------------------------------------------------------------
-Included engines
-
-Just because an engine is included does not mean any/all of its games
-are supported. Please check game compatability for more infomation.
-
------------------------------------------------------------------------
Supported audio options
@@ -78,106 +46,6 @@ FLAC audio is currently unsupported.
For best results use uncompressed audio in games.
-------------------------------------------------------------------------
-Supported cut-scene options
-
-No cut scene compression options are currently supported.
-
-DXA video support will be added as soon as it is stable.
-
-------------------------------------------------------------------------
-Recent changes
-
-Refined audio hacks to reduce audio delay a little more.
-Enabled hardware scalar code.
-Now built using SDL 1.2.9 for the parts of the port that use SDL (some
-parts now hit the hardware directly).
-Enabled new launcher - (Ensure defaulttheme.zip is in the same folder as
-the executable).
-Aspect Ratio Correction can now be disabled ?per game?. When adding a
-game you can find this option on the GFX tab.
-Note: This will cause the game to run with a black border at the bottom
-as it will be rendered to a 320*200 frame.
-
-------------------------------------------------------------------------
-How to save
-
-NOTE: Everything is saved to the SD card, saves are stored in the saves
-folder under your main ScummVM executable unless you set another save
-location.
-
-The configiration file for ScummVM (.scummvmrc) is stored in the same
-place as the ScummVM executable.
-
-The save process below is for Scumm engine games but the principle is
-the same for all.
-
-In Game.
-
-1. Right Trigger
-2. Select SAVE with B
-3. Select a position with B
-4. Right trigger puts ? in the name box for some text.
-5. Press B to save
-
-Basically the emulated keys you can use are equivelent to the values
-buttons are mapped to,
-
-I have a virtual keyboard like the GP32 one (left/right on the stick to
-pick chars) to add in at some point ;-)
-
-------------------------------------------------------------------------
-Controller mappings
-
-Mouse emulation:
-
-Stick: Move Pointer
-Stick Click: ?light? Left Click
-B: Left click
-X: Right click
-
-Keyboard emulation:
-
-Start: Return
-Select: Escape
-Y: Space Bar (Pause)
-Right Trigger: Game Menu (Save, Load, Quit etc.)
-Volume Buttons: Increase and Decrease volume (5% per press)
-
-Fancy button combos:
-
-NOTE: To use button combos press and hold the Left Trigger then...
-
-Y: Toggle "zoom" mode - Try it in larger games like Broken Sword.
-Volume Buttons: Increase and Decrease subtitle speed (In SCUMM games)
-Right Trigger: 0 (For skipping the copy protection in Monkey Island 2)
-Select: Exit ScummVM completely (and gracefully)
-
-------------------------------------------------------------------------
-Know issues
-
-Possible random crash (well SegFault). I have had this happen twice and
-have not tracked down the cause.
-It happens very infrequently, both times it was in the DOTT CD intro.
-Saving often is never a bad idea anyhow.
-
-------------------------------------------------------------------------
-TODO's
-
-Fix save support when using the Sky engine (Beneath a Steel Sky) - You
-CAN'T save at the moment but auto save works.
-
-------------------------------------------------------------------------
-Additional resources/links
-
- * ScummVM WiKi GP2X page
- * ScummVM forums GP2X forum
-
- * My own ScummVM page (for
- SVN/test builds)
- * Main ScummVM site (for official supported
- release builds)
-
------------------------------------------------------------------------
Credits
diff --git a/backends/platform/gp2x/build/config.sh b/backends/platform/gp2x/build/config.sh
index 2bc49564f7..e0a1bf1209 100755
--- a/backends/platform/gp2x/build/config.sh
+++ b/backends/platform/gp2x/build/config.sh
@@ -18,6 +18,7 @@ export DEFINES=-DNDEBUG
# Edit the configure line to suit.
cd ../../../..
./configure --backend=gp2x --disable-mt32emu --host=gp2x --disable-flac --disable-nasm --disable-hq-scalers --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-vkeybd
-#--enable-plugins --default-dynamic
+# --disable-release --enable-debug
+# --enable-plugins --default-dynamic
echo Generating config for GP2X complete. Check for errors.
diff --git a/backends/platform/gp2x/build/scummvm.gpe b/backends/platform/gp2x/build/scummvm.gpe
index 1e69c149b9..c6b051831c 100755
--- a/backends/platform/gp2x/build/scummvm.gpe
+++ b/backends/platform/gp2x/build/scummvm.gpe
@@ -4,7 +4,7 @@
mount -o sync,remount /dev/mmcsd/disc0/part1 /mnt/sd/
# Run ScummVM, important this bit.
-./scummvm.gp2x
+./scummvm.gph
# Sync the SD card to check that everything is written.
sync
diff --git a/backends/platform/gp2x/gp2x.cpp b/backends/platform/gp2x/gp2x.cpp
index 5bd106e72c..88d4f9d632 100644
--- a/backends/platform/gp2x/gp2x.cpp
+++ b/backends/platform/gp2x/gp2x.cpp
@@ -115,7 +115,7 @@ void OSystem_GP2X::initBackend() {
char workDirName[PATH_MAX+1];
if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Could not obtain current working directory");
+ error("Could not obtain current working directory.");
} else {
printf("Current working directory: %s\n", workDirName);
}
@@ -328,7 +328,7 @@ void OSystem_GP2X::addSysArchivesToSearchSet(Common::SearchSet &s, int priority)
char workDirName[PATH_MAX+1];
if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Error: Could not obtain current working directory");
+ error("Error: Could not obtain current working directory.");
}
Common::FSNode workdirNode(workDirName);
diff --git a/backends/platform/gph/build/config-alleng.sh b/backends/platform/gph/build/config-alleng.sh
index cfed463edf..9ec8a09cd2 100755
--- a/backends/platform/gph/build/config-alleng.sh
+++ b/backends/platform/gph/build/config-alleng.sh
@@ -13,10 +13,15 @@ export CXX=arm-open2x-linux-g++
export CXXFLAGS="-mcpu=arm926ej-s -mtune=arm926ej-s"
export CPPFLAGS=-I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include
export LDFLAGS=-L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib
-export DEFINES=-DNDEBUG
# Edit the configure line to suit.
cd ../../../..
-./configure --backend=gp2xwiz --disable-mt32emu --host=gp2xwiz --disable-flac --disable-nasm --disable-hq-scalers --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-all-engines --enable-vkeybd --enable-plugins --default-dynamic
+./configure --backend=gph --disable-mt32emu --host=gp2xwiz --disable-flac --disable-nasm --disable-hq-scalers \
+ --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
+ --enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
+ --enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
+ --enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
+ --enable-png --with-png-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
+ --enable-vkeybd --enable-all-engines --enable-plugins --default-dynamic
echo Generating config for GP2X Wiz complete. Check for errors.
diff --git a/backends/platform/gph/build/config.sh b/backends/platform/gph/build/config.sh
index 25c3a83da0..ac7c34ad12 100755
--- a/backends/platform/gph/build/config.sh
+++ b/backends/platform/gph/build/config.sh
@@ -13,10 +13,15 @@ export CXX=arm-open2x-linux-g++
export CXXFLAGS="-mcpu=arm926ej-s -mtune=arm926ej-s"
export CPPFLAGS=-I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include
export LDFLAGS=-L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib
-export DEFINES=-DNDEBUG
# Edit the configure line to suit.
cd ../../../..
-./configure --backend=gp2xwiz --disable-mt32emu --host=gp2xwiz --disable-flac --disable-nasm --disable-hq-scalers --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-vkeybd --enable-plugins --default-dynamic
+./configure --backend=gph --disable-mt32emu --host=gp2xwiz --disable-flac --disable-nasm --disable-hq-scalers \
+ --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
+ --enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
+ --enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
+ --enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
+ --enable-png --with-png-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
+ --enable-vkeybd --enable-plugins --default-dynamic
echo Generating config for GP2X Wiz complete. Check for errors.
diff --git a/backends/platform/gph/build/scummvm-gdb.gpe b/backends/platform/gph/build/scummvm-gdb.gpe
index f486c288ee..63ce193ca8 100755
--- a/backends/platform/gph/build/scummvm-gdb.gpe
+++ b/backends/platform/gph/build/scummvm-gdb.gpe
@@ -6,7 +6,7 @@ export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH
# Run ScummVM via GDB (so make sure you have a terminal open or serial).
# Oh, and GDB installed of course ;)
-gdb --args ./scummvm.wiz --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
+gdb --args ./scummvm.gph --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
# Sync the SD card to check that everything is written.
sync
diff --git a/backends/platform/gph/build/scummvm.gpe b/backends/platform/gph/build/scummvm.gpe
index 2866825e91..59ff562aeb 100755
--- a/backends/platform/gph/build/scummvm.gpe
+++ b/backends/platform/gph/build/scummvm.gpe
@@ -5,7 +5,7 @@
export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH
# Run ScummVM, important this bit.
-./scummvm.wiz --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
+./scummvm.gph --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
# Sync the SD card to check that everything is written.
sync
diff --git a/backends/platform/gph/caanoo-bundle.mk b/backends/platform/gph/caanoo-bundle.mk
index c411310688..b7b3c9e188 100755
--- a/backends/platform/gph/caanoo-bundle.mk
+++ b/backends/platform/gph/caanoo-bundle.mk
@@ -17,7 +17,7 @@ caanoo-bundle: $(EXECUTABLE)
$(CP) $(srcdir)/backends/platform/gph/caanoo/scummvm.gpe $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gph/build/scummvm.png $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gph/build/scummvmb.png $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/build/README-GP2XWIZ $(bundle_name)/scummvm/README-CAANOO
+ $(CP) $(srcdir)/backends/platform/gph/build/README-GPH $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gph/build/scummvm.ini $(bundle_name)/
$(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
@@ -48,7 +48,7 @@ caanoo-bundle-debug: $(EXECUTABLE)
$(CP) $(srcdir)/backends/platform/gph/caanoo/scummvm-gdb.gpe $(bundle_name)/scummvm/scummvm.gpe
$(CP) $(srcdir)/backends/platform/gph/build/scummvm.png $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gph/build/scummvmb.png $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/build/README-GP2XWIZ $(bundle_name)/scummvm/README-CAANOO
+ $(CP) $(srcdir)/backends/platform/gph/build/README-GPH $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gph/build/scummvm.ini $(bundle_name)/
$(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
diff --git a/backends/platform/gph/caanoo/scummvm-gdb.gpe b/backends/platform/gph/caanoo/scummvm-gdb.gpe
index 2d776f1bc3..63ce193ca8 100755
--- a/backends/platform/gph/caanoo/scummvm-gdb.gpe
+++ b/backends/platform/gph/caanoo/scummvm-gdb.gpe
@@ -6,7 +6,7 @@ export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH
# Run ScummVM via GDB (so make sure you have a terminal open or serial).
# Oh, and GDB installed of course ;)
-gdb --args ./scummvm.caanoo --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
+gdb --args ./scummvm.gph --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
# Sync the SD card to check that everything is written.
sync
diff --git a/backends/platform/gph/caanoo/scummvm.gpe b/backends/platform/gph/caanoo/scummvm.gpe
index 52bb7a98cd..37d0f65d18 100755
--- a/backends/platform/gph/caanoo/scummvm.gpe
+++ b/backends/platform/gph/caanoo/scummvm.gpe
@@ -5,7 +5,7 @@
export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH
# Run ScummVM, important this bit.
-./scummvm.caanoo --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
+./scummvm.gph --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
# Sync the SD card to check that everything is written.
sync
diff --git a/backends/platform/gph/gp2xwiz-bundle.mk b/backends/platform/gph/gp2xwiz-bundle.mk
index 5ca6c0a9c7..df4cae7f4f 100755
--- a/backends/platform/gph/gp2xwiz-bundle.mk
+++ b/backends/platform/gph/gp2xwiz-bundle.mk
@@ -17,7 +17,7 @@ gp2xwiz-bundle: $(EXECUTABLE)
$(CP) $(srcdir)/backends/platform/gph/build/scummvm.gpe $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gph/build/scummvm.png $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gph/build/scummvmb.png $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/build/README-GP2XWIZ $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/build/README-GPH $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gph/build/scummvm.ini $(bundle_name)/
$(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
@@ -51,7 +51,7 @@ gp2xwiz-bundle-debug: $(EXECUTABLE)
$(CP) $(srcdir)/backends/platform/gph/build/scummvm-gdb.gpe $(bundle_name)/scummvm/scummvm.gpe
$(CP) $(srcdir)/backends/platform/gph/build/scummvm.png $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gph/build/scummvmb.png $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/build/README-GP2XWIZ $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/build/README-GPH $(bundle_name)/scummvm/
$(CP) $(srcdir)/backends/platform/gph/build/scummvm.ini $(bundle_name)/
$(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
diff --git a/backends/platform/gph/gph-events.cpp b/backends/platform/gph/gph-events.cpp
index 91ea30bdc9..2a6237c794 100644
--- a/backends/platform/gph/gph-events.cpp
+++ b/backends/platform/gph/gph-events.cpp
@@ -253,7 +253,6 @@ bool OSystem_GPH::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
event.type = Common::EVENT_MOUSEMOVE;
else
event.type = Common::EVENT_LBUTTONUP; /* For normal mice etc. */
-
}
else if (ev.button.button == SDL_BUTTON_RIGHT)
event.type = Common::EVENT_RBUTTONUP;
diff --git a/backends/platform/gph/gph-main.cpp b/backends/platform/gph/gph-main.cpp
index 727d599cc8..71f9f77bfc 100644
--- a/backends/platform/gph/gph-main.cpp
+++ b/backends/platform/gph/gph-main.cpp
@@ -26,6 +26,7 @@
#include "common/scummsys.h"
#include
+// #include "backends/platform/gph/gph-options.h"
#include "backends/platform/gph/gph-sdl.h"
#include "backends/platform/gph/gph-hw.h"
#include "backends/plugins/posix/posix-provider.h"
@@ -78,7 +79,7 @@ void OSystem_GPH::initBackend() {
char workDirName[PATH_MAX+1];
if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Could not obtain current working directory");
+ error("Could not obtain current working directory.");
} else {
printf("Current working directory: %s\n", workDirName);
}
@@ -158,6 +159,9 @@ void OSystem_GPH::initBackend() {
/* Make sure SDL knows that we have a joystick we want to use. */
ConfMan.setInt("joystick_num", 0);
+ /* Now setup any device specific user options (Left handed mode, that sort of thing). */
+ // GPH::setOptions();
+
printf("%s\n", "Passing to OSystem::SDL initBackend.");
/* Pass to SDL backend to do the heavy lifting */
@@ -170,7 +174,7 @@ void OSystem_GPH::addSysArchivesToSearchSet(Common::SearchSet &s, int priority)
char workDirName[PATH_MAX+1];
if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Error: Could not obtain current working directory");
+ error("Error: Could not obtain current working directory.");
}
Common::FSNode workdirNode(workDirName);
diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp
index 6ee10119cc..df63c3a7d6 100644
--- a/backends/platform/sdl/graphics.cpp
+++ b/backends/platform/sdl/graphics.cpp
@@ -539,7 +539,7 @@ bool OSystem_SDL::loadGFXMode() {
assert(_inited);
_forceFull = true;
-#if !defined(__MAEMO__) && !defined(GP2XWIZ) && !defined(LINUXMOTO) && !defined(DINGUX) && !defined(OPENPANDORA)
+#if !defined(__MAEMO__) && !defined(DINGUX) && !defined(GPH_DEVICE) && !defined(LINUXMOTO) && !defined(OPENPANDORA)
_videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
_videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
diff --git a/backends/platform/sdl/main.cpp b/backends/platform/sdl/main.cpp
index c27ccc09d4..60bf59689c 100644
--- a/backends/platform/sdl/main.cpp
+++ b/backends/platform/sdl/main.cpp
@@ -38,7 +38,7 @@
// Several SDL based ports use a custom main, and hence do not want to compile
// of this file. The following "#if" ensures that.
-#if !defined(__MAEMO__) && !defined(_WIN32_WCE) && !defined(CAANOO) && !defined(GP2XWIZ) && !defined(LINUXMOTO) && !defined(OPENPANDORA) && !defined(__SYMBIAN32__) && !defined(DINGUX)
+#if !defined(__MAEMO__) && !defined(__SYMBIAN32__) && !defined(_WIN32_WCE) && !defined(DINGUX) && !defined(GPH_DEVICE) && !defined(LINUXMOTO) && !defined(OPENPANDORA)
#include "backends/platform/sdl/sdl.h"
--
cgit v1.2.3
From 33038a2d58c7c919c66f714277d2e239e6a015d9 Mon Sep 17 00:00:00 2001
From: John Willis
Date: Wed, 20 Oct 2010 13:07:52 +0000
Subject: OPENPANDORA: Clean up support scripts and README.
svn-id: r53641
---
backends/platform/gph/caanoo/config-alleng.sh | 17 +++++++++++------
backends/platform/gph/caanoo/config.sh | 13 +++++++++----
backends/platform/openpandora/build/README-OPENPANDORA | 2 +-
backends/platform/openpandora/build/config-alleng.sh | 9 ++++++++-
backends/platform/openpandora/build/config.sh | 9 ++++++++-
5 files changed, 37 insertions(+), 13 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/gph/caanoo/config-alleng.sh b/backends/platform/gph/caanoo/config-alleng.sh
index 7a097c268b..97fed942fa 100755
--- a/backends/platform/gph/caanoo/config-alleng.sh
+++ b/backends/platform/gph/caanoo/config-alleng.sh
@@ -3,14 +3,19 @@
echo Quick script to make running configure all the time less painful
echo and let all the build work be done from the backend/build folder.
-# Assume Caanoo toolchain/build env.
+# Assume Caanoo toolchain/build env and source it.
. /opt/arm-caanoo/environment-setup
-# Export the tool names for cross-compiling
-export DEFINES=-DNDEBUG
-
# Edit the configure line to suit.
cd ../../../..
-./configure --backend=caanoo --disable-mt32emu --host=caanoo --disable-alsa --disable-flac --disable-nasm --disable-vorbis --disable-hq-scalers --with-sdl-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/bin --with-mpeg2-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --enable-tremor --with-tremor-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --enable-zlib --with-zlib-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --enable-mad --with-mad-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr --enable-all-engines --enable-vkeybd --enable-plugins --default-dynamic
+./configure --backend=caanoo --disable-mt32emu --host=caanoo --disable-alsa --disable-flac \
+ --disable-nasm --disable-vorbis --disable-hq-scalers \
+ --with-sdl-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr/bin \
+ --with-mpeg2-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
+ --enable-tremor --with-tremor-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
+ --enable-zlib --with-zlib-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
+ --enable-mad --with-mad-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
+ --enable-png --with-png-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
+ --enable-all-engines --enable-vkeybd --enable-plugins --default-dynamic
-echo Generating config for GP2X Caanoo complete. Check for errors.
+echo Generating config for Caanoo complete. Check for errors.
diff --git a/backends/platform/gph/caanoo/config.sh b/backends/platform/gph/caanoo/config.sh
index 82e3774dbf..11d597481a 100755
--- a/backends/platform/gph/caanoo/config.sh
+++ b/backends/platform/gph/caanoo/config.sh
@@ -6,11 +6,16 @@ echo and let all the build work be done from the backend/build folder.
# Assume Caanoo toolchain/build env.
. /opt/arm-caanoo/environment-setup
-# Export the tool names for cross-compiling
-export DEFINES=-DNDEBUG
-
# Edit the configure line to suit.
cd ../../../..
-./configure --backend=caanoo --disable-mt32emu --host=caanoo --disable-alsa --disable-flac --disable-nasm --disable-vorbis --disable-hq-scalers --with-sdl-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr/bin --with-mpeg2-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr --enable-tremor --with-tremor-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr --enable-zlib --with-zlib-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr --enable-mad --with-mad-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr --enable-vkeybd --enable-plugins --default-dynamic
+./configure --backend=caanoo --disable-mt32emu --host=caanoo --disable-alsa --disable-flac \
+ --disable-nasm --disable-vorbis --disable-hq-scalers \
+ --with-sdl-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr/bin \
+ --with-mpeg2-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
+ --enable-tremor --with-tremor-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
+ --enable-zlib --with-zlib-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
+ --enable-mad --with-mad-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
+ --enable-png --with-png-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
+ --enable-vkeybd --enable-plugins --default-dynamic
echo Generating config for GP2X Caanoo complete. Check for errors.
diff --git a/backends/platform/openpandora/build/README-OPENPANDORA b/backends/platform/openpandora/build/README-OPENPANDORA
index c3aa5e8ea9..c8aabcbb7a 100755
--- a/backends/platform/openpandora/build/README-OPENPANDORA
+++ b/backends/platform/openpandora/build/README-OPENPANDORA
@@ -1,4 +1,4 @@
-ScummVM - OPENPANDORA SPECIFIC README - HEAD SVN
+ScummVM - OPENPANDORA SPECIFIC README
------------------------------------------------------------------------
Please refer to the:
diff --git a/backends/platform/openpandora/build/config-alleng.sh b/backends/platform/openpandora/build/config-alleng.sh
index cd9a17ef40..f3fa1a0f94 100755
--- a/backends/platform/openpandora/build/config-alleng.sh
+++ b/backends/platform/openpandora/build/config-alleng.sh
@@ -17,6 +17,13 @@ export DEFINES=-DNDEBUG
# Edit the configure line to suit.
cd ../../../..
-./configure --backend=openpandora --host=openpandora --disable-nasm --with-sdl-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/bin --with-mpeg2-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --disable-vorbis --enable-tremor --with-tremor-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --enable-zlib --with-zlib-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --enable-mad --with-mad-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --enable-all-engines --enable-plugins --default-dynamic
+./configure --backend=openpandora --host=openpandora --disable-nasm \
+ --with-sdl-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/bin \
+ --with-mpeg2-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
+ --disable-vorbis --enable-tremor --with-tremor-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
+ --enable-zlib --with-zlib-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
+ --enable-mad --with-mad-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
+ --enable-png --with-png-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
+ --enable-all-engines --enable-plugins --default-dynamic
echo Generating config for OpenPandora complete. Check for errors.
diff --git a/backends/platform/openpandora/build/config.sh b/backends/platform/openpandora/build/config.sh
index 8be16f1317..9bc52a9bc4 100755
--- a/backends/platform/openpandora/build/config.sh
+++ b/backends/platform/openpandora/build/config.sh
@@ -17,6 +17,13 @@ export DEFINES=-DNDEBUG
# Edit the configure line to suit.
cd ../../../..
-./configure --backend=openpandora --host=openpandora --disable-nasm --with-sdl-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/bin --with-mpeg2-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --disable-vorbis --enable-tremor --with-tremor-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --enable-zlib --with-zlib-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --enable-mad --with-mad-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr --enable-plugins --default-dynamic
+./configure --backend=openpandora --host=openpandora --disable-nasm \
+ --with-sdl-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/bin \
+ --with-mpeg2-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
+ --disable-vorbis --enable-tremor --with-tremor-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
+ --enable-zlib --with-zlib-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
+ --enable-mad --with-mad-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
+ --enable-png --with-png-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
+ --enable-plugins --default-dynamic
echo Generating config for OpenPandora complete. Check for errors.
--
cgit v1.2.3
From 8ae4926da21c17943fb9621a02a3913a82a2a8f3 Mon Sep 17 00:00:00 2001
From: Julien Templier
Date: Thu, 21 Oct 2010 03:41:44 +0000
Subject: GPH: Rename README (package build step uses the README-GPH name)
svn-id: r53661
---
backends/platform/gph/build/README-GP2XWIZ | 140 -----------------------------
backends/platform/gph/build/README-GPH | 140 +++++++++++++++++++++++++++++
2 files changed, 140 insertions(+), 140 deletions(-)
delete mode 100644 backends/platform/gph/build/README-GP2XWIZ
create mode 100644 backends/platform/gph/build/README-GPH
(limited to 'backends/platform')
diff --git a/backends/platform/gph/build/README-GP2XWIZ b/backends/platform/gph/build/README-GP2XWIZ
deleted file mode 100644
index 269fa901c9..0000000000
--- a/backends/platform/gph/build/README-GP2XWIZ
+++ /dev/null
@@ -1,140 +0,0 @@
-ScummVM - GP2X WIZ SPECIFIC README - HEAD SVN
-------------------------------------------------------------------------
-
-Contents:
-
- * About the backend/port <#About_the_backendport>
- * Game compatability <#Game_compatibility>
- * Included engines <#Included_engines>
- * Supported audio options <#Supported_audio_options>
- * Supported cut-scene options <#Supported_cut-scene_options>
- * Recent changes <#Recent_changes>
- * How to save <#How_to_save>
- * Controller mappings <#Controller_mappings>
- * Known issues <#Knonw_issues>
- * Additional resources/links <#Additional_resourceslinks>
- * Credits <#Credits>
-
-------------------------------------------------------------------------
-
-Please refer to the:
-
-GP2X/GP2XWiz ScummVM Forum:
-WiKi:
-
-for the most current information on the port and any updates to this
-documentation.
-
-------------------------------------------------------------------------
-About the backend/port
-
-This is the readme for the official GP2XWiz ScummVM backend (also known as
-the GP2XWiz port).
-
-This is an SVN test release of ScummVM for the GP2XWiz, it would be
-appreciated if this SVN test distribution was not mirrored and that
-people be directed to http://scummvm.distant-earth.com/ instead for
-updated SVN builds.
-
-Full supported official releases of the GP2X WIZ ScummVM backend are made in
-line with main official releases and are avalalble from the ScummVM
-downloads page .
-
-This build is in an active state of development and as such no
-"expected" behavior can be guaranteed ;).
-
-------------------------------------------------------------------------
-Game compatibility
-
-For information on the compatability of a specific game please refer to
-the GP2XWiz compatability section of the ScummVM WiKi
-.
-
-Please note the version and date of the ScummVM build you are running
-when reviewing the above list.
-
-------------------------------------------------------------------------
-Supported audio options
-
-Raw audio.
-MP3 audio.
-OGG Vorbis audio.
-
-FLAC audio is currently unsupported.
-
-For best results use uncompressed audio in games.
-
-------------------------------------------------------------------------
-How to save
-
-NOTE: Everything is saved to the SD card, saves are stored in the saves
-folder under your main ScummVM executable unless you set another save
-location.
-
-The configiration file for ScummVM (.scummvmrc) is stored in the same
-place as the ScummVM executable.
-
-The save process below is for Scumm engine games but the principle is
-the same for all.
-
-In Game.
-
-1. Menu Button
-2. Select SAVE with B
-3. Select a position with B
-4. Right trigger puts 0 in the name box for some text.
-5. Press B to save
-
-Basically the emulated keys you can use are equivelent to the values
-buttons are mapped to,
-
-------------------------------------------------------------------------
-Controller mappings
-
-Touch screen:
-Touch: Move Pointer and Left click
-
-Mouse emulation:
-
-dPad: Move Pointer
-B: Left click
-X: Right click
-
-Keyboard emulation:
-
-Right Trigger: Return
-Select: Escape
-Y: Space Bar (Pause)
-Menu: Game Menu (Save, Load, Quit etc.)
-Volume Buttons: Increase and Decrease volume
-
-Fancy button combos:
-
-NOTE: To use button combos press and hold the Left Trigger then...
-
-Right Trigger: Display Virtual Keyboard
-Menu: Bring up the Global main menu for ScummVM
-Select: Exit ScummVM completely (and gracefully)
-
-------------------------------------------------------------------------
-Known issues
-
-No major known issues
-
-------------------------------------------------------------------------
-Additional resources/links
-
- * ScummVM WiKi GP2X page
- * ScummVM forums GP2X forum
-
- * My own ScummVM page (for
- SVN/test builds)
- * Main ScummVM site (for official supported
- release builds)
-
-------------------------------------------------------------------------
-Credits
-
-Core ScummVM code (c) The ScummVM Team
-GP2X Wiz backend (c) John Willis
-Detailed (c) information can be found within the source code
diff --git a/backends/platform/gph/build/README-GPH b/backends/platform/gph/build/README-GPH
new file mode 100644
index 0000000000..269fa901c9
--- /dev/null
+++ b/backends/platform/gph/build/README-GPH
@@ -0,0 +1,140 @@
+ScummVM - GP2X WIZ SPECIFIC README - HEAD SVN
+------------------------------------------------------------------------
+
+Contents:
+
+ * About the backend/port <#About_the_backendport>
+ * Game compatability <#Game_compatibility>
+ * Included engines <#Included_engines>
+ * Supported audio options <#Supported_audio_options>
+ * Supported cut-scene options <#Supported_cut-scene_options>
+ * Recent changes <#Recent_changes>
+ * How to save <#How_to_save>
+ * Controller mappings <#Controller_mappings>
+ * Known issues <#Knonw_issues>
+ * Additional resources/links <#Additional_resourceslinks>
+ * Credits <#Credits>
+
+------------------------------------------------------------------------
+
+Please refer to the:
+
+GP2X/GP2XWiz ScummVM Forum:
+WiKi:
+
+for the most current information on the port and any updates to this
+documentation.
+
+------------------------------------------------------------------------
+About the backend/port
+
+This is the readme for the official GP2XWiz ScummVM backend (also known as
+the GP2XWiz port).
+
+This is an SVN test release of ScummVM for the GP2XWiz, it would be
+appreciated if this SVN test distribution was not mirrored and that
+people be directed to http://scummvm.distant-earth.com/ instead for
+updated SVN builds.
+
+Full supported official releases of the GP2X WIZ ScummVM backend are made in
+line with main official releases and are avalalble from the ScummVM
+downloads page .
+
+This build is in an active state of development and as such no
+"expected" behavior can be guaranteed ;).
+
+------------------------------------------------------------------------
+Game compatibility
+
+For information on the compatability of a specific game please refer to
+the GP2XWiz compatability section of the ScummVM WiKi
+.
+
+Please note the version and date of the ScummVM build you are running
+when reviewing the above list.
+
+------------------------------------------------------------------------
+Supported audio options
+
+Raw audio.
+MP3 audio.
+OGG Vorbis audio.
+
+FLAC audio is currently unsupported.
+
+For best results use uncompressed audio in games.
+
+------------------------------------------------------------------------
+How to save
+
+NOTE: Everything is saved to the SD card, saves are stored in the saves
+folder under your main ScummVM executable unless you set another save
+location.
+
+The configiration file for ScummVM (.scummvmrc) is stored in the same
+place as the ScummVM executable.
+
+The save process below is for Scumm engine games but the principle is
+the same for all.
+
+In Game.
+
+1. Menu Button
+2. Select SAVE with B
+3. Select a position with B
+4. Right trigger puts 0 in the name box for some text.
+5. Press B to save
+
+Basically the emulated keys you can use are equivelent to the values
+buttons are mapped to,
+
+------------------------------------------------------------------------
+Controller mappings
+
+Touch screen:
+Touch: Move Pointer and Left click
+
+Mouse emulation:
+
+dPad: Move Pointer
+B: Left click
+X: Right click
+
+Keyboard emulation:
+
+Right Trigger: Return
+Select: Escape
+Y: Space Bar (Pause)
+Menu: Game Menu (Save, Load, Quit etc.)
+Volume Buttons: Increase and Decrease volume
+
+Fancy button combos:
+
+NOTE: To use button combos press and hold the Left Trigger then...
+
+Right Trigger: Display Virtual Keyboard
+Menu: Bring up the Global main menu for ScummVM
+Select: Exit ScummVM completely (and gracefully)
+
+------------------------------------------------------------------------
+Known issues
+
+No major known issues
+
+------------------------------------------------------------------------
+Additional resources/links
+
+ * ScummVM WiKi GP2X page
+ * ScummVM forums GP2X forum
+
+ * My own ScummVM page (for
+ SVN/test builds)
+ * Main ScummVM site (for official supported
+ release builds)
+
+------------------------------------------------------------------------
+Credits
+
+Core ScummVM code (c) The ScummVM Team
+GP2X Wiz backend (c) John Willis
+Detailed (c) information can be found within the source code
--
cgit v1.2.3
From d602e4a785df248140d088fa691fb525d603d76e Mon Sep 17 00:00:00 2001
From: Joost Peters
Date: Sat, 23 Oct 2010 03:09:39 +0000
Subject: PSP: make vkbd's function keys match their visual representation
svn-id: r53728
---
backends/platform/psp/pspkeyboard.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/psp/pspkeyboard.cpp b/backends/platform/psp/pspkeyboard.cpp
index 3dd5e9789b..b758109285 100644
--- a/backends/platform/psp/pspkeyboard.cpp
+++ b/backends/platform/psp/pspkeyboard.cpp
@@ -78,9 +78,9 @@ short PSPKeyboard::_modeChar[MODE_COUNT][5][6] = {
},
{ //numbers
{ K('1'), K('2'), K('3'), K('4'), K(0), K(0) },
- { C(F5), C(F8), C(F7), C(F6), C(F9), C(F10) },
+ { C(F5), C(F6), C(F7), C(F8), C(F9), C(F10) },
{ K('5'), K('6'), K('7'), K('8'), K(0), K(0) },
- { C(F1), C(F4), C(F3), C(F2), K(0), K(0) },
+ { C(F1), C(F2), C(F3), C(F4), K(0), K(0) },
{ K('\b'), K('0'), K(' '), K('9'), K(0), K(0) }
},
{ //symbols
--
cgit v1.2.3
From 4af9057eaa3e69b6575415359537d91d6bc0cfb9 Mon Sep 17 00:00:00 2001
From: Yotam Barnoy
Date: Sat, 23 Oct 2010 19:01:34 +0000
Subject: PSP: Fix up imageViewer to pause game
The only real way to pause the game is to take over the event loop, which is a little sad... Also fixed a possible crash when loading an image that was to big, by only rendering when we have _init set.
svn-id: r53741
---
backends/platform/psp/image_viewer.cpp | 80 +++++++++++++++++++++-------------
backends/platform/psp/image_viewer.h | 8 +++-
backends/platform/psp/osys_psp.cpp | 1 +
3 files changed, 57 insertions(+), 32 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/psp/image_viewer.cpp b/backends/platform/psp/image_viewer.cpp
index 791a5cc0e3..dbcafd3898 100644
--- a/backends/platform/psp/image_viewer.cpp
+++ b/backends/platform/psp/image_viewer.cpp
@@ -27,13 +27,16 @@
#include "common/str.h"
#include "common/stream.h"
#include "common/archive.h"
+#include "common/events.h"
#include "common/ptr.h"
#include "gui/message.h"
#include "engines/engine.h"
#include "backends/platform/psp/input.h"
+#include "backends/platform/psp/display_manager.h"
#include "backends/platform/psp/display_client.h"
#include "backends/platform/psp/image_viewer.h"
#include "backends/platform/psp/png_loader.h"
+#include "backends/platform/psp/thread.h"
static const char *imageName = "psp_image";
#define PSP_SCREEN_HEIGHT 272
@@ -112,13 +115,13 @@ void ImageViewer::setConstantRendererOptions() {
}
void ImageViewer::unload() {
+ _init = false;
delete _buffer;
delete _palette;
delete _renderer;
_buffer = 0;
_palette = 0;
_renderer = 0;
- _init = false;
}
void ImageViewer::resetOnEngineDone() {
@@ -127,30 +130,45 @@ void ImageViewer::resetOnEngineDone() {
void ImageViewer::setVisible(bool visible) {
DEBUG_ENTER_FUNC();
+
if (_visible == visible)
return;
-
- if (!g_engine) // we can only run the image viewer when there's an engine
- return; // otherwise we won't know where to open the image
// from here on, we're making the loader visible
- if (visible && load(_imageNum ? _imageNum : 1)) { // load the 1st image or the current
- g_engine->pauseEngine(true);
+ if (visible && g_engine) { // we can only run the image viewer when there's an engine
+ g_engine->pauseEngine(true);
+
+ load(_imageNum ? _imageNum : 1); // load the 1st image or the current
+ }
+
+ if (visible && _init) { // we managed to load
_visible = true;
- setDirty();
setViewerButtons(true);
GUI::TimedMessageDialog dialog("Image Viewer", 1000);
dialog.runModal();
- } else { // all other cases
+
+ runLoop(); // only listen to viewer events
+ } else { // we were asked to make invisible or failed to load
_visible = false;
- setDirty();
unload();
setViewerButtons(false);
- if (g_engine->isPaused())
+ if (g_engine && g_engine->isPaused())
g_engine->pauseEngine(false);
}
+ setDirty();
+}
+
+// This is the only way we can truly pause the games
+// Sad but true.
+void ImageViewer::runLoop() {
+ while (_visible) {
+ Common::Event event;
+ PspThread::delayMillis(30);
+ _inputHandler->getAllInputs(event);
+ _displayManager->renderAll();
+ }
}
void ImageViewer::setViewerButtons(bool active) {
@@ -191,27 +209,29 @@ void ImageViewer::setFullScreenImageParams() {
}
void ImageViewer::render() {
- assert(_buffer);
- assert(_renderer);
+ if (_init) {
+ assert(_buffer);
+ assert(_renderer);
- // move the image slightly. Note that we count on the renderer's timing
- switch (_movement) {
- case EVENT_MOVE_LEFT:
- moveImageX(-2);
- break;
- case EVENT_MOVE_UP:
- moveImageY(-2);
- break;
- case EVENT_MOVE_RIGHT:
- moveImageX(2);
- break;
- case EVENT_MOVE_DOWN:
- moveImageY(2);
- break;
- default:
- break;
- }
- _renderer->render();
+ // move the image slightly. Note that we count on the renderer's timing
+ switch (_movement) {
+ case EVENT_MOVE_LEFT:
+ moveImageX(-2);
+ break;
+ case EVENT_MOVE_UP:
+ moveImageY(-2);
+ break;
+ case EVENT_MOVE_RIGHT:
+ moveImageX(2);
+ break;
+ case EVENT_MOVE_DOWN:
+ moveImageY(2);
+ break;
+ default:
+ break;
+ }
+ _renderer->render();
+ }
}
void ImageViewer::modifyZoom(bool up) {
diff --git a/backends/platform/psp/image_viewer.h b/backends/platform/psp/image_viewer.h
index 0e24ea496d..1946b0ffe2 100644
--- a/backends/platform/psp/image_viewer.h
+++ b/backends/platform/psp/image_viewer.h
@@ -59,6 +59,7 @@ private:
Event _movement;
InputHandler *_inputHandler;
+ DisplayManager *_displayManager;
void setFullScreenImageParams();
void loadNextImage();
@@ -69,6 +70,7 @@ private:
void moveImageY(int val);
bool load(int imageNum);
void unload();
+ void runLoop(); // to get total pausing we have to do our own loop
void setZoom(float value);
void setOffsetParams();
@@ -80,14 +82,15 @@ public:
ImageViewer() : _buffer(0), _palette(0), _visible(false),
_dirty(false), _init(false), _imageNum(0),
_zoomFactor(0.0f), _visibleHeight(0.0f), _visibleWidth(0.0f),
- _centerX(0.0f), _centerY(0.0f), _movement(EVENT_MOVE_STOP) {}
+ _centerX(0.0f), _centerY(0.0f), _movement(EVENT_MOVE_STOP),
+ _inputHandler(0), _displayManager(0) {}
~ImageViewer() { unload(); } // deallocate images
bool load();
void render();
bool isVisible() { return _visible; }
bool isDirty() { return _dirty; }
void setDirty() { _dirty = true; }
- void setClean() { if (_movement == EVENT_MOVE_STOP) // otherwise we want to keep rendering
+ void setClean() { if (!_visible) // otherwise we want to keep rendering
_dirty = false;
}
void resetOnEngineDone();
@@ -96,6 +99,7 @@ public:
// pointer setters
void setInputHandler(InputHandler *inputHandler) { _inputHandler = inputHandler; }
+ void setDisplayManager(DisplayManager *displayManager) { _displayManager = displayManager; }
};
#endif /* PSP_IMAGE_VIEWER_H */
\ No newline at end of file
diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp
index 8b490217a4..40c074ae00 100644
--- a/backends/platform/psp/osys_psp.cpp
+++ b/backends/platform/psp/osys_psp.cpp
@@ -87,6 +87,7 @@ void OSystem_PSP::initBackend() {
// Set pointers for image viewer
_imageViewer.setInputHandler(&_inputHandler);
+ _imageViewer.setDisplayManager(&_displayManager);
_savefile = new PSPSaveFileManager;
--
cgit v1.2.3
From c9c9eafbbb791d1b754c053aac221979a39216e1 Mon Sep 17 00:00:00 2001
From: Martin Kiewitz
Date: Sun, 24 Oct 2010 18:34:08 +0000
Subject: SDL/w32: add ability to hide console
feature is currently commented out - waiting till discussion has ended
svn-id: r53767
---
backends/platform/sdl/sdl.cpp | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
(limited to 'backends/platform')
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 22fc561b0f..21c2c50d79 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -116,6 +116,26 @@ static AspectRatio getDesiredAspectRatio() {
}
#endif
+#if defined(WIN32)
+ struct SdlConsoleHidingWin32 {
+ DWORD myPid;
+ DWORD myTid;
+ HWND consoleHandle;
+ };
+
+ // console hiding for win32
+ static BOOL CALLBACK initBackendFindConsoleWin32Proc(HWND hWnd, LPARAM lParam) {
+ DWORD pid, tid;
+ SdlConsoleHidingWin32 *variables = (SdlConsoleHidingWin32 *)lParam;
+ tid = GetWindowThreadProcessId(hWnd, &pid);
+ if ((tid == variables->myTid) && (pid == variables->myPid)) {
+ variables->consoleHandle = hWnd;
+ return FALSE;
+ }
+ return TRUE;
+ }
+#endif
+
void OSystem_SDL::initBackend() {
assert(!_inited);
@@ -135,6 +155,25 @@ void OSystem_SDL::initBackend() {
if (joystick_num > -1)
sdlFlags |= SDL_INIT_JOYSTICK;
+#if 0
+ // NEW CODE TO HIDE CONSOLE FOR WIN32
+#if defined(WIN32)
+ // console hiding for win32
+ SdlConsoleHidingWin32 consoleHidingWin32;
+ consoleHidingWin32.consoleHandle = 0;
+ consoleHidingWin32.myPid = GetCurrentProcessId();
+ consoleHidingWin32.myTid = GetCurrentThreadId();
+ EnumWindows (initBackendFindConsoleWin32Proc, (LPARAM)&consoleHidingWin32);
+
+ if (!ConfMan.getBool("show_console")) {
+ if (consoleHidingWin32.consoleHandle) {
+ // We won't find a window with our TID/PID in case we were started from command-line
+ ShowWindow(consoleHidingWin32.consoleHandle, SW_HIDE);
+ }
+ }
+#endif
+#endif
+
if (SDL_Init(sdlFlags) == -1) {
error("Could not initialize SDL: %s", SDL_GetError());
}
--
cgit v1.2.3
From 27ee12e6a596dc585622e0cee5a27f906503df70 Mon Sep 17 00:00:00 2001
From: Martin Kiewitz
Date: Sun, 24 Oct 2010 19:04:35 +0000
Subject: SDL/win32: fix lf, thx msvc
svn-id: r53768
---
backends/platform/sdl/sdl.cpp | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 21c2c50d79..83393c225a 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -124,16 +124,16 @@ static AspectRatio getDesiredAspectRatio() {
};
// console hiding for win32
- static BOOL CALLBACK initBackendFindConsoleWin32Proc(HWND hWnd, LPARAM lParam) {
- DWORD pid, tid;
- SdlConsoleHidingWin32 *variables = (SdlConsoleHidingWin32 *)lParam;
- tid = GetWindowThreadProcessId(hWnd, &pid);
- if ((tid == variables->myTid) && (pid == variables->myPid)) {
- variables->consoleHandle = hWnd;
- return FALSE;
- }
- return TRUE;
- }
+ static BOOL CALLBACK initBackendFindConsoleWin32Proc(HWND hWnd, LPARAM lParam) {
+ DWORD pid, tid;
+ SdlConsoleHidingWin32 *variables = (SdlConsoleHidingWin32 *)lParam;
+ tid = GetWindowThreadProcessId(hWnd, &pid);
+ if ((tid == variables->myTid) && (pid == variables->myPid)) {
+ variables->consoleHandle = hWnd;
+ return FALSE;
+ }
+ return TRUE;
+ }
#endif
void OSystem_SDL::initBackend() {
@@ -161,8 +161,8 @@ void OSystem_SDL::initBackend() {
// console hiding for win32
SdlConsoleHidingWin32 consoleHidingWin32;
consoleHidingWin32.consoleHandle = 0;
- consoleHidingWin32.myPid = GetCurrentProcessId();
- consoleHidingWin32.myTid = GetCurrentThreadId();
+ consoleHidingWin32.myPid = GetCurrentProcessId();
+ consoleHidingWin32.myTid = GetCurrentThreadId();
EnumWindows (initBackendFindConsoleWin32Proc, (LPARAM)&consoleHidingWin32);
if (!ConfMan.getBool("show_console")) {
--
cgit v1.2.3
From 2bf64b10506a97a7e9342e5d97ad89bd33628a53 Mon Sep 17 00:00:00 2001
From: Angus Lees
Date: Mon, 25 Oct 2010 07:27:05 +0000
Subject: ANDROID: Force extra screen update when updating overlay.
This appears to work around a blank screen bug Nexus1. I never
tracked it down, but as far as I can tell it is triggered by multiple
overlapping updates before flushing the texture to screen. This
condition only happens in the overlay atm so an extra redraw isn't the
end of the world.
(Also remove an unused _full_screen_dirty property)
svn-id: r53801
---
backends/platform/android/android.cpp | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index dcc4e37458..38f387b201 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -109,7 +109,7 @@ static void JNU_ThrowByName(JNIEnv* env, const char* name, const char* msg) {
env->DeleteLocalRef(cls);
}
-// floating point. use sparingly.
+// floating point. use sparingly.
template
static inline T scalef(T in, float numerator, float denominator) {
return static_cast(in) * numerator / denominator;
@@ -177,7 +177,6 @@ private:
GLESPaletteTexture* _game_texture;
int _shake_offset;
Common::Rect _focus_rect;
- bool _full_screen_dirty;
// Overlay layer
GLES4444Texture* _overlay_texture;
@@ -320,7 +319,6 @@ OSystem_Android::OSystem_Android(jobject am)
_fsFactory(new POSIXFilesystemFactory()),
_asset_archive(new AndroidAssetArchive(am)),
_shake_offset(0),
- _full_screen_dirty(false),
_event_queue_lock(createMutex()) {
}
@@ -862,6 +860,9 @@ void OSystem_Android::hideOverlay() {
void OSystem_Android::clearOverlay() {
ENTER("clearOverlay()");
_overlay_texture->fillBuffer(0);
+
+ // Shouldn't need this, but works around a 'blank screen' bug on Nexus1
+ updateScreen();
}
void OSystem_Android::grabOverlay(OverlayColor *buf, int pitch) {
@@ -887,6 +888,9 @@ void OSystem_Android::copyRectToOverlay(const OverlayColor *buf, int pitch,
// This 'pitch' is pixels not bytes
_overlay_texture->updateBuffer(x, y, w, h, buf, pitch * sizeof(buf[0]));
+
+ // Shouldn't need this, but works around a 'blank screen' bug on Nexus1?
+ updateScreen();
}
int16 OSystem_Android::getOverlayHeight() {
--
cgit v1.2.3
From 7d0598d81025793dd078722a68b429a7e807c8a8 Mon Sep 17 00:00:00 2001
From: Angus Lees
Date: Mon, 25 Oct 2010 07:35:40 +0000
Subject: ANDROID: Provide an alternate partial texture update for stride !=
width
The new one copies into a temp buffer and only does one
glTexSubImage2D. I'm led to believe that this is faster on some
devices (but slower on others). Disabled for now, but someone might
want to try both versions on their slow device.
Also manually set glColor before calling DrawTexiOES, following
mention of a bug in a discussion I stumbled across. DrawTexiOES-use
is disabled for now, so this is a noop.
svn-id: r53803
---
backends/platform/android/video.cpp | 40 +++++++++++++++++++++++++++----------
1 file changed, 30 insertions(+), 10 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/android/video.cpp b/backends/platform/android/video.cpp
index d4c002fbd0..81a8f7fbc7 100644
--- a/backends/platform/android/video.cpp
+++ b/backends/platform/android/video.cpp
@@ -38,6 +38,9 @@
#include "backends/platform/android/video.h"
+// Unfortunately, Android devices are too varied to make broad assumptions :/
+#define TEXSUBIMAGE_IS_EXPENSIVE 0
+
#undef LOG_TAG
#define LOG_TAG "ScummVM-video"
@@ -158,13 +161,11 @@ void GLESTexture::allocBuffer(GLuint w, GLuint h) {
// later (perhaps with multiple TexSubImage2D operations).
CHECK_GL_ERROR();
glBindTexture(GL_TEXTURE_2D, _texture_name);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
CHECK_GL_ERROR();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- CHECK_GL_ERROR();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- CHECK_GL_ERROR();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- CHECK_GL_ERROR();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
CHECK_GL_ERROR();
glTexImage2D(GL_TEXTURE_2D, 0, glFormat(),
@@ -177,6 +178,7 @@ void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h,
const void* buf, int pitch) {
ENTER("updateBuffer(%u, %u, %u, %u, %p, %d)", x, y, w, h, buf, pitch);
glBindTexture(GL_TEXTURE_2D, _texture_name);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
setDirtyRect(Common::Rect(x, y, x+w, y+h));
@@ -185,7 +187,25 @@ void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h,
glFormat(), glType(), buf);
} else {
// GLES removed the ability to specify pitch, so we
- // have to do this row by row.
+ // have to do this ourselves.
+ if (h == 0)
+ return;
+
+#if TEXSUBIMAGE_IS_EXPENSIVE
+ byte tmpbuf[w * h * bytesPerPixel()];
+ const byte* src = static_cast(buf);
+ byte* dst = tmpbuf;
+ GLuint count = h;
+ do {
+ memcpy(dst, src, w * bytesPerPixel());
+ dst += w * bytesPerPixel();
+ src += pitch;
+ } while (--count);
+ glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h,
+ glFormat(), glType(), tmpbuf);
+#else
+ // This version avoids the intermediate copy at the expense of
+ // repeat glTexSubImage2D calls. On some devices this is worse.
const byte* src = static_cast(buf);
do {
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y,
@@ -193,16 +213,15 @@ void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h,
++y;
src += pitch;
} while (--h);
+#endif
}
}
void GLESTexture::fillBuffer(byte x) {
- byte tmpbuf[_surface.h * _surface.w * bytesPerPixel()];
- memset(tmpbuf, 0, _surface.h * _surface.w * bytesPerPixel());
- glBindTexture(GL_TEXTURE_2D, _texture_name);
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _surface.w, _surface.h,
- glFormat(), glType(), tmpbuf);
- setDirty();
+ int rowbytes = _surface.w * bytesPerPixel();
+ byte tmpbuf[_surface.h * rowbytes];
+ memset(tmpbuf, x, _surface.h * rowbytes);
+ updateBuffer(0, 0, _surface.w, _surface.h, tmpbuf, rowbytes);
}
void GLESTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) {
@@ -215,6 +234,7 @@ void GLESTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) {
//glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
const GLint crop[4] = {0, _surface.h, _surface.w, -_surface.h};
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop);
+ glColor4ub(0xff, 0xff, 0xff, 0xff); // Android GLES bug?
glDrawTexiOES(x, y, 0, w, h);
} else
#endif
--
cgit v1.2.3
From 3bd60b09c1b58a2a75591d89a806d6f0d1b1221c Mon Sep 17 00:00:00 2001
From: Angus Lees
Date: Mon, 25 Oct 2010 08:50:16 +0000
Subject: ANDROID: Don't trust eglChooseConfig and refilter/sort results
manually
It seems some Android versions and devices (eg Droid) don't implement
eglChooseConfig according to spec and the first result isn't the best
choice. Implement our own filtering / scoring to workaround this.
svn-id: r53808
---
.../android/org/inodes/gus/scummvm/ScummVM.java | 123 ++++++++++++++++++++-
1 file changed, 118 insertions(+), 5 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java
index d39aa363ef..6986f3988d 100644
--- a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java
+++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java
@@ -23,6 +23,8 @@ import javax.microedition.khronos.egl.EGLSurface;
import java.io.File;
import java.util.concurrent.Semaphore;
+import java.util.Map;
+import java.util.LinkedHashMap;
// At least in Android 2.1, eglCreateWindowSurface() requires an
@@ -109,6 +111,51 @@ public class ScummVM implements SurfaceHolder.Callback {
}
}
+ // For debugging
+ private static final Map attribs;
+ static {
+ attribs = new LinkedHashMap();
+ attribs.put("CONFIG_ID", EGL10.EGL_CONFIG_ID);
+ attribs.put("BUFFER_SIZE", EGL10.EGL_BUFFER_SIZE);
+ attribs.put("RED_SIZE", EGL10.EGL_RED_SIZE);
+ attribs.put("GREEN_SIZE", EGL10.EGL_GREEN_SIZE);
+ attribs.put("BLUE_SIZE", EGL10.EGL_BLUE_SIZE);
+ attribs.put("ALPHA_SIZE", EGL10.EGL_ALPHA_SIZE);
+ //attribs.put("BIND_TO_RGB", EGL10.EGL_BIND_TO_TEXTURE_RGB);
+ //attribs.put("BIND_TO_RGBA", EGL10.EGL_BIND_TO_TEXTURE_RGBA);
+ attribs.put("CONFIG_CAVEAT", EGL10.EGL_CONFIG_CAVEAT);
+ attribs.put("DEPTH_SIZE", EGL10.EGL_DEPTH_SIZE);
+ attribs.put("LEVEL", EGL10.EGL_LEVEL);
+ attribs.put("MAX_PBUFFER_WIDTH", EGL10.EGL_MAX_PBUFFER_WIDTH);
+ attribs.put("MAX_PBUFFER_HEIGHT", EGL10.EGL_MAX_PBUFFER_HEIGHT);
+ attribs.put("MAX_PBUFFER_PIXELS", EGL10.EGL_MAX_PBUFFER_PIXELS);
+ //attribs.put("MAX_SWAP_INTERVAL", EGL10.EGL_MAX_SWAP_INTERVAL);
+ //attribs.put("MIN_SWAP_INTERVAL", EGL10.EGL_MIN_SWAP_INTERVAL);
+ attribs.put("NATIVE_RENDERABLE", EGL10.EGL_NATIVE_RENDERABLE);
+ attribs.put("NATIVE_VISUAL_ID", EGL10.EGL_NATIVE_VISUAL_ID);
+ attribs.put("NATIVE_VISUAL_TYPE", EGL10.EGL_NATIVE_VISUAL_TYPE);
+ attribs.put("SAMPLE_BUFFERS", EGL10.EGL_SAMPLE_BUFFERS);
+ attribs.put("SAMPLES", EGL10.EGL_SAMPLES);
+ attribs.put("STENCIL_SIZE", EGL10.EGL_STENCIL_SIZE);
+ attribs.put("SURFACE_TYPE", EGL10.EGL_SURFACE_TYPE);
+ attribs.put("TRANSPARENT_TYPE", EGL10.EGL_TRANSPARENT_TYPE);
+ attribs.put("TRANSPARENT_RED_VALUE", EGL10.EGL_TRANSPARENT_RED_VALUE);
+ attribs.put("TRANSPARENT_GREEN_VALUE", EGL10.EGL_TRANSPARENT_GREEN_VALUE);
+ attribs.put("TRANSPARENT_BLUE_VALUE", EGL10.EGL_TRANSPARENT_BLUE_VALUE);
+ }
+ private void dumpEglConfig(EGLConfig config) {
+ int[] value = new int[1];
+ for (Map.Entry entry : attribs.entrySet()) {
+ egl.eglGetConfigAttrib(eglDisplay, config,
+ entry.getValue(), value);
+ if (value[0] == EGL10.EGL_NONE)
+ Log.d(LOG_TAG, entry.getKey() + ": NONE");
+ else
+ Log.d(LOG_TAG, String.format("%s: %d",
+ entry.getKey(), value[0]));
+ }
+ }
+
// Called by ScummVM thread (from initBackend)
private void createScummVMGLContext() {
egl = (EGL10)EGLContext.getEGL();
@@ -125,10 +172,75 @@ public class ScummVM implements SurfaceHolder.Callback {
EGLConfig[] configs = new EGLConfig[numConfigs];
egl.eglChooseConfig(eglDisplay, configSpec, configs, numConfigs,
num_config);
- eglConfig = configs[0];
+
+ if (false) {
+ Log.d(LOG_TAG,
+ String.format("Found %d EGL configurations.", numConfigs));
+ for (EGLConfig config : configs)
+ dumpEglConfig(config);
+ }
+
+ // Android's eglChooseConfig is busted in several versions and
+ // devices so we have to filter/rank the configs again ourselves.
+ eglConfig = chooseEglConfig(configs);
+ if (false) {
+ Log.d(LOG_TAG,
+ String.format("Chose EGL config from %d possibilities.", numConfigs));
+ dumpEglConfig(eglConfig);
+ }
eglContext = egl.eglCreateContext(eglDisplay, eglConfig,
EGL10.EGL_NO_CONTEXT, null);
+ if (eglContext == EGL10.EGL_NO_CONTEXT)
+ throw new RuntimeException("Failed to create context");
+ }
+
+ private EGLConfig chooseEglConfig(EGLConfig[] configs) {
+ int best = 0;
+ int bestScore = -1;
+ int[] value = new int[1];
+ for (int i = 0; i < configs.length; i++) {
+ EGLConfig config = configs[i];
+ int score = 10000;
+ egl.eglGetConfigAttrib(eglDisplay, config,
+ EGL10.EGL_SURFACE_TYPE, value);
+ if ((value[0] & EGL10.EGL_WINDOW_BIT) == 0)
+ continue; // must have
+
+ egl.eglGetConfigAttrib(eglDisplay, config,
+ EGL10.EGL_CONFIG_CAVEAT, value);
+ if (value[0] != EGL10.EGL_NONE)
+ score -= 1000;
+
+ // Must be at least 555, but then smaller is better
+ final int[] colorBits = {EGL10.EGL_RED_SIZE,
+ EGL10.EGL_GREEN_SIZE,
+ EGL10.EGL_BLUE_SIZE,
+ EGL10.EGL_ALPHA_SIZE};
+ for (int component : colorBits) {
+ egl.eglGetConfigAttrib(eglDisplay, config,
+ component, value);
+ if (value[0] >= 5)
+ score += 10; // boost if >5 bits accuracy
+ score -= value[0]; // penalize for wasted bits
+ }
+
+ egl.eglGetConfigAttrib(eglDisplay, config,
+ EGL10.EGL_DEPTH_SIZE, value);
+ score -= value[0]; // penalize for wasted bits
+
+ if (score > bestScore) {
+ best = i;
+ bestScore = score;
+ }
+ }
+
+ if (bestScore < 0) {
+ Log.e(LOG_TAG, "Unable to find an acceptable EGL config, expect badness.");
+ return configs[0];
+ }
+
+ return configs[best];
}
// Called by ScummVM thread
@@ -137,12 +249,13 @@ public class ScummVM implements SurfaceHolder.Callback {
try {
surfaceLock.acquire();
} catch (InterruptedException e) {
- Log.e(this.toString(),
- "Interrupted while waiting for surface lock", e);
+ Log.e(LOG_TAG, "Interrupted while waiting for surface lock", e);
return;
}
eglSurface = egl.eglCreateWindowSurface(eglDisplay, eglConfig,
nativeSurface, null);
+ if (eglSurface == EGL10.EGL_NO_SURFACE)
+ Log.e(LOG_TAG, "CreateWindowSurface failed!");
egl.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext);
GL10 gl = (GL10)eglContext.getGL();
@@ -302,8 +415,8 @@ public class ScummVM implements SurfaceHolder.Callback {
if (buf_size < 0) {
int guess = AUDIO_FRAME_SIZE * sample_rate / 100; // 10ms of audio
Log.w(LOG_TAG, String.format(
- "Unable to get min audio buffer size (error %d). Guessing %dB.",
- buf_size, guess));
+ "Unable to get min audio buffer size (error %d). Guessing %dB.",
+ buf_size, guess));
buf_size = guess;
}
Log.d(LOG_TAG, String.format("Using %dB buffer for %dHZ audio",
--
cgit v1.2.3
From a0a9de42e1a86278706c94af5f93522d4077d8fa Mon Sep 17 00:00:00 2001
From: Angus Lees
Date: Mon, 25 Oct 2010 08:51:10 +0000
Subject: ANDROID: Add --disable-timidity to the recommended flags
svn-id: r53809
---
backends/platform/android/README.build | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
(limited to 'backends/platform')
diff --git a/backends/platform/android/README.build b/backends/platform/android/README.build
index 1c407bd469..f3fb77cbcf 100644
--- a/backends/platform/android/README.build
+++ b/backends/platform/android/README.build
@@ -82,7 +82,8 @@ Then build ScummVM:
export ANDROID_TOP=
- ./configure --backend=android --host=android --enable-zlib #and any other flags
+ ./configure --backend=android --host=android --enable-zlib --disable-timidity
+ # ... and any other configure flags you want
make scummvm.apk
This will build a "monolithic" ScummVM package, with the engines
--
cgit v1.2.3
From 13b6e0d69a041a4598b12cd92fbf2c00a347b932 Mon Sep 17 00:00:00 2001
From: Yotam Barnoy
Date: Wed, 27 Oct 2010 11:09:03 +0000
Subject: PSP: Fixed ImageViewer code to deallocate TimedMessageDialog
Not deallocating it before loading the next image causes fragmentation in memory which eventually prevents big things from being loaded into memory.
svn-id: r53873
---
backends/platform/psp/image_viewer.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/psp/image_viewer.cpp b/backends/platform/psp/image_viewer.cpp
index dbcafd3898..66512e450b 100644
--- a/backends/platform/psp/image_viewer.cpp
+++ b/backends/platform/psp/image_viewer.cpp
@@ -145,8 +145,10 @@ void ImageViewer::setVisible(bool visible) {
_visible = true;
setViewerButtons(true);
- GUI::TimedMessageDialog dialog("Image Viewer", 1000);
- dialog.runModal();
+ { // so dialog goes out of scope, destroying all allocations
+ GUI::TimedMessageDialog dialog("Image Viewer", 1000);
+ dialog.runModal();
+ }
runLoop(); // only listen to viewer events
} else { // we were asked to make invisible or failed to load
--
cgit v1.2.3
From 082d9a446571ae034d4deaeb81c0affde450224d Mon Sep 17 00:00:00 2001
From: Yotam Barnoy
Date: Fri, 29 Oct 2010 07:08:24 +0000
Subject: PSP: corrected png loader to use bit depth rather than palette size
Sometimes we can have an 8bit file for example that has a palette of 16 colors or less, so we need to go by the bit depth rather than inferring the bit depth from the palette size.
svn-id: r53917
---
backends/platform/psp/png_loader.cpp | 35 ++++++++++++++++++-----------------
backends/platform/psp/png_loader.h | 8 ++++++--
2 files changed, 24 insertions(+), 19 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/psp/png_loader.cpp b/backends/platform/psp/png_loader.cpp
index 64a89af5f9..a4efdb6b06 100644
--- a/backends/platform/psp/png_loader.cpp
+++ b/backends/platform/psp/png_loader.cpp
@@ -36,25 +36,27 @@
PngLoader::Status PngLoader::allocate() {
DEBUG_ENTER_FUNC();
+
if (!findImageDimensions()) {
PSP_ERROR("failed to get image dimensions\n");
return BAD_FILE;
}
-
_buffer->setSize(_width, _height, _sizeBy);
+ uint32 bitsPerPixel = _bitDepth * _channels;
+
if (_paletteSize) { // 8 or 4-bit image
- if (_paletteSize <= 16) { // 4 bit
+ if (bitsPerPixel == 4) {
_buffer->setPixelFormat(PSPPixelFormat::Type_Palette_4bit);
_palette->setPixelFormats(PSPPixelFormat::Type_4444, PSPPixelFormat::Type_Palette_4bit);
- _paletteSize = 16;
- } else if (_paletteSize <= 256) { // 8-bit image
- _paletteSize = 256;
+ _paletteSize = 16; // round up
+ } else if (bitsPerPixel == 8) { // 8-bit image
_buffer->setPixelFormat(PSPPixelFormat::Type_Palette_8bit);
_palette->setPixelFormats(PSPPixelFormat::Type_4444, PSPPixelFormat::Type_Palette_8bit);
+ _paletteSize = 256; // round up
} else {
- PSP_ERROR("palette of %d too big!\n", _paletteSize);
+ PSP_ERROR("too many bits per pixel[%d] for a palette\n", bitsPerPixel);
return BAD_FILE;
}
@@ -127,7 +129,8 @@ bool PngLoader::basicImageLoad() {
int interlaceType;
png_get_IHDR(_pngPtr, _infoPtr, (png_uint_32 *)&_width, (png_uint_32 *)&_height, &_bitDepth,
&_colorType, &interlaceType, int_p_NULL, int_p_NULL);
-
+ _channels = png_get_channels(_pngPtr, _infoPtr);
+
if (_colorType & PNG_COLOR_MASK_PALETTE)
_paletteSize = _infoPtr->num_palette;
@@ -140,7 +143,7 @@ bool PngLoader::findImageDimensions() {
bool status = basicImageLoad();
- PSP_DEBUG_PRINT("width[%d], height[%d], paletteSize[%d], bitDepth[%d], rowBytes[%d]\n", _width, _height, _paletteSize, _bitDepth, _infoPtr->rowbytes);
+ PSP_DEBUG_PRINT("width[%d], height[%d], paletteSize[%d], bitDepth[%d], channels[%d], rowBytes[%d]\n", _width, _height, _paletteSize, _bitDepth, _channels, _infoPtr->rowbytes);
png_destroy_read_struct(&_pngPtr, &_infoPtr, png_infopp_NULL);
return status;
}
@@ -160,7 +163,7 @@ bool PngLoader::loadImageIntoBuffer() {
if (_paletteSize) {
// Copy the palette
png_colorp srcPal = _infoPtr->palette;
- for (int i = 0; i < (int)_paletteSize; i++) {
+ for (int i = 0; i < _infoPtr->num_palette; i++) {
unsigned char alphaVal = (i < _infoPtr->num_trans) ? _infoPtr->trans[i] : 0xFF; // Load alpha if it's there
_palette->setSingleColorRGBA(i, srcPal->red, srcPal->green, srcPal->blue, alphaVal);
srcPal++;
@@ -171,21 +174,19 @@ bool PngLoader::loadImageIntoBuffer() {
if (png_get_valid(_pngPtr, _infoPtr, PNG_INFO_tRNS))
png_set_tRNS_to_alpha(_pngPtr); // Convert trans channel to alpha for 32 bits
- //png_set_filler(_pngPtr, 0xff, PNG_FILLER_AFTER); // Filler for alpha if none exists
png_set_add_alpha(_pngPtr, 0xff, PNG_FILLER_AFTER); // Filler for alpha if none exists
}
uint32 rowBytes = png_get_rowbytes(_pngPtr, _infoPtr);
- uint32 channels = png_get_channels(_pngPtr, _infoPtr);
- // there seems to be a bug in libpng where it doesn't increase the rowbytes or the channel even after we add the
- // alpha channel
- if (channels == 3 && (rowBytes / _width) == 3) {
- channels = 4;
- rowBytes = _width * channels;
+ // there seems to be a bug in libpng where it doesn't increase the rowbytes or the
+ // channel even after we add the alpha channel
+ if (_channels == 3 && (rowBytes / _width) == 3) {
+ _channels = 4;
+ rowBytes = _width * _channels;
}
- PSP_DEBUG_PRINT("rowBytes[%d], channels[%d]\n", rowBytes, channels);
+ PSP_DEBUG_PRINT("rowBytes[%d], channels[%d]\n", rowBytes, _channels);
unsigned char *line = (unsigned char*) malloc(rowBytes);
if (!line) {
diff --git a/backends/platform/psp/png_loader.h b/backends/platform/psp/png_loader.h
index 6b0282621a..4119bfef2b 100644
--- a/backends/platform/psp/png_loader.h
+++ b/backends/platform/psp/png_loader.h
@@ -44,11 +44,14 @@ private:
uint32 _width;
uint32 _height;
uint32 _paletteSize;
- int _bitDepth;
Buffer::HowToSize _sizeBy;
+
+ // PNG lib values
+ int _bitDepth;
png_structp _pngPtr;
png_infop _infoPtr;
int _colorType;
+ uint32 _channels;
public:
enum Status {
@@ -61,7 +64,8 @@ public:
Buffer::HowToSize sizeBy = Buffer::kSizeByTextureSize) :
_file(file), _buffer(&buffer), _palette(&palette),
_width(0), _height(0), _paletteSize(0),
- _bitDepth(0), _sizeBy(sizeBy), _pngPtr(0), _infoPtr(0), _colorType(0) {}
+ _bitDepth(0), _sizeBy(sizeBy), _pngPtr(0),
+ _infoPtr(0), _colorType(0), _channels(0) {}
PngLoader::Status allocate();
bool load();
--
cgit v1.2.3
From 547e028b93cdc279d4ee871b94aac5701534cb28 Mon Sep 17 00:00:00 2001
From: Yotam Barnoy
Date: Fri, 29 Oct 2010 07:55:18 +0000
Subject: PSP: Improved image viewer movement
Before the limit was arbitrary. Now we check the proper location on screen and move in increments relative to the size on screen.
svn-id: r53918
---
backends/platform/psp/image_viewer.cpp | 16 ++++++++--------
backends/platform/psp/image_viewer.h | 4 ++--
2 files changed, 10 insertions(+), 10 deletions(-)
(limited to 'backends/platform')
diff --git a/backends/platform/psp/image_viewer.cpp b/backends/platform/psp/image_viewer.cpp
index 66512e450b..b859fe21d1 100644
--- a/backends/platform/psp/image_viewer.cpp
+++ b/backends/platform/psp/image_viewer.cpp
@@ -218,16 +218,16 @@ void ImageViewer::render() {
// move the image slightly. Note that we count on the renderer's timing
switch (_movement) {
case EVENT_MOVE_LEFT:
- moveImageX(-2);
+ moveImageX(-_visibleWidth / 100.0f);
break;
case EVENT_MOVE_UP:
- moveImageY(-2);
+ moveImageY(-_visibleHeight / 100.0f);
break;
case EVENT_MOVE_RIGHT:
- moveImageX(2);
+ moveImageX(_visibleWidth / 100.0f);
break;
case EVENT_MOVE_DOWN:
- moveImageY(2);
+ moveImageY(_visibleHeight / 100.0f);
break;
default:
break;
@@ -255,19 +255,19 @@ void ImageViewer::setZoom(float value) {
setOffsetParams();
}
-void ImageViewer::moveImageX(int val) {
+void ImageViewer::moveImageX(float val) {
float newVal = _centerX + val;
- if (newVal < 0 || newVal > PSP_SCREEN_WIDTH)
+ if (newVal - (_visibleWidth / 2) > PSP_SCREEN_WIDTH - 4 || newVal + (_visibleWidth / 2) < 4)
return;
_centerX = newVal;
setOffsetParams();
}
-void ImageViewer::moveImageY(int val) {
+void ImageViewer::moveImageY(float val) {
float newVal = _centerY + val;
- if (newVal < 0 || newVal > PSP_SCREEN_HEIGHT)
+ if (newVal - (_visibleHeight / 2) > PSP_SCREEN_HEIGHT - 4 || newVal + (_visibleHeight / 2) < 4)
return;
_centerY = newVal;
setOffsetParams();
diff --git a/backends/platform/psp/image_viewer.h b/backends/platform/psp/image_viewer.h
index 1946b0ffe2..ef8b196dbe 100644
--- a/backends/platform/psp/image_viewer.h
+++ b/backends/platform/psp/image_viewer.h
@@ -66,8 +66,8 @@ private:
void loadLastImage();
void setViewerButtons(bool active);
void setConstantRendererOptions();
- void moveImageX(int val);
- void moveImageY(int val);
+ void moveImageX(float val);
+ void moveImageY(float val);
bool load(int imageNum);
void unload();
void runLoop(); // to get total pausing we have to do our own loop
--
cgit v1.2.3
From 44393b2dc8ba78342dcbb7df39eca2e9e1f6e429 Mon Sep 17 00:00:00 2001
From: Max Horn
Date: Sat, 30 Oct 2010 21:27:42 +0000
Subject: ALL: Add code to help stop people from accidentally using "bad" APIs
A new header file common/forbidden.h is included by scummsys.h and it
re-#defines numerous symbols like fopen(), fread(), system(), etc. with
garbage, in order to provoke compile errors in any code using them.
If a .cpp file really *must* use any of these (e.g. because it is a
backend file), then these redefinitions can be disabled by #defining
FORBIDDEN_SYMBOL_ALLOW_ALL as the first thing in the .cpp file. Whenever
this is done, an explanatory comment should be added.
Note that this system cannot catch all "bad" usages (notably the Lua
code in the sword25 engine), as it can only work if scummsys.h is
included.
svn-id: r53961
---
backends/platform/sdl/main.cpp | 2 ++
backends/platform/sdl/sdl.cpp | 5 ++++-
2 files changed, 6 insertions(+), 1 deletion(-)
(limited to 'backends/platform')
diff --git a/backends/platform/sdl/main.cpp b/backends/platform/sdl/main.cpp
index 60bf59689c..a9e1f5cf4b 100644
--- a/backends/platform/sdl/main.cpp
+++ b/backends/platform/sdl/main.cpp
@@ -23,6 +23,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
// Fix for bug #2895217 "MSVC compilation broken with r47595":
// We need to keep this on top of the "common/scummsys.h" include,
// otherwise we will get errors about the windows headers redefining
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 83393c225a..8725a7df8a 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -23,6 +23,9 @@
*
*/
+// Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
#if defined(WIN32)
#define WIN32_LEAN_AND_MEAN
#include
@@ -79,7 +82,7 @@
#endif
#if defined(MACOSX) || defined(IPHONE)
-#include "CoreFoundation/CoreFoundation.h"
+#include
#endif
--
cgit v1.2.3
From 768038be1147d66b31e508b61099726018f96e10 Mon Sep 17 00:00:00 2001
From: Max Horn
Date: Sat, 30 Oct 2010 21:49:20 +0000
Subject: GP2x: Enable use of forbidden symbols
svn-id: r53962
---
backends/platform/gp2x/gp2x-hw.cpp | 3 +++
backends/platform/gp2x/gp2x-mem.cpp | 3 +++
backends/platform/gp2x/gp2x.cpp | 3 +++
3 files changed, 9 insertions(+)
(limited to 'backends/platform')
diff --git a/backends/platform/gp2x/gp2x-hw.cpp b/backends/platform/gp2x/gp2x-hw.cpp
index 75e4ca6471..6f544258ec 100644
--- a/backends/platform/gp2x/gp2x-hw.cpp
+++ b/backends/platform/gp2x/gp2x-hw.cpp
@@ -30,6 +30,9 @@
*
*/
+// Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
#include "gp2x-common.h"
#include "gp2x-hw.h"
diff --git a/backends/platform/gp2x/gp2x-mem.cpp b/backends/platform/gp2x/gp2x-mem.cpp
index 97a34ffb6a..4a1802f311 100644
--- a/backends/platform/gp2x/gp2x-mem.cpp
+++ b/backends/platform/gp2x/gp2x-mem.cpp
@@ -28,6 +28,9 @@
*
*/
+// Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
#include
#include
#include
diff --git a/backends/platform/gp2x/gp2x.cpp b/backends/platform/gp2x/gp2x.cpp
index 88d4f9d632..0811380be9 100644
--- a/backends/platform/gp2x/gp2x.cpp
+++ b/backends/platform/gp2x/gp2x.cpp
@@ -28,6 +28,9 @@
*
*/
+// Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
#include "backends/platform/gp2x/gp2x-common.h"
#include "backends/platform/gp2x/gp2x-hw.h"
#include "backends/platform/gp2x/gp2x-mem.h"
--
cgit v1.2.3
From 19c3196c1ce73fd0b05d17df03fe56cbb9d711db Mon Sep 17 00:00:00 2001
From: Max Horn
Date: Sat, 30 Oct 2010 21:49:46 +0000
Subject: LINUXMOTO: Enable use of forbidden symbols
svn-id: r53963
---
backends/platform/linuxmoto/linuxmoto-main.cpp | 3 +++
1 file changed, 3 insertions(+)
(limited to 'backends/platform')
diff --git a/backends/platform/linuxmoto/linuxmoto-main.cpp b/backends/platform/linuxmoto/linuxmoto-main.cpp
index 97f12e8ce1..09b03c31d6 100644
--- a/backends/platform/linuxmoto/linuxmoto-main.cpp
+++ b/backends/platform/linuxmoto/linuxmoto-main.cpp
@@ -23,6 +23,9 @@
*
*/
+// Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
#include "common/scummsys.h"
#include "common/system.h"
--
cgit v1.2.3
From 1425013c4bd67add0037806060b178b17c4c6e4f Mon Sep 17 00:00:00 2001
From: Max Horn
Date: Sat, 30 Oct 2010 22:43:25 +0000
Subject: GPH: Enable use of forbidden symbols
svn-id: r53964
---
backends/platform/gph/gph-hw.cpp | 3 +++
backends/platform/gph/gph-main.cpp | 3 +++
2 files changed, 6 insertions(+)
(limited to 'backends/platform')
diff --git a/backends/platform/gph/gph-hw.cpp b/backends/platform/gph/gph-hw.cpp
index b43324b547..fa52526f01 100644
--- a/backends/platform/gph/gph-hw.cpp
+++ b/backends/platform/gph/gph-hw.cpp
@@ -28,6 +28,9 @@
*
*/
+// Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
#include "backends/platform/gph/gph-hw.h"
#include
diff --git a/backends/platform/gph/gph-main.cpp b/backends/platform/gph/gph-main.cpp
index 71f9f77bfc..c433ba9f3f 100644
--- a/backends/platform/gph/gph-main.cpp
+++ b/backends/platform/gph/gph-main.cpp
@@ -23,6 +23,9 @@
*
*/
+// Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
#include "common/scummsys.h"
#include
--
cgit v1.2.3
From 184c732bf6d1a2fd77eecf6f95314eb5181057ce Mon Sep 17 00:00:00 2001
From: Max Horn
Date: Sat, 30 Oct 2010 23:53:59 +0000
Subject: PS2: Enable use of forbidden symbols
svn-id: r53969
---
backends/platform/ps2/fileio.cpp | 3 +++
backends/platform/ps2/systemps2.cpp | 3 +++
2 files changed, 6 insertions(+)
(limited to 'backends/platform')
diff --git a/backends/platform/ps2/fileio.cpp b/backends/platform/ps2/fileio.cpp
index 8c10156aaf..826a2578e4 100644
--- a/backends/platform/ps2/fileio.cpp
+++ b/backends/platform/ps2/fileio.cpp
@@ -23,6 +23,9 @@
*
*/
+// Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
#include "backends/platform/ps2/fileio.h"
#include
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index 7659d5194d..fd2bf80761 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -23,6 +23,9 @@
*
*/
+// Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
#include
#include
#include
--
cgit v1.2.3
From ac748c2ebd6fc437df2d7232edcc53cdbd532760 Mon Sep 17 00:00:00 2001
From: Max Horn
Date: Sun, 31 Oct 2010 00:01:00 +0000
Subject: PSP: Enable use of forbidden symbols
svn-id: r53970
---
backends/platform/psp/image_viewer.cpp | 3 +++
backends/platform/psp/png_loader.cpp | 3 +++
backends/platform/psp/pspkeyboard.cpp | 3 +++
3 files changed, 9 insertions(+)
(limited to 'backends/platform')
diff --git a/backends/platform/psp/image_viewer.cpp b/backends/platform/psp/image_viewer.cpp
index b859fe21d1..26b7f31c97 100644
--- a/backends/platform/psp/image_viewer.cpp
+++ b/backends/platform/psp/image_viewer.cpp
@@ -23,6 +23,9 @@
*
*/
+// Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
#include "common/scummsys.h"
#include "common/str.h"
#include "common/stream.h"
diff --git a/backends/platform/psp/png_loader.cpp b/backends/platform/psp/png_loader.cpp
index a4efdb6b06..08f370f36d 100644
--- a/backends/platform/psp/png_loader.cpp
+++ b/backends/platform/psp/png_loader.cpp
@@ -23,6 +23,9 @@
*
*/
+// Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
#include "common/scummsys.h"
#include "common/stream.h"
#include "backends/platform/psp/psppixelformat.h"
diff --git a/backends/platform/psp/pspkeyboard.cpp b/backends/platform/psp/pspkeyboard.cpp
index b758109285..f210726692 100644
--- a/backends/platform/psp/pspkeyboard.cpp
+++ b/backends/platform/psp/pspkeyboard.cpp
@@ -23,6 +23,9 @@
*
*/
+// Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
//#define PSP_KB_SHELL /* Need a hack to properly load the keyboard from the PSP shell */
#ifdef PSP_KB_SHELL
--
cgit v1.2.3
From 2e4cedd98a472a9e5109b546d42cc14fcd6bd42b Mon Sep 17 00:00:00 2001
From: Max Horn
Date: Sun, 31 Oct 2010 00:04:24 +0000
Subject: IPHONE: Enable use of forbidden symbols
svn-id: r53971
---
backends/platform/iphone/osys_events.cpp | 3 +++
backends/platform/iphone/osys_main.cpp | 3 +++
backends/platform/iphone/osys_sound.cpp | 3 +++
backends/platform/iphone/osys_video.cpp | 3 +++
4 files changed, 12 insertions(+)
(limited to 'backends/platform')
diff --git a/backends/platform/iphone/osys_events.cpp b/backends/platform/iphone/osys_events.cpp
index 22f529dfac..c30e34dd05 100644
--- a/backends/platform/iphone/osys_events.cpp
+++ b/backends/platform/iphone/osys_events.cpp
@@ -23,6 +23,9 @@
*
*/
+// Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
#include "gui/message.h"
#include "common/translation.h"
diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp
index a1fb8f0d5e..9dc4e202c4 100644
--- a/backends/platform/iphone/osys_main.cpp
+++ b/backends/platform/iphone/osys_main.cpp
@@ -23,6 +23,9 @@
*
*/
+// Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
#include
#include
diff --git a/backends/platform/iphone/osys_sound.cpp b/backends/platform/iphone/osys_sound.cpp
index 55892580f6..cd364f57ac 100644
--- a/backends/platform/iphone/osys_sound.cpp
+++ b/backends/platform/iphone/osys_sound.cpp
@@ -23,6 +23,9 @@
*
*/
+// Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
#include "osys_main.h"
void OSystem_IPHONE::AQBufferCallback(void *in, AudioQueueRef inQ, AudioQueueBufferRef outQB) {
diff --git a/backends/platform/iphone/osys_video.cpp b/backends/platform/iphone/osys_video.cpp
index d30a412a9f..88368a0eec 100644
--- a/backends/platform/iphone/osys_video.cpp
+++ b/backends/platform/iphone/osys_video.cpp
@@ -23,6 +23,9 @@
*
*/
+// Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
#include "osys_main.h"
const OSystem::GraphicsMode* OSystem_IPHONE::getSupportedGraphicsModes() const {
--
cgit v1.2.3