Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DM: Create engine and detection with dummy data
- Loading branch information
WinterGrascph
committed
Aug 26, 2016
1 parent
e880fd7
commit 96cc074
Showing
5 changed files
with
174 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|