[Scummvm-cvs-logs] SF.net SVN: scummvm: [31810] scummvm/trunk/engines/made

john_doe at users.sourceforge.net john_doe at users.sourceforge.net
Fri May 2 14:08:07 CEST 2008


Revision: 31810
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31810&view=rev
Author:   john_doe
Date:     2008-05-02 05:08:06 -0700 (Fri, 02 May 2008)

Log Message:
-----------
- Added patch #1955698: MADE: Add "The Manhole" Detection
- Added detection for Leather Goddesses of Phobos 2
Note that these two games will definitely not work as expected and will probably crash!

Modified Paths:
--------------
    scummvm/trunk/engines/made/database.cpp
    scummvm/trunk/engines/made/database.h
    scummvm/trunk/engines/made/detection.cpp
    scummvm/trunk/engines/made/made.cpp
    scummvm/trunk/engines/made/made.h

Modified: scummvm/trunk/engines/made/database.cpp
===================================================================
--- scummvm/trunk/engines/made/database.cpp	2008-05-02 12:00:58 UTC (rev 31809)
+++ scummvm/trunk/engines/made/database.cpp	2008-05-02 12:08:06 UTC (rev 31810)
@@ -47,13 +47,9 @@
 		delete[] _objData;
 }
 
-void Object::load(Common::SeekableReadStream &source) {
-
+int Object::load(Common::SeekableReadStream &source) {
 	_freeData = true;
-
-	source.readUint16LE(); // skip flags
 	uint16 type = source.readUint16LE();
-
 	if (type == 0x7FFF) {
 		_objSize = source.readUint16LE();
 	} else if (type == 0x7FFE) {
@@ -63,29 +59,23 @@
 		byte count2 = source.readByte();
 		_objSize = (count1 + count2) * 2;
 	}
-
 	source.seek(-6, SEEK_CUR);
-
 	_objSize += 6;
-
 	_objData = new byte[_objSize];
 	source.read(_objData, _objSize);
-
+	return _objSize;
 }
 
-void Object::load(byte *source) {
-
+int Object::load(byte *source) {
 	_objData = source;
 	_freeData = false;
-
 	if (getClass() < 0x7FFE) {
 		_objSize = (getCount1() + getCount2()) * 2;
 	} else {
 		_objSize = getSize();
 	}
-	
 	_objSize += 6;
-
+	return _objSize;
 }
 
 uint16 Object::getFlags() const {
@@ -184,7 +174,7 @@
 	*/
 }
 
-GameDatabase::GameDatabase() {
+GameDatabase::GameDatabase(MadeEngine *vm) : _vm(vm) {
 }
 
 GameDatabase::~GameDatabase() {
@@ -211,11 +201,60 @@
 }
 
 void GameDatabase::load(Common::SeekableReadStream &sourceS) {
+
+	if (_vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_LGOP2) {
+		debug(2, "loading version 2 dat");
+		loadVersion2(sourceS);
+	} else if (_vm->getGameID() == GID_RTZ) {
+		debug(2, "loading version 3 dat");
+		loadVersion3(sourceS);
+	}
+
+}
+
+void GameDatabase::loadVersion2(Common::SeekableReadStream &sourceS) {
 	
 	// TODO: Read/verifiy header
 	
+	sourceS.seek(0x1C);
+	
+	uint32 textStartOffs = sourceS.readUint16LE() * 512;
+	uint16 objectCount = sourceS.readUint16LE();
+	uint16 varObjectCount = sourceS.readUint16LE();
+	_gameStateSize = sourceS.readUint16LE() * 2;
+	sourceS.readUint16LE(); // unknown
+	uint32 objectsOffs = sourceS.readUint16LE() * 512;
+	sourceS.readUint16LE(); // unknown
+	_mainCodeObjectIndex = sourceS.readUint16LE();
+	sourceS.readUint16LE(); // unknown
+	uint32 objectsSize = sourceS.readUint32LE() * 2;
+
+	debug(2, "textStartOffs = %08X; objectCount = %d; varObjectCount = %d; gameStateSize = %d; objectsOffs = %08X; objectsSize = %d\n", textStartOffs, objectCount, varObjectCount, _gameStateSize, objectsOffs, objectsSize);
+
+	_gameState = new byte[_gameStateSize];
+	memset(_gameState, 0, _gameStateSize);
+
+	sourceS.seek(objectsOffs);
+
+	for (uint32 i = 0; i < objectCount; i++) {
+		Object *obj = new Object();
+		int objSize = obj->load(sourceS);
+		objSize = objSize % 2;
+		// objects are aligned on 2-byte-boundaries, skip unused bytes
+		sourceS.skip(objSize);
+		_objects.push_back(obj);
+	}
+	
+	printf("ok!\n"); fflush(stdout);
+
+}
+
+void GameDatabase::loadVersion3(Common::SeekableReadStream &sourceS) {
+
+	// TODO: Read/verifiy header
+
 	sourceS.seek(0x1E);
-	
+
 	uint32 objectIndexOffs = sourceS.readUint32LE();
 	uint16 objectCount = sourceS.readUint16LE();
 	uint32 gameStateOffs = sourceS.readUint32LE();
@@ -223,9 +262,9 @@
 	uint32 objectsOffs = sourceS.readUint32LE();
 	uint32 objectsSize = sourceS.readUint32LE();
 	_mainCodeObjectIndex = sourceS.readUint16LE();
-	
-	//debug(2, "objectIndexOffs = %08X; objectCount = %d; gameStateOffs = %08X; gameStateSize = %d; objectsOffs = %08X; objectsSize = %d\n", objectIndexOffs, objectCount, gameStateOffs, _gameStateSize, objectsOffs, objectsSize);
 
+	debug(2, "objectIndexOffs = %08X; objectCount = %d; gameStateOffs = %08X; gameStateSize = %d; objectsOffs = %08X; objectsSize = %d\n", objectIndexOffs, objectCount, gameStateOffs, _gameStateSize, objectsOffs, objectsSize);
+
 	_gameState = new byte[_gameStateSize];
 	sourceS.seek(gameStateOffs);
 	sourceS.read(_gameState, _gameStateSize);
@@ -241,15 +280,16 @@
 		// The LSB indicates if it's a constant or variable object.
 		// Constant objects are loaded from disk, while variable objects exist
 		// in the _gameState buffer.
-		
-		//debug(2, "obj(%04X) ofs = %08X\n", i, objectOffsets[i]);
-		
+
+		debug(2, "obj(%04X) ofs = %08X\n", i, objectOffsets[i]);
+
 		if (objectOffsets[i] & 1) {
-			//debug(2, "-> const %08X\n", objectsOffs + objectOffsets[i] - 1);
+			debug(2, "-> const %08X\n", objectsOffs + objectOffsets[i] - 1);
 			sourceS.seek(objectsOffs + objectOffsets[i] - 1);
+			sourceS.readUint16LE(); // skip flags
 			obj->load(sourceS);
 		} else {
-			//debug(2, "-> var\n");
+			debug(2, "-> var\n");
 			obj->load(_gameState + objectOffsets[i]);
 		}
 		_objects.push_back(obj);
@@ -348,8 +388,6 @@
 	int16 *propPtr1 = prop + count1;
 	int16 *propPtr2 = prop + count2;
 
-	debug(2, "# propertyId = %04X\n", propertyId);
-
 	// First see if the property exists in the given object
 	while (count2-- > 0) {
 		if ((READ_LE_UINT16(prop) & 0x3FFF) == propertyId) {

Modified: scummvm/trunk/engines/made/database.h
===================================================================
--- scummvm/trunk/engines/made/database.h	2008-05-02 12:00:58 UTC (rev 31809)
+++ scummvm/trunk/engines/made/database.h	2008-05-02 12:08:06 UTC (rev 31810)
@@ -32,6 +32,7 @@
 #include "common/stream.h"
 #include "common/str.h"
 
+#include "made/made.h"
 #include "made/redreader.h"
 
 namespace Made {
@@ -40,8 +41,8 @@
 public:
 	Object();
 	~Object();
-	void load(Common::SeekableReadStream &source);
-	void load(byte *source);
+	int load(Common::SeekableReadStream &source);
+	int load(byte *source);
 
 	uint16 getFlags() const;
 	uint16 getClass() const;
@@ -73,7 +74,7 @@
 class GameDatabase {
 public:
 
-	GameDatabase();
+	GameDatabase(MadeEngine *vm);
 	~GameDatabase();
 
 	void open(const char *filename);
@@ -102,11 +103,14 @@
 	void dumpObject(int16 index);
 	
 protected:
+	MadeEngine *_vm;
 	Common::Array<Object*> _objects;
 	byte *_gameState;
 	uint32 _gameStateSize;
 	int16 _mainCodeObjectIndex;
 	void load(Common::SeekableReadStream &sourceS);
+	void loadVersion2(Common::SeekableReadStream &sourceS);
+	void loadVersion3(Common::SeekableReadStream &sourceS);
 };
 
 } // End of namespace Made

Modified: scummvm/trunk/engines/made/detection.cpp
===================================================================
--- scummvm/trunk/engines/made/detection.cpp	2008-05-02 12:00:58 UTC (rev 31809)
+++ scummvm/trunk/engines/made/detection.cpp	2008-05-02 12:08:06 UTC (rev 31810)
@@ -61,8 +61,10 @@
 }
 
 static const PlainGameDescriptor madeGames[] = {
-	{"made", "MADE engine game"}, 
+	{"made", "MADE engine game"},
+	{"manhole", "The Manhole"},
 	{"rtz", "Return to Zork"},
+	{"lgop2", "Leather Goddesses of Phobos 2"},
 	{0, 0}
 };
 
@@ -83,8 +85,8 @@
 			Common::kPlatformPC,
 			Common::ADGF_NO_FLAGS
 		},
+		GID_RTZ,
 		0,
-		0,
 		GF_CD,
 		0,
 	},
@@ -99,8 +101,8 @@
 			Common::kPlatformPC,
 			Common::ADGF_NO_FLAGS
 		},
+		GID_RTZ,
 		0,
-		0,
 		GF_CD_COMPRESSED,
 		0,
 	},
@@ -115,8 +117,8 @@
 			Common::kPlatformPC,
 			Common::ADGF_NO_FLAGS
 		},
