diff --git a/debug.cpp b/debug.cpp new file mode 100644 index 0000000..e69de29 diff --git a/detection.cpp b/detection.cpp new file mode 100644 index 0000000..552ab40 --- /dev/null +++ b/detection.cpp @@ -0,0 +1,70 @@ +#include "engines/metaengine.h" +#include "common/fs.h" +#include "common/unzip.h" + +#include "unity.h" + +static const PlainGameDescriptor unityGames[] = { + { "unity", "Star Trek: The Next Generation \"A Final Unity\"" }, + { 0, 0 } +}; + +class UnityMetaEngine : public MetaEngine { + virtual const char *getName() const { return "A Final Unity engine"; } + virtual const char *getOriginalCopyright() const { return "Copyright (C) Spectrum Holobyte Inc."; } + + virtual GameList getSupportedGames() const { + GameList games; + const PlainGameDescriptor *g = unityGames; + while (g->gameid) { + games.push_back(*g); + g++; + } + return games; + } + + virtual GameDescriptor findGame(const char *gameid) const { + const PlainGameDescriptor *g = unityGames; + while (g->gameid) { + if (0 == scumm_stricmp(gameid, g->gameid)) + break; + g++; + } + return GameDescriptor(g->gameid, g->description); + } + + virtual GameList detectGames(const Common::FSList &fslist) const { + GameList detectedGames; + + for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { + if (!file->isDirectory()) { + const char *gameName = file->getName().c_str(); + + // game data is stored on the CD in this file; + // TODO: might want to support unzipped installs too + if (0 == scumm_stricmp("STTNG.ZIP", gameName)) { + Common::Archive *archive = Common::makeZipArchive(*file); + // just some random file as a sanity check + if (archive && archive->hasFile("PENTARA.BIN")) { + detectedGames.push_back(unityGames[0]); + delete archive; + break; + } + delete archive; + } + } + } + return detectedGames; + } + + virtual Common::Error createInstance(OSystem *syst, Engine **engine) const { + *engine = new Unity::UnityEngine(syst); + return Common::kNoError; + } +}; + +#if PLUGIN_ENABLED_DYNAMIC(UNITY) + REGISTER_PLUGIN_DYNAMIC(UNITY, PLUGIN_TYPE_ENGINE, UnityMetaEngine); +#else + REGISTER_PLUGIN_STATIC(UNITY, PLUGIN_TYPE_ENGINE, UnityMetaEngine); +#endif diff --git a/graphics.cpp b/graphics.cpp new file mode 100644 index 0000000..e69de29 diff --git a/module.mk b/module.mk new file mode 100644 index 0000000..b12f878 --- /dev/null +++ b/module.mk @@ -0,0 +1,15 @@ +MODULE := engines/unity + +MODULE_OBJS := \ + debug.o \ + detection.o \ + graphics.o \ + unity.o + +# This module can be built as a plugin +ifeq ($(ENABLE_UNITY), DYNAMIC_PLUGIN) +PLUGIN := 1 +endif + +# Include common rules +include $(srcdir)/rules.mk diff --git a/unity.cpp b/unity.cpp new file mode 100644 index 0000000..7e55831 --- /dev/null +++ b/unity.cpp @@ -0,0 +1,29 @@ +#include "unity.h" + +#include "common/fs.h" +#include "common/config-manager.h" +#include "engines/util.h" + +namespace Unity { + +UnityEngine::UnityEngine(OSystem *syst) : Engine(syst) { + const Common::FSNode gameDataDir(ConfMan.get("path")); +} + +UnityEngine::~UnityEngine() { +} + +Common::Error UnityEngine::init() { + return Common::kNoError; +} + +Common::Error UnityEngine::run() { + initGraphics(640, 480, true); + + // TODO + + return Common::kNoError; +} + +} // Unity + diff --git a/unity.h b/unity.h new file mode 100644 index 0000000..78f17af --- /dev/null +++ b/unity.h @@ -0,0 +1,20 @@ +#ifndef _UNITY_H +#define _UNITY_H + +#include "engines/engine.h" + +namespace Unity { + +class UnityEngine : public Engine { +public: + UnityEngine(class OSystem *syst); + ~UnityEngine(); + + Common::Error init(); + Common::Error run(); +}; + +} // Unity + +#endif +