diff options
author | Paul Gilbert | 2016-08-27 13:59:08 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-27 13:59:08 -0400 |
commit | f5ab3d1cd9eb3a884b0ab5d0b154a4f9cccc74b7 (patch) | |
tree | 771a8d2b3fddf96c17a1d81d42cb08dfba09d110 /common | |
parent | 873d555add9aaf5eb0d021518f5134142e2c2ff6 (diff) | |
parent | 5ea32efbb0ecb3e6b8336ad3c2edd3905ea5b89a (diff) | |
download | scummvm-rg350-f5ab3d1cd9eb3a884b0ab5d0b154a4f9cccc74b7.tar.gz scummvm-rg350-f5ab3d1cd9eb3a884b0ab5d0b154a4f9cccc74b7.tar.bz2 scummvm-rg350-f5ab3d1cd9eb3a884b0ab5d0b154a4f9cccc74b7.zip |
Merge branch 'master' into xeen
Diffstat (limited to 'common')
-rw-r--r-- | common/debug.cpp | 23 | ||||
-rw-r--r-- | common/debug.h | 30 | ||||
-rw-r--r-- | common/file.cpp | 2 | ||||
-rw-r--r-- | common/file.h | 2 | ||||
-rw-r--r-- | common/gui_options.h | 2 | ||||
-rw-r--r-- | common/memstream.h | 4 | ||||
-rw-r--r-- | common/recorderfile.cpp | 4 | ||||
-rw-r--r-- | common/scummsys.h | 10 | ||||
-rw-r--r-- | common/stream.cpp | 2 | ||||
-rw-r--r-- | common/stream.h | 8 | ||||
-rw-r--r-- | common/system.cpp | 7 | ||||
-rw-r--r-- | common/system.h | 2 | ||||
-rw-r--r-- | common/util.cpp | 7 | ||||
-rw-r--r-- | common/util.h | 11 | ||||
-rw-r--r-- | common/zlib.cpp | 6 |
15 files changed, 92 insertions, 28 deletions
diff --git a/common/debug.cpp b/common/debug.cpp index 182b28afdf..c61fc63dea 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -30,6 +30,7 @@ // TODO: Move gDebugLevel into namespace Common. int gDebugLevel = -1; +bool gDebugChannelsOnly = false; namespace Common { @@ -119,6 +120,18 @@ bool DebugManager::isDebugChannelEnabled(uint32 channel) { } // End of namespace Common +bool debugLevelSet(int level) { + return level <= gDebugLevel; +} + +bool debugChannelSet(int level, uint32 debugChannels) { + if (gDebugLevel != 11) + if (level > gDebugLevel || !(DebugMan.isDebugChannelEnabled(debugChannels))) + return false; + + return true; +} + #ifndef DISABLE_TEXT_CONSOLE @@ -137,6 +150,9 @@ static void debugHelper(const char *s, va_list va, bool caret = true) { void debug(const char *s, ...) { va_list va; + if (gDebugChannelsOnly) + return; + va_start(va, s); debugHelper(s, va); va_end(va); @@ -145,7 +161,7 @@ void debug(const char *s, ...) { void debug(int level, const char *s, ...) { va_list va; - if (level > gDebugLevel) + if (level > gDebugLevel || gDebugChannelsOnly) return; va_start(va, s); @@ -157,6 +173,9 @@ void debug(int level, const char *s, ...) { void debugN(const char *s, ...) { va_list va; + if (gDebugChannelsOnly) + return; + va_start(va, s); debugHelper(s, va, false); va_end(va); @@ -165,7 +184,7 @@ void debugN(const char *s, ...) { void debugN(int level, const char *s, ...) { va_list va; - if (level > gDebugLevel) + if (level > gDebugLevel || gDebugChannelsOnly) return; va_start(va, s); diff --git a/common/debug.h b/common/debug.h index b6e0679a12..883a0bf29d 100644 --- a/common/debug.h +++ b/common/debug.h @@ -31,11 +31,10 @@ inline void debug(const char *s, ...) {} inline void debug(int level, const char *s, ...) {} inline void debugN(const char *s, ...) {} inline void debugN(int level, const char *s, ...) {} -inline void debugC(int level, uint32 engineChannel, const char *s, ...) {} -inline void debugC(uint32 engineChannel, const char *s, ...) {} -inline void debugCN(int level, uint32 engineChannel, const char *s, ...) {} -inline void debugCN(uint32 engineChannel, const char *s, ...) {} - +inline void debugC(int level, uint32 debugChannels, const char *s, ...) {} +inline void debugC(uint32 debugChannels, const char *s, ...) {} +inline void debugCN(int level, uint32 debugChannels, const char *s, ...) {} +inline void debugCN(uint32 debugChannels, const char *s, ...) {} #else @@ -111,6 +110,18 @@ void debugCN(uint32 debugChannels, const char *s, ...) GCC_PRINTF(2, 3); #endif /** + * Returns true if the debug level is set to the specified level + */ +bool debugLevelSet(int level); + +/** + * Returns true if the debug level and channel are active + * + * @see enableDebugChannel + */ +bool debugChannelSet(int level, uint32 debugChannels); + +/** * The debug level. Initially set to -1, indicating that no debug output * should be shown. Positive values usually imply an increasing number of * debug output shall be generated, the higher the value, the more verbose the @@ -118,6 +129,15 @@ void debugCN(uint32 debugChannels, const char *s, ...) GCC_PRINTF(2, 3); */ extern int gDebugLevel; +/** + * Specify if we want to show only the debug channels and suppress + * the non-channeled output. + * + * This option is useful when you want to have higher levels of channels + * visible without the noise from other subsystems or OSystem. + */ +extern bool gDebugChannelsOnly; + //Global constant for EventRecorder debug channel enum GlobalDebugLevels { kDebugLevelEventRec = 1 << 30 diff --git a/common/file.cpp b/common/file.cpp index 16e6a0df1a..4d9c630076 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -202,4 +202,6 @@ bool DumpFile::flush() { return _handle->flush(); } +int32 DumpFile::pos() const { return _handle->pos(); } + } // End of namespace Common diff --git a/common/file.h b/common/file.h index c055acc57d..3d174834e9 100644 --- a/common/file.h +++ b/common/file.h @@ -161,6 +161,8 @@ public: virtual uint32 write(const void *dataPtr, uint32 dataSize); virtual bool flush(); + + virtual int32 pos() const; }; } // End of namespace Common diff --git a/common/gui_options.h b/common/gui_options.h index ec3eccd161..d17f45cac1 100644 --- a/common/gui_options.h +++ b/common/gui_options.h @@ -68,7 +68,7 @@ #define GUIO_GAMEOPTIONS6 "\055" #define GUIO_GAMEOPTIONS7 "\056" #define GUIO_GAMEOPTIONS8 "\057" -#define GUIO_GAMEOPTIONS9 "\058" +#define GUIO_GAMEOPTIONS9 "\060" #define GUIO0() (GUIO_NONE) #define GUIO1(a) (a) diff --git a/common/memstream.h b/common/memstream.h index 94407f5cc9..59d5f15b1a 100644 --- a/common/memstream.h +++ b/common/memstream.h @@ -111,7 +111,7 @@ public: return dataSize; } - uint32 pos() const { return _pos; } + int32 pos() const { return _pos; } uint32 size() const { return _bufSize; } virtual bool err() const { return _err; } @@ -201,7 +201,7 @@ public: return dataSize; } - uint32 pos() const { return _pos; } + int32 pos() const { return _pos; } uint32 size() const { return _size; } byte *getData() { return _data; } diff --git a/common/recorderfile.cpp b/common/recorderfile.cpp index 04802aa0c8..71f8272b44 100644 --- a/common/recorderfile.cpp +++ b/common/recorderfile.cpp @@ -30,8 +30,6 @@ #include "graphics/surface.h" #include "graphics/scaler.h" -#ifdef ENABLE_EVENTRECORDER - #define RECORD_VERSION 1 namespace Common { @@ -716,5 +714,3 @@ void PlaybackFile::checkRecordedMD5() { } - -#endif // ENABLE_EVENTRECORDER diff --git a/common/scummsys.h b/common/scummsys.h index 3513ee2d7d..959c67a404 100644 --- a/common/scummsys.h +++ b/common/scummsys.h @@ -29,7 +29,11 @@ // This is a convenience macro to test whether the compiler used is a GCC // version, which is at least major.minor. -#define GCC_ATLEAST(major, minor) (defined(__GNUC__) && (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))) +#ifdef __GNUC__ + #define GCC_ATLEAST(major, minor) (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))) +#else + #define GCC_ATLEAST(major, minor) 0 +#endif #if defined(_WIN32_WCE) && _WIN32_WCE < 300 #define NONSTANDARD_PORT @@ -215,10 +219,6 @@ #include "config.h" #endif -// Now we need to adjust some settings when running tests -#ifdef COMPILING_TESTS -#undef ENABLE_EVENTRECORDER -#endif // In the following we configure various targets, in particular those // which can't use our "configure" tool and hence don't use config.h. diff --git a/common/stream.cpp b/common/stream.cpp index 45060b9db5..a8446a9086 100644 --- a/common/stream.cpp +++ b/common/stream.cpp @@ -500,6 +500,8 @@ public: virtual bool flush() { return flushBuffer(); } + virtual int32 pos() const { return _pos; } + }; } // End of anonymous namespace diff --git a/common/stream.h b/common/stream.h index abe5192b70..c6c300fa97 100644 --- a/common/stream.h +++ b/common/stream.h @@ -103,6 +103,14 @@ public: flush(); } + /** + * Obtains the current value of the stream position indicator of the + * stream. + * + * @return the current position indicator, or -1 if an error occurred. + */ + virtual int32 pos() const = 0; + // The remaining methods all have default implementations; subclasses // need not (and should not) overload them. diff --git a/common/system.cpp b/common/system.cpp index 53f28cafa1..131a7d2580 100644 --- a/common/system.cpp +++ b/common/system.cpp @@ -30,9 +30,6 @@ #include "common/taskbar.h" #include "common/updates.h" #include "common/textconsole.h" -#ifdef ENABLE_EVENTRECORDER -#include "gui/EventRecorder.h" -#endif #include "backends/audiocd/default/default-audiocd.h" #include "backends/fs/fs-factory.h" @@ -161,9 +158,5 @@ Common::TimerManager *OSystem::getTimerManager() { } Common::SaveFileManager *OSystem::getSavefileManager() { -#ifdef ENABLE_EVENTRECORDER - return g_eventRec.getSaveManager(_savefileManager); -#else return _savefileManager; -#endif } diff --git a/common/system.h b/common/system.h index 8896554f76..6d185d3075 100644 --- a/common/system.h +++ b/common/system.h @@ -1090,7 +1090,7 @@ public: * and other modifiable persistent game data. For more information, * refer to the SaveFileManager documentation. */ - Common::SaveFileManager *getSavefileManager(); + virtual Common::SaveFileManager *getSavefileManager(); #if defined(USE_TASKBAR) /** diff --git a/common/util.cpp b/common/util.cpp index 8e0a2fd61f..62a1baf6ac 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -28,6 +28,7 @@ #define FORBIDDEN_SYMBOL_EXCEPTION_isspace #define FORBIDDEN_SYMBOL_EXCEPTION_isupper #define FORBIDDEN_SYMBOL_EXCEPTION_isprint +#define FORBIDDEN_SYMBOL_EXCEPTION_ispunct #include "common/util.h" @@ -150,4 +151,10 @@ bool isPrint(int c) { ENSURE_ASCII_CHAR(c); return isprint((byte)c); } + +bool isPunct(int c) { + ENSURE_ASCII_CHAR(c); + return ispunct((byte)c); +} + } // End of namespace Common diff --git a/common/util.h b/common/util.h index f51aa00925..1f635f3654 100644 --- a/common/util.h +++ b/common/util.h @@ -177,6 +177,17 @@ bool isUpper(int c); * @return true if the character is printable, false otherwise. */ bool isPrint(int c); + + +/** + * Test whether the given character is a punctuation character, + * (i.e not alphanumeric. + * + * @param c the character to test + * @return true if the character is punctuation, false otherwise. + */ +bool isPunct(int c); + } // End of namespace Common #endif diff --git a/common/zlib.cpp b/common/zlib.cpp index c22ea1e660..39130beb4e 100644 --- a/common/zlib.cpp +++ b/common/zlib.cpp @@ -316,6 +316,7 @@ protected: ScopedPtr<WriteStream> _wrapped; z_stream _stream; int _zlibErr; + uint32 _pos; void processData(int flushType) { // This function is called by both write() and finalize(). @@ -333,7 +334,7 @@ protected: } public: - GZipWriteStream(WriteStream *w) : _wrapped(w), _stream() { + GZipWriteStream(WriteStream *w) : _wrapped(w), _stream(), _pos(0) { assert(w != 0); // Adding 16 to windowBits indicates to zlib that it is supposed to @@ -403,8 +404,11 @@ public: // ... and flush it to disk processData(Z_NO_FLUSH); + _pos += dataSize - _stream.avail_in; return dataSize - _stream.avail_in; } + + virtual int32 pos() const { return _pos; } }; #endif // USE_ZLIB |