[Scummvm-cvs-logs] SF.net SVN: scummvm: [24881] scummvm/trunk
sev at users.sourceforge.net
sev at users.sourceforge.net
Tue Dec 19 04:52:06 CET 2006
Revision: 24881
http://scummvm.svn.sourceforge.net/scummvm/?rev=24881&view=rev
Author: sev
Date: 2006-12-18 19:52:04 -0800 (Mon, 18 Dec 2006)
Log Message:
-----------
Got rid of ARRAYSIZE in advanceDetector calls
Modified Paths:
--------------
scummvm/trunk/common/advancedDetector.cpp
scummvm/trunk/common/advancedDetector.h
scummvm/trunk/engines/agi/detection.cpp
scummvm/trunk/engines/agos/agosgame.cpp
scummvm/trunk/engines/agos/game.cpp
scummvm/trunk/engines/cine/detection.cpp
scummvm/trunk/engines/kyra/plugin.cpp
scummvm/trunk/engines/saga/game.cpp
scummvm/trunk/engines/saga/sagagame.cpp
Modified: scummvm/trunk/common/advancedDetector.cpp
===================================================================
--- scummvm/trunk/common/advancedDetector.cpp 2006-12-19 01:57:30 UTC (rev 24880)
+++ scummvm/trunk/common/advancedDetector.cpp 2006-12-19 03:52:04 UTC (rev 24881)
@@ -128,7 +128,6 @@
const FSList &fslist,
const byte *descs,
const int descItemSize,
- const int descItemCount,
const int md5Bytes,
const PlainGameDescriptor *list
) {
@@ -136,13 +135,16 @@
Common::AdvancedDetector AdvDetector;
Common::ADList matches;
Common::ADGameDescList descList;
+ const byte *descPtr;
- for (int i = 0; i < descItemCount; i++)
- descList.push_back((const ADGameDescription *)(descs + i * descItemSize));
+ for (descPtr = descs; *descPtr != NULL; descPtr += descItemSize)
+ descList.push_back((const ADGameDescription *)descPtr);
AdvDetector.registerGameDescriptions(descList);
AdvDetector.setFileMD5Bytes(md5Bytes);
+ debug(3, "%s: cnt: %d", ((const ADGameDescription *)descs)->name, descList.size());
+
matches = AdvDetector.detectGame(&fslist, Common::UNK_LANG, Common::kPlatformUnknown);
for (uint i = 0; i < matches.size(); i++)
@@ -154,7 +156,6 @@
int real_ADVANCED_DETECTOR_DETECT_INIT_GAME(
const byte *descs,
const int descItemSize,
- const int descItemCount,
const int md5Bytes,
const PlainGameDescriptor *list
) {
@@ -164,6 +165,7 @@
Common::AdvancedDetector AdvDetector;
Common::ADList matches;
Common::ADGameDescList descList;
+ const byte *descPtr;
Common::Language language = Common::UNK_LANG;
Common::Platform platform = Common::kPlatformUnknown;
@@ -175,8 +177,8 @@
Common::String gameid = ConfMan.get("gameid");
- for (int i = 0; i < descItemCount; i++)
- descList.push_back((const ADGameDescription *)(descs + i * descItemSize));
+ for (descPtr = descs; *descPtr != NULL; descPtr += descItemSize)
+ descList.push_back((const ADGameDescription *)descPtr);
AdvDetector.registerGameDescriptions(descList);
AdvDetector.setFileMD5Bytes(md5Bytes);
@@ -190,8 +192,8 @@
}
}
- if (gameNumber >= descItemCount || gameNumber == -1) {
- error("TODO invalid gameNumber %d (max. expected value: %d)", gameNumber, descItemCount );
+ if (gameNumber >= (int)descList.size() || gameNumber == -1) {
+ error("TODO invalid gameNumber %d (max. expected value: %d)", gameNumber, descList.size());
}
debug(2, "Running %s", toDetectedGame(*(const ADGameDescription *)(descs + gameNumber * descItemSize), list).description.c_str());
@@ -312,8 +314,10 @@
debug(3, "Matched file: %s", tstr.c_str());
}
if (!fileMissing) {
- debug(2, "Found game: %s", getDescription(i).c_str());
+ debug(2, "Found game: %s (%d)", getDescription(i).c_str(), i);
matched[matchedCount++] = i;
+ } else {
+ debug(5, "Skipping game: %s (%d)", getDescription(i).c_str(), i);
}
}
Modified: scummvm/trunk/common/advancedDetector.h
===================================================================
--- scummvm/trunk/common/advancedDetector.h 2006-12-19 01:57:30 UTC (rev 24880)
+++ scummvm/trunk/common/advancedDetector.h 2006-12-19 03:52:04 UTC (rev 24881)
@@ -78,7 +78,6 @@
const FSList &fslist,
const byte *descs,
const int descItemSize,
- const int descItemCount,
const int md5Bytes,
const PlainGameDescriptor *list
);
@@ -92,7 +91,6 @@
int real_ADVANCED_DETECTOR_DETECT_INIT_GAME(
const byte *descs,
const int descItemSize,
- const int descItemCount,
const int md5Bytes,
const PlainGameDescriptor *list
);
Modified: scummvm/trunk/engines/agi/detection.cpp
===================================================================
--- scummvm/trunk/engines/agi/detection.cpp 2006-12-19 01:57:30 UTC (rev 24880)
+++ scummvm/trunk/engines/agi/detection.cpp 2006-12-19 03:52:04 UTC (rev 24881)
@@ -174,14 +174,13 @@
0x2440,
},
-
+ { { NULL, NULL, 0, NULL, Common::UNK_LANG, Common::kPlatformUnknown }, 0, 0, 0 }
};
bool AgiEngine::initGame() {
int i = Common::real_ADVANCED_DETECTOR_DETECT_INIT_GAME(
(const byte *)gameDescriptions,
sizeof(AGIGameDescription),
- ARRAYSIZE(gameDescriptions),
FILE_MD5_BYTES,
agiGames
);
@@ -194,7 +193,6 @@
fslist,
(const byte *)gameDescriptions,
sizeof(AGIGameDescription),
- ARRAYSIZE(gameDescriptions),
FILE_MD5_BYTES,
agiGames
);
Modified: scummvm/trunk/engines/agos/agosgame.cpp
===================================================================
--- scummvm/trunk/engines/agos/agosgame.cpp 2006-12-19 01:57:30 UTC (rev 24880)
+++ scummvm/trunk/engines/agos/agosgame.cpp 2006-12-19 03:52:04 UTC (rev 24881)
@@ -1850,4 +1850,5 @@
GID_SWAMPY,
GF_OLD_BUNDLE | GF_TALKIE,
},
+ { { NULL, NULL, 0, NULL, Common::UNK_LANG, Common::kPlatformUnknown }, 0, 0, 0 }
};
Modified: scummvm/trunk/engines/agos/game.cpp
===================================================================
--- scummvm/trunk/engines/agos/game.cpp 2006-12-19 01:57:30 UTC (rev 24880)
+++ scummvm/trunk/engines/agos/game.cpp 2006-12-19 03:52:04 UTC (rev 24881)
@@ -86,7 +86,6 @@
int i = Common::real_ADVANCED_DETECTOR_DETECT_INIT_GAME(
(const byte *)gameDescriptions,
sizeof(AGOSGameDescription),
- ARRAYSIZE(gameDescriptions),
FILE_MD5_BYTES,
simonGames
);
@@ -99,7 +98,6 @@
fslist,
(const byte *)gameDescriptions,
sizeof(AGOSGameDescription),
- ARRAYSIZE(gameDescriptions),
FILE_MD5_BYTES,
simonGames
);
Modified: scummvm/trunk/engines/cine/detection.cpp
===================================================================
--- scummvm/trunk/engines/cine/detection.cpp 2006-12-19 01:57:30 UTC (rev 24880)
+++ scummvm/trunk/engines/cine/detection.cpp 2006-12-19 03:52:04 UTC (rev 24881)
@@ -569,13 +569,13 @@
0,
},
+ { { NULL, NULL, 0, NULL, Common::UNK_LANG, Common::kPlatformUnknown }, 0, 0 }
};
bool CineEngine::initGame() {
int i = Common::real_ADVANCED_DETECTOR_DETECT_INIT_GAME(
(const byte *)gameDescriptions,
sizeof(CINEGameDescription),
- ARRAYSIZE(gameDescriptions),
FILE_MD5_BYTES,
cineGames
);
@@ -588,7 +588,6 @@
fslist,
(const byte *)gameDescriptions,
sizeof(CINEGameDescription),
- ARRAYSIZE(gameDescriptions),
FILE_MD5_BYTES,
cineGames
);
Modified: scummvm/trunk/engines/kyra/plugin.cpp
===================================================================
--- scummvm/trunk/engines/kyra/plugin.cpp 2006-12-19 01:57:30 UTC (rev 24880)
+++ scummvm/trunk/engines/kyra/plugin.cpp 2006-12-19 03:52:04 UTC (rev 24881)
@@ -133,13 +133,14 @@
{ { "The Legend of Kyrandia: The Hand of Fate", 0, ARRAYSIZE(kyra2UnknownUnknown1), kyra2UnknownUnknown1, UNK_LANG, kPlatformPC }, "kyra2", KYRA2_UNK_FLAGS }, // check this! (cd version?)
- { { "The Legend of Kyrandia: Malcolm's Revenge", 0, ARRAYSIZE(kyra3CD1), kyra3CD1, UNK_LANG, kPlatformPC }, "kyra3", KYRA3_CD_FLAGS }
+ { { "The Legend of Kyrandia: Malcolm's Revenge", 0, ARRAYSIZE(kyra3CD1), kyra3CD1, UNK_LANG, kPlatformPC }, "kyra3", KYRA3_CD_FLAGS },
+ { { NULL, NULL, 0, NULL, UNK_LANG, kPlatformUnknown }, NULL, KYRA2_UNK_FLAGS }
};
ADGameDescList getADDescList() {
ADGameDescList gameDesc;
- for (int i = 0; i < ARRAYSIZE(adGameDescs); ++i) {
+ for (int i = 0; i < ARRAYSIZE(adGameDescs) - 1; ++i) {
gameDesc.push_back(&adGameDescs[i].desc);
}
Modified: scummvm/trunk/engines/saga/game.cpp
===================================================================
--- scummvm/trunk/engines/saga/game.cpp 2006-12-19 01:57:30 UTC (rev 24880)
+++ scummvm/trunk/engines/saga/game.cpp 2006-12-19 03:52:04 UTC (rev 24881)
@@ -75,7 +75,6 @@
int i = Common::real_ADVANCED_DETECTOR_DETECT_INIT_GAME(
(const byte *)gameDescriptions,
sizeof(SAGAGameDescription),
- ARRAYSIZE(gameDescriptions),
FILE_MD5_BYTES,
saga_games
);
@@ -88,7 +87,6 @@
fslist,
(const byte *)gameDescriptions,
sizeof(SAGAGameDescription),
- ARRAYSIZE(gameDescriptions),
FILE_MD5_BYTES,
saga_games
);
Modified: scummvm/trunk/engines/saga/sagagame.cpp
===================================================================
--- scummvm/trunk/engines/saga/sagagame.cpp 2006-12-19 01:57:30 UTC (rev 24880)
+++ scummvm/trunk/engines/saga/sagagame.cpp 2006-12-19 03:52:04 UTC (rev 24881)
@@ -1464,4 +1464,5 @@
0,
NULL,
},
+ { { NULL, NULL, 0, NULL, Common::UNK_LANG, Common::kPlatformUnknown }, 0, 0, 0, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL }
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list