aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Menshakov2009-09-03 22:42:12 +0000
committerVladimir Menshakov2009-09-03 22:42:12 +0000
commit39e3c2c096987b3ec9a7f8241dab4dea4f0e45c8 (patch)
tree26615ccf0ce29733a1b16bb59de76ec8f53f5455
parentd4923071c1b9a3a8c1ab117fdf9349a354e18ca7 (diff)
downloadscummvm-rg350-39e3c2c096987b3ec9a7f8241dab4dea4f0e45c8.tar.gz
scummvm-rg350-39e3c2c096987b3ec9a7f8241dab4dea4f0e45c8.tar.bz2
scummvm-rg350-39e3c2c096987b3ec9a7f8241dab4dea4f0e45c8.zip
added detection structures with exe offsets.
svn-id: r43929
-rw-r--r--engines/teenagent/detection.cpp45
-rw-r--r--engines/teenagent/resources.cpp9
-rw-r--r--engines/teenagent/resources.h4
-rw-r--r--engines/teenagent/teenagent.cpp4
-rw-r--r--engines/teenagent/teenagent.h15
5 files changed, 57 insertions, 20 deletions
diff --git a/engines/teenagent/detection.cpp b/engines/teenagent/detection.cpp
index 1801d7abbf..98e13feba2 100644
--- a/engines/teenagent/detection.cpp
+++ b/engines/teenagent/detection.cpp
@@ -28,6 +28,7 @@
#include "teenagent/teenagent.h"
#include "common/system.h"
#include "common/savefile.h"
+#include "teenagent.h"
static const PlainGameDescriptor teenAgentGames[] = {
{ "teenagent", "Teen agent" },
@@ -35,23 +36,43 @@ static const PlainGameDescriptor teenAgentGames[] = {
};
-static const ADGameDescription teenAgentGameDescriptions[] = {
+static const TeenAgent::GameDescription teenAgentGameDescriptions[] = {
{
- "teenagent",
- "",
- AD_ENTRY1s("teenagnt.exe", "b886cae8f875ea5eaefed04a8cc3c8a1", 152690),
- Common::EN_ANY,
- Common::kPlatformPC,
- ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ {
+ "teenagent",
+ "",
+ AD_ENTRY1s("teenagnt.exe", "b886cae8f875ea5eaefed04a8cc3c8a1", 152690),
+ Common::EN_ANY,
+ Common::kPlatformPC,
+ ADGF_NO_FLAGS,
+ Common::GUIO_NONE
+ },
+ {0x0200, 0xb5b0, 0x1c890}
},
- AD_TABLE_END_MARKER
+/*
+ {
+ {
+ "teenagent",
+ "",
+ AD_ENTRY1s("teenagnt.exe", "7172e0c46cd11e4072ba486e3d220210", 152626),
+ Common::EN_ANY,
+ Common::kPlatformPC,
+ ADGF_NO_FLAGS,
+ Common::GUIO_NONE
+ },
+ {0x00c0, 0xB5E0, 0x1c850}
+ },
+*/
+ {
+ AD_TABLE_END_MARKER,
+ {0, 0, 0}
+ }
};
static const ADParams detectionParams = {
(const byte *)teenAgentGameDescriptions,
- sizeof(ADGameDescription),
- 512,
+ sizeof(TeenAgent::GameDescription),
+ 5000,
teenAgentGames,
0,
"teenagent",
@@ -89,7 +110,7 @@ public:
virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
if (desc) {
- *engine = new TeenAgent::TeenAgentEngine(syst);
+ *engine = new TeenAgent::TeenAgentEngine(syst, (TeenAgent::GameDescription*)desc);
}
return desc != 0;
}
diff --git a/engines/teenagent/resources.cpp b/engines/teenagent/resources.cpp
index acd610001e..4f2fe6354c 100644
--- a/engines/teenagent/resources.cpp
+++ b/engines/teenagent/resources.cpp
@@ -23,6 +23,7 @@
*/
#include "resources.h"
+#include "teenagent.h"
using namespace TeenAgent;
@@ -45,7 +46,7 @@ void Resources::deinit() {
sam_sam.close();
}
-void Resources::loadArchives() {
+void Resources::loadArchives(const GameDescription * gd) {
off.open("off.res");
varia.open("varia.res");
on.open("on.res");
@@ -63,13 +64,13 @@ void Resources::loadArchives() {
error("cannot open exe file");
return;
}
- exe.seek(0x0200);
+ exe.seek(gd->offsets.cseg_offset);
cseg.read(&exe, 0xb3b0); //code
- exe.seek(0xb5b0);
+ exe.seek(gd->offsets.dseg_offset);
dseg.read(&exe, 0xe790); //data
- exe.seek(0x1c890);
+ exe.seek(gd->offsets.eseg_offset);
eseg.read(&exe, 0x8be2);
exe.close();
diff --git a/engines/teenagent/resources.h b/engines/teenagent/resources.h
index eba0744b72..97a1f7da05 100644
--- a/engines/teenagent/resources.h
+++ b/engines/teenagent/resources.h
@@ -33,12 +33,14 @@
namespace TeenAgent {
+class GameDescription;
+
class Resources {
protected:
Resources();
public:
static Resources * instance();
- void loadArchives();
+ void loadArchives(const GameDescription * gd);
void deinit();
void loadOff(Graphics::Surface &surface, byte *palette, int id);
Common::SeekableReadStream * loadLan(uint32 id) const;
diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp
index 11ab91f965..675663f46a 100644
--- a/engines/teenagent/teenagent.cpp
+++ b/engines/teenagent/teenagent.cpp
@@ -36,7 +36,7 @@
using namespace TeenAgent;
-TeenAgentEngine::TeenAgentEngine(OSystem * system) : Engine(system), action(ActionNone) {
+TeenAgentEngine::TeenAgentEngine(OSystem * system, const GameDescription *gd) : Engine(system), action(ActionNone), _gameDescription(gd) {
music = new MusicPlayer();
}
@@ -202,7 +202,7 @@ Common::Error TeenAgentEngine::run() {
inventory = new Inventory;
Resources * res = Resources::instance();
- res->loadArchives();
+ res->loadArchives(_gameDescription);
scene->init(this, _system);
diff --git a/engines/teenagent/teenagent.h b/engines/teenagent/teenagent.h
index c5b31de99b..da8dec0f59 100644
--- a/engines/teenagent/teenagent.h
+++ b/engines/teenagent/teenagent.h
@@ -32,6 +32,7 @@
#include "inventory.h"
#include "sound/audiostream.h"
#include "sound/mixer.h"
+#include "engines/advancedDetector.h"
namespace TeenAgent {
@@ -39,11 +40,22 @@ struct Object;
class Scene;
class MusicPlayer;
+struct ExeOffsets {
+ uint32 cseg_offset;
+ uint32 dseg_offset;
+ uint32 eseg_offset;
+};
+
+struct GameDescription {
+ ADGameDescription gd;
+ ExeOffsets offsets;
+};
+
class TeenAgentEngine: public Engine {
public:
enum Action { ActionNone, ActionExamine, ActionUse };
- TeenAgentEngine(OSystem * system);
+ TeenAgentEngine(OSystem * system, const GameDescription *gd);
virtual Common::Error run();
virtual Common::Error loadGameState(int slot);
@@ -102,6 +114,7 @@ private:
Audio::AudioStream *_musicStream;
Audio::SoundHandle _musicHandle, _soundHandle;
+ const GameDescription *_gameDescription;
};
}