aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWinterGrascph2016-04-26 14:44:01 +0200
committerBendegúz Nagy2016-08-26 23:02:22 +0200
commit96cc074ea0752165d2eb9281c9affeda8e5be5b1 (patch)
tree0ad517cd8856ba331ac09d9d3b168841064c4124
parente880fd74edeb79852fe8746eb924055ea8facffc (diff)
downloadscummvm-rg350-96cc074ea0752165d2eb9281c9affeda8e5be5b1.tar.gz
scummvm-rg350-96cc074ea0752165d2eb9281c9affeda8e5be5b1.tar.bz2
scummvm-rg350-96cc074ea0752165d2eb9281c9affeda8e5be5b1.zip
DM: Create engine and detection with dummy data
-rw-r--r--engines/dm/configure.engine3
-rw-r--r--engines/dm/detection.cpp55
-rw-r--r--engines/dm/dm.cpp61
-rw-r--r--engines/dm/dm.h38
-rw-r--r--engines/dm/module.mk17
5 files changed, 174 insertions, 0 deletions
diff --git a/engines/dm/configure.engine b/engines/dm/configure.engine
new file mode 100644
index 0000000000..50a3d9975c
--- /dev/null
+++ b/engines/dm/configure.engine
@@ -0,0 +1,3 @@
+# This file is included from the main "configure" script
+# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
+add_engine dm "Dungeon Master" yes
diff --git a/engines/dm/detection.cpp b/engines/dm/detection.cpp
new file mode 100644
index 0000000000..4c970e32c9
--- /dev/null
+++ b/engines/dm/detection.cpp
@@ -0,0 +1,55 @@
+#include "dm/dm.h"
+
+#include "common/config-manager.h"
+#include "common/error.h"
+#include "common/fs.h"
+
+#include "engines/advancedDetector.h"
+namespace DM {
+static const PlainGameDescriptor DMGames[] = {
+ {0, 0}
+};
+
+static const ADGameDescription gameDescriptions[] = {
+ AD_TABLE_END_MARKER
+};
+
+static const ADExtraGuiOptionsMap optionsList[] = {
+ AD_EXTRA_GUI_OPTIONS_TERMINATOR
+};
+
+
+class DMMetaEngine : public AdvancedMetaEngine {
+public:
+
+
+ DMMetaEngine() : AdvancedMetaEngine(DM::gameDescriptions, sizeof(ADGameDescription), DMGames, optionsList) {
+ _singleId = "Dummy";
+ }
+
+ virtual const char *getName() const {
+ return "Dummy";
+ }
+
+ virtual const char *getOriginalCopyright() const {
+ return "Dummy";
+ }
+
+ virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const { return gameDescriptions; }
+ virtual bool hasFeature(MetaEngineFeature f) const { return false; }
+ virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
+ *engine = new DM::DMEngine(syst);
+ return true;
+ }
+ virtual int getMaximumSaveSlot() const { return 99; }
+ virtual SaveStateList listSaves(const char *target) const { return SaveStateList(); }
+ SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const { return SaveStateDescriptor(); }
+ virtual void removeSaveState(const char *target, int slot) const {}
+};
+
+}
+#if PLUGIN_ENABLED_DYNAMIC(DM)
+REGISTER_PLUGIN_DYNAMIC(DM, PLUGIN_TYPE_ENGINE, DM::DMMetaEngine);
+#else
+REGISTER_PLUGIN_STATIC(DM, PLUGIN_TYPE_ENGINE, DM::DMMetaEngine);
+#endif
diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp
new file mode 100644
index 0000000000..b0c281a12b
--- /dev/null
+++ b/engines/dm/dm.cpp
@@ -0,0 +1,61 @@
+#include "common/scummsys.h"
+
+#include "common/config-manager.h"
+#include "common/debug.h"
+#include "common/debug-channels.h"
+#include "common/error.h"
+#include "gui/EventRecorder.h"
+#include "common/file.h"
+#include "common/fs.h"
+
+#include "engines/util.h"
+
+#include "dm/dm.h"
+
+namespace DM {
+
+DMEngine::DMEngine(OSystem *syst) : Engine(syst), _console(nullptr) {
+ // Do not load data files
+ // Do not initialize graphics here
+ // Do not initialize audio devices here
+ // Do these from run
+
+ //Specify all default directories
+ const Common::FSNode gameDataDir(ConfMan.get("example"));
+ SearchMan.addSubDirectoryMatching(gameDataDir, "example2");
+
+ DebugMan.addDebugChannel(kDMDebugExample, "example", "example desc");
+
+ // regiser random source
+ _rnd = new Common::RandomSource("quux");
+
+ debug("DMEngine::DMEngine");
+}
+
+DMEngine::~DMEngine() {
+ debug("DMEngine::~DMEngine");
+
+ // dispose of resources
+ delete _rnd;
+
+ // clear debug channels
+ DebugMan.clearAllDebugChannels();
+}
+
+Common::Error DMEngine::run() {
+ // Init graphics
+ initGraphics(320, 200, false);
+
+ // Create debug console (it requirese GFX to be inited)
+ _console = new Console(this);
+
+ // Additional setup
+ debug("DMEngine::init");
+
+ // Run main loop
+ debug("DMEngine:: start main loop");
+
+ return Common::kNoError;
+}
+
+} // End of namespace DM
diff --git a/engines/dm/dm.h b/engines/dm/dm.h
new file mode 100644
index 0000000000..79deb299da
--- /dev/null
+++ b/engines/dm/dm.h
@@ -0,0 +1,38 @@
+#ifndef DM_H
+#define DM_H
+
+#include "common/random.h"
+#include "engines/engine.h"
+#include "gui/debugger.h"
+
+
+namespace DM {
+
+class Console;
+
+enum {
+ // engine debug channels
+ kDMDebugExample = 1 << 0
+};
+
+class DMEngine : public Engine {
+public:
+ DMEngine(OSystem *syst);
+ ~DMEngine();
+
+ virtual Common::Error run();
+
+private:
+ Console *_console;
+ Common::RandomSource *_rnd;
+};
+
+class Console : public GUI::Debugger {
+public:
+ Console(DMEngine *vm) {}
+ virtual ~Console(void) {}
+};
+
+} // End of namespace DM
+
+#endif
diff --git a/engines/dm/module.mk b/engines/dm/module.mk
new file mode 100644
index 0000000000..808b4e5c52
--- /dev/null
+++ b/engines/dm/module.mk
@@ -0,0 +1,17 @@
+MODULE := engines/dm
+
+MODULE_OBJS := \
+ detection.o \
+ dm.o
+
+MODULE_DIRS += \
+ engines/dm
+
+# This module can be built as a plugin
+ifeq ($(ENABLE_DM), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+
+# Include common rules
+include $(srcdir)/rules.mk
+