diff options
Diffstat (limited to 'backends/platform')
36 files changed, 798 insertions, 424 deletions
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index bbfdb06b8d..c7f62f523b 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -32,6 +32,7 @@ #include <unistd.h> #include "common/util.h" +#include "common/textconsole.h" #include "common/rect.h" #include "common/queue.h" #include "common/mutex.h" diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h index 6eebdb97d9..109d252a99 100644 --- a/backends/platform/android/android.h +++ b/backends/platform/android/android.h @@ -31,6 +31,7 @@ #include "common/fs.h" #include "common/archive.h" #include "audio/mixer_intern.h" +#include "graphics/palette.h" #include "graphics/surface.h" #include "backends/base-backend.h" #include "backends/plugins/posix/posix-provider.h" diff --git a/backends/platform/android/asset-archive.cpp b/backends/platform/android/asset-archive.cpp index 8e95029894..7c21b35281 100644 --- a/backends/platform/android/asset-archive.cpp +++ b/backends/platform/android/asset-archive.cpp @@ -35,6 +35,7 @@ #include "common/util.h" #include "common/archive.h" #include "common/debug.h" +#include "common/textconsole.h" #include "backends/platform/android/jni.h" #include "backends/platform/android/asset-archive.h" diff --git a/backends/platform/android/jni.cpp b/backends/platform/android/jni.cpp index 08a1491998..f23d71b2a4 100644 --- a/backends/platform/android/jni.cpp +++ b/backends/platform/android/jni.cpp @@ -28,6 +28,8 @@ #include "base/main.h" #include "base/version.h" #include "common/config-manager.h" +#include "common/error.h" +#include "common/textconsole.h" #include "engines/engine.h" #include "backends/platform/android/android.h" diff --git a/backends/platform/dc/Makefile b/backends/platform/dc/Makefile index 637f474b4b..11d9421a0a 100644 --- a/backends/platform/dc/Makefile +++ b/backends/platform/dc/Makefile @@ -65,7 +65,7 @@ ENABLE_TOUCHE = $(ENABLED) ENABLE_TUCKER = $(ENABLED) OBJS := dcmain.o time.o display.o audio.o input.o selector.o icon.o \ - label.o vmsave.o softkbd.o dcloader.o cache.o dc-fs.o + label.o vmsave.o softkbd.o dcloader.o cache.o dc-fs.o plugins.o MODULE_DIRS += ./ diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h index 76c4b8cfd2..060eff2b48 100644 --- a/backends/platform/dc/dc.h +++ b/backends/platform/dc/dc.h @@ -26,11 +26,15 @@ #include "backends/base-backend.h" #include <graphics/surface.h> #include <graphics/colormasks.h> +#include <graphics/palette.h> #include <ronin/soundcommon.h> #include "backends/timer/default/default-timer.h" #include "backends/audiocd/default/default-audiocd.h" #include "backends/fs/fs-factory.h" #include "audio/mixer_intern.h" +#ifdef DYNAMIC_MODULES +#include "backends/plugins/dynamic-plugin.h" +#endif #define NUM_BUFFERS 4 #define SOUND_BUFFER_SHIFT 3 @@ -69,7 +73,11 @@ class DCCDManager : public DefaultAudioCDManager { void updateCD(); }; -class OSystem_Dreamcast : private DCHardware, public BaseBackend, public PaletteManager, public FilesystemFactory { +class OSystem_Dreamcast : private DCHardware, public BaseBackend, public PaletteManager, public FilesystemFactory +#ifdef DYNAMIC_MODULES + , public FilePluginProvider +#endif + { public: OSystem_Dreamcast(); @@ -250,6 +258,14 @@ public: void logMessage(LogMessageType::Type type, const char *message); Common::String getSystemLanguage() const; + +#ifdef DYNAMIC_MODULES + class DCPlugin; + + protected: + Plugin* createPlugin(const Common::FSNode &node) const; + bool isPluginFilename(const Common::FSNode &node) const; +#endif }; diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp index bbd4f994f7..f9640130d3 100644 --- a/backends/platform/dc/dcmain.cpp +++ b/backends/platform/dc/dcmain.cpp @@ -33,7 +33,6 @@ #include <common/config-manager.h> #include <common/memstream.h> -#include "backends/plugins/dc/dc-provider.h" #include "audio/mixer_intern.h" @@ -336,7 +335,7 @@ int main() g_system = &osys_dc; #ifdef DYNAMIC_MODULES - PluginManager::instance().addPluginProvider(new DCPluginProvider()); + PluginManager::instance().addPluginProvider(&osys_dc); #endif scummvm_main(argc, argv); diff --git a/backends/platform/dc/dreamcast.mk b/backends/platform/dc/dreamcast.mk index 8651a2936c..666e03eece 100644 --- a/backends/platform/dc/dreamcast.mk +++ b/backends/platform/dc/dreamcast.mk @@ -35,3 +35,7 @@ ip.txt : $(srcdir)/backends/platform/dc/ip.txt.in ver="V$(VER_MAJOR).$(VER_MINOR).$(VER_PATCH)"; fi; \ sed -e 's/[@]VERSION[@]/'"$$ver"/ -e 's/[@]DATE[@]/$(shell date '+%Y%m%d')/' < $< > $@ + +dcdist : dist + mkdir -p dcdist/scummvm + cp scummvm.elf SCUMMVM.BIN IP.BIN *.PLG dcdist/scummvm/ diff --git a/backends/platform/dc/module.mk b/backends/platform/dc/module.mk index c52ca1a474..9ab287c080 100644 --- a/backends/platform/dc/module.mk +++ b/backends/platform/dc/module.mk @@ -1,7 +1,7 @@ MODULE := backends/platform/dc MODULE_OBJS := dcmain.o time.o display.o audio.o input.o selector.o icon.o \ - label.o vmsave.o softkbd.o dcloader.o cache.o dc-fs.o + label.o vmsave.o softkbd.o dcloader.o cache.o dc-fs.o plugins.o # We don't use rules.mk but rather manually update OBJS and MODULE_DIRS. MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) diff --git a/backends/platform/dc/plugins.cpp b/backends/platform/dc/plugins.cpp new file mode 100644 index 0000000000..44b8960513 --- /dev/null +++ b/backends/platform/dc/plugins.cpp @@ -0,0 +1,136 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "common/scummsys.h" + +#if defined(DYNAMIC_MODULES) + +#include "backends/plugins/dynamic-plugin.h" +#include "common/fs.h" + +#include "dcloader.h" + +extern void draw_solid_quad(float x1, float y1, float x2, float y2, + int c0, int c1, int c2, int c3); + +static void drawPluginProgress(const Common::String &filename) +{ + ta_sync(); + void *mark = ta_txmark(); + const char *fn = filename.c_str(); + Label lab1, lab2, lab3; + char buf[32]; + unsigned memleft = 0x8cf00000-((unsigned)sbrk(0)); + float ffree = memleft*(1.0/(16<<20)); + int fcol = (memleft < (1<<20)? 0xffff0000: + (memleft < (4<<20)? 0xffffff00: 0xff00ff00)); + snprintf(buf, sizeof(buf), "%dK free memory", memleft>>10); + if (fn[0] == '/') fn++; + lab1.create_texture("Loading plugins, please wait..."); + lab2.create_texture(fn); + lab3.create_texture(buf); + ta_begin_frame(); + draw_solid_quad(80.0, 270.0, 560.0, 300.0, + 0xff808080, 0xff808080, 0xff808080, 0xff808080); + draw_solid_quad(85.0, 275.0, 555.0, 295.0, + 0xff202020, 0xff202020, 0xff202020, 0xff202020); + draw_solid_quad(85.0, 275.0, 85.0+470.0*ffree, 295.0, + fcol, fcol, fcol, fcol); + ta_commit_end(); + lab1.draw(100.0, 150.0, 0xffffffff); + lab2.draw(100.0, 190.0, 0xffaaffaa); + lab3.draw(100.0, 230.0, 0xffffffff); + ta_commit_frame(); + ta_sync(); + ta_txrelease(mark); +} + + +class OSystem_Dreamcast::DCPlugin : public DynamicPlugin { +protected: + void *_dlHandle; + + virtual VoidFunc findSymbol(const char *symbol) { + void *func = dlsym(_dlHandle, symbol); + if (!func) + warning("Failed loading symbol '%s' from plugin '%s' (%s)", symbol, _filename.c_str(), dlerror()); + + // FIXME HACK: This is a HACK to circumvent a clash between the ISO C++ + // standard and POSIX: ISO C++ disallows casting between function pointers + // and data pointers, but dlsym always returns a void pointer. For details, + // see e.g. <http://www.trilithium.com/johan/2004/12/problem-with-dlsym/>. + assert(sizeof(VoidFunc) == sizeof(func)); + VoidFunc tmp; + memcpy(&tmp, &func, sizeof(VoidFunc)); + return tmp; + } + +public: + DCPlugin(const Common::String &filename) + : DynamicPlugin(filename), _dlHandle(0) {} + + bool loadPlugin() { + assert(!_dlHandle); + drawPluginProgress(_filename); + _dlHandle = dlopen(_filename.c_str(), RTLD_LAZY); + + if (!_dlHandle) { + warning("Failed loading plugin '%s' (%s)", _filename.c_str(), dlerror()); + return false; + } + + bool ret = DynamicPlugin::loadPlugin(); + + if (ret) + dlforgetsyms(_dlHandle); + + return ret; + } + + void unloadPlugin() { + DynamicPlugin::unloadPlugin(); + if (_dlHandle) { + if (dlclose(_dlHandle) != 0) + warning("Failed unloading plugin '%s' (%s)", _filename.c_str(), dlerror()); + _dlHandle = 0; + } + } +}; + + +Plugin* OSystem_Dreamcast::createPlugin(const Common::FSNode &node) const { + return new DCPlugin(node.getPath()); +} + +bool OSystem_Dreamcast::isPluginFilename(const Common::FSNode &node) const { + // Check the plugin suffix + Common::String filename = node.getName(); + if (!filename.hasSuffix(".PLG")) + return false; + + return true; +} + +#endif // defined(DYNAMIC_MODULES) diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index 5e179d1337..b745b4dc6e 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -36,6 +36,7 @@ #include "audio/mixer_intern.h" #include "graphics/surface.h" #include "graphics/colormasks.h" +#include "graphics/palette.h" class OSystem_DS : public BaseBackend, public PaletteManager { protected: diff --git a/backends/platform/gph/gph-backend.cpp b/backends/platform/gph/gph-backend.cpp index 0432974246..375ee37378 100644 --- a/backends/platform/gph/gph-backend.cpp +++ b/backends/platform/gph/gph-backend.cpp @@ -26,23 +26,23 @@ #include "backends/platform/sdl/sdl-sys.h" // #include "backends/platform/gph/gph-options.h" -#include "backends/platform/gph/gph-sdl.h" +#include "backends/mixer/doublebuffersdl/doublebuffersdl-mixer.h" #include "backends/platform/gph/gph-hw.h" +#include "backends/platform/gph/gph-sdl.h" #include "backends/plugins/posix/posix-provider.h" +#include "backends/saves/default/default-saves.h" +#include "backends/timer/default/default-timer.h" + #include "base/main.h" #include "common/archive.h" #include "common/config-manager.h" #include "common/debug.h" #include "common/events.h" -#include "common/util.h" - #include "common/file.h" -#include "base/main.h" - -#include "backends/saves/default/default-saves.h" +#include "common/textconsole.h" +#include "common/util.h" -#include "backends/timer/default/default-timer.h" #include "audio/mixer_intern.h" #include <stdio.h> @@ -67,6 +67,14 @@ void OSystem_GPH::initBackend() { _graphicsManager = new GPHGraphicsManager(_eventSource); } + // Create the mixer manager + if (_mixer == 0) { + _mixerManager = new DoubleBufferSDLMixerManager(); + + // Setup and start mixer + _mixerManager->init(); + } + /* Setup default save path to be workingdir/saves */ char savePath[PATH_MAX+1]; diff --git a/backends/platform/gph/gph-sdl.h b/backends/platform/gph/gph-sdl.h index 51c609d29e..68a641eed7 100644 --- a/backends/platform/gph/gph-sdl.h +++ b/backends/platform/gph/gph-sdl.h @@ -32,7 +32,6 @@ #include "backends/events/gph/gph-events.h" #define __GP2XWIZ__ -#define MIXER_DOUBLE_BUFFERING 1 #ifndef PATH_MAX #define PATH_MAX 255 diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h index 25c3c40cf9..79f596632f 100644 --- a/backends/platform/iphone/osys_main.h +++ b/backends/platform/iphone/osys_main.h @@ -30,6 +30,7 @@ #include "audio/mixer_intern.h" #include "backends/fs/posix/posix-fs-factory.h" #include "graphics/colormasks.h" +#include "graphics/palette.h" #include <AudioToolbox/AudioQueue.h> diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h index 2daa41a9f6..7a84de0449 100644 --- a/backends/platform/n64/osys_n64.h +++ b/backends/platform/n64/osys_n64.h @@ -37,6 +37,7 @@ #include "graphics/surface.h" #include "graphics/colormasks.h" +#include "graphics/palette.h" #include "graphics/pixelformat.h" #include "audio/mixer_intern.h" diff --git a/backends/platform/openpandora/op-backend.cpp b/backends/platform/openpandora/op-backend.cpp index 5b333929c9..4c29636e40 100644 --- a/backends/platform/openpandora/op-backend.cpp +++ b/backends/platform/openpandora/op-backend.cpp @@ -26,20 +26,17 @@ #include "backends/platform/openpandora/op-sdl.h" #include "base/main.h" +#include "backends/mixer/doublebuffersdl/doublebuffersdl-mixer.h" #include "backends/saves/default/default-saves.h" +#include "backends/timer/default/default-timer.h" #include "common/archive.h" #include "common/config-manager.h" #include "common/debug.h" #include "common/events.h" -#include "common/util.h" - #include "common/file.h" -#include "base/main.h" - -#include "backends/saves/default/default-saves.h" +#include "common/util.h" -#include "backends/timer/default/default-timer.h" #include "audio/mixer_intern.h" #include <stdio.h> @@ -78,6 +75,14 @@ void OSystem_OP::initBackend() { // } // + // Create the mixer manager + if (_mixer == 0) { + _mixerManager = new DoubleBufferSDLMixerManager(); + + // Setup and start mixer + _mixerManager->init(); + } + /* Setup default save path to be workingdir/saves */ char savePath[PATH_MAX+1]; diff --git a/backends/platform/openpandora/op-sdl.h b/backends/platform/openpandora/op-sdl.h index 93c82ca397..9d92472b17 100644 --- a/backends/platform/openpandora/op-sdl.h +++ b/backends/platform/openpandora/op-sdl.h @@ -32,7 +32,6 @@ #include "backends/graphics/openpandora/op-graphics.h" #define __OPENPANDORA__ -#define MIXER_DOUBLE_BUFFERING 1 #ifndef PATH_MAX #define PATH_MAX 255 diff --git a/backends/platform/ps2/Gs2dScreen.h b/backends/platform/ps2/Gs2dScreen.h index 358e717cbe..6e842b3f55 100644 --- a/backends/platform/ps2/Gs2dScreen.h +++ b/backends/platform/ps2/Gs2dScreen.h @@ -46,7 +46,7 @@ enum GsInterlace { namespace Graphics { - struct Surface; +struct Surface; } class Gs2dScreen { diff --git a/backends/platform/ps2/ps2input.h b/backends/platform/ps2/ps2input.h index 266f408809..eca5950113 100644 --- a/backends/platform/ps2/ps2input.h +++ b/backends/platform/ps2/ps2input.h @@ -32,6 +32,10 @@ class OSystem_PS2; class Ps2Pad; +namespace Common { +struct Event; +} + class Ps2Input { public: Ps2Input(OSystem_PS2 *system, bool mouseLoaded, bool kbdLoaded); diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h index 37575f399f..54e6f05798 100644 --- a/backends/platform/ps2/systemps2.h +++ b/backends/platform/ps2/systemps2.h @@ -28,6 +28,7 @@ #include "common/system.h" #include "backends/base-backend.h" +#include "graphics/palette.h" class DefaultTimerManager; class DefaultSaveFileManager; @@ -47,11 +48,11 @@ struct Ps2Mutex { }; namespace Common { - class TimerManager; +class TimerManager; }; namespace Audio { - class MixerImpl; +class MixerImpl; }; class OSystem_PS2 : public BaseBackend, public PaletteManager { diff --git a/backends/platform/psp/README.PSP b/backends/platform/psp/README.PSP index b520022033..dcfa30898c 100644 --- a/backends/platform/psp/README.PSP +++ b/backends/platform/psp/README.PSP @@ -1,4 +1,4 @@ -ScummVM-PSP 1.3.0git README +ScummVM-PSP 1.4.0git README ============================================================================== Installation diff --git a/backends/platform/psp/mp3.cpp b/backends/platform/psp/mp3.cpp index 54476dabfd..0faeacb2f2 100644 --- a/backends/platform/psp/mp3.cpp +++ b/backends/platform/psp/mp3.cpp @@ -29,6 +29,7 @@ #include "common/util.h" #include "common/singleton.h" #include "common/mutex.h" +#include "common/textconsole.h" #include "audio/audiostream.h" diff --git a/backends/platform/psp/mp3.h b/backends/platform/psp/mp3.h index 1d2fe5ec2f..95491d5788 100644 --- a/backends/platform/psp/mp3.h +++ b/backends/platform/psp/mp3.h @@ -30,7 +30,7 @@ #include "common/scummsys.h" namespace Common { - class SeekableReadStream; +class SeekableReadStream; } namespace Audio { diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h index 051449d4a0..1e4aea70d3 100644 --- a/backends/platform/psp/osys_psp.h +++ b/backends/platform/psp/osys_psp.h @@ -29,6 +29,7 @@ #include "common/scummsys.h" #include "graphics/surface.h" #include "graphics/colormasks.h" +#include "graphics/palette.h" #include "audio/mixer_intern.h" #include "backends/base-backend.h" #include "backends/fs/psp/psp-fs-factory.h" diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index d6e79248f9..4694a061a3 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -32,6 +32,7 @@ #include "backends/platform/sdl/sdl.h" #include "common/config-manager.h" #include "common/EventRecorder.h" +#include "common/textconsole.h" #include "backends/saves/default/default-saves.h" #include "backends/audiocd/sdl/sdl-audiocd.h" @@ -378,7 +379,11 @@ void OSystem_SDL::setupIcon() { unsigned int rgba[256]; unsigned int *icon; - sscanf(scummvm_icon[0], "%d %d %d %d", &w, &h, &ncols, &nbytes); + if (sscanf(scummvm_icon[0], "%d %d %d %d", &w, &h, &ncols, &nbytes) != 4) { + warning("Wrong format of scummvm_icon[0] (%s)", scummvm_icon[0]); + + return; + } if ((w > 512) || (h > 512) || (ncols > 255) || (nbytes > 1)) { warning("Could not load the built-in icon (%d %d %d %d)", w, h, ncols, nbytes); return; @@ -393,13 +398,17 @@ void OSystem_SDL::setupIcon() { unsigned char code; char color[32]; unsigned int col; - sscanf(scummvm_icon[1 + i], "%c c %s", &code, color); + if (sscanf(scummvm_icon[1 + i], "%c c %s", &code, color) != 2) { + warning("Wrong format of scummvm_icon[%d] (%s)", 1 + i, scummvm_icon[1 + i]); + } if (!strcmp(color, "None")) col = 0x00000000; else if (!strcmp(color, "black")) col = 0xFF000000; else if (color[0] == '#') { - sscanf(color + 1, "%06x", &col); + if (sscanf(color + 1, "%06x", &col) != 1) { + warning("Wrong format of color (%s)", color + 1); + } col |= 0xFF000000; } else { warning("Could not load the built-in icon (%d %s - %s) ", code, color, scummvm_icon[1 + i]); diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp index 9459263ae2..fffc3a2a75 100644 --- a/backends/platform/sdl/win32/win32.cpp +++ b/backends/platform/sdl/win32/win32.cpp @@ -27,6 +27,8 @@ #define FORBIDDEN_SYMBOL_ALLOW_ALL #include "common/scummsys.h" +#include "common/error.h" +#include "common/textconsole.h" #ifdef WIN32 diff --git a/backends/platform/symbian/AdaptAllMMPs.pl b/backends/platform/symbian/AdaptAllMMPs.pl index 921f384c65..dbced3126a 100644 --- a/backends/platform/symbian/AdaptAllMMPs.pl +++ b/backends/platform/symbian/AdaptAllMMPs.pl @@ -36,6 +36,7 @@ chdir("../../../"); "mmp/scummvm_hugo.mmp", "mmp/scummvm_toon.mmp", "mmp/scummvm_lastexpress.mmp", + "mmp/scummvm_tsage.mmp", # Target Platform Project Files "S60/ScummVM_S60.mmp", "S60v3/ScummVM_S60v3.mmp", @@ -111,7 +112,8 @@ ParseModule("_base", "base", \@section_empty); # now in ./TRG/ScummVM_TRG.mmp, ParseModule("_base", "common", \@section_empty); ParseModule("_base", "gui", \@section_empty, \@excludes_gui); ParseModule("_base", "graphics", \@section_empty, \@excludes_graphics); -ParseModule("_base", "sound", \@section_empty, \@excludes_snd); +ParseModule("_base", "audio", \@section_empty, \@excludes_snd); +ParseModule("_base", "video", \@section_empty); chdir("engines/"); ParseModule("_scumm", "scumm", \@sections_scumm, \@excludes_scumm ); @@ -142,6 +144,7 @@ ParseModule("_mohawk" ,"mohawk", \@section_empty); ParseModule("_hugo" ,"hugo", \@section_empty); ParseModule("_toon" ,"toon", \@section_empty); ParseModule("_lastexpress","lastexpress", \@section_empty); +ParseModule("_tsage","tsage", \@section_empty); print " ======================================================================================= Done. Enjoy :P diff --git a/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl b/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl index 5c127afaa0..cb1c508fa1 100644 --- a/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl +++ b/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl @@ -4,7 +4,7 @@ @WorkingEngines = qw( scumm agos sky queen gob groovie saga drascula kyra lure agi touche parallaction cine - cruise made m4 tinsel tucker sword1 sword2 draci sci teenagent mohawk hugo toon lastexpress + cruise made m4 tinsel tucker sword1 sword2 draci sci teenagent mohawk hugo toon lastexpress tsage ); @WorkingEngines_1st = qw( @@ -14,9 +14,10 @@ ); @WorkingEngines_2nd = qw( - agos sky gob - kyra lure agi tinsel - sword1 sword2 draci sci teenagent hugo toon + agos sky gob kyra lure + agi tinsel sword1 sword2 + draci sci teenagent hugo toon + tsage ); @TestingEngines = qw( diff --git a/backends/platform/symbian/mmp/scummvm_base.mmp.in b/backends/platform/symbian/mmp/scummvm_base.mmp.in index b3bfbab530..2b74bca42b 100644 --- a/backends/platform/symbian/mmp/scummvm_base.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_base.mmp.in @@ -96,11 +96,11 @@ SOURCEPATH ..\..\..\..\gui //SOURCE Actions.cpp SOURCEPATH ..\..\..\..\audio -//START_AUTO_OBJECTS_SOUND_// +//START_AUTO_OBJECTS_AUDIO_// // empty base file, will be updated by Perl build scripts -//STOP_AUTO_OBJECTS_SOUND_// +//STOP_AUTO_OBJECTS_AUDIO_// SOURCE softsynth\fmtowns_pc98\towns_pc98_fmsynth.cpp // Included since its excluded by filter #if defined (WINS) diff --git a/backends/platform/symbian/mmp/scummvm_tsage.mmp.in b/backends/platform/symbian/mmp/scummvm_tsage.mmp.in new file mode 100644 index 0000000000..8265d9e772 --- /dev/null +++ b/backends/platform/symbian/mmp/scummvm_tsage.mmp.in @@ -0,0 +1,64 @@ +/* ScummVM - Graphic Adventure Engine + * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL + * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System + * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer + * Copyright (C) 2005-2011 The ScummVM project + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +// +// EPOC MMP makefile project for ScummVM +// + +// *** Definitions + +TARGET scummvm_tsage.lib +TARGETTYPE lib +OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp +OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings +OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char +ALWAYS_BUILD_AS_ARM + +//START_AUTO_MACROS_SLAVE// + + // empty base file, will be updated by Perl build scripts + +//STOP_AUTO_MACROS_SLAVE// + +// *** SOURCE files + +SOURCEPATH ..\..\..\..\engines\tsage + +//START_AUTO_OBJECTS_TSAGE_// + + // empty base file, will be updated by Perl build scripts + +//STOP_AUTO_OBJECTS_TSAGE_// + +// *** Include paths + +USERINCLUDE ..\..\..\..\engines +USERINCLUDE ..\..\..\.. ..\..\..\..\common ..\..\..\..\gui ..\..\..\..\audio ..\src +SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version +SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src diff --git a/backends/platform/symbian/src/portdefs.h b/backends/platform/symbian/src/portdefs.h index 1c5de2d43c..e8a620475e 100644 --- a/backends/platform/symbian/src/portdefs.h +++ b/backends/platform/symbian/src/portdefs.h @@ -35,6 +35,11 @@ #include <e32std.h> #include <math.h> +/* define pi */ +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif /* M_PI */ + #define DISABLE_COMMAND_LINE #if defined(USE_TREMOR) && !defined(USE_VORBIS) diff --git a/backends/platform/symbian/src/vsnprintf.h b/backends/platform/symbian/src/vsnprintf.h index 5a9c836ea3..6e75719d55 100644 --- a/backends/platform/symbian/src/vsnprintf.h +++ b/backends/platform/symbian/src/vsnprintf.h @@ -1,8 +1,11 @@ /* - * This is the vsnprintf for scummvm/symbian implementation from the original snprintf.c, - * all support functions has been removed and vsnprintf renamed to symbian_vsnprintf + * This is the vsnprintf for scummvm/symbian implementation from the original + * snprintf.c, all support functions has been removed and vsnprintf renamed to + * symbian_vsnprintf + * According to the homepage this function may be licensed under either the + * Frontier Artistic License or the GPL. + * * snprintf.c - a portable implementation of snprintf - * According to the homepage this function could be licensed as either Frontier Aritistic or GPL. * * AUTHOR * Mark Martinec <mark.martinec@ijs.si>, April 1999. @@ -244,13 +247,14 @@ int symbian_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) { /* if (str_l < str_m) str[str_l++] = *p++; -- this would be sufficient */ /* but the following code achieves better performance for cases * where format string is long and contains few conversions */ - const char *q = strchr(p+1,'%'); - size_t n = !q ? strlen(p) : (q-p); + const char *q = strchr(p + 1, '%'); + size_t n = !q ? strlen(p) : (q - p); if (str_l < str_m) { - size_t avail = str_m-str_l; - fast_memcpy(str+str_l, p, (n>avail?avail:n)); + size_t avail = str_m - str_l; + fast_memcpy(str + str_l, p, (n > avail ? avail : n)); } - p += n; str_l += n; + p += n; + str_l += n; } else { const char *starting_p; size_t min_field_width = 0, precision = 0; @@ -262,398 +266,453 @@ int symbian_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) { char tmp[32];/* temporary buffer for simple numeric->string conversion */ const char *str_arg; /* string address in case of string argument */ - size_t str_arg_l; /* natural field width of arg without padding + size_t str_arg_l; /* natural field width of arg without padding and sign */ - unsigned char uchar_arg; - /* unsigned char argument value - only defined for c conversion. - N.B. standard explicitly states the char argument for - the c conversion is unsigned */ + unsigned char uchar_arg; + /* unsigned char argument value - only defined for c conversion. + N.B. standard explicitly states the char argument for + the c conversion is unsigned */ - size_t number_of_zeros_to_pad = 0; - /* number of zeros to be inserted for numeric conversions - as required by the precision or minimal field width */ + size_t number_of_zeros_to_pad = 0; + /* number of zeros to be inserted for numeric conversions + as required by the precision or minimal field width */ - size_t zero_padding_insertion_ind = 0; - /* index into tmp where zero padding is to be inserted */ + size_t zero_padding_insertion_ind = 0; + /* index into tmp where zero padding is to be inserted */ - char fmt_spec = '\0'; - /* current conversion specifier character */ + char fmt_spec = '\0'; + /* current conversion specifier character */ - str_arg = credits;/* just to make compiler happy (defined but not used)*/ - str_arg = NULL; - starting_p = p; p++; /* skip '%' */ - /* parse flags */ - while (*p == '0' || *p == '-' || *p == '+' || - *p == ' ' || *p == '#' || *p == '\'') { - switch (*p) { - case '0': zero_padding = 1; break; - case '-': justify_left = 1; break; - case '+': force_sign = 1; space_for_positive = 0; break; - case ' ': force_sign = 1; - /* If both the ' ' and '+' flags appear, the ' ' flag should be ignored */ - break; - case '#': alternate_form = 1; break; - case '\'': break; - } - p++; - } - /* If the '0' and '-' flags both appear, the '0' flag should be ignored. */ + str_arg = credits;/* just to make compiler happy (defined but not used)*/ + str_arg = NULL; + starting_p = p; + p++; /* skip '%' */ + /* parse flags */ + while (*p == '0' || *p == '-' || *p == '+' || + *p == ' ' || *p == '#' || *p == '\'') { + switch (*p) { + case '0': + zero_padding = 1; + break; + case '-': + justify_left = 1; + break; + case '+': + force_sign = 1; + space_for_positive = 0; + break; + case ' ': + force_sign = 1; + /* If both the ' ' and '+' flags appear, the ' ' flag should be ignored */ + break; + case '#': + alternate_form = 1; + break; + case '\'': + break; + } + p++; + } + /* If the '0' and '-' flags both appear, the '0' flag should be ignored. */ - /* parse field width */ - if (*p == '*') { - int j; - p++; j = va_arg(ap, int); - if (j >= 0) min_field_width = j; - else { min_field_width = -j; justify_left = 1; } - } else if (isdigit((int)(*p))) { - /* size_t could be wider than unsigned int; - make sure we treat argument like common implementations do */ - unsigned int uj = *p++ - '0'; - while (isdigit((int)(*p))) uj = 10*uj + (unsigned int)(*p++ - '0'); - min_field_width = uj; - } - /* parse precision */ - if (*p == '.') { - p++; precision_specified = 1; - if (*p == '*') { - int j = va_arg(ap, int); - p++; - if (j >= 0) precision = j; - else { - precision_specified = 0; precision = 0; - /* NOTE: - * Solaris 2.6 man page claims that in this case the precision - * should be set to 0. Digital Unix 4.0, HPUX 10 and BSD man page - * claim that this case should be treated as unspecified precision, - * which is what we do here. - */ - } - } else if (isdigit((int)(*p))) { - /* size_t could be wider than unsigned int; - make sure we treat argument like common implementations do */ - unsigned int uj = *p++ - '0'; - while (isdigit((int)(*p))) uj = 10*uj + (unsigned int)(*p++ - '0'); - precision = uj; - } - } - /* parse 'h', 'l' and 'll' length modifiers */ - if (*p == 'h' || *p == 'l') { - length_modifier = *p; p++; - if (length_modifier == 'l' && *p == 'l') { /* double l = long long */ + /* parse field width */ + if (*p == '*') { + int j; + p++; + j = va_arg(ap, int); + if (j >= 0) min_field_width = j; + else { min_field_width = -j; justify_left = 1; } + } else if (isdigit((int)(*p))) { + /* size_t could be wider than unsigned int; + make sure we treat argument like common implementations do */ + unsigned int uj = *p++ - '0'; + while (isdigit((int)(*p))) uj = 10 * uj + (unsigned int)(*p++ - '0'); + min_field_width = uj; + } + /* parse precision */ + if (*p == '.') { + p++; + precision_specified = 1; + if (*p == '*') { + int j = va_arg(ap, int); + p++; + if (j >= 0) precision = j; + else { + precision_specified = 0; + precision = 0; + /* NOTE: + * Solaris 2.6 man page claims that in this case the precision + * should be set to 0. Digital Unix 4.0, HPUX 10 and BSD man page + * claim that this case should be treated as unspecified precision, + * which is what we do here. + */ + } + } else if (isdigit((int)(*p))) { + /* size_t could be wider than unsigned int; + make sure we treat argument like common implementations do */ + unsigned int uj = *p++ - '0'; + while (isdigit((int)(*p))) uj = 10 * uj + (unsigned int)(*p++ - '0'); + precision = uj; + } + } + /* parse 'h', 'l' and 'll' length modifiers */ + if (*p == 'h' || *p == 'l') { + length_modifier = *p; + p++; + if (length_modifier == 'l' && *p == 'l') { /* double l = long long */ #ifdef SNPRINTF_LONGLONG_SUPPORT - length_modifier = '2'; /* double l encoded as '2' */ + length_modifier = '2'; /* double l encoded as '2' */ #else - length_modifier = 'l'; /* treat it as a single 'l' */ + length_modifier = 'l'; /* treat it as a single 'l' */ #endif - p++; - } - } - fmt_spec = *p; - /* common synonyms: */ - switch (fmt_spec) { - case 'i': fmt_spec = 'd'; break; - case 'D': fmt_spec = 'd'; length_modifier = 'l'; break; - case 'U': fmt_spec = 'u'; length_modifier = 'l'; break; - case 'O': fmt_spec = 'o'; length_modifier = 'l'; break; - default: break; - } - /* get parameter value, do initial processing */ - switch (fmt_spec) { - case '%': /* % behaves similar to 's' regarding flags and field widths */ - case 'c': /* c behaves similar to 's' regarding flags and field widths */ - case 's': - length_modifier = '\0'; /* wint_t and wchar_t not supported */ - /* the result of zero padding flag with non-numeric conversion specifier*/ - /* is undefined. Solaris and HPUX 10 does zero padding in this case, */ - /* Digital Unix and Linux does not. */ - zero_padding = 0; /* turn zero padding off for string conversions */ - str_arg_l = 1; - switch (fmt_spec) { - case '%': - str_arg = p; break; - case 'c': { - int j = va_arg(ap, int); - uchar_arg = (unsigned char) j; /* standard demands unsigned char */ - str_arg = (const char *) &uchar_arg; - break; - } - case 's': - str_arg = va_arg(ap, const char *); - if (!str_arg) str_arg_l = 0; - /* make sure not to address string beyond the specified precision !!! */ - else if (!precision_specified) str_arg_l = strlen(str_arg); - /* truncate string if necessary as requested by precision */ - else if (precision == 0) str_arg_l = 0; - else { - /* memchr on HP does not like n > 2^31 !!! */ - const char *q = (const char*) memchr(str_arg, '\0', - precision <= 0x7fffffff ? precision : 0x7fffffff); - str_arg_l = !q ? precision : (q-str_arg); - } - break; - default: break; - } - break; - case 'd': case 'u': case 'o': case 'x': case 'X': case 'p': { - /* NOTE: the u, o, x, X and p conversion specifiers imply - the value is unsigned; d implies a signed value */ + p++; + } + } + fmt_spec = *p; + /* common synonyms: */ + switch (fmt_spec) { + case 'i': + fmt_spec = 'd'; + break; + case 'D': + fmt_spec = 'd'; + length_modifier = 'l'; + break; + case 'U': + fmt_spec = 'u'; + length_modifier = 'l'; + break; + case 'O': + fmt_spec = 'o'; + length_modifier = 'l'; + break; + default: + break; + } + /* get parameter value, do initial processing */ + switch (fmt_spec) { + case '%': /* % behaves similar to 's' regarding flags and field widths */ + case 'c': /* c behaves similar to 's' regarding flags and field widths */ + case 's': + length_modifier = '\0'; /* wint_t and wchar_t not supported */ + /* the result of zero padding flag with non-numeric conversion specifier*/ + /* is undefined. Solaris and HPUX 10 does zero padding in this case, */ + /* Digital Unix and Linux does not. */ + zero_padding = 0; /* turn zero padding off for string conversions */ + str_arg_l = 1; + switch (fmt_spec) { + case '%': + str_arg = p; + break; + case 'c': { + int j = va_arg(ap, int); + uchar_arg = (unsigned char) j; /* standard demands unsigned char */ + str_arg = (const char *) & uchar_arg; + break; + } + case 's': + str_arg = va_arg(ap, const char *); + if (!str_arg) str_arg_l = 0; + /* make sure not to address string beyond the specified precision !!! */ + else if (!precision_specified) str_arg_l = strlen(str_arg); + /* truncate string if necessary as requested by precision */ + else if (precision == 0) str_arg_l = 0; + else { + /* memchr on HP does not like n > 2^31 !!! */ + const char *q = (const char*) memchr(str_arg, '\0', + precision <= 0x7fffffff ? precision : 0x7fffffff); + str_arg_l = !q ? precision : (q - str_arg); + } + break; + default: + break; + } + break; + case 'd': + case 'u': + case 'o': + case 'x': + case 'X': + case 'p': { + /* NOTE: the u, o, x, X and p conversion specifiers imply + the value is unsigned; d implies a signed value */ - int arg_sign = 0; - /* 0 if numeric argument is zero (or if pointer is NULL for 'p'), - +1 if greater than zero (or nonzero for unsigned arguments), - -1 if negative (unsigned argument is never negative) */ + int arg_sign = 0; + /* 0 if numeric argument is zero (or if pointer is NULL for 'p'), + +1 if greater than zero (or nonzero for unsigned arguments), + -1 if negative (unsigned argument is never negative) */ - int int_arg = 0; unsigned int uint_arg = 0; - /* only defined for length modifier h, or for no length modifiers */ + int int_arg = 0; + unsigned int uint_arg = 0; + /* only defined for length modifier h, or for no length modifiers */ - long int long_arg = 0; unsigned long int ulong_arg = 0; - /* only defined for length modifier l */ + long int long_arg = 0; + unsigned long int ulong_arg = 0; + /* only defined for length modifier l */ - void *ptr_arg = NULL; - /* pointer argument value -only defined for p conversion */ + void *ptr_arg = NULL; + /* pointer argument value -only defined for p conversion */ #ifdef SNPRINTF_LONGLONG_SUPPORT - long long int long_long_arg = 0; - unsigned long long int ulong_long_arg = 0; - /* only defined for length modifier ll */ + long long int long_long_arg = 0; + unsigned long long int ulong_long_arg = 0; + /* only defined for length modifier ll */ #endif - if (fmt_spec == 'p') { - /* HPUX 10: An l, h, ll or L before any other conversion character - * (other than d, i, u, o, x, or X) is ignored. - * Digital Unix: - * not specified, but seems to behave as HPUX does. - * Solaris: If an h, l, or L appears before any other conversion - * specifier (other than d, i, u, o, x, or X), the behavior - * is undefined. (Actually %hp converts only 16-bits of address - * and %llp treats address as 64-bit data which is incompatible - * with (void *) argument on a 32-bit system). - */ - length_modifier = '\0'; - ptr_arg = va_arg(ap, void *); - if (ptr_arg != NULL) arg_sign = 1; - } else if (fmt_spec == 'd') { /* signed */ - switch (length_modifier) { - case '\0': - case 'h': - /* It is non-portable to specify a second argument of char or short - * to va_arg, because arguments seen by the called function - * are not char or short. C converts char and short arguments - * to int before passing them to a function. - */ - int_arg = va_arg(ap, int); - if (int_arg > 0) arg_sign = 1; - else if (int_arg < 0) arg_sign = -1; - break; - case 'l': - long_arg = va_arg(ap, long int); - if (long_arg > 0) arg_sign = 1; - else if (long_arg < 0) arg_sign = -1; - break; + if (fmt_spec == 'p') { + /* HPUX 10: An l, h, ll or L before any other conversion character + * (other than d, i, u, o, x, or X) is ignored. + * Digital Unix: + * not specified, but seems to behave as HPUX does. + * Solaris: If an h, l, or L appears before any other conversion + * specifier (other than d, i, u, o, x, or X), the behavior + * is undefined. (Actually %hp converts only 16-bits of address + * and %llp treats address as 64-bit data which is incompatible + * with (void *) argument on a 32-bit system). + */ + length_modifier = '\0'; + ptr_arg = va_arg(ap, void *); + if (ptr_arg != NULL) arg_sign = 1; + } else if (fmt_spec == 'd') { /* signed */ + switch (length_modifier) { + case '\0': + case 'h': + /* It is non-portable to specify a second argument of char or short + * to va_arg, because arguments seen by the called function + * are not char or short. C converts char and short arguments + * to int before passing them to a function. + */ + int_arg = va_arg(ap, int); + if (int_arg > 0) arg_sign = 1; + else if (int_arg < 0) arg_sign = -1; + break; + case 'l': + long_arg = va_arg(ap, long int); + if (long_arg > 0) arg_sign = 1; + else if (long_arg < 0) arg_sign = -1; + break; #ifdef SNPRINTF_LONGLONG_SUPPORT - case '2': - long_long_arg = va_arg(ap, long long int); - if (long_long_arg > 0) arg_sign = 1; - else if (long_long_arg < 0) arg_sign = -1; - break; + case '2': + long_long_arg = va_arg(ap, long long int); + if (long_long_arg > 0) arg_sign = 1; + else if (long_long_arg < 0) arg_sign = -1; + break; #endif - } - } else { /* unsigned */ - switch (length_modifier) { - case '\0': - case 'h': - uint_arg = va_arg(ap, unsigned int); - if (uint_arg) arg_sign = 1; - break; - case 'l': - ulong_arg = va_arg(ap, unsigned long int); - if (ulong_arg) arg_sign = 1; - break; + } + } else { /* unsigned */ + switch (length_modifier) { + case '\0': + case 'h': + uint_arg = va_arg(ap, unsigned int); + if (uint_arg) arg_sign = 1; + break; + case 'l': + ulong_arg = va_arg(ap, unsigned long int); + if (ulong_arg) arg_sign = 1; + break; #ifdef SNPRINTF_LONGLONG_SUPPORT - case '2': - ulong_long_arg = va_arg(ap, unsigned long long int); - if (ulong_long_arg) arg_sign = 1; - break; + case '2': + ulong_long_arg = va_arg(ap, unsigned long long int); + if (ulong_long_arg) arg_sign = 1; + break; #endif - } - } - str_arg = tmp; str_arg_l = 0; - /* NOTE: - * For d, i, u, o, x, and X conversions, if precision is specified, - * the '0' flag should be ignored. This is so with Solaris 2.6, - * Digital UNIX 4.0, HPUX 10, Linux, FreeBSD, NetBSD; but not with Perl. - */ - if (precision_specified) zero_padding = 0; - if (fmt_spec == 'd') { - if (force_sign && arg_sign >= 0) - tmp[str_arg_l++] = space_for_positive ? ' ' : '+'; - /* leave negative numbers for sprintf to handle, - to avoid handling tricky cases like (short int)(-32768) */ - } else if (alternate_form) { - if (arg_sign != 0 && (fmt_spec == 'x' || fmt_spec == 'X') ) - { tmp[str_arg_l++] = '0'; tmp[str_arg_l++] = fmt_spec; } - /* alternate form should have no effect for p conversion, but ... */ - } - zero_padding_insertion_ind = str_arg_l; - if (!precision_specified) precision = 1; /* default precision is 1 */ - if (precision == 0 && arg_sign == 0 - ) { - /* converted to null string */ - /* When zero value is formatted with an explicit precision 0, - the resulting formatted string is empty (d, i, u, o, x, X, p). */ - } else { - char f[5]; int f_l = 0; - f[f_l++] = '%'; /* construct a simple format string for sprintf */ - if (!length_modifier) { } - else if (length_modifier=='2') { f[f_l++] = 'l'; f[f_l++] = 'l'; } - else f[f_l++] = length_modifier; - f[f_l++] = fmt_spec; f[f_l++] = '\0'; - if (fmt_spec == 'p') str_arg_l += sprintf(tmp+str_arg_l, f, ptr_arg); - else if (fmt_spec == 'd') { /* signed */ - switch (length_modifier) { - case '\0': - case 'h': str_arg_l+=sprintf(tmp+str_arg_l, f, int_arg); break; - case 'l': str_arg_l+=sprintf(tmp+str_arg_l, f, long_arg); break; + } + } + str_arg = tmp; + str_arg_l = 0; + /* NOTE: + * For d, i, u, o, x, and X conversions, if precision is specified, + * the '0' flag should be ignored. This is so with Solaris 2.6, + * Digital UNIX 4.0, HPUX 10, Linux, FreeBSD, NetBSD; but not with Perl. + */ + if (precision_specified) zero_padding = 0; + if (fmt_spec == 'd') { + if (force_sign && arg_sign >= 0) + tmp[str_arg_l++] = space_for_positive ? ' ' : '+'; + /* leave negative numbers for sprintf to handle, + to avoid handling tricky cases like (short int)(-32768) */ + } else if (alternate_form) { + if (arg_sign != 0 && (fmt_spec == 'x' || fmt_spec == 'X')) + { tmp[str_arg_l++] = '0'; tmp[str_arg_l++] = fmt_spec; } + /* alternate form should have no effect for p conversion, but ... */ + } + zero_padding_insertion_ind = str_arg_l; + if (!precision_specified) precision = 1; /* default precision is 1 */ + if (precision == 0 && arg_sign == 0 + ) { + /* converted to null string */ + /* When zero value is formatted with an explicit precision 0, + the resulting formatted string is empty (d, i, u, o, x, X, p). */ + } else { + char f[5]; + int f_l = 0; + f[f_l++] = '%'; /* construct a simple format string for sprintf */ + if (!length_modifier) { } else if (length_modifier == '2') { f[f_l++] = 'l'; f[f_l++] = 'l'; } else f[f_l++] = length_modifier; + f[f_l++] = fmt_spec; + f[f_l++] = '\0'; + if (fmt_spec == 'p') str_arg_l += sprintf(tmp + str_arg_l, f, ptr_arg); + else if (fmt_spec == 'd') { /* signed */ + switch (length_modifier) { + case '\0': + case 'h': + str_arg_l += sprintf(tmp + str_arg_l, f, int_arg); + break; + case 'l': + str_arg_l += sprintf(tmp + str_arg_l, f, long_arg); + break; #ifdef SNPRINTF_LONGLONG_SUPPORT - case '2': str_arg_l+=sprintf(tmp+str_arg_l,f,long_long_arg); break; + case '2': + str_arg_l += sprintf(tmp + str_arg_l, f, long_long_arg); + break; #endif - } - } else { /* unsigned */ - switch (length_modifier) { - case '\0': - case 'h': str_arg_l+=sprintf(tmp+str_arg_l, f, uint_arg); break; - case 'l': str_arg_l+=sprintf(tmp+str_arg_l, f, ulong_arg); break; + } + } else { /* unsigned */ + switch (length_modifier) { + case '\0': + case 'h': + str_arg_l += sprintf(tmp + str_arg_l, f, uint_arg); + break; + case 'l': + str_arg_l += sprintf(tmp + str_arg_l, f, ulong_arg); + break; #ifdef SNPRINTF_LONGLONG_SUPPORT - case '2': str_arg_l+=sprintf(tmp+str_arg_l,f,ulong_long_arg);break; + case '2': + str_arg_l += sprintf(tmp + str_arg_l, f, ulong_long_arg); + break; #endif - } - } - /* include the optional minus sign and possible "0x" - in the region before the zero padding insertion point */ - if (zero_padding_insertion_ind < str_arg_l && - tmp[zero_padding_insertion_ind] == '-') { - zero_padding_insertion_ind++; - } - if (zero_padding_insertion_ind+1 < str_arg_l && - tmp[zero_padding_insertion_ind] == '0' && - (tmp[zero_padding_insertion_ind+1] == 'x' || - tmp[zero_padding_insertion_ind+1] == 'X') ) { - zero_padding_insertion_ind += 2; - } - } - { size_t num_of_digits = str_arg_l - zero_padding_insertion_ind; - if (alternate_form && fmt_spec == 'o' - /* unless zero is already the first character */ - && !(zero_padding_insertion_ind < str_arg_l - && tmp[zero_padding_insertion_ind] == '0') - ) { /* assure leading zero for alternate-form octal numbers */ - if (!precision_specified || precision < num_of_digits+1) { - /* precision is increased to force the first character to be zero, - except if a zero value is formatted with an explicit precision - of zero */ - precision = num_of_digits+1; precision_specified = 1; - } - } - /* zero padding to specified precision? */ - if (num_of_digits < precision) - number_of_zeros_to_pad = precision - num_of_digits; - } - /* zero padding to specified minimal field width? */ - if (!justify_left && zero_padding) { - int n = min_field_width - (str_arg_l+number_of_zeros_to_pad); - if (n > 0) number_of_zeros_to_pad += n; - } - break; - } - default: /* unrecognized conversion specifier, keep format string as-is*/ - zero_padding = 0; /* turn zero padding off for non-numeric convers. */ - justify_left = 1; min_field_width = 0; /* reset flags */ - /* discard the unrecognized conversion, just keep * - * the unrecognized conversion character */ - str_arg = p; str_arg_l = 0; - if (*p) str_arg_l++; /* include invalid conversion specifier unchanged + } + } + /* include the optional minus sign and possible "0x" + in the region before the zero padding insertion point */ + if (zero_padding_insertion_ind < str_arg_l && + tmp[zero_padding_insertion_ind] == '-') { + zero_padding_insertion_ind++; + } + if (zero_padding_insertion_ind + 1 < str_arg_l && + tmp[zero_padding_insertion_ind] == '0' && + (tmp[zero_padding_insertion_ind+1] == 'x' || + tmp[zero_padding_insertion_ind+1] == 'X')) { + zero_padding_insertion_ind += 2; + } + } + { + size_t num_of_digits = str_arg_l - zero_padding_insertion_ind; + if (alternate_form && fmt_spec == 'o' + /* unless zero is already the first character */ + && !(zero_padding_insertion_ind < str_arg_l + && tmp[zero_padding_insertion_ind] == '0') + ) { /* assure leading zero for alternate-form octal numbers */ + if (!precision_specified || precision < num_of_digits + 1) { + /* precision is increased to force the first character to be zero, + except if a zero value is formatted with an explicit precision + of zero */ + precision = num_of_digits + 1; + precision_specified = 1; + } + } + /* zero padding to specified precision? */ + if (num_of_digits < precision) + number_of_zeros_to_pad = precision - num_of_digits; + } + /* zero padding to specified minimal field width? */ + if (!justify_left && zero_padding) { + int n = min_field_width - (str_arg_l + number_of_zeros_to_pad); + if (n > 0) number_of_zeros_to_pad += n; + } + break; + } + default: /* unrecognized conversion specifier, keep format string as-is*/ + zero_padding = 0; /* turn zero padding off for non-numeric convers. */ + justify_left = 1; + min_field_width = 0; /* reset flags */ + /* discard the unrecognized conversion, just keep * + * the unrecognized conversion character */ + str_arg = p; + str_arg_l = 0; + if (*p) str_arg_l++; /* include invalid conversion specifier unchanged if not at end-of-string */ - break; - } - if (*p) p++; /* step over the just processed conversion specifier */ - /* insert padding to the left as requested by min_field_width; - this does not include the zero padding in case of numerical conversions*/ - if (!justify_left) { /* left padding with blank or zero */ - int n = min_field_width - (str_arg_l+number_of_zeros_to_pad); - if (n > 0) { - if (str_l < str_m) { - size_t avail = str_m-str_l; - fast_memset(str+str_l, (zero_padding?'0':' '), (n>avail?avail:n)); - } - str_l += n; - } - } - /* zero padding as requested by the precision or by the minimal field width - * for numeric conversions required? */ - if (number_of_zeros_to_pad <= 0) { - /* will not copy first part of numeric right now, * - * force it to be copied later in its entirety */ - zero_padding_insertion_ind = 0; - } else { - /* insert first part of numerics (sign or '0x') before zero padding */ - int n = zero_padding_insertion_ind; - if (n > 0) { - if (str_l < str_m) { - size_t avail = str_m-str_l; - fast_memcpy(str+str_l, str_arg, (n>avail?avail:n)); - } - str_l += n; - } - /* insert zero padding as requested by the precision or min field width */ - n = number_of_zeros_to_pad; - if (n > 0) { - if (str_l < str_m) { - size_t avail = str_m-str_l; - fast_memset(str+str_l, '0', (n>avail?avail:n)); - } - str_l += n; - } - } - /* insert formatted string - * (or as-is conversion specifier for unknown conversions) */ - { int n = str_arg_l - zero_padding_insertion_ind; - if (n > 0) { - if (str_l < str_m) { - size_t avail = str_m-str_l; - fast_memcpy(str+str_l, str_arg+zero_padding_insertion_ind, - (n>avail?avail:n)); - } - str_l += n; - } - } - /* insert right padding */ - if (justify_left) { /* right blank padding to the field width */ - int n = min_field_width - (str_arg_l+number_of_zeros_to_pad); - if (n > 0) { - if (str_l < str_m) { - size_t avail = str_m-str_l; - fast_memset(str+str_l, ' ', (n>avail?avail:n)); - } - str_l += n; - } - } - } - } - if (str_m > 0) { /* make sure the string is null-terminated + break; + } + if (*p) p++; /* step over the just processed conversion specifier */ + /* insert padding to the left as requested by min_field_width; + this does not include the zero padding in case of numerical conversions*/ + if (!justify_left) { /* left padding with blank or zero */ + int n = min_field_width - (str_arg_l + number_of_zeros_to_pad); + if (n > 0) { + if (str_l < str_m) { + size_t avail = str_m - str_l; + fast_memset(str + str_l, (zero_padding ? '0' : ' '), (n > avail ? avail : n)); + } + str_l += n; + } + } + /* zero padding as requested by the precision or by the minimal field width + * for numeric conversions required? */ + if (number_of_zeros_to_pad <= 0) { + /* will not copy first part of numeric right now, * + * force it to be copied later in its entirety */ + zero_padding_insertion_ind = 0; + } else { + /* insert first part of numerics (sign or '0x') before zero padding */ + int n = zero_padding_insertion_ind; + if (n > 0) { + if (str_l < str_m) { + size_t avail = str_m - str_l; + fast_memcpy(str + str_l, str_arg, (n > avail ? avail : n)); + } + str_l += n; + } + /* insert zero padding as requested by the precision or min field width */ + n = number_of_zeros_to_pad; + if (n > 0) { + if (str_l < str_m) { + size_t avail = str_m - str_l; + fast_memset(str + str_l, '0', (n > avail ? avail : n)); + } + str_l += n; + } + } + /* insert formatted string + * (or as-is conversion specifier for unknown conversions) */ + { + int n = str_arg_l - zero_padding_insertion_ind; + if (n > 0) { + if (str_l < str_m) { + size_t avail = str_m - str_l; + fast_memcpy(str + str_l, str_arg + zero_padding_insertion_ind, + (n > avail ? avail : n)); + } + str_l += n; + } + } + /* insert right padding */ + if (justify_left) { /* right blank padding to the field width */ + int n = min_field_width - (str_arg_l + number_of_zeros_to_pad); + if (n > 0) { + if (str_l < str_m) { + size_t avail = str_m - str_l; + fast_memset(str + str_l, ' ', (n > avail ? avail : n)); + } + str_l += n; + } + } + } + } + if (str_m > 0) { /* make sure the string is null-terminated even at the expense of overwriting the last character (shouldn't happen, but just in case) */ - str[str_l <= str_m-1 ? str_l : str_m-1] = '\0'; - } - /* Return the number of characters formatted (excluding trailing null - * character), that is, the number of characters that would have been - * written to the buffer if it were large enough. - * - * The value of str_l should be returned, but str_l is of unsigned type - * size_t, and snprintf is int, possibly leading to an undetected - * integer overflow, resulting in a negative return value, which is illegal. - * Both XSH5 and ISO C99 (at least the draft) are silent on this issue. - * Should errno be set to EOVERFLOW and EOF returned in this case??? - */ - return (int) str_l; + str[str_l <= str_m-1 ? str_l : str_m-1] = '\0'; + } + /* Return the number of characters formatted (excluding trailing null + * character), that is, the number of characters that would have been + * written to the buffer if it were large enough. + * + * The value of str_l should be returned, but str_l is of unsigned type + * size_t, and snprintf is int, possibly leading to an undetected + * integer overflow, resulting in a negative return value, which is illegal. + * Both XSH5 and ISO C99 (at least the draft) are silent on this issue. + * Should errno be set to EOVERFLOW and EOF returned in this case??? + */ + return (int) str_l; } int symbian_snprintf(char *text, size_t maxlen, const char *fmt, ...) { diff --git a/backends/platform/webos/webos.mk b/backends/platform/webos/webos.mk index 885c9eb90e..22df5622ee 100644 --- a/backends/platform/webos/webos.mk +++ b/backends/platform/webos/webos.mk @@ -1,23 +1,70 @@ # WebOS specific build targets +# ============================================================================ +# +# Run "make webosrelease" to create a release package to be uploaded to the +# Palm app catalog. +# +# Run "make webosbeta" to create a beta package to be uploaded to the Palm +# Beta app catalog. +# +# Before calling these targets the ScummVM source must be configured for a +# WebOS build. See +# http://wiki.scummvm.org/index.php/Compiling_ScummVM/WebOS for details. +# +# VER_PACKAGE must be set to a number which is higher than the currently +# used package version in the app catalog. So when creating an updated +# package for ScummVM 1.3.9 and the current ScummVM package in the app +# catalog is version 1.3.0902 then you must specify VER_PACKAGE=3 to create +# the ScummVM package with version 1.3.0903. Yeah, I know that's ugly but +# WebOS package version numbers are restricted to three numeric components. +# +# As long as Palm doesn't support Team-maintained apps the uploaded packages +# MUST NOT be packaged with the default "org.scummvm" base id. Instead apps +# must be uploaded with a user-specific base id. A good practice is using +# the github user as base id: com.github.<username>. It is also necessary +# to use a user-specific app name when submitting the created package to the +# Palm app catalog. Use "ScummVM (<username>)" instead of "ScummVM" and +# "ScummVM Beta (<username>)" instead of "ScummVM Beta". PATH_DIST = $(srcdir)/dists/webos PATH_MOJO = $(PATH_DIST)/mojo +BASE_APP_ID = org.scummvm +APP_ID = $(BASE_APP_ID).scummvm +BETA_APP_ID = $(APP_ID)-beta +APP_VERSION = $(shell printf "%d.%d.%02d%02d" $(VER_MAJOR) $(VER_MINOR) $(VER_PATCH) $(VER_PACKAGE)) +STAGING_DIR=STAGING/$(APP_ID) -STAGING_DIR=STAGING/org.scummvm.scummvm +webosprepare: all + $(QUIET)if [ "$(VER_PACKAGE)" = "" ]; \ + then \ + echo "ERROR: VER_PACKAGE is not set"; \ + echo "Example: export VER_PACKAGE=1"; \ + exit 1; \ + fi + $(QUIET)$(RM_REC) $(STAGING_DIR) + $(QUIET)$(MKDIR) $(STAGING_DIR) + $(QUIET)$(MKDIR) $(STAGING_DIR)/bin + $(QUIET)$(MKDIR) $(STAGING_DIR)/lib + $(QUIET)$(MKDIR) $(STAGING_DIR)/share/scummvm + $(QUIET)$(CP) $(PATH_MOJO)/* $(STAGING_DIR) + $(QUIET)$(CP) gui/themes/translations.dat $(STAGING_DIR)/share/scummvm + $(QUIET)$(CP) gui/themes/scummmodern.zip $(STAGING_DIR)/share/scummvm + $(QUIET)$(CP) scummvm $(STAGING_DIR)/bin + $(QUIET)$(STRIP) $(STAGING_DIR)/bin/scummvm + $(QUIET)sed -i s/'APP_VERSION'/'$(APP_VERSION)'/ $(STAGING_DIR)/appinfo.json -webosrelease: - rm -rf $(STAGING_DIR) - rm -f *.ipk - mkdir -p $(STAGING_DIR) - mkdir -p $(STAGING_DIR)/bin - mkdir -p $(STAGING_DIR)/lib - mkdir -p $(STAGING_DIR)/share/scummvm - cp -f $(PATH_MOJO)/* $(STAGING_DIR) - cp -f gui/themes/translations.dat $(STAGING_DIR)/share/scummvm - cp -f gui/themes/scummmodern.zip $(STAGING_DIR)/share/scummvm - cp -f scummvm $(STAGING_DIR)/bin - $(STRIP) $(STAGING_DIR)/bin/scummvm - $(WEBOS_SDK)/bin/palm-package $(STAGING_DIR) - rm -rf STAGING +webosrelease: webosprepare + $(QUIET)$(RM) $(APP_ID)_*.ipk + $(QUIET)sed -i s/'APP_ID'/'$(APP_ID)'/ $(STAGING_DIR)/appinfo.json + $(QUIET)sed -i s/'APP_TITLE'/'ScummVM'/ $(STAGING_DIR)/appinfo.json + $(QUIET)$(WEBOS_SDK)/bin/palm-package --use-v1-format $(STAGING_DIR) + $(QUIET)$(RM_REC) STAGING -.PHONY: webosrelease +webosbeta: webosprepare + $(QUIET)$(RM) $(BETA_APP_ID)_*.ipk + $(QUIET)sed -i s/'APP_ID'/'$(BETA_APP_ID)'/ $(STAGING_DIR)/appinfo.json + $(QUIET)sed -i s/'APP_TITLE'/'ScummVM Beta'/ $(STAGING_DIR)/appinfo.json + $(QUIET)$(WEBOS_SDK)/bin/palm-package --use-v1-format $(STAGING_DIR) + $(QUIET)$(RM_REC) STAGING + +.PHONY: webosrelease webosbeta diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp index 2aefe48f0c..54da27126c 100644 --- a/backends/platform/wii/osystem.cpp +++ b/backends/platform/wii/osystem.cpp @@ -26,6 +26,7 @@ #include <ogc/lwp_watchdog.h> #include "common/config-manager.h" +#include "common/textconsole.h" #include "backends/fs/wii/wii-fs-factory.h" #include "osystem.h" diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h index 3c992b8bdc..d1ea8e07ae 100644 --- a/backends/platform/wii/osystem.h +++ b/backends/platform/wii/osystem.h @@ -36,6 +36,7 @@ #include "backends/saves/default/default-saves.h" #include "backends/timer/default/default-timer.h" #include "graphics/colormasks.h" +#include "graphics/palette.h" #include "graphics/surface.h" #include "audio/mixer_intern.h" diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index b829686cb0..b54aebe6bd 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -33,6 +33,7 @@ #include "common/debug.h" #include "common/events.h" #include "common/util.h" +#include "common/textconsole.h" #include "common/timer.h" #include "common/translation.h" |