+		GID_RTZ,
 		0,
-		0,
 		GF_CD_COMPRESSED,
 		0,
 	},
@@ -132,8 +134,8 @@
 			Common::kPlatformPC,
 			Common::ADGF_NO_FLAGS
 		},
+		GID_RTZ,
 		0,
-		0,
 		GF_FLOPPY,
 		0,
 	},
@@ -148,12 +150,44 @@
 			Common::kPlatformPC,
 			Common::ADGF_DEMO
 		},
+		GID_RTZ,
 		0,
-		0,
 		GF_DEMO,
 		0,
 	},
+	
+	{
+		// The Manhole: New and Enhanced
+		{
+			"manhole",
+			"",
+			AD_ENTRY1("manhole.dat", "cb21e31ed35c963208343bc995225b73"),
+			Common::EN_ANY,
+			Common::kPlatformPC,
+			Common::ADGF_NO_FLAGS
+		},
+		GID_MANHOLE,
+		0,
+		GF_CD,
+		0,
+	},
 
+	{
+		// Leather Goddesses of Phobos 2
+		{
+			"lgop2",
+			"",
+			AD_ENTRY1("lgop2.dat", "8137996db200ff67e8f172ff106f2e48"),
+			Common::EN_ANY,
+			Common::kPlatformPC,
+			Common::ADGF_NO_FLAGS
+		},
+		GID_LGOP2,
+		0,
+		GF_FLOPPY,
+		0,
+	},
+
 	{ AD_TABLE_END_MARKER, 0, 0, 0, 0 }
 };
 

