aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/gph
diff options
context:
space:
mode:
authorMatthew Hoops2011-04-13 16:04:29 -0400
committerMatthew Hoops2011-04-13 16:04:29 -0400
commit6d153f311c65fe414e31e99f8a9a6503c49a01a5 (patch)
tree9173f9964c0fec4215514e622f705810730d0ce9 /backends/platform/gph
parent47c2a9adbe8d9e6640a819386f0f34e929937672 (diff)
parent66b43f2312578f35e0718d0699de207a7bf77f1a (diff)
downloadscummvm-rg350-6d153f311c65fe414e31e99f8a9a6503c49a01a5.tar.gz
scummvm-rg350-6d153f311c65fe414e31e99f8a9a6503c49a01a5.tar.bz2
scummvm-rg350-6d153f311c65fe414e31e99f8a9a6503c49a01a5.zip
Merge remote branch 'upstream/master' into t7g-ios
Conflicts: video/qt_decoder.cpp
Diffstat (limited to 'backends/platform/gph')
-rw-r--r--[-rwxr-xr-x]backends/platform/gph/build/caanoo-build.sh (renamed from backends/platform/gph/caanoo/build.sh)0
-rw-r--r--[-rwxr-xr-x]backends/platform/gph/build/caanoo-bundle-debug.sh (renamed from backends/platform/gph/caanoo/bundle-debug.sh)0
-rw-r--r--[-rwxr-xr-x]backends/platform/gph/build/caanoo-bundle.sh (renamed from backends/platform/gph/caanoo/bundle.sh)0
-rw-r--r--[-rwxr-xr-x]backends/platform/gph/build/caanoo-config-alleng.sh (renamed from backends/platform/gph/caanoo/config-alleng.sh)0
-rw-r--r--[-rwxr-xr-x]backends/platform/gph/build/caanoo-config.sh (renamed from backends/platform/gph/caanoo/config.sh)0
-rwxr-xr-xbackends/platform/gph/build/clean.sh2
-rw-r--r--backends/platform/gph/build/gp2x-build.sh20
-rw-r--r--backends/platform/gph/build/gp2x-bundle.sh19
-rw-r--r--backends/platform/gph/build/gp2x-config-alleng.sh23
-rw-r--r--backends/platform/gph/build/gp2x-config.sh24
-rw-r--r--[-rwxr-xr-x]backends/platform/gph/build/gp2xwiz-build.sh (renamed from backends/platform/gph/build/build.sh)0
-rw-r--r--[-rwxr-xr-x]backends/platform/gph/build/gp2xwiz-bundle-debug.sh (renamed from backends/platform/gph/build/bundle-debug.sh)0
-rw-r--r--[-rwxr-xr-x]backends/platform/gph/build/gp2xwiz-bundle.sh (renamed from backends/platform/gph/build/bundle.sh)0
-rw-r--r--[-rwxr-xr-x]backends/platform/gph/build/gp2xwiz-config-alleng.sh (renamed from backends/platform/gph/build/config-alleng.sh)0
-rw-r--r--[-rwxr-xr-x]backends/platform/gph/build/gp2xwiz-config.sh (renamed from backends/platform/gph/build/config.sh)0
-rwxr-xr-xbackends/platform/gph/caanoo-bundle.mk20
-rwxr-xr-xbackends/platform/gph/caanoo/clean.sh8
-rw-r--r--[-rwxr-xr-x]backends/platform/gph/devices/caanoo/scummvm-gdb.gpe (renamed from backends/platform/gph/build/scummvm-gdb.gpe)0
-rw-r--r--[-rwxr-xr-x]backends/platform/gph/devices/caanoo/scummvm.gpe (renamed from backends/platform/gph/caanoo/scummvm.gpe)0
-rw-r--r--backends/platform/gph/devices/common/README-GPH (renamed from backends/platform/gph/build/README-GPH)4
-rw-r--r--backends/platform/gph/devices/common/scummvm.ini (renamed from backends/platform/gph/build/scummvm.ini)0
-rw-r--r--backends/platform/gph/devices/common/scummvm.png (renamed from backends/platform/gph/build/scummvm.png)bin2656 -> 2656 bytes
-rw-r--r--backends/platform/gph/devices/common/scummvmb.png (renamed from backends/platform/gph/build/scummvmb.png)bin34274 -> 34274 bytes
-rw-r--r--backends/platform/gph/devices/gp2x/mmuhack/Makefile11
-rw-r--r--backends/platform/gph/devices/gp2x/mmuhack/flush_uppermem_cache.h11
-rw-r--r--backends/platform/gph/devices/gp2x/mmuhack/flush_uppermem_cache.s6
-rw-r--r--backends/platform/gph/devices/gp2x/mmuhack/mmuhack.c129
-rw-r--r--backends/platform/gph/devices/gp2x/mmuhack/mmuhack.obin0 -> 1720 bytes
-rw-r--r--backends/platform/gph/devices/gp2x/mmuhack/readme.txt110
-rw-r--r--backends/platform/gph/devices/gp2x/scummvm.gpe18
-rw-r--r--[-rwxr-xr-x]backends/platform/gph/devices/gp2xwiz/scummvm-gdb.gpe (renamed from backends/platform/gph/caanoo/scummvm-gdb.gpe)0
-rw-r--r--[-rwxr-xr-x]backends/platform/gph/devices/gp2xwiz/scummvm.gpe (renamed from backends/platform/gph/build/scummvm.gpe)0
-rw-r--r--backends/platform/gph/gp2x-bundle.mk67
-rwxr-xr-xbackends/platform/gph/gp2xwiz-bundle.mk21
-rw-r--r--backends/platform/gph/gph-main.cpp2
-rw-r--r--backends/platform/gph/gph-sdl.h2
36 files changed, 463 insertions, 34 deletions
diff --git a/backends/platform/gph/caanoo/build.sh b/backends/platform/gph/build/caanoo-build.sh
index 8000d2595d..8000d2595d 100755..100644
--- a/backends/platform/gph/caanoo/build.sh
+++ b/backends/platform/gph/build/caanoo-build.sh
diff --git a/backends/platform/gph/caanoo/bundle-debug.sh b/backends/platform/gph/build/caanoo-bundle-debug.sh
index 2d5cefe80e..2d5cefe80e 100755..100644
--- a/backends/platform/gph/caanoo/bundle-debug.sh
+++ b/backends/platform/gph/build/caanoo-bundle-debug.sh
diff --git a/backends/platform/gph/caanoo/bundle.sh b/backends/platform/gph/build/caanoo-bundle.sh
index 76fd31cec6..76fd31cec6 100755..100644
--- a/backends/platform/gph/caanoo/bundle.sh
+++ b/backends/platform/gph/build/caanoo-bundle.sh
diff --git a/backends/platform/gph/caanoo/config-alleng.sh b/backends/platform/gph/build/caanoo-config-alleng.sh
index 97fed942fa..97fed942fa 100755..100644
--- a/backends/platform/gph/caanoo/config-alleng.sh
+++ b/backends/platform/gph/build/caanoo-config-alleng.sh
diff --git a/backends/platform/gph/caanoo/config.sh b/backends/platform/gph/build/caanoo-config.sh
index 11d597481a..11d597481a 100755..100644
--- a/backends/platform/gph/caanoo/config.sh
+++ b/backends/platform/gph/build/caanoo-config.sh
diff --git a/backends/platform/gph/build/clean.sh b/backends/platform/gph/build/clean.sh
index 5ec1b9e62c..6d58b7a975 100755
--- a/backends/platform/gph/build/clean.sh
+++ b/backends/platform/gph/build/clean.sh
@@ -4,5 +4,5 @@ echo Quick script to make building all the time less painful.
cd ../../../..
-echo Cleaning ScummVM for the GP2X Wiz.
+echo Cleaning ScummVM for the GPH devices.
make clean
diff --git a/backends/platform/gph/build/gp2x-build.sh b/backends/platform/gph/build/gp2x-build.sh
new file mode 100644
index 0000000000..1ea77f4937
--- /dev/null
+++ b/backends/platform/gph/build/gp2x-build.sh
@@ -0,0 +1,20 @@
+#!/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=-march=armv4t
+export LDFLAGS=-static
+export ASFLAGS=-mfloat-abi=soft
+
+cd ../../../..
+
+echo Building ScummVM for GP2X.
+make
+
+echo Build for GP2X - SDL - complete - Please check build logs.
diff --git a/backends/platform/gph/build/gp2x-bundle.sh b/backends/platform/gph/build/gp2x-bundle.sh
new file mode 100644
index 0000000000..c4fe63ed9e
--- /dev/null
+++ b/backends/platform/gph/build/gp2x-bundle.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+echo Quick script to make building a distribution of the GP2X port more consistent.
+
+# 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=-march=armv4t
+export LDFLAGS=-static
+export ASFLAGS=-mfloat-abi=soft
+
+cd ../../../..
+
+echo Building ScummVM for GP2X Wiz.
+
+make gp2x-bundle
diff --git a/backends/platform/gph/build/gp2x-config-alleng.sh b/backends/platform/gph/build/gp2x-config-alleng.sh
new file mode 100644
index 0000000000..4a3526d50c
--- /dev/null
+++ b/backends/platform/gph/build/gp2x-config-alleng.sh
@@ -0,0 +1,23 @@
+#!/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=-march=armv4t
+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=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-all-engines --enable-vkeybd
+#--enable-plugins --default-dynamic
+
+echo Generating config for GP2X complete. Check for errors.
diff --git a/backends/platform/gph/build/gp2x-config.sh b/backends/platform/gph/build/gp2x-config.sh
new file mode 100644
index 0000000000..9092b0b1ea
--- /dev/null
+++ b/backends/platform/gph/build/gp2x-config.sh
@@ -0,0 +1,24 @@
+#!/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=-march=armv4t
+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=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/gph/build/build.sh b/backends/platform/gph/build/gp2xwiz-build.sh
index 876c3e378a..876c3e378a 100755..100644
--- a/backends/platform/gph/build/build.sh
+++ b/backends/platform/gph/build/gp2xwiz-build.sh
diff --git a/backends/platform/gph/build/bundle-debug.sh b/backends/platform/gph/build/gp2xwiz-bundle-debug.sh
index cd5145b31d..cd5145b31d 100755..100644
--- a/backends/platform/gph/build/bundle-debug.sh
+++ b/backends/platform/gph/build/gp2xwiz-bundle-debug.sh
diff --git a/backends/platform/gph/build/bundle.sh b/backends/platform/gph/build/gp2xwiz-bundle.sh
index 579e2dc77b..579e2dc77b 100755..100644
--- a/backends/platform/gph/build/bundle.sh
+++ b/backends/platform/gph/build/gp2xwiz-bundle.sh
diff --git a/backends/platform/gph/build/config-alleng.sh b/backends/platform/gph/build/gp2xwiz-config-alleng.sh
index 9ec8a09cd2..9ec8a09cd2 100755..100644
--- a/backends/platform/gph/build/config-alleng.sh
+++ b/backends/platform/gph/build/gp2xwiz-config-alleng.sh
diff --git a/backends/platform/gph/build/config.sh b/backends/platform/gph/build/gp2xwiz-config.sh
index ac7c34ad12..ac7c34ad12 100755..100644
--- a/backends/platform/gph/build/config.sh
+++ b/backends/platform/gph/build/gp2xwiz-config.sh
diff --git a/backends/platform/gph/caanoo-bundle.mk b/backends/platform/gph/caanoo-bundle.mk
index b7b3c9e188..8aabca9028 100755
--- a/backends/platform/gph/caanoo-bundle.mk
+++ b/backends/platform/gph/caanoo-bundle.mk
@@ -14,11 +14,11 @@ caanoo-bundle: $(EXECUTABLE)
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-GPH $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/build/scummvm.ini $(bundle_name)/
+ $(CP) $(srcdir)/backends/platform/gph/devices/caanoo/scummvm.gpe $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvm.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvmb.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/devices/common/README-GPH $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvm.ini $(bundle_name)/
$(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
$(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/
@@ -45,11 +45,11 @@ caanoo-bundle-debug: $(EXECUTABLE)
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-GPH $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/build/scummvm.ini $(bundle_name)/
+ $(CP) $(srcdir)/backends/platform/gph/devices/caanoo/scummvm-gdb.gpe $(bundle_name)/scummvm/scummvm.gpe
+ $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvm.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvmb.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/devices/common/README-GPH $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvm.ini $(bundle_name)/
$(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
$(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/
diff --git a/backends/platform/gph/caanoo/clean.sh b/backends/platform/gph/caanoo/clean.sh
deleted file mode 100755
index 5ec1b9e62c..0000000000
--- a/backends/platform/gph/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/gph/build/scummvm-gdb.gpe b/backends/platform/gph/devices/caanoo/scummvm-gdb.gpe
index 63ce193ca8..63ce193ca8 100755..100644
--- a/backends/platform/gph/build/scummvm-gdb.gpe
+++ b/backends/platform/gph/devices/caanoo/scummvm-gdb.gpe
diff --git a/backends/platform/gph/caanoo/scummvm.gpe b/backends/platform/gph/devices/caanoo/scummvm.gpe
index 37d0f65d18..37d0f65d18 100755..100644
--- a/backends/platform/gph/caanoo/scummvm.gpe
+++ b/backends/platform/gph/devices/caanoo/scummvm.gpe
diff --git a/backends/platform/gph/build/README-GPH b/backends/platform/gph/devices/common/README-GPH
index 64b9fcb76b..ea196f6649 100644
--- a/backends/platform/gph/build/README-GPH
+++ b/backends/platform/gph/devices/common/README-GPH
@@ -1,4 +1,4 @@
-ScummVM - GPH SPECIFIC README
+ScummVM - GPH DEVICE SPECIFIC README
------------------------------------------------------------------------
Contents:
@@ -29,7 +29,7 @@ control information.
About the backend/port
This is the readme for the official GPH ScummVM backend (also known as
-the GP2X port/GP2XWiz port and Caanoo port).
+the GP2X port/GP2XWiz port or Caanoo port).
This is an SVN test release of ScummVM for GPH devices, it would be
appreciated if this SVN test distribution was not mirrored and that
diff --git a/backends/platform/gph/build/scummvm.ini b/backends/platform/gph/devices/common/scummvm.ini
index c9cce92379..c9cce92379 100644
--- a/backends/platform/gph/build/scummvm.ini
+++ b/backends/platform/gph/devices/common/scummvm.ini
diff --git a/backends/platform/gph/build/scummvm.png b/backends/platform/gph/devices/common/scummvm.png
index 128e59efc4..128e59efc4 100644
--- a/backends/platform/gph/build/scummvm.png
+++ b/backends/platform/gph/devices/common/scummvm.png
Binary files differ
diff --git a/backends/platform/gph/build/scummvmb.png b/backends/platform/gph/devices/common/scummvmb.png
index 24a27bc0e1..24a27bc0e1 100644
--- a/backends/platform/gph/build/scummvmb.png
+++ b/backends/platform/gph/devices/common/scummvmb.png
Binary files differ
diff --git a/backends/platform/gph/devices/gp2x/mmuhack/Makefile b/backends/platform/gph/devices/gp2x/mmuhack/Makefile
new file mode 100644
index 0000000000..a35d5c2a98
--- /dev/null
+++ b/backends/platform/gph/devices/gp2x/mmuhack/Makefile
@@ -0,0 +1,11 @@
+TARGET = mmuhack
+INCLUDE = -I/opt/gcc-3.4.4-glibc-2.3.6/arm-open2x-linux/sys-include
+CFLAGS = -O2 -DMODULE -D__KERNEL__ ${INCLUDE}
+CC = arm-open2x-linux-gcc
+
+all: ${TARGET}.o
+
+${TARGET}.o: ${TARGET}.c
+
+clean:
+ rm -rf ${TARGET}.o
diff --git a/backends/platform/gph/devices/gp2x/mmuhack/flush_uppermem_cache.h b/backends/platform/gph/devices/gp2x/mmuhack/flush_uppermem_cache.h
new file mode 100644
index 0000000000..520841ace7
--- /dev/null
+++ b/backends/platform/gph/devices/gp2x/mmuhack/flush_uppermem_cache.h
@@ -0,0 +1,11 @@
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+void flush_uppermem_cache(void *start_address, void *end_address, int flags);
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/backends/platform/gph/devices/gp2x/mmuhack/flush_uppermem_cache.s b/backends/platform/gph/devices/gp2x/mmuhack/flush_uppermem_cache.s
new file mode 100644
index 0000000000..17628c156a
--- /dev/null
+++ b/backends/platform/gph/devices/gp2x/mmuhack/flush_uppermem_cache.s
@@ -0,0 +1,6 @@
+.global flush_uppermem_cache @ void *start_address, void *end_address, int flags
+
+flush_uppermem_cache:
+ swi #0x9f0002
+ bx lr
+
diff --git a/backends/platform/gph/devices/gp2x/mmuhack/mmuhack.c b/backends/platform/gph/devices/gp2x/mmuhack/mmuhack.c
new file mode 100644
index 0000000000..7e27262e5f
--- /dev/null
+++ b/backends/platform/gph/devices/gp2x/mmuhack/mmuhack.c
@@ -0,0 +1,129 @@
+/* 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 <linux/config.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/miscdevice.h>
+#include <asm/memory.h>
+
+#define MMUHACK_MINOR 225
+#define DEVICE_NAME "mmuhack"
+
+#if __GNUC__ == 3
+#include <linux/version.h>
+static const char __module_kernel_version_gcc3[] __attribute__((__used__)) __attribute__((section(".modinfo"))) =
+"kernel_version=" UTS_RELEASE;
+#endif
+
+static ssize_t mmuhack_open(struct inode *inode, struct file *filp)
+{
+ unsigned int *pgtable;
+ unsigned int *cpt;
+ int i, j;
+ int ttb;
+ int ret = -EFAULT;
+
+ // get the pointer to the translation table base...
+ asm volatile(
+ "stmdb sp!, {r0}\n\t"
+ "mrc p15, 0, r0, c2, c0, 0\n\t"
+ "mov %0, r0\n\t"
+ "ldmia sp!, {r0}\n\t": "=r"(ttb)
+ );
+
+ pgtable = __va(ttb);
+
+ for (i = 0; i < 4096; i ++) if ( (pgtable[i] & 3) == 1 ) {
+ cpt = __va(pgtable[i] & 0xfffffc00);
+
+ for (j = 0; j < 256; j ++) {/*
+ if ( (cpt[j] & 0xfe00000f) == 0x02000002 ) {
+ // set C and B bits in upper 32MB memory area...
+ printk("Set C&B bits %08x\n",cpt[j]);
+ cpt[j] |= 0xFFC;
+ ret = 0;
+ }
+ */
+ if (((cpt[j] & 0xff000000) == 0x02000000) && ((cpt[j] & 12)==0) )
+ {
+ //printk("Set C&B bits %08x\n",cpt[j]);
+ cpt[j] |= 0xFFC;
+ }
+ //if ((a>=0x31 && a<=0x36) && ((cpt[i] & 12)==0))
+ if (((cpt[j] & 0xff000000) == 0x03000000) && ((cpt[j] & 12)==0))
+ {
+ //printk("Set C&B bits %08x\n",cpt[j]);
+ //printf("SDL c and b bits not set, overwriting\n");
+ cpt[j] |= 0xFFC;
+ }
+ }
+ }
+
+ // drain the write buffer and flush the tlb caches...
+ asm volatile(
+ "stmdb sp!, {r0}\n\t"
+ "mov r0, #0\n\t"
+ "mcr 15, 0, r0, cr7, cr10, 4\n\t"
+ "mcr 15, 0, r0, cr8, cr7, 0\n\t"
+ "ldmia sp!, {r0}\n\t"
+ );
+
+ if (ret == 0)
+ printk("MMU hack applied.\n");
+
+ return 0;
+}
+
+static struct file_operations mmuhack_fops = {
+ owner: THIS_MODULE,
+ open: mmuhack_open,
+};
+
+
+static struct miscdevice mmuhack = {
+ MMUHACK_MINOR, DEVICE_NAME, &mmuhack_fops
+};
+
+static int __init mmuhack_init(void)
+{
+ misc_register(&mmuhack);
+/*
+ printk("MMSP2 MMU Hack module.\n");
+*/
+ return 0;
+}
+
+static void __exit mmuhack_exit(void)
+{
+ misc_deregister(&mmuhack);
+/*
+ printk(KERN_ALERT "MMU Hack module removed.\n");
+*/
+}
+
+module_init(mmuhack_init);
+module_exit(mmuhack_exit);
diff --git a/backends/platform/gph/devices/gp2x/mmuhack/mmuhack.o b/backends/platform/gph/devices/gp2x/mmuhack/mmuhack.o
new file mode 100644
index 0000000000..475f4a54ae
--- /dev/null
+++ b/backends/platform/gph/devices/gp2x/mmuhack/mmuhack.o
Binary files differ
diff --git a/backends/platform/gph/devices/gp2x/mmuhack/readme.txt b/backends/platform/gph/devices/gp2x/mmuhack/readme.txt
new file mode 100644
index 0000000000..bea49d7d6d
--- /dev/null
+++ b/backends/platform/gph/devices/gp2x/mmuhack/readme.txt
@@ -0,0 +1,110 @@
+About
+-----
+
+This is a module for GP2X 2.4 based Linux kernel, created for developers to use in their
+programs.
+
+Normally the upper 32MB is uncached. This means that reads/writes on the memory
+are always done via the physical memory modules rather than the much faster
+memory built into the processor (called 'cache'). Access to the upper 32MB can
+be sped up by Squidge's MMU hack. The easiest way to use the MMU hack is to add
+and load the MMU hack kernel module into your program.
+
+Note: Building this module requries a GP2X 'kernel' toolchain (i.e. GCC 2.95.*
+for the GP2X stock, 3.* for Open2X).
+
+You can't build this module with the GCC 4 based application toolchains.
+
+Operation
+---------
+
+When loaded into kernel, this module creates /dev/mmuhack device. Whenever
+a program opens that device using open() call, the module traverses all
+memory, which was allocated in 0x02000000-0x03ffffff range by the program via
+using mmap() system call. While doing that, it marks all encountered memory
+as bufferable and cacheable.
+
+The most common use of this is to remove the framebuffer access bottleneck.
+Note that, however, by making the framebuffer cacheable you can cause display
+artifacts. This can happen because parts of your framebuffer may stay in CPU
+cache and not to be written back to the physical memory. The display
+controller only fetches data from the physical memory, so you get incomplete
+image (the memory will most likely contain data from previous frame, so these
+artifacts are better visible during fade effects). The easy way to fix this
+is by using a special ARM Linux system call, which flushes the cache (forces
+the CPU to write data in cache to the physical memory (see section "Flushing
+the cache")).
+
+Using this module affects the whole upper memory area. But in some situations
+this may be not desirable, for example when using ARM940 core in your program
+(ether using 940 libraries like ogg940 and gpu940, or using your custom code,
+which needs uncacheable memory for communication and such). If you need part
+of your upper memory to be cached, and other part not, you should mmap() that
+memory (which you want to be uncached) _after_ doing open("/dev/mmuhack").
+Another way is to modify mmuhack.c to suit your needs and rebuild the module.
+
+
+Usage
+-----
+
+The very first thing to do is to load the kernel module (mmuhack.o) into the
+running kernel. But before that you should try to unload mmuhack module,
+because other program might have left a different version loaded with
+different memory configuration, which may not suit your program.
+
+system("/sbin/rmmod mmuhack");
+system("/sbin/insmod mmuhack.o");
+
+Now you can assume the module is loaded into kernel and open /dev/mmuhack
+device. You don't need to worry about previous calls failing, because in that
+case open() will simply fail and nothing bad will happen.
+
+IMPORTANT: you _must_ do the open() call _after_ you initialize your graphics
+library or allocate your memory, because it can only work with memory which is
+already allocated, it won't affect memory you or your lib allocates after the
+open() call.
+
+int mmufd = open("/dev/mmuhack", O_RDWR);
+if(mmufd < 0)
+{
+ printf("MMU hack failed");
+}
+else
+{
+ printf("MMU hack loaded");
+ close(mmufd);
+}
+
+If the above call succeeded, you are all done.
+I recommend to unload the module when your program exits, because the other
+program may want to load a different mmuhack.o and may fail, because you left
+your mmuhack.o loaded (it does not get unloaded automatically on exit).
+
+system("/sbin/rmmod mmuhack");
+
+
+Flushing the cache
+------------------
+
+If using mmuhack.o causes your program to display artifacts (see "Operation"
+section for explanation), you will need to flush the CPU cache. This should
+be done after finishing every frame and just before flipping your display
+buffer/surface. You will need to add flush_uppermem_cache.s file to your
+Makefile/project and add a call to flush_uppermem_cache() just before final
+framebuffer flip or blit.
+
+flush_uppermem_cache() has 3 parameters. First param is the start address,
+second param is the end address, third one should always be 0. The addresses
+should be virtual ones (most often pointers to the start/end of your
+framebuffer). Example:
+
+flush_uppermem_cache(screen_surface->pixels, screen_surface->pixels + 320*240, 0);
+
+
+Credits
+-------
+
+Original idea/implementation: Squidge (this whole thing is also known as squidgehack)
+Kernel module: NK
+Documentation: notaz
+
diff --git a/backends/platform/gph/devices/gp2x/scummvm.gpe b/backends/platform/gph/devices/gp2x/scummvm.gpe
new file mode 100644
index 0000000000..e8983aa2ce
--- /dev/null
+++ b/backends/platform/gph/devices/gp2x/scummvm.gpe
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# Remount SD with forced Sync, does this really work?
+mount -o sync,remount /dev/mmcsd/disc0/part1 /mnt/sd/
+
+# 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.gph
+
+# 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-gdb.gpe b/backends/platform/gph/devices/gp2xwiz/scummvm-gdb.gpe
index 63ce193ca8..63ce193ca8 100755..100644
--- a/backends/platform/gph/caanoo/scummvm-gdb.gpe
+++ b/backends/platform/gph/devices/gp2xwiz/scummvm-gdb.gpe
diff --git a/backends/platform/gph/build/scummvm.gpe b/backends/platform/gph/devices/gp2xwiz/scummvm.gpe
index 59ff562aeb..59ff562aeb 100755..100644
--- a/backends/platform/gph/build/scummvm.gpe
+++ b/backends/platform/gph/devices/gp2xwiz/scummvm.gpe
diff --git a/backends/platform/gph/gp2x-bundle.mk b/backends/platform/gph/gp2x-bundle.mk
new file mode 100644
index 0000000000..810ff8b8f0
--- /dev/null
+++ b/backends/platform/gph/gp2x-bundle.mk
@@ -0,0 +1,67 @@
+# Special target to create bundles for the GP2X.
+
+bundle_name = release/scummvm-gp2x
+f=$(shell which $(STRIP))
+libloc = $(shell dirname $(f))
+
+gp2x-bundle: $(EXECUTABLE)
+ $(MKDIR) "$(bundle_name)"
+ $(MKDIR) "$(bundle_name)/saves"
+ $(MKDIR) "$(bundle_name)/engine-data"
+ $(MKDIR) "$(bundle_name)/lib"
+
+ echo "Please put your save games in this dir" >> "$(bundle_name)/saves/PUT_SAVES_IN_THIS_DIR"
+
+ $(CP) $(srcdir)/backends/platform/gph/devices/gp2x/scummvm.gpe $(bundle_name)/
+ $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvm.png $(bundle_name)/
+ $(CP) $(srcdir)/backends/platform/gph/devices/common/README-GPH $(bundle_name)/
+ $(CP) $(srcdir)/backends/platform/gph/devices/gp2x/mmuhack/mmuhack.o $(bundle_name)/
+
+ $(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/
+ $(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)/
+
+ $(STRIP) $(EXECUTABLE) -o $(bundle_name)/$(EXECUTABLE)
+
+ifdef DYNAMIC_MODULES
+ $(INSTALL) -d "$(bundle_name)/plugins"
+ $(INSTALL) -c -m 644 $(PLUGINS) "$(bundle_name)/plugins"
+ $(STRIP) $(bundle_name)/plugins/*
+endif
+
+ $(CP) $(libloc)/../arm-open2x-linux/lib/libdl.so $(bundle_name)/lib/libdl.so
+
+ tar -C $(bundle_name) -cvjf $(bundle_name).tar.bz2 .
+ 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/gph/devices/gp2x/scummvm.gpe $(bundle_name)/
+ $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvm.png $(bundle_name)/
+ $(CP) $(srcdir)/backends/platform/gph/devices/common/README-GPH $(bundle_name)/
+ $(CP) $(srcdir)/backends/platform/gph/devices/gp2x/mmuhack/mmuhack.o $(bundle_name)/
+
+ $(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/
+ $(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
+
+ $(CP) $(libloc)/../arm-open2x-linux/lib/libdl.so $(bundle_name)/lib/libdl.so
+
+ tar -C $(bundle_name) -cvjf $(bundle_name)-debug.tar.bz2 .
+ rm -R ./$(bundle_name)
+
+.PHONY: gp2x-bundle gp2x-bundle-debug
diff --git a/backends/platform/gph/gp2xwiz-bundle.mk b/backends/platform/gph/gp2xwiz-bundle.mk
index df4cae7f4f..65e2952fde 100755
--- a/backends/platform/gph/gp2xwiz-bundle.mk
+++ b/backends/platform/gph/gp2xwiz-bundle.mk
@@ -1,6 +1,5 @@
# 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))
@@ -14,11 +13,11 @@ gp2xwiz-bundle: $(EXECUTABLE)
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-GPH $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/build/scummvm.ini $(bundle_name)/
+ $(CP) $(srcdir)/backends/platform/gph/devices/gp2xwiz/scummvm.gpe $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvm.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvmb.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/devices/common/README-GPH $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvm.ini $(bundle_name)/
$(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
$(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/
@@ -48,11 +47,11 @@ gp2xwiz-bundle-debug: $(EXECUTABLE)
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-GPH $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/build/scummvm.ini $(bundle_name)/
+ $(CP) $(srcdir)/backends/platform/gph/devices/gp2xwiz/scummvm-gdb.gpe $(bundle_name)/scummvm/scummvm.gpe
+ $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvm.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvmb.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/devices/common/README-GPH $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvm.ini $(bundle_name)/
$(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
$(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/
diff --git a/backends/platform/gph/gph-main.cpp b/backends/platform/gph/gph-main.cpp
index c7d691fc66..f91ec8f478 100644
--- a/backends/platform/gph/gph-main.cpp
+++ b/backends/platform/gph/gph-main.cpp
@@ -24,7 +24,7 @@
#include "backends/plugins/sdl/sdl-provider.h"
#include "base/main.h"
-#if defined(GP2XWIZ) || defined(CAANOO)
+#if defined(GPH_DEVICE)
int main(int argc, char *argv[]) {
diff --git a/backends/platform/gph/gph-sdl.h b/backends/platform/gph/gph-sdl.h
index ef696bc3d8..51c609d29e 100644
--- a/backends/platform/gph/gph-sdl.h
+++ b/backends/platform/gph/gph-sdl.h
@@ -23,7 +23,7 @@
#ifndef GPH_H
#define GPH_H
-#if defined(GP2XWIZ) || defined(CAANOO)
+#if defined(GPH_DEVICE)
#include "backends/base-backend.h"
#include "backends/platform/sdl/sdl.h"