Skip to content

Commit

Permalink
initial stub code
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzie committed May 25, 2010
0 parents commit f78699b
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 0 deletions.
Empty file added debug.cpp
Empty file.
70 changes: 70 additions & 0 deletions 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
Empty file added graphics.cpp
Empty file.
15 changes: 15 additions & 0 deletions 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
29 changes: 29 additions & 0 deletions 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

20 changes: 20 additions & 0 deletions 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

0 comments on commit f78699b

Please sign in to comment.