aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/EventDispatcher.cpp4
-rw-r--r--common/EventMapper.cpp10
-rw-r--r--common/algorithm.h1
-rw-r--r--common/archive.cpp4
-rw-r--r--common/archive.h4
-rw-r--r--common/array.h1
-rw-r--r--common/bitstream.h13
-rw-r--r--common/bufferedstream.h4
-rw-r--r--common/c++11-compat.h6
-rw-r--r--common/config-manager.cpp4
-rw-r--r--common/config-manager.h4
-rw-r--r--common/coroutines.cpp1
-rw-r--r--common/coroutines.h1
-rw-r--r--common/cosinetables.cpp4
-rw-r--r--common/cosinetables.h4
-rw-r--r--common/dcl.cpp4
-rw-r--r--common/dcl.h4
-rw-r--r--common/dct.cpp18
-rw-r--r--common/dct.h4
-rw-r--r--common/debug-channels.h12
-rw-r--r--common/debug.cpp17
-rw-r--r--common/debug.h1
-rw-r--r--common/endian.h4
-rw-r--r--common/error.cpp4
-rw-r--r--common/error.h4
-rw-r--r--common/events.h4
-rw-r--r--common/fft.cpp4
-rw-r--r--common/fft.h4
-rw-r--r--common/file.cpp4
-rw-r--r--common/file.h4
-rw-r--r--common/forbidden.h4
-rw-r--r--common/frac.h4
-rw-r--r--common/fs.cpp1
-rw-r--r--common/fs.h1
-rw-r--r--common/func.h1
-rw-r--r--common/gui_options.cpp4
-rw-r--r--common/gui_options.h4
-rw-r--r--common/hash-str.h1
-rw-r--r--common/hashmap.cpp4
-rw-r--r--common/hashmap.h4
-rw-r--r--common/huffman.cpp4
-rw-r--r--common/huffman.h4
-rw-r--r--common/iff_container.cpp4
-rw-r--r--common/iff_container.h1
-rw-r--r--common/ini-file.cpp8
-rw-r--r--common/ini-file.h8
-rw-r--r--common/installshield_cab.cpp4
-rw-r--r--common/installshield_cab.h4
-rw-r--r--common/keyboard.h4
-rw-r--r--common/language.cpp4
-rw-r--r--common/language.h4
-rw-r--r--common/list.h1
-rw-r--r--common/list_intern.h1
-rw-r--r--common/localization.cpp1
-rw-r--r--common/localization.h1
-rw-r--r--common/macresman.cpp4
-rw-r--r--common/macresman.h4
-rw-r--r--common/math.h8
-rw-r--r--common/md5.cpp1
-rw-r--r--common/md5.h1
-rw-r--r--common/memory.h1
-rw-r--r--common/memorypool.cpp4
-rw-r--r--common/memorypool.h4
-rw-r--r--common/memstream.h4
-rw-r--r--common/module.mk1
-rw-r--r--common/mutex.cpp4
-rw-r--r--common/mutex.h4
-rw-r--r--common/noncopyable.h4
-rw-r--r--common/pack-end.h1
-rw-r--r--common/pack-start.h1
-rw-r--r--common/platform.cpp1
-rw-r--r--common/platform.h1
-rw-r--r--common/ptr.h1
-rw-r--r--common/queue.h1
-rw-r--r--common/quicktime.cpp46
-rw-r--r--common/quicktime.h9
-rw-r--r--common/random.cpp1
-rw-r--r--common/random.h1
-rw-r--r--common/rational.cpp1
-rw-r--r--common/rational.h1
-rw-r--r--common/rdft.cpp18
-rw-r--r--common/rdft.h4
-rw-r--r--common/recorderfile.cpp6
-rw-r--r--common/recorderfile.h4
-rw-r--r--common/rect.h4
-rw-r--r--common/rendermode.cpp4
-rw-r--r--common/rendermode.h4
-rw-r--r--common/savefile.h4
-rw-r--r--common/scummsys.h11
-rw-r--r--common/serializer.h4
-rw-r--r--common/sinetables.cpp4
-rw-r--r--common/sinetables.h4
-rw-r--r--common/singleton.h4
-rw-r--r--common/stack.h1
-rw-r--r--common/str-array.h4
-rw-r--r--common/str.cpp1
-rw-r--r--common/str.h8
-rw-r--r--common/stream.cpp4
-rw-r--r--common/stream.h4
-rw-r--r--common/substream.h4
-rw-r--r--common/system.cpp4
-rw-r--r--common/system.h4
-rw-r--r--common/textconsole.cpp1
-rw-r--r--common/textconsole.h1
-rw-r--r--common/timer.h1
-rw-r--r--common/tokenizer.cpp1
-rw-r--r--common/tokenizer.h1
-rw-r--r--common/translation.cpp1
-rw-r--r--common/translation.h1
-rw-r--r--common/types.h1
-rw-r--r--common/unzip.cpp1
-rw-r--r--common/unzip.h1
-rw-r--r--common/updates.h4
-rw-r--r--common/ustr.cpp330
-rw-r--r--common/ustr.h195
-rw-r--r--common/util.cpp1
-rw-r--r--common/util.h1
-rw-r--r--common/winexe.cpp4
-rw-r--r--common/winexe.h4
-rw-r--r--common/winexe_ne.cpp6
-rw-r--r--common/winexe_ne.h6
-rw-r--r--common/winexe_pe.cpp4
-rw-r--r--common/winexe_pe.h4
-rw-r--r--common/zlib.cpp28
-rw-r--r--common/zlib.h4
125 files changed, 860 insertions, 197 deletions
diff --git a/common/EventDispatcher.cpp b/common/EventDispatcher.cpp
index e60c1aa7ff..2650d795b7 100644
--- a/common/EventDispatcher.cpp
+++ b/common/EventDispatcher.cpp
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/EventMapper.cpp b/common/EventMapper.cpp
index 5f6771a71d..30896d7514 100644
--- a/common/EventMapper.cpp
+++ b/common/EventMapper.cpp
@@ -8,12 +8,12 @@
* 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.
@@ -37,11 +37,17 @@ List<Event> DefaultEventMapper::mapEvent(const Event &ev, EventSource *source) {
#ifdef ENABLE_VKEYBD
else if (ev.kbd.keycode == KEYCODE_F7 && ev.kbd.hasFlags(0)) {
mappedEvent.type = EVENT_VIRTUAL_KEYBOARD;
+
+ // Avoid blocking F7 events from engine.
+ addDelayedEvent(100, ev);
}
#endif
#ifdef ENABLE_KEYMAPPER
else if (ev.kbd.keycode == KEYCODE_F8 && ev.kbd.hasFlags(0)) {
mappedEvent.type = EVENT_KEYMAPPER_REMAP;
+
+ // Avoid blocking F8 events from engine.
+ addDelayedEvent(100, ev);
}
#endif
}
diff --git a/common/algorithm.h b/common/algorithm.h
index 7a0eed89ce..6453073ae5 100644
--- a/common/algorithm.h
+++ b/common/algorithm.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_ALGORITHM_H
diff --git a/common/archive.cpp b/common/archive.cpp
index 57ebeb2ca6..36d420561f 100644
--- a/common/archive.cpp
+++ b/common/archive.cpp
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/archive.h b/common/archive.h
index 2f9736f032..9293b937af 100644
--- a/common/archive.h
+++ b/common/archive.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/array.h b/common/array.h
index ca89523a0b..f240a9c2f5 100644
--- a/common/array.h
+++ b/common/array.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_ARRAY_H
diff --git a/common/bitstream.h b/common/bitstream.h
index c8c8c11fca..b789f2ac8d 100644
--- a/common/bitstream.h
+++ b/common/bitstream.h
@@ -8,12 +8,12 @@
* 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.
@@ -52,6 +52,9 @@ public:
/** Skip the specified amount of bits. */
virtual void skip(uint32 n) = 0;
+ /** Skip the bits to closest data value border. */
+ virtual void align() = 0;
+
/** Read a bit from the bit stream. */
virtual uint32 getBit() = 0;
@@ -276,6 +279,12 @@ public:
getBit();
}
+ /** Skip the bits to closest data value border. */
+ void align() {
+ while (_inValue)
+ getBit();
+ }
+
/** Return the stream position in bits. */
uint32 pos() const {
if (_stream->pos() == 0)
diff --git a/common/bufferedstream.h b/common/bufferedstream.h
index 6c859c98fe..bbd25722a8 100644
--- a/common/bufferedstream.h
+++ b/common/bufferedstream.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/c++11-compat.h b/common/c++11-compat.h
index 50d79bd79e..14e0642821 100644
--- a/common/c++11-compat.h
+++ b/common/c++11-compat.h
@@ -8,12 +8,12 @@
* 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.
@@ -31,7 +31,9 @@
// Custom nullptr replacement. This is not type safe as the real C++11 nullptr
// though.
//
+#if !defined(nullptr) // XCode 5.0.1 has __cplusplus=199711 but defines this
#define nullptr 0
+#endif
//
// Replacement for the override keyword. This allows compilation of code
diff --git a/common/config-manager.cpp b/common/config-manager.cpp
index aaa812bc94..feb3ddcf56 100644
--- a/common/config-manager.cpp
+++ b/common/config-manager.cpp
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/config-manager.h b/common/config-manager.h
index 6bf56749c5..14f911f69d 100644
--- a/common/config-manager.h
+++ b/common/config-manager.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/coroutines.cpp b/common/coroutines.cpp
index 849b881177..248777febd 100644
--- a/common/coroutines.cpp
+++ b/common/coroutines.cpp
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#include "common/coroutines.h"
diff --git a/common/coroutines.h b/common/coroutines.h
index 30b9bb6a99..4fef1a0d4e 100644
--- a/common/coroutines.h
+++ b/common/coroutines.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_COROUTINES_H
diff --git a/common/cosinetables.cpp b/common/cosinetables.cpp
index 3b245750fa..4bee1f24ea 100644
--- a/common/cosinetables.cpp
+++ b/common/cosinetables.cpp
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/cosinetables.h b/common/cosinetables.h
index f5c95ec003..0ff01e40d6 100644
--- a/common/cosinetables.h
+++ b/common/cosinetables.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/dcl.cpp b/common/dcl.cpp
index 87ec0ad915..bb4e283de5 100644
--- a/common/dcl.cpp
+++ b/common/dcl.cpp
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/dcl.h b/common/dcl.h
index 78ffa631ed..0e96f74c07 100644
--- a/common/dcl.h
+++ b/common/dcl.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/dct.cpp b/common/dct.cpp
index 38b4fbcff2..27e0c0bf41 100644
--- a/common/dct.cpp
+++ b/common/dct.cpp
@@ -8,12 +8,12 @@
* 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.
@@ -73,7 +73,7 @@ void DCT::calc(float *data) {
void DCT::calcDCTI(float *data) {
int n = 1 << _bits;
- float next = -0.5 * (data[0] - data[n]);
+ float next = -0.5f * (data[0] - data[n]);
for (int i = 0; i < (n / 2); i++) {
float tmp1 = data[i ];
@@ -87,7 +87,7 @@ void DCT::calcDCTI(float *data) {
next += c;
- tmp1 = (tmp1 + tmp2) * 0.5;
+ tmp1 = (tmp1 + tmp2) * 0.5f;
data[i ] = tmp1 - s;
data[n - i] = tmp1 + s;
@@ -113,7 +113,7 @@ void DCT::calcDCTII(float *data) {
s *= tmp1 - tmp2;
- tmp1 = (tmp1 + tmp2) * 0.5;
+ tmp1 = (tmp1 + tmp2) * 0.5f;
data[i ] = tmp1 + s;
data[n - i - 1] = tmp1 - s;
@@ -121,7 +121,7 @@ void DCT::calcDCTII(float *data) {
_rdft->calc(data);
- float next = data[1] * 0.5;
+ float next = data[1] * 0.5f;
data[1] *= -1;
@@ -143,7 +143,7 @@ void DCT::calcDCTIII(float *data) {
int n = 1 << _bits;
float next = data[n - 1];
- float inv_n = 1.0 / n;
+ float inv_n = 1.0f / n;
for (int i = n - 2; i >= 2; i -= 2) {
float val1 = data[i ];
@@ -184,7 +184,7 @@ void DCT::calcDSTI(float *data) {
float s = SIN(n, 2 * i);
s *= tmp1 + tmp2;
- tmp1 = (tmp1 - tmp2) * 0.5;
+ tmp1 = (tmp1 - tmp2) * 0.5f;
data[i ] = s + tmp1;
data[n - i] = s - tmp1;
@@ -194,7 +194,7 @@ void DCT::calcDSTI(float *data) {
_rdft->calc(data);
- data[0] *= 0.5;
+ data[0] *= 0.5f;
for (int i = 1; i < (n - 2); i += 2) {
data[i + 1] += data[i - 1];
diff --git a/common/dct.h b/common/dct.h
index 085423ddff..882856a8a9 100644
--- a/common/dct.h
+++ b/common/dct.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/debug-channels.h b/common/debug-channels.h
index 40d1ea667e..1414a1053a 100644
--- a/common/debug-channels.h
+++ b/common/debug-channels.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_DEBUG_CHANNELS_H
@@ -94,8 +95,6 @@ public:
*/
bool disableDebugChannel(const String &name);
-
-
typedef List<DebugChannel> DebugChannelList;
/**
@@ -105,6 +104,15 @@ public:
*/
DebugChannelList listDebugChannels();
+ /**
+ * Enable all debug channels.
+ */
+ void enableAllDebugChannels();
+
+ /**
+ * Disable all debug channels.
+ */
+ void disableAllDebugChannels();
/**
* Test whether the given debug channel is enabled.
diff --git a/common/debug.cpp b/common/debug.cpp
index ba5479c34d..182b28afdf 100644
--- a/common/debug.cpp
+++ b/common/debug.cpp
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#include "common/debug.h"
@@ -45,6 +46,11 @@ struct DebugLevelComperator {
} // end of anonymous namespace
bool DebugManager::addDebugChannel(uint32 channel, const String &name, const String &description) {
+ if (name.equalsIgnoreCase("all")) {
+ warning("Debug channel 'all' is reserved for internal use");
+ return false;
+ }
+
if (gDebugChannels.contains(name))
warning("Duplicate declaration of engine debug channel '%s'", name.c_str());
@@ -84,7 +90,6 @@ bool DebugManager::disableDebugChannel(const String &name) {
}
}
-
DebugManager::DebugChannelList DebugManager::listDebugChannels() {
DebugChannelList tmp;
for (DebugChannelMap::iterator i = gDebugChannels.begin(); i != gDebugChannels.end(); ++i)
@@ -94,6 +99,16 @@ DebugManager::DebugChannelList DebugManager::listDebugChannels() {
return tmp;
}
+void DebugManager::enableAllDebugChannels() {
+ for (DebugChannelMap::iterator i = gDebugChannels.begin(); i != gDebugChannels.end(); ++i)
+ enableDebugChannel(i->_value.name);
+}
+
+void DebugManager::disableAllDebugChannels() {
+ for (DebugChannelMap::iterator i = gDebugChannels.begin(); i != gDebugChannels.end(); ++i)
+ disableDebugChannel(i->_value.name);
+}
+
bool DebugManager::isDebugChannelEnabled(uint32 channel) {
// Debug level 11 turns on all special debug level messages
if (gDebugLevel == 11)
diff --git a/common/debug.h b/common/debug.h
index 859f3c41b3..b6e0679a12 100644
--- a/common/debug.h
+++ b/common/debug.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_DEBUG_H
diff --git a/common/endian.h b/common/endian.h
index 759513efef..529e7f5ac0 100644
--- a/common/endian.h
+++ b/common/endian.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/error.cpp b/common/error.cpp
index 78178f8e27..53cd8cec55 100644
--- a/common/error.cpp
+++ b/common/error.cpp
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/error.h b/common/error.h
index 7043862eea..3e0a7b556f 100644
--- a/common/error.h
+++ b/common/error.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/events.h b/common/events.h
index 9029a4096a..488d586b3f 100644
--- a/common/events.h
+++ b/common/events.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/fft.cpp b/common/fft.cpp
index a9c58ead9b..ac7386083f 100644
--- a/common/fft.cpp
+++ b/common/fft.cpp
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/fft.h b/common/fft.h
index ef5f6e95ad..6eb72c3f84 100644
--- a/common/fft.h
+++ b/common/fft.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/file.cpp b/common/file.cpp
index 7ad6bc2e81..16e6a0df1a 100644
--- a/common/file.cpp
+++ b/common/file.cpp
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/file.h b/common/file.h
index b6319dfc3c..29f12b255d 100644
--- a/common/file.h
+++ b/common/file.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/forbidden.h b/common/forbidden.h
index 9050114442..d6fd9c42fe 100644
--- a/common/forbidden.h
+++ b/common/forbidden.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/frac.h b/common/frac.h
index d402878825..d71d31645b 100644
--- a/common/frac.h
+++ b/common/frac.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/fs.cpp b/common/fs.cpp
index 19a01074ea..3a7026b1cc 100644
--- a/common/fs.cpp
+++ b/common/fs.cpp
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#include "common/system.h"
diff --git a/common/fs.h b/common/fs.h
index fadd672bb1..b5b88ba8cb 100644
--- a/common/fs.h
+++ b/common/fs.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_FS_H
diff --git a/common/func.h b/common/func.h
index a4a80e5406..b58474b2f3 100644
--- a/common/func.h
+++ b/common/func.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_FUNC_H
diff --git a/common/gui_options.cpp b/common/gui_options.cpp
index e463232276..d79bf1b82f 100644
--- a/common/gui_options.cpp
+++ b/common/gui_options.cpp
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/gui_options.h b/common/gui_options.h
index 447fff43ed..78e9cc7199 100644
--- a/common/gui_options.h
+++ b/common/gui_options.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/hash-str.h b/common/hash-str.h
index 190e6922eb..82af6cca93 100644
--- a/common/hash-str.h
+++ b/common/hash-str.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_HASH_STR_H
diff --git a/common/hashmap.cpp b/common/hashmap.cpp
index e505d1dd25..99840993ce 100644
--- a/common/hashmap.cpp
+++ b/common/hashmap.cpp
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/hashmap.h b/common/hashmap.h
index 42509d67e5..d7ba100571 100644
--- a/common/hashmap.h
+++ b/common/hashmap.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/huffman.cpp b/common/huffman.cpp
index a8ebe4142a..afb4fa00b6 100644
--- a/common/huffman.cpp
+++ b/common/huffman.cpp
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/huffman.h b/common/huffman.h
index 3b23340b2e..5ba7deca87 100644
--- a/common/huffman.h
+++ b/common/huffman.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/iff_container.cpp b/common/iff_container.cpp
index 9c6e5f124a..1eee7ad71e 100644
--- a/common/iff_container.cpp
+++ b/common/iff_container.cpp
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/iff_container.h b/common/iff_container.h
index a730930b2c..e684f253b2 100644
--- a/common/iff_container.h
+++ b/common/iff_container.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_IFF_CONTAINER_H
diff --git a/common/ini-file.cpp b/common/ini-file.cpp
index be5247dcfb..7fa17da76c 100644
--- a/common/ini-file.cpp
+++ b/common/ini-file.cpp
@@ -8,12 +8,12 @@
* 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.
@@ -53,7 +53,7 @@ bool INIFile::loadFromFile(const String &filename) {
return false;
}
-bool INIFile::loadFromSaveFile(const char *filename) {
+bool INIFile::loadFromSaveFile(const String &filename) {
assert(g_system);
SaveFileManager *saveFileMan = g_system->getSavefileManager();
SeekableReadStream *loadFile;
@@ -181,7 +181,7 @@ bool INIFile::saveToFile(const String &filename) {
return false;
}
-bool INIFile::saveToSaveFile(const char *filename) {
+bool INIFile::saveToSaveFile(const String &filename) {
assert(g_system);
SaveFileManager *saveFileMan = g_system->getSavefileManager();
WriteStream *saveFile;
diff --git a/common/ini-file.h b/common/ini-file.h
index 1d94ce7bdc..f27a8b9425 100644
--- a/common/ini-file.h
+++ b/common/ini-file.h
@@ -8,12 +8,12 @@
* 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.
@@ -94,10 +94,10 @@ public:
void clear();
bool loadFromFile(const String &filename);
- bool loadFromSaveFile(const char *filename);
+ bool loadFromSaveFile(const String &filename);
bool loadFromStream(SeekableReadStream &stream);
bool saveToFile(const String &filename);
- bool saveToSaveFile(const char *filename);
+ bool saveToSaveFile(const String &filename);
bool saveToStream(WriteStream &stream);
bool hasSection(const String &section) const;
diff --git a/common/installshield_cab.cpp b/common/installshield_cab.cpp
index e25d14741a..e9e8586185 100644
--- a/common/installshield_cab.cpp
+++ b/common/installshield_cab.cpp
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/installshield_cab.h b/common/installshield_cab.h
index 7c4f294578..d3c584815e 100644
--- a/common/installshield_cab.h
+++ b/common/installshield_cab.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/keyboard.h b/common/keyboard.h
index 3262a15c3f..e6e1f5948b 100644
--- a/common/keyboard.h
+++ b/common/keyboard.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/language.cpp b/common/language.cpp
index 898adf8d0e..97c515b45a 100644
--- a/common/language.cpp
+++ b/common/language.cpp
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#include "common/language.h"
@@ -28,6 +29,7 @@ namespace Common {
const LanguageDescription g_languages[] = {
{ "zh-cn", "zh_CN", "Chinese (China)", ZH_CNA },
{ "zh", "zh_TW", "Chinese (Taiwan)", ZH_TWN },
+ { "hr", "hr_HR", "Croatian", HR_HRV },
{ "cz", "cs_CZ", "Czech", CZ_CZE },
{ "nl", "nl_NL", "Dutch", NL_NLD },
{ "en", "en", "English", EN_ANY }, // Generic English (when only one game version exist)
@@ -38,11 +40,11 @@ const LanguageDescription g_languages[] = {
{ "gr", "el_GR", "Greek", GR_GRE },
{ "he", "he_IL", "Hebrew", HE_ISR },
{ "hb", "he_IL", "Hebrew", HE_ISR }, // Deprecated
- { "hr", "hr_HR", "Croatian", HR_HRV },
{ "hu", "hu_HU", "Hungarian", HU_HUN },
{ "it", "it_IT", "Italian", IT_ITA },
{ "jp", "ja_JP", "Japanese", JA_JPN },
{ "kr", "ko_KR", "Korean", KO_KOR },
+ { "lv", "lv_LV", "Latvian", LV_LAT },
{ "nb", "nb_NO", "Norwegian Bokm\xE5l", NB_NOR }, // TODO Someone should verify the unix locale
{ "pl", "pl_PL", "Polish", PL_POL },
{ "br", "pt_BR", "Portuguese", PT_BRA },
diff --git a/common/language.h b/common/language.h
index 03b9ebaf8e..ac3c7267ab 100644
--- a/common/language.h
+++ b/common/language.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_LANGUAGE_H
@@ -34,6 +35,7 @@ class String;
enum Language {
ZH_CNA,
ZH_TWN,
+ HR_HRV,
CZ_CZE,
NL_NLD,
EN_ANY, // Generic English (when only one game version exist)
@@ -43,11 +45,11 @@ enum Language {
DE_DEU,
GR_GRE,
HE_ISR,
- HR_HRV,
HU_HUN,
IT_ITA,
JA_JPN,
KO_KOR,
+ LV_LAT,
NB_NOR,
PL_POL,
PT_BRA,
diff --git a/common/list.h b/common/list.h
index 9792042239..1bb4a2a5df 100644
--- a/common/list.h
+++ b/common/list.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_LIST_H
diff --git a/common/list_intern.h b/common/list_intern.h
index fef32fbe1e..b4f347561b 100644
--- a/common/list_intern.h
+++ b/common/list_intern.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_LIST_INTERN_H
diff --git a/common/localization.cpp b/common/localization.cpp
index afd31b8d22..d08583d955 100644
--- a/common/localization.cpp
+++ b/common/localization.cpp
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#include "common/localization.h"
diff --git a/common/localization.h b/common/localization.h
index e908485b99..096c5e95f5 100644
--- a/common/localization.h
+++ b/common/localization.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_LOCALIZATION_H
diff --git a/common/macresman.cpp b/common/macresman.cpp
index ba44caafd9..d83bde8fd8 100644
--- a/common/macresman.cpp
+++ b/common/macresman.cpp
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/macresman.h b/common/macresman.h
index cca6592f21..373545795e 100644
--- a/common/macresman.h
+++ b/common/macresman.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/math.h b/common/math.h
index ba137101e4..f91f7a2eec 100644
--- a/common/math.h
+++ b/common/math.h
@@ -8,12 +8,12 @@
* 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.
@@ -108,11 +108,11 @@ inline int intLog2(uint32 v) {
#endif
inline float rad2deg(float rad) {
- return rad * 180.0 / M_PI;
+ return rad * 180.0f / (float)M_PI;
}
inline float deg2rad(float deg) {
- return deg * M_PI / 180.0;
+ return deg * (float)M_PI / 180.0f;
}
} // End of namespace Common
diff --git a/common/md5.cpp b/common/md5.cpp
index 52fe8b8f8d..6a6eeaf048 100644
--- a/common/md5.cpp
+++ b/common/md5.cpp
@@ -17,6 +17,7 @@
* 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.
+ *
*/
/*
diff --git a/common/md5.h b/common/md5.h
index d1be8c8e39..640326efe7 100644
--- a/common/md5.h
+++ b/common/md5.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_MD5_H
diff --git a/common/memory.h b/common/memory.h
index 0e5a97c20b..c32af42ba5 100644
--- a/common/memory.h
+++ b/common/memory.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_MEMORY_H
diff --git a/common/memorypool.cpp b/common/memorypool.cpp
index e3742eeae0..1a9bfe2e29 100644
--- a/common/memorypool.cpp
+++ b/common/memorypool.cpp
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/memorypool.h b/common/memorypool.h
index 1cd725b99d..b84012232c 100644
--- a/common/memorypool.h
+++ b/common/memorypool.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/memstream.h b/common/memstream.h
index 7fa6500753..5ecc553454 100644
--- a/common/memstream.h
+++ b/common/memstream.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/module.mk b/common/module.mk
index 1b34d151d0..67c498df00 100644
--- a/common/module.mk
+++ b/common/module.mk
@@ -35,6 +35,7 @@ MODULE_OBJS := \
translation.o \
unarj.o \
unzip.o \
+ ustr.o \
util.o \
winexe.o \
winexe_ne.o \
diff --git a/common/mutex.cpp b/common/mutex.cpp
index f912e79591..a7b34eb334 100644
--- a/common/mutex.cpp
+++ b/common/mutex.cpp
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/mutex.h b/common/mutex.h
index 26f69a3996..6e467cfddf 100644
--- a/common/mutex.h
+++ b/common/mutex.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/noncopyable.h b/common/noncopyable.h
index 0cbe41388a..24021f42a6 100644
--- a/common/noncopyable.h
+++ b/common/noncopyable.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/pack-end.h b/common/pack-end.h
index 04633b7635..5fed5e577b 100644
--- a/common/pack-end.h
+++ b/common/pack-end.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#if defined(SCUMMVM_USE_PRAGMA_PACK)
diff --git a/common/pack-start.h b/common/pack-start.h
index 631a6529d3..cfb8968a57 100644
--- a/common/pack-start.h
+++ b/common/pack-start.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#if defined(SCUMMVM_USE_PRAGMA_PACK)
diff --git a/common/platform.cpp b/common/platform.cpp
index 20ed970385..636c1ddb52 100644
--- a/common/platform.cpp
+++ b/common/platform.cpp
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#include "common/platform.h"
diff --git a/common/platform.h b/common/platform.h
index ac8772fa94..17a332b851 100644
--- a/common/platform.h
+++ b/common/platform.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_PLATFORM_H
diff --git a/common/ptr.h b/common/ptr.h
index f734ec133f..ebdd77cf3c 100644
--- a/common/ptr.h
+++ b/common/ptr.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_PTR_H
diff --git a/common/queue.h b/common/queue.h
index 3a2d6aad4b..ee14d5b364 100644
--- a/common/queue.h
+++ b/common/queue.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_QUEUE_H
diff --git a/common/quicktime.cpp b/common/quicktime.cpp
index a3efc2b443..76880e1016 100644
--- a/common/quicktime.cpp
+++ b/common/quicktime.cpp
@@ -368,9 +368,6 @@ int QuickTimeParser::readMVHD(Atom atom) {
int QuickTimeParser::readTRAK(Atom atom) {
Track *track = new Track();
- if (!track)
- return -1;
-
track->codecType = CODEC_TYPE_MOV_OTHER;
track->startTime = 0; // XXX: check
_tracks.push_back(track);
@@ -532,7 +529,7 @@ int QuickTimeParser::readSTSD(Atom atom) {
_fd->readByte(); _fd->readByte(); _fd->readByte(); // flags
uint32 entryCount = _fd->readUint32BE();
- track->sampleDescs.resize(entryCount);
+ track->sampleDescs.reserve(entryCount);
for (uint32 i = 0; i < entryCount; i++) { // Parsing Sample description table
Atom a = { 0, 0, 0 };
@@ -544,7 +541,7 @@ int QuickTimeParser::readSTSD(Atom atom) {
_fd->readUint16BE(); // reserved
_fd->readUint16BE(); // index
- track->sampleDescs[i] = readSampleDesc(track, format, size - 16);
+ track->sampleDescs.push_back(readSampleDesc(track, format, size - 16));
debug(0, "size=%d 4CC= %s codec_type=%d", size, tag2str(format), track->codecType);
@@ -695,8 +692,14 @@ int QuickTimeParser::readWAVE(Atom atom) {
if (atom.size > (1 << 30))
return -1;
- if (track->sampleDescs[0]->getCodecTag() == MKTAG('Q', 'D', 'M', '2')) // Read extra data for QDM2
- track->extraData = _fd->readStream(atom.size);
+ // We should only get here within an stsd atom
+ if (track->sampleDescs.empty())
+ return -1;
+
+ SampleDesc *sampleDesc = track->sampleDescs.back();
+
+ if (sampleDesc->getCodecTag() == MKTAG('Q', 'D', 'M', '2')) // Read extra data for QDM2
+ sampleDesc->_extraData = _fd->readStream(atom.size);
else if (atom.size > 8)
return readDefault(atom);
else
@@ -738,6 +741,12 @@ int QuickTimeParser::readESDS(Atom atom) {
Track *track = _tracks.back();
+ // We should only get here within an stsd atom
+ if (track->sampleDescs.empty())
+ return -1;
+
+ SampleDesc *sampleDesc = track->sampleDescs.back();
+
_fd->readUint32BE(); // version + flags
byte tag;
@@ -753,7 +762,7 @@ int QuickTimeParser::readESDS(Atom atom) {
if (tag != kMP4DecConfigDescTag)
return 0;
- track->objectTypeMP4 = _fd->readByte();
+ sampleDesc->_objectTypeMP4 = _fd->readByte();
_fd->readByte(); // stream type
_fd->readUint16BE(); _fd->readByte(); // buffer size
_fd->readUint32BE(); // max bitrate
@@ -764,9 +773,9 @@ int QuickTimeParser::readESDS(Atom atom) {
if (tag != kMP4DecSpecificDescTag)
return 0;
- track->extraData = _fd->readStream(length);
+ sampleDesc->_extraData = _fd->readStream(length);
- debug(0, "MPEG-4 object type = %02x", track->objectTypeMP4);
+ debug(0, "MPEG-4 object type = %02x", sampleDesc->_objectTypeMP4);
return 0;
}
@@ -776,8 +785,14 @@ int QuickTimeParser::readSMI(Atom atom) {
Track *track = _tracks.back();
+ // We should only get here within an stsd atom
+ if (track->sampleDescs.empty())
+ return -1;
+
+ SampleDesc *sampleDesc = track->sampleDescs.back();
+
// This atom just contains SVQ3 extra data
- track->extraData = _fd->readStream(atom.size);
+ sampleDesc->_extraData = _fd->readStream(atom.size);
return 0;
}
@@ -797,6 +812,12 @@ void QuickTimeParser::close() {
QuickTimeParser::SampleDesc::SampleDesc(Track *parentTrack, uint32 codecTag) {
_parentTrack = parentTrack;
_codecTag = codecTag;
+ _extraData = 0;
+ _objectTypeMP4 = 0;
+}
+
+QuickTimeParser::SampleDesc::~SampleDesc() {
+ delete _extraData;
}
QuickTimeParser::Track::Track() {
@@ -817,11 +838,9 @@ QuickTimeParser::Track::Track() {
codecType = CODEC_TYPE_MOV_OTHER;
editCount = 0;
editList = 0;
- extraData = 0;
frameCount = 0;
duration = 0;
startTime = 0;
- objectTypeMP4 = 0;
mediaDuration = 0;
}
@@ -832,7 +851,6 @@ QuickTimeParser::Track::~Track() {
delete[] sampleSizes;
delete[] keyframes;
delete[] editList;
- delete extraData;
for (uint32 i = 0; i < sampleDescs.size(); i++)
delete sampleDescs[i];
diff --git a/common/quicktime.h b/common/quicktime.h
index caa92578b1..f5fd578e3a 100644
--- a/common/quicktime.h
+++ b/common/quicktime.h
@@ -108,10 +108,13 @@ protected:
class SampleDesc {
public:
SampleDesc(Track *parentTrack, uint32 codecTag);
- virtual ~SampleDesc() {}
+ virtual ~SampleDesc();
uint32 getCodecTag() const { return _codecTag; }
+ SeekableReadStream *_extraData;
+ byte _objectTypeMP4;
+
protected:
Track *_parentTrack;
uint32 _codecTag;
@@ -150,16 +153,12 @@ protected:
uint32 editCount;
EditListEntry *editList;
- SeekableReadStream *extraData;
-
uint32 frameCount;
uint32 duration;
uint32 mediaDuration;
uint32 startTime;
Rational scaleFactorX;
Rational scaleFactorY;
-
- byte objectTypeMP4;
};
virtual SampleDesc *readSampleDesc(Track *track, uint32 format, uint32 descSize) = 0;
diff --git a/common/random.cpp b/common/random.cpp
index de1269b485..86bde77e82 100644
--- a/common/random.cpp
+++ b/common/random.cpp
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#include "common/random.h"
diff --git a/common/random.h b/common/random.h
index c8aec58946..48cde26dc5 100644
--- a/common/random.h
+++ b/common/random.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_RANDOM_H
diff --git a/common/rational.cpp b/common/rational.cpp
index f5495da3a9..90e44576a7 100644
--- a/common/rational.cpp
+++ b/common/rational.cpp
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#include "common/debug.h"
diff --git a/common/rational.h b/common/rational.h
index 8270d2194e..55fb361774 100644
--- a/common/rational.h
+++ b/common/rational.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_RATIONAL_H
diff --git a/common/rdft.cpp b/common/rdft.cpp
index bfd6818fbd..89d39112e6 100644
--- a/common/rdft.cpp
+++ b/common/rdft.cpp
@@ -8,12 +8,12 @@
* 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.
@@ -29,7 +29,7 @@
namespace Common {
RDFT::RDFT(int bits, TransformType trans) : _bits(bits), _sin(bits), _cos(bits), _fft(0) {
- assert ((_bits >= 4) && (_bits <= 16));
+ assert((_bits >= 4) && (_bits <= 16));
_inverse = trans == IDFT_C2R || trans == DFT_C2R;
_signConvention = trans == IDFT_R2C || trans == DFT_C2R ? 1 : -1;
@@ -49,12 +49,12 @@ RDFT::~RDFT() {
void RDFT::calc(float *data) {
const int n = 1 << _bits;
- const float k1 = 0.5;
- const float k2 = 0.5 - _inverse;
+ const float k1 = 0.5f;
+ const float k2 = 0.5f - _inverse;
if (!_inverse) {
- _fft->permute((Complex *) data);
- _fft->calc ((Complex *) data);
+ _fft->permute((Complex *)data);
+ _fft->calc ((Complex *)data);
}
Complex ev, od;
@@ -91,8 +91,8 @@ void RDFT::calc(float *data) {
data[0] *= k1;
data[1] *= k1;
- _fft->permute((Complex *) data);
- _fft->calc ((Complex *) data);
+ _fft->permute((Complex *)data);
+ _fft->calc ((Complex *)data);
}
}
diff --git a/common/rdft.h b/common/rdft.h
index 76e95c363a..ae06c72ef8 100644
--- a/common/rdft.h
+++ b/common/rdft.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/recorderfile.cpp b/common/recorderfile.cpp
index d08bc599f1..71f8272b44 100644
--- a/common/recorderfile.cpp
+++ b/common/recorderfile.cpp
@@ -8,12 +8,12 @@
* 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.
@@ -45,6 +45,8 @@ PlaybackFile::PlaybackFile() : _tmpRecordFile(_tmpBuffer, kRecordBuffSize), _tmp
_recordCount = 0;
_eventsSize = 0;
memset(_tmpBuffer, 1, kRecordBuffSize);
+
+ _playbackParseState = kFileStateCheckFormat;
}
PlaybackFile::~PlaybackFile() {
diff --git a/common/recorderfile.h b/common/recorderfile.h
index 1c95e5a915..d34a442604 100644
--- a/common/recorderfile.h
+++ b/common/recorderfile.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/rect.h b/common/rect.h
index 5790cf7c0f..32424d3e6a 100644
--- a/common/rect.h
+++ b/common/rect.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/rendermode.cpp b/common/rendermode.cpp
index e8f3146630..6115666399 100644
--- a/common/rendermode.cpp
+++ b/common/rendermode.cpp
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/rendermode.h b/common/rendermode.h
index 945c4e7d9d..59fa860c6c 100644
--- a/common/rendermode.h
+++ b/common/rendermode.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/savefile.h b/common/savefile.h
index 19536da54f..b0c4d31f53 100644
--- a/common/savefile.h
+++ b/common/savefile.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/scummsys.h b/common/scummsys.h
index b15a76e5b9..c30bc4a52a 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -8,12 +8,12 @@
* 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.
@@ -405,6 +405,13 @@
typedef unsigned int uint32;
typedef signed int int32;
typedef unsigned int uint;
+ #ifdef __PLAYSTATION2__
+ typedef signed long int64;
+ typedef unsigned long uint64;
+ #else
+ typedef signed long long int64;
+ typedef unsigned long long uint64;
+ #endif
#endif
diff --git a/common/serializer.h b/common/serializer.h
index 4d97c9e930..ef8fca9906 100644
--- a/common/serializer.h
+++ b/common/serializer.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/sinetables.cpp b/common/sinetables.cpp
index 7338166d39..c01705e3dc 100644
--- a/common/sinetables.cpp
+++ b/common/sinetables.cpp
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/sinetables.h b/common/sinetables.h
index 3489663661..67225c0bcb 100644
--- a/common/sinetables.h
+++ b/common/sinetables.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/singleton.h b/common/singleton.h
index 6e47f119ba..13bdb0c3a3 100644
--- a/common/singleton.h
+++ b/common/singleton.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/stack.h b/common/stack.h
index bc5de9ac7f..cba3fb124d 100644
--- a/common/stack.h
+++ b/common/stack.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_STACK_H
diff --git a/common/str-array.h b/common/str-array.h
index 57c76bf305..7a52a314e1 100644
--- a/common/str-array.h
+++ b/common/str-array.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/str.cpp b/common/str.cpp
index 4a10792373..faf84d722f 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#include "common/hash-str.h"
diff --git a/common/str.h b/common/str.h
index 6b4475e1c4..a2451f2f69 100644
--- a/common/str.h
+++ b/common/str.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_STRING_H
@@ -234,6 +235,13 @@ public:
static String vformat(const char *fmt, va_list args);
public:
+ typedef char value_type;
+ /**
+ * Unsigned version of the underlying type. This can be used to cast
+ * individual string characters to bigger integer types without sign
+ * extension happening.
+ */
+ typedef unsigned char unsigned_type;
typedef char * iterator;
typedef const char * const_iterator;
diff --git a/common/stream.cpp b/common/stream.cpp
index f49603c882..45060b9db5 100644
--- a/common/stream.cpp
+++ b/common/stream.cpp
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/stream.h b/common/stream.h
index 33ebc95a86..238844a860 100644
--- a/common/stream.h
+++ b/common/stream.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/substream.h b/common/substream.h
index 01686529aa..e3161c0a53 100644
--- a/common/substream.h
+++ b/common/substream.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/system.cpp b/common/system.cpp
index d86b5b2b81..53f28cafa1 100644
--- a/common/system.cpp
+++ b/common/system.cpp
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/system.h b/common/system.h
index 81c4bdf34e..8896554f76 100644
--- a/common/system.h
+++ b/common/system.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/textconsole.cpp b/common/textconsole.cpp
index a721c121d5..5c69e42379 100644
--- a/common/textconsole.cpp
+++ b/common/textconsole.cpp
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#define FORBIDDEN_SYMBOL_EXCEPTION_exit
diff --git a/common/textconsole.h b/common/textconsole.h
index 12f15e5e4b..e7654dd7e5 100644
--- a/common/textconsole.h
+++ b/common/textconsole.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_CONSOLE_H
diff --git a/common/timer.h b/common/timer.h
index 3db32df76a..2db163327d 100644
--- a/common/timer.h
+++ b/common/timer.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_TIMER_H
diff --git a/common/tokenizer.cpp b/common/tokenizer.cpp
index 46ba7a8d8b..2547f88168 100644
--- a/common/tokenizer.cpp
+++ b/common/tokenizer.cpp
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#include "common/tokenizer.h"
diff --git a/common/tokenizer.h b/common/tokenizer.h
index 8485094997..dd831f3431 100644
--- a/common/tokenizer.h
+++ b/common/tokenizer.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_TOKENIZER_H
diff --git a/common/translation.cpp b/common/translation.cpp
index 2bc31c617b..01665bf876 100644
--- a/common/translation.cpp
+++ b/common/translation.cpp
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#if defined(WIN32)
diff --git a/common/translation.h b/common/translation.h
index 77e2fdfc07..e316507fdb 100644
--- a/common/translation.h
+++ b/common/translation.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_TRANSLATION_H
diff --git a/common/types.h b/common/types.h
index ab86f3afc2..dd5408daa5 100644
--- a/common/types.h
+++ b/common/types.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_TYPES_H
diff --git a/common/unzip.cpp b/common/unzip.cpp
index 69b9ff67cb..716c8c2d5e 100644
--- a/common/unzip.cpp
+++ b/common/unzip.cpp
@@ -17,6 +17,7 @@
* 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.
+ *
*/
/* unzip.c -- IO on .zip files using zlib
diff --git a/common/unzip.h b/common/unzip.h
index 2e0dae831a..f249c5db19 100644
--- a/common/unzip.h
+++ b/common/unzip.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_UNZIP_H
diff --git a/common/updates.h b/common/updates.h
index 0012808a17..4c30987c38 100644
--- a/common/updates.h
+++ b/common/updates.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/ustr.cpp b/common/ustr.cpp
new file mode 100644
index 0000000000..35b5502a6d
--- /dev/null
+++ b/common/ustr.cpp
@@ -0,0 +1,330 @@
+/* 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.
+ *
+ */
+
+#include "common/ustr.h"
+#include "common/memorypool.h"
+#include "common/util.h"
+
+namespace Common {
+
+extern MemoryPool *g_refCountPool;
+
+static uint32 computeCapacity(uint32 len) {
+ // By default, for the capacity we use the next multiple of 32
+ return ((len + 32 - 1) & ~0x1F);
+}
+
+U32String::U32String(const value_type *str) : _size(0), _str(_storage) {
+ if (str == 0) {
+ _storage[0] = 0;
+ _size = 0;
+ } else {
+ uint32 len = 0;
+ const value_type *s = str;
+ while (*s++) {
+ ++len;
+ }
+ initWithCStr(str, len);
+ }
+}
+
+U32String::U32String(const value_type *str, uint32 len) : _size(0), _str(_storage) {
+ initWithCStr(str, len);
+}
+
+U32String::U32String(const value_type *beginP, const value_type *endP) : _size(0), _str(_storage) {
+ assert(endP >= beginP);
+ initWithCStr(beginP, endP - beginP);
+}
+
+U32String::U32String(const U32String &str)
+ : _size(str._size) {
+ if (str.isStorageIntern()) {
+ // String in internal storage: just copy it
+ memcpy(_storage, str._storage, _builtinCapacity * sizeof(value_type));
+ _str = _storage;
+ } else {
+ // String in external storage: use refcount mechanism
+ str.incRefCount();
+ _extern._refCount = str._extern._refCount;
+ _extern._capacity = str._extern._capacity;
+ _str = str._str;
+ }
+ assert(_str != 0);
+}
+
+U32String::~U32String() {
+ decRefCount(_extern._refCount);
+}
+
+U32String &U32String::operator=(const U32String &str) {
+ if (&str == this)
+ return *this;
+
+ if (str.isStorageIntern()) {
+ decRefCount(_extern._refCount);
+ _size = str._size;
+ _str = _storage;
+ memcpy(_str, str._str, (_size + 1) * sizeof(value_type));
+ } else {
+ str.incRefCount();
+ decRefCount(_extern._refCount);
+
+ _extern._refCount = str._extern._refCount;
+ _extern._capacity = str._extern._capacity;
+ _size = str._size;
+ _str = str._str;
+ }
+
+ return *this;
+}
+
+U32String &U32String::operator+=(const U32String &str) {
+ if (&str == this) {
+ return operator+=(U32String(str));
+ }
+
+ int len = str._size;
+ if (len > 0) {
+ ensureCapacity(_size + len, true);
+
+ memcpy(_str + _size, str._str, (len + 1) * sizeof(value_type));
+ _size += len;
+ }
+ return *this;
+}
+
+U32String &U32String::operator+=(value_type c) {
+ ensureCapacity(_size + 1, true);
+
+ _str[_size++] = c;
+ _str[_size] = 0;
+
+ return *this;
+}
+
+bool U32String::equals(const U32String &x) const {
+ if (this == &x || _str == x._str) {
+ return true;
+ }
+
+ if (x.size() != _size) {
+ return false;
+ }
+
+ return !memcmp(_str, x._str, _size * sizeof(value_type));
+}
+
+bool U32String::contains(value_type x) const {
+ for (uint32 i = 0; i < _size; ++i) {
+ if (_str[i] == x) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void U32String::deleteChar(uint32 p) {
+ assert(p < _size);
+
+ makeUnique();
+ while (p++ < _size)
+ _str[p - 1] = _str[p];
+ _size--;
+}
+
+void U32String::clear() {
+ decRefCount(_extern._refCount);
+
+ _size = 0;
+ _str = _storage;
+ _storage[0] = 0;
+}
+
+void U32String::toLowercase() {
+ makeUnique();
+ for (uint32 i = 0; i < _size; ++i) {
+ if (_str[i] < 128) {
+ _str[i] = tolower(_str[i]);
+ }
+ }
+}
+
+void U32String::toUppercase() {
+ makeUnique();
+ for (uint32 i = 0; i < _size; ++i) {
+ if (_str[i] < 128) {
+ _str[i] = toupper(_str[i]);
+ }
+ }
+}
+
+uint32 U32String::find(const U32String &str, uint32 pos) const {
+ if (pos >= _size) {
+ return npos;
+ }
+
+ const value_type *strP = str.c_str();
+
+ for (const_iterator cur = begin() + pos; *cur; ++cur) {
+ uint i = 0;
+ while (true) {
+ if (!strP[i]) {
+ return cur - begin();
+ }
+
+ if (cur[i] != strP[i]) {
+ break;
+ }
+
+ ++i;
+ }
+ }
+
+ return npos;
+}
+
+void U32String::makeUnique() {
+ ensureCapacity(_size, true);
+}
+
+void U32String::ensureCapacity(uint32 new_size, bool keep_old) {
+ bool isShared;
+ uint32 curCapacity, newCapacity;
+ value_type *newStorage;
+ int *oldRefCount = _extern._refCount;
+
+ if (isStorageIntern()) {
+ isShared = false;
+ curCapacity = _builtinCapacity;
+ } else {
+ isShared = (oldRefCount && *oldRefCount > 1);
+ curCapacity = _extern._capacity;
+ }
+
+ // Special case: If there is enough space, and we do not share
+ // the storage, then there is nothing to do.
+ if (!isShared && new_size < curCapacity)
+ return;
+
+ if (isShared && new_size < _builtinCapacity) {
+ // We share the storage, but there is enough internal storage: Use that.
+ newStorage = _storage;
+ newCapacity = _builtinCapacity;
+ } else {
+ // We need to allocate storage on the heap!
+
+ // Compute a suitable new capacity limit
+ // If the current capacity is sufficient we use the same capacity
+ if (new_size < curCapacity)
+ newCapacity = curCapacity;
+ else
+ newCapacity = MAX(curCapacity * 2, computeCapacity(new_size+1));
+
+ // Allocate new storage
+ newStorage = new value_type[newCapacity];
+ assert(newStorage);
+ }
+
+ // Copy old data if needed, elsewise reset the new storage.
+ if (keep_old) {
+ assert(_size < newCapacity);
+ memcpy(newStorage, _str, (_size + 1) * sizeof(value_type));
+ } else {
+ _size = 0;
+ newStorage[0] = 0;
+ }
+
+ // Release hold on the old storage ...
+ decRefCount(oldRefCount);
+
+ // ... in favor of the new storage
+ _str = newStorage;
+
+ if (!isStorageIntern()) {
+ // Set the ref count & capacity if we use an external storage.
+ // It is important to do this *after* copying any old content,
+ // else we would override data that has not yet been copied!
+ _extern._refCount = 0;
+ _extern._capacity = newCapacity;
+ }
+}
+
+void U32String::incRefCount() const {
+ assert(!isStorageIntern());
+ if (_extern._refCount == 0) {
+ if (g_refCountPool == 0) {
+ g_refCountPool = new MemoryPool(sizeof(int));
+ assert(g_refCountPool);
+ }
+
+ _extern._refCount = (int *)g_refCountPool->allocChunk();
+ *_extern._refCount = 2;
+ } else {
+ ++(*_extern._refCount);
+ }
+}
+
+void U32String::decRefCount(int *oldRefCount) {
+ if (isStorageIntern())
+ return;
+
+ if (oldRefCount) {
+ --(*oldRefCount);
+ }
+ if (!oldRefCount || *oldRefCount <= 0) {
+ // The ref count reached zero, so we free the string storage
+ // and the ref count storage.
+ if (oldRefCount) {
+ assert(g_refCountPool);
+ g_refCountPool->freeChunk(oldRefCount);
+ }
+ delete[] _str;
+
+ // Even though _str points to a freed memory block now,
+ // we do not change its value, because any code that calls
+ // decRefCount will have to do this afterwards anyway.
+ }
+}
+
+void U32String::initWithCStr(const value_type *str, uint32 len) {
+ assert(str);
+
+ _storage[0] = 0;
+
+ _size = len;
+
+ if (len >= _builtinCapacity) {
+ // Not enough internal storage, so allocate more
+ _extern._capacity = computeCapacity(len+1);
+ _extern._refCount = 0;
+ _str = new value_type[_extern._capacity];
+ assert(_str != 0);
+ }
+
+ // Copy the string into the storage area
+ memmove(_str, str, len * sizeof(value_type));
+ _str[len] = 0;
+}
+
+} // End of namespace Common
diff --git a/common/ustr.h b/common/ustr.h
new file mode 100644
index 0000000000..0059a1eb96
--- /dev/null
+++ b/common/ustr.h
@@ -0,0 +1,195 @@
+/* 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.
+ *
+ */
+
+#ifndef COMMON_USTR_H
+#define COMMON_USTR_H
+
+#include "common/scummsys.h"
+
+namespace Common {
+
+/**
+ * Very simple string class for UTF-32 strings in ScummVM. The main intention
+ * behind this class is to feature a simple way of displaying UTF-32 strings
+ * through the Graphics::Font API.
+ *
+ * Please note that operations like equals, deleteCharacter, toUppercase, etc.
+ * are only very simplified convenience operations. They might not fully work
+ * as you would expect for a proper UTF-32 string class.
+ *
+ * The presence of \0 characters in the string will cause undefined
+ * behavior in some operations.
+ */
+class U32String {
+public:
+ static const uint32 npos = 0xFFFFFFFF;
+
+ typedef uint32 value_type;
+ typedef uint32 unsigned_type;
+private:
+ /**
+ * The size of the internal storage. Increasing this means less heap
+ * allocations are needed, at the cost of more stack memory usage,
+ * and of course lots of wasted memory.
+ */
+ static const uint32 _builtinCapacity = 32;
+
+ /**
+ * Length of the string.
+ */
+ uint32 _size;
+
+ /**
+ * Pointer to the actual string storage. Either points to _storage,
+ * or to a block allocated on the heap via malloc.
+ */
+ value_type *_str;
+
+
+ union {
+ /**
+ * Internal string storage.
+ */
+ value_type _storage[_builtinCapacity];
+ /**
+ * External string storage data -- the refcounter, and the
+ * capacity of the string _str points to.
+ */
+ struct {
+ mutable int *_refCount;
+ uint32 _capacity;
+ } _extern;
+ };
+
+ inline bool isStorageIntern() const {
+ return _str == _storage;
+ }
+
+public:
+ /** Construct a new empty string. */
+ U32String() : _size(0), _str(_storage) { _storage[0] = 0; }
+
+ /** Construct a new string from the given NULL-terminated C string. */
+ explicit U32String(const value_type *str);
+
+ /** Construct a new string containing exactly len characters read from address str. */
+ U32String(const value_type *str, uint32 len);
+
+ /** Construct a new string containing the characters between beginP (including) and endP (excluding). */
+ U32String(const value_type *beginP, const value_type *endP);
+
+ /** Construct a copy of the given string. */
+ U32String(const U32String &str);
+
+ ~U32String();
+
+ U32String &operator=(const U32String &str);
+ U32String &operator+=(const U32String &str);
+ U32String &operator+=(value_type c);
+
+ /**
+ * Equivalence comparison operator.
+ * @see equals
+ */
+ bool operator==(const U32String &x) const { return equals(x); }
+
+ /**
+ * Compares whether two U32String are the same based on memory comparison.
+ * This does *not* do comparison based on canonical equivalence.
+ */
+ bool equals(const U32String &x) const;
+
+ bool contains(value_type x) const;
+
+ inline const value_type *c_str() const { return _str; }
+ inline uint32 size() const { return _size; }
+
+ inline bool empty() const { return (_size == 0); }
+
+ value_type operator[](int idx) const {
+ assert(_str && idx >= 0 && idx < (int)_size);
+ return _str[idx];
+ }
+
+ /**
+ * Removes the value at position p from the string.
+ * Using this on decomposed characters will not remove the whole
+ * character!
+ */
+ void deleteChar(uint32 p);
+
+ /** Clears the string, making it empty. */
+ void clear();
+
+ /**
+ * Convert all characters in the string to lowercase.
+ *
+ * Be aware that this only affects the case of ASCII characters. All
+ * other characters will not be touched at all.
+ */
+ void toLowercase();
+
+ /**
+ * Convert all characters in the string to uppercase.
+ *
+ * Be aware that this only affects the case of ASCII characters. All
+ * other characters will not be touched at all.
+ */
+ void toUppercase();
+
+ uint32 find(const U32String &str, uint32 pos = 0) const;
+
+ typedef value_type * iterator;
+ typedef const value_type * const_iterator;
+
+ iterator begin() {
+ // Since the user could potentially
+ // change the string via the returned
+ // iterator we have to assure we are
+ // pointing to a unique storage.
+ makeUnique();
+
+ return _str;
+ }
+
+ iterator end() {
+ return begin() + size();
+ }
+
+ const_iterator begin() const {
+ return _str;
+ }
+
+ const_iterator end() const {
+ return begin() + size();
+ }
+private:
+ void makeUnique();
+ void ensureCapacity(uint32 new_size, bool keep_old);
+ void incRefCount() const;
+ void decRefCount(int *oldRefCount);
+ void initWithCStr(const value_type *str, uint32 len);
+};
+
+} // End of namespace Common
+
+#endif
diff --git a/common/util.cpp b/common/util.cpp
index 3d40fffff5..8e0a2fd61f 100644
--- a/common/util.cpp
+++ b/common/util.cpp
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#define FORBIDDEN_SYMBOL_EXCEPTION_isalnum
diff --git a/common/util.h b/common/util.h
index 392ced1ffe..1c0e45662e 100644
--- a/common/util.h
+++ b/common/util.h
@@ -17,6 +17,7 @@
* 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.
+ *
*/
#ifndef COMMON_UTIL_H
diff --git a/common/winexe.cpp b/common/winexe.cpp
index 877ab6baa1..fc389f6ea6 100644
--- a/common/winexe.cpp
+++ b/common/winexe.cpp
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/winexe.h b/common/winexe.h
index bec156d2e7..cfadbf882d 100644
--- a/common/winexe.h
+++ b/common/winexe.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/winexe_ne.cpp b/common/winexe_ne.cpp
index c3698d5fce..ccf1fd17e5 100644
--- a/common/winexe_ne.cpp
+++ b/common/winexe_ne.cpp
@@ -8,12 +8,12 @@
* 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.
@@ -187,7 +187,7 @@ uint32 NEResources::getResourceTableOffset() {
static const char *s_resTypeNames[] = {
"", "cursor", "bitmap", "icon", "menu", "dialog", "string",
"font_dir", "font", "accelerator", "rc_data", "msg_table",
- "group_cursor", "group_icon", "", "", "version", "dlg_include",
+ "group_cursor", "", "group_icon", "", "version", "dlg_include",
"", "plug_play", "vxd", "ani_cursor", "ani_icon", "html",
"manifest"
};
diff --git a/common/winexe_ne.h b/common/winexe_ne.h
index f00941412f..d6698e6cf0 100644
--- a/common/winexe_ne.h
+++ b/common/winexe_ne.h
@@ -8,12 +8,12 @@
* 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.
@@ -46,7 +46,7 @@ enum NEResourceType {
kNERCData = 0x0A,
kNEMessageTable = 0x0B,
kNEGroupCursor = 0x0C,
- kNEGroupIcon = 0x0D,
+ kNEGroupIcon = 0x0E,
kNEVersion = 0x10,
kNEDlgInclude = 0x11,
kNEPlugPlay = 0x13,
diff --git a/common/winexe_pe.cpp b/common/winexe_pe.cpp
index b3c45ffe73..969ea5d923 100644
--- a/common/winexe_pe.cpp
+++ b/common/winexe_pe.cpp
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/winexe_pe.h b/common/winexe_pe.h
index b38f2f78f5..b163bd15d2 100644
--- a/common/winexe_pe.h
+++ b/common/winexe_pe.h
@@ -8,12 +8,12 @@
* 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.
diff --git a/common/zlib.cpp b/common/zlib.cpp
index 920338e57e..c22ea1e660 100644
--- a/common/zlib.cpp
+++ b/common/zlib.cpp
@@ -8,12 +8,12 @@
* 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.
@@ -27,6 +27,8 @@
#include "common/ptr.h"
#include "common/util.h"
#include "common/stream.h"
+#include "common/debug.h"
+#include "common/textconsole.h"
#if defined(USE_ZLIB)
#ifdef __SYMBIAN32__
@@ -139,6 +141,10 @@ bool inflateZlibInstallShield(byte *dst, uint dstLen, const byte *src, uint srcL
return true;
}
+#ifndef RELEASE_BUILD
+static bool _shownBackwardSeekingWarning = false;
+#endif
+
/**
* A simple wrapper class which can be used to wrap around an arbitrary
* other SeekableReadStream and will then provide on-the-fly decompression support.
@@ -241,13 +247,17 @@ public:
}
bool seek(int32 offset, int whence = SEEK_SET) {
int32 newPos = 0;
- assert(whence != SEEK_END); // SEEK_END not supported
switch (whence) {
case SEEK_SET:
newPos = offset;
break;
case SEEK_CUR:
newPos = _pos + offset;
+ break;
+ case SEEK_END:
+ // NOTE: This can be an expensive operation (see below).
+ newPos = size() + offset;
+ break;
}
assert(newPos >= 0);
@@ -256,9 +266,17 @@ public:
// To search backward, we have to restart the whole decompression
// from the start of the file. A rather wasteful operation, best
// to avoid it. :/
-#if DEBUG
- warning("Backward seeking in GZipReadStream detected");
+
+#ifndef RELEASE_BUILD
+ if (!_shownBackwardSeekingWarning) {
+ // We only throw this warning once per stream, to avoid
+ // getting the console swarmed with warnings when consecutive
+ // seeks are made.
+ debug(1, "Backward seeking in GZipReadStream detected");
+ _shownBackwardSeekingWarning = true;
+ }
#endif
+
_pos = 0;
_wrapped->seek(0, SEEK_SET);
_zlibErr = inflateReset(&_stream);
diff --git a/common/zlib.h b/common/zlib.h
index d940f3f3a1..e2936a334a 100644
--- a/common/zlib.h
+++ b/common/zlib.h
@@ -8,12 +8,12 @@
* 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.