[Scummvm-cvs-logs] SF.net SVN: scummvm:[43929] scummvm/trunk/engines/teenagent

megath at users.sourceforge.net megath at users.sourceforge.net
Fri Sep 4 00:42:12 CEST 2009


Revision: 43929
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43929&view=rev
Author:   megath
Date:     2009-09-03 22:42:12 +0000 (Thu, 03 Sep 2009)

Log Message:
-----------
added detection structures with exe offsets.

Modified Paths:
--------------
    scummvm/trunk/engines/teenagent/detection.cpp
    scummvm/trunk/engines/teenagent/resources.cpp
    scummvm/trunk/engines/teenagent/resources.h
    scummvm/trunk/engines/teenagent/teenagent.cpp
    scummvm/trunk/engines/teenagent/teenagent.h

Modified: scummvm/trunk/engines/teenagent/detection.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/detection.cpp	2009-09-03 22:41:15 UTC (rev 43928)
+++ scummvm/trunk/engines/teenagent/detection.cpp	2009-09-03 22:42:12 UTC (rev 43929)
@@ -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 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 @@
 
 	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;
 	}

Modified: scummvm/trunk/engines/teenagent/resources.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/resources.cpp	2009-09-03 22:41:15 UTC (rev 43928)
+++ scummvm/trunk/engines/teenagent/resources.cpp	2009-09-03 22:42:12 UTC (rev 43929)
@@ -23,6 +23,7 @@
  */
 
 #include "resources.h"
+#include "teenagent.h"
 
 using namespace TeenAgent;
 
@@ -45,7 +46,7 @@
 	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 @@
 		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();

Modified: scummvm/trunk/engines/teenagent/resources.h
===================================================================
--- scummvm/trunk/engines/teenagent/resources.h	2009-09-03 22:41:15 UTC (rev 43928)
+++ scummvm/trunk/engines/teenagent/resources.h	2009-09-03 22:42:12 UTC (rev 43929)
@@ -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;

Modified: scummvm/trunk/engines/teenagent/teenagent.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/teenagent.cpp	2009-09-03 22:41:15 UTC (rev 43928)
+++ scummvm/trunk/engines/teenagent/teenagent.cpp	2009-09-03 22:42:12 UTC (rev 43929)
@@ -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 @@
 	inventory = new Inventory;
 	
 	Resources * res = Resources::instance();
-	res->loadArchives();
+	res->loadArchives(_gameDescription);
 	
 	
 	scene->init(this, _system);

Modified: scummvm/trunk/engines/teenagent/teenagent.h
===================================================================
--- scummvm/trunk/engines/teenagent/teenagent.h	2009-09-03 22:41:15 UTC (rev 43928)
+++ scummvm/trunk/engines/teenagent/teenagent.h	2009-09-03 22:42:12 UTC (rev 43929)
@@ -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 @@
 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 @@
 
 	Audio::AudioStream *_musicStream;
 	Audio::SoundHandle _musicHandle, _soundHandle;
+	const GameDescription *_gameDescription;
 };
 
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list