diff options
Diffstat (limited to 'backends/platform')
41 files changed, 1011 insertions, 590 deletions
diff --git a/backends/platform/dc/dreamcast.mk b/backends/platform/dc/dreamcast.mk index c33867b7f4..cd0d4748bd 100644 --- a/backends/platform/dc/dreamcast.mk +++ b/backends/platform/dc/dreamcast.mk @@ -6,8 +6,7 @@ ronindir = /usr/local/ronin CC := $(CXX) ASFLAGS := $(CXXFLAGS) - -dist : SCUMMVM.BIN plugin_dist +dist : SCUMMVM.BIN IP.BIN plugin_dist plugin_dist : plugins @[ -z "$(PLUGINS)" ] || for p in $(or $(PLUGINS),none); do \ @@ -24,4 +23,12 @@ SCUMMVM.BIN : scummvm.bin scummvm.bin : scummvm.elf sh-elf-objcopy -S -R .stack -O binary $< $@ +IP.BIN : ip.txt + makeip $< $@ + +ip.txt : $(srcdir)/backends/platform/dc/ip.txt.in + if [ x"$(VER_EXTRA)" = xsvn ]; then \ + if [ -z "$(VER_SVNREV)" ]; then ver="SVN"; else ver="r$(VER_SVNREV)"; fi; \ + else ver="V$(VERSION)"; fi; \ + sed -e 's/[@]VERSION[@]/'"$$ver"/ -e 's/[@]DATE[@]/$(shell date '+%Y%m%d')/' < $< > $@ diff --git a/backends/platform/dc/ip.txt.in b/backends/platform/dc/ip.txt.in new file mode 100644 index 0000000000..23424e0950 --- /dev/null +++ b/backends/platform/dc/ip.txt.in @@ -0,0 +1,11 @@ +Hardware ID : SEGA SEGAKATANA +Maker ID : SEGA ENTERPRISES +Device Info : 0000 CD-ROM1/1 +Area Symbols : JUE +Peripherals : E000F10 +Product No : T0000 +Version : @VERSION@ +Release Date : @DATE@ +Boot Filename : SCUMMVM.BIN +SW Maker Name : The ScummVM team +Game Title : ScummVM diff --git a/backends/platform/ds/arm9/source/fat/disc_io.h b/backends/platform/ds/arm9/source/fat/disc_io.h index d9a3c67353..0fc83a7493 100644 --- a/backends/platform/ds/arm9/source/fat/disc_io.h +++ b/backends/platform/ds/arm9/source/fat/disc_io.h @@ -64,7 +64,7 @@ #endif #ifdef NDS - #include <nds/jtypes.h> + #include <nds/ndstypes.h> #else #include "gba_types.h" #endif diff --git a/backends/platform/ds/arm9/source/fat/gba_nds_fat.h b/backends/platform/ds/arm9/source/fat/gba_nds_fat.h index f9746560e0..dd5c8ba85f 100644 --- a/backends/platform/ds/arm9/source/fat/gba_nds_fat.h +++ b/backends/platform/ds/arm9/source/fat/gba_nds_fat.h @@ -47,7 +47,7 @@ #endif #ifdef NDS - #include <nds/jtypes.h> + #include <nds/ndstypes.h> #else #include "gba_types.h" #endif diff --git a/backends/platform/ds/arm9/source/portdefs.h b/backends/platform/ds/arm9/source/portdefs.h index 7f22709206..560bd8ab4b 100644 --- a/backends/platform/ds/arm9/source/portdefs.h +++ b/backends/platform/ds/arm9/source/portdefs.h @@ -36,7 +36,7 @@ typedef unsigned int u32; typedef signed int s32; */ -#include "nds/jtypes.h" +#include "nds/ndstypes.h" // Somebody removed these from scummsys.h, but they're still required, so I'm adding them here diff --git a/backends/platform/ds/commoninclude/NDS/scummvm_ipc.h b/backends/platform/ds/commoninclude/NDS/scummvm_ipc.h index 743d158d34..9344be68f9 100644 --- a/backends/platform/ds/commoninclude/NDS/scummvm_ipc.h +++ b/backends/platform/ds/commoninclude/NDS/scummvm_ipc.h @@ -27,7 +27,7 @@ ////////////////////////////////////////////////////////////////////// -#include <nds/jtypes.h> +#include <nds/ndstypes.h> #include <nds/ipc.h> ////////////////////////////////////////////////////////////////////// diff --git a/backends/platform/ds/ds.mk b/backends/platform/ds/ds.mk new file mode 100644 index 0000000000..aeba1820c6 --- /dev/null +++ b/backends/platform/ds/ds.mk @@ -0,0 +1,111 @@ +# Repeat "all" target here, to make sure it is the first target +# Currently disabled, so only arm7.bin gets build +#all: + + + +# Files in this list will be optimisied for speed, otherwise they will be optimised for space +OPTLIST := actor.cpp ds_main.cpp osystem_ds.cpp blitters.cpp fmopl.cpp rate.cpp isomap.cpp image.cpp gfx.cpp sprite.cpp actor_path.cpp actor_walk.cpp +#OPTLIST := + +# Compiler options for files which should be optimised for speed +OPT_SPEED := -O3 + +# Compiler options for files which should be optimised for space +OPT_SIZE := -Os -mthumb + + +#-mthumb -fno-gcse -fno-schedule-insns2 + + +OBJS := $(DATA_OBJS) $(LIBCARTRESET_OBJS) $(PORT_OBJS) $(COMPRESSOR_OBJS) $(FAT_OBJS) + + +# TODO: Handle files in OPTLIST. +# For this, the list should be made explicit. So, replace actor.cpp by path/to/actor.cpp -- +# in fact, there are several actor.cpp files, and right now all are "optimized", but +# I think Neil only had the SAGA one in mind. Same for gfx.cpp + + + + + + +############################################################################# +############################################################################# +############################################################################# + + +#ndsdir = $(srcdir)/backends/platform/ds +ndsdir = backends/platform/ds + +############################################################################# +# +# ARM7 rules. +# For ARM7 files, we need different compiler flags, which leads to the +# extra rules for .o files below +# +############################################################################# + +$(ndsdir)/arm7/arm7.bin: $(ndsdir)/arm7/arm7.elf + +$(ndsdir)/arm7/arm7.elf: \ + $(ndsdir)/arm7/source/libcartreset/cartreset.o \ + $(ndsdir)/arm7/source/main.o + +# HACK/FIXME: C compiler, for cartreset.c -- we should switch this to use CXX +# as soon as possible. +CC := $(DEVKITARM)/bin/arm-eabi-gcc + +# HACK/TODO: Pointer to objcopy. This should really be set by configure +OBJCOPY := $(DEVKITARM)/bin/arm-eabi-objcopy + +# +# Set various flags +# +ARM7_ARCH := -mthumb-interwork + +# note: arm9tdmi isn't the correct CPU arch, but anything newer and LD +# *insists* it has a FPU or VFP, and it won't take no for an answer! +ARM7_CFLAGS := -g -Wall -O2\ + -mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer\ + -ffast-math \ + $(ARM7_ARCH) \ + -I$(srcdir)/$(ndsdir)/arm7/source/libcartreset \ + -I$(srcdir)/$(ndsdir)/commoninclude \ + -I$(DEVKITPRO)/libnds/include \ + -I$(DEVKITPRO)/libnds/include/nds \ + -DARM7 + +ARM7_CXXFLAGS := $(ARM7_CFLAGS) -fno-exceptions -fno-rtti + +ARM7_LDFLAGS := -g $(ARM7_ARCH) -mno-fpu + +# HACK/FIXME: Define a custom build rule for cartreset.c. +# We do this because it is a .c file, not a .cpp file and so is outside our +# regular build system anyway. But this is *bad*. It should be changed into a +# .cpp file and this rule be removed. +%.o: %.c + $(MKDIR) $(*D)/$(DEPDIR) + $(CC) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o + + +# Set custom build flags for cartreset.o +$(ndsdir)/arm7/source/libcartreset/cartreset.o: CXXFLAGS=$(ARM7_CFLAGS) +$(ndsdir)/arm7/source/libcartreset/cartreset.o: CPPFLAGS= + +# Set custom build flags for main.o +$(ndsdir)/arm7/source/main.o: CXXFLAGS=$(ARM7_CXXFLAGS) +$(ndsdir)/arm7/source/main.o: CPPFLAGS= + +# Rule for creating ARM7 .bin files from .elf files +%.bin: %.elf + @echo ------ + @echo Building $@... + $(OBJCOPY) -O binary $< $@ + +# Rule for creating ARM7 .elf files by linking .o files together with a special linker script +%.elf: + @echo ------ + @echo Building $@... + $(CXX) $(ARM7_LDFLAGS) -specs=ds_arm7.specs $+ -L/opt/devkitPro/libnds/lib -lnds7 -o $@ diff --git a/backends/platform/ds/module.mk b/backends/platform/ds/module.mk new file mode 100644 index 0000000000..16630dc070 --- /dev/null +++ b/backends/platform/ds/module.mk @@ -0,0 +1,71 @@ +MODULE := backends/platform/ds + +ARM7_MODULE_OBJS := \ + arm7/source/main.o \ + arm7/source/libcartreset/cartreset.o \ + +PORT_OBJS := \ + arm9/source/blitters_arm.o \ + arm9/source/cdaudio.o \ + arm9/source/dsmain.o \ + ../../fs/ds/ds-fs.o \ + arm9/source/gbampsave.o \ + arm9/source/scummhelp.o \ + arm9/source/osystem_ds.o \ + arm9/source/portdefs.o \ + arm9/source/ramsave.o \ + arm9/source/touchkeyboard.o \ + arm9/source/zipreader.o \ + arm9/source/dsoptions.o \ + arm9/source/keys.o \ + arm9/source/wordcompletion.o \ + arm9/source/interrupt.o + +ifdef USE_PROFILER + PORT_OBJS += arm9/source/profiler/cyg-profile.o +endif + +DATA_OBJS := \ + arm9/data/icons.o \ + arm9/data/keyboard.o \ + arm9/data/keyboard_pal.o \ + arm9/data/default_font.o \ + arm9/data/8x8font_tga.o + +COMPRESSOR_OBJS := #arm9/source/compressor/lz.o + +FAT_OBJS := arm9/source/fat/disc_io.o arm9/source/fat/gba_nds_fat.o\ + arm9/source/fat/io_fcsr.o \ + arm9/source/fat/io_m3cf.o \ + arm9/source/fat/io_mpcf.o \ + arm9/source/fat/io_sccf.o \ + arm9/source/fat/io_m3sd.o \ + arm9/source/fat/io_nmmc.o \ + arm9/source/fat/io_scsd.o \ + arm9/source/fat/io_scsd_asm.o \ + arm9/source/fat/io_njsd.o \ + arm9/source/fat/io_mmcf.o \ + arm9/source/fat/io_sd_common.o \ + arm9/source/fat/io_m3_common.o \ + arm9/source/fat/io_dldi.o \ + arm9/source/fat/m3sd.o + + +# arm9/source/fat/io_cf_common.o arm9/source/fat/io_m3_common.o\ +# arm9/source/fat/io_sd_common.o arm9/source/fat/io_scsd_s.o \ +# arm9/source/fat/io_sc_common.o arm9/source/fat/io_sd_common.o + +LIBCARTRESET_OBJS := + #arm9/source/libcartreset/cartreset.o + + +MODULE_OBJS := + + + +# TODO: Should add more dirs to MODULE_DIRS so that "make distclean" can remove .deps dirs. +MODULE_DIRS += \ + backends/platform/ds/ + +# We don't use the rules.mk here on purpose +OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) diff --git a/backends/platform/gp2x/build/README-GP2X b/backends/platform/gp2x/build/README-GP2X index 7e10fc484e..f95a974230 100644 --- a/backends/platform/gp2x/build/README-GP2X +++ b/backends/platform/gp2x/build/README-GP2X @@ -12,10 +12,19 @@ Contents: * How to save <#How_to_save> * Controller mappings <#Controller_mappings> * Know issues <#Know_issues> - * Major TODO's <#Major_TODOs> + * TODO's <#Major_TODOs> * Additional resources/links <#Additional_resourceslinks> * Credits <#Credits> +------------------------------------------------------------------------ + +Please refer to the: + +GP2X/GP2XWiz ScummVM Forum: <http://forums.scummvm.org/viewforum.php?f=14> +WiKi: <http://wiki.scummvm.org/index.php/GP2X> + +for the most current information on the port and any updates to this +documentation. ------------------------------------------------------------------------ About the backend/port @@ -58,22 +67,6 @@ 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. - * Scumm - (All games supported by ScummVM should work to some - extent, using the hardware scalar if needed) - * AGOS (AKA Simon) - (Simon the Sorcerer one and two). - * Sky - (Beneath a Steel Sky) - * Sword - (Broken Sword 1) - This engine uses the hardware scalar to - downsize the graphics to fix on the GP2X. It is NOT very nice to - look at. - * Sword2 - (Broken Sword 2) - This engine uses the hardware scalar - to downsize the graphics to fix on the GP2X. It is NOT very nice - to look at. - * Gob - (Goblins one) - * Queen - (Flight of the Amazon Queen) - * Kyra - (The Legend of Kyrandia) - -All other game engines are disabled in this release. - ------------------------------------------------------------------------ Supported audio options @@ -169,16 +162,10 @@ It happens very infrequently, both times it was in the DOTT CD intro. Saving often is never a bad idea anyhow. ------------------------------------------------------------------------ -Major TODO's +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. -Look into inconsistencies with AGOS engine and map Y key to a button -combination to allow clean quitting (Simon 1/2). -Add splash-screen and pre-ScummVM config menu (CPU speed, LCD timings -etc.) - Partly done. -Fix TV out, maybe make it an option in the pre-ScummVM config menu. -Any help appreciated :). ------------------------------------------------------------------------ Additional resources/links @@ -186,7 +173,7 @@ Additional resources/links * ScummVM WiKi GP2X page <http://wiki.scummvm.org/index.php/GP2X> * ScummVM forums GP2X forum <http://forums.scummvm.org/viewforum.php?f=14> - * My own ScummVM page <http://www.distant-earth.com/scummvm> (for + * My own ScummVM page <http://scummvm.distant-earth.com/> (for SVN/test builds) * Main ScummVM site <http://www.scummvm.org> (for official supported release builds) @@ -197,4 +184,3 @@ Credits Core ScummVM code (c) The ScummVM Team Portions of the GP2X backend (c) John Willis Detailed (c) information can be found within the source code - diff --git a/backends/platform/gp2x/build/README-GP2X.html b/backends/platform/gp2x/build/README-GP2X.html deleted file mode 100644 index 1b5f1a4173..0000000000 --- a/backends/platform/gp2x/build/README-GP2X.html +++ /dev/null @@ -1,369 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<html> -<head> - <title>ScummVM - GP2X SPECIFIC README</title> - - -</head> - - -<body> - -<span style="font-weight: bold;">ScummVM - -GP2X SPECIFIC README - HEAD SVN<br> - -</span> -<hr style="width: 100%; height: 2px;"><br> - -<span style="font-weight: bold;">Contents:</span><br> - -<ul> - - <li><a href="#About_the_backendport">About the -backend/port</a></li> - - <li><a href="#Game_compatibility">Game -compatability</a></li> - - <li><a href="#Included_engines">Included engines</a></li> - - <li><a href="#Supported_audio_options">Supported -audio options</a></li> - - <li><a href="#Supported_cut-scene_options">Supported -cut-scene options</a></li> - - <li><a href="#Recent_changes">Recent changes</a></li> - - <li><a href="#How_to_save">How to save</a></li> - - <li><a href="#Controller_mappings">Controller -mappings</a></li> - - <li><a href="#Know_issues">Know issues</a></li> - - <li><a href="#Major_TODOs">Major TODO's</a></li> - - <li><a href="#Additional_resourceslinks">Additional -resources/links</a></li> - - <li><a href="#Credits">Credits</a></li> - -</ul> - -<br> - -<hr style="width: 100%; height: 2px;"><a style="font-weight: bold;" name="About_the_backendport"></a><span style="font-weight: bold;">About the backend/port</span><br> - -<br> - -This is the readme for the offficial GP2X ScummVM backend (also known -as the GP2X port).<br> - -<br> - -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 <a href="http://www.distant-earth.com/scummvm">http://www.distant-earth.com/scummvm</a> -instead for updated SVN builds.<br> - -<br> - -Full supported official releases of the GP2X ScummVM backend are made -in line with main official releases and are avalalble from the <a href="http://www.scummvm.org/downloads.php">ScummVM -downloads page</a>.<br> - -<br> - -This build is in an active state of development and as such no -‘expected’ behavior can be guaranteed ;).<br> - -<br> - -SVN builds are quickly tested with firmware 2.0.0 for reference.<br> - -<br> - -Please refer to the <a href="http://forums.scummvm.org/viewforum.php?f=14">GP2X -ScummVM forum</a> and <a href="http://wiki.scummvm.org/index.php/GP2X">WiKi</a> -for the latest information on the port.<br> - -<br> - -<hr style="width: 100%; height: 2px;"><a style="font-weight: bold;" name="Game_compatibility"></a><span style="font-weight: bold;">Game compatibility</span><br> - -<br> - -For information on the compatability of a specific game please refer to -the <a href="http://wiki.scummvm.org/index.php/GP2X#Compatibility_List">GP2X -compatability section of the ScummVM WiKi</a>.<br> - -<br> - -Please note the version and date of the ScummVM build you are running -when reviewing the above list.<br> - -<br> - -<hr style="width: 100%; height: 2px;"><a style="font-weight: bold;" name="Included_engines"></a><span style="font-weight: bold;">Included engines</span><br> - -<br> - -Just because an engine is included does not mean any/all of its games -are supported. Please check game compatability for more infomation.<br> - -<ul> - - <li>Scumm - (All games supported by ScummVM should work to some -extent, using the hardware scalar if needed)</li> - - <li>AGOS (AKA Simon) - (Simon the Sorcerer one and two).</li> - - <li>Sky - (Beneath a Steel Sky)</li> - - <li>Sword - (Broken Sword 1) - This engine uses the hardware -scalar to -downsize the graphics to fix on the GP2X. It is NOT very nice to look -at.</li> - - <li>Sword2 - (Broken Sword 2) - This engine uses the hardware -scalar to downsize the graphics to fix on the GP2X. It is NOT very nice -to look at.</li> - - <li>Gob - (Goblins one)</li> - - <li>Queen - (Flight of the Amazon Queen)</li> - - <li>Kyra - (The Legend of Kyrandia)</li> - -</ul> - -All other game engines are disabled in this release.<br> - -<br style="font-weight: bold;"> - -<hr style="width: 100%; height: 2px;"><a style="font-weight: bold;" name="Supported_audio_options"></a><span style="font-weight: bold;">Supported audio options</span><br> - -<br> - -Raw audio.<br> - -MP3 audio.<br> - -OGG Vorbis audio.<br> - -<br> - -FLAC audio is currently unsupported.<br> - -<br> - -For best results use uncompressed audio in games.<br> - -<br> - -<hr style="width: 100%; height: 2px;"><a style="font-weight: bold;" name="Supported_cut-scene_options"></a><span style="font-weight: bold;">Supported cut-scene options</span><br> - -<br> - -No cut scene compression options are currently supported. <br> - -<br> - -DXA video support will be added as soon as it is stable.<br> - -<br> - -<hr style="width: 100%; height: 2px;"><a style="font-weight: bold;" name="Recent_changes"></a><span style="font-weight: bold;">Recent changes<br> - -<br> - -</span>Refined audio hacks to reduce audio delay a little more.<br> - -Enabled hardware scalar code.<br> - -Now built using SDL 1.2.9 for the parts of the port that use SDL (some -parts now hit the hardware directly).<br> - -Enabled new launcher - (Ensure defaulttheme.zip is in the same folder -as the executable).<br> - -Aspect Ratio Correction can now be disabled ‘per -game’. When adding a game you can find this option on the GFX -tab. <br> - -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.<br> - -<br> - -<hr style="width: 100%; height: 2px;"><a style="font-weight: bold;" name="How_to_save"></a><span style="font-weight: bold;">How to save</span><br> - -<br> - -<span style="font-weight: bold;">NOTE:</span> -Everything is saved to the SD card, saves are stored in the <span style="font-weight: bold;">saves</span> folder under -your main ScummVM executable unless you set another save location.<br> - -<br> - -The configiration file for ScummVM (.scummvmrc) is stored in the -same place as the ScummVM executable.<br> - -<br> - -The save process below is for Scumm engine games but the -principle is the same for all.<br> - -<br> - -In Game.<br> - -<br> - -1. Right Trigger<br> - -2. Select SAVE with B<br> - -3. Select a position with B<br> - -4. Right trigger puts ? in the name box for some text.<br> - -5. Press B to save<br> - -<br> - -Basically the emulated keys you can use are equivelent to the values -buttons are mapped to, <br> - -<br> - -I have a virtual keyboard like the GP32 one (left/right on the stick to -pick chars) to add in at some point ;-)<br> - -<br> - -<hr style="width: 100%; height: 2px;"><a style="font-weight: bold;" name="Controller_mappings"></a><span style="font-weight: bold;">Controller mappings</span><br> - -<br> - -<span style="font-weight: bold;">Mouse emulation:</span><br> - -<br> - -Stick: Move Pointer<br> - -Stick Click: ‘light’ Left Click<br> - -B: Left click<br> - -X: Right click<br> - -<br> - -<span style="font-weight: bold;">Keyboard emulation:</span><br> - -<br> - -Start: Return<br> - -Select: Escape<br> - -Y: Space Bar (Pause)<br> - -Right Trigger: Game Menu (Save, Load, Quit etc.)<br> - -Volume Buttons: Increase and Decrease volume (5% per press)<br> - -<br> - -<span style="font-weight: bold;">Fancy button combos:</span><br> - -<br> - -NOTE: To use button combos press and hold the Left Trigger then...<br> - -<br> - -Y: Toggle "zoom" mode - Try it in larger games like Broken Sword.<br> - -Volume Buttons: Increase and Decrease subtitle speed (In SCUMM games)<br> - -Right Trigger: 0 (For skipping the copy protection in Monkey Island 2)<br> - -Select: Exit ScummVM completely (and gracefully)<br> - -<br> - -<hr style="width: 100%; height: 2px;"><a style="font-weight: bold;" name="Know_issues"></a><span style="font-weight: bold;">Know issues</span><br> - -<br> - -Possible random crash (well SegFault). I have had this happen twice and -have not tracked down the cause. <br> - -It happens very infrequently, both times it was in the DOTT CD intro. -Saving often is never a bad idea anyhow.<br> - -<br> - -<hr style="width: 100%; height: 2px;"><a style="font-weight: bold;" name="Major_TODOs"></a><span style="font-weight: bold;">Major TODO's</span><br> - -<br> - -Fix save support when using the Sky engine (Beneath a Steel Sky) - You -CAN'T save at the moment but auto save works.<br> - -Look into inconsistencies with AGOS engine and map Y key to a button -combination to allow clean quitting (Simon 1/2).<br> - -Add splash-screen and pre-ScummVM config menu (CPU speed, LCD timings -etc.) - Partly done.<br> - -Fix TV out, maybe make it an option in the pre-ScummVM config menu.<br> - -Any help appreciated :).<br> - -<br style="font-weight: bold;"> - -<hr style="width: 100%; height: 2px;"><a style="font-weight: bold;" name="Additional_resourceslinks"></a><span style="font-weight: bold;">Additional resources/links<br> - -<br> - -</span><span style="font-weight: bold;">Note:</span> -When providing feedback, -requests, forum posts, bug reports or anything like that always include -a mention of the version of ScummVM you are using (the build version, -date and time can be seen in the main game launcher window).<br> - -<ul> - - <li><a href="http://wiki.scummvm.org/index.php/GP2X">ScummVM -WiKi GP2X page</a></li> - - <li><a href="http://forums.scummvm.org/viewforum.php?f=14">ScummVM -forums GP2X forum</a></li> - - <li><a href="http://www.distant-earth.com/scummvm">My -own ScummVM page</a> (for SVN/test builds)</li> - - <li><a href="http://www.scummvm.org">Main ScummVM -site</a> (for official supported release builds)</li> - -</ul> - -<hr style="width: 100%; height: 2px;"><a style="font-weight: bold;" name="Credits"></a><span style="font-weight: bold;">Credits</span><br> - -<br> - -Core ScummVM code (c) The ScummVM Team<br> - -Portions of the GP2X backend (c) John Willis<br> - -Detailed (c) information can be found within the source code<br> - -<br> - -</body> -</html> diff --git a/backends/platform/gp2x/build/bundle.sh b/backends/platform/gp2x/build/bundle.sh index 560f096ed4..c68c62191b 100755 --- a/backends/platform/gp2x/build/bundle.sh +++ b/backends/platform/gp2x/build/bundle.sh @@ -19,7 +19,6 @@ echo "Please put your save games in this dir" >> "scummvm-gp2x-`date '+%Y-%m-%d' cp ./scummvm.gpe ./scummvm-gp2x-`date '+%Y-%m-%d'`/ cp ./scummvm.png ./scummvm-gp2x-`date '+%Y-%m-%d'`/ -cp ./README-GP2X.html ./scummvm-gp2x-`date '+%Y-%m-%d'`/ cp ./README-GP2X ./scummvm-gp2x-`date '+%Y-%m-%d'`/ cp ./mmuhack.o ./scummvm-gp2x-`date '+%Y-%m-%d'`/ cp ../../../../scummvm.gp2x ./scummvm-gp2x-`date '+%Y-%m-%d'`/ diff --git a/backends/platform/gp2x/build/config-alleng.sh b/backends/platform/gp2x/build/config-alleng.sh index 5724f39dc5..4a3526d50c 100755 --- a/backends/platform/gp2x/build/config-alleng.sh +++ b/backends/platform/gp2x/build/config-alleng.sh @@ -18,6 +18,6 @@ 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 +#--enable-plugins --default-dynamic echo Generating config for GP2X complete. Check for errors. diff --git a/backends/platform/gp2x/build/config.sh b/backends/platform/gp2x/build/config.sh index 55954d6231..2bc49564f7 100755 --- a/backends/platform/gp2x/build/config.sh +++ b/backends/platform/gp2x/build/config.sh @@ -18,6 +18,6 @@ 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 +#--enable-plugins --default-dynamic echo Generating config for GP2X complete. Check for errors. diff --git a/backends/platform/gp2x/events.cpp b/backends/platform/gp2x/events.cpp index 9a9a59765d..8cd034d2d5 100644 --- a/backends/platform/gp2x/events.cpp +++ b/backends/platform/gp2x/events.cpp @@ -35,7 +35,7 @@ #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 +// we should really allow users to map any key to a joystick button using the keymapper. #define JOY_DEADZONE 2200 #define JOY_XAXIS 0 @@ -273,7 +273,7 @@ bool OSystem_GP2X::pollEvent(Common::Event &event) { Combos: - GP2X_BUTTON_VOLUP & GP2X_BUTTON_VOLDOWN 0 (For Monkey 2 CP) + 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) @@ -434,29 +434,22 @@ bool OSystem_GP2X::pollEvent(Common::Event &event) { } break; case GP2X_BUTTON_VOLUP: - //if (GP2X_BUTTON_STATE_L == TRUE) { - // displayMessageOnOSD("Setting CPU Speed at 230MHz"); - // GP2X_setCpuspeed(200); - //event.kbd.keycode = Common::KEYCODE_PLUS; - //event.kbd.ascii = mapKey(SDLK_PLUS, ev.key.keysym.mod, 0); - //} else { - GP2X_mixer_move_volume(1); + GP2X_HW::mixerMoveVolume(2); + if (GP2X_HW::volumeLevel == 100) { + displayMessageOnOSD("Maximum Volume"); + } else { displayMessageOnOSD("Increasing Volume"); - //} + } break; case GP2X_BUTTON_VOLDOWN: - //if (GP2X_BUTTON_STATE_L == TRUE) { - // displayMessageOnOSD("Setting CPU Speed at 60MHz"); - // GP2X_setCpuspeed(60); - //event.kbd.keycode = Common::KEYCODE_MINUS; - //event.kbd.ascii = mapKey(SDLK_MINUS, ev.key.keysym.mod, 0); - //} else { - GP2X_mixer_move_volume(0); + GP2X_HW::mixerMoveVolume(1); + if (GP2X_HW::volumeLevel == 0) { + displayMessageOnOSD("Minimal Volume"); + } else { displayMessageOnOSD("Decreasing Volume"); - //} + } break; - } } return true; diff --git a/backends/platform/gp2x/gp2x-hw.cpp b/backends/platform/gp2x/gp2x-hw.cpp index fe02e029f7..38799ea7ad 100644 --- a/backends/platform/gp2x/gp2x-hw.cpp +++ b/backends/platform/gp2x/gp2x-hw.cpp @@ -48,6 +48,20 @@ #include <sys/time.h> #include <unistd.h> +namespace GP2X_HW { + +enum { + VOLUME_NOCHG = 0, + VOLUME_DOWN = 1, + VOLUME_UP = 2, + VOLUME_CHANGE_RATE = 8, + VOLUME_MIN = 0, + VOLUME_INITIAL = 70, + VOLUME_MAX = 100 +}; + +int volumeLevel = VOLUME_INITIAL; + /* system registers */ static struct { @@ -61,14 +75,14 @@ static volatile unsigned short *MEM_REG; #define SYS_CLK_FREQ 7372800 -void GP2X_device_init() { +void deviceInit() { // Open devices if (!gp2x_dev[0]) gp2x_dev[0] = open("/dev/mixer", O_RDWR); if (!gp2x_dev[1]) gp2x_dev[1] = open("/dev/batt", O_RDONLY); if (!gp2x_dev[2]) gp2x_dev[2] = open("/dev/mem", O_RDWR); } -void GP2X_device_deinit() { +void deviceDeinit() { // Close devices { int i; @@ -92,68 +106,35 @@ void GP2X_device_deinit() { unpatchMMU(); } -// Vairous mixer level fudges. -// TODO: Clean up and merge quick hacks. - -void GP2X_mixer_set_volume(int L /*0..100*/, int R /*0..100*/) { - - /* Set an arbitrary percentage value for the hardware mixer volume. - - Parameters: - L (0..100) - volume percentage for the left channel - R (0..100) - volume percentage for the right channel - - Note: - - A higher percentage than 100 will distort your sound. - */ - - unsigned char temp[4]; - - if (L < 0) L = 0; - if (L > GP2X_MAXVOL) L = GP2X_MAXVOL; - if (R < 0) R = 0; - if (R > GP2X_MAXVOL) R = GP2X_MAXVOL; - - temp[0]=(unsigned char)L; - temp[1]=(unsigned char)R; - temp[2]=temp[3]=0; - - //warning("GP2X_mixer_set_volume is about to set %d %d", L, R); - ioctl(gp2x_dev[0], SOUND_MIXER_WRITE_PCM, temp); -} - -int GP2X_mixer_get_volume() { - int vol; - ioctl(gp2x_dev[0], SOUND_MIXER_READ_PCM, &vol); - //warning("GP2X_mixer_get_volume returned %d %d", (int)((vol & 0xff)), (int)((vol >> 8) & 0xff)); - return (int)((vol & 0xff)); +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); + } } -void GP2X_mixer_move_volume(int UpDown) { - // Raise volume 5% if 1 passed, lower 5% if 0. - int curvol, newvol; - ioctl(gp2x_dev[0], SOUND_MIXER_READ_PCM, &curvol); - curvol = ((int)((curvol & 0xff))); - newvol = ((int)((curvol & 0xff))); - //warning("GP2X_mixer_move_volume got current volume @ %d", curvol); - if (UpDown == 1) { - newvol = (curvol + 5); - } else if (UpDown == 0) { - newvol = (curvol - 5); - } - //warning("GP2X_mixer_move_volume is about to set volume @ %d", newvol); - GP2X_mixer_set_volume(newvol, newvol); - return; -} - -void GP2X_setCpuspeed(unsigned int mhz) +void setCpuspeed(unsigned int mhz) { set_FCLK(mhz); set_DCLK_Div(0); set_920_Div(0); } -int GP2X_getBattLevel() { +int getBattLevel() { int devbatt; unsigned short currentval=0; devbatt = open("/dev/batt", O_RDONLY); @@ -213,3 +194,6 @@ void gp2x_video_wait_vsync(void) MEM_REG[0x2846>>1]=(MEM_REG[0x2846>>1] | 0x20) & ~2; while (!(MEM_REG[0x2846>>1] & 2)); } + +} /* namespace GP2X_HW */ + diff --git a/backends/platform/gp2x/gp2x-hw.h b/backends/platform/gp2x/gp2x-hw.h index 89ad1093e4..7e72812cc4 100644 --- a/backends/platform/gp2x/gp2x-hw.h +++ b/backends/platform/gp2x/gp2x-hw.h @@ -31,16 +31,18 @@ #ifndef GP2X_HW_H #define GP2X_HW_H +namespace GP2X_HW { + #define GP2X_MAXVOL 100 // Highest level permitted by GP2X's mixer #define SYS_CLK_FREQ 7372800 // Clock Frequency -extern void GP2X_device_init(); -extern void GP2X_device_deinit(); -extern void GP2X_mixer_set_volume(int, int); -extern int GP2X_mixer_get_volume(); -extern void GP2X_mixer_move_volume(int); -extern void GP2X_setCpuspeed(unsigned int cpuspeed); -extern int GP2X_getBattLevel(); +extern int volumeLevel; + +extern void deviceInit(); +extern void deviceDeinit(); +extern void mixerMoveVolume(int); +extern void setCpuspeed(unsigned int cpuspeed); +extern int getBattLevel(); extern void save_system_regs(void); /* save some registers */ extern void set_display_clock_div(unsigned div); @@ -50,4 +52,6 @@ extern void set_DCLK_Div(unsigned short div); /* 0 to 7 divider (freq=FCLK/(1+di extern void Disable_940(void); /* 940t down */ extern void gp2x_video_wait_vsync(void); +} /* namespace GP2X_HW */ + #endif //GP2X_HW_H diff --git a/backends/platform/gp2x/gp2x.cpp b/backends/platform/gp2x/gp2x.cpp index 15b5e19e5d..3d416f8415 100644 --- a/backends/platform/gp2x/gp2x.cpp +++ b/backends/platform/gp2x/gp2x.cpp @@ -34,6 +34,7 @@ #include "common/archive.h" #include "common/config-manager.h" #include "common/debug.h" +#include "common/EventRecorder.h" #include "common/events.h" #include "common/util.h" @@ -232,15 +233,16 @@ void OSystem_GP2X::initBackend() { // switch. Still, it's a potential future change to keep in mind. _timer = new DefaultTimerManager(); _timerID = SDL_AddTimer(10, &timer_handler, _timer); + } + + /* Initialise any GP2X specific stuff we may want (Batt Status, scaler etc.) */ + GP2X_HW::deviceInit(); - // Initialise any GP2X specific stuff we may want (Volume, Batt Status etc.) - GP2X_device_init(); + /* Set Default hardware mixer volume to a preset level (VOLUME_INITIAL). This is done to 'reset' volume level if set by other apps. */ + GP2X_HW::mixerMoveVolume(0); // Set Default hardware mixer volume to a plesent level. // This is done to 'reset' volume level if set by other apps. - GP2X_mixer_set_volume(70, 70); - - } //if (SDL_GP2X_MouseType() == 0) { // // No mouse, F100 default state. @@ -318,7 +320,7 @@ OSystem_GP2X::~OSystem_GP2X() { uint32 OSystem_GP2X::getMillis() { uint32 millis = SDL_GetTicks(); - getEventManager()->processMillis(millis); + g_eventRec.processMillis(millis); return millis; } @@ -446,8 +448,7 @@ void OSystem_GP2X::quit() { if (_joystick) SDL_JoystickClose(_joystick); - //CloseRam(); - GP2X_device_deinit(); + GP2X_HW::deviceDeinit(); SDL_RemoveTimer(_timerID); closeMixer(); diff --git a/backends/platform/gp2x/graphics.cpp b/backends/platform/gp2x/graphics.cpp index 775c3afb73..a77afd88b7 100644 --- a/backends/platform/gp2x/graphics.cpp +++ b/backends/platform/gp2x/graphics.cpp @@ -30,6 +30,7 @@ #include "backends/platform/gp2x/gp2x-common.h" #include "common/util.h" +#include "common/mutex.h" #include "graphics/font.h" #include "graphics/fontman.h" #include "graphics/scaler.h" diff --git a/backends/platform/gp2xwiz/build/README-GP2XWIZ b/backends/platform/gp2xwiz/build/README-GP2XWIZ index 95ac844a2c..ec8142a6f3 100644 --- a/backends/platform/gp2xwiz/build/README-GP2XWIZ +++ b/backends/platform/gp2xwiz/build/README-GP2XWIZ @@ -11,19 +11,27 @@ Contents: * Recent changes <#Recent_changes> * How to save <#How_to_save> * Controller mappings <#Controller_mappings> - * Know issues <#Know_issues> - * Major TODO's <#Major_TODOs> + * Known issues <#Knonw_issues> * Additional resources/links <#Additional_resourceslinks> * Credits <#Credits> +------------------------------------------------------------------------ + +Please refer to the: + +GP2X/GP2XWiz ScummVM Forum: <http://forums.scummvm.org/viewforum.php?f=14> +WiKi: <http://wiki.scummvm.org/index.php/GP2XWiz> + +for the most current information on the port and any updates to this +documentation. ------------------------------------------------------------------------ About the backend/port -This is the readme for the offficial GP2X WIZ ScummVM backend (also known as -the GP2X WIZ 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 GP2X WIZ, it would be +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. @@ -35,19 +43,12 @@ downloads page <http://www.scummvm.org/downloads.php>. 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 1.0.0 for reference. - -Please refer to the GP2X/GP2X WIZ ScummVM forum -<http://forums.scummvm.org/viewforum.php?f=14> and WiKi -<http://wiki.scummvm.org/index.php/GP2X> 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 -<http://wiki.scummvm.org/index.php/GP2X#Compatibility_List>. +the GP2XWiz compatability section of the ScummVM WiKi +<http://wiki.scummvm.org/index.php/GP2XWiz#Compatibility_List>. Please note the version and date of the ScummVM build you are running when reviewing the above list. @@ -105,22 +106,20 @@ Right Trigger: Return Select: Escape Y: Space Bar (Pause) Menu: Game Menu (Save, Load, Quit etc.) -Volume Buttons: Increase and Decrease volume (5% per press) +Volume Buttons: Increase and Decrease volume Fancy button combos: NOTE: To use button combos press and hold the Left Trigger then... -Right Trigger: 0 (For skipping the copy protection in Monkey Island 2) +Right Trigger: Display Virtual Keyboard Menu: Bring up the Global main menu for ScummVM Select: Exit ScummVM completely (and gracefully) ------------------------------------------------------------------------ -Know issues +Known 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. +No major known issues ------------------------------------------------------------------------ Additional resources/links @@ -128,7 +127,7 @@ Additional resources/links * ScummVM WiKi GP2X page <http://wiki.scummvm.org/index.php/GP2X> * ScummVM forums GP2X forum <http://forums.scummvm.org/viewforum.php?f=14> - * My own ScummVM page <http://www.distant-earth.com/scummvm> (for + * My own ScummVM page <http://scummvm.distant-earth.com/> (for SVN/test builds) * Main ScummVM site <http://www.scummvm.org> (for official supported release builds) diff --git a/backends/platform/gp2xwiz/build/bundle.sh b/backends/platform/gp2xwiz/build/bundle.sh index 506dfcb742..492ba9e1c6 100755 --- a/backends/platform/gp2xwiz/build/bundle.sh +++ b/backends/platform/gp2xwiz/build/bundle.sh @@ -8,6 +8,8 @@ mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm" mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/saves" mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/plugins" mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/engine-data" +mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/lib" + echo "Please put your save games in this dir" >> "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/saves/PUT_SAVES_IN_THIS_DIR" @@ -27,6 +29,13 @@ cp ../../../../dists/pred.dic ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ cp ../../../../dists/engine-data/* ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/engine-data cp ../../../../plugins/* ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/plugins +# Copy over dynamic libs needed by the app (as the ones in the default filesystem are broken). +f=`which arm-open2x-linux-g++` +loc=`dirname "$f"` +cp $loc/../lib/libz.so.1.2.3 ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/lib/libz.so.1 +cp $loc/../lib/libvorbisidec.so.1.0.2 ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/lib/libvorbisidec.so.1 + + echo Making Stripped exe. arm-open2x-linux-strip ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/scummvm.wiz diff --git a/backends/platform/gp2xwiz/build/scummvm.gpe b/backends/platform/gp2xwiz/build/scummvm.gpe index 037b81d937..42cc00a22a 100755 --- a/backends/platform/gp2xwiz/build/scummvm.gpe +++ b/backends/platform/gp2xwiz/build/scummvm.gpe @@ -1,5 +1,9 @@ #!/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 diff --git a/backends/platform/gp2xwiz/gp2xwiz-events.cpp b/backends/platform/gp2xwiz/gp2xwiz-events.cpp index dfb36742dc..48c9af00ff 100644 --- a/backends/platform/gp2xwiz/gp2xwiz-events.cpp +++ b/backends/platform/gp2xwiz/gp2xwiz-events.cpp @@ -81,8 +81,13 @@ static int mapKey(SDLKey key, SDLMod mod, Uint16 unicode) { } void OSystem_GP2XWIZ::fillMouseEvent(Common::Event &event, int x, int y) { - event.mouse.x = x; - event.mouse.y = 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; @@ -203,7 +208,7 @@ bool OSystem_GP2XWIZ::pollEvent(Common::Event &event) { Combos: - GP2X_BUTTON_VOLUP & GP2X_BUTTON_VOLDOWN 0 (For Monkey 2 CP) + 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) diff --git a/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp b/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp index 2482051286..90f2c821aa 100644 --- a/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp +++ b/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp @@ -24,10 +24,433 @@ */ #include "backends/platform/gp2xwiz/gp2xwiz-sdl.h" +#include "backends/platform/gp2xwiz/gp2xwiz-scaler.h" // TODO: Make GFX_HALF/HalfScale generic. +#include "common/mutex.h" +#include "graphics/font.h" +#include "graphics/fontman.h" +#include "graphics/scaler.h" +#include "graphics/scaler/intern.h" +#include "graphics/surface.h" -/* TODO: Add code to ensure that overlay is always 320*240 and maybe invoke some custom scale code. */ +static const OSystem::GraphicsMode s_supportedGraphicsModes[] = { + {"1x", "Fullscreen", GFX_NORMAL}, +// {"½x", "Downscale", GFX_HALF}, + {0, 0, 0} +}; + + +const OSystem::GraphicsMode *OSystem_GP2XWIZ::getSupportedGraphicsModes() const { + return s_supportedGraphicsModes; +} + +int OSystem_GP2XWIZ::getDefaultGraphicsMode() const { + return GFX_NORMAL; +} + +bool OSystem_GP2XWIZ::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_GP2XWIZ::setGraphicsModeIntern() { + Common::StackLock lock(_graphicsMutex); + ScalerProc *newScalerProc = 0; + + switch (_videoMode.mode) { + case GFX_NORMAL: + newScalerProc = Normal1x; + break; + case GFX_HALF: + newScalerProc = HalfScale; + 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_GP2XWIZ::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(); + } + + _cksumNum = (w * h / (8 * 8)); + + _transactionDetails.sizeChanged = true; + + free(_dirtyChecksums); + _dirtyChecksums = (uint32 *)calloc(_cksumNum * 2, sizeof(uint32)); +} bool OSystem_GP2XWIZ::loadGFXMode() { + _videoMode.overlayWidth = 320; + _videoMode.overlayHeight = 240; + _videoMode.fullscreen = true; + + if (_videoMode.screenHeight != 200 && _videoMode.screenHeight != 400) + _videoMode.aspectRatioCorrection = false; + OSystem_SDL::loadGFXMode(); } + +void OSystem_GP2XWIZ::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_GP2XWIZ::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_GP2XWIZ::internUpdateScreen() { + SDL_Surface *srcSurf, *origSurf; + int height, width; + ScalerProc *scalerProc; + int scale1; + +#if defined (DEBUG) && ! defined(_WIN32_WCE) // definitions not available for non-DEBUG here. (needed this to compile in SYMBIAN32 & linux?) + assert(_hwscreen != NULL); + assert(_hwscreen->map->sw_data != NULL); +#endif + + // If the shake position changed, fill the dirty area with blackness + if (_currentShakePos != _newShakePos) { + 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 == HalfScale){ + 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); + } + + if(_videoMode.mode == GFX_HALF && scalerProc == HalfScale){ + 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; + + +#ifndef DISABLE_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_GP2XWIZ::showOverlay() { + if(_videoMode.mode == GFX_HALF){ + _mouseCurState.x = _mouseCurState.x / 2; + _mouseCurState.y = _mouseCurState.y / 2; + } + OSystem_SDL::showOverlay(); +} + +void OSystem_GP2XWIZ::hideOverlay() { + if(_videoMode.mode == GFX_HALF){ + _mouseCurState.x = _mouseCurState.x * 2; + _mouseCurState.y = _mouseCurState.y * 2; + } + OSystem_SDL::hideOverlay(); +} + +void OSystem_GP2XWIZ::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 index 4d69915e27..4a86443aa7 100644 --- a/backends/platform/gp2xwiz/gp2xwiz-hw.cpp +++ b/backends/platform/gp2xwiz/gp2xwiz-hw.cpp @@ -48,7 +48,7 @@ enum { VOLUME_UP = 2, VOLUME_CHANGE_RATE = 8, VOLUME_MIN = 0, - VOLUME_INITIAL = 70, + VOLUME_INITIAL = 60, VOLUME_MAX = 100 }; diff --git a/backends/platform/gp2xwiz/gp2xwiz-main.cpp b/backends/platform/gp2xwiz/gp2xwiz-main.cpp index 4bd3f98211..394c3090c3 100644 --- a/backends/platform/gp2xwiz/gp2xwiz-main.cpp +++ b/backends/platform/gp2xwiz/gp2xwiz-main.cpp @@ -148,9 +148,9 @@ void OSystem_GP2XWIZ::initBackend() { WIZ_HW::mixerMoveVolume(0); /* Up default volume values as we use a seperate system level volume anyway. */ - ConfMan.registerDefault("music_volume", 220); - ConfMan.registerDefault("sfx_volume", 220); - ConfMan.registerDefault("speech_volume", 220); + 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); diff --git a/backends/platform/gp2xwiz/gp2xwiz-scaler.cpp b/backends/platform/gp2xwiz/gp2xwiz-scaler.cpp new file mode 100644 index 0000000000..3a95280eab --- /dev/null +++ b/backends/platform/gp2xwiz/gp2xwiz-scaler.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 "graphics/scaler/intern.h" +#include "backends/platform/gp2xwiz/gp2xwiz-sdl.h" + +SDL_PixelFormat *screenPixelFormat; + +extern "C" { + void PocketPCHalfARM(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height, int mask, int round); + // Rounding constants and masks used for different pixel formats + int roundingconstants[] = { 0x00200802, 0x00201002 }; + int redbluegreenMasks[] = { 0x03E07C1F, 0x07E0F81F }; +} + +void HalfScale(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) { + int maskUsed = (gBitFormat == 565); + PocketPCHalfARM(srcPtr, srcPitch, dstPtr, dstPitch, width, height, redbluegreenMasks[maskUsed],roundingconstants[maskUsed]); +} diff --git a/backends/platform/gp2xwiz/gp2xwiz-scaler.h b/backends/platform/gp2xwiz/gp2xwiz-scaler.h new file mode 100644 index 0000000000..5867693dfb --- /dev/null +++ b/backends/platform/gp2xwiz/gp2xwiz-scaler.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$ + * + */ + +#ifndef GP2XWIZ_SCALER_H +#define GP2XWIZ_SCALER_H + +#include "common/scummsys.h" +#include "common/system.h" +#include "graphics/scaler.h" +#include "graphics/scaler/intern.h" + +// FIXME: For now keep hacks in this header to save polluting the SDL backend. +enum { + GFX_HALF = 12 +}; + +// TODO/FIXME: Move this platform specific scaler into /graphics/scaler and properly merge with the WinCE PocketPCHalf that it is based on. +DECLARE_SCALER(HalfScale); + +#endif diff --git a/backends/platform/gp2xwiz/gp2xwiz-sdl.h b/backends/platform/gp2xwiz/gp2xwiz-sdl.h index 8811f86edf..1f67624d5c 100644 --- a/backends/platform/gp2xwiz/gp2xwiz-sdl.h +++ b/backends/platform/gp2xwiz/gp2xwiz-sdl.h @@ -27,6 +27,7 @@ #define GP2XWIZ_SDL_H #include "backends/platform/sdl/sdl.h" +#include "backends/platform/gp2xwiz/gp2xwiz-scaler.h" #include <SDL.h> @@ -42,12 +43,24 @@ public: OSystem_GP2XWIZ() {} /* Graphics */ - bool loadGFXMode(); + 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 */ bool pollEvent(Common::Event &event); void moveStick(); void fillMouseEvent(Common::Event&, int, int); + void warpMouse(int, int); bool remapKey(SDL_Event&, Common::Event&); /* Platform Setup Stuff */ diff --git a/backends/platform/gp2xwiz/module.mk b/backends/platform/gp2xwiz/module.mk index 03241f7b60..f2e27a7cce 100644 --- a/backends/platform/gp2xwiz/module.mk +++ b/backends/platform/gp2xwiz/module.mk @@ -1,6 +1,8 @@ MODULE := backends/platform/gp2xwiz MODULE_OBJS := \ + gp2xwiz-scaler.o \ + ../wince/ARMscaler.o \ gp2xwiz-graphics.o \ gp2xwiz-events.o \ gp2xwiz-hw.o \ diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp index 6d9f3fc6eb..8768dd90d4 100644 --- a/backends/platform/sdl/graphics.cpp +++ b/backends/platform/sdl/graphics.cpp @@ -481,7 +481,7 @@ bool OSystem_SDL::loadGFXMode() { int hwW, hwH; -#ifndef __MAEMO__ +#if !defined(__MAEMO__) && !defined(GP2XWIZ) _videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor; _videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor; @@ -804,7 +804,7 @@ void OSystem_SDL::internUpdateScreen() { for (r = _dirtyRectList; r != lastRect; ++r) { dst = *r; - dst.x++; // Shift rect by one since 2xSai needs to acces the data around + 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) diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 105206ec07..5abeff3902 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -33,7 +33,7 @@ #include "common/archive.h" #include "common/config-manager.h" #include "common/debug.h" -#include "common/events.h" +#include "common/EventRecorder.h" #include "common/util.h" #ifdef UNIX @@ -261,7 +261,7 @@ OSystem_SDL::~OSystem_SDL() { uint32 OSystem_SDL::getMillis() { uint32 millis = SDL_GetTicks(); - getEventManager()->processMillis(millis); + g_eventRec.processMillis(millis); return millis; } diff --git a/backends/platform/wince/CEActionsPocket.cpp b/backends/platform/wince/CEActionsPocket.cpp index 1f6eeb3770..45dbad12cc 100644 --- a/backends/platform/wince/CEActionsPocket.cpp +++ b/backends/platform/wince/CEActionsPocket.cpp @@ -133,12 +133,14 @@ void CEActionsPocket::initInstanceGame() { bool is_tucker = (gameid == "tucker"); bool is_groovie = (gameid == "groovie"); bool is_tinsel = (gameid == "tinsel"); + bool is_cruise = (gameid == "cruise"); + bool is_made = (gameid == "made"); GUI_Actions::initInstanceGame(); // See if a right click mapping could be needed if (is_sword1 || is_sword2 || is_sky || is_queen || is_comi || is_gob || is_tinsel || - is_samnmax || is_cine || is_touche || is_parallaction || is_drascula) + is_samnmax || is_cine || is_touche || is_parallaction || is_drascula || is_cruise) _right_click_needed = true; // See if a "hide toolbar" mapping could be needed @@ -158,10 +160,10 @@ void CEActionsPocket::initInstanceGame() { } else if (is_sky) { _action_enabled[POCKET_ACTION_SAVE] = true; _key_action[POCKET_ACTION_SAVE].setKey(Common::ASCII_F5, SDLK_F5); - } else if (is_cine || is_drascula) { + } else if (is_cine || is_drascula || is_cruise) { _action_enabled[POCKET_ACTION_SAVE] = true; _key_action[POCKET_ACTION_SAVE].setKey(Common::ASCII_F10, SDLK_F10); // F10 - } else if (is_agi) { + } else if (is_agi || is_made) { _action_enabled[POCKET_ACTION_SAVE] = true; _key_action[POCKET_ACTION_SAVE].setKey(Common::ASCII_ESCAPE, SDLK_ESCAPE); } else if (is_parallaction) { @@ -177,7 +179,7 @@ void CEActionsPocket::initInstanceGame() { // Quit _action_enabled[POCKET_ACTION_QUIT] = true; // Skip - if (!is_cine && !is_parallaction && !is_groovie) + if (!is_cine && !is_parallaction && !is_groovie && !is_cruise && !is_made) _action_enabled[POCKET_ACTION_SKIP] = true; if (is_simon || is_sky || is_sword2 || is_queen || is_sword1 || is_gob || is_tinsel || is_saga || is_kyra || is_touche || is_lure || is_feeble || is_drascula || is_tucker) @@ -214,6 +216,12 @@ void CEActionsPocket::initInstanceGame() { _key_action[POCKET_ACTION_MULTI].setKey('V', SDLK_v, KMOD_SHIFT); // FT cheat : shift-V // Key bind method _action_enabled[POCKET_ACTION_BINDKEYS] = true; + // Disable double-tap right-click for convenience + if (is_tinsel || is_cruise) + if (!ConfMan.hasKey("no_doubletap_rightclick")) { + ConfMan.setBool("no_doubletap_rightclick", true); + ConfMan.flushToDisk(); + } } diff --git a/backends/platform/wince/CEActionsSmartphone.cpp b/backends/platform/wince/CEActionsSmartphone.cpp index 99f73bf37d..47733ae317 100644 --- a/backends/platform/wince/CEActionsSmartphone.cpp +++ b/backends/platform/wince/CEActionsSmartphone.cpp @@ -123,12 +123,14 @@ void CEActionsSmartphone::initInstanceGame() { bool is_tucker = (gameid == "tucker"); bool is_groovie = (gameid == "groovie"); bool is_tinsel = (gameid == "tinsel"); + bool is_cruise = (gameid == "cruise"); + bool is_made = (gameid == "made"); GUI_Actions::initInstanceGame(); // See if a right click mapping could be needed if (is_sword1 || is_sword2 || is_sky || is_queen || is_comi || is_gob || is_tinsel || - is_samnmax || is_cine || is_touche || is_parallaction || is_drascula) + is_samnmax || is_cine || is_touche || is_parallaction || is_drascula || is_cruise) _right_click_needed = true; // Initialize keys for different actions @@ -141,10 +143,10 @@ void CEActionsSmartphone::initInstanceGame() { } else if (is_sky) { _action_enabled[SMARTPHONE_ACTION_SAVE] = true; _key_action[SMARTPHONE_ACTION_SAVE].setKey(Common::ASCII_F5, SDLK_F5); - } else if (is_cine || is_drascula) { + } else if (is_cine || is_drascula || is_cruise) { _action_enabled[SMARTPHONE_ACTION_SAVE] = true; _key_action[SMARTPHONE_ACTION_SAVE].setKey(Common::ASCII_F10, SDLK_F10); //F10 - } else if (is_agi) { + } else if (is_agi || is_made) { _action_enabled[SMARTPHONE_ACTION_SAVE] = true; _key_action[SMARTPHONE_ACTION_SAVE].setKey(Common::ASCII_ESCAPE, SDLK_ESCAPE); } else if (is_parallaction) { @@ -160,7 +162,8 @@ void CEActionsSmartphone::initInstanceGame() { // Skip _action_enabled[SMARTPHONE_ACTION_SKIP] = true; if (is_simon || is_sky || is_sword2 || is_queen || is_sword1 || is_gob || is_tinsel || - is_saga || is_kyra || is_touche || is_lure || is_feeble || is_drascula || is_tucker || is_groovie) + is_saga || is_kyra || is_touche || is_lure || is_feeble || is_drascula || is_tucker || + is_groovie || is_cruise || is_made) _key_action[SMARTPHONE_ACTION_SKIP].setKey(VK_ESCAPE); else _key_action[SMARTPHONE_ACTION_SKIP].setKey(KEY_ALL_SKIP); @@ -178,6 +181,12 @@ void CEActionsSmartphone::initInstanceGame() { _key_action[SMARTPHONE_ACTION_MULTI].setKey('V', SDLK_v, KMOD_SHIFT); // FT cheat : shift-V // Bind keys _action_enabled[SMARTPHONE_ACTION_BINDKEYS] = true; + // Disable double-tap right-click for convenience + if (is_tinsel || is_cruise) + if (!ConfMan.hasKey("no_doubletap_rightclick")) { + ConfMan.setBool("no_doubletap_rightclick", true); + ConfMan.flushToDisk(); + } } diff --git a/backends/platform/wince/CEScaler.cpp b/backends/platform/wince/CEScaler.cpp index bfdb74319d..d26db3190f 100644 --- a/backends/platform/wince/CEScaler.cpp +++ b/backends/platform/wince/CEScaler.cpp @@ -53,15 +53,6 @@ void PocketPCPortraitTemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPt } MAKE_WRAPPER(PocketPCPortrait) -void PocketPCRawPortrait(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) { - - while (height--) { - memcpy(dstPtr, srcPtr, width*sizeof(uint16_t)); - srcPtr += srcPitch; - dstPtr += dstPitch; - } -} - // Our version of an aspect scaler. Main difference is the out-of-place // operation, omitting a straight blit step the sdl backend does. Also, // tests show unaligned access errors with the stock aspect scaler. @@ -234,8 +225,8 @@ void SmartphoneLandscape(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, ui SmartphoneLandscapeARM(srcPtr, srcPitch, dstPtr, dstPitch, width, height, redbluegreenMasks[maskUsed]); #else if (gBitFormat == 565) - SmartphoneLandscape<565>(srcPtr, srcPitch, dstPtr, dstPitch, width, height); + SmartphoneLandscapeTemplate<565>(srcPtr, srcPitch, dstPtr, dstPitch, width, height); else - SmartphoneLandscape<555>(srcPtr, srcPitch, dstPtr, dstPitch, width, height); + SmartphoneLandscapeTemplate<555>(srcPtr, srcPitch, dstPtr, dstPitch, width, height); #endif } diff --git a/backends/platform/wince/CEgui/SDL_ImageResource.cpp b/backends/platform/wince/CEgui/SDL_ImageResource.cpp index e1a9d911de..ce6ebd6382 100644 --- a/backends/platform/wince/CEgui/SDL_ImageResource.cpp +++ b/backends/platform/wince/CEgui/SDL_ImageResource.cpp @@ -60,7 +60,7 @@ namespace CEGUI { _surface = SDL_LoadBMP_RW(surfaceData, 1); return _surface; - }; + } SDL_Surface* SDL_ImageResource::get() { return _surface; diff --git a/backends/platform/wince/Makefile b/backends/platform/wince/Makefile index 1846029469..acade8ac9a 100644 --- a/backends/platform/wince/Makefile +++ b/backends/platform/wince/Makefile @@ -39,12 +39,12 @@ ENABLE_PARALLACTION = STATIC_PLUGIN ENABLE_DRASCULA = STATIC_PLUGIN ENABLE_GROOVIE = STATIC_PLUGIN ENABLE_TUCKER = STATIC_PLUGIN +ENABLE_TINSEL = STATIC_PLUGIN +ENABLE_CRUISE = STATIC_PLUGIN +ENABLE_MADE = STATIC_PLUGIN #ENABLE_SCI = STATIC_PLUGIN -#ENABLE_TINSEL = STATIC_PLUGIN -#ENABLE_CRUISE = STATIC_PLUGIN #ENABLE_IGOR = STATIC_PLUGIN #ENABLE_M4 = STATIC_PLUGIN -#ENABLE_MADE = STATIC_PLUGIN ######################################################################## ## Pick which libraries you want to use here @@ -76,6 +76,7 @@ USE_ARM_SOUND_ASM = 1 USE_ARM_SMUSH_ASM = 1 USE_ARM_GFX_ASM = 1 USE_ARM_COSTUME_ASM = 1 +USE_ARM_SCALER_ASM = 1 ######################################################################## ## Hopefully you shouldn't need to change anything below here. ## @@ -167,6 +168,10 @@ ifdef USE_ARM_COSTUME_ASM DEFINES += -DUSE_ARM_COSTUME_ASM endif +ifdef USE_ARM_SCALER_ASM +DEFINES += -DUSE_ARM_SCALER_ASM +endif + ######################################################################## # Targets follow here diff --git a/backends/platform/wince/README-WinCE.txt b/backends/platform/wince/README-WinCE.txt index 6a289766a2..5b3215e34e 100644 --- a/backends/platform/wince/README-WinCE.txt +++ b/backends/platform/wince/README-WinCE.txt @@ -6,26 +6,19 @@ Release version: 0.13.0 New in this version ------------------- -0.13.0: -Important: Two builds for ScummVM CE +1.0.0rc1: +This version features optimized ARM assembly versions for the Smartphone, +Normal2x and Normal2xAspect scalers, courtesy of Robin Watts. There should +be a speed improvement when using these scalers. -For this release, two binaries (executables) are provided. The first, -with file name scummvm1.exe, includes support for the following engines: - - scumm, sword1, sword2, queen, sky, lure, agi, touche -while the second, with file name scummvm2.exe: - - gob, cine, saga, kyra, agos, parallaction, drascula, groovie, tucker -The user must make sure to execute the correct file for a game. All -previously detected games will be shown in the launcher. Trying to launch -a gob engine game with scummvm1.exe will not work. -Detection also works as implied: scummvm1.exe will detect only the games -for which it has support; the same holds for scummvm2.exe. -This change has been done so users with less free memory can play more -memory hungry games. - -Also noted are problems with flac support. Your mileage may vary. Please -consider using ogg or mp3 for those games (smaller sizes are better for -handheld devices too!) +Also new is the aspect 2x upscaling mode, which is auto detected and used +when the scaler is set to (normal) 2x mode and the panel is hidden. Hence, +a 320x200 game running on a VGA or higher resolution device will be +aspect scaled to fill the 640x480 screen. +Be aware that Discworld 2 tries to allocate a big chunk of memory (10 MB) +and this will fail on many devices (file under the not enough memory +category). ------------------------------------------------------------------------ @@ -590,6 +583,20 @@ By default, the double tap to right click action is disabled in this game as this interferes with the game's controls. This setting can be overridden (see 'no_doubletap_rightclick' parameter above). +----------------- +-- Discworld 2 -- +----------------- + +Crashes at startup of this game are usually due to the high memory +requirements of this game. + +------------------------- +-- Cruise for a Corpse -- +------------------------- + +As with Discworld, the double-tap-to-right-click action interferes and will +be disabled by default. + ------------------------------------------------------------------------ Support @@ -637,6 +644,27 @@ http://www.scummvm.org/ Old news follow ... ------------------------------------------------------------------------ +0.13.0: +Important: Two builds for ScummVM CE + +For this release, two binaries (executables) are provided. The first, +with file name scummvm1.exe, includes support for the following engines: + - scumm, sword1, sword2, queen, sky, lure, agi, touche +while the second, with file name scummvm2.exe: + - gob, cine, saga, kyra, agos, parallaction, drascula, groovie, tucker +The user must make sure to execute the correct file for a game. All +previously detected games will be shown in the launcher. Trying to launch +a gob engine game with scummvm1.exe will not work. +Detection also works as implied: scummvm1.exe will detect only the games +for which it has support; the same holds for scummvm2.exe. +This change has been done so users with less free memory can play more +memory hungry games. + +Also noted are problems with flac support. Your mileage may vary. Please +consider using ogg or mp3 for those games (smaller sizes are better for +handheld devices too!) + + 0.12.0: - Improved SMUSH support (deprecated 'Smush_force_redraw' option) No skipped frames in Full Throttle action sequences. The 'Smush_force_redraw' diff --git a/backends/platform/wince/missing/missing.cpp b/backends/platform/wince/missing/missing.cpp index f63ad72298..ac93e8f714 100644 --- a/backends/platform/wince/missing/missing.cpp +++ b/backends/platform/wince/missing/missing.cpp @@ -135,7 +135,7 @@ EXT_C char *getcwd(char *buffer, int maxlen) { #endif EXT_C void GetCurrentDirectory(int len, char *buf) { getcwd(buf,len); -}; +} /* Windows CE fopen has non-standard behavior -- not diff --git a/backends/platform/wince/module.mk b/backends/platform/wince/module.mk new file mode 100644 index 0000000000..5fefe08d79 --- /dev/null +++ b/backends/platform/wince/module.mk @@ -0,0 +1,21 @@ +MODULE := backends/platform/wince + +MODULE_OBJS := \ + CEActionsPocket.o CEDevice.o CEScaler.o \ + CEActionsSmartphone.o CELauncherDialog.o wince-sdl.o \ + CEgui/GUIElement.o CEgui/Panel.o CEgui/SDL_ImageResource.o \ + CEgui/ItemAction.o CEgui/PanelItem.o CEgui/Toolbar.o \ + CEgui/ItemSwitch.o CEgui/PanelKeyboard.o CEgui/ToolbarHandler.o \ + CEkeys/EventsBuffer.o \ + ../../../gui/Actions.o ../../../gui/Key.o ../../../gui/KeysDialog.o \ + ../sdl/sdl.o ../sdl/graphics.o ../sdl/events.o ../sdl/hardwarekeys.o \ + missing/missing.o \ + PocketSCUMM.o \ + ARMscaler.o \ + smartLandScale.o + +MODULE_DIRS += \ + backends/platform/wince/ + +# We don't use the rules.mk here on purpose +OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index 8b2e0848f8..5d75b76805 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -403,9 +403,8 @@ static Uint32 timer_handler_wrapper(Uint32 interval) { void OSystem_WINCE3::initBackend() { // Instantiate our own sound mixer - // mixer init is postponed until a game engine is selected. - if (_mixer == 0) - _mixer = new Audio::MixerImpl(this); + // mixer init is rerun when a game engine is selected. + setupMixer(); // Create the timer. CE SDL does not support multiple timers (SDL_AddTimer). // We work around this by using the SetTimer function, since we only use @@ -792,11 +791,15 @@ void OSystem_WINCE3::setupMixer() { SDL_AudioSpec desired; int thread_priority; + compute_sample_rate(); if (_sampleRate == 0) warning("setSoundCallback called with 0 _sampleRate. Audio will not work."); + else if (_mixer && _mixer->getOutputRate() == _sampleRate) { + debug(1, "Skipping sound mixer re-init: samplerate is good"); + return; + } memset(&desired, 0, sizeof(desired)); - desired.freq = _sampleRate; desired.format = AUDIO_S16SYS; desired.channels = 2; @@ -913,7 +916,6 @@ void OSystem_WINCE3::engineInit() { //update_game_settings(); // finalize mixer init - compute_sample_rate(); setupMixer(); } @@ -1080,13 +1082,6 @@ void OSystem_WINCE3::update_game_settings() { if (ConfMan.hasKey("no_doubletap_rightclick")) _noDoubleTapRMB = ConfMan.getBool("no_doubletap_rightclick"); - else if (gameid == "tinsel") { - _noDoubleTapRMB = true; - ConfMan.setBool("no_doubletap_rightclick", true); - ConfMan.flushToDisk(); - } - - compute_sample_rate(); } void OSystem_WINCE3::initSize(uint w, uint h) { @@ -1147,13 +1142,13 @@ void OSystem_WINCE3::setGraphicsModeIntern() { } bool OSystem_WINCE3::update_scalers() { - if (_videoMode.mode != GFX_NORMAL) - return false; - _videoMode.aspectRatioCorrection = false; if (CEDevice::hasPocketPCResolution()) { - if ( (!_orientationLandscape && (_videoMode.screenWidth == 320 || !_videoMode.screenWidth)) + if (_videoMode.mode != GFX_NORMAL) + return false; + + if ((!_orientationLandscape && (_videoMode.screenWidth == 320 || !_videoMode.screenWidth)) || CEDevice::hasSquareQVGAResolution() ) { if (getScreenWidth() != 320) { _scaleFactorXm = 3; @@ -1204,9 +1199,32 @@ bool OSystem_WINCE3::update_scalers() { } return true; - } + } else if (CEDevice::hasWideResolution()) { +#ifdef USE_ARM_SCALER_ASM + if ( _videoMode.mode == GFX_DOUBLESIZE && (_videoMode.screenWidth == 320 || !_videoMode.screenWidth) ) { + if ( !_panelVisible && !_overlayVisible && _canBeAspectScaled ) { + _scaleFactorXm = 2; + _scaleFactorXd = 1; + _scaleFactorYm = 12; + _scaleFactorYd = 5; + _scalerProc = Normal2xAspect; + _modeFlags = 0; + _videoMode.aspectRatioCorrection = true; + } else if ( (_panelVisible || _overlayVisible) && _canBeAspectScaled ) { + _scaleFactorXm = 2; + _scaleFactorXd = 1; + _scaleFactorYm = 2; + _scaleFactorYd = 1; + _scalerProc = Normal2x; + _modeFlags = 0; + } + return true; + } +#endif + } else if (CEDevice::hasSmartphoneResolution()) { + if (_videoMode.mode != GFX_NORMAL) + return false; - if (CEDevice::hasSmartphoneResolution()) { if (_videoMode.screenWidth > 320) error("Game resolution not supported on Smartphone"); #ifdef ARM @@ -1373,8 +1391,8 @@ bool OSystem_WINCE3::loadGFXMode() { displayWidth = _videoMode.screenWidth * _scaleFactorXm / _scaleFactorXd; displayHeight = _videoMode.screenHeight * _scaleFactorYm / _scaleFactorYd; } else { - displayWidth = _videoMode.screenWidth; - displayHeight = _videoMode.screenHeight; + displayWidth = _videoMode.screenWidth * _videoMode.scaleFactor; + displayHeight = _videoMode.screenHeight* _videoMode.scaleFactor; } switch (_orientationLandscape) { diff --git a/backends/platform/wince/wince.mk b/backends/platform/wince/wince.mk new file mode 100644 index 0000000000..5551b27289 --- /dev/null +++ b/backends/platform/wince/wince.mk @@ -0,0 +1,5 @@ +all: PocketSCUMM.o + +PocketSCUMM.o: $(srcdir)/backends/platform/wince/PocketSCUMM.rc + mkdir -p backends/platform/wince + $(WINDRES) -I$(srcdir)/backends/platform/wince $(srcdir)/backends/platform/wince/PocketSCUMM.rc backends/platform/wince/PocketSCUMM.o |