aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/archive.cpp29
-rw-r--r--common/dcl.cpp2
-rw-r--r--common/fs.h7
-rw-r--r--common/gui_options.cpp22
-rw-r--r--common/gui_options.h74
-rw-r--r--common/rendermode.cpp30
-rw-r--r--common/rendermode.h5
-rw-r--r--common/str.cpp7
-rw-r--r--common/str.h7
9 files changed, 110 insertions, 73 deletions
diff --git a/common/archive.cpp b/common/archive.cpp
index 36d420561f..5a339900b6 100644
--- a/common/archive.cpp
+++ b/common/archive.cpp
@@ -48,7 +48,7 @@ int Archive::listMatchingMembers(ArchiveMemberList &list, const String &pattern)
int matches = 0;
ArchiveMemberList::const_iterator it = allNames.begin();
- for ( ; it != allNames.end(); ++it) {
+ for (; it != allNames.end(); ++it) {
// TODO: We match case-insenstivie for now, our API does not define whether that's ok or not though...
// For our use case case-insensitive is probably what we want to have though.
if ((*it)->getName().matchString(pattern, true, true)) {
@@ -64,7 +64,7 @@ int Archive::listMatchingMembers(ArchiveMemberList &list, const String &pattern)
SearchSet::ArchiveNodeList::iterator SearchSet::find(const String &name) {
ArchiveNodeList::iterator it = _list.begin();
- for ( ; it != _list.end(); ++it) {
+ for (; it != _list.end(); ++it) {
if (it->_name == name)
break;
}
@@ -73,7 +73,7 @@ SearchSet::ArchiveNodeList::iterator SearchSet::find(const String &name) {
SearchSet::ArchiveNodeList::const_iterator SearchSet::find(const String &name) const {
ArchiveNodeList::const_iterator it = _list.begin();
- for ( ; it != _list.end(); ++it) {
+ for (; it != _list.end(); ++it) {
if (it->_name == name)
break;
}
@@ -81,13 +81,13 @@ SearchSet::ArchiveNodeList::const_iterator SearchSet::find(const String &name) c
}
/*
- Keep the nodes sorted according to descending priorities.
- In case two or node nodes have the same priority, insertion
- order prevails.
+ Keep the nodes sorted according to descending priorities.
+ In case two or node nodes have the same priority, insertion
+ order prevails.
*/
void SearchSet::insert(const Node &node) {
ArchiveNodeList::iterator it = _list.begin();
- for ( ; it != _list.end(); ++it) {
+ for (; it != _list.end(); ++it) {
if (it->_priority < node._priority)
break;
}
@@ -131,8 +131,7 @@ void SearchSet::addSubDirectoriesMatching(const FSNode &directory, String origPa
++sep;
if (sep != origPattern.end())
nextPattern = String(sep, origPattern.end());
- }
- else {
+ } else {
pattern = origPattern;
}
@@ -211,7 +210,7 @@ bool SearchSet::hasFile(const String &name) const {
return false;
ArchiveNodeList::const_iterator it = _list.begin();
- for ( ; it != _list.end(); ++it) {
+ for (; it != _list.end(); ++it) {
if (it->_arc->hasFile(name))
return true;
}
@@ -223,7 +222,7 @@ int SearchSet::listMatchingMembers(ArchiveMemberList &list, const String &patter
int matches = 0;
ArchiveNodeList::const_iterator it = _list.begin();
- for ( ; it != _list.end(); ++it)
+ for (; it != _list.end(); ++it)
matches += it->_arc->listMatchingMembers(list, pattern);
return matches;
@@ -233,7 +232,7 @@ int SearchSet::listMembers(ArchiveMemberList &list) const {
int matches = 0;
ArchiveNodeList::const_iterator it = _list.begin();
- for ( ; it != _list.end(); ++it)
+ for (; it != _list.end(); ++it)
matches += it->_arc->listMembers(list);
return matches;
@@ -244,7 +243,7 @@ const ArchiveMemberPtr SearchSet::getMember(const String &name) const {
return ArchiveMemberPtr();
ArchiveNodeList::const_iterator it = _list.begin();
- for ( ; it != _list.end(); ++it) {
+ for (; it != _list.end(); ++it) {
if (it->_arc->hasFile(name))
return it->_arc->getMember(name);
}
@@ -257,7 +256,7 @@ SeekableReadStream *SearchSet::createReadStreamForMember(const String &name) con
return 0;
ArchiveNodeList::const_iterator it = _list.begin();
- for ( ; it != _list.end(); ++it) {
+ for (; it != _list.end(); ++it) {
SeekableReadStream *stream = it->_arc->createReadStreamForMember(name);
if (stream)
return stream;
@@ -268,7 +267,7 @@ SeekableReadStream *SearchSet::createReadStreamForMember(const String &name) con
SearchManager::SearchManager() {
- clear(); // Force a reset
+ clear(); // Force a reset
}
void SearchManager::clear() {
diff --git a/common/dcl.cpp b/common/dcl.cpp
index 66dfb76b2a..75a533aa9d 100644
--- a/common/dcl.cpp
+++ b/common/dcl.cpp
@@ -470,7 +470,7 @@ bool decompressDCL(ReadStream *src, byte *dest, uint32 packedSize, uint32 unpack
// Read source into memory
src->read(sourceBufferPtr, packedSize);
- Common::MemoryReadStream *sourceStream = new MemoryReadStream(sourceBufferPtr, packedSize, DisposeAfterUse::NO);
+ Common::MemoryReadStream *sourceStream = new MemoryReadStream(sourceBufferPtr, packedSize, DisposeAfterUse::YES);
Common::MemoryWriteStream *targetStream = new MemoryWriteStream(dest, unpackedSize);
success = dcl.unpack(sourceStream, targetStream, unpackedSize, true);
diff --git a/common/fs.h b/common/fs.h
index b5b88ba8cb..f516bf7a9c 100644
--- a/common/fs.h
+++ b/common/fs.h
@@ -57,7 +57,14 @@ class FSList : public Array<FSNode> {};
*/
class FSNode : public ArchiveMember {
private:
+ friend class ::AbstractFSNode;
SharedPtr<AbstractFSNode> _realNode;
+ /**
+ * Construct a FSNode from a backend's AbstractFSNode implementation.
+ *
+ * @param realNode Pointer to a heap allocated instance. FSNode will take
+ * ownership of the pointer.
+ */
FSNode(AbstractFSNode *realNode);
public:
diff --git a/common/gui_options.cpp b/common/gui_options.cpp
index d79bf1b82f..473f78c795 100644
--- a/common/gui_options.cpp
+++ b/common/gui_options.cpp
@@ -53,15 +53,18 @@ const struct GameOpt {
{ GUIO_NOASPECT, "noAspect" },
- { GUIO_RENDERHERCGREEN, "hercGreen" },
- { GUIO_RENDERHERCAMBER, "hercAmber" },
- { GUIO_RENDERCGA, "cga" },
- { GUIO_RENDEREGA, "ega" },
- { GUIO_RENDERVGA, "vga" },
- { GUIO_RENDERAMIGA, "amiga" },
- { GUIO_RENDERFMTOWNS, "fmtowns" },
- { GUIO_RENDERPC9821, "pc9821" },
- { GUIO_RENDERPC9801, "pc9801" },
+ { GUIO_RENDERHERCGREEN, "hercGreen" },
+ { GUIO_RENDERHERCAMBER, "hercAmber" },
+ { GUIO_RENDERCGA, "cga" },
+ { GUIO_RENDEREGA, "ega" },
+ { GUIO_RENDERVGA, "vga" },
+ { GUIO_RENDERAMIGA, "amiga" },
+ { GUIO_RENDERFMTOWNS, "fmtowns" },
+ { GUIO_RENDERPC9821, "pc9821" },
+ { GUIO_RENDERPC9801, "pc9801" },
+ { GUIO_RENDERAPPLE2GS, "2gs" },
+ { GUIO_RENDERATARIST, "atari" },
+ { GUIO_RENDERMACINTOSH, "macintosh" },
{ GUIO_GAMEOPTIONS1, "gameOption1" },
{ GUIO_GAMEOPTIONS2, "gameOption2" },
@@ -70,6 +73,7 @@ const struct GameOpt {
{ GUIO_GAMEOPTIONS5, "gameOption5" },
{ GUIO_GAMEOPTIONS6, "gameOption6" },
{ GUIO_GAMEOPTIONS7, "gameOption7" },
+ { GUIO_GAMEOPTIONS8, "gameOption8" },
{ GUIO_NONE, 0 }
};
diff --git a/common/gui_options.h b/common/gui_options.h
index 78e9cc7199..aa15d906f5 100644
--- a/common/gui_options.h
+++ b/common/gui_options.h
@@ -23,47 +23,51 @@
#ifndef COMMON_GUI_OPTIONS_H
#define COMMON_GUI_OPTIONS_H
-#define GUIO_NONE "\000"
-#define GUIO_NOSUBTITLES "\001"
-#define GUIO_NOMUSIC "\002"
-#define GUIO_NOSPEECH "\003"
-#define GUIO_NOSFX "\004"
-#define GUIO_NOMIDI "\005"
-#define GUIO_NOLAUNCHLOAD "\006"
+#define GUIO_NONE "\000"
+#define GUIO_NOSUBTITLES "\001"
+#define GUIO_NOMUSIC "\002"
+#define GUIO_NOSPEECH "\003"
+#define GUIO_NOSFX "\004"
+#define GUIO_NOMIDI "\005"
+#define GUIO_NOLAUNCHLOAD "\006"
-#define GUIO_MIDIPCSPK "\007"
-#define GUIO_MIDICMS "\010"
-#define GUIO_MIDIPCJR "\011"
-#define GUIO_MIDIADLIB "\012"
-#define GUIO_MIDIC64 "\013"
-#define GUIO_MIDIAMIGA "\014"
-#define GUIO_MIDIAPPLEIIGS "\015"
-#define GUIO_MIDITOWNS "\016"
-#define GUIO_MIDIPC98 "\017"
-#define GUIO_MIDIMT32 "\020"
-#define GUIO_MIDIGM "\021"
+#define GUIO_MIDIPCSPK "\007"
+#define GUIO_MIDICMS "\010"
+#define GUIO_MIDIPCJR "\011"
+#define GUIO_MIDIADLIB "\012"
+#define GUIO_MIDIC64 "\013"
+#define GUIO_MIDIAMIGA "\014"
+#define GUIO_MIDIAPPLEIIGS "\015"
+#define GUIO_MIDITOWNS "\016"
+#define GUIO_MIDIPC98 "\017"
+#define GUIO_MIDIMT32 "\020"
+#define GUIO_MIDIGM "\021"
-#define GUIO_NOASPECT "\022"
+#define GUIO_NOASPECT "\022"
-#define GUIO_RENDERHERCGREEN "\030"
-#define GUIO_RENDERHERCAMBER "\031"
-#define GUIO_RENDERCGA "\032"
-#define GUIO_RENDEREGA "\033"
-#define GUIO_RENDERVGA "\034"
-#define GUIO_RENDERAMIGA "\035"
-#define GUIO_RENDERFMTOWNS "\036"
-#define GUIO_RENDERPC9821 "\037"
-#define GUIO_RENDERPC9801 "\040"
+#define GUIO_RENDERHERCGREEN "\030"
+#define GUIO_RENDERHERCAMBER "\031"
+#define GUIO_RENDERCGA "\032"
+#define GUIO_RENDEREGA "\033"
+#define GUIO_RENDERVGA "\034"
+#define GUIO_RENDERAMIGA "\035"
+#define GUIO_RENDERFMTOWNS "\036"
+#define GUIO_RENDERPC9821 "\037"
+#define GUIO_RENDERPC9801 "\040"
+#define GUIO_RENDERAPPLE2GS "\041"
+#define GUIO_RENDERATARIST "\042"
+#define GUIO_RENDERMACINTOSH "\043"
// Special GUIO flags for the AdvancedDetector's caching of game specific
// options.
-#define GUIO_GAMEOPTIONS1 "\041"
-#define GUIO_GAMEOPTIONS2 "\042"
-#define GUIO_GAMEOPTIONS3 "\043"
-#define GUIO_GAMEOPTIONS4 "\044"
-#define GUIO_GAMEOPTIONS5 "\045"
-#define GUIO_GAMEOPTIONS6 "\046"
-#define GUIO_GAMEOPTIONS7 "\047"
+#define GUIO_GAMEOPTIONS1 "\050"
+#define GUIO_GAMEOPTIONS2 "\051"
+#define GUIO_GAMEOPTIONS3 "\052"
+#define GUIO_GAMEOPTIONS4 "\053"
+#define GUIO_GAMEOPTIONS5 "\054"
+#define GUIO_GAMEOPTIONS6 "\055"
+#define GUIO_GAMEOPTIONS7 "\056"
+#define GUIO_GAMEOPTIONS8 "\057"
#define GUIO0() (GUIO_NONE)
#define GUIO1(a) (a)
diff --git a/common/rendermode.cpp b/common/rendermode.cpp
index 6115666399..e07cac4b4e 100644
--- a/common/rendermode.cpp
+++ b/common/rendermode.cpp
@@ -38,9 +38,12 @@ const RenderModeDescription g_renderModes[] = {
{ "ega", "EGA", kRenderEGA },
{ "vga", "VGA", kRenderVGA },
{ "amiga", "Amiga", kRenderAmiga },
- { "fmtowns", "FM-Towns", kRenderFMTowns },
- { "pc9821", "PC-9821 (256 Colors)", kRenderPC9821 },
- { "pc9801", "PC-9801 (16 Colors)", kRenderPC9801 },
+ { "fmtowns", "FM-TOWNS", kRenderFMTowns },
+ { "pc9821", _s("PC-9821 (256 Colors)"), kRenderPC9821 },
+ { "pc9801", _s("PC-9801 (16 Colors)"), kRenderPC9801 },
+ { "2gs", "Apple IIgs", kRenderApple2GS },
+ { "atari", "Atari ST", kRenderAtariST },
+ { "macintosh", "Macintosh", kRenderMacintosh },
{0, 0, kRenderDefault}
};
@@ -53,15 +56,18 @@ struct RenderGUIOMapping {
// could be used to indicate "any" mode when passed to renderMode2GUIO (if
// we wanted to merge allRenderModesGUIOs back into)
static const RenderGUIOMapping s_renderGUIOMapping[] = {
- { kRenderHercG, GUIO_RENDERHERCGREEN },
- { kRenderHercA, GUIO_RENDERHERCAMBER },
- { kRenderCGA, GUIO_RENDERCGA },
- { kRenderEGA, GUIO_RENDEREGA },
- { kRenderVGA, GUIO_RENDERVGA },
- { kRenderAmiga, GUIO_RENDERAMIGA },
- { kRenderFMTowns, GUIO_RENDERFMTOWNS },
- { kRenderPC9821, GUIO_RENDERPC9821 },
- { kRenderPC9801, GUIO_RENDERPC9801 }
+ { kRenderHercG, GUIO_RENDERHERCGREEN },
+ { kRenderHercA, GUIO_RENDERHERCAMBER },
+ { kRenderCGA, GUIO_RENDERCGA },
+ { kRenderEGA, GUIO_RENDEREGA },
+ { kRenderVGA, GUIO_RENDERVGA },
+ { kRenderAmiga, GUIO_RENDERAMIGA },
+ { kRenderFMTowns, GUIO_RENDERFMTOWNS },
+ { kRenderPC9821, GUIO_RENDERPC9821 },
+ { kRenderPC9801, GUIO_RENDERPC9801 },
+ { kRenderApple2GS, GUIO_RENDERAPPLE2GS },
+ { kRenderAtariST, GUIO_RENDERATARIST },
+ { kRenderMacintosh, GUIO_RENDERMACINTOSH }
};
DECLARE_TRANSLATION_ADDITIONAL_CONTEXT("Hercules Green", "lowres")
diff --git a/common/rendermode.h b/common/rendermode.h
index 59fa860c6c..ae1a7bc790 100644
--- a/common/rendermode.h
+++ b/common/rendermode.h
@@ -45,7 +45,10 @@ enum RenderMode {
kRenderAmiga = 6,
kRenderFMTowns = 7,
kRenderPC9821 = 8,
- kRenderPC9801 = 9
+ kRenderPC9801 = 9,
+ kRenderApple2GS = 10,
+ kRenderAtariST = 11,
+ kRenderMacintosh = 12
};
struct RenderModeDescription {
diff --git a/common/str.cpp b/common/str.cpp
index faf84d722f..ae3a965c70 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -751,6 +751,13 @@ bool matchString(const char *str, const char *pat, bool ignoreCase, bool pathMod
return true;
break;
+ case '#':
+ if (!isDigit(*str))
+ return false;
+ pat++;
+ str++;
+ break;
+
default:
if ((!ignoreCase && *pat != *str) ||
(ignoreCase && tolower(*pat) != tolower(*str))) {
diff --git a/common/str.h b/common/str.h
index dede87a005..1b41c481c7 100644
--- a/common/str.h
+++ b/common/str.h
@@ -158,6 +158,7 @@ public:
* Token meaning:
* "*": any character, any amount of times.
* "?": any character, only once.
+ * "#": any decimal digit, only once.
*
* Example strings/patterns:
* String: monkey.s01 Pattern: monkey.s?? => true
@@ -165,6 +166,8 @@ public:
* String: monkey.s99 Pattern: monkey.s?1 => false
* String: monkey.s101 Pattern: monkey.s* => true
* String: monkey.s99 Pattern: monkey.s*1 => false
+ * String: monkey.s01 Pattern: monkey.s## => true
+ * String: monkey.s01 Pattern: monkey.### => false
*
* @param pat Glob pattern.
* @param ignoreCase Whether to ignore the case when doing pattern match
@@ -180,6 +183,7 @@ public:
inline uint size() const { return _size; }
inline bool empty() const { return (_size == 0); }
+ char firstChar() const { return (_size > 0) ? _str[0] : 0; }
char lastChar() const { return (_size > 0) ? _str[_size - 1] : 0; }
char operator[](int idx) const {
@@ -329,6 +333,7 @@ String normalizePath(const String &path, const char sep);
* Token meaning:
* "*": any character, any amount of times.
* "?": any character, only once.
+ * "#": any decimal digit, only once.
*
* Example strings/patterns:
* String: monkey.s01 Pattern: monkey.s?? => true
@@ -336,6 +341,8 @@ String normalizePath(const String &path, const char sep);
* String: monkey.s99 Pattern: monkey.s?1 => false
* String: monkey.s101 Pattern: monkey.s* => true
* String: monkey.s99 Pattern: monkey.s*1 => false
+ * String: monkey.s01 Pattern: monkey.s## => true
+ * String: monkey.s01 Pattern: monkey.### => false
*
* @param str Text to be matched against the given pattern.
* @param pat Glob pattern.