From 69b1485a22dc2b8a2cfe0bd10edcbaad0da0cf6e Mon Sep 17 00:00:00 2001 From: strangerke Date: Thu, 12 May 2011 01:13:57 +0200 Subject: GIT: Clean up: Suppress SVN tags, now useless --- engines/scumm/detection.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'engines/scumm/detection.cpp') diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index 51b46b033c..6d2f395b2f 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ // FIXME: Avoid using printf -- cgit v1.2.3 From f05de5228f9484a04da75e8b7c10bb0189e1be6e Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 11 May 2011 14:05:56 +0200 Subject: SCUMM: Print SCUMM & HE version when starting a game in deug mode --- engines/scumm/detection.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/scumm/detection.cpp') diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index 6d2f395b2f..95f76dbf51 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -1036,6 +1036,7 @@ Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) co // Simply use the first match DetectorResult res(*(results.begin())); debug(1, "Using gameid %s, variant %s, extra %s", res.game.gameid, res.game.variant, res.extra); + debug(1, " SCUMM version %d, HE version %d", res.game.version, res.game.heversion); // Print the MD5 of the game; either verbose using printf, in case of an // unknown MD5, or with a medium debug level in case of a known MD5 (for -- cgit v1.2.3 From b37463fe5921420a9081aa6c5cf7588d52b41e78 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 11 May 2011 16:03:50 +0200 Subject: SCUMM: Move class ResourceManager to its own header --- engines/scumm/detection.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/scumm/detection.cpp') diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index 95f76dbf51..ad1cb3da89 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -40,6 +40,7 @@ #include "scumm/scumm_v8.h" #include "scumm/file.h" #include "scumm/file_nes.h" +#include "scumm/resource.h" #include "engines/metaengine.h" -- cgit v1.2.3 From 45e65d7ea04b10cf7bb5282bd66b8df609700a63 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 11 May 2011 16:23:26 +0200 Subject: SCUMM: Refactor how resource (types) are srepresented Previously, we had a couple of arrays of size N (where N = number of resource types), one for each attribute of a resource type (such as as the number of resources of that type. Now, we have one array of size N, whose elements are a record aggregating all the attributes of each resource type. --- engines/scumm/detection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/scumm/detection.cpp') diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index ad1cb3da89..6440228d78 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -68,7 +68,7 @@ static const MD5Table *findInMD5Table(const char *md5) { } Common::String ScummEngine::generateFilename(const int room) const { - const int diskNumber = (room > 0) ? _res->roomno[rtRoom][room] : 0; + const int diskNumber = (room > 0) ? _res->_types[rtRoom].roomno[room] : 0; char buf[128]; if (_game.version == 4) { @@ -110,7 +110,7 @@ Common::String ScummEngine_v60he::generateFilename(const int room) const { if (room < 0) { id = '0' - room; } else { - const int diskNumber = (room > 0) ? _res->roomno[rtRoom][room] : 0; + const int diskNumber = (room > 0) ? _res->_types[rtRoom].roomno[room] : 0; id = diskNumber + '0'; } -- cgit v1.2.3 From c02420df43bec4ec523c18d8e6fdb381af29c1b5 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 13 May 2011 11:45:42 +0200 Subject: SCUMM: Add a Resource class, refactor res code around it --- engines/scumm/detection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/scumm/detection.cpp') diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index 6440228d78..38c65b3049 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -68,7 +68,7 @@ static const MD5Table *findInMD5Table(const char *md5) { } Common::String ScummEngine::generateFilename(const int room) const { - const int diskNumber = (room > 0) ? _res->_types[rtRoom].roomno[room] : 0; + const int diskNumber = (room > 0) ? _res->_types[rtRoom]._resources[room]._roomno : 0; char buf[128]; if (_game.version == 4) { @@ -110,7 +110,7 @@ Common::String ScummEngine_v60he::generateFilename(const int room) const { if (room < 0) { id = '0' - room; } else { - const int diskNumber = (room > 0) ? _res->_types[rtRoom].roomno[room] : 0; + const int diskNumber = (room > 0) ? _res->_types[rtRoom]._resources[room]._roomno : 0; id = diskNumber + '0'; } -- cgit v1.2.3 From 9ec64a66fe2f20eb1be0811b5f733332efff1b93 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 13 May 2011 14:48:01 +0200 Subject: SCUMM: Turned ResTypeData into a Common::Array, subsuming its _resource member --- engines/scumm/detection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/scumm/detection.cpp') diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index 38c65b3049..ec85f52ace 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -68,7 +68,7 @@ static const MD5Table *findInMD5Table(const char *md5) { } Common::String ScummEngine::generateFilename(const int room) const { - const int diskNumber = (room > 0) ? _res->_types[rtRoom]._resources[room]._roomno : 0; + const int diskNumber = (room > 0) ? _res->_types[rtRoom][room]._roomno : 0; char buf[128]; if (_game.version == 4) { @@ -110,7 +110,7 @@ Common::String ScummEngine_v60he::generateFilename(const int room) const { if (room < 0) { id = '0' - room; } else { - const int diskNumber = (room > 0) ? _res->_types[rtRoom]._resources[room]._roomno : 0; + const int diskNumber = (room > 0) ? _res->_types[rtRoom][room]._roomno : 0; id = diskNumber + '0'; } -- cgit v1.2.3 From 3c59e37035742ce843f3e12039b5169e4bdd0168 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sun, 15 May 2011 15:50:09 +0100 Subject: ENGINES: Unify engine names This unifies the engine names in MetaEngine::getName() and the credits. In particular drop "Engine" or "engine" from the names when it was present and use expanded names in credits when the MetaEngine uses it (e.g. "Beneath a Steel Sky" instead of "BASS"). --- engines/scumm/detection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/scumm/detection.cpp') diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index ec85f52ace..bba26961c7 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -1156,7 +1156,7 @@ Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) co } const char *ScummMetaEngine::getName() const { - return "SCUMM Engine [" + return "SCUMM [" #if defined(ENABLE_SCUMM_7_8) && defined(ENABLE_HE) "all games" -- cgit v1.2.3 From 0aa6aca4201df105276455d550d00495fdaa067b Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 25 May 2011 10:46:58 +0200 Subject: SCUMM: Switch some code to use String::format --- engines/scumm/detection.cpp | 63 ++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 32 deletions(-) (limited to 'engines/scumm/detection.cpp') diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index bba26961c7..aecd13db5a 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -69,26 +69,26 @@ static const MD5Table *findInMD5Table(const char *md5) { Common::String ScummEngine::generateFilename(const int room) const { const int diskNumber = (room > 0) ? _res->_types[rtRoom][room]._roomno : 0; - char buf[128]; + Common::String result; if (_game.version == 4) { if (room == 0 || room >= 900) { - snprintf(buf, sizeof(buf), "%03d.lfl", room); + result = Common::String::format("%03d.lfl", room); } else { - snprintf(buf, sizeof(buf), "disk%02d.lec", diskNumber); + result = Common::String::format("disk%02d.lec", diskNumber); } } else { switch (_filenamePattern.genMethod) { case kGenDiskNum: - snprintf(buf, sizeof(buf), _filenamePattern.pattern, diskNumber); + result = Common::String::format(_filenamePattern.pattern, diskNumber); break; case kGenRoomNum: - snprintf(buf, sizeof(buf), _filenamePattern.pattern, room); + result = Common::String::format(_filenamePattern.pattern, room); break; case kGenUnchanged: - strncpy(buf, _filenamePattern.pattern, sizeof(buf)); + result = _filenamePattern.pattern; break; default: @@ -96,11 +96,11 @@ Common::String ScummEngine::generateFilename(const int room) const { } } - return buf; + return result; } Common::String ScummEngine_v60he::generateFilename(const int room) const { - char buf[128]; + Common::String result; char id = 0; switch (_filenamePattern.genMethod) { @@ -115,16 +115,16 @@ Common::String ScummEngine_v60he::generateFilename(const int room) const { } if (_filenamePattern.genMethod == kGenHEPC) { - snprintf(buf, sizeof(buf), "%s.he%c", _filenamePattern.pattern, id); + result = Common::String::format("%s.he%c", _filenamePattern.pattern, id); } else { if (id == '3') { // special case for cursors // For mac they're stored in game binary - strncpy(buf, _filenamePattern.pattern, sizeof(buf)); + result = _filenamePattern.pattern; } else { if (_filenamePattern.genMethod == kGenHEMac) - snprintf(buf, sizeof(buf), "%s (%c)", _filenamePattern.pattern, id); + result = Common::String::format("%s (%c)", _filenamePattern.pattern, id); else - snprintf(buf, sizeof(buf), "%s %c", _filenamePattern.pattern, id); + result = Common::String::format("%s %c", _filenamePattern.pattern, id); } } @@ -135,11 +135,11 @@ Common::String ScummEngine_v60he::generateFilename(const int room) const { return ScummEngine::generateFilename(room); } - return buf; + return result; } Common::String ScummEngine_v70he::generateFilename(const int room) const { - char buf[128]; + Common::String result; char id = 0; switch (_filenamePattern.genMethod) { @@ -156,19 +156,19 @@ Common::String ScummEngine_v70he::generateFilename(const int room) const { id = 'b'; // Special cases for Blue's games, which share common (b) files if (_game.id == GID_BIRTHDAY && !(_game.features & GF_DEMO)) - strcpy(buf, "Blue'sBirthday.(b)"); + result = "Blue'sBirthday.(b)"; else if (_game.id == GID_TREASUREHUNT) - strcpy(buf, "Blue'sTreasureHunt.(b)"); + result = "Blue'sTreasureHunt.(b)"; else - snprintf(buf, sizeof(buf), "%s.(b)", _filenamePattern.pattern); + result = Common::String::format("%s.(b)", _filenamePattern.pattern); break; case 1: id = 'a'; - snprintf(buf, sizeof(buf), "%s.(a)", _filenamePattern.pattern); + result = Common::String::format("%s.(a)", _filenamePattern.pattern); break; default: id = '0'; - snprintf(buf, sizeof(buf), "%s.he0", _filenamePattern.pattern); + result = Common::String::format("%s.he0", _filenamePattern.pattern); } } else if (room < 0) { id = '0' - room; @@ -179,16 +179,16 @@ Common::String ScummEngine_v70he::generateFilename(const int room) const { if (_filenamePattern.genMethod == kGenHEPC) { // For HE >= 98, we already called snprintf above. if (_game.heversion < 98 || room < 0) - snprintf(buf, sizeof(buf), "%s.he%c", _filenamePattern.pattern, id); + result = Common::String::format("%s.he%c", _filenamePattern.pattern, id); } else { if (id == '3') { // special case for cursors // For mac they're stored in game binary - strncpy(buf, _filenamePattern.pattern, sizeof(buf)); + result = _filenamePattern.pattern; } else { if (_filenamePattern.genMethod == kGenHEMac) - snprintf(buf, sizeof(buf), "%s (%c)", _filenamePattern.pattern, id); + result = Common::String::format("%s (%c)", _filenamePattern.pattern, id); else - snprintf(buf, sizeof(buf), "%s %c", _filenamePattern.pattern, id); + result = Common::String::format("%s %c", _filenamePattern.pattern, id); } } @@ -199,40 +199,39 @@ Common::String ScummEngine_v70he::generateFilename(const int room) const { return ScummEngine_v60he::generateFilename(room); } - return buf; + return result; } static Common::String generateFilenameForDetection(const char *pattern, FilenameGenMethod genMethod) { - char buf[128]; + Common::String result; switch (genMethod) { case kGenDiskNum: case kGenRoomNum: - snprintf(buf, sizeof(buf), pattern, 0); + result = Common::String::format(pattern, 0); break; case kGenHEPC: - snprintf(buf, sizeof(buf), "%s.he0", pattern); + result = Common::String::format("%s.he0", pattern); break; case kGenHEMac: - snprintf(buf, sizeof(buf), "%s (0)", pattern); + result = Common::String::format("%s (0)", pattern); break; case kGenHEMacNoParens: - snprintf(buf, sizeof(buf), "%s 0", pattern); + result = Common::String::format("%s 0", pattern); break; case kGenUnchanged: - strncpy(buf, pattern, sizeof(buf)); + result = pattern; break; default: error("generateFilenameForDetection: Unsupported genMethod"); } - buf[sizeof(buf) - 1] = 0; - return buf; + return result; } struct DetectorDesc { -- cgit v1.2.3