aboutsummaryrefslogtreecommitdiff
path: root/engines/adl/detection.cpp
diff options
context:
space:
mode:
authorWalter van Niftrik2016-03-06 21:59:55 +0100
committerWalter van Niftrik2016-03-09 10:03:13 +0100
commit07d0997befe416c56e38b831031b81a30e63925a (patch)
tree2dfd398f068e616f562902e53e6887f2ad5ee65f /engines/adl/detection.cpp
parent58e7c539096f6b37c40dd0afa13c7ed500037be8 (diff)
downloadscummvm-rg350-07d0997befe416c56e38b831031b81a30e63925a.tar.gz
scummvm-rg350-07d0997befe416c56e38b831031b81a30e63925a.tar.bz2
scummvm-rg350-07d0997befe416c56e38b831031b81a30e63925a.zip
ADL: Clean up AdlMetaEngine
Diffstat (limited to 'engines/adl/detection.cpp')
-rw-r--r--engines/adl/detection.cpp35
1 files changed, 21 insertions, 14 deletions
diff --git a/engines/adl/detection.cpp b/engines/adl/detection.cpp
index e556e1258a..d96d94c66f 100644
--- a/engines/adl/detection.cpp
+++ b/engines/adl/detection.cpp
@@ -28,7 +28,7 @@
#include "engines/advancedDetector.h"
-#include "adl/adl.h"
+#include "adl/detection.h"
namespace Adl {
@@ -59,18 +59,12 @@ static const ADExtraGuiOptionsMap optionsList[] = {
AD_EXTRA_GUI_OPTIONS_TERMINATOR
};
-struct AdlGameDescription {
- ADGameDescription desc;
- GameType gameType;
-};
-
static const PlainGameDescriptor adlGames[] = {
{"hires1", "Hi-Res Adventure #1: Mystery House"},
{0, 0}
};
static const AdlGameDescription gameDescriptions[] = {
-
{ // MD5 by waltervn
{
"hires1", 0,
@@ -85,9 +79,9 @@ static const AdlGameDescription gameDescriptions[] = {
ADGF_NO_FLAGS,
GUIO2(GAMEOPTION_COLOR, GAMEOPTION_SCANLINES)
},
- kGameTypeHires1
+ GAME_TYPE_HIRES1
},
- {AD_TABLE_END_MARKER, kGameTypeNone}
+ { AD_TABLE_END_MARKER, GAME_TYPE_NONE }
};
class AdlMetaEngine : public AdvancedMetaEngine {
@@ -189,7 +183,7 @@ SaveStateList AdlMetaEngine::listSaves(const char *target) const {
const Common::String &fileName = files[i];
Common::InSaveFile *inFile = saveFileMan->openForLoading(fileName);
if (!inFile) {
- warning("Cannot open save file %s", fileName.c_str());
+ warning("Cannot open save file '%s'", fileName.c_str());
continue;
}
@@ -201,7 +195,7 @@ SaveStateList AdlMetaEngine::listSaves(const char *target) const {
byte saveVersion = inFile->readByte();
if (saveVersion != SAVEGAME_VERSION) {
- warning("Save game version %i not supported in '%s'", saveVersion, fileName.c_str());
+ warning("Unsupported save game version %i found in '%s'", saveVersion, fileName.c_str());
delete inFile;
continue;
}
@@ -225,10 +219,23 @@ void AdlMetaEngine::removeSaveState(const char *target, int slot) const {
g_system->getSavefileManager()->removeSavefile(fileName);
}
+Engine *HiRes1Engine_create(OSystem *syst, const AdlGameDescription *gd);
+
bool AdlMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const {
- if (gd)
- *engine = AdlEngine::create(((const AdlGameDescription *)gd)->gameType, syst, (const AdlGameDescription *)gd);
- return gd != nullptr;
+ if (!gd)
+ return false;
+
+ const AdlGameDescription *adlGd = (const AdlGameDescription *)gd;
+
+ switch (adlGd->gameType) {
+ case GAME_TYPE_HIRES1:
+ *engine = HiRes1Engine_create(syst, adlGd);
+ break;
+ default:
+ error("Unknown GameType");
+ }
+
+ return true;
}
} // End of namespace Adl