[Scummvm-git-logs] scummvm master -> a97f66a529b54e3d8f157d9509a3ac5578ca206e

sev- sev at scummvm.org
Sat Nov 28 23:49:09 UTC 2020


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
aa0f898f85 TSAGE: Added support for uninstalled floppy version
a97f66a529 NEWS: Mention support for uninstalled floppy Blue Force


Commit: aa0f898f85f571afb4aaac983b18cbb7712c2665
    https://github.com/scummvm/scummvm/commit/aa0f898f85f571afb4aaac983b18cbb7712c2665
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-11-29T00:48:45+01:00

Commit Message:
TSAGE: Added support for uninstalled floppy version

Changed paths:
    engines/tsage/detection.h
    engines/tsage/detection_tables.h
    engines/tsage/resources.cpp
    engines/tsage/resources.h


diff --git a/engines/tsage/detection.h b/engines/tsage/detection.h
index e9afc97126..9e2adfc5e2 100644
--- a/engines/tsage/detection.h
+++ b/engines/tsage/detection.h
@@ -35,10 +35,11 @@ enum {
 };
 
 enum {
-	GF_DEMO = 1 << 0,
-	GF_CD = 1 << 1,
-	GF_FLOPPY = 1 << 2,
-	GF_ALT_REGIONS = 1 << 3
+	GF_DEMO			= 1 << 0,
+	GF_CD			= 1 << 1,
+	GF_FLOPPY		= 1 << 2,
+	GF_ALT_REGIONS	= 1 << 3,
+	GF_UNINSTALLED	= 1 << 4
 };
 
 struct tSageGameDescription {
diff --git a/engines/tsage/detection_tables.h b/engines/tsage/detection_tables.h
index 9bcc67c49f..7d5c383756 100644
--- a/engines/tsage/detection_tables.h
+++ b/engines/tsage/detection_tables.h
@@ -97,23 +97,22 @@ static const tSageGameDescription gameDescriptions[] = {
 		GType_Ringworld,
 		GF_FLOPPY | GF_DEMO | GF_ALT_REGIONS
 	},
-#if 0
-	// FIXME: Compute new MD5s based on 5000 bytes instead of 0 (unlimited)
-	// Blue Force floppy
+
+	// Blue Force floppy, uninstalled
 	{
 		{
 			"blueforce",
-			"Floppy",
-			AD_ENTRY1s("blue.rlb", "17c3993415e8a2cf93040eef7e88ec93", 1156508),
+			"Floppy, Uninstalled",
+			AD_ENTRY1s("blue.rlb", "0625e9f985e52bf221107f50672bd4c3", 1156508),
 			Common::EN_ANY,
 			Common::kPlatformDOS,
 			ADGF_UNSTABLE,
 			GUIO2(GUIO_NOSPEECH, GUIO_NOSFX)
 		},
 		GType_BlueForce,
-		GF_FLOPPY
+		GF_FLOPPY | GF_UNINSTALLED
 	},
-#endif
+
 	// Blue Force
 	{
 		{
diff --git a/engines/tsage/resources.cpp b/engines/tsage/resources.cpp
index d4b922a1c3..1b2479cbf1 100644
--- a/engines/tsage/resources.cpp
+++ b/engines/tsage/resources.cpp
@@ -148,14 +148,69 @@ TLib::TLib(MemoryManager &memManager, const Common::String &filename) :
 		}
 	}
 
-	if (!_file.open(filename))
-		error("Missing file %s", filename.c_str());
+	if (g_vm->getFeatures() & GF_UNINSTALLED && g_vm->getGameID() == GType_BlueForce &&
+			(filename.equals("BLUE.RLB") || filename.equals("FILES.RLB"))) {
+
+		// Let's recostruct the files from the parts. File headers are just skipped
+		byte *data;
+		uint32 size;
+
+		Common::File f;
+		if (!f.open(filename))
+			error("Missing file %s", filename.c_str());
+
+		size = f.size() - 18; // First file header
+		data = (byte *)malloc(size);
+		f.skip(18);
+		f.read(data, size);
+
+		f.close();
+
+		if (filename.equals("BLUE.RLB")) {
+			for (int i = 2; i < 9; i++) {
+				Common::String partname = Common::String::format("BLUE.#0%d", i);
+
+				if (!f.open(partname))
+					error("Missing file %s", partname.c_str());
+
+				uint32 partsize = f.size() - 4;	// Further headers
+				byte *newdata = (byte *)realloc(data, size + partsize);
+
+				if (!newdata)
+					error("Cannot realloc %d bytes", size + partsize);
+
+				data = newdata;
+
+				f.skip(4);
+				f.read(data + size, partsize);
+				size += partsize;
+
+				f.close();
+			}
+		}
+
+		warning("File %s: resulting size is %d bytes", filename.c_str(), size);
+
+		Common::MemoryReadStream *stream = new Common::MemoryReadStream(data, size, DisposeAfterUse::YES);
+
+		_file = stream;
+
+	} else {
+		Common::File *f = new Common::File;
+
+		if (!f->open(filename))
+			error("Missing file %s", filename.c_str());
+
+		_file = f;
+	}
 
 	loadIndex();
 }
 
 TLib::~TLib() {
 	_resStrings.clear();
+
+	delete _file;
 }
 
 /**
@@ -163,7 +218,7 @@ TLib::~TLib() {
  */
 void TLib::loadSection(uint32 fileOffset) {
 	_resources.clear();
-	_file.seek(fileOffset);
+	_file->seek(fileOffset);
 	_sections.fileOffset = fileOffset;
 
 	ResourceManager::loadSection(_file, _resources);
@@ -196,8 +251,8 @@ byte *TLib::getResource(uint16 id, bool suppressErrors) {
 	if (!re->isCompressed) {
 		// Read in the resource data and return it
 		byte *dataP = _memoryManager.allocate2(re->size);
-		_file.seek(_sections.fileOffset + re->fileOffset);
-		_file.read(dataP, re->size);
+		_file->seek(_sections.fileOffset + re->fileOffset);
+		_file->read(dataP, re->size);
 
 		return dataP;
 	}
@@ -206,8 +261,8 @@ byte *TLib::getResource(uint16 id, bool suppressErrors) {
 	 * Decompress the data block
 	 */
 
-	_file.seek(_sections.fileOffset + re->fileOffset);
-	Common::ReadStream *compStream = _file.readStream(re->size);
+	_file->seek(_sections.fileOffset + re->fileOffset);
+	Common::ReadStream *compStream = _file->readStream(re->size);
 	BitReader bitReader(*compStream);
 
 	byte *dataOut = _memoryManager.allocate2(re->uncompressedSize);
@@ -541,7 +596,7 @@ bool ResourceManager::scanIndex(Common::File &f, ResourceType resType, int rlbNu
 									  ResourceEntry &resEntry) {
 	// Load the root section index
 	ResourceList resList;
-	loadSection(f, resList);
+	loadSection(&f, resList);
 
 	// Loop through the index for the desired entry
 	ResourceList::iterator iter;
@@ -562,21 +617,21 @@ bool ResourceManager::scanIndex(Common::File &f, ResourceType resType, int rlbNu
 /**
  * Inner logic for decoding a section index into a passed resource list object
  */
-void ResourceManager::loadSection(Common::File &f, ResourceList &resources) {
-	if (f.readUint32BE() != 0x544D492D)
+void ResourceManager::loadSection(Common::SeekableReadStream *f, ResourceList &resources) {
+	if (f->readUint32BE() != 0x544D492D)
 		error("Data block is not valid Rlb data");
 
-	/*uint8 unknown1 = */f.readByte();
-	uint16 numEntries = f.readByte();
+	/*uint8 unknown1 = */f->readByte();
+	uint16 numEntries = f->readByte();
 
 	for (uint i = 0; i < numEntries; ++i) {
-		uint16 id = f.readUint16LE();
-		uint16 size = f.readUint16LE();
-		uint16 uncSize = f.readUint16LE();
-		uint8 sizeHi = f.readByte();
-		uint8 type = f.readByte() >> 5;
+		uint16 id = f->readUint16LE();
+		uint16 size = f->readUint16LE();
+		uint16 uncSize = f->readUint16LE();
+		uint8 sizeHi = f->readByte();
+		uint8 type = f->readByte() >> 5;
 		assert(type <= 1);
-		uint32 offset = f.readUint32LE();
+		uint32 offset = f->readUint32LE();
 
 		ResourceEntry re;
 		re.id = id;
diff --git a/engines/tsage/resources.h b/engines/tsage/resources.h
index 7aa0c49dd4..8ab73e91ca 100644
--- a/engines/tsage/resources.h
+++ b/engines/tsage/resources.h
@@ -144,7 +144,7 @@ private:
 	Common::StringArray _resStrings;
 	MemoryManager &_memoryManager;
 private:
-	Common::File _file;
+	Common::SeekableReadStream *_file;
 	Common::String _filename;
 	ResourceList _resources;
 	SectionList _sections;
@@ -181,7 +181,7 @@ public:
 	TLib &first() { return **_libList.begin(); }
 
 	static bool scanIndex(Common::File &f, ResourceType resType, int rlbNum, int resNum, ResourceEntry &resEntry);
-	static void loadSection(Common::File &f, ResourceList &resources);
+	static void loadSection(Common::SeekableReadStream *f, ResourceList &resources);
 };
 
 


Commit: a97f66a529b54e3d8f157d9509a3ac5578ca206e
    https://github.com/scummvm/scummvm/commit/a97f66a529b54e3d8f157d9509a3ac5578ca206e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-11-29T00:48:45+01:00

Commit Message:
NEWS: Mention support for uninstalled floppy Blue Force

Changed paths:
    NEWS.md


diff --git a/NEWS.md b/NEWS.md
index eb0a168861..1dc2d327d6 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -56,6 +56,9 @@ For a more comprehensive changelog of the latest experimental code, see:
  Tinsel:
    - Enabled the Return to Launcher feature.
 
+ TsAGE:
+   - Added support for uninstalled floppy version.
+
  Stark:
    - Added support for Hungarian translation.
 




More information about the Scummvm-git-logs mailing list