-
Notifications
You must be signed in to change notification settings - Fork 0
/
metaengine.cpp
46 lines (38 loc) · 1.21 KB
/
metaengine.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "engines/metaengine.h"
#include "base/plugins.h"
#include "common/md5.h"
#include "common/memstream.h"
#include "common/savefile.h"
#include "common/str-array.h"
#include "common/system.h"
#include "graphics/surface.h"
#include "common/config-manager.h"
#include "common/file.h"
#include "kom/kom.h"
class KomMetaEngine : public MetaEngine {
private:
Common::String findFileByGameId(const Common::String &gameId) const;
public:
const char* getName() const override {
return "kom";
}
Common::Error createInstance(OSystem *syst, Engine **engine) override;
};
Common::Error KomMetaEngine::createInstance(OSystem *syst, Engine **engine) {
Common::FSNode dir(ConfMan.get("path"));
// Unable to locate game data
if (!(dir.getChild("thidney.dsk").exists() || dir.getChild("shahron.dsk").exists())) {
warning("KOM: unable to locate game data at path '%s'", dir.getPath().c_str());
return Common::kNoGameDataFoundError;
}
if (engine == NULL) {
return Common::kUnknownError;
}
*engine = new Kom::KomEngine(syst);
return Common::kNoError;
}
#if PLUGIN_ENABLED_DYNAMIC(KOM)
REGISTER_PLUGIN_DYNAMIC(KOM, PLUGIN_TYPE_ENGINE, KomMetaEngine);
#else
REGISTER_PLUGIN_STATIC(KOM, PLUGIN_TYPE_ENGINE, KomMetaEngine);
#endif