diff options
Diffstat (limited to 'backends')
155 files changed, 2239 insertions, 1185 deletions
diff --git a/backends/audiocd/sdl/sdl-audiocd.cpp b/backends/audiocd/sdl/sdl-audiocd.cpp index 4136c34403..82c9549a57 100644 --- a/backends/audiocd/sdl/sdl-audiocd.cpp +++ b/backends/audiocd/sdl/sdl-audiocd.cpp @@ -27,6 +27,7 @@ #if defined(SDL_BACKEND) +#include "common/textconsole.h" #include "backends/audiocd/sdl/sdl-audiocd.h" SdlAudioCDManager::SdlAudioCDManager() diff --git a/backends/events/default/default-events.h b/backends/events/default/default-events.h index 06db1dc027..73dc60695b 100644 --- a/backends/events/default/default-events.h +++ b/backends/events/default/default-events.h @@ -31,10 +31,10 @@ namespace Common { #ifdef ENABLE_KEYMAPPER - class Keymapper; +class Keymapper; #endif #ifdef ENABLE_VKEYBD - class VirtualKeyboard; +class VirtualKeyboard; #endif } diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp index ce846a0836..6e343b63f5 100644 --- a/backends/events/sdl/sdl-events.cpp +++ b/backends/events/sdl/sdl-events.cpp @@ -31,6 +31,7 @@ #include "backends/platform/sdl/sdl.h" #include "backends/graphics/graphics.h" #include "common/config-manager.h" +#include "common/textconsole.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 @@ -65,7 +66,7 @@ SdlEventSource::SdlEventSource() // Enable joystick if (SDL_NumJoysticks() > 0) { - printf("Using joystick: %s\n", SDL_JoystickName(0)); + debug("Using joystick: %s", SDL_JoystickName(0)); _joystick = SDL_JoystickOpen(joystick_num); } } diff --git a/backends/events/webossdl/webossdl-events.cpp b/backends/events/webossdl/webossdl-events.cpp index fd9628995d..3f3efe9e2a 100644 --- a/backends/events/webossdl/webossdl-events.cpp +++ b/backends/events/webossdl/webossdl-events.cpp @@ -25,7 +25,11 @@ #ifdef WEBOS +// Allow use of stuff in <time.h> +#define FORBIDDEN_SYMBOL_EXCEPTION_time_h + #include "common/scummsys.h" +#include "common/system.h" #include "sys/time.h" #include "time.h" @@ -35,9 +39,6 @@ // Inidicates if gesture area is pressed down or not. static bool gestureDown = false; -// The timestamp when gesture area was pressed down. -static int gestureDownTime = 0; - // The timestamp when screen was pressed down. static int screenDownTime = 0; @@ -91,6 +92,8 @@ void WebOSSdlEventSource::SDLModToOSystemKeyFlags(SDLMod mod, event.kbd.flags |= Common::KBD_SHIFT; if (mod & KMOD_CTRL) event.kbd.flags |= Common::KBD_CTRL; + + // Holding down the gesture area emulates the ALT key if (gestureDown) event.kbd.flags |= Common::KBD_ALT; } @@ -107,10 +110,17 @@ bool WebOSSdlEventSource::handleKeyDown(SDL_Event &ev, Common::Event &event) { // Handle gesture area tap. if (ev.key.keysym.sym == SDLK_WORLD_71) { gestureDown = true; - gestureDownTime = getMillis(); return true; } + // Ensure that ALT key (Gesture down) is ignored when back or forward + // gesture is detected. This is needed for WebOS 1 which releases the + // gesture tap AFTER the backward gesture event and not BEFORE (Like + // WebOS 2). + if (ev.key.keysym.sym == 27 || ev.key.keysym.sym == 229) { + gestureDown = false; + } + // Call original SDL key handler. return SdlEventSource::handleKeyDown(ev, event); } diff --git a/backends/fs/amigaos4/amigaos4-fs-factory.cpp b/backends/fs/amigaos4/amigaos4-fs-factory.cpp index 2c7dc61278..51c2c294d4 100644 --- a/backends/fs/amigaos4/amigaos4-fs-factory.cpp +++ b/backends/fs/amigaos4/amigaos4-fs-factory.cpp @@ -23,8 +23,9 @@ */ #if defined(__amigaos4__) + #include "backends/fs/amigaos4/amigaos4-fs-factory.h" -#include "backends/fs/amigaos4/amigaos4-fs.cpp" +#include "backends/fs/amigaos4/amigaos4-fs.h" AbstractFSNode *AmigaOSFilesystemFactory::makeRootFileNode() const { return new AmigaOSFilesystemNode(); diff --git a/backends/fs/amigaos4/amigaos4-fs.cpp b/backends/fs/amigaos4/amigaos4-fs.cpp index 8a57a3cf1c..4f763ef9e8 100644 --- a/backends/fs/amigaos4/amigaos4-fs.cpp +++ b/backends/fs/amigaos4/amigaos4-fs.cpp @@ -23,97 +23,16 @@ */ #if defined(__amigaos4__) -#ifdef __USE_INLINE__ -#undef __USE_INLINE__ -#endif - -#include <proto/exec.h> -#include <proto/dos.h> -#include <stdio.h> - -#ifndef USE_NEWLIB -#include <strings.h> -#endif +#include "backends/fs/amigaos4/amigaos4-fs.h" +#include "backends/fs/stdiostream.h" #include "common/debug.h" #include "common/util.h" -#include "backends/fs/abstract-fs.h" -#include "backends/fs/stdiostream.h" #define ENTER() /* debug(6, "Enter") */ #define LEAVE() /* debug(6, "Leave") */ /** - * Implementation of the ScummVM file system API. - * - * Parts of this class are documented in the base interface class, AbstractFSNode. - */ -class AmigaOSFilesystemNode : public AbstractFSNode { -protected: - BPTR _pFileLock; - Common::String _sDisplayName; - Common::String _sPath; - bool _bIsDirectory; - bool _bIsValid; - uint32 _nProt; - - /** - * Creates a list with all the volumes present in the root node. - */ - virtual AbstractFSList listVolumes() const; - -public: - /** - * Creates an AmigaOSFilesystemNode with the root node as path. - */ - AmigaOSFilesystemNode(); - - /** - * Creates an AmigaOSFilesystemNode for a given path. - * - * @param path Common::String with the path the new node should point to. - */ - AmigaOSFilesystemNode(const Common::String &p); - - /** - * Creates an AmigaOSFilesystemNode given its lock and display name - * - * @param pLock BPTR to the lock. - * @param pDisplayName name to be used for display, in case not supplied the FilePart() of the filename will be used. - * - * @note This shouldn't even be public as it's only internally, at best it should have been protected if not private - */ - AmigaOSFilesystemNode(BPTR pLock, const char *pDisplayName = 0); - - /** - * Copy constructor. - * - * @note Needed because it duplicates the file lock - */ - AmigaOSFilesystemNode(const AmigaOSFilesystemNode &node); - - /** - * Destructor. - */ - virtual ~AmigaOSFilesystemNode(); - - virtual bool exists() const; - virtual Common::String getDisplayName() const { return _sDisplayName; }; - virtual Common::String getName() const { return _sDisplayName; }; - virtual Common::String getPath() const { return _sPath; }; - virtual bool isDirectory() const { return _bIsDirectory; }; - virtual bool isReadable() const; - virtual bool isWritable() const; - - virtual AbstractFSNode *getChild(const Common::String &n) const; - virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; - virtual AbstractFSNode *getParent() const; - - virtual Common::SeekableReadStream *createReadStream(); - virtual Common::WriteStream *createWriteStream(); -}; - -/** * Returns the last component of a given path. * * @param str Common::String containing the path. @@ -497,11 +416,11 @@ AbstractFSList AmigaOSFilesystemNode::listVolumes() const { } Common::SeekableReadStream *AmigaOSFilesystemNode::createReadStream() { - return StdioStream::makeFromPath(getPath().c_str(), false); + return StdioStream::makeFromPath(getPath(), false); } Common::WriteStream *AmigaOSFilesystemNode::createWriteStream() { - return StdioStream::makeFromPath(getPath().c_str(), true); + return StdioStream::makeFromPath(getPath(), true); } #endif //defined(__amigaos4__) diff --git a/backends/fs/amigaos4/amigaos4-fs.h b/backends/fs/amigaos4/amigaos4-fs.h new file mode 100644 index 0000000000..83188f89f1 --- /dev/null +++ b/backends/fs/amigaos4/amigaos4-fs.h @@ -0,0 +1,113 @@ +/* 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 AMIGAOS_FILESYSTEM_H +#define AMIGAOS_FILESYSTEM_H + +#ifdef __USE_INLINE__ +#undef __USE_INLINE__ +#endif + +#include <proto/exec.h> +#include <proto/dos.h> +#include <stdio.h> + +#ifndef USE_NEWLIB +#include <strings.h> +#endif + +#include "backends/fs/abstract-fs.h" + +/** + * Implementation of the ScummVM file system API. + * + * Parts of this class are documented in the base interface class, AbstractFSNode. + */ +class AmigaOSFilesystemNode : public AbstractFSNode { +protected: + BPTR _pFileLock; + Common::String _sDisplayName; + Common::String _sPath; + bool _bIsDirectory; + bool _bIsValid; + uint32 _nProt; + + /** + * Creates a list with all the volumes present in the root node. + */ + virtual AbstractFSList listVolumes() const; + +public: + /** + * Creates an AmigaOSFilesystemNode with the root node as path. + */ + AmigaOSFilesystemNode(); + + /** + * Creates an AmigaOSFilesystemNode for a given path. + * + * @param path Common::String with the path the new node should point to. + */ + AmigaOSFilesystemNode(const Common::String &p); + + /** + * Creates an AmigaOSFilesystemNode given its lock and display name + * + * @param pLock BPTR to the lock. + * @param pDisplayName name to be used for display, in case not supplied the FilePart() of the filename will be used. + * + * @note This shouldn't even be public as it's only internally, at best it should have been protected if not private + */ + AmigaOSFilesystemNode(BPTR pLock, const char *pDisplayName = 0); + + /** + * Copy constructor. + * + * @note Needed because it duplicates the file lock + */ + AmigaOSFilesystemNode(const AmigaOSFilesystemNode &node); + + /** + * Destructor. + */ + virtual ~AmigaOSFilesystemNode(); + + virtual bool exists() const; + virtual Common::String getDisplayName() const { return _sDisplayName; }; + virtual Common::String getName() const { return _sDisplayName; }; + virtual Common::String getPath() const { return _sPath; }; + virtual bool isDirectory() const { return _bIsDirectory; }; + virtual bool isReadable() const; + virtual bool isWritable() const; + + virtual AbstractFSNode *getChild(const Common::String &n) const; + virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; + virtual AbstractFSNode *getParent() const; + + virtual Common::SeekableReadStream *createReadStream(); + virtual Common::WriteStream *createWriteStream(); +}; + + +#endif diff --git a/backends/fs/n64/n64-fs-factory.cpp b/backends/fs/n64/n64-fs-factory.cpp index 7e314693b8..e362e3214a 100644 --- a/backends/fs/n64/n64-fs-factory.cpp +++ b/backends/fs/n64/n64-fs-factory.cpp @@ -25,9 +25,10 @@ #ifdef __N64__ #include <n64utils.h> +#include <romfs.h> #include "backends/fs/n64/n64-fs-factory.h" -#include "backends/fs/n64/n64-fs.cpp" +#include "backends/fs/n64/n64-fs.h" AbstractFSNode *N64FilesystemFactory::makeRootFileNode() const { return new N64FilesystemNode(); diff --git a/backends/fs/n64/n64-fs-factory.h b/backends/fs/n64/n64-fs-factory.h index 915153c6f8..35bad9600a 100644 --- a/backends/fs/n64/n64-fs-factory.h +++ b/backends/fs/n64/n64-fs-factory.h @@ -25,7 +25,6 @@ #ifndef N64_FILESYSTEM_FACTORY_H #define N64_FILESYSTEM_FACTORY_H -#include <romfs.h> #include "backends/fs/fs-factory.h" /** diff --git a/backends/fs/n64/n64-fs.cpp b/backends/fs/n64/n64-fs.cpp index 4def84afcd..e712c198a9 100644 --- a/backends/fs/n64/n64-fs.cpp +++ b/backends/fs/n64/n64-fs.cpp @@ -22,65 +22,18 @@ #ifdef __N64__ -#include "backends/fs/abstract-fs.h" +#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h + +#include "backends/fs/n64/n64-fs.h" #include "backends/fs/n64/romfsstream.h" +#include <romfs.h> #include <sys/param.h> #include <unistd.h> #include <n64utils.h> #define ROOT_PATH "/" -/** - * Implementation of the ScummVM file system API based on N64 Hkz romfs. - * - * Parts of this class are documented in the base interface class, AbstractFSNode. - */ -class N64FilesystemNode : public AbstractFSNode { -protected: - Common::String _displayName; - Common::String _path; - bool _isDirectory; - bool _isValid; - -public: - /** - * Creates a N64FilesystemNode with the root node as path. - */ - N64FilesystemNode(); - - /** - * Creates a N64FilesystemNode for a given path. - * - * @param path Common::String with the path the new node should point to. - * @param verify true if the isValid and isDirectory flags should be verified during the construction. - */ - N64FilesystemNode(const Common::String &p, bool verify = true); - - virtual bool exists() const; - virtual Common::String getDisplayName() const { - return _displayName; - } - virtual Common::String getName() const { - return _displayName; - } - virtual Common::String getPath() const { - return _path; - } - virtual bool isDirectory() const { - return _isDirectory; - } - virtual bool isReadable() const; - virtual bool isWritable() const; - - virtual AbstractFSNode *getChild(const Common::String &n) const; - virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; - virtual AbstractFSNode *getParent() const; - - virtual Common::SeekableReadStream *createReadStream(); - virtual Common::WriteStream *createWriteStream(); -}; - N64FilesystemNode::N64FilesystemNode() { _isDirectory = true; _displayName = "Root"; diff --git a/backends/fs/n64/n64-fs.h b/backends/fs/n64/n64-fs.h new file mode 100644 index 0000000000..3a5dd375b9 --- /dev/null +++ b/backends/fs/n64/n64-fs.h @@ -0,0 +1,80 @@ +/* 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 N64_FILESYSTEM_H +#define N64_FILESYSTEM_H + +#include "backends/fs/abstract-fs.h" + +/** + * Implementation of the ScummVM file system API based on N64 Hkz romfs. + * + * Parts of this class are documented in the base interface class, AbstractFSNode. + */ +class N64FilesystemNode : public AbstractFSNode { +protected: + Common::String _displayName; + Common::String _path; + bool _isDirectory; + bool _isValid; + +public: + /** + * Creates a N64FilesystemNode with the root node as path. + */ + N64FilesystemNode(); + + /** + * Creates a N64FilesystemNode for a given path. + * + * @param path Common::String with the path the new node should point to. + * @param verify true if the isValid and isDirectory flags should be verified during the construction. + */ + N64FilesystemNode(const Common::String &p, bool verify = true); + + virtual bool exists() const; + virtual Common::String getDisplayName() const { + return _displayName; + } + virtual Common::String getName() const { + return _displayName; + } + virtual Common::String getPath() const { + return _path; + } + virtual bool isDirectory() const { + return _isDirectory; + } + virtual bool isReadable() const; + virtual bool isWritable() const; + + virtual AbstractFSNode *getChild(const Common::String &n) const; + virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; + virtual AbstractFSNode *getParent() const; + + virtual Common::SeekableReadStream *createReadStream(); + virtual Common::WriteStream *createWriteStream(); +}; + +#endif diff --git a/backends/fs/posix/posix-fs-factory.cpp b/backends/fs/posix/posix-fs-factory.cpp index df21d41dda..639f57ac06 100644 --- a/backends/fs/posix/posix-fs-factory.cpp +++ b/backends/fs/posix/posix-fs-factory.cpp @@ -23,8 +23,15 @@ */ #if defined(UNIX) + +// Re-enable some forbidden symbols to avoid clashes with stat.h and unistd.h. +// Also with clock() in sys/time.h in some Mac OS X SDKs. +#define FORBIDDEN_SYMBOL_EXCEPTION_time_h +#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h +#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir + #include "backends/fs/posix/posix-fs-factory.h" -#include "backends/fs/posix/posix-fs.cpp" +#include "backends/fs/posix/posix-fs.h" AbstractFSNode *POSIXFilesystemFactory::makeRootFileNode() const { return new POSIXFilesystemNode("/"); diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp index b218e9dd59..34edb78504 100644 --- a/backends/fs/posix/posix-fs.cpp +++ b/backends/fs/posix/posix-fs.cpp @@ -24,6 +24,12 @@ #if defined(UNIX) +// Re-enable some forbidden symbols to avoid clashes with stat.h and unistd.h. +// Also with clock() in sys/time.h in some Mac OS X SDKs. +#define FORBIDDEN_SYMBOL_EXCEPTION_time_h +#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h +#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir + #include "backends/fs/posix/posix-fs.h" #include "backends/fs/stdiostream.h" #include "common/algorithm.h" @@ -238,11 +244,11 @@ AbstractFSNode *POSIXFilesystemNode::getParent() const { } Common::SeekableReadStream *POSIXFilesystemNode::createReadStream() { - return StdioStream::makeFromPath(getPath().c_str(), false); + return StdioStream::makeFromPath(getPath(), false); } Common::WriteStream *POSIXFilesystemNode::createWriteStream() { - return StdioStream::makeFromPath(getPath().c_str(), true); + return StdioStream::makeFromPath(getPath(), true); } #endif //#if defined(UNIX) diff --git a/backends/fs/posix/posix-fs.h b/backends/fs/posix/posix-fs.h index 859e8973b3..003a0b38d0 100644 --- a/backends/fs/posix/posix-fs.h +++ b/backends/fs/posix/posix-fs.h @@ -83,4 +83,4 @@ private: virtual void setFlags(); }; -#endif /*POSIX_FILESYSTEM_H*/ +#endif diff --git a/backends/fs/ps2/ps2-fs-factory.cpp b/backends/fs/ps2/ps2-fs-factory.cpp index 8b5202bff4..9e7ec3fa10 100644 --- a/backends/fs/ps2/ps2-fs-factory.cpp +++ b/backends/fs/ps2/ps2-fs-factory.cpp @@ -28,7 +28,7 @@ #define FORBIDDEN_SYMBOL_ALLOW_ALL #include "backends/fs/ps2/ps2-fs-factory.h" -#include "backends/fs/ps2/ps2-fs.cpp" +#include "backends/fs/ps2/ps2-fs.h" DECLARE_SINGLETON(Ps2FilesystemFactory); @@ -43,4 +43,5 @@ AbstractFSNode *Ps2FilesystemFactory::makeCurrentDirectoryFileNode() const { AbstractFSNode *Ps2FilesystemFactory::makeFileNodePath(const Common::String &path) const { return new Ps2FilesystemNode(path, true); } + #endif diff --git a/backends/fs/ps2/ps2-fs-factory.h b/backends/fs/ps2/ps2-fs-factory.h index 3a1dec252d..f193982d6b 100644 --- a/backends/fs/ps2/ps2-fs-factory.h +++ b/backends/fs/ps2/ps2-fs-factory.h @@ -39,9 +39,6 @@ public: virtual AbstractFSNode *makeCurrentDirectoryFileNode() const; virtual AbstractFSNode *makeFileNodePath(const Common::String &path) const; -protected: - Ps2FilesystemFactory() {}; - private: friend class Common::Singleton<SingletonBaseType>; }; diff --git a/backends/fs/ps2/ps2-fs.cpp b/backends/fs/ps2/ps2-fs.cpp index 0968ecc9d3..24cc6bd30a 100644 --- a/backends/fs/ps2/ps2-fs.cpp +++ b/backends/fs/ps2/ps2-fs.cpp @@ -22,7 +22,14 @@ * $Id$ */ -#include "backends/fs/abstract-fs.h" +#if defined(__PLAYSTATION2__) + +// Disable symbol overrides so that we can use system headers. +#define FORBIDDEN_SYMBOL_ALLOW_ALL + + +#include "backends/fs/ps2/ps2-fs.h" + #include <kernel.h> #include <stdio.h> #include <stdlib.h> @@ -40,81 +47,6 @@ extern AsyncFio fio; extern OSystem_PS2 *g_systemPs2; -/** - * Implementation of the ScummVM file system API based on the Ps2SDK. - * - * Parts of this class are documented in the base interface class, AbstractFSNode. - */ -class Ps2FilesystemNode : public AbstractFSNode { - -friend class Ps2FilesystemFactory; - -protected: - Common::String _displayName; - Common::String _path; - bool _isDirectory; - bool _isRoot; - bool _isHere; - bool _verified; - -private: - const char *getDeviceDescription() const; - void doverify(); - -public: - /** - * Creates a PS2FilesystemNode with the root node as path. - */ - Ps2FilesystemNode(); - - /** - * Creates a PS2FilesystemNode for a given path. - * - * @param path Common::String with the path the new node should point to. - */ - Ps2FilesystemNode(const Common::String &path); - Ps2FilesystemNode(const Common::String &path, bool verify); - - /** - * Copy constructor. - */ - Ps2FilesystemNode(const Ps2FilesystemNode *node); - - virtual Common::String getDisplayName() const { return _displayName; } - virtual Common::String getName() const { return _displayName; } - virtual Common::String getPath() const { return _path; } - - virtual bool exists() const { - // printf("%s : is %d\n", _path.c_str(), _isHere); - return _isHere; - } - - virtual bool isDirectory() const { - // printf("%s : dir %d\n", _path.c_str(), _isDirectory); - return _isDirectory; - } - - virtual bool isReadable() const { - return _isHere; - } - - virtual bool isWritable() const { - if (strncmp(_path.c_str(), "cdfs", 4)==0) - return false; - return true; // exists(); // creating ? - } - - virtual AbstractFSNode *clone() const { return new Ps2FilesystemNode(this); } - virtual AbstractFSNode *getChild(const Common::String &n) const; - virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; - virtual AbstractFSNode *getParent() const; - - virtual Common::SeekableReadStream *createReadStream(); - virtual Common::WriteStream *createWriteStream(); - - int getDev() { return 0; }; -}; - const char *_lastPathComponent(const Common::String &str) { if (str.empty()) return ""; @@ -502,10 +434,12 @@ const char *Ps2FilesystemNode::getDeviceDescription() const { } Common::SeekableReadStream *Ps2FilesystemNode::createReadStream() { - Common::SeekableReadStream *ss = PS2FileStream::makeFromPath(getPath().c_str(), false); + Common::SeekableReadStream *ss = PS2FileStream::makeFromPath(getPath(), false); return ss; } Common::WriteStream *Ps2FilesystemNode::createWriteStream() { - return PS2FileStream::makeFromPath(getPath().c_str(), true); + return PS2FileStream::makeFromPath(getPath(), true); } + +#endif diff --git a/backends/fs/ps2/ps2-fs.h b/backends/fs/ps2/ps2-fs.h new file mode 100644 index 0000000000..0c37ceeb91 --- /dev/null +++ b/backends/fs/ps2/ps2-fs.h @@ -0,0 +1,105 @@ +/* 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 PS2_FILESYSTEM_H +#define PS2_FILESYSTEM_H + +#include "backends/fs/abstract-fs.h" + +/** + * Implementation of the ScummVM file system API based on the Ps2SDK. + * + * Parts of this class are documented in the base interface class, AbstractFSNode. + */ +class Ps2FilesystemNode : public AbstractFSNode { + +friend class Ps2FilesystemFactory; + +protected: + Common::String _displayName; + Common::String _path; + bool _isDirectory; + bool _isRoot; + bool _isHere; + bool _verified; + +private: + const char *getDeviceDescription() const; + void doverify(); + +public: + /** + * Creates a PS2FilesystemNode with the root node as path. + */ + Ps2FilesystemNode(); + + /** + * Creates a PS2FilesystemNode for a given path. + * + * @param path Common::String with the path the new node should point to. + */ + Ps2FilesystemNode(const Common::String &path); + Ps2FilesystemNode(const Common::String &path, bool verify); + + /** + * Copy constructor. + */ + Ps2FilesystemNode(const Ps2FilesystemNode *node); + + virtual Common::String getDisplayName() const { return _displayName; } + virtual Common::String getName() const { return _displayName; } + virtual Common::String getPath() const { return _path; } + + virtual bool exists() const { + // printf("%s : is %d\n", _path.c_str(), _isHere); + return _isHere; + } + + virtual bool isDirectory() const { + // printf("%s : dir %d\n", _path.c_str(), _isDirectory); + return _isDirectory; + } + + virtual bool isReadable() const { + return _isHere; + } + + virtual bool isWritable() const { + if (strncmp(_path.c_str(), "cdfs", 4)==0) + return false; + return true; // exists(); // creating ? + } + + virtual AbstractFSNode *clone() const { return new Ps2FilesystemNode(this); } + virtual AbstractFSNode *getChild(const Common::String &n) const; + virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; + virtual AbstractFSNode *getParent() const; + + virtual Common::SeekableReadStream *createReadStream(); + virtual Common::WriteStream *createWriteStream(); + + int getDev() { return 0; }; +}; + +#endif diff --git a/backends/fs/psp/psp-fs-factory.cpp b/backends/fs/psp/psp-fs-factory.cpp index 7ed84de034..aee541d12a 100644 --- a/backends/fs/psp/psp-fs-factory.cpp +++ b/backends/fs/psp/psp-fs-factory.cpp @@ -23,8 +23,28 @@ */ #if defined(__PSP__) + +// Disable printf override in common/forbidden.h to avoid +// clashes with pspdebug.h from the PSP SDK. +// That header file uses +// __attribute__((format(printf,1,2))); +// which gets messed up by our override mechanism; this could +// be avoided by either changing the PSP SDK to use the equally +// legal and valid +// __attribute__((format(__printf__,1,2))); +// or by refining our printf override to use a varadic macro +// (which then wouldn't be portable, though). +// Anyway, for now we just disable the printf override globally +// for the PSP port +#define FORBIDDEN_SYMBOL_EXCEPTION_printf + +#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h + #include "backends/fs/psp/psp-fs-factory.h" -#include "backends/fs/psp/psp-fs.cpp" +#include "backends/fs/psp/psp-fs.h" +#include "backends/platform/psp/powerman.h" + +#include <unistd.h> DECLARE_SINGLETON(PSPFilesystemFactory); @@ -34,7 +54,7 @@ AbstractFSNode *PSPFilesystemFactory::makeRootFileNode() const { AbstractFSNode *PSPFilesystemFactory::makeCurrentDirectoryFileNode() const { char buf[MAXPATHLEN]; - char * ret = 0; + char *ret = 0; PowerMan.beginCriticalSection(); ret = getcwd(buf, MAXPATHLEN); @@ -46,4 +66,5 @@ AbstractFSNode *PSPFilesystemFactory::makeCurrentDirectoryFileNode() const { AbstractFSNode *PSPFilesystemFactory::makeFileNodePath(const Common::String &path) const { return new PSPFilesystemNode(path, true); } + #endif diff --git a/backends/fs/psp/psp-fs.cpp b/backends/fs/psp/psp-fs.cpp index 16a0e9cd5b..908430b2f9 100644 --- a/backends/fs/psp/psp-fs.cpp +++ b/backends/fs/psp/psp-fs.cpp @@ -22,12 +22,32 @@ * $Id$ */ -#ifdef __PSP__ +#if defined(__PSP__) -#include "engines/engine.h" -#include "backends/fs/abstract-fs.h" +// Disable printf override in common/forbidden.h to avoid +// clashes with pspdebug.h from the PSP SDK. +// That header file uses +// __attribute__((format(printf,1,2))); +// which gets messed up by our override mechanism; this could +// be avoided by either changing the PSP SDK to use the equally +// legal and valid +// __attribute__((format(__printf__,1,2))); +// or by refining our printf override to use a varadic macro +// (which then wouldn't be portable, though). +// Anyway, for now we just disable the printf override globally +// for the PSP port +#define FORBIDDEN_SYMBOL_EXCEPTION_printf + +#define FORBIDDEN_SYMBOL_EXCEPTION_time_h + +#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h + +#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir + +#include "backends/fs/psp/psp-fs.h" #include "backends/fs/psp/psp-stream.h" #include "common/bufferedstream.h" +#include "engines/engine.h" #include <sys/stat.h> #include <unistd.h> @@ -41,48 +61,6 @@ //#define __PSP_DEBUG_PRINT__ /* For debug printouts */ #include "backends/platform/psp/trace.h" -/** - * Implementation of the ScummVM file system API based on PSPSDK API. - * - * Parts of this class are documented in the base interface class, AbstractFSNode. - */ -class PSPFilesystemNode : public AbstractFSNode { -protected: - Common::String _displayName; - Common::String _path; - bool _isDirectory; - bool _isValid; - -public: - /** - * Creates a PSPFilesystemNode with the root node as path. - */ - PSPFilesystemNode(); - - /** - * Creates a PSPFilesystemNode for a given path. - * - * @param path Common::String with the path the new node should point to. - * @param verify true if the isValid and isDirectory flags should be verified during the construction. - */ - PSPFilesystemNode(const Common::String &p, bool verify = true); - - virtual bool exists() const; - virtual Common::String getDisplayName() const { return _displayName; } - virtual Common::String getName() const { return _displayName; } - virtual Common::String getPath() const { return _path; } - virtual bool isDirectory() const { return _isDirectory; } - virtual bool isReadable() const; - virtual bool isWritable() const; - - virtual AbstractFSNode *getChild(const Common::String &n) const; - virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; - virtual AbstractFSNode *getParent() const; - - virtual Common::SeekableReadStream *createReadStream(); - virtual Common::WriteStream *createWriteStream(); -}; - PSPFilesystemNode::PSPFilesystemNode() { _isDirectory = true; _displayName = "Root"; diff --git a/backends/fs/psp/psp-fs.h b/backends/fs/psp/psp-fs.h new file mode 100644 index 0000000000..12d2c540c0 --- /dev/null +++ b/backends/fs/psp/psp-fs.h @@ -0,0 +1,72 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + */ + +#ifndef PSP_FILESYSTEM_H +#define PSP_FILESYSTEM_H + +#include "backends/fs/abstract-fs.h" + +/** + * Implementation of the ScummVM file system API based on PSPSDK API. + * + * Parts of this class are documented in the base interface class, AbstractFSNode. + */ +class PSPFilesystemNode : public AbstractFSNode { +protected: + Common::String _displayName; + Common::String _path; + bool _isDirectory; + bool _isValid; + +public: + /** + * Creates a PSPFilesystemNode with the root node as path. + */ + PSPFilesystemNode(); + + /** + * Creates a PSPFilesystemNode for a given path. + * + * @param path Common::String with the path the new node should point to. + * @param verify true if the isValid and isDirectory flags should be verified during the construction. + */ + PSPFilesystemNode(const Common::String &p, bool verify = true); + + virtual bool exists() const; + virtual Common::String getDisplayName() const { return _displayName; } + virtual Common::String getName() const { return _displayName; } + virtual Common::String getPath() const { return _path; } + virtual bool isDirectory() const { return _isDirectory; } + virtual bool isReadable() const; + virtual bool isWritable() const; + + virtual AbstractFSNode *getChild(const Common::String &n) const; + virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; + virtual AbstractFSNode *getParent() const; + + virtual Common::SeekableReadStream *createReadStream(); + virtual Common::WriteStream *createWriteStream(); +}; + +#endif diff --git a/backends/fs/symbian/symbian-fs-factory.cpp b/backends/fs/symbian/symbian-fs-factory.cpp index c70a67f339..9afacfebf5 100644 --- a/backends/fs/symbian/symbian-fs-factory.cpp +++ b/backends/fs/symbian/symbian-fs-factory.cpp @@ -24,7 +24,7 @@ #if defined(__SYMBIAN32__) #include "backends/fs/symbian/symbian-fs-factory.h" -#include "backends/fs/symbian/symbian-fs.cpp" +#include "backends/fs/symbian/symbian-fs.h" AbstractFSNode *SymbianFilesystemFactory::makeRootFileNode() const { return new SymbianFilesystemNode(true); diff --git a/backends/fs/symbian/symbian-fs.cpp b/backends/fs/symbian/symbian-fs.cpp index 5d4951e269..b8fc5e19f6 100644 --- a/backends/fs/symbian/symbian-fs.cpp +++ b/backends/fs/symbian/symbian-fs.cpp @@ -23,7 +23,8 @@ */ #if defined (__SYMBIAN32__) -#include "backends/fs/abstract-fs.h" + +#include "backends/fs/symbian/symbian-fs.h" #include "backends/fs/symbian/symbianstream.h" #include "backends/platform/symbian/src/symbianos.h" @@ -35,66 +36,11 @@ #define KDriveLabelSize 30 /** - * Implementation of the ScummVM file system API based on POSIX. - * - * Parts of this class are documented in the base interface class, AbstractFSNode. - */ -class SymbianFilesystemNode : public AbstractFSNode { -protected: - Common::String _displayName; - Common::String _path; - TBool _isDirectory; - TBool _isValid; - TBool _isPseudoRoot; -public: - /** - * Creates a SymbianFilesystemNode with the root node as path. - * - * @param aIsRoot true if the node will be a pseudo root, false otherwise. - */ - SymbianFilesystemNode(bool aIsRoot); - - /** - * Creates a SymbianFilesystemNode for a given path. - * - * @param path Common::String with the path the new node should point to. - */ - SymbianFilesystemNode(const Common::String &path); - - virtual bool exists() const { - TFileName fname; - TPtrC8 ptr((const unsigned char*) _path.c_str(), _path.size()); - fname.Copy(ptr); - TBool fileExists = BaflUtils::FileExists(static_cast<OSystem_SDL_Symbian*> (g_system)->FsSession(), fname); - if (!fileExists) { - TParsePtrC parser(fname); - if (parser.PathPresent() && parser.Path().Compare(_L("\\")) == KErrNone && !parser.NameOrExtPresent()) { - fileExists = ETrue; - } - } - return fileExists; - } - virtual Common::String getDisplayName() const { return _displayName; } - virtual Common::String getName() const { return _displayName; } - virtual Common::String getPath() const { return _path; } - virtual bool isDirectory() const { return _isDirectory; } - virtual bool isReadable() const { return access(_path.c_str(), R_OK) == 0; } //FIXME: this is just a stub - virtual bool isWritable() const { return access(_path.c_str(), W_OK) == 0; } //FIXME: this is just a stub - - virtual AbstractFSNode *getChild(const Common::String &n) const; - virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; - virtual AbstractFSNode *getParent() const; - - virtual Common::SeekableReadStream *createReadStream(); - virtual Common::WriteStream *createWriteStream(); -}; - -/** * Fixes the path by changing all slashes to backslashes. * * @param path Common::String with the path to be fixed. */ -static void fixFilePath(Common::String& aPath){ +static void fixFilePath(Common::String &aPath){ TInt len = aPath.size(); for (TInt index = 0; index < len; index++) { @@ -106,18 +52,15 @@ static void fixFilePath(Common::String& aPath){ SymbianFilesystemNode::SymbianFilesystemNode(bool aIsRoot) { _path = ""; - _isValid = ETrue; - _isDirectory = ETrue; + _isValid = true; + _isDirectory = true; _isPseudoRoot = aIsRoot; _displayName = "Root"; } SymbianFilesystemNode::SymbianFilesystemNode(const Common::String &path) { - if (path.size() == 0) - _isPseudoRoot = ETrue; - else - _isPseudoRoot = EFalse; + _isPseudoRoot = path.empty(); _path = path; @@ -131,18 +74,41 @@ SymbianFilesystemNode::SymbianFilesystemNode(const Common::String &path) { fname.Copy(ptr); if (static_cast<OSystem_SDL_Symbian*>(g_system)->FsSession().Entry(fname, fileAttribs) == KErrNone) { - _isValid = ETrue; + _isValid = true; _isDirectory = fileAttribs.IsDir(); } else { - _isValid = ETrue; - _isDirectory = EFalse; + _isValid = true; + _isDirectory = false; TParsePtrC parser(fname); if (parser.PathPresent() && parser.Path().Compare(_L("\\")) == KErrNone && !parser.NameOrExtPresent()) { - _isDirectory = ETrue; + _isDirectory = true; } } } +bool SymbianFilesystemNode::exists() const { + TFileName fname; + TPtrC8 ptr((const unsigned char*) _path.c_str(), _path.size()); + fname.Copy(ptr); + bool fileExists = BaflUtils::FileExists(static_cast<OSystem_SDL_Symbian*> (g_system)->FsSession(), fname); + if (!fileExists) { + TParsePtrC parser(fname); + if (parser.PathPresent() && parser.Path().Compare(_L("\\")) == KErrNone && !parser.NameOrExtPresent()) { + fileExists = true; + } + } + return fileExists; +} + +bool SymbianFilesystemNode::isReadable() const { + return access(_path.c_str(), R_OK) == 0; +} + +bool SymbianFilesystemNode::isWritable() const { + return access(_path.c_str(), W_OK) == 0; +} + + AbstractFSNode *SymbianFilesystemNode::getChild(const Common::String &n) const { assert(_isDirectory); Common::String newPath(_path); @@ -191,9 +157,9 @@ bool SymbianFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b SymbianFilesystemNode entry(false); entry._displayName = (char*) driveString8.PtrZ(); // drive_name - entry._isDirectory = ETrue; - entry._isValid = ETrue; - entry._isPseudoRoot = EFalse; + entry._isDirectory = true; + entry._isValid = true; + entry._isPseudoRoot = false; entry._path = path; myList.push_back(new SymbianFilesystemNode(entry)); } @@ -209,20 +175,20 @@ bool SymbianFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b if (static_cast<OSystem_SDL_Symbian*>(g_system)->FsSession().GetDir(fname, KEntryAttNormal|KEntryAttDir, 0, dirPtr) == KErrNone) { CleanupStack::PushL(dirPtr); - TInt cnt=dirPtr->Count(); - for (TInt loop=0;loop<cnt;loop++) { - TEntry fileentry=(*dirPtr)[loop]; + TInt cnt = dirPtr->Count(); + for (TInt loop = 0; loop < cnt; loop++) { + TEntry fileentry = (*dirPtr)[loop]; nameBuf.Copy(fileentry.iName); - SymbianFilesystemNode entry(EFalse); - entry._isPseudoRoot = EFalse; + SymbianFilesystemNode entry(false); + entry._isPseudoRoot = false; - entry._displayName =(char*) nameBuf.PtrZ(); + entry._displayName =(char *)nameBuf.PtrZ(); entry._path = _path; if (entry._path.lastChar() != '\\') entry._path+= '\\'; - entry._path +=(char*) nameBuf.PtrZ(); + entry._path +=(char *)nameBuf.PtrZ(); entry._isDirectory = fileentry.IsDir(); // Honor the chosen mode @@ -245,29 +211,27 @@ AbstractFSNode *SymbianFilesystemNode::getParent() const { // Root node is its own parent. Still we can't just return this // as the GUI code will call delete on the old node. if (!_isPseudoRoot && _path.size() > 3) { - p = new SymbianFilesystemNode(EFalse); + p = new SymbianFilesystemNode(false); const char *start = _path.c_str(); const char *end = lastPathComponent(_path, '\\'); p->_path = Common::String(start, end - start); - p->_isValid = ETrue; - p->_isDirectory = ETrue; + p->_isValid = true; + p->_isDirectory = true; p->_displayName = lastPathComponent(p->_path, '\\'); - } - else - { - p = new SymbianFilesystemNode(ETrue); + } else { + p = new SymbianFilesystemNode(true); } return p; } Common::SeekableReadStream *SymbianFilesystemNode::createReadStream() { - return SymbianStdioStream::makeFromPath(getPath().c_str(), false); + return SymbianStdioStream::makeFromPath(getPath(), false); } Common::WriteStream *SymbianFilesystemNode::createWriteStream() { - return SymbianStdioStream::makeFromPath(getPath().c_str(), true); + return SymbianStdioStream::makeFromPath(getPath(), true); } #endif //#if defined (__SYMBIAN32__) diff --git a/backends/fs/symbian/symbian-fs.h b/backends/fs/symbian/symbian-fs.h new file mode 100644 index 0000000000..9b0e80c3d6 --- /dev/null +++ b/backends/fs/symbian/symbian-fs.h @@ -0,0 +1,73 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + */ + +#ifndef SYMBIAN_FILESYSTEM_H +#define SYMBIAN_FILESYSTEM_H + +#include "backends/fs/abstract-fs.h" + +/** + * Implementation of the ScummVM file system API based on POSIX. + * + * Parts of this class are documented in the base interface class, AbstractFSNode. + */ +class SymbianFilesystemNode : public AbstractFSNode { +protected: + Common::String _displayName; + Common::String _path; + bool _isDirectory; + bool _isValid; + bool _isPseudoRoot; +public: + /** + * Creates a SymbianFilesystemNode with the root node as path. + * + * @param aIsRoot true if the node will be a pseudo root, false otherwise. + */ + SymbianFilesystemNode(bool aIsRoot); + + /** + * Creates a SymbianFilesystemNode for a given path. + * + * @param path Common::String with the path the new node should point to. + */ + SymbianFilesystemNode(const Common::String &path); + + virtual bool exists() const; + virtual Common::String getDisplayName() const { return _displayName; } + virtual Common::String getName() const { return _displayName; } + virtual Common::String getPath() const { return _path; } + virtual bool isDirectory() const { return _isDirectory; } + virtual bool isReadable() const; + virtual bool isWritable() const; + + virtual AbstractFSNode *getChild(const Common::String &n) const; + virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; + virtual AbstractFSNode *getParent() const; + + virtual Common::SeekableReadStream *createReadStream(); + virtual Common::WriteStream *createWriteStream(); +}; + +#endif diff --git a/backends/fs/wii/wii-fs-factory.cpp b/backends/fs/wii/wii-fs-factory.cpp index 6a11d7d12e..34cde8ef46 100644 --- a/backends/fs/wii/wii-fs-factory.cpp +++ b/backends/fs/wii/wii-fs-factory.cpp @@ -22,10 +22,13 @@ #if defined(__WII__) +#define FORBIDDEN_SYMBOL_EXCEPTION_printf +#define FORBIDDEN_SYMBOL_EXCEPTION_getcwd + #include <unistd.h> #include "backends/fs/wii/wii-fs-factory.h" -#include "backends/fs/wii/wii-fs.cpp" +#include "backends/fs/wii/wii-fs.h" #ifdef USE_WII_DI #include <di/di.h> diff --git a/backends/fs/wii/wii-fs.cpp b/backends/fs/wii/wii-fs.cpp index e6ba2a4aa0..eb631df1bf 100644 --- a/backends/fs/wii/wii-fs.cpp +++ b/backends/fs/wii/wii-fs.cpp @@ -22,7 +22,13 @@ #if defined(__WII__) -#include "backends/fs/abstract-fs.h" +#define FORBIDDEN_SYMBOL_EXCEPTION_time_h +#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h + +#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir + +#include "backends/fs/wii/wii-fs.h" +#include "backends/fs/wii/wii-fs-factory.h" #include "backends/fs/stdiostream.h" #include <sys/iosupport.h> @@ -34,52 +40,6 @@ #include <gctypes.h> -/** - * Implementation of the ScummVM file system API based on Wii. - * - * Parts of this class are documented in the base interface class, AbstractFSNode. - */ -class WiiFilesystemNode : public AbstractFSNode { -protected: - Common::String _displayName; - Common::String _path; - bool _exists, _isDirectory, _isReadable, _isWritable; - - virtual void initRootNode(); - virtual bool getDevopChildren(AbstractFSList &list, ListMode mode, bool hidden) const; - virtual void setFlags(const struct stat *st); - virtual void clearFlags(); - -public: - /** - * Creates a WiiFilesystemNode with the root node as path. - */ - WiiFilesystemNode(); - - /** - * Creates a WiiFilesystemNode for a given path. - * - * @param path Common::String with the path the new node should point to. - */ - WiiFilesystemNode(const Common::String &path); - WiiFilesystemNode(const Common::String &p, const struct stat *st); - - virtual bool exists() const; - virtual Common::String getDisplayName() const { return _displayName; } - virtual Common::String getName() const { return _displayName; } - virtual Common::String getPath() const { return _path; } - virtual bool isDirectory() const { return _isDirectory; } - virtual bool isReadable() const { return _isReadable; } - virtual bool isWritable() const { return _isWritable; } - - virtual AbstractFSNode *getChild(const Common::String &n) const; - virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; - virtual AbstractFSNode *getParent() const; - - virtual Common::SeekableReadStream *createReadStream(); - virtual Common::WriteStream *createWriteStream(); -}; - // gets all registered devoptab devices bool WiiFilesystemNode::getDevopChildren(AbstractFSList &list, ListMode mode, bool hidden) const { u8 i; @@ -234,11 +194,11 @@ AbstractFSNode *WiiFilesystemNode::getParent() const { } Common::SeekableReadStream *WiiFilesystemNode::createReadStream() { - return StdioStream::makeFromPath(getPath().c_str(), false); + return StdioStream::makeFromPath(getPath(), false); } Common::WriteStream *WiiFilesystemNode::createWriteStream() { - return StdioStream::makeFromPath(getPath().c_str(), true); + return StdioStream::makeFromPath(getPath(), true); } #endif //#if defined(__WII__) diff --git a/backends/fs/wii/wii-fs.h b/backends/fs/wii/wii-fs.h new file mode 100644 index 0000000000..fd160624ca --- /dev/null +++ b/backends/fs/wii/wii-fs.h @@ -0,0 +1,76 @@ +/* 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 WII_FILESYSTEM_H +#define WII_FILESYSTEM_H + +#include "backends/fs/abstract-fs.h" + +/** + * Implementation of the ScummVM file system API based on Wii. + * + * Parts of this class are documented in the base interface class, AbstractFSNode. + */ +class WiiFilesystemNode : public AbstractFSNode { +protected: + Common::String _displayName; + Common::String _path; + bool _exists, _isDirectory, _isReadable, _isWritable; + + virtual void initRootNode(); + virtual bool getDevopChildren(AbstractFSList &list, ListMode mode, bool hidden) const; + virtual void setFlags(const struct stat *st); + virtual void clearFlags(); + +public: + /** + * Creates a WiiFilesystemNode with the root node as path. + */ + WiiFilesystemNode(); + + /** + * Creates a WiiFilesystemNode for a given path. + * + * @param path Common::String with the path the new node should point to. + */ + WiiFilesystemNode(const Common::String &path); + WiiFilesystemNode(const Common::String &p, const struct stat *st); + + virtual bool exists() const; + virtual Common::String getDisplayName() const { return _displayName; } + virtual Common::String getName() const { return _displayName; } + virtual Common::String getPath() const { return _path; } + virtual bool isDirectory() const { return _isDirectory; } + virtual bool isReadable() const { return _isReadable; } + virtual bool isWritable() const { return _isWritable; } + + virtual AbstractFSNode *getChild(const Common::String &n) const; + virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; + virtual AbstractFSNode *getParent() const; + + virtual Common::SeekableReadStream *createReadStream(); + virtual Common::WriteStream *createWriteStream(); +}; + +#endif diff --git a/backends/fs/windows/windows-fs-factory.cpp b/backends/fs/windows/windows-fs-factory.cpp index ae9485a121..0b240bcbcf 100644 --- a/backends/fs/windows/windows-fs-factory.cpp +++ b/backends/fs/windows/windows-fs-factory.cpp @@ -22,13 +22,13 @@ * $Id$ */ +#if defined(WIN32) + // Disable symbol overrides so that we can use system headers. #define FORBIDDEN_SYMBOL_ALLOW_ALL -#if defined(WIN32) - #include "backends/fs/windows/windows-fs-factory.h" -#include "backends/fs/windows/windows-fs.cpp" +#include "backends/fs/windows/windows-fs.h" AbstractFSNode *WindowsFilesystemFactory::makeRootFileNode() const { return new WindowsFilesystemNode(); diff --git a/backends/fs/windows/windows-fs.cpp b/backends/fs/windows/windows-fs.cpp index 00f72773c3..8345c9d7b4 100644 --- a/backends/fs/windows/windows-fs.cpp +++ b/backends/fs/windows/windows-fs.cpp @@ -22,23 +22,13 @@ * $Id$ */ -#ifdef WIN32 +#if defined(WIN32) -#if defined(ARRAYSIZE) -#undef ARRAYSIZE -#endif -#include <windows.h> -// winnt.h defines ARRAYSIZE, but we want our own one... -#undef ARRAYSIZE -#ifdef _WIN32_WCE -#undef GetCurrentDirectory -#endif -#include "backends/fs/abstract-fs.h" +// Disable symbol overrides so that we can use system headers. +#define FORBIDDEN_SYMBOL_ALLOW_ALL + +#include "backends/fs/windows/windows-fs.h" #include "backends/fs/stdiostream.h" -#include <io.h> -#include <stdio.h> -#include <stdlib.h> -#include <tchar.h> // F_OK, R_OK and W_OK are not defined under MSVC, so we define them here // For more information on the modes used by MSVC, check: @@ -55,84 +45,17 @@ #define W_OK 2 #endif -/** - * Implementation of the ScummVM file system API based on Windows API. - * - * Parts of this class are documented in the base interface class, AbstractFSNode. - */ -class WindowsFilesystemNode : public AbstractFSNode { -protected: - Common::String _displayName; - Common::String _path; - bool _isDirectory; - bool _isPseudoRoot; - bool _isValid; - -public: - /** - * Creates a WindowsFilesystemNode with the root node as path. - * - * In regular windows systems, a virtual root path is used "". - * In windows CE, the "\" root is used instead. - */ - WindowsFilesystemNode(); - - /** - * Creates a WindowsFilesystemNode for a given path. - * - * Examples: - * path=c:\foo\bar.txt, currentDir=false -> c:\foo\bar.txt - * path=c:\foo\bar.txt, currentDir=true -> current directory - * path=NULL, currentDir=true -> current directory - * - * @param path Common::String with the path the new node should point to. - * @param currentDir if true, the path parameter will be ignored and the resulting node will point to the current directory. - */ - WindowsFilesystemNode(const Common::String &path, const bool currentDir); - - virtual bool exists() const { return _access(_path.c_str(), F_OK) == 0; } - virtual Common::String getDisplayName() const { return _displayName; } - virtual Common::String getName() const { return _displayName; } - virtual Common::String getPath() const { return _path; } - virtual bool isDirectory() const { return _isDirectory; } - virtual bool isReadable() const { return _access(_path.c_str(), R_OK) == 0; } - virtual bool isWritable() const { return _access(_path.c_str(), W_OK) == 0; } - - virtual AbstractFSNode *getChild(const Common::String &n) const; - virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; - virtual AbstractFSNode *getParent() const; - - virtual Common::SeekableReadStream *createReadStream(); - virtual Common::WriteStream *createWriteStream(); - -private: - /** - * Adds a single WindowsFilesystemNode to a given list. - * This method is used by getChildren() to populate the directory entries list. - * - * @param list List to put the file entry node in. - * @param mode Mode to use while adding the file entry to the list. - * @param base Common::String with the directory being listed. - * @param find_data Describes a file that the FindFirstFile, FindFirstFileEx, or FindNextFile functions find. - */ - static void addFile(AbstractFSList &list, ListMode mode, const char *base, WIN32_FIND_DATA* find_data); - - /** - * Converts a Unicode string to Ascii format. - * - * @param str Common::String to convert from Unicode to Ascii. - * @return str in Ascii format. - */ - static char *toAscii(TCHAR *str); - - /** - * Converts an Ascii string to Unicode format. - * - * @param str Common::String to convert from Ascii to Unicode. - * @return str in Unicode format. - */ - static const TCHAR* toUnicode(const char *str); -}; +bool WindowsFilesystemNode::exists() const { + return _access(_path.c_str(), F_OK) == 0; +} + +bool WindowsFilesystemNode::isReadable() const { + return _access(_path.c_str(), R_OK) == 0; +} + +bool WindowsFilesystemNode::isWritable() const { + return _access(_path.c_str(), W_OK) == 0; +} void WindowsFilesystemNode::addFile(AbstractFSList &list, ListMode mode, const char *base, WIN32_FIND_DATA* find_data) { WindowsFilesystemNode entry; @@ -314,11 +237,11 @@ AbstractFSNode *WindowsFilesystemNode::getParent() const { } Common::SeekableReadStream *WindowsFilesystemNode::createReadStream() { - return StdioStream::makeFromPath(getPath().c_str(), false); + return StdioStream::makeFromPath(getPath(), false); } Common::WriteStream *WindowsFilesystemNode::createWriteStream() { - return StdioStream::makeFromPath(getPath().c_str(), true); + return StdioStream::makeFromPath(getPath(), true); } #endif //#ifdef WIN32 diff --git a/backends/fs/windows/windows-fs.h b/backends/fs/windows/windows-fs.h new file mode 100644 index 0000000000..8e4880ce23 --- /dev/null +++ b/backends/fs/windows/windows-fs.h @@ -0,0 +1,123 @@ +/* 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 WINDOWS_FILESYSTEM_H +#define WINDOWS_FILESYSTEM_H + +#include "backends/fs/abstract-fs.h" + +#if defined(ARRAYSIZE) +#undef ARRAYSIZE +#endif +#include <windows.h> +// winnt.h defines ARRAYSIZE, but we want our own one... +#undef ARRAYSIZE +#ifdef _WIN32_WCE +#undef GetCurrentDirectory +#endif +#include <io.h> +#include <stdio.h> +#include <stdlib.h> +#include <tchar.h> + +/** + * Implementation of the ScummVM file system API based on Windows API. + * + * Parts of this class are documented in the base interface class, AbstractFSNode. + */ +class WindowsFilesystemNode : public AbstractFSNode { +protected: + Common::String _displayName; + Common::String _path; + bool _isDirectory; + bool _isPseudoRoot; + bool _isValid; + +public: + /** + * Creates a WindowsFilesystemNode with the root node as path. + * + * In regular windows systems, a virtual root path is used "". + * In windows CE, the "\" root is used instead. + */ + WindowsFilesystemNode(); + + /** + * Creates a WindowsFilesystemNode for a given path. + * + * Examples: + * path=c:\foo\bar.txt, currentDir=false -> c:\foo\bar.txt + * path=c:\foo\bar.txt, currentDir=true -> current directory + * path=NULL, currentDir=true -> current directory + * + * @param path Common::String with the path the new node should point to. + * @param currentDir if true, the path parameter will be ignored and the resulting node will point to the current directory. + */ + WindowsFilesystemNode(const Common::String &path, const bool currentDir); + + virtual bool exists() const; + virtual Common::String getDisplayName() const { return _displayName; } + virtual Common::String getName() const { return _displayName; } + virtual Common::String getPath() const { return _path; } + virtual bool isDirectory() const { return _isDirectory; } + virtual bool isReadable() const; + virtual bool isWritable() const; + + virtual AbstractFSNode *getChild(const Common::String &n) const; + virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; + virtual AbstractFSNode *getParent() const; + + virtual Common::SeekableReadStream *createReadStream(); + virtual Common::WriteStream *createWriteStream(); + +private: + /** + * Adds a single WindowsFilesystemNode to a given list. + * This method is used by getChildren() to populate the directory entries list. + * + * @param list List to put the file entry node in. + * @param mode Mode to use while adding the file entry to the list. + * @param base Common::String with the directory being listed. + * @param find_data Describes a file that the FindFirstFile, FindFirstFileEx, or FindNextFile functions find. + */ + static void addFile(AbstractFSList &list, ListMode mode, const char *base, WIN32_FIND_DATA* find_data); + + /** + * Converts a Unicode string to Ascii format. + * + * @param str Common::String to convert from Unicode to Ascii. + * @return str in Ascii format. + */ + static char *toAscii(TCHAR *str); + + /** + * Converts an Ascii string to Unicode format. + * + * @param str Common::String to convert from Ascii to Unicode. + * @return str in Unicode format. + */ + static const TCHAR* toUnicode(const char *str); +}; + +#endif diff --git a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp index 3c043ca986..4e2aee3a3b 100644 --- a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp +++ b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp @@ -31,6 +31,7 @@ #include "backends/events/dinguxsdl/dinguxsdl-events.h" #include "graphics/scaler/aspect.h" #include "common/mutex.h" +#include "common/textconsole.h" static const OSystem::GraphicsMode s_supportedGraphicsModes[] = { {"1x", "Standard", GFX_NORMAL}, @@ -437,14 +438,14 @@ bool DINGUXSdlGraphicsManager::loadGFXMode() { _videoMode.aspectRatioCorrection = false; } - fprintf(stdout, "Game ScreenMode = %d*%d\n", _videoMode.screenWidth, _videoMode.screenHeight); + debug("Game ScreenMode = %d*%d", _videoMode.screenWidth, _videoMode.screenHeight); if (_videoMode.screenWidth > 320 || _videoMode.screenHeight > 240) { _videoMode.aspectRatioCorrection = false; setGraphicsMode(GFX_HALF); - fprintf(stdout, "GraphicsMode set to HALF\n"); + debug("GraphicsMode set to HALF"); } else { setGraphicsMode(GFX_NORMAL); - fprintf(stdout, "GraphicsMode set to NORMAL\n"); + debug("GraphicsMode set to NORMAL"); } if ((_videoMode.mode == GFX_HALF) && !_overlayVisible) { diff --git a/backends/graphics/gph/gph-graphics.cpp b/backends/graphics/gph/gph-graphics.cpp index 4f2185ef4b..b407bf1faf 100644 --- a/backends/graphics/gph/gph-graphics.cpp +++ b/backends/graphics/gph/gph-graphics.cpp @@ -28,6 +28,7 @@ #include "backends/events/gph/gph-events.h" #include "graphics/scaler/aspect.h" #include "common/mutex.h" +#include "common/textconsole.h" static const OSystem::GraphicsMode s_supportedGraphicsModes[] = { {"1x", "Standard", GFX_NORMAL}, @@ -444,14 +445,14 @@ bool GPHGraphicsManager::loadGFXMode() { _videoMode.aspectRatioCorrection = false; } - fprintf(stdout, "Game ScreenMode = %d*%d\n", _videoMode.screenWidth, _videoMode.screenHeight); + debug("Game ScreenMode = %d*%d", _videoMode.screenWidth, _videoMode.screenHeight); if (_videoMode.screenWidth > 320 || _videoMode.screenHeight > 240) { _videoMode.aspectRatioCorrection = false; setGraphicsMode(GFX_HALF); - fprintf(stdout, "GraphicsMode set to HALF\n"); + debug("GraphicsMode set to HALF"); } else { setGraphicsMode(GFX_NORMAL); - fprintf(stdout, "GraphicsMode set to NORMAL\n"); + debug("GraphicsMode set to NORMAL"); } if ((_videoMode.mode == GFX_HALF) && !_overlayVisible) { diff --git a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp index c2dcb7f587..7d1809f4ac 100644 --- a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp +++ b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp @@ -30,6 +30,7 @@ #include "backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h" #include "backends/events/linuxmotosdl/linuxmotosdl-events.h" #include "common/mutex.h" +#include "common/textconsole.h" #include "graphics/font.h" #include "graphics/fontman.h" #include "graphics/scaler.h" @@ -143,14 +144,14 @@ void LinuxmotoSdlGraphicsManager::initSize(uint w, uint h) { } bool LinuxmotoSdlGraphicsManager::loadGFXMode() { - printf("Game ScreenMode = %d*%d\n",_videoMode.screenWidth, _videoMode.screenHeight); + debug("Game ScreenMode = %d*%d",_videoMode.screenWidth, _videoMode.screenHeight); if (_videoMode.screenWidth > 320 || _videoMode.screenHeight > 240) { _videoMode.aspectRatioCorrection = false; setGraphicsMode(GFX_HALF); - printf("GraphicsMode set to HALF\n"); + debug("GraphicsMode set to HALF"); } else { setGraphicsMode(GFX_NORMAL); - printf("GraphicsMode set to NORMAL\n"); + debug("GraphicsMode set to NORMAL"); } if (_videoMode.mode == GFX_HALF && !_overlayVisible) { _videoMode.overlayWidth = 320; diff --git a/backends/graphics/opengl/gltexture.h b/backends/graphics/opengl/gltexture.h index e7951a0c96..238b035425 100644 --- a/backends/graphics/opengl/gltexture.h +++ b/backends/graphics/opengl/gltexture.h @@ -42,9 +42,6 @@ #include "graphics/surface.h" -#include "common/rect.h" -#include "common/array.h" - /** * OpenGL texture manager class */ diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index 4ac2747d25..b85cac809e 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -32,6 +32,7 @@ #include "common/config-manager.h" #include "common/file.h" #include "common/mutex.h" +#include "common/textconsole.h" #include "common/translation.h" #ifdef USE_OSD #include "common/tokenizer.h" @@ -355,9 +356,9 @@ void OpenGLGraphicsManager::copyRectToScreen(const byte *buf, int pitch, int x, // Copy buffer data to game screen internal buffer const byte *src = buf; - byte *dst = (byte *)_screenData.pixels + y * _screenData.pitch + x * _screenData.bytesPerPixel; + byte *dst = (byte *)_screenData.pixels + y * _screenData.pitch + x * _screenData.format.bytesPerPixel; for (int i = 0; i < h; i++) { - memcpy(dst, src, w * _screenData.bytesPerPixel); + memcpy(dst, src, w * _screenData.format.bytesPerPixel); src += pitch; dst += _screenData.pitch; } @@ -466,7 +467,7 @@ void OpenGLGraphicsManager::clearOverlay() { } void OpenGLGraphicsManager::grabOverlay(OverlayColor *buf, int pitch) { - assert(_overlayData.bytesPerPixel == sizeof(buf[0])); + assert(_overlayData.format.bytesPerPixel == sizeof(buf[0])); const byte *src = (byte *)_overlayData.pixels; for (int i = 0; i < _overlayData.h; i++) { // Copy overlay data to buffer @@ -519,7 +520,7 @@ void OpenGLGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pitch const byte *src = (const byte *)buf; byte *dst = (byte *)_overlayData.pixels + y * _overlayData.pitch; for (int i = 0; i < h; i++) { - memcpy(dst + x * _overlayData.bytesPerPixel, src, w * _overlayData.bytesPerPixel); + memcpy(dst + x * _overlayData.format.bytesPerPixel, src, w * _overlayData.format.bytesPerPixel); src += pitch * sizeof(buf[0]); dst += _overlayData.pitch; } @@ -616,8 +617,8 @@ void OpenGLGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int // Allocate space for cursor data if (_cursorData.w != w || _cursorData.h != h || - _cursorData.bytesPerPixel != _cursorFormat.bytesPerPixel) - _cursorData.create(w, h, _cursorFormat.bytesPerPixel); + _cursorData.format.bytesPerPixel != _cursorFormat.bytesPerPixel) + _cursorData.create(w, h, _cursorFormat); // Save cursor data memcpy(_cursorData.pixels, buf, h * _cursorData.pitch); @@ -699,13 +700,13 @@ void OpenGLGraphicsManager::refreshGameScreen() { int w = _screenDirtyRect.width(); int h = _screenDirtyRect.height(); - if (_screenData.bytesPerPixel == 1) { + if (_screenData.format.bytesPerPixel == 1) { // Create a temporary RGB888 surface byte *surface = new byte[w * h * 3]; // Convert the paletted buffer to RGB888 const byte *src = (byte *)_screenData.pixels + y * _screenData.pitch; - src += x * _screenData.bytesPerPixel; + src += x * _screenData.format.bytesPerPixel; byte *dst = surface; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { @@ -725,7 +726,7 @@ void OpenGLGraphicsManager::refreshGameScreen() { } else { // Update the texture _gameTexture->updateBuffer((byte *)_screenData.pixels + y * _screenData.pitch + - x * _screenData.bytesPerPixel, _screenData.pitch, x, y, w, h); + x * _screenData.format.bytesPerPixel, _screenData.pitch, x, y, w, h); } _screenNeedsRedraw = false; @@ -741,13 +742,13 @@ void OpenGLGraphicsManager::refreshOverlay() { int w = _overlayDirtyRect.width(); int h = _overlayDirtyRect.height(); - if (_overlayData.bytesPerPixel == 1) { + if (_overlayData.format.bytesPerPixel == 1) { // Create a temporary RGB888 surface byte *surface = new byte[w * h * 3]; // Convert the paletted buffer to RGB888 const byte *src = (byte *)_overlayData.pixels + y * _overlayData.pitch; - src += x * _overlayData.bytesPerPixel; + src += x * _overlayData.format.bytesPerPixel; byte *dst = surface; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { @@ -767,7 +768,7 @@ void OpenGLGraphicsManager::refreshOverlay() { } else { // Update the texture _overlayTexture->updateBuffer((byte *)_overlayData.pixels + y * _overlayData.pitch + - x * _overlayData.bytesPerPixel, _overlayData.pitch, x, y, w, h); + x * _overlayData.format.bytesPerPixel, _overlayData.pitch, x, y, w, h); } _overlayNeedsRedraw = false; @@ -1175,9 +1176,9 @@ void OpenGLGraphicsManager::loadTextures() { _oldVideoMode.screenHeight != _videoMode.screenHeight) _screenData.create(_videoMode.screenWidth, _videoMode.screenHeight, #ifdef USE_RGB_COLOR - _screenFormat.bytesPerPixel + _screenFormat #else - 1 + Graphics::PixelFormat::createFormatCLUT8() #endif ); @@ -1185,7 +1186,7 @@ void OpenGLGraphicsManager::loadTextures() { if (_oldVideoMode.overlayWidth != _videoMode.overlayWidth || _oldVideoMode.overlayHeight != _videoMode.overlayHeight) _overlayData.create(_videoMode.overlayWidth, _videoMode.overlayHeight, - _overlayFormat.bytesPerPixel); + _overlayFormat); _screenNeedsRedraw = true; _overlayNeedsRedraw = true; @@ -1387,7 +1388,7 @@ void OpenGLGraphicsManager::updateOSD() { const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kOSDFont); if (_osdSurface.w != _osdTexture->getWidth() || _osdSurface.h != _osdTexture->getHeight()) - _osdSurface.create(_osdTexture->getWidth(), _osdTexture->getHeight(), 2); + _osdSurface.create(_osdTexture->getWidth(), _osdTexture->getHeight(), _overlayFormat); else // Clear everything memset(_osdSurface.pixels, 0, _osdSurface.h * _osdSurface.pitch); diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h index 374f1c196e..1725817730 100644 --- a/backends/graphics/opengl/opengl-graphics.h +++ b/backends/graphics/opengl/opengl-graphics.h @@ -28,7 +28,9 @@ #include "backends/graphics/opengl/gltexture.h" #include "backends/graphics/graphics.h" +#include "common/array.h" #include "common/events.h" +#include "graphics/pixelformat.h" // Uncomment this to enable the 'on screen display' code. #define USE_OSD 1 diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp index b9022af120..fe86dd2098 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.cpp +++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp @@ -30,6 +30,7 @@ #include "backends/graphics/openglsdl/openglsdl-graphics.h" #include "backends/platform/sdl/sdl.h" #include "common/config-manager.h" +#include "common/textconsole.h" OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager() : @@ -487,9 +488,9 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) { SDL_RWclose(file); } if (saveScreenshot(filename)) - printf("Saved '%s'\n", filename); + debug("Saved screenshot '%s'", filename); else - printf("Could not save screenshot!\n"); + warning("Could not save screenshot"); return true; } } diff --git a/backends/graphics/openpandora/op-graphics.cpp b/backends/graphics/openpandora/op-graphics.cpp index ab6974ba5f..20ee5dfc36 100644 --- a/backends/graphics/openpandora/op-graphics.cpp +++ b/backends/graphics/openpandora/op-graphics.cpp @@ -28,7 +28,6 @@ #include "backends/events/openpandora/op-events.h" #include "backends/platform/openpandora/op-sdl.h" #include "common/mutex.h" -#include "common/translation.h" #include "common/util.h" #include "graphics/scaler/aspect.h" diff --git a/backends/graphics/sdl/sdl-graphics.cpp b/backends/graphics/sdl/sdl-graphics.cpp index 67b979a830..3ae9597f1c 100644 --- a/backends/graphics/sdl/sdl-graphics.cpp +++ b/backends/graphics/sdl/sdl-graphics.cpp @@ -32,6 +32,7 @@ #include "backends/platform/sdl/sdl.h" #include "common/config-manager.h" #include "common/mutex.h" +#include "common/textconsole.h" #include "common/translation.h" #include "common/util.h" #ifdef USE_RGB_COLOR @@ -1287,9 +1288,9 @@ Graphics::Surface *SdlGraphicsManager::lockScreen() { _framebuffer.h = _screen->h; _framebuffer.pitch = _screen->pitch; #ifdef USE_RGB_COLOR - _framebuffer.bytesPerPixel = _screenFormat.bytesPerPixel; + _framebuffer.format = _screenFormat; #else - _framebuffer.bytesPerPixel = 1; + _framebuffer.format = Graphics::PixelFormat::createFormatCLUT8(); #endif return &_framebuffer; @@ -2054,7 +2055,11 @@ void SdlGraphicsManager::displayMessageOnOSD(const char *msg) { dst.w = _osdSurface->w; dst.h = _osdSurface->h; dst.pitch = _osdSurface->pitch; - dst.bytesPerPixel = _osdSurface->format->BytesPerPixel; + dst.format = Graphics::PixelFormat(_osdSurface->format->BytesPerPixel, + 8 - _osdSurface->format->Rloss, 8 - _osdSurface->format->Gloss, + 8 - _osdSurface->format->Bloss, 8 - _osdSurface->format->Aloss, + _osdSurface->format->Rshift, _osdSurface->format->Gshift, + _osdSurface->format->Bshift, _osdSurface->format->Ashift); // The font we are going to use: const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kOSDFont); @@ -2274,9 +2279,9 @@ bool SdlGraphicsManager::notifyEvent(const Common::Event &event) { SDL_RWclose(file); } if (saveScreenshot(filename)) - printf("Saved '%s'\n", filename); + debug("Saved screenshot '%s'", filename); else - printf("Could not save screenshot!\n"); + warning("Could not save screenshot"); return true; } diff --git a/backends/graphics/sdl/sdl-graphics.h b/backends/graphics/sdl/sdl-graphics.h index f467c38d5f..4895b240b0 100644 --- a/backends/graphics/sdl/sdl-graphics.h +++ b/backends/graphics/sdl/sdl-graphics.h @@ -27,6 +27,7 @@ #define BACKENDS_GRAPHICS_SDL_H #include "backends/graphics/graphics.h" +#include "graphics/pixelformat.h" #include "graphics/scaler.h" #include "common/events.h" #include "common/system.h" diff --git a/backends/graphics/wincesdl/wincesdl-graphics.cpp b/backends/graphics/wincesdl/wincesdl-graphics.cpp index 37c6624560..b15f86e8fe 100644 --- a/backends/graphics/wincesdl/wincesdl-graphics.cpp +++ b/backends/graphics/wincesdl/wincesdl-graphics.cpp @@ -28,6 +28,7 @@ #ifdef _WIN32_WCE #include "common/system.h" +#include "common/textconsole.h" #include "common/translation.h" #include "common/mutex.h" diff --git a/backends/keymapper/hardware-key.h b/backends/keymapper/hardware-key.h index 7c608a53fc..b6d9dbf042 100644 --- a/backends/keymapper/hardware-key.h +++ b/backends/keymapper/hardware-key.h @@ -31,6 +31,7 @@ #ifdef ENABLE_KEYMAPPER #include "backends/keymapper/types.h" +#include "common/textconsole.h" namespace Common { diff --git a/backends/keymapper/remap-dialog.cpp b/backends/keymapper/remap-dialog.cpp index 2f913055fc..8edc26a526 100644 --- a/backends/keymapper/remap-dialog.cpp +++ b/backends/keymapper/remap-dialog.cpp @@ -26,6 +26,7 @@ #ifdef ENABLE_KEYMAPPER +#include "common/system.h" #include "gui/gui-manager.h" #include "gui/widgets/popup.h" #include "gui/widgets/scrollbar.h" diff --git a/backends/keymapper/remap-dialog.h b/backends/keymapper/remap-dialog.h index 2c0e79a79d..5721d368a4 100644 --- a/backends/keymapper/remap-dialog.h +++ b/backends/keymapper/remap-dialog.h @@ -33,8 +33,10 @@ #include "gui/dialog.h" namespace GUI { - class PopupWidget; - class ScrollBarWidget; +class ButtonWidget; +class PopUpWidget; +class ScrollBarWidget; +class StaticTextWidget; } namespace Common { diff --git a/backends/midi/alsa.cpp b/backends/midi/alsa.cpp index 2257f60e27..bc8fab6a56 100644 --- a/backends/midi/alsa.cpp +++ b/backends/midi/alsa.cpp @@ -30,6 +30,8 @@ #if defined(USE_ALSA) #include "common/config-manager.h" +#include "common/error.h" +#include "common/textconsole.h" #include "common/util.h" #include "audio/musicplugin.h" #include "audio/mpu401.h" @@ -181,6 +183,11 @@ void MidiDriver_ALSA::close() { } void MidiDriver_ALSA::send(uint32 b) { + if (!_isOpen) { + warning("MidiDriver_ALSA: Got event while not open"); + return; + } + unsigned int midiCmd[4]; ev.type = SND_SEQ_EVENT_OSS; @@ -254,6 +261,11 @@ void MidiDriver_ALSA::send(uint32 b) { } void MidiDriver_ALSA::sysEx(const byte *msg, uint16 length) { + if (!_isOpen) { + warning("MidiDriver_ALSA: Got SysEx while not open"); + return; + } + unsigned char buf[266]; assert(length + 2 <= ARRAYSIZE(buf)); diff --git a/backends/midi/camd.cpp b/backends/midi/camd.cpp index ee3baaadd2..aafc7347f0 100644 --- a/backends/midi/camd.cpp +++ b/backends/midi/camd.cpp @@ -29,6 +29,8 @@ #if defined(__amigaos4__) +#include "common/textconsole.h" +#include "common/error.h" #include "common/endian.h" #include "common/util.h" #include "audio/musicplugin.h" @@ -114,11 +116,21 @@ void MidiDriver_CAMD::close() { } void MidiDriver_CAMD::send(uint32 b) { + if (!_isOpen) { + warning("MidiDriver_CAMD: Got event while not open"); + return; + } + ULONG data = READ_LE_UINT32(&b); _ICamd->PutMidi(_midi_link, data); } void MidiDriver_CAMD::sysEx(const byte *msg, uint16 length) { + if (!_isOpen) { + warning("MidiDriver_CAMD: Got SysEx while not open"); + return; + } + unsigned char buf[266]; assert(length + 2 <= ARRAYSIZE(buf)); @@ -135,8 +147,8 @@ void MidiDriver_CAMD::sysEx(const byte *msg, uint16 length) { char *MidiDriver_CAMD::getDevice() { char *retname = NULL; - APTR key; - if (key = _ICamd->LockCAMD(CD_Linkages)) { + APTR key = _ICamd->LockCAMD(CD_Linkages); + if (key != NULL) { struct MidiCluster *cluster = _ICamd->NextCluster(NULL); while (cluster && !retname) { diff --git a/backends/midi/coreaudio.cpp b/backends/midi/coreaudio.cpp index 0158cc4a1d..52d32cb5e3 100644 --- a/backends/midi/coreaudio.cpp +++ b/backends/midi/coreaudio.cpp @@ -41,6 +41,8 @@ #include "common/config-manager.h" +#include "common/error.h" +#include "common/textconsole.h" #include "common/util.h" #include "audio/musicplugin.h" #include "audio/mpu401.h" diff --git a/backends/midi/coremidi.cpp b/backends/midi/coremidi.cpp index 9123c9bc8c..87cd6307ba 100644 --- a/backends/midi/coremidi.cpp +++ b/backends/midi/coremidi.cpp @@ -30,6 +30,8 @@ #ifdef MACOSX #include "common/config-manager.h" +#include "common/error.h" +#include "common/textconsole.h" #include "common/util.h" #include "audio/musicplugin.h" #include "audio/mpu401.h" diff --git a/backends/midi/dmedia.cpp b/backends/midi/dmedia.cpp index c4c1968354..ba6d58d52d 100644 --- a/backends/midi/dmedia.cpp +++ b/backends/midi/dmedia.cpp @@ -34,9 +34,10 @@ #if defined(IRIX) -#include "common/scummsys.h" -#include "common/util.h" #include "common/config-manager.h" +#include "common/error.h" +#include "common/textconsole.h" +#include "common/util.h" #include "audio/musicplugin.h" #include "audio/mpu401.h" diff --git a/backends/midi/seq.cpp b/backends/midi/seq.cpp index 7cd7f0a38e..b90a9b19e0 100644 --- a/backends/midi/seq.cpp +++ b/backends/midi/seq.cpp @@ -35,6 +35,8 @@ #if defined(USE_SEQ_MIDI) +#include "common/error.h" +#include "common/textconsole.h" #include "common/util.h" #include "audio/musicplugin.h" #include "audio/mpu401.h" diff --git a/backends/midi/timidity.cpp b/backends/midi/timidity.cpp index c01b9bbef7..84d2846eda 100644 --- a/backends/midi/timidity.cpp +++ b/backends/midi/timidity.cpp @@ -41,13 +41,13 @@ #if defined(USE_TIMIDITY) -#include "common/util.h" #include "common/endian.h" +#include "common/error.h" #include "common/str.h" +#include "common/textconsole.h" #include "audio/musicplugin.h" #include "audio/mpu401.h" -#include <fcntl.h> #include <unistd.h> #include <stdio.h> #include <string.h> @@ -560,4 +560,4 @@ Common::Error TimidityMusicPlugin::createInstance(MidiDriver **mididriver, MidiD REGISTER_PLUGIN_STATIC(TIMIDITY, PLUGIN_TYPE_MUSIC, TimidityMusicPlugin); //#endif -#endif // defined (UNIX) +#endif // defined (USE_TIMIDITY) diff --git a/backends/midi/windows.cpp b/backends/midi/windows.cpp index aad7f48d94..292bbea79e 100644 --- a/backends/midi/windows.cpp +++ b/backends/midi/windows.cpp @@ -38,6 +38,8 @@ #include "audio/mpu401.h" #include "common/config-manager.h" #include "common/translation.h" +#include "common/textconsole.h" +#include "common/error.h" #include <mmsystem.h> diff --git a/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp b/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp index 6b0074862e..93c779ea5f 100644 --- a/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp +++ b/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp @@ -23,7 +23,7 @@ * */ -#if defined(MACOSX) || defined(GP2X) +#if defined(MACOSX) || defined(GP2X) || defined(CAANOO) || defined(GP2XWIZ) #include "backends/mixer/doublebuffersdl/doublebuffersdl-mixer.h" diff --git a/backends/mixer/sdl/sdl-mixer.cpp b/backends/mixer/sdl/sdl-mixer.cpp index fa2bf3e232..90629954c5 100644 --- a/backends/mixer/sdl/sdl-mixer.cpp +++ b/backends/mixer/sdl/sdl-mixer.cpp @@ -26,8 +26,10 @@ #if defined(SDL_BACKEND) #include "backends/mixer/sdl/sdl-mixer.h" +#include "common/debug.h" #include "common/system.h" #include "common/config-manager.h" +#include "common/textconsole.h" #ifdef GP2X #define SAMPLES_PER_SEC 11025 diff --git a/backends/mixer/wincesdl/wincesdl-mixer.cpp b/backends/mixer/wincesdl/wincesdl-mixer.cpp index fb8a7d10c7..17cf0ced49 100644 --- a/backends/mixer/wincesdl/wincesdl-mixer.cpp +++ b/backends/mixer/wincesdl/wincesdl-mixer.cpp @@ -32,14 +32,19 @@ #include "backends/platform/wince/wince-sdl.h" #include "backends/mixer/wincesdl/wincesdl-mixer.h" #include "common/system.h" +#include "common/textconsole.h" #ifdef USE_VORBIS #ifndef USE_TREMOR #include <vorbis/vorbisfile.h> #else +#ifdef USE_TREMOLO +#include <tremolo/ivorbisfile.h> +#else #include <tremor/ivorbisfile.h> #endif #endif +#endif #define SAMPLES_PER_SEC_OLD 11025 #define SAMPLES_PER_SEC_NEW 22050 diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp index 19cba89af3..b691250289 100644 --- a/backends/modular-backend.cpp +++ b/backends/modular-backend.cpp @@ -26,12 +26,14 @@ #include "backends/modular-backend.h" #include "backends/fs/fs-factory.h" -#include "backends/events/default/default-events.h" -#include "backends/audiocd/default/default-audiocd.h" -#include "backends/mutex/null/null-mutex.h" -#include "backends/graphics/null/null-graphics.h" +#include "backends/audiocd/audiocd.h" +#include "backends/graphics/graphics.h" +#include "backends/mutex/mutex.h" +#include "audio/mixer.h" +#include "common/events.h" #include "gui/message.h" +#include "graphics/pixelformat.h" ModularBackend::ModularBackend() : diff --git a/backends/module.mk b/backends/module.mk index 426409ab73..c665b66e39 100644 --- a/backends/module.mk +++ b/backends/module.mk @@ -4,103 +4,142 @@ MODULE_OBJS := \ base-backend.o \ modular-backend.o \ audiocd/default/default-audiocd.o \ - audiocd/sdl/sdl-audiocd.o \ events/default/default-events.o \ - events/dinguxsdl/dinguxsdl-events.o \ - events/gp2xsdl/gp2xsdl-events.o \ - events/gph/gph-events.o \ - events/linuxmotosdl/linuxmotosdl-events.o \ - events/openpandora/op-events.o \ - events/samsungtvsdl/samsungtvsdl-events.o \ - events/sdl/sdl-events.o \ - events/symbiansdl/symbiansdl-events.o \ - events/webossdl/webossdl-events.o \ - events/wincesdl/wincesdl-events.o \ fs/abstract-fs.o \ fs/stdiostream.o \ - fs/amigaos4/amigaos4-fs-factory.o \ - fs/posix/posix-fs-factory.o \ - fs/symbian/symbian-fs-factory.o \ - fs/windows/windows-fs-factory.o \ - graphics/dinguxsdl/dinguxsdl-graphics.o \ - graphics/gp2xsdl/gp2xsdl-graphics.o \ - graphics/gph/gph-graphics.o \ - graphics/linuxmotosdl/linuxmotosdl-graphics.o \ graphics/opengl/glerrorcheck.o \ graphics/opengl/gltexture.o \ graphics/opengl/opengl-graphics.o \ graphics/openglsdl/openglsdl-graphics.o \ - graphics/openpandora/op-graphics.o \ - graphics/sdl/sdl-graphics.o \ - graphics/symbiansdl/symbiansdl-graphics.o \ - graphics/wincesdl/wincesdl-graphics.o \ keymapper/action.o \ keymapper/keymap.o \ keymapper/keymapper.o \ keymapper/remap-dialog.o \ log/log.o \ midi/alsa.o \ - midi/camd.o \ - midi/coreaudio.o \ - midi/coremidi.o \ + midi/dmedia.o \ midi/seq.o \ midi/stmidi.o \ midi/timidity.o \ - midi/dmedia.o \ - midi/windows.o \ - mixer/doublebuffersdl/doublebuffersdl-mixer.o \ - mixer/sdl/sdl-mixer.o \ - mixer/symbiansdl/symbiansdl-mixer.o \ - mixer/wincesdl/wincesdl-mixer.o \ - mutex/sdl/sdl-mutex.o \ - plugins/elf/elf-loader.o \ - plugins/elf/mips-loader.o \ - plugins/elf/shorts-segment-manager.o \ - plugins/elf/ppc-loader.o \ plugins/elf/arm-loader.o \ + plugins/elf/elf-loader.o \ plugins/elf/elf-provider.o \ plugins/elf/memory-manager.o \ + plugins/elf/mips-loader.o \ + plugins/elf/ppc-loader.o \ + plugins/elf/shorts-segment-manager.o \ plugins/elf/version.o \ - plugins/posix/posix-provider.o \ - plugins/sdl/sdl-provider.o \ - plugins/win32/win32-provider.o \ saves/savefile.o \ saves/default/default-saves.o \ - saves/posix/posix-saves.o \ timer/default/default-timer.o \ - timer/sdl/sdl-timer.o \ vkeybd/image-map.o \ vkeybd/polygon.o \ vkeybd/virtual-keyboard.o \ vkeybd/virtual-keyboard-gui.o \ vkeybd/virtual-keyboard-parser.o -ifeq ($(BACKEND),dc) +# SDL specific source files. +# We cannot just check $BACKEND = sdl, as various other backends +# derive from the SDL backend, and they all need the following files. +# TODO: Add SDL_BACKEND to config.mk; this would match the fact that +# we also add -DSDL_BACKEND to the DEFINES. +# However, the latter is only done for *most* SDL based stuff, not always +# so we really should unify the relevant code in configure. +MODULE_OBJS += \ + audiocd/sdl/sdl-audiocd.o \ + events/sdl/sdl-events.o \ + graphics/sdl/sdl-graphics.o \ + mixer/doublebuffersdl/doublebuffersdl-mixer.o \ + mixer/sdl/sdl-mixer.o \ + mutex/sdl/sdl-mutex.o \ + plugins/sdl/sdl-provider.o \ + timer/sdl/sdl-timer.o + +ifdef UNIX +MODULE_OBJS += \ + fs/posix/posix-fs.o \ + fs/posix/posix-fs-factory.o \ + plugins/posix/posix-provider.o \ + saves/posix/posix-saves.o +endif + +ifdef MACOSX +MODULE_OBJS += \ + midi/coreaudio.o \ + midi/coremidi.o +endif + +ifdef WIN32 MODULE_OBJS += \ - plugins/dc/dc-provider.o + fs/windows/windows-fs.o \ + fs/windows/windows-fs-factory.o \ + midi/windows.o \ + plugins/win32/win32-provider.o +endif + +ifdef AMIGAOS +MODULE_OBJS += \ + fs/amigaos4/amigaos4-fs.o \ + fs/amigaos4/amigaos4-fs-factory.o \ + midi/camd.o endif ifeq ($(BACKEND),ds) MODULE_OBJS += \ - fs/ds/ds-fs-factory.o \ fs/ds/ds-fs.o \ + fs/ds/ds-fs-factory.o \ plugins/ds/ds-provider.o endif +ifeq ($(BACKEND),dingux) +MODULE_OBJS += \ + events/dinguxsdl/dinguxsdl-events.o \ + graphics/dinguxsdl/dinguxsdl-graphics.o +endif + +ifeq ($(BACKEND),gph) +MODULE_OBJS += \ + events/gph/gph-events.o \ + graphics/gph/gph-graphics.o +endif + +# TODO/FIXME: The gp2xsdl files are only compiled if GP2X_OLD is defined, +# which currently is never the case (unless the user manually requests it). +# ifeq ($(BACKEND),gp2x) +# MODULE_OBJS += \ +# events/gp2xsdl/gp2xsdl-events.o \ +# graphics/gp2xsdl/gp2xsdl-graphics.o +# endif + +ifeq ($(BACKEND),linuxmoto) +MODULE_OBJS += \ + events/linuxmotosdl/linuxmotosdl-events.o \ + graphics/linuxmotosdl/linuxmotosdl-graphics.o +endif + ifeq ($(BACKEND),n64) MODULE_OBJS += \ + fs/n64/n64-fs.o \ fs/n64/n64-fs-factory.o \ fs/n64/romfsstream.o endif +ifeq ($(BACKEND),openpandora) +MODULE_OBJS += \ + events/openpandora/op-events.o \ + graphics/openpandora/op-graphics.o +endif + ifeq ($(BACKEND),ps2) MODULE_OBJS += \ + fs/ps2/ps2-fs.o \ fs/ps2/ps2-fs-factory.o \ plugins/ps2/ps2-provider.o endif ifeq ($(BACKEND),psp) MODULE_OBJS += \ + fs/psp/psp-fs.o \ fs/psp/psp-fs-factory.o \ fs/psp/psp-stream.o \ plugins/psp/psp-provider.o \ @@ -108,8 +147,28 @@ MODULE_OBJS += \ timer/psp/timer.o endif +ifeq ($(BACKEND),samsungstv) +MODULE_OBJS += \ + events/samsungtvsdl/samsungtvsdl-events.o +endif + +ifeq ($(BACKEND),webos) +MODULE_OBJS += \ + events/webossdl/webossdl-events.o +endif + +ifeq ($(BACKEND),wince) +MODULE_OBJS += \ + events/wincesdl/wincesdl-events.o \ + fs/windows/windows-fs.o \ + fs/windows/windows-fs-factory.o \ + graphics/wincesdl/wincesdl-graphics.o \ + mixer/wincesdl/wincesdl-mixer.o +endif + ifeq ($(BACKEND),wii) MODULE_OBJS += \ + fs/wii/wii-fs.o \ fs/wii/wii-fs-factory.o \ plugins/wii/wii-provider.o endif diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index bbfdb06b8d..b1d0727d1f 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -25,6 +25,23 @@ #if defined(__ANDROID__) +// Allow use of stuff in <time.h> +#define FORBIDDEN_SYMBOL_EXCEPTION_time_h + +// Disable printf override in common/forbidden.h to avoid +// clashes with log.h from the Android SDK. +// That header file uses +// __attribute__ ((format(printf, 3, 4))) +// which gets messed up by our override mechanism; this could +// be avoided by either changing the Android SDK to use the equally +// legal and valid +// __attribute__ ((format(printf, 3, 4))) +// or by refining our printf override to use a varadic macro +// (which then wouldn't be portable, though). +// Anyway, for now we just disable the printf override globally +// for the Android port +#define FORBIDDEN_SYMBOL_EXCEPTION_printf + #include <sys/time.h> #include <sys/resource.h> #include <sys/system_properties.h> @@ -32,6 +49,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/events.cpp b/backends/platform/android/events.cpp index 09466b4d2f..0d74e1c524 100644 --- a/backends/platform/android/events.cpp +++ b/backends/platform/android/events.cpp @@ -25,6 +25,23 @@ #if defined(__ANDROID__) +// Allow use of stuff in <time.h> +#define FORBIDDEN_SYMBOL_EXCEPTION_time_h + +// Disable printf override in common/forbidden.h to avoid +// clashes with log.h from the Android SDK. +// That header file uses +// __attribute__ ((format(printf, 3, 4))) +// which gets messed up by our override mechanism; this could +// be avoided by either changing the Android SDK to use the equally +// legal and valid +// __attribute__ ((format(printf, 3, 4))) +// or by refining our printf override to use a varadic macro +// (which then wouldn't be portable, though). +// Anyway, for now we just disable the printf override globally +// for the Android port +#define FORBIDDEN_SYMBOL_EXCEPTION_printf + #include "common/events.h" #include "backends/platform/android/android.h" @@ -444,8 +461,12 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, if (arg4 & JMETA_SHIFT) e.kbd.flags |= Common::KBD_SHIFT; - if (arg4 & JMETA_ALT) - e.kbd.flags |= Common::KBD_ALT; + // JMETA_ALT is Fn on physical keyboards! + // when mapping this to ALT - as we know it from PC keyboards - all + // Fn combos will be broken (like Fn+q, which needs to end as 1 and + // not ALT+1). Do not want. + //if (arg4 & JMETA_ALT) + // e.kbd.flags |= Common::KBD_ALT; if (arg4 & (JMETA_SYM | JMETA_CTRL)) e.kbd.flags |= Common::KBD_CTRL; diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp index 86232030ff..ebce58e291 100644 --- a/backends/platform/android/gfx.cpp +++ b/backends/platform/android/gfx.cpp @@ -25,6 +25,23 @@ #if defined(__ANDROID__) +// Allow use of stuff in <time.h> +#define FORBIDDEN_SYMBOL_EXCEPTION_time_h + +// Disable printf override in common/forbidden.h to avoid +// clashes with log.h from the Android SDK. +// That header file uses +// __attribute__ ((format(printf, 3, 4))) +// which gets messed up by our override mechanism; this could +// be avoided by either changing the Android SDK to use the equally +// legal and valid +// __attribute__ ((format(printf, 3, 4))) +// or by refining our printf override to use a varadic macro +// (which then wouldn't be portable, though). +// Anyway, for now we just disable the printf override globally +// for the Android port +#define FORBIDDEN_SYMBOL_EXCEPTION_printf + #include "common/endian.h" #include "graphics/conversion.h" @@ -628,13 +645,13 @@ void OSystem_Android::grabOverlay(OverlayColor *buf, int pitch) { GLTHREADCHECK; const Graphics::Surface *surface = _overlay_texture->surface_const(); - assert(surface->bytesPerPixel == sizeof(buf[0])); + assert(surface->format.bytesPerPixel == sizeof(buf[0])); const byte *src = (const byte *)surface->pixels; uint h = surface->h; do { - memcpy(buf, src, surface->w * surface->bytesPerPixel); + memcpy(buf, src, surface->w * surface->format.bytesPerPixel); src += surface->pitch; // This 'pitch' is pixels not bytes buf += pitch; diff --git a/backends/platform/android/jni.cpp b/backends/platform/android/jni.cpp index 08a1491998..13aef11fa2 100644 --- a/backends/platform/android/jni.cpp +++ b/backends/platform/android/jni.cpp @@ -25,9 +25,28 @@ #if defined(__ANDROID__) +// Allow use of stuff in <time.h> +#define FORBIDDEN_SYMBOL_EXCEPTION_time_h + +// Disable printf override in common/forbidden.h to avoid +// clashes with log.h from the Android SDK. +// That header file uses +// __attribute__ ((format(printf, 3, 4))) +// which gets messed up by our override mechanism; this could +// be avoided by either changing the Android SDK to use the equally +// legal and valid +// __attribute__ ((format(printf, 3, 4))) +// or by refining our printf override to use a varadic macro +// (which then wouldn't be portable, though). +// Anyway, for now we just disable the printf override globally +// for the Android port +#define FORBIDDEN_SYMBOL_EXCEPTION_printf + #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/android/org/inodes/gus/scummvm/ScummVM.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java index 8bf40ac553..c4de6d62f8 100644 --- a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java +++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java @@ -35,7 +35,7 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable { private String[] _args; - final private native void create(AssetManager _asset_manager, + final private native void create(AssetManager asset_manager, EGL10 egl, EGLDisplay egl_display, AudioTrack audio_track, int sample_rate, int buffer_size); diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp index a6b28ca485..c830676c07 100644 --- a/backends/platform/android/texture.cpp +++ b/backends/platform/android/texture.cpp @@ -25,6 +25,23 @@ #if defined(__ANDROID__) +// Allow use of stuff in <time.h> +#define FORBIDDEN_SYMBOL_EXCEPTION_time_h + +// Disable printf override in common/forbidden.h to avoid +// clashes with log.h from the Android SDK. +// That header file uses +// __attribute__ ((format(printf, 3, 4))) +// which gets messed up by our override mechanism; this could +// be avoided by either changing the Android SDK to use the equally +// legal and valid +// __attribute__ ((format(printf, 3, 4))) +// or by refining our printf override to use a varadic macro +// (which then wouldn't be portable, though). +// Anyway, for now we just disable the printf override globally +// for the Android port +#define FORBIDDEN_SYMBOL_EXCEPTION_printf + #include "base/main.h" #include "graphics/surface.h" @@ -147,7 +164,7 @@ void GLESBaseTexture::setLinearFilter(bool value) { void GLESBaseTexture::allocBuffer(GLuint w, GLuint h) { _surface.w = w; _surface.h = h; - _surface.bytesPerPixel = _pixelFormat.bytesPerPixel; + _surface.format = _pixelFormat; if (w == _texture_width && h == _texture_height) return; @@ -241,14 +258,14 @@ void GLESTexture::allocBuffer(GLuint w, GLuint h) { delete[] _buf; delete[] _pixels; - _pixels = new byte[w * h * _surface.bytesPerPixel]; + _pixels = new byte[w * h * _surface.format.bytesPerPixel]; assert(_pixels); _surface.pixels = _pixels; fillBuffer(0); - _buf = new byte[w * h * _surface.bytesPerPixel]; + _buf = new byte[w * h * _surface.format.bytesPerPixel]; assert(_buf); } @@ -257,10 +274,10 @@ void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h, setDirtyRect(Common::Rect(x, y, x + w, y + h)); const byte *src = (const byte *)buf; - byte *dst = _pixels + y * _surface.pitch + x * _surface.bytesPerPixel; + byte *dst = _pixels + y * _surface.pitch + x * _surface.format.bytesPerPixel; do { - memcpy(dst, src, w * _surface.bytesPerPixel); + memcpy(dst, src, w * _surface.format.bytesPerPixel); dst += _surface.pitch; src += pitch_buf; } while (--h); @@ -301,10 +318,10 @@ void GLESTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) { _tex = _buf; byte *src = _pixels + _dirty_rect.top * _surface.pitch + - _dirty_rect.left * _surface.bytesPerPixel; + _dirty_rect.left * _surface.format.bytesPerPixel; byte *dst = _buf; - uint16 l = dwidth * _surface.bytesPerPixel; + uint16 l = dwidth * _surface.format.bytesPerPixel; for (uint16 i = 0; i < dheight; ++i) { memcpy(dst, src, l); @@ -373,7 +390,7 @@ void GLESFakePaletteTexture::allocBuffer(GLuint w, GLuint h) { GLESBaseTexture::allocBuffer(w, h); - _surface.bytesPerPixel = 1; + _surface.format = Graphics::PixelFormat::createFormatCLUT8(); _surface.pitch = w; if (_surface.w == oldw && _surface.h == oldh) { 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-fs.cpp b/backends/platform/dc/dc-fs.cpp index e21a12fa33..a024b5d70d 100644 --- a/backends/platform/dc/dc-fs.cpp +++ b/backends/platform/dc/dc-fs.cpp @@ -22,6 +22,8 @@ * $Id$ */ +#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h + #include "dc.h" #include "backends/fs/abstract-fs.h" #include "backends/fs/stdiostream.h" 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..a3a1200178 100644 --- a/backends/platform/dc/dcmain.cpp +++ b/backends/platform/dc/dcmain.cpp @@ -23,6 +23,11 @@ * */ +// Allow use of stuff in <time.h> +#define FORBIDDEN_SYMBOL_EXCEPTION_time_h + +#define FORBIDDEN_SYMBOL_EXCEPTION_printf + #include <common/scummsys.h> #include <engines/engine.h> #include <base/main.h> @@ -33,7 +38,6 @@ #include <common/config-manager.h> #include <common/memstream.h> -#include "backends/plugins/dc/dc-provider.h" #include "audio/mixer_intern.h" @@ -336,7 +340,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/display.cpp b/backends/platform/dc/display.cpp index b297022775..78fa2182dc 100644 --- a/backends/platform/dc/display.cpp +++ b/backends/platform/dc/display.cpp @@ -720,7 +720,7 @@ Graphics::Surface *OSystem_Dreamcast::lockScreen() _framebuffer.w = _screen_w; _framebuffer.h = _screen_h; _framebuffer.pitch = SCREEN_W*2; - _framebuffer.bytesPerPixel = (_screenFormat == 0? 1 : 2); + _framebuffer.format = screenFormats[_screenFormat]; return &_framebuffer; } 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/plugins/dc/dc-provider.cpp b/backends/platform/dc/plugins.cpp index 86ef68828c..44b8960513 100644 --- a/backends/plugins/dc/dc-provider.cpp +++ b/backends/platform/dc/plugins.cpp @@ -25,16 +25,50 @@ #include "common/scummsys.h" -#if defined(DYNAMIC_MODULES) && defined(__DC__) +#if defined(DYNAMIC_MODULES) -#include "backends/plugins/dc/dc-provider.h" #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 DCPlugin : public DynamicPlugin { +class OSystem_Dreamcast::DCPlugin : public DynamicPlugin { protected: void *_dlHandle; @@ -59,6 +93,7 @@ public: bool loadPlugin() { assert(!_dlHandle); + drawPluginProgress(_filename); _dlHandle = dlopen(_filename.c_str(), RTLD_LAZY); if (!_dlHandle) { @@ -85,11 +120,11 @@ public: }; -Plugin* DCPluginProvider::createPlugin(const Common::FSNode &node) const { +Plugin* OSystem_Dreamcast::createPlugin(const Common::FSNode &node) const { return new DCPlugin(node.getPath()); } -bool DCPluginProvider::isPluginFilename(const Common::FSNode &node) const { +bool OSystem_Dreamcast::isPluginFilename(const Common::FSNode &node) const { // Check the plugin suffix Common::String filename = node.getName(); if (!filename.hasSuffix(".PLG")) @@ -98,4 +133,4 @@ bool DCPluginProvider::isPluginFilename(const Common::FSNode &node) const { return true; } -#endif // defined(DYNAMIC_MODULES) && defined(__DC__) +#endif // defined(DYNAMIC_MODULES) diff --git a/backends/platform/dc/selector.cpp b/backends/platform/dc/selector.cpp index 8fd12d66bf..77f34394a1 100644 --- a/backends/platform/dc/selector.cpp +++ b/backends/platform/dc/selector.cpp @@ -23,6 +23,8 @@ * */ +#define FORBIDDEN_SYMBOL_EXCEPTION_chdir + #include <common/scummsys.h> #include <engines/engine.h> #include <engines/metaengine.h> diff --git a/backends/platform/dc/vmsave.cpp b/backends/platform/dc/vmsave.cpp index 6c8289684f..63e345efbe 100644 --- a/backends/platform/dc/vmsave.cpp +++ b/backends/platform/dc/vmsave.cpp @@ -23,6 +23,11 @@ * */ +// Allow use of stuff in <time.h> +#define FORBIDDEN_SYMBOL_EXCEPTION_time_h + +#define FORBIDDEN_SYMBOL_EXCEPTION_fprintf + #include <common/scummsys.h> #include "engines/engine.h" #include "dc.h" diff --git a/backends/platform/dingux/main.cpp b/backends/platform/dingux/main.cpp index c5dccc5f50..cf25e1cb42 100644 --- a/backends/platform/dingux/main.cpp +++ b/backends/platform/dingux/main.cpp @@ -30,8 +30,6 @@ #if defined(DINGUX) -#include <unistd.h> - int main(int argc, char* argv[]) { g_system = new OSystem_SDL_Dingux(); diff --git a/backends/platform/ds/arm9/source/fat/gba_nds_fat.c b/backends/platform/ds/arm9/source/fat/gba_nds_fat.c index 7f0757ef53..698590418c 100644 --- a/backends/platform/ds/arm9/source/fat/gba_nds_fat.c +++ b/backends/platform/ds/arm9/source/fat/gba_nds_fat.c @@ -18,6 +18,9 @@ //--------------------------------------------------------------- // Includes +// Allow use of stuff in <time.h> +#define FORBIDDEN_SYMBOL_EXCEPTION_time_h + #include "gba_nds_fat.h" #include "disc_io.h" #include <string.h> diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index 3ad92b4355..462990cb32 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -20,6 +20,9 @@ */ +// Allow use of stuff in <time.h> +#define FORBIDDEN_SYMBOL_EXCEPTION_time_h + #include "common/scummsys.h" #include "common/system.h" @@ -243,7 +246,7 @@ void OSystem_DS::setCursorPalette(const byte *colors, uint start, uint num) { } bool OSystem_DS::grabRawScreen(Graphics::Surface *surf) { - surf->create(DS::getGameWidth(), DS::getGameHeight(), 1); + surf->create(DS::getGameWidth(), DS::getGameHeight(), Graphics::PixelFormat::createFormatCLUT8()); // Ensure we copy using 16 bit quantities due to limitation of VRAM addressing @@ -259,13 +262,13 @@ bool OSystem_DS::grabRawScreen(Graphics::Surface *surf) { return true; } -void OSystem_DS::grabPalette(unsigned char *colours, uint start, uint num) { +void OSystem_DS::grabPalette(unsigned char *colors, uint start, uint num) { // consolePrintf("Grabpalette"); for (unsigned int r = start; r < start + num; r++) { - *colours++ = (BG_PALETTE[r] & 0x001F) << 3; - *colours++ = (BG_PALETTE[r] & 0x03E0) >> 5 << 3; - *colours++ = (BG_PALETTE[r] & 0x7C00) >> 10 << 3; + *colors++ = (BG_PALETTE[r] & 0x001F) << 3; + *colors++ = (BG_PALETTE[r] & 0x03E0) >> 5 << 3; + *colors++ = (BG_PALETTE[r] & 0x7C00) >> 10 << 3; } } @@ -756,7 +759,7 @@ Graphics::Surface *OSystem_DS::createTempFrameBuffer() { _framebuffer.w = DS::getGameWidth(); _framebuffer.h = DS::getGameHeight(); _framebuffer.pitch = DS::getGameWidth(); - _framebuffer.bytesPerPixel = 1; + _framebuffer.format = Graphics::PixelFormat::createFormatCLUT8(); } else { @@ -781,7 +784,7 @@ Graphics::Surface *OSystem_DS::createTempFrameBuffer() { _framebuffer.w = width; _framebuffer.h = height; _framebuffer.pitch = width; - _framebuffer.bytesPerPixel = 1; + _framebuffer.format = Graphics::PixelFormat::createFormatCLUT8(); } @@ -849,16 +852,16 @@ Common::WriteStream *OSystem_DS::createConfigWriteStream() { return file.createWriteStream(); } -u16 OSystem_DS::applyGamma(u16 colour) { +u16 OSystem_DS::applyGamma(u16 color) { // Attempt to do gamma correction (or something like it) to palette entries // to improve the contrast of the image on the original DS screen. - // Split the colour into it's component channels - int r = colour & 0x001F; - int g = (colour & 0x03E0) >> 5; - int b = (colour & 0x7C00) >> 10; + // Split the color into it's component channels + int r = color & 0x001F; + int g = (color & 0x03E0) >> 5; + int b = (color & 0x7C00) >> 10; - // Caluclate the scaling factor for this colour based on it's brightness + // Caluclate the scaling factor for this color based on it's brightness int scale = ((23 - ((r + g + b) >> 2)) * _gammaValue) >> 3; // Scale the three components by the scaling factor, with clamping @@ -871,7 +874,7 @@ u16 OSystem_DS::applyGamma(u16 colour) { b = b + ((b * scale) >> 4); if (b > 31) b = 31; - // Stick them back together into a 555 colour value + // Stick them back together into a 555 color value return 0x8000 | r | (g << 5) | (b << 10); } diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index 7feed7541f..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: @@ -183,7 +184,7 @@ public: Common::WriteStream *createConfigWriteStream(); Common::SeekableReadStream *createConfigReadStream(); - u16 applyGamma(u16 colour); + u16 applyGamma(u16 color); void setGammaValue(int gamma) { _gammaValue = gamma; } void engineDone(); diff --git a/backends/platform/ds/ds.mk b/backends/platform/ds/ds.mk index a9ed3e0096..654475e1f3 100644 --- a/backends/platform/ds/ds.mk +++ b/backends/platform/ds/ds.mk @@ -170,10 +170,10 @@ dsclean: # HACK/FIXME: C compiler, for cartreset.c -- we should switch this to use CXX # as soon as possible. -CC := $(DEVKITARM)/bin/arm-eabi-gcc +CC := $(DEVKITPRO)/devkitARM/bin/arm-eabi-gcc # HACK/TODO: Pointer to objcopy. This should really be set by configure -OBJCOPY := $(DEVKITARM)/bin/arm-eabi-objcopy +OBJCOPY := $(DEVKITPRO)/devkitARM/bin/arm-eabi-objcopy # # Set various flags diff --git a/backends/platform/ds/makefile b/backends/platform/ds/makefile index 58d6fd4c02..e24a36ef81 100644 --- a/backends/platform/ds/makefile +++ b/backends/platform/ds/makefile @@ -3,7 +3,7 @@ -export PATH := $(DEVKITARM)/bin:$(PATH) +export PATH := $(DEVKITPRO)/devkitARM/bin:$(PATH) export portdir = $(CURDIR)/arm9 export srcdir = $(CURDIR)/../../.. 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 5e88510980..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> @@ -81,7 +82,7 @@ protected: bool _mouseVisible; byte *_mouseBuf; - byte _mouseKeyColour; + byte _mouseKeyColor; uint _mouseWidth, _mouseHeight; uint _mouseX, _mouseY; int _mouseHotspotX, _mouseHotspotY; diff --git a/backends/platform/iphone/osys_video.cpp b/backends/platform/iphone/osys_video.cpp index d67d38932a..a10efeff40 100644 --- a/backends/platform/iphone/osys_video.cpp +++ b/backends/platform/iphone/osys_video.cpp @@ -312,7 +312,7 @@ void OSystem_IPHONE::drawMouseCursorOnRectUpdate(const Common::Rect& updatedRect uint16 *dst = &_fullscreen[top * _screenWidth + left]; for (int y = displayHeight; y > srcY; y--) { for (int x = displayWidth; x > srcX; x--) { - if (*src != _mouseKeyColour) + if (*src != _mouseKeyColor) *dst = _palette[*src]; dst++; src++; @@ -334,7 +334,7 @@ Graphics::Surface *OSystem_IPHONE::lockScreen() { _framebuffer.w = _screenWidth; _framebuffer.h = _screenHeight; _framebuffer.pitch = _screenWidth; - _framebuffer.bytesPerPixel = 1; + _framebuffer.format = Graphics::PixelFormat::createFormatCLUT8(); return &_framebuffer; } @@ -497,7 +497,7 @@ void OSystem_IPHONE::setMouseCursor(const byte *buf, uint w, uint h, int hotspot _mouseHotspotX = hotspotX; _mouseHotspotY = hotspotY; - _mouseKeyColour = (byte)keycolor; + _mouseKeyColor = (byte)keycolor; memcpy(_mouseBuf, buf, w * h); diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h index 2daa41a9f6..b9acb7c76c 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" @@ -128,7 +129,7 @@ protected: volatile int _mouseMaxX, _mouseMaxY; int _mouseHotspotX, _mouseHotspotY; - uint8 _controllerPort; + int8 _controllerPort; int8 _mousePort; bool _controllerHasRumble; // Gets enabled if rumble-pak is detected diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp index 54eab0fd52..ae8d23d3e2 100644 --- a/backends/platform/n64/osys_n64_base.cpp +++ b/backends/platform/n64/osys_n64_base.cpp @@ -32,6 +32,8 @@ #include "framfs_save_manager.h" #include "backends/fs/n64/n64-fs-factory.h" +typedef unsigned long long uint64; + extern uint8 _romfs; // Defined by linker (used to calculate position of romfs image) inline uint16 colRGB888toBGR555(byte r, byte g, byte b); @@ -90,9 +92,9 @@ OSystem_N64::OSystem_N64() { _shakeOffset = 0; // Allocate memory for offscreen buffers - _offscreen_hic = (uint16*)memalign(8, _screenWidth * _screenHeight * 2); - _offscreen_pal = (uint8*)memalign(8, _screenWidth * _screenHeight); - _overlayBuffer = (uint16*)memalign(8, _overlayWidth * _overlayHeight * sizeof(OverlayColor)); + _offscreen_hic = (uint16 *)memalign(8, _screenWidth * _screenHeight * 2); + _offscreen_pal = (uint8 *)memalign(8, _screenWidth * _screenHeight); + _overlayBuffer = (uint16 *)memalign(8, _overlayWidth * _overlayHeight * sizeof(OverlayColor)); _cursor_pal = NULL; _cursor_hic = NULL; @@ -111,9 +113,9 @@ OSystem_N64::OSystem_N64() { _graphicMode = OVERS_NTSC_340X240; // Clear palette array - _screenPalette = (uint16*)memalign(8, 256 * sizeof(uint16)); + _screenPalette = (uint16 *)memalign(8, 256 * sizeof(uint16)); #ifndef N64_EXTREME_MEMORY_SAVING - _screenExactPalette = (uint8*)memalign(8, 256 * 3); + _screenExactPalette = (uint8 *)memalign(8, 256 * 3); memset(_screenExactPalette, 0, 256 * 3); #endif memset(_screenPalette, 0, 256 * sizeof(uint16)); @@ -125,7 +127,7 @@ OSystem_N64::OSystem_N64() { _audioEnabled = false; // Initialize ROMFS access interface - initRomFSmanager((uint8*)(((uint32)&_romfs + (uint32)0xc00) | (uint32)0xB0000000)); + initRomFSmanager((uint8 *)(((uint32)&_romfs + (uint32)0xc00) | (uint32)0xB0000000)); _mouseVisible = false; @@ -374,7 +376,7 @@ void OSystem_N64::rebuildOffscreenGameBuffer(void) { for (int h = 0; h < _gameHeight; h++) { for (int w = 0; w < _gameWidth; w += 4) { - four_col_pal = *(uint32*)(_offscreen_pal + ((h * _screenWidth) + w)); + four_col_pal = *(uint32 *)(_offscreen_pal + ((h * _screenWidth) + w)); four_col_hi = 0; four_col_hi |= (uint64)_screenPalette[((four_col_pal >> 24) & 0xFF)] << 48; @@ -383,7 +385,7 @@ void OSystem_N64::rebuildOffscreenGameBuffer(void) { four_col_hi |= (uint64)_screenPalette[((four_col_pal >> 0) & 0xFF)] << 0; // Save the converted pixels into hicolor buffer - *(uint64*)((_offscreen_hic) + (h * _screenWidth) + w) = four_col_hi; + *(uint64 *)((_offscreen_hic) + (h * _screenWidth) + w) = four_col_hi; } } } @@ -520,7 +522,7 @@ void OSystem_N64::updateScreen() { // Obtain the framebuffer while (!(_dc = lockDisplay())); - uint16 *overlay_framebuffer = (uint16*)_dc->conf.framebuffer; // Current screen framebuffer + uint16 *overlay_framebuffer = (uint16 *)_dc->conf.framebuffer; // Current screen framebuffer uint16 *game_framebuffer = overlay_framebuffer + (_frameBufferWidth * skip_lines * 2); // Skip some lines to center the image vertically uint16 currentHeight, currentWidth; @@ -532,8 +534,8 @@ void OSystem_N64::updateScreen() { tmpDst = game_framebuffer; tmpSrc = _offscreen_hic + (_shakeOffset * _screenWidth); for (currentHeight = _shakeOffset; currentHeight < _gameHeight; currentHeight++) { - uint64 *game_dest = (uint64*)(tmpDst + skip_pixels + _offscrPixels); - uint64 *game_src = (uint64*)tmpSrc; + uint64 *game_dest = (uint64 *)(tmpDst + skip_pixels + _offscrPixels); + uint64 *game_src = (uint64 *)tmpSrc; // With uint64 we copy 4 pixels at a time for (currentWidth = 0; currentWidth < _gameWidth; currentWidth += 4) { @@ -552,8 +554,8 @@ void OSystem_N64::updateScreen() { tmpDst = overlay_framebuffer; tmpSrc = _overlayBuffer; for (currentHeight = 0; currentHeight < _overlayHeight; currentHeight++) { - uint64 *over_dest = (uint64*)(tmpDst + _offscrPixels); - uint64 *over_src = (uint64*)tmpSrc; + uint64 *over_dest = (uint64 *)(tmpDst + _offscrPixels); + uint64 *over_src = (uint64 *)tmpSrc; // Copy 4 pixels at a time for (currentWidth = 0; currentWidth < _overlayWidth; currentWidth += 4) { @@ -610,7 +612,7 @@ Graphics::Surface *OSystem_N64::lockScreen() { _framebuffer.w = _gameWidth; _framebuffer.h = _gameHeight; _framebuffer.pitch = _screenWidth; - _framebuffer.bytesPerPixel = 1; + _framebuffer.format = Graphics::PixelFormat::createFormatCLUT8(); return &_framebuffer; } @@ -790,8 +792,8 @@ void OSystem_N64::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, } if (!_cursor_pal) { - _cursor_pal = (uint8*)malloc(w * h); - _cursor_hic = (uint16*)malloc(w * h * sizeof(uint16)); + _cursor_pal = (uint8 *)malloc(w * h); + _cursor_hic = (uint16 *)malloc(w * h * sizeof(uint16)); } _cursorWidth = w; @@ -907,10 +909,10 @@ void OSystem_N64::setupMixer(void) { /* Check all controller ports for a compatible input adapter. */ void OSystem_N64::detectControllers(void) { - controller_data_status *ctrl_status = (controller_data_status*)memalign(8, sizeof(controller_data_status)); + controller_data_status *ctrl_status = (controller_data_status *)memalign(8, sizeof(controller_data_status)); controller_Read_Status(ctrl_status); - _controllerPort = 0; // Use first controller as default + _controllerPort = -1; // Default no controller _mousePort = -1; // Default no mouse for (int8 ctrl_port = 3; ctrl_port >= 0; ctrl_port--) { // Found a standard pad, use this by default. diff --git a/backends/platform/n64/osys_n64_events.cpp b/backends/platform/n64/osys_n64_events.cpp index 22b9addbfb..69c854750c 100644 --- a/backends/platform/n64/osys_n64_events.cpp +++ b/backends/platform/n64/osys_n64_events.cpp @@ -94,8 +94,13 @@ void OSystem_N64::readControllerAnalogInput(void) { // Read current controller status controller_Read_Buttons(&_ctrlData); - pad_analogX = (_ctrlData.c[_controllerPort].throttle >> 8) & 0xFF; - pad_analogY = (_ctrlData.c[_controllerPort].throttle >> 0) & 0xFF; + pad_analogX = 0; + pad_analogY = 0; + + if (_controllerPort >= 0) { + pad_analogX = (_ctrlData.c[_controllerPort].throttle >> 8) & 0xFF; + pad_analogY = (_ctrlData.c[_controllerPort].throttle >> 0) & 0xFF; + } pad_mouseX = 0; pad_mouseY = 0; @@ -157,9 +162,11 @@ bool OSystem_N64::pollEvent(Common::Event &event) { static uint16 oldButtons = 0; // old button data... used for button press/release static uint16 oldMouseButtons = 0; - uint16 newButtons = _ctrlData.c[_controllerPort].buttons; // Read from controller + uint16 newButtons = 0; + if (_controllerPort >= 0) + newButtons = _ctrlData.c[_controllerPort].buttons; // Read from controller + uint16 newMouseButtons = 0; - if (_mousePort >= 0) newMouseButtons = _ctrlData.c[_mousePort].buttons; diff --git a/backends/platform/n64/pad_rom.sh b/backends/platform/n64/pad_rom.sh index 085203306f..085203306f 100644..100755 --- a/backends/platform/n64/pad_rom.sh +++ b/backends/platform/n64/pad_rom.sh 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.cpp b/backends/platform/ps2/Gs2dScreen.cpp index a460b919fd..c228a12b26 100644 --- a/backends/platform/ps2/Gs2dScreen.cpp +++ b/backends/platform/ps2/Gs2dScreen.cpp @@ -23,6 +23,8 @@ * */ +#define FORBIDDEN_SYMBOL_EXCEPTION_printf + #include "Gs2dScreen.h" #include <kernel.h> #include <malloc.h> @@ -398,7 +400,7 @@ Graphics::Surface *Gs2dScreen::lockScreen() { _framebuffer.w = _width; _framebuffer.h = _height; _framebuffer.pitch = _width; // -not- _pitch; ! It's EE mem, not Tex - _framebuffer.bytesPerPixel = 1; + _framebuffer.format = Graphics::PixelFormat::createFormatCLUT8(); return &_framebuffer; } @@ -441,7 +443,7 @@ void Gs2dScreen::grabPalette(uint8 *pal, uint8 start, uint16 num) { void Gs2dScreen::grabScreen(Graphics::Surface *surf) { assert(surf); WaitSema(g_DmacSema); - surf->create(_width, _height, 1); + surf->create(_width, _height, Graphics::PixelFormat::createFormatCLUT8()); memcpy(surf->pixels, _screenBuf, _width * _height); SignalSema(g_DmacSema); } 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/irxboot.cpp b/backends/platform/ps2/irxboot.cpp index 5ab7823e63..cc23df6575 100644 --- a/backends/platform/ps2/irxboot.cpp +++ b/backends/platform/ps2/irxboot.cpp @@ -73,7 +73,7 @@ PS2Device detectBootPath(const char *elfPath, char *bootPath) { PS2Device device = _getDev(elfPath); - printf("elf path: %s, device %d\n", elfPath, device); + sioprintf("elf path: %s, device %d\n", elfPath, device); strcpy(bootPath, elfPath); diff --git a/backends/platform/ps2/ps2input.cpp b/backends/platform/ps2/ps2input.cpp index 964a773f7e..6da21172ad 100644 --- a/backends/platform/ps2/ps2input.cpp +++ b/backends/platform/ps2/ps2input.cpp @@ -23,6 +23,8 @@ * */ +#define FORBIDDEN_SYMBOL_EXCEPTION_printf + #include <kernel.h> #include <malloc.h> #include <assert.h> 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/ps2mutex.cpp b/backends/platform/ps2/ps2mutex.cpp index fe76202f32..974cf00f56 100644 --- a/backends/platform/ps2/ps2mutex.cpp +++ b/backends/platform/ps2/ps2mutex.cpp @@ -23,6 +23,8 @@ * */ +#define FORBIDDEN_SYMBOL_EXCEPTION_printf + #include "backends/platform/ps2/systemps2.h" void OSystem_PS2::initMutexes(void) { diff --git a/backends/platform/ps2/ps2pad.cpp b/backends/platform/ps2/ps2pad.cpp index 3d285eedd5..090a5f2a35 100644 --- a/backends/platform/ps2/ps2pad.cpp +++ b/backends/platform/ps2/ps2pad.cpp @@ -23,6 +23,8 @@ * */ +#define FORBIDDEN_SYMBOL_EXCEPTION_printf + #include <kernel.h> #include <malloc.h> #include <assert.h> diff --git a/backends/platform/ps2/ps2time.cpp b/backends/platform/ps2/ps2time.cpp index 4da8420478..4c682cb9f2 100644 --- a/backends/platform/ps2/ps2time.cpp +++ b/backends/platform/ps2/ps2time.cpp @@ -23,6 +23,8 @@ * */ +#define FORBIDDEN_SYMBOL_EXCEPTION_time_h + #include "backends/platform/ps2/systemps2.h" #include "backends/platform/ps2/ps2debug.h" #include "eecodyvdfs.h" diff --git a/backends/platform/ps2/savefilemgr.cpp b/backends/platform/ps2/savefilemgr.cpp index a4b3ddb971..459920c34a 100644 --- a/backends/platform/ps2/savefilemgr.cpp +++ b/backends/platform/ps2/savefilemgr.cpp @@ -23,6 +23,10 @@ * */ +#define FORBIDDEN_SYMBOL_EXCEPTION_printf +#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir +#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h + #include "common/config-manager.h" #include "common/zlib.h" diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp index 77de74eb5b..aed2378faf 100644 --- a/backends/platform/ps2/systemps2.cpp +++ b/backends/platform/ps2/systemps2.cpp @@ -568,6 +568,11 @@ void OSystem_PS2::updateScreen(void) { _screen->updateScreen(); } +void OSystem_PS2::displayMessageOnOSD(const char *msg) { + /* TODO : check */ + printf("displayMessageOnOSD: %s\n", msg); +} + uint32 OSystem_PS2::getMillis(void) { return msecCount; } @@ -727,7 +732,7 @@ void OSystem_PS2::msgPrintf(int millis, const char *format, ...) { int maxWidth = 0; Graphics::Surface surf; - surf.create(300, 200, 1); + surf.create(300, 200, Graphics::PixelFormat::createFormatCLUT8()); char *lnSta = resStr; while (*lnSta && (posY < 180)) { diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h index 37575f399f..26e3105cd9 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 { @@ -78,9 +79,7 @@ public: virtual Graphics::Surface *lockScreen(); virtual void unlockScreen(); virtual void updateScreen(); - /* TODO : check */ - virtual void displayMessageOnOSD(const char *msg) { printf("displayMessageOnOSD: %s\n", msg); }; - /* */ + virtual void displayMessageOnOSD(const char *msg); virtual void showOverlay(); virtual void hideOverlay(); 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/cursor.cpp b/backends/platform/psp/cursor.cpp index cf879e095a..420b0398c3 100644 --- a/backends/platform/psp/cursor.cpp +++ b/backends/platform/psp/cursor.cpp @@ -327,8 +327,20 @@ inline void Cursor::setRendererModePalettized(bool palettized) { _renderer.setAlphaReverse(false); _renderer.setColorTest(false); } else { // 16 bits, no palette + // Color test is an easy way for the hardware to make our keycolor + // transparent. + _renderer.setColorTest(true); + + // Alpha blending is not strictly required, but makes the cursor look + // much better _renderer.setAlphaBlending(true); - _renderer.setAlphaReverse(true); // We can't change all alpha values, so just reverse - _renderer.setColorTest(true); // Color test to make our key color transparent + + // Pixel formats without alpha (5650) are considered to have their alpha set. + // Since pixel formats with alpha don't have their alpha bits set, we reverse + // the alpha format for them so that 0 alpha is 1. + if (_buffer.getPixelFormat() != PSPPixelFormat::Type_5650) + _renderer.setAlphaReverse(true); + else + _renderer.setAlphaReverse(false); } } diff --git a/backends/platform/psp/default_display_client.cpp b/backends/platform/psp/default_display_client.cpp index bb42406c3e..34b1a70711 100644 --- a/backends/platform/psp/default_display_client.cpp +++ b/backends/platform/psp/default_display_client.cpp @@ -199,7 +199,7 @@ Graphics::Surface *Screen::lockAndGetForEditing() { _frameBuffer.w = _buffer.getSourceWidth(); _frameBuffer.h = _buffer.getSourceHeight(); _frameBuffer.pitch = _buffer.getBytesPerPixel() * _buffer.getWidth(); - _frameBuffer.bytesPerPixel = _buffer.getBytesPerPixel(); + _frameBuffer.format = _pixelFormat; // We'll set to dirty once we unlock the screen return &_frameBuffer; diff --git a/backends/platform/psp/display_client.cpp b/backends/platform/psp/display_client.cpp index 76b4a28e4a..d43e876a17 100644 --- a/backends/platform/psp/display_client.cpp +++ b/backends/platform/psp/display_client.cpp @@ -23,6 +23,20 @@ * */ +// Disable printf override in common/forbidden.h to avoid +// clashes with pspdebug.h from the PSP SDK. +// That header file uses +// __attribute__((format(printf,1,2))); +// which gets messed up by our override mechanism; this could +// be avoided by either changing the PSP SDK to use the equally +// legal and valid +// __attribute__((format(__printf__,1,2))); +// or by refining our printf override to use a varadic macro +// (which then wouldn't be portable, though). +// Anyway, for now we just disable the printf override globally +// for the PSP port +#define FORBIDDEN_SYMBOL_EXCEPTION_printf + #include <pspgu.h> #include <pspkerneltypes.h> #include <pspdisplay.h> diff --git a/backends/platform/psp/mp3.cpp b/backends/platform/psp/mp3.cpp index 54476dabfd..fd686513af 100644 --- a/backends/platform/psp/mp3.cpp +++ b/backends/platform/psp/mp3.cpp @@ -23,12 +23,26 @@ * */ +// Disable printf override in common/forbidden.h to avoid +// clashes with pspdebug.h from the PSP SDK. +// That header file uses +// __attribute__((format(printf,1,2))); +// which gets messed up by our override mechanism; this could +// be avoided by either changing the PSP SDK to use the equally +// legal and valid +// __attribute__((format(__printf__,1,2))); +// or by refining our printf override to use a varadic macro +// (which then wouldn't be portable, though). +// Anyway, for now we just disable the printf override globally +// for the PSP port +#define FORBIDDEN_SYMBOL_EXCEPTION_printf #include "common/debug.h" #include "common/stream.h" #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.cpp b/backends/platform/psp/osys_psp.cpp index bb7c1ff7d5..e2a8a88c57 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -23,6 +23,9 @@ * */ +// Allow use of stuff in <time.h> +#define FORBIDDEN_SYMBOL_EXCEPTION_time_h + #include <pspuser.h> #include <pspgu.h> #include <pspdisplay.h> 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/psp/portdefs.h b/backends/platform/psp/portdefs.h index bf7ed41e25..dae9b5d49e 100644 --- a/backends/platform/psp/portdefs.h +++ b/backends/platform/psp/portdefs.h @@ -26,6 +26,12 @@ #ifndef PORTDEFS_H #define PORTDEFS_H +// FIXME: This file is only used when building using the file +// backends/platform/psp/Makefile, but not when building using configure +// && make. So either -DNONSTANDARD_PORT needs to be added to the PSP +// configure rules, or it should be removed from the aforementioned +// Makefile. + #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/backends/platform/psp/psp_main.cpp b/backends/platform/psp/psp_main.cpp index d24c614e33..b85467f788 100644 --- a/backends/platform/psp/psp_main.cpp +++ b/backends/platform/psp/psp_main.cpp @@ -23,6 +23,20 @@ * */ +// Disable printf override in common/forbidden.h to avoid +// clashes with pspdebug.h from the PSP SDK. +// That header file uses +// __attribute__((format(printf,1,2))); +// which gets messed up by our override mechanism; this could +// be avoided by either changing the PSP SDK to use the equally +// legal and valid +// __attribute__((format(__printf__,1,2))); +// or by refining our printf override to use a varadic macro +// (which then wouldn't be portable, though). +// Anyway, for now we just disable the printf override globally +// for the PSP port +#define FORBIDDEN_SYMBOL_EXCEPTION_printf + #define USERSPACE_ONLY //don't use kernel mode features #ifndef USERSPACE_ONLY diff --git a/backends/platform/psp/trace.cpp b/backends/platform/psp/trace.cpp index 74c2f64300..92ee7b669e 100644 --- a/backends/platform/psp/trace.cpp +++ b/backends/platform/psp/trace.cpp @@ -23,6 +23,19 @@ * */ +// Disable printf override in common/forbidden.h to avoid +// clashes with pspdebug.h from the PSP SDK. +// That header file uses +// __attribute__((format(printf,1,2))); +// which gets messed up by our override mechanism; this could +// be avoided by either changing the PSP SDK to use the equally +// legal and valid +// __attribute__((format(__printf__,1,2))); +// or by refining our printf override to use a varadic macro +// (which then wouldn't be portable, though). +// Anyway, for now we just disable the printf override globally +// for the PSP port +#define FORBIDDEN_SYMBOL_EXCEPTION_printf #include <pspkernel.h> #include <pspdebug.h> diff --git a/backends/platform/samsungtv/main.cpp b/backends/platform/samsungtv/main.cpp index 3beb97165f..a1962dd904 100644 --- a/backends/platform/samsungtv/main.cpp +++ b/backends/platform/samsungtv/main.cpp @@ -23,6 +23,8 @@ * */ +#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h + #include "backends/platform/samsungtv/samsungtv.h" #include "backends/plugins/sdl/sdl-provider.h" #include "base/main.h" diff --git a/backends/platform/sdl/posix/posix.cpp b/backends/platform/sdl/posix/posix.cpp index 71a88265a0..2208f7c351 100644 --- a/backends/platform/sdl/posix/posix.cpp +++ b/backends/platform/sdl/posix/posix.cpp @@ -23,6 +23,9 @@ * */ +#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir +#define FORBIDDEN_SYMBOL_EXCEPTION_time_h //On IRIX, sys/stat.h includes sys/time.h + #include "common/scummsys.h" #ifdef UNIX @@ -34,6 +37,7 @@ #include <errno.h> #include <sys/stat.h> + OSystem_POSIX::OSystem_POSIX(Common::String baseConfigName) : _baseConfigName(baseConfigName) { diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index d6e79248f9..e6ca423f61 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -23,6 +23,8 @@ * */ +#define FORBIDDEN_SYMBOL_EXCEPTION_time_h + #ifdef WIN32 #define WIN32_LEAN_AND_MEAN #include <windows.h> @@ -32,6 +34,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 +381,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 +400,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..d6a39ff48f 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 @@ -37,6 +39,8 @@ #include "backends/platform/sdl/win32/win32.h" #include "backends/fs/windows/windows-fs-factory.h" +#include "common/memstream.h" + #define DEFAULT_CONFIG_FILE "scummvm.ini" //#define HIDE_CONSOLE @@ -168,4 +172,88 @@ Common::WriteStream *OSystem_Win32::createLogFile() { } } +namespace { + +class Win32ResourceArchive : public Common::Archive { + friend BOOL CALLBACK EnumResNameProc(HMODULE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG_PTR lParam); +public: + Win32ResourceArchive(); + + virtual bool hasFile(const Common::String &name); + virtual int listMembers(Common::ArchiveMemberList &list); + virtual Common::ArchiveMemberPtr getMember(const Common::String &name); + virtual Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const; +private: + typedef Common::List<Common::String> FilenameList; + + FilenameList _files; +}; + +BOOL CALLBACK EnumResNameProc(HMODULE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG_PTR lParam) { + if (IS_INTRESOURCE(lpszName)) + return TRUE; + + Win32ResourceArchive *arch = (Win32ResourceArchive *)lParam; + arch->_files.push_back(lpszName); + return TRUE; +} + +Win32ResourceArchive::Win32ResourceArchive() { + EnumResourceNames(NULL, MAKEINTRESOURCE(256), &EnumResNameProc, (LONG_PTR)this); +} + +bool Win32ResourceArchive::hasFile(const Common::String &name) { + for (FilenameList::const_iterator i = _files.begin(); i != _files.end(); ++i) { + if (i->equalsIgnoreCase(name)) + return true; + } + + return false; +} + +int Win32ResourceArchive::listMembers(Common::ArchiveMemberList &list) { + int count = 0; + + for (FilenameList::const_iterator i = _files.begin(); i != _files.end(); ++i, ++count) + list.push_back(Common::ArchiveMemberPtr(new Common::GenericArchiveMember(*i, this))); + + return count; +} + +Common::ArchiveMemberPtr Win32ResourceArchive::getMember(const Common::String &name) { + return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this)); +} + +Common::SeekableReadStream *Win32ResourceArchive::createReadStreamForMember(const Common::String &name) const { + HRSRC resource = FindResource(NULL, name.c_str(), MAKEINTRESOURCE(256)); + + if (resource == NULL) + return 0; + + HGLOBAL handle = LoadResource(NULL, resource); + + if (handle == NULL) + return 0; + + const byte *data = (const byte *)LockResource(handle); + + if (data == NULL) + return 0; + + uint32 size = SizeofResource(NULL, resource); + + if (size == 0) + return 0; + + return new Common::MemoryReadStream(data, size); +} + +} // End of anonymous namespace + +void OSystem_Win32::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) { + s.add("Win32Res", new Win32ResourceArchive()); + + OSystem_SDL::addSysArchivesToSearchSet(s, priority); +} + #endif diff --git a/backends/platform/sdl/win32/win32.h b/backends/platform/sdl/win32/win32.h index 8379c49437..25cb6bfbba 100644 --- a/backends/platform/sdl/win32/win32.h +++ b/backends/platform/sdl/win32/win32.h @@ -32,6 +32,7 @@ class OSystem_Win32 : public OSystem_SDL { public: virtual void init(); + virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0); protected: virtual Common::String getDefaultConfigFileName(); virtual Common::WriteStream *createLogFile(); 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/S60v3/ScummVM_A0000658_S60v3.mmp.in b/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in index 12b4cb3610..4e0a66793c 100644 --- a/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in +++ b/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in @@ -63,8 +63,8 @@ START BITMAP ScummVM.mbm TARGETPATH \Resource\Apps SOURCEPATH ..\res // Source Color-depth Source-bitmap-list -// c denotes whether the bitmap is a colour bitmap and the digits represent the -// colour-depth of the bitmap and the bitmap mask respectively +// c denotes whether the bitmap is a color bitmap and the digits represent the +// color-depth of the bitmap and the bitmap mask respectively SOURCE c24 ScummSmall.bmp SOURCE 8 ScummSmallMask.bmp SOURCE c24 ScummLarge.bmp @@ -119,6 +119,7 @@ SOURCE backends\platform\sdl\hardwarekeys.cpp SOURCE backends\platform\sdl\sdl.cpp SOURCE backends\audiocd\sdl\sdl-audiocd.cpp SOURCE backends\audiocd\default\default-audiocd.cpp +SOURCE backends\fs\symbian\symbian-fs.cpp SOURCE backends\fs\symbian\symbian-fs-factory.cpp SOURCE backends\platform\symbian\src\SymbianOS.cpp SOURCE backends\platform\symbian\src\SymbianActions.cpp diff --git a/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in b/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in index 9af6535b22..1929723fb6 100644 --- a/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in +++ b/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in @@ -63,8 +63,8 @@ START BITMAP ScummVM.mbm TARGETPATH \Resource\Apps SOURCEPATH ..\res // Source Color-depth Source-bitmap-list -// c denotes whether the bitmap is a colour bitmap and the digits represent the -// colour-depth of the bitmap and the bitmap mask respectively +// c denotes whether the bitmap is a color bitmap and the digits represent the +// color-depth of the bitmap and the bitmap mask respectively SOURCE c24 ScummSmall.bmp SOURCE 8 ScummSmallMask.bmp SOURCE c24 ScummLarge.bmp @@ -119,6 +119,7 @@ SOURCE backends\platform\sdl\hardwarekeys.cpp SOURCE backends\platform\sdl\sdl.cpp SOURCE backends\audiocd\sdl\sdl-audiocd.cpp SOURCE backends\audiocd\default\default-audiocd.cpp +SOURCE backends\fs\symbian\symbian-fs.cpp SOURCE backends\fs\symbian\symbian-fs-factory.cpp SOURCE backends\platform\symbian\src\SymbianOS.cpp SOURCE backends\platform\symbian\src\SymbianActions.cpp diff --git a/backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in b/backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in index 3fab5cc2b7..f5bdaac237 100644 --- a/backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in +++ b/backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in @@ -64,8 +64,8 @@ START BITMAP ScummVM.mbm TARGETPATH \Resource\Apps SOURCEPATH ..\res // Source Color-depth Source-bitmap-list -// c denotes whether the bitmap is a colour bitmap and the digits represent the -// colour-depth of the bitmap and the bitmap mask respectively +// c denotes whether the bitmap is a color bitmap and the digits represent the +// color-depth of the bitmap and the bitmap mask respectively SOURCE c24 ScummSmall.bmp SOURCE 8 ScummSmallMask.bmp SOURCE c24 ScummLarge.bmp @@ -117,6 +117,7 @@ SOURCE backends\platform\sdl\hardwarekeys.cpp SOURCE backends\platform\sdl\sdl.cpp SOURCE backends\audiocd\sdl\sdl-audiocd.cpp SOURCE backends\audiocd\default\default-audiocd.cpp +SOURCE backends\fs\symbian\symbian-fs.cpp SOURCE backends\fs\symbian\symbian-fs-factory.cpp SOURCE backends\platform\symbian\src\SymbianOS.cpp SOURCE backends\platform\symbian\src\SymbianActions.cpp diff --git a/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in b/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in index 31dfc36399..2354161e47 100644 --- a/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in +++ b/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in @@ -64,8 +64,8 @@ START BITMAP ScummVM.mbm TARGETPATH \Resource\Apps SOURCEPATH ..\res // Source Color-depth Source-bitmap-list -// c denotes whether the bitmap is a colour bitmap and the digits represent the -// colour-depth of the bitmap and the bitmap mask respectively +// c denotes whether the bitmap is a color bitmap and the digits represent the +// color-depth of the bitmap and the bitmap mask respectively SOURCE c24 ScummSmall.bmp SOURCE 8 ScummSmallMask.bmp SOURCE c24 ScummLarge.bmp @@ -117,6 +117,7 @@ SOURCE backends\platform\sdl\hardwarekeys.cpp SOURCE backends\platform\sdl\sdl.cpp SOURCE backends\audiocd\sdl\sdl-audiocd.cpp SOURCE backends\audiocd\default\default-audiocd.cpp +SOURCE backends\fs\symbian\symbian-fs.cpp SOURCE backends\fs\symbian\symbian-fs-factory.cpp SOURCE backends\platform\symbian\src\SymbianOS.cpp SOURCE backends\platform\symbian\src\SymbianActions.cpp 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/main.cpp b/backends/platform/webos/main.cpp index bbf55c6efd..eefdd30496 100644 --- a/backends/platform/webos/main.cpp +++ b/backends/platform/webos/main.cpp @@ -23,6 +23,8 @@ * */ +#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h + #include "backends/platform/webos/webos.h" #include "backends/plugins/sdl/sdl-provider.h" #include "base/main.h" diff --git a/backends/platform/webos/webos.mk b/backends/platform/webos/webos.mk index 885c9eb90e..37223ac56c 100644 --- a/backends/platform/webos/webos.mk +++ b/backends/platform/webos/webos.mk @@ -1,23 +1,96 @@ # WebOS specific build targets +# ============================================================================ +# +# Build instructions: +# +# 1. Install the WebOS SDK and PDK and setup the environment variables +# WEBOS_SDK and WEBOS_PDK accordingly. +# +# 2. Cross-compile zlib, flac, mad and tremor and install it into the PDK. +# +# 3. Prepare the ScummVM source for a webOS build: +# $ ./configure --host=webos --enable-plugins --default-dynamic \ +# --enable-release +# +# 4. Create the package: +# $ make package +# +# The package is now in the "portdist" folder. +# +# See http://wiki.scummvm.org/index.php/Compiling_ScummVM/WebOS for +# more detailed build instructions. +# +# +# Palm App catalog instructions: +# +# 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". +# +# The app id is automatically parsed from the installation prefix. So add a +# configure parameter like this to prepare a build of a package for the Palm +# App Catalog: +# +# --prefix=/media/cryptofs/apps/usr/palm/applications/com.github.kayahr.scummvm +# +# To build a package for the Palm Beta App Catalog add "-beta" to the prefix: +# +# --prefix=/media/cryptofs/apps/usr/palm/applications/com.github.kayahr.scummvm-beta +# ============================================================================ + +# Increment this number when the packaging of the app has been changed while +# ScummVM itself has the same version as before. The number can be reset to +# 1 when the ScummVM version is increased. +VER_PACKAGE = 5 PATH_DIST = $(srcdir)/dists/webos PATH_MOJO = $(PATH_DIST)/mojo +APP_ID = $(shell basename $(prefix)) +APP_VERSION = $(shell printf "%d.%d.%02d%02d" $(VER_MAJOR) $(VER_MINOR) $(VER_PATCH) $(VER_PACKAGE)) +DESTDIR ?= staging +PORTDISTDIR ?= portdist + +install: all + $(QUIET)$(INSTALL) -d "$(DESTDIR)$(prefix)" + $(QUIET)$(INSTALL) -m 0644 -t "$(DESTDIR)$(prefix)/" "$(PATH_MOJO)/"* + $(QUIET)$(INSTALL) -m 0755 "$(PATH_MOJO)/start" "$(DESTDIR)$(prefix)/" + $(QUIET)$(INSTALL) -d "$(DESTDIR)$(bindir)" + $(QUIET)$(INSTALL) -c -m 755 "./$(EXECUTABLE)" "$(DESTDIR)$(bindir)/$(EXECUTABLE)" + $(QUIET)$(STRIP) "$(DESTDIR)$(bindir)/$(EXECUTABLE)" + $(QUIET)$(INSTALL) -d "$(DESTDIR)$(docdir)" + $(QUIET)$(INSTALL) -c -m 644 $(DIST_FILES_DOCS) "$(DESTDIR)$(docdir)" + $(QUIET)$(INSTALL) -d "$(DESTDIR)$(datadir)" + $(QUIET)$(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) "$(DESTDIR)$(datadir)/" +ifdef DYNAMIC_MODULES + $(QUIET)$(INSTALL) -d "$(DESTDIR)$(libdir)/" + $(QUIET)$(INSTALL) -c -m 644 $(PLUGINS) "$(DESTDIR)$(libdir)/" + $(QUIET)$(STRIP) "$(DESTDIR)$(libdir)/"* +endif + $(QUIET)sed -i s/'APP_VERSION'/'$(APP_VERSION)'/ "$(DESTDIR)$(prefix)/appinfo.json" + $(QUIET)sed -i s/'APP_ID'/'$(APP_ID)'/ "$(DESTDIR)$(prefix)/appinfo.json" +ifneq (,$(findstring -beta,$(APP_ID))) + $(QUIET)sed -i s/'APP_TITLE'/'ScummVM Beta'/ "$(DESTDIR)$(prefix)/appinfo.json" +else + $(QUIET)sed -i s/'APP_TITLE'/'ScummVM'/ "$(DESTDIR)$(prefix)/appinfo.json" +endif -STAGING_DIR=STAGING/org.scummvm.scummvm +uninstall: + $(QUIET)$(RM_REC) "$(DESTDIR)$(prefix)" -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 +package: uninstall install + $(QUIET)$(RM_REC) "$(PORTDISTDIR)" + $(QUIET)$(MKDIR) "$(PORTDISTDIR)" + $(QUIET)$(WEBOS_SDK)/bin/palm-package --use-v1-format "$(DESTDIR)$(prefix)" -o "$(PORTDISTDIR)" -.PHONY: webosrelease +.PHONY: install uninstall package diff --git a/backends/platform/wii/main.cpp b/backends/platform/wii/main.cpp index aa688534fc..3965f51b7f 100644 --- a/backends/platform/wii/main.cpp +++ b/backends/platform/wii/main.cpp @@ -19,6 +19,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#define FORBIDDEN_SYMBOL_EXCEPTION_chdir +#define FORBIDDEN_SYMBOL_EXCEPTION_getcwd +#define FORBIDDEN_SYMBOL_EXCEPTION_printf + #include <sys/stat.h> #include <sys/types.h> #include <errno.h> diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp index 2aefe48f0c..401b19b0e1 100644 --- a/backends/platform/wii/osystem.cpp +++ b/backends/platform/wii/osystem.cpp @@ -19,6 +19,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// Allow use of stuff in <time.h> +#define FORBIDDEN_SYMBOL_EXCEPTION_time_h + +#define FORBIDDEN_SYMBOL_EXCEPTION_printf +#define FORBIDDEN_SYMBOL_EXCEPTION_getcwd + #include <unistd.h> #include <ogc/conf.h> @@ -26,6 +32,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..0db5f92fff 100644 --- a/backends/platform/wii/osystem.h +++ b/backends/platform/wii/osystem.h @@ -24,7 +24,6 @@ #include <gctypes.h> #include <gccore.h> -#include <ogcsys.h> #include <gxflux/gfx.h> @@ -36,6 +35,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/wii/osystem_events.cpp b/backends/platform/wii/osystem_events.cpp index 5d0bca453f..8e51bbc673 100644 --- a/backends/platform/wii/osystem_events.cpp +++ b/backends/platform/wii/osystem_events.cpp @@ -19,6 +19,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#define FORBIDDEN_SYMBOL_EXCEPTION_printf + #include <unistd.h> #include <malloc.h> diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp index cb9a8c72e9..b44c1270f5 100644 --- a/backends/platform/wii/osystem_gfx.cpp +++ b/backends/platform/wii/osystem_gfx.cpp @@ -19,6 +19,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#define FORBIDDEN_SYMBOL_EXCEPTION_printf + #include <malloc.h> #include <gxflux/gfx_con.h> @@ -537,10 +539,10 @@ Graphics::Surface *OSystem_Wii::lockScreen() { _surface.h = _gameHeight; #ifdef USE_RGB_COLOR _surface.pitch = _gameWidth * _pfGame.bytesPerPixel; - _surface.bytesPerPixel = _pfGame.bytesPerPixel; + _surface.format = _pfGame; #else _surface.pitch = _gameWidth; - _surface.bytesPerPixel = 1; + _surface.format = Graphics::PixelFormat::createFormatCLUT8(); #endif return &_surface; diff --git a/backends/platform/wii/osystem_sfx.cpp b/backends/platform/wii/osystem_sfx.cpp index 33397f0a93..acab6df7e1 100644 --- a/backends/platform/wii/osystem_sfx.cpp +++ b/backends/platform/wii/osystem_sfx.cpp @@ -19,6 +19,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#define FORBIDDEN_SYMBOL_EXCEPTION_printf + #include <malloc.h> #include "osystem.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" diff --git a/backends/plugins/dc/dc-provider.h b/backends/plugins/dc/dc-provider.h deleted file mode 100644 index 55413ade5a..0000000000 --- a/backends/plugins/dc/dc-provider.h +++ /dev/null @@ -1,42 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#ifndef BACKENDS_PLUGINS_DC_H -#define BACKENDS_PLUGINS_DC_H - -#include "base/plugins.h" - -#if defined(DYNAMIC_MODULES) && defined(__DC__) - -class DCPluginProvider : public FilePluginProvider { -protected: - Plugin* createPlugin(const Common::FSNode &node) const; - - bool isPluginFilename(const Common::FSNode &node) const; -}; - -#endif // defined(DYNAMIC_MODULES) && defined(__DC__) - -#endif diff --git a/backends/plugins/dynamic-plugin.h b/backends/plugins/dynamic-plugin.h index 32d411656c..775e887105 100644 --- a/backends/plugins/dynamic-plugin.h +++ b/backends/plugins/dynamic-plugin.h @@ -27,6 +27,7 @@ #define BACKENDS_PLUGINS_DYNAMICPLUGIN_H #include "base/plugins.h" +#include "common/textconsole.h" class DynamicPlugin : public Plugin { diff --git a/backends/plugins/elf/memory-manager.cpp b/backends/plugins/elf/memory-manager.cpp index b2ac497771..d32ac2da28 100644 --- a/backends/plugins/elf/memory-manager.cpp +++ b/backends/plugins/elf/memory-manager.cpp @@ -28,6 +28,7 @@ #if defined(DYNAMIC_MODULES) && defined(USE_ELF_LOADER) #include "backends/plugins/elf/memory-manager.h" +#include "common/debug.h" #include "common/util.h" #include <malloc.h> diff --git a/backends/plugins/sdl/sdl-provider.h b/backends/plugins/sdl/sdl-provider.h index b546b028a2..350261a37f 100644 --- a/backends/plugins/sdl/sdl-provider.h +++ b/backends/plugins/sdl/sdl-provider.h @@ -35,6 +35,6 @@ protected: Plugin* createPlugin(const Common::FSNode &node) const; }; -#endif // defined(DYNAMIC_MODULES) && defined(UNIX) +#endif // defined(DYNAMIC_MODULES) && defined(SDL_BACKEND) #endif diff --git a/backends/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp index 0e16f165b3..75e10cf810 100644 --- a/backends/saves/default/default-saves.cpp +++ b/backends/saves/default/default-saves.cpp @@ -60,7 +60,7 @@ void DefaultSaveFileManager::checkPath(const Common::FSNode &dir) { Common::StringArray DefaultSaveFileManager::listSavefiles(const Common::String &pattern) { Common::String savePathName = getSavePath(); checkPath(Common::FSNode(savePathName)); - if (getError() != Common::kNoError) + if (getError().getCode() != Common::kNoError) return Common::StringArray(); // recreate FSNode since checkPath may have changed/created the directory @@ -84,7 +84,7 @@ Common::InSaveFile *DefaultSaveFileManager::openForLoading(const Common::String // Ensure that the savepath is valid. If not, generate an appropriate error. Common::String savePathName = getSavePath(); checkPath(Common::FSNode(savePathName)); - if (getError() != Common::kNoError) + if (getError().getCode() != Common::kNoError) return 0; // recreate FSNode since checkPath may have changed/created the directory @@ -104,7 +104,7 @@ Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String // Ensure that the savepath is valid. If not, generate an appropriate error. Common::String savePathName = getSavePath(); checkPath(Common::FSNode(savePathName)); - if (getError() != Common::kNoError) + if (getError().getCode() != Common::kNoError) return 0; // recreate FSNode since checkPath may have changed/created the directory @@ -121,7 +121,7 @@ Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String bool DefaultSaveFileManager::removeSavefile(const Common::String &filename) { Common::String savePathName = getSavePath(); checkPath(Common::FSNode(savePathName)); - if (getError() != Common::kNoError) + if (getError().getCode() != Common::kNoError) return false; // recreate FSNode since checkPath may have changed/created the directory diff --git a/backends/saves/posix/posix-saves.cpp b/backends/saves/posix/posix-saves.cpp index 866cd912e5..3a8e5e998e 100644 --- a/backends/saves/posix/posix-saves.cpp +++ b/backends/saves/posix/posix-saves.cpp @@ -23,6 +23,11 @@ * */ + +// Enable mkdir +#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir +#define FORBIDDEN_SYMBOL_EXCEPTION_time_h //On IRIX, sys/stat.h includes sys/time.h + #include "common/scummsys.h" #if defined(UNIX) && !defined(DISABLE_DEFAULT_SAVEFILEMANAGER) @@ -31,6 +36,7 @@ #include "common/config-manager.h" #include "common/savefile.h" +#include "common/textconsole.h" #include <stdio.h> #include <string.h> diff --git a/backends/saves/psp/psp-saves.cpp b/backends/saves/psp/psp-saves.cpp index 66c63dfdea..5752d2fa5f 100644 --- a/backends/saves/psp/psp-saves.cpp +++ b/backends/saves/psp/psp-saves.cpp @@ -23,6 +23,20 @@ * */ +// Disable printf override in common/forbidden.h to avoid +// clashes with pspdebug.h from the PSP SDK. +// That header file uses +// __attribute__((format(printf,1,2))); +// which gets messed up by our override mechanism; this could +// be avoided by either changing the PSP SDK to use the equally +// legal and valid +// __attribute__((format(__printf__,1,2))); +// or by refining our printf override to use a varadic macro +// (which then wouldn't be portable, though). +// Anyway, for now we just disable the printf override globally +// for the PSP port +#define FORBIDDEN_SYMBOL_EXCEPTION_printf + #include "common/scummsys.h" #ifdef __PSP__ diff --git a/backends/saves/savefile.cpp b/backends/saves/savefile.cpp index 7b7d6b0c0c..9888146049 100644 --- a/backends/saves/savefile.cpp +++ b/backends/saves/savefile.cpp @@ -25,9 +25,7 @@ #include "common/util.h" #include "common/savefile.h" - -#include <stdio.h> -#include <string.h> +#include "common/str.h" namespace Common { diff --git a/backends/timer/default/default-timer.h b/backends/timer/default/default-timer.h index a4c7385ef9..9a353f58c3 100644 --- a/backends/timer/default/default-timer.h +++ b/backends/timer/default/default-timer.h @@ -28,8 +28,6 @@ #include "common/timer.h" #include "common/mutex.h" -class OSystem; - struct TimerSlot; class DefaultTimerManager : public Common::TimerManager { diff --git a/backends/timer/psp/timer.cpp b/backends/timer/psp/timer.cpp index 746ff97197..9e36b43490 100644 --- a/backends/timer/psp/timer.cpp +++ b/backends/timer/psp/timer.cpp @@ -23,6 +23,20 @@ * */ +// Disable printf override in common/forbidden.h to avoid +// clashes with pspdebug.h from the PSP SDK. +// That header file uses +// __attribute__((format(printf,1,2))); +// which gets messed up by our override mechanism; this could +// be avoided by either changing the PSP SDK to use the equally +// legal and valid +// __attribute__((format(__printf__,1,2))); +// or by refining our printf override to use a varadic macro +// (which then wouldn't be portable, though). +// Anyway, for now we just disable the printf override globally +// for the PSP port +#define FORBIDDEN_SYMBOL_EXCEPTION_printf + #include "common/scummsys.h" #if defined (__PSP__) diff --git a/backends/timer/sdl/sdl-timer.cpp b/backends/timer/sdl/sdl-timer.cpp index 0a4cd428de..647ddba2d3 100644 --- a/backends/timer/sdl/sdl-timer.cpp +++ b/backends/timer/sdl/sdl-timer.cpp @@ -30,6 +30,8 @@ #include "backends/timer/sdl/sdl-timer.h" +#include "common/textconsole.h" + static Uint32 timer_handler(Uint32 interval, void *param) { ((DefaultTimerManager *)param)->handler(); return interval; diff --git a/backends/vkeybd/image-map.cpp b/backends/vkeybd/image-map.cpp index b0a77b5220..f4b4541d7e 100644 --- a/backends/vkeybd/image-map.cpp +++ b/backends/vkeybd/image-map.cpp @@ -27,6 +27,8 @@ #ifdef ENABLE_VKEYBD +#include "common/textconsole.h" + #include "backends/vkeybd/image-map.h" #include "backends/vkeybd/polygon.h" diff --git a/backends/vkeybd/packs/vkeybd_default/vkeybd_default.xml b/backends/vkeybd/packs/vkeybd_default/vkeybd_default.xml index 86f39d3d4d..85a27c71ca 100644 --- a/backends/vkeybd/packs/vkeybd_default/vkeybd_default.xml +++ b/backends/vkeybd/packs/vkeybd_default/vkeybd_default.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> -<keyboard initial_mode="lowercase" v_align="bottom" h_align="centre"> +<keyboard initial_mode="lowercase" v_align="bottom" h_align="center"> <!-- coords key = "start x, start y, end x, end y" --> <!-- Lowercase --> <mode name="lowercase" resolutions="320x240,640x480"> diff --git a/backends/vkeybd/virtual-keyboard-gui.cpp b/backends/vkeybd/virtual-keyboard-gui.cpp index c5ab39e46b..9ffda6e3a7 100644 --- a/backends/vkeybd/virtual-keyboard-gui.cpp +++ b/backends/vkeybd/virtual-keyboard-gui.cpp @@ -36,7 +36,7 @@ namespace Common { static void blit(Graphics::Surface *surf_dst, Graphics::Surface *surf_src, int16 x, int16 y, OverlayColor transparent) { - if (surf_dst->bytesPerPixel != sizeof(OverlayColor) || surf_src->bytesPerPixel != sizeof(OverlayColor)) + if (surf_dst->format.bytesPerPixel != sizeof(OverlayColor) || surf_src->format.bytesPerPixel != sizeof(OverlayColor)) return; const OverlayColor *src = (const OverlayColor *)surf_src->pixels; @@ -133,7 +133,7 @@ void VirtualKeyboardGUI::setupDisplayArea(Rect& r, OverlayColor forecolor) { _dispI = 0; _dispForeColor = forecolor; _dispBackColor = _dispForeColor + 0xFF; - _dispSurface.create(r.width(), _dispFont->getFontHeight(), sizeof(OverlayColor)); + _dispSurface.create(r.width(), _dispFont->getFontHeight(), _system->getOverlayFormat()); _dispSurface.fillRect(Rect(_dispSurface.w, _dispSurface.h), _dispBackColor); _displayEnabled = true; } @@ -163,7 +163,7 @@ void VirtualKeyboardGUI::run() { _system->showOverlay(); _system->clearOverlay(); } - _overlayBackup.create(_screenW, _screenH, sizeof(OverlayColor)); + _overlayBackup.create(_screenW, _screenH, _system->getOverlayFormat()); _system->grabOverlay((OverlayColor*)_overlayBackup.pixels, _overlayBackup.w); setupCursor(); @@ -203,7 +203,7 @@ void VirtualKeyboardGUI::moveToDefaultPosition() case VirtualKeyboard::kAlignLeft: x = 0; break; - case VirtualKeyboard::kAlignCentre: + case VirtualKeyboard::kAlignCenter: x = (_screenW - kbdW) / 2; break; case VirtualKeyboard::kAlignRight: @@ -265,7 +265,7 @@ void VirtualKeyboardGUI::screenChanged() { _screenW = newScreenW; _screenH = newScreenH; - _overlayBackup.create(_screenW, _screenH, sizeof(OverlayColor)); + _overlayBackup.create(_screenW, _screenH, _system->getOverlayFormat()); _system->grabOverlay((OverlayColor*)_overlayBackup.pixels, _overlayBackup.w); if (!_kbd->checkModeResolutions()) { @@ -358,7 +358,7 @@ void VirtualKeyboardGUI::redraw() { if (w <= 0 || h <= 0) return; Graphics::Surface surf; - surf.create(w, h, sizeof(OverlayColor)); + surf.create(w, h, _system->getOverlayFormat()); OverlayColor *dst = (OverlayColor *)surf.pixels; const OverlayColor *src = (OverlayColor *) _overlayBackup.getBasePtr(_dirtyRect.left, _dirtyRect.top); diff --git a/backends/vkeybd/virtual-keyboard-parser.cpp b/backends/vkeybd/virtual-keyboard-parser.cpp index a81258b25f..3ebdfdc653 100644 --- a/backends/vkeybd/virtual-keyboard-parser.cpp +++ b/backends/vkeybd/virtual-keyboard-parser.cpp @@ -84,7 +84,7 @@ bool VirtualKeyboardParser::parserCallback_keyboard(ParserNode *node) { if (h.equalsIgnoreCase("left")) _keyboard->_hAlignment = VirtualKeyboard::kAlignLeft; else if (h.equalsIgnoreCase("centre") || h.equalsIgnoreCase("center")) - _keyboard->_hAlignment = VirtualKeyboard::kAlignCentre; + _keyboard->_hAlignment = VirtualKeyboard::kAlignCenter; else if (h.equalsIgnoreCase("right")) _keyboard->_hAlignment = VirtualKeyboard::kAlignRight; } diff --git a/backends/vkeybd/virtual-keyboard-parser.h b/backends/vkeybd/virtual-keyboard-parser.h index 9723744dc4..1327008a80 100644 --- a/backends/vkeybd/virtual-keyboard-parser.h +++ b/backends/vkeybd/virtual-keyboard-parser.h @@ -51,7 +51,7 @@ keyboard layouts for different screen resolutions. ** Example keyboard pack description file ** ******************************************** -<keyboard modes="normal,caps" initial_mode="normal" v_align="bottom" h_align="centre"> +<keyboard modes="normal,caps" initial_mode="normal" v_align="bottom" h_align="center"> <mode name="normal" resolutions="640x400,320x200"> <layout resolution="640x400" bitmap="normal_640x400.bmp" transparent_color="255,0,255"> <map> diff --git a/backends/vkeybd/virtual-keyboard.cpp b/backends/vkeybd/virtual-keyboard.cpp index 31fde8c0fa..e1a25474e7 100644 --- a/backends/vkeybd/virtual-keyboard.cpp +++ b/backends/vkeybd/virtual-keyboard.cpp @@ -33,6 +33,7 @@ #include "backends/vkeybd/virtual-keyboard-parser.h" #include "backends/vkeybd/keycode-descriptions.h" #include "common/config-manager.h" +#include "common/textconsole.h" #include "common/unzip.h" #define KEY_START_CHAR ('[') @@ -71,7 +72,7 @@ void VirtualKeyboard::reset() { deleteEvents(); _modes.clear(); _initialMode = _currentMode = 0; - _hAlignment = kAlignCentre; + _hAlignment = kAlignCenter; _vAlignment = kAlignBottom; _keyQueue.clear(); _loaded = false; @@ -136,7 +137,7 @@ bool VirtualKeyboard::loadKeyboardPack(const String &packName) { _loaded = _parser->parse(); if (_loaded) { - printf("Keyboard pack '%s' loaded successfully!\n", packName.c_str()); + debug("Keyboard pack '%s' loaded successfully", packName.c_str()); } else { warning("Error parsing the keyboard pack '%s'", packName.c_str()); diff --git a/backends/vkeybd/virtual-keyboard.h b/backends/vkeybd/virtual-keyboard.h index db94cbe476..169cd67833 100644 --- a/backends/vkeybd/virtual-keyboard.h +++ b/backends/vkeybd/virtual-keyboard.h @@ -134,7 +134,7 @@ protected: enum HorizontalAlignment { kAlignLeft, - kAlignCentre, + kAlignCenter, kAlignRight }; |