From 7e0a88f69b05e71f41e2ea776b85a13fbb132bfc Mon Sep 17 00:00:00 2001 From: David-John Willis Date: Sun, 22 Jan 2012 16:46:43 +0000 Subject: GPH: Move all dist files into own folder under dists. * Update vairous GPH bundle targets to suit new layout. * Also add .in input files so we can automatically update version numbers. --- dists/gph/README-GPH | 61 +++++++++++++ dists/gph/README-GPH.in | 61 +++++++++++++ dists/gph/caanoo/scummvm-gdb.gpe | 16 ++++ dists/gph/caanoo/scummvm.gpe | 15 +++ dists/gph/gp2x/mmuhack/Makefile | 11 +++ dists/gph/gp2x/mmuhack/README | 116 ++++++++++++++++++++++++ dists/gph/gp2x/mmuhack/flush_uppermem_cache.h | 10 ++ dists/gph/gp2x/mmuhack/flush_uppermem_cache.s | 5 + dists/gph/gp2x/mmuhack/mmuhack.c | 126 ++++++++++++++++++++++++++ dists/gph/gp2x/mmuhack/mmuhack.o | Bin 0 -> 1720 bytes dists/gph/gp2x/scummvm.gpe | 18 ++++ dists/gph/gp2xwiz/scummvm-gdb.gpe | 16 ++++ dists/gph/gp2xwiz/scummvm.gpe | 15 +++ dists/gph/scummvm.ini | 5 + dists/gph/scummvm.ini.in | 5 + dists/gph/scummvm.png | Bin 0 -> 2656 bytes dists/gph/scummvmb.png | Bin 0 -> 34274 bytes 17 files changed, 480 insertions(+) create mode 100644 dists/gph/README-GPH create mode 100644 dists/gph/README-GPH.in create mode 100644 dists/gph/caanoo/scummvm-gdb.gpe create mode 100644 dists/gph/caanoo/scummvm.gpe create mode 100644 dists/gph/gp2x/mmuhack/Makefile create mode 100644 dists/gph/gp2x/mmuhack/README create mode 100644 dists/gph/gp2x/mmuhack/flush_uppermem_cache.h create mode 100644 dists/gph/gp2x/mmuhack/flush_uppermem_cache.s create mode 100644 dists/gph/gp2x/mmuhack/mmuhack.c create mode 100644 dists/gph/gp2x/mmuhack/mmuhack.o create mode 100644 dists/gph/gp2x/scummvm.gpe create mode 100644 dists/gph/gp2xwiz/scummvm-gdb.gpe create mode 100644 dists/gph/gp2xwiz/scummvm.gpe create mode 100644 dists/gph/scummvm.ini create mode 100644 dists/gph/scummvm.ini.in create mode 100644 dists/gph/scummvm.png create mode 100644 dists/gph/scummvmb.png (limited to 'dists/gph') diff --git a/dists/gph/README-GPH b/dists/gph/README-GPH new file mode 100644 index 0000000000..29f0175306 --- /dev/null +++ b/dists/gph/README-GPH @@ -0,0 +1,61 @@ +ScummVM 1.5.0git - GPH DEVICE SPECIFIC README + +------------------------------------------------------------------------ + +Contents: + + * About the backend/port <#About_the_backendport> + * Supported audio options <#Supported_audio_options> + * Credits <#Credits> + +------------------------------------------------------------------------ + +Please refer to the: + +GPH ScummVM Forum: + +WiKi: (Select your device) + + + + + +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 official GPH ScummVM backend (also known as +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 +people be directed to http://scummvm.distant-earth.com/ instead for +updated SVN builds. + +Fully supported official releases of the GPH ScummVM backend are made in +line with main official releases and are avalalble from the ScummVM +downloads page for the GP2X, +GP2XWiz and Caanoo. + +------------------------------------------------------------------------ +Supported audio options + +Raw audio. +MP3 audio. +OGG Vorbis audio. + +FLAC audio is currently unsupported. + +For best results use uncompressed audio in games. + +------------------------------------------------------------------------ +Credits + +Core ScummVM code (c) The ScummVM Team +Portions of the GPH backend (c) John Willis +Detailed (c) information can be found within the source code diff --git a/dists/gph/README-GPH.in b/dists/gph/README-GPH.in new file mode 100644 index 0000000000..31ec3e4041 --- /dev/null +++ b/dists/gph/README-GPH.in @@ -0,0 +1,61 @@ +ScummVM @VERSION@ - GPH DEVICE SPECIFIC README + +------------------------------------------------------------------------ + +Contents: + + * About the backend/port <#About_the_backendport> + * Supported audio options <#Supported_audio_options> + * Credits <#Credits> + +------------------------------------------------------------------------ + +Please refer to the: + +GPH ScummVM Forum: + +WiKi: (Select your device) + + + + + +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 official GPH ScummVM backend (also known as +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 +people be directed to http://scummvm.distant-earth.com/ instead for +updated SVN builds. + +Fully supported official releases of the GPH ScummVM backend are made in +line with main official releases and are avalalble from the ScummVM +downloads page for the GP2X, +GP2XWiz and Caanoo. + +------------------------------------------------------------------------ +Supported audio options + +Raw audio. +MP3 audio. +OGG Vorbis audio. + +FLAC audio is currently unsupported. + +For best results use uncompressed audio in games. + +------------------------------------------------------------------------ +Credits + +Core ScummVM code (c) The ScummVM Team +Portions of the GPH backend (c) John Willis +Detailed (c) information can be found within the source code diff --git a/dists/gph/caanoo/scummvm-gdb.gpe b/dists/gph/caanoo/scummvm-gdb.gpe new file mode 100644 index 0000000000..63ce193ca8 --- /dev/null +++ b/dists/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.gph --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/dists/gph/caanoo/scummvm.gpe b/dists/gph/caanoo/scummvm.gpe new file mode 100644 index 0000000000..37d0f65d18 --- /dev/null +++ b/dists/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.gph --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/dists/gph/gp2x/mmuhack/Makefile b/dists/gph/gp2x/mmuhack/Makefile new file mode 100644 index 0000000000..a35d5c2a98 --- /dev/null +++ b/dists/gph/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/dists/gph/gp2x/mmuhack/README b/dists/gph/gp2x/mmuhack/README new file mode 100644 index 0000000000..6db7d81845 --- /dev/null +++ b/dists/gph/gp2x/mmuhack/README @@ -0,0 +1,116 @@ +PLEASE NOTE: + +The binary object 'mmuhack.o' is stored in the source tree as it is very awkward to +build it manually each time and would require the use of 2 toolchains to do so. + +Notes on how to rebuild from the included source can be found below. + +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/dists/gph/gp2x/mmuhack/flush_uppermem_cache.h b/dists/gph/gp2x/mmuhack/flush_uppermem_cache.h new file mode 100644 index 0000000000..d01548e474 --- /dev/null +++ b/dists/gph/gp2x/mmuhack/flush_uppermem_cache.h @@ -0,0 +1,10 @@ +#ifdef __cplusplus +extern "C" +{ +#endif + +void flush_uppermem_cache(void *start_address, void *end_address, int flags); + +#ifdef __cplusplus +} +#endif diff --git a/dists/gph/gp2x/mmuhack/flush_uppermem_cache.s b/dists/gph/gp2x/mmuhack/flush_uppermem_cache.s new file mode 100644 index 0000000000..265908e1fd --- /dev/null +++ b/dists/gph/gp2x/mmuhack/flush_uppermem_cache.s @@ -0,0 +1,5 @@ +.global flush_uppermem_cache @ void *start_address, void *end_address, int flags + +flush_uppermem_cache: + swi #0x9f0002 + bx lr diff --git a/dists/gph/gp2x/mmuhack/mmuhack.c b/dists/gph/gp2x/mmuhack/mmuhack.c new file mode 100644 index 0000000000..2e38bdb284 --- /dev/null +++ b/dists/gph/gp2x/mmuhack/mmuhack.c @@ -0,0 +1,126 @@ +/* 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. + * + */ + +#include +#include +#include +#include +#include +#include + +#define MMUHACK_MINOR 225 +#define DEVICE_NAME "mmuhack" + +#if __GNUC__ == 3 +#include +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/dists/gph/gp2x/mmuhack/mmuhack.o b/dists/gph/gp2x/mmuhack/mmuhack.o new file mode 100644 index 0000000000..475f4a54ae Binary files /dev/null and b/dists/gph/gp2x/mmuhack/mmuhack.o differ diff --git a/dists/gph/gp2x/scummvm.gpe b/dists/gph/gp2x/scummvm.gpe new file mode 100644 index 0000000000..51a49f7560 --- /dev/null +++ b/dists/gph/gp2x/scummvm.gpe @@ -0,0 +1,18 @@ +#!/bin/sh + +# 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 --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/dists/gph/gp2xwiz/scummvm-gdb.gpe b/dists/gph/gp2xwiz/scummvm-gdb.gpe new file mode 100644 index 0000000000..63ce193ca8 --- /dev/null +++ b/dists/gph/gp2xwiz/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.gph --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/dists/gph/gp2xwiz/scummvm.gpe b/dists/gph/gp2xwiz/scummvm.gpe new file mode 100644 index 0000000000..59ff562aeb --- /dev/null +++ b/dists/gph/gp2xwiz/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.gph --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/dists/gph/scummvm.ini b/dists/gph/scummvm.ini new file mode 100644 index 0000000000..952cd0de24 --- /dev/null +++ b/dists/gph/scummvm.ini @@ -0,0 +1,5 @@ +[info] +name="ScummVM 1.5.0git" +path="/scummvm/scummvm.gpe" +icon="/scummvm/scummvm.png" +title="/scummvm/scummvmb.png" diff --git a/dists/gph/scummvm.ini.in b/dists/gph/scummvm.ini.in new file mode 100644 index 0000000000..1c80d97d8b --- /dev/null +++ b/dists/gph/scummvm.ini.in @@ -0,0 +1,5 @@ +[info] +name="ScummVM @VERSION@" +path="/scummvm/scummvm.gpe" +icon="/scummvm/scummvm.png" +title="/scummvm/scummvmb.png" diff --git a/dists/gph/scummvm.png b/dists/gph/scummvm.png new file mode 100644 index 0000000000..128e59efc4 Binary files /dev/null and b/dists/gph/scummvm.png differ diff --git a/dists/gph/scummvmb.png b/dists/gph/scummvmb.png new file mode 100644 index 0000000000..24a27bc0e1 Binary files /dev/null and b/dists/gph/scummvmb.png differ -- cgit v1.2.3