Permalink
Browse files

MUTATIONOFJB: Base for new engine

  • Loading branch information...
LubomirR authored and sev- committed Feb 10, 2018
1 parent ac540f2 commit 764ee3a5a3f9f600b8d369d8474d2702b22f73f7
@@ -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
@@ -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

@@ -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
@@ -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;
}
}
@@ -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

0 comments on commit 764ee3a

Please sign in to comment.