Skip to content

Commit f78699b

Browse files
committed
initial stub code
0 parents  commit f78699b

File tree

6 files changed

+134
-0
lines changed

6 files changed

+134
-0
lines changed

debug.cpp

Whitespace-only changes.

detection.cpp

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#include "engines/metaengine.h"
2+
#include "common/fs.h"
3+
#include "common/unzip.h"
4+
5+
#include "unity.h"
6+
7+
static const PlainGameDescriptor unityGames[] = {
8+
{ "unity", "Star Trek: The Next Generation \"A Final Unity\"" },
9+
{ 0, 0 }
10+
};
11+
12+
class UnityMetaEngine : public MetaEngine {
13+
virtual const char *getName() const { return "A Final Unity engine"; }
14+
virtual const char *getOriginalCopyright() const { return "Copyright (C) Spectrum Holobyte Inc."; }
15+
16+
virtual GameList getSupportedGames() const {
17+
GameList games;
18+
const PlainGameDescriptor *g = unityGames;
19+
while (g->gameid) {
20+
games.push_back(*g);
21+
g++;
22+
}
23+
return games;
24+
}
25+
26+
virtual GameDescriptor findGame(const char *gameid) const {
27+
const PlainGameDescriptor *g = unityGames;
28+
while (g->gameid) {
29+
if (0 == scumm_stricmp(gameid, g->gameid))
30+
break;
31+
g++;
32+
}
33+
return GameDescriptor(g->gameid, g->description);
34+
}
35+
36+
virtual GameList detectGames(const Common::FSList &fslist) const {
37+
GameList detectedGames;
38+
39+
for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
40+
if (!file->isDirectory()) {
41+
const char *gameName = file->getName().c_str();
42+
43+
// game data is stored on the CD in this file;
44+
// TODO: might want to support unzipped installs too
45+
if (0 == scumm_stricmp("STTNG.ZIP", gameName)) {
46+
Common::Archive *archive = Common::makeZipArchive(*file);
47+
// just some random file as a sanity check
48+
if (archive && archive->hasFile("PENTARA.BIN")) {
49+
detectedGames.push_back(unityGames[0]);
50+
delete archive;
51+
break;
52+
}
53+
delete archive;
54+
}
55+
}
56+
}
57+
return detectedGames;
58+
}
59+
60+
virtual Common::Error createInstance(OSystem *syst, Engine **engine) const {
61+
*engine = new Unity::UnityEngine(syst);
62+
return Common::kNoError;
63+
}
64+
};
65+
66+
#if PLUGIN_ENABLED_DYNAMIC(UNITY)
67+
REGISTER_PLUGIN_DYNAMIC(UNITY, PLUGIN_TYPE_ENGINE, UnityMetaEngine);
68+
#else
69+
REGISTER_PLUGIN_STATIC(UNITY, PLUGIN_TYPE_ENGINE, UnityMetaEngine);
70+
#endif

graphics.cpp

Whitespace-only changes.

module.mk

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
MODULE := engines/unity
2+
3+
MODULE_OBJS := \
4+
debug.o \
5+
detection.o \
6+
graphics.o \
7+
unity.o
8+
9+
# This module can be built as a plugin
10+
ifeq ($(ENABLE_UNITY), DYNAMIC_PLUGIN)
11+
PLUGIN := 1
12+
endif
13+
14+
# Include common rules
15+
include $(srcdir)/rules.mk

unity.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#include "unity.h"
2+
3+
#include "common/fs.h"
4+
#include "common/config-manager.h"
5+
#include "engines/util.h"
6+
7+
namespace Unity {
8+
9+
UnityEngine::UnityEngine(OSystem *syst) : Engine(syst) {
10+
const Common::FSNode gameDataDir(ConfMan.get("path"));
11+
}
12+
13+
UnityEngine::~UnityEngine() {
14+
}
15+
16+
Common::Error UnityEngine::init() {
17+
return Common::kNoError;
18+
}
19+
20+
Common::Error UnityEngine::run() {
21+
initGraphics(640, 480, true);
22+
23+
// TODO
24+
25+
return Common::kNoError;
26+
}
27+
28+
} // Unity
29+

unity.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#ifndef _UNITY_H
2+
#define _UNITY_H
3+
4+
#include "engines/engine.h"
5+
6+
namespace Unity {
7+
8+
class UnityEngine : public Engine {
9+
public:
10+
UnityEngine(class OSystem *syst);
11+
~UnityEngine();
12+
13+
Common::Error init();
14+
Common::Error run();
15+
};
16+
17+
} // Unity
18+
19+
#endif
20+

0 commit comments

Comments
 (0)