aboutsummaryrefslogtreecommitdiff
path: root/engines/mutationofjb
diff options
context:
space:
mode:
authorĽubomír Remák2018-02-10 21:39:14 +0100
committerEugene Sandulenko2018-08-25 23:12:01 +0200
commit764ee3a5a3f9f600b8d369d8474d2702b22f73f7 (patch)
tree07a9de9b48006187621a25162c3067f6cb7758a1 /engines/mutationofjb
parentac540f2a2f4ecf0d12227d2193fb783c99688084 (diff)
downloadscummvm-rg350-764ee3a5a3f9f600b8d369d8474d2702b22f73f7.tar.gz
scummvm-rg350-764ee3a5a3f9f600b8d369d8474d2702b22f73f7.tar.bz2
scummvm-rg350-764ee3a5a3f9f600b8d369d8474d2702b22f73f7.zip
MUTATIONOFJB: Base for new engine
Diffstat (limited to 'engines/mutationofjb')
-rw-r--r--engines/mutationofjb/configure.engine3
-rw-r--r--engines/mutationofjb/detection.cpp113
-rw-r--r--engines/mutationofjb/module.mk13
-rw-r--r--engines/mutationofjb/mutationofjb.cpp50
-rw-r--r--engines/mutationofjb/mutationofjb.h51
5 files changed, 230 insertions, 0 deletions
diff --git a/engines/mutationofjb/configure.engine b/engines/mutationofjb/configure.engine
new file mode 100644
index 0000000000..499e0780a2
--- /dev/null
+++ b/engines/mutationofjb/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 mutationofjb "Mutation of JB" no
diff --git a/engines/mutationofjb/detection.cpp b/engines/mutationofjb/detection.cpp
new file mode 100644
index 0000000000..f95f696f29
--- /dev/null
+++ b/engines/mutationofjb/detection.cpp
@@ -0,0 +1,113 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "mutationofjb/mutationofjb.h"
+
+#include "common/config-manager.h"
+
+#include "engines/metaengine.h"
+
+static const PlainGameDescriptor mutationofjb_setting[] = {
+ {"mutationofjb", "Mutation of J.B."},
+ {0, 0}
+};
+
+class MutationOfJBMetaEngine : public MetaEngine {
+public:
+ virtual const char *getName() const {
+ return "Mutation of J.B.";
+ }
+
+ virtual const char *getOriginalCopyright() const {
+ return "Mutation of J.B. (C) 1996 RIKI Computer Games";
+ }
+
+ virtual PlainGameList getSupportedGames() const {
+ PlainGameList games;
+ const PlainGameDescriptor *g = mutationofjb_setting;
+ while (g->gameId) {
+ games.push_back(*g);
+ g++;
+ }
+
+ return games;
+ }
+
+ virtual PlainGameDescriptor findGame(const char *gameid) const {
+ const PlainGameDescriptor *g = mutationofjb_setting;
+ while (g->gameId) {
+ if (0 == scumm_stricmp(gameid, g->gameId))
+ return *g;
+ g++;
+ }
+ return PlainGameDescriptor::empty();
+ }
+
+ virtual DetectedGames detectGames(const Common::FSList &fslist) const {
+ DetectedGames detectedGames;
+
+ for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
+ if (!file->isDirectory()) {
+ const char *gameName = file->getName().c_str();
+
+ if (0 == scumm_stricmp("startup.dat", gameName)) {
+ detectedGames.push_back(DetectedGame(mutationofjb_setting[0]));
+ break;
+ }
+ }
+ }
+ return detectedGames;
+ }
+
+ virtual Common::Error createInstance(OSystem *syst, Engine **engine) const {
+ assert(syst);
+ assert(engine);
+
+ Common::FSList fslist;
+ Common::FSNode dir(ConfMan.get("path"));
+ if (!dir.getChildren(fslist, Common::FSNode::kListAll)) {
+ return Common::kNoGameDataFoundError;
+ }
+
+ // Invoke the detector
+ Common::String gameid = ConfMan.get("gameid");
+ DetectedGames detectedGames = detectGames(fslist);
+
+ for (uint i = 0; i < detectedGames.size(); i++) {
+ if (detectedGames[i].gameId == gameid) {
+ // At this point you may want to perform additional sanity checks.
+ *engine = new MutationOfJB::MutationOfJBEngine(syst);
+ return Common::kNoError;
+ }
+ }
+
+ // Failed to find any game data
+ return Common::kNoGameDataFoundError;
+ }
+};
+
+#if PLUGIN_ENABLED_DYNAMIC(MUTATIONOFJB)
+ REGISTER_PLUGIN_DYNAMIC(MUTATIONOFJB, PLUGIN_TYPE_ENGINE, MutationOfJBMetaEngine);
+#else
+ REGISTER_PLUGIN_STATIC(MUTATIONOFJB, PLUGIN_TYPE_ENGINE, MutationOfJBMetaEngine);
+#endif
+
diff --git a/engines/mutationofjb/module.mk b/engines/mutationofjb/module.mk
new file mode 100644
index 0000000000..2e28d41eee
--- /dev/null
+++ b/engines/mutationofjb/module.mk
@@ -0,0 +1,13 @@
+MODULE := engines/mutationofjb
+
+MODULE_OBJS := \
+ detection.o \
+ mutationofjb.o
+
+# This module can be built as a plugin
+ifeq ($(ENABLE_MUTATIONOFJB), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+
+# Include common rules
+include $(srcdir)/rules.mk
diff --git a/engines/mutationofjb/mutationofjb.cpp b/engines/mutationofjb/mutationofjb.cpp
new file mode 100644
index 0000000000..f50ba70792
--- /dev/null
+++ b/engines/mutationofjb/mutationofjb.cpp
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/scummsys.h"
+
+#include "common/debug.h"
+#include "common/error.h"
+
+#include "engines/util.h"
+
+#include "mutationofjb/mutationofjb.h"
+
+namespace MutationOfJB {
+
+MutationOfJBEngine::MutationOfJBEngine(OSystem *syst)
+: Engine(syst), _console(nullptr) {
+ debug("MutationOfJBEngine::MutationOfJBEngine");
+}
+
+MutationOfJBEngine::~MutationOfJBEngine() {
+ debug("MutationOfJBEngine::~MutationOfJBEngine");
+}
+
+Common::Error MutationOfJBEngine::run() {
+ initGraphics(320, 200, false);
+ _console = new Console(this);
+ debug("MutationOfJBEngine::run");
+
+ return Common::kNoError;
+}
+}
diff --git a/engines/mutationofjb/mutationofjb.h b/engines/mutationofjb/mutationofjb.h
new file mode 100644
index 0000000000..1c87fe46f0
--- /dev/null
+++ b/engines/mutationofjb/mutationofjb.h
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef MUTATIONOFJB_MUTATIONOFJB_H
+#define MUTATIONOFJB_MUTATIONOFJB_H
+
+#include "engines/engine.h"
+#include "gui/debugger.h"
+
+namespace MutationOfJB {
+
+class Console;
+
+class MutationOfJBEngine : public Engine {
+public:
+ MutationOfJBEngine(OSystem *syst);
+ ~MutationOfJBEngine();
+
+ virtual Common::Error run();
+private:
+ Console *_console;
+};
+
+class Console : public GUI::Debugger {
+public:
+ Console(MutationOfJBEngine *vm) {}
+ virtual ~Console(void) {}
+};
+
+}
+
+#endif