diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/advancedDetector.h | 23 | ||||
-rw-r--r-- | common/error.h | 47 | ||||
-rw-r--r-- | common/file.cpp | 1 | ||||
-rw-r--r-- | common/file.h | 6 | ||||
-rw-r--r-- | common/fs.cpp | 7 | ||||
-rw-r--r-- | common/fs.h | 2 | ||||
-rw-r--r-- | common/iff_container.h | 4 | ||||
-rw-r--r-- | common/keyboard.h | 4 | ||||
-rw-r--r-- | common/savefile.h | 13 | ||||
-rw-r--r-- | common/scummsys.h | 18 | ||||
-rw-r--r-- | common/system.cpp | 21 | ||||
-rw-r--r-- | common/system.h | 44 | ||||
-rw-r--r-- | common/util.cpp | 6 | ||||
-rw-r--r-- | common/util.h | 1 |
14 files changed, 123 insertions, 74 deletions
diff --git a/common/advancedDetector.h b/common/advancedDetector.h index 5066ba71e9..1817f634a6 100644 --- a/common/advancedDetector.h +++ b/common/advancedDetector.h @@ -252,7 +252,7 @@ PluginError detectGameForEngineCreation(const Common::ADParams ¶ms); } // End of namespace AdvancedDetector -#define ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_FUNC(engine,factoryFunc,params) \ +#define _ADVANCED_DETECTOR_DEFINE_PLUGIN_HEAD(engine,params) \ GameList Engine_##engine##_gameIDList() { \ return Common::AdvancedDetector::gameIDList(params); \ } \ @@ -262,6 +262,10 @@ PluginError detectGameForEngineCreation(const Common::ADParams ¶ms); GameList Engine_##engine##_detectGames(const FSList &fslist) { \ return Common::AdvancedDetector::detectAllGames(fslist, params); \ } \ + void dummyFuncToAllowTrailingSemicolon() + +#define _ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_PREDEFINED_FUNC(engine,factoryFunc,params) \ + _ADVANCED_DETECTOR_DEFINE_PLUGIN_HEAD(engine,params); \ PluginError Engine_##engine##_create(OSystem *syst, Engine **engine) { \ assert(syst); \ assert(engine); \ @@ -272,11 +276,26 @@ PluginError detectGameForEngineCreation(const Common::ADParams ¶ms); } \ void dummyFuncToAllowTrailingSemicolon() +#define ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_COMPLEX_CREATION(engine,factoryFunc,params) \ + _ADVANCED_DETECTOR_DEFINE_PLUGIN_HEAD(engine,params); \ + PluginError Engine_##engine##_create(OSystem *syst, Engine **engine) { \ + assert(engine); \ + Common::EncapsulatedADGameDesc encapsulatedDesc = Common::AdvancedDetector::detectBestMatchingGame(params); \ + if (encapsulatedDesc.realDesc == 0) { \ + return kNoGameDataFoundError; \ + } \ + if (!factoryFunc(syst,engine,encapsulatedDesc)) { \ + return kNoGameDataFoundError; \ + } \ + return kNoError; \ + } \ + void dummyFuncToAllowTrailingSemicolon() + #define ADVANCED_DETECTOR_DEFINE_PLUGIN(engine,className,params) \ static Engine *engine##_createInstance(OSystem *syst) { \ return new className(syst); \ } \ - ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_FUNC(engine,engine##_createInstance,params); \ + _ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_PREDEFINED_FUNC(engine,engine##_createInstance,params); \ void dummyFuncToAllowTrailingSemicolon() diff --git a/common/error.h b/common/error.h new file mode 100644 index 0000000000..0ac84df5c3 --- /dev/null +++ b/common/error.h @@ -0,0 +1,47 @@ +/* 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 COMMON_ERROR_H +#define COMMON_ERROR_H + +/** + * This file contains enums with error codes commonly used. + */ + +/** + * Errors used in the SaveFileManager class. + */ +enum SFMError { + SFM_NO_ERROR, //Default state, indicates no error has been recorded + SFM_DIR_ACCESS, //stat(), mkdir()::EACCES: Search or write permission denied + SFM_DIR_LINKMAX, //mkdir()::EMLINK: The link count of the parent directory would exceed {LINK_MAX} + SFM_DIR_LOOP, //stat(), mkdir()::ELOOP: Too many symbolic links encountered while traversing the path + SFM_DIR_NAMETOOLONG, //stat(), mkdir()::ENAMETOOLONG: The path name is too long + SFM_DIR_NOENT, //stat(), mkdir()::ENOENT: A component of the path path does not exist, or the path is an empty string + SFM_DIR_NOTDIR, //stat(), mkdir()::ENOTDIR: A component of the path prefix is not a directory + SFM_DIR_ROFS //mkdir()::EROFS: The parent directory resides on a read-only file system +}; + +#endif //COMMON_ERROR_H diff --git a/common/file.cpp b/common/file.cpp index e70a9328cb..880383d220 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -24,6 +24,7 @@ */ #include "common/file.h" +#include "common/fs.h" #include "common/hashmap.h" #include "common/util.h" #include "common/hash-str.h" diff --git a/common/file.h b/common/file.h index 19b1d45144..416ca75ec7 100644 --- a/common/file.h +++ b/common/file.h @@ -30,9 +30,6 @@ #include "common/scummsys.h" #include "common/str.h" #include "common/stream.h" -#include "common/fs.h" -#include "backends/file/base-file.h" -//#include "backends/factories/fs-factory-maker.h" class FilesystemNode; @@ -41,9 +38,6 @@ namespace Common { class File : public SeekableReadStream, public WriteStream { protected: /** File handle to the actual file; 0 if no file is open. */ - BaseFile *_test; - - /** File handle to the actual file; 0 if no file is open. */ void *_handle; /** Status flag which tells about recent I/O failures. */ diff --git a/common/fs.cpp b/common/fs.cpp index 442e3ed4d7..3e0959b232 100644 --- a/common/fs.cpp +++ b/common/fs.cpp @@ -24,9 +24,8 @@ #include "common/stdafx.h" #include "common/util.h" -#include "common/fs.h" #include "backends/fs/abstract-fs.h" -#include "backends/factories/fs-factory-maker.cpp" +#include "backends/fs/fs-factory-maker.cpp" /* * Simple DOS-style pattern matching function (understands * and ? like used in DOS). @@ -83,7 +82,7 @@ FilesystemNode::FilesystemNode(const FilesystemNode &node) { } FilesystemNode::FilesystemNode(const Common::String &p) { - AbstractFilesystemFactory *factory = FilesystemFactoryMaker::makeFactory(); + AbstractFilesystemFactory *factory = makeFSFactory(); if (p.empty() || p == ".") _realNode = factory->makeCurrentDirectoryFileNode(); @@ -250,7 +249,7 @@ int FilesystemNode::lookupFileRec(FSList &results, FilesystemNode &dir, Common:: //TODO: here we assume all backends implement the lastPathComponent method. It is currently static, // so it might be a good idea to include it inside the backend class. This would enforce its // implementation by all ports. - if(matchString(_realNode->getLastPathComponent(entry->getPath()), filename.c_str())) { + if (matchString(lastPathComponent(entry->getPath()), filename.c_str())) { results.push_back(*entry); matches++; diff --git a/common/fs.h b/common/fs.h index 7f634791d6..38e5c64a10 100644 --- a/common/fs.h +++ b/common/fs.h @@ -120,7 +120,7 @@ public: */ bool operator<(const FilesystemNode& node) const; - /* + /** * Indicates whether the object referred by this path exists in the filesystem or not. * * @return bool true if the path exists, false otherwise. diff --git a/common/iff_container.h b/common/iff_container.h index 0d07b5bd57..cc55970591 100644 --- a/common/iff_container.h +++ b/common/iff_container.h @@ -18,8 +18,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL:https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/branches/gsoc2007-fsnode/common/iff_container.h $ - * $Id:iff_container.h 26949 2007-05-26 20:23:24Z david_corrales $ + * $URL$ + * $Id$ */ #ifndef COMMON_IFF_CONTAINER_H diff --git a/common/keyboard.h b/common/keyboard.h index dfc47af1ce..d0d0e43f00 100644 --- a/common/keyboard.h +++ b/common/keyboard.h @@ -18,8 +18,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/branches/gsoc2007-fsnode/common/keyboard.h $ - * $Id: keyboard.h 27654 2007-06-23 10:06:39Z fingolfin $ + * $URL$ + * $Id$ * */ diff --git a/common/savefile.h b/common/savefile.h index 3e1b9ffaaa..9fdd76ae15 100644 --- a/common/savefile.h +++ b/common/savefile.h @@ -31,6 +31,7 @@ #include "common/scummsys.h" #include "common/stream.h" #include "common/str.h" +#include "common/error.h" namespace Common { @@ -76,18 +77,6 @@ public: * returning the single SaveFileManager instances to be used. */ class SaveFileManager : NonCopyable { - -public: - enum SFMError { - SFM_NO_ERROR, //Default state, indicates no error has been recorded - SFM_DIR_ACCESS, //stat(), mkdir()::EACCES: Search or write permission denied - SFM_DIR_LINKMAX, //mkdir()::EMLINK: The link count of the parent directory would exceed {LINK_MAX} - SFM_DIR_LOOP, //stat(), mkdir()::ELOOP: Too many symbolic links encountered while traversing the path - SFM_DIR_NAMETOOLONG, //stat(), mkdir()::ENAMETOOLONG: The path name is too long - SFM_DIR_NOENT, //stat(), mkdir()::ENOENT: A component of the path path does not exist, or the path is an empty string - SFM_DIR_NOTDIR, //stat(), mkdir()::ENOTDIR: A component of the path prefix is not a directory - SFM_DIR_ROFS //mkdir()::EROFS: The parent directory resides on a read-only file system - }; protected: SFMError _error; diff --git a/common/scummsys.h b/common/scummsys.h index fb81bcb25a..25c5c166e3 100644 --- a/common/scummsys.h +++ b/common/scummsys.h @@ -200,21 +200,11 @@ #elif defined(__PALMOS_TRAPS__) || defined (__PALMOS_ARMLET__) - #ifdef PALMOS_68K - # include "globals.h" - # define SCUMM_BIG_ENDIAN - - # define scumm_stricmp StrCaselessCompare - # define scumm_strnicmp StrNCaselessCompare - - #else - - # include <extras_string.h> - # define SCUMM_LITTLE_ENDIAN + #include <extras_string.h> + #define SCUMM_LITTLE_ENDIAN - # define scumm_stricmp stricmp - # define scumm_strnicmp strnicmp - #endif + #define scumm_stricmp stricmp + #define scumm_strnicmp strnicmp #define SCUMM_NEED_ALIGNMENT #define STRINGBUFLEN 256 diff --git a/common/system.cpp b/common/system.cpp index f8068d41f5..a1bdb4cdcc 100644 --- a/common/system.cpp +++ b/common/system.cpp @@ -28,13 +28,13 @@ #include "backends/intern.h" #include "backends/events/default/default-events.h" -#include "gui/message.h" - #include "common/config-manager.h" #include "common/system.h" #include "common/timer.h" #include "common/util.h" +#include "graphics/colormasks.h" +#include "gui/message.h" #include "sound/mixer.h" OSystem *g_system = 0; @@ -66,6 +66,23 @@ bool OSystem::setGraphicsMode(const char *name) { return false; } +OverlayColor OSystem::RGBToColor(uint8 r, uint8 g, uint8 b) { + return ::RGBToColor<ColorMasks<565> >(r, g, b); +} + +void OSystem::colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) { + ::colorToRGB<ColorMasks<565> >(color, r, g, b); +} + +OverlayColor OSystem::ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b) { + return RGBToColor(r, g, b); +} + +void OSystem::colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) { + colorToRGB(color, r, g, b); + a = 255; +} + void OSystem::displayMessageOnOSD(const char *msg) { // Display the message for 1.5 seconds GUI::TimedMessageDialog dialog(msg, 1500); diff --git a/common/system.h b/common/system.h index 79680c4655..a1df855449 100644 --- a/common/system.h +++ b/common/system.h @@ -495,17 +495,16 @@ public: virtual void updateScreen() = 0; /** - * Set current shake position, a feature needed for some SCUMM screen effects. - * The effect causes the displayed graphics to be shifted upwards by the specified - * (always positive) offset. The area at the bottom of the screen which is moved - * into view by this is filled by black. This does not cause any graphic data to - * be lost - that is, to restore the original view, the game engine only has to - * call this method again with a 0 offset. No calls to copyRectToScreen are necessary. + * Set current shake position, a feature needed for some SCUMM screen + * effects. The effect causes the displayed graphics to be shifted upwards + * by the specified (always positive) offset. The area at the bottom of the + * screen which is moved into view by this is filled with black. This does + * not cause any graphic data to be lost - that is, to restore the original + * view, the game engine only has to call this method again with offset + * equal to zero. No calls to copyRectToScreen are necessary. * @param shakeOffset the shake offset * - * @todo This is a rather special screen effect, only used by the SCUMM - * frontend - we should consider removing it from the backend API - * and instead implement the functionality in the frontend. + * @note This is currently used in the SCUMM, QUEEN and KYRA engines. */ virtual void setShakePos(int shakeOffset) = 0; @@ -549,8 +548,10 @@ public: * 8bpp), this needs some trickery. * * Essentially, we fake (alpha) blending on these systems by copying the - * game graphics into the overlay buffer, then manually compose whatever - * graphics we want to show in the overlay. + * current game graphics into the overlay buffer when activating the overlay, + * then manually compose whatever graphics we want to show in the overlay. + * This works because we assume the game to be "paused" whenever an overlay + * is active. */ //@{ @@ -607,9 +608,7 @@ public: * @see colorToRGB * @see ARGBToColor */ - virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b) { - return ((((r >> 3) & 0x1F) << 11) | (((g >> 2) & 0x3F) << 5) | ((b >> 3) & 0x1F)); - } + virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b); /** * Convert the given OverlayColor into a RGB triplet. An OverlayColor can @@ -619,14 +618,10 @@ public: * @see RGBToColor * @see colorToARGB */ - virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) { - r = (((color >> 11) & 0x1F) << 3); - g = (((color >> 5) & 0x3F) << 2); - b = ((color&0x1F) << 3); - } + virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b); /** - * Convert the given ARGB quadruplet into an OverlayColor. A OverlayColor can + * Convert the given ARGB quadruplet into an OverlayColor. A OverlayColor can * be 8bit, 16bit or 32bit, depending on the target system. The default * implementation generates a 16 bit color value, in the 565 format * (that is, 5 bits red, 6 bits green, 5 bits blue). @@ -634,9 +629,7 @@ public: * @see colorToRGB * @see RGBToColor */ - virtual OverlayColor ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b) { - return RGBToColor(r, g, b); - } + virtual OverlayColor ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b); /** * Convert the given OverlayColor into an ARGB quadruplet. An OverlayColor can @@ -647,10 +640,7 @@ public: * @see ARGBToColor * @see colorToRGB */ - virtual void colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) { - colorToRGB(color, r, g, b); - a = 255; - } + virtual void colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g, uint8 &b); //@} diff --git a/common/util.cpp b/common/util.cpp index b38dfa6664..389e229a78 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -212,6 +212,7 @@ const PlatformDescription g_platforms[] = { {"atari", "atari-st", "st", "Atari ST", kPlatformAtariST}, {"c64", "c64", "c64", "Commodore 64", kPlatformC64}, {"pc", "dos", "ibm", "DOS", kPlatformPC}, + {"pc98", "pc98", "pc98", "PC-98", kPlatformPC98}, // The 'official' spelling seems to be "FM-TOWNS" (e.g. in the Indy4 demo). // However, on the net many variations can be seen, like "FMTOWNS", @@ -481,8 +482,9 @@ void CDECL debugC(int level, uint32 engine_level, const char *s, ...) { char buf[STRINGBUFLEN]; va_list va; - if (level > gDebugLevel || !(Common::gDebugLevelsEnabled & engine_level)) - return; + if (gDebugLevel != 11) + if (level > gDebugLevel || !(Common::gDebugLevelsEnabled & engine_level)) + return; va_start(va, s); vsnprintf(buf, STRINGBUFLEN, s, va); diff --git a/common/util.h b/common/util.h index 0d63af0878..6d1814280b 100644 --- a/common/util.h +++ b/common/util.h @@ -150,6 +150,7 @@ enum Platform { kPlatformPCEngine, kPlatformApple2GS, + kPlatformPC98, kPlatformUnknown = -1 }; |