Skip to content

Commit

Permalink
DM: Create engine and detection with dummy data
Browse files Browse the repository at this point in the history
  • Loading branch information
WinterGrascph committed Aug 26, 2016
1 parent e880fd7 commit 96cc074
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 0 deletions.
3 changes: 3 additions & 0 deletions 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
55 changes: 55 additions & 0 deletions 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
61 changes: 61 additions & 0 deletions 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
38 changes: 38 additions & 0 deletions 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
17 changes: 17 additions & 0 deletions 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

0 comments on commit 96cc074

Please sign in to comment.