Modified: scummvm/trunk/engines/made/made.cpp
===================================================================
--- scummvm/trunk/engines/made/made.cpp	2008-05-02 12:00:58 UTC (rev 31809)
+++ scummvm/trunk/engines/made/made.cpp	2008-05-02 12:08:06 UTC (rev 31810)
@@ -86,7 +86,7 @@
 	_pmvPlayer = new PmvPlayer(this, _mixer);
 	_res = new ProjectReader();
 	_screen = new Screen(this);
-	_dat = new GameDatabase();
+	_dat = new GameDatabase(this);
 	_script = new ScriptInterpreter(this);
 
 	int midiDriver = MidiDriver::detectMusicDriver(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MIDI);
@@ -159,21 +159,31 @@
 
 	for (int i = 0; i < ARRAYSIZE(_timers); i++)
 		_timers[i] = -1;
-
-	if (getFeatures() & GF_DEMO) {
-		_dat->open("demo.dat");
-		_res->open("demo.prj");
-	} else if (getFeatures() & GF_CD) {
-		_dat->open("rtzcd.dat");
-		_res->open("rtzcd.prj");
-	} else if (getFeatures() & GF_CD_COMPRESSED) {
-		_dat->openFromRed("rtzcd.red", "rtzcd.dat");
-		_res->open("rtzcd.prj");
-	} else if (getFeatures() & GF_FLOPPY) {
-		_dat->open("rtz.dat");
-		_res->open("rtz.prj");
+	
+	if (getGameID() == GID_RTZ) {
+		if (getFeatures() & GF_DEMO) {
+			_dat->open("demo.dat");
+			_res->open("demo.prj");
+		} else if (getFeatures() & GF_CD) {
+			_dat->open("rtzcd.dat");
+			_res->open("rtzcd.prj");
+		} else if (getFeatures() & GF_CD_COMPRESSED) {
+			_dat->openFromRed("rtzcd.red", "rtzcd.dat");
+			_res->open("rtzcd.prj");
+		} else if (getFeatures() & GF_FLOPPY) {
+			_dat->open("rtz.dat");
+			_res->open("rtz.prj");
+		} else {
+			error("Unknown RTZ game features");
+		}
+	} else if (getGameID() == GID_MANHOLE) {
+		_dat->open("manhole.dat");
+		_res->open("manhole.prj");
+	} else if (getGameID() == GID_LGOP2) {
+		_dat->open("lgop2.dat");
+		_res->open("lgop2.prj");
 	} else {
-		error("Unknown game features");
+		error ("Unknown MADE game");
 	}
 
 	_eventMouseX = _eventMouseY = 0;

Modified: scummvm/trunk/engines/made/made.h
===================================================================
--- scummvm/trunk/engines/made/made.h	2008-05-02 12:00:58 UTC (rev 31809)
+++ scummvm/trunk/engines/made/made.h	2008-05-02 12:08:06 UTC (rev 31810)
@@ -47,6 +47,12 @@
 
 namespace Made {
 
+enum MadeGameID {
+	GID_RTZ = 0,
+	GID_MANHOLE = 1,
+	GID_LGOP2 = 2
+};
+
 enum MadeGameFeatures {
 	GF_DEMO = 1 << 0,
 	GF_CD = 1 << 1,


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