Stripped some more real_ prefixes from function names; also added a new FIXME comment to Kyra's setupGameFlags, and did some more cleanup
svn-id: r24899
This commit is contained in:
parent
dc30c2304c
commit
6eef02245c
3 changed files with 23 additions and 25 deletions
|
@ -33,7 +33,7 @@
|
|||
|
||||
namespace Common {
|
||||
|
||||
PluginError real_ADVANCED_DETECTOR_ENGINE_CREATE(
|
||||
PluginError ADVANCED_DETECTOR_ENGINE_CREATE(
|
||||
DetectedGameList (*detectFunc)(const FSList &fslist),
|
||||
const Common::ADObsoleteGameID *obsoleteList
|
||||
) {
|
||||
|
@ -72,7 +72,7 @@ PluginError real_ADVANCED_DETECTOR_ENGINE_CREATE(
|
|||
return kNoGameDataFoundError;
|
||||
}
|
||||
|
||||
GameDescriptor real_ADVANCED_DETECTOR_FIND_GAMEID(
|
||||
GameDescriptor ADVANCED_DETECTOR_FIND_GAMEID(
|
||||
const char *gameid,
|
||||
const PlainGameDescriptor *list,
|
||||
const Common::ADObsoleteGameID *obsoleteList
|
||||
|
@ -174,7 +174,7 @@ int ADVANCED_DETECTOR_DETECT_INIT_GAME(
|
|||
matches = ad.detectGame(0, md5Bytes, language, platform);
|
||||
|
||||
for (uint i = 0; i < matches.size(); i++) {
|
||||
if (toDetectedGame(*(const ADGameDescription *)(descs + matches[i] * descItemSize), list).gameid == gameid) {
|
||||
if (((const ADGameDescription *)(descs + matches[i] * descItemSize))->gameid == gameid) {
|
||||
gameNumber = matches[i];
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ private:
|
|||
|
||||
// FIXME/TODO: Rename this function to something more sensible.
|
||||
// Possibly move it inside class AdvancedDetector ?
|
||||
GameDescriptor real_ADVANCED_DETECTOR_FIND_GAMEID(
|
||||
GameDescriptor ADVANCED_DETECTOR_FIND_GAMEID(
|
||||
const char *gameid,
|
||||
const PlainGameDescriptor *list,
|
||||
const Common::ADObsoleteGameID *obsoleteList
|
||||
|
@ -121,7 +121,7 @@ int ADVANCED_DETECTOR_DETECT_INIT_GAME(
|
|||
|
||||
// FIXME/TODO: Rename this function to something more sensible.
|
||||
// Possibly move it inside class AdvancedDetector ?
|
||||
PluginError real_ADVANCED_DETECTOR_ENGINE_CREATE(
|
||||
PluginError ADVANCED_DETECTOR_ENGINE_CREATE(
|
||||
DetectedGameList (*detectFunc)(const FSList &fslist),
|
||||
const Common::ADObsoleteGameID *obsoleteList
|
||||
);
|
||||
|
@ -132,7 +132,7 @@ PluginError real_ADVANCED_DETECTOR_ENGINE_CREATE(
|
|||
return GameList(list); \
|
||||
} \
|
||||
GameDescriptor Engine_##engine##_findGameID(const char *gameid) { \
|
||||
return Common::real_ADVANCED_DETECTOR_FIND_GAMEID(gameid,list,obsoleteList); \
|
||||
return Common::ADVANCED_DETECTOR_FIND_GAMEID(gameid,list,obsoleteList); \
|
||||
} \
|
||||
DetectedGameList Engine_##engine##_detectGames(const FSList &fslist) { \
|
||||
return detectFunc(fslist); \
|
||||
|
@ -140,7 +140,7 @@ PluginError real_ADVANCED_DETECTOR_ENGINE_CREATE(
|
|||
PluginError Engine_##engine##_create(OSystem *syst, Engine **engine) { \
|
||||
assert(syst); \
|
||||
assert(engine); \
|
||||
PluginError err = real_ADVANCED_DETECTOR_ENGINE_CREATE(detectFunc, obsoleteList); \
|
||||
PluginError err = ADVANCED_DETECTOR_ENGINE_CREATE(detectFunc, obsoleteList); \
|
||||
if (err == kNoError) \
|
||||
*engine = new createFunction(syst); \
|
||||
return err; \
|
||||
|
|
|
@ -150,21 +150,6 @@ static const KYRAGameDescription adGameDescs[] = {
|
|||
{ { NULL, NULL, NULL, UNK_LANG, kPlatformUnknown }, KYRA2_UNK_FLAGS }
|
||||
};
|
||||
|
||||
static ADList detectKyraGames(const FSList &fslist) {
|
||||
Common::AdvancedDetector ad;
|
||||
Common::ADList matches;
|
||||
Common::ADGameDescList descList;
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(adGameDescs) - 1; ++i) {
|
||||
descList.push_back(&adGameDescs[i].desc);
|
||||
}
|
||||
|
||||
ad.registerGameDescriptions(descList);
|
||||
|
||||
matches = ad.detectGame(&fslist, kMD5FileSizeLimit, Common::UNK_LANG, Common::kPlatformUnknown);
|
||||
return matches;
|
||||
}
|
||||
|
||||
static bool setupGameFlags(const ADList &list, GameFlags &flags) {
|
||||
if (!list.size()) {
|
||||
// maybe add non md5 based detection again?
|
||||
|
@ -173,6 +158,8 @@ static bool setupGameFlags(const ADList &list, GameFlags &flags) {
|
|||
|
||||
int id = list[0];
|
||||
|
||||
// FIXME: Isn't the following check/loop obsolete (i.e. I was/am under the
|
||||
// impression that AdvancedDetector already performs this check).
|
||||
if (list.size() > 1) {
|
||||
int filesCount = 0;
|
||||
int curID = 0;
|
||||
|
@ -222,7 +209,7 @@ GameList Engine_KYRA_gameIDList() {
|
|||
}
|
||||
|
||||
GameDescriptor Engine_KYRA_findGameID(const char *gameid) {
|
||||
return Common::real_ADVANCED_DETECTOR_FIND_GAMEID(gameid, gameList, 0);
|
||||
return Common::ADVANCED_DETECTOR_FIND_GAMEID(gameid, gameList, 0);
|
||||
}
|
||||
|
||||
DetectedGameList Engine_KYRA_detectGames(const FSList &fslist) {
|
||||
|
@ -246,8 +233,19 @@ PluginError Engine_KYRA_create(OSystem *syst, Engine **engine) {
|
|||
}
|
||||
|
||||
GameFlags flags;
|
||||
ADList games = detectKyraGames(fslist);
|
||||
if (!setupGameFlags(games, flags)) {
|
||||
Common::AdvancedDetector ad;
|
||||
Common::ADList matches;
|
||||
Common::ADGameDescList descList;
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(adGameDescs) - 1; ++i) {
|
||||
descList.push_back(&adGameDescs[i].desc);
|
||||
}
|
||||
|
||||
ad.registerGameDescriptions(descList);
|
||||
|
||||
matches = ad.detectGame(&fslist, kMD5FileSizeLimit, Common::UNK_LANG, Common::kPlatformUnknown);
|
||||
|
||||
if (!setupGameFlags(matches, flags)) {
|
||||
return kNoGameDataFoundError;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue