1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 
24 #include "bladerunner/bladerunner.h"
25 #include "bladerunner/savefile.h"
26 
27 #include "common/config-manager.h"
28 #include "common/system.h"
29 #include "common/savefile.h"
30 #include "common/serializer.h"
31 
32 #include "engines/advancedDetector.h"
33 
34 class BladeRunnerMetaEngine : public AdvancedMetaEngine {
35 public:
36 	const char *getName() const override;
37 
38 	Common::Error createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
39 	bool hasFeature(MetaEngineFeature f) const override;
40 
41 	SaveStateList listSaves(const char *target) const override;
42 	int getMaximumSaveSlot() const override;
43 	void removeSaveState(const char *target, int slot) const override;
44 	SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override;
45 };
46 
getName() const47 const char *BladeRunnerMetaEngine::getName() const {
48 	return "bladerunner";
49 }
50 
createInstance(OSystem * syst,Engine ** engine,const ADGameDescription * desc) const51 Common::Error BladeRunnerMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
52 	*engine = new BladeRunner::BladeRunnerEngine(syst, desc);
53 	return Common::kNoError;
54 }
55 
hasFeature(MetaEngineFeature f) const56 bool BladeRunnerMetaEngine::hasFeature(MetaEngineFeature f) const {
57 	return
58 		f == kSupportsListSaves ||
59 		f == kSupportsLoadingDuringStartup ||
60 		f == kSupportsDeleteSave ||
61 		f == kSavesSupportMetaInfo ||
62 		f == kSavesSupportThumbnail ||
63 		f == kSavesSupportCreationDate ||
64 		f == kSavesSupportPlayTime ||
65 		f == kSimpleSavesNames;
66 }
67 
listSaves(const char * target) const68 SaveStateList BladeRunnerMetaEngine::listSaves(const char *target) const {
69 	return BladeRunner::SaveFileManager::list(this, target);
70 }
71 
getMaximumSaveSlot() const72 int BladeRunnerMetaEngine::getMaximumSaveSlot() const {
73 	return 999;
74 }
75 
removeSaveState(const char * target,int slot) const76 void BladeRunnerMetaEngine::removeSaveState(const char *target, int slot) const {
77 	BladeRunner::SaveFileManager::remove(target, slot);
78 }
79 
querySaveMetaInfos(const char * target,int slot) const80 SaveStateDescriptor BladeRunnerMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
81 	return BladeRunner::SaveFileManager::queryMetaInfos(this, target, slot);
82 }
83 
84 #if PLUGIN_ENABLED_DYNAMIC(BLADERUNNER)
85 	REGISTER_PLUGIN_DYNAMIC(BLADERUNNER, PLUGIN_TYPE_ENGINE, BladeRunnerMetaEngine);
86 #else
87 	REGISTER_PLUGIN_STATIC(BLADERUNNER, PLUGIN_TYPE_ENGINE, BladeRunnerMetaEngine);
88 #endif
89