[Scummvm-git-logs] scummvm master -> 5598be22b8376c2dc0a592861391b2d801ed493e

neuromancer noreply at scummvm.org
Fri Apr 5 09:31:57 UTC 2024


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

Summary:
1900f5eaad FREESCAPE: added more eclipse releases for amiga/atari
0ce9cbe151 FREESCAPE: improve decryption for dark releases for amiga/atari
5598be22b8 FREESCAPE: initial parsing of filename table for dark releases from amiga/atari


Commit: 1900f5eaadb30150e56a54e536e56131077a7c93
    https://github.com/scummvm/scummvm/commit/1900f5eaadb30150e56a54e536e56131077a7c93
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-04-05T11:25:59+02:00

Commit Message:
FREESCAPE: added more eclipse releases for amiga/atari

Changed paths:
    engines/freescape/detection.cpp


diff --git a/engines/freescape/detection.cpp b/engines/freescape/detection.cpp
index 9a7b8f7e39d..870355ffb4d 100644
--- a/engines/freescape/detection.cpp
+++ b/engines/freescape/detection.cpp
@@ -570,6 +570,32 @@ static const ADGameDescription gameDescriptions[] = {
 		ADGF_TESTING,
 		GUIO3(GUIO_NOMIDI, GUIO_RENDEREGA, GUIO_RENDERCGA)
 	},
+	{
+		"totaleclipse",
+		"",
+		{
+			{"0.TEC", 0, "e8b362cd913a2d58f8601e4df11a643a", 89500},
+			{"1.TEC", 0, "3a2e304706bde3e34ac2a730eff8567b", 305286},
+			AD_LISTEND
+		},
+		Common::EN_ANY,
+		Common::kPlatformAmiga,
+		ADGF_UNSUPPORTED,
+		GUIO1(GUIO_NOMIDI)
+	},
+	{ // Stampede Atari, Issue 7
+		"totaleclipse",
+		"",
+		{
+			{"0.TEC", 0, "c20a3bfea7147f73dc4fcd8aecf4faf8", 49402},
+			{"1.TEC", 0, "fb65655f60b11040285aa947d4ed1193", 263453},
+			AD_LISTEND
+		},
+		Common::EN_ANY,
+		Common::kPlatformAtariST,
+		ADGF_UNSUPPORTED,
+		GUIO1(GUIO_NOMIDI)
+	},
 	{
 		"spacestationoblivion",
 		"",


Commit: 0ce9cbe151af8a859cf2677d734dfc257490242c
    https://github.com/scummvm/scummvm/commit/0ce9cbe151af8a859cf2677d734dfc257490242c
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-04-05T11:25:59+02:00

Commit Message:
FREESCAPE: improve decryption for dark releases for amiga/atari

Changed paths:
  A engines/freescape/games/dark/atari.cpp
    engines/freescape/games/dark/amiga.cpp
    engines/freescape/games/dark/dark.h
    engines/freescape/loaders/8bitBinaryLoader.cpp
    engines/freescape/module.mk


diff --git a/engines/freescape/games/dark/amiga.cpp b/engines/freescape/games/dark/amiga.cpp
index a00e8f5dd26..bc2a008bfa6 100644
--- a/engines/freescape/games/dark/amiga.cpp
+++ b/engines/freescape/games/dark/amiga.cpp
@@ -27,21 +27,21 @@
 
 namespace Freescape {
 
-Common::SeekableReadStream *DarkEngine::decryptFile(const Common::Path &filename) {
+Common::SeekableReadStream *DarkEngine::decryptFile(const Common::Path &packed, const Common::Path &unpacker, uint32 unpackArrayOffset) {
 	Common::File file;
-	file.open(filename);
+	file.open(packed);
 	if (!file.isOpen())
-		error("Failed to open %s", filename.toString().c_str());
+		error("Failed to open %s", packed.toString().c_str());
 
 	int size = file.size();
 	byte *encryptedBuffer = (byte *)malloc(size);
 	file.read(encryptedBuffer, size);
 	file.close();
 
-    uint32 d7 = 0;
-    uint32 d6 = 0;
+	uint32 d7 = 0;
+	uint32 d6 = 0;
 	byte *a6 = encryptedBuffer;
-    byte *a5 = encryptedBuffer + size - 1;
+	byte *a5 = encryptedBuffer + size - 1;
 
 	while (a6 <= a5) {
 		uint64 d0 = (a6[0] << 24) | (a6[1] << 16) | (a6[2] << 8) | a6[3];
@@ -52,13 +52,13 @@ Common::SeekableReadStream *DarkEngine::decryptFile(const Common::Path &filename
 		d0 -= d7;
 		d0 = ((d0 << 16) & 0xFFFF0000) | ((d0 >> 16) & 0xFFFF);
 
-        a6[0] = byte((d0 >> 24) & 0xFF);
+		a6[0] = byte((d0 >> 24) & 0xFF);
 		//debug("%c", a6[0]);
-        a6[1] = byte((d0 >> 16) & 0xFF);
+		a6[1] = byte((d0 >> 16) & 0xFF);
 		//debug("%c", a6[1]);
-        a6[2] = byte((d0 >> 8) & 0xFF);
+		a6[2] = byte((d0 >> 8) & 0xFF);
 		//debug("%c", a6[2]);
-        a6[3] = byte(d0 & 0xFF);
+		a6[3] = byte(d0 & 0xFF);
 		//debug("%c", a6[3]);
 
 		d6 += 5;
@@ -68,17 +68,40 @@ Common::SeekableReadStream *DarkEngine::decryptFile(const Common::Path &filename
 		a6 += 4;
 	}
 
-	return (new Common::MemoryReadStream(encryptedBuffer, size));
+	file.open(unpacker);
+	if (!file.isOpen())
+		error("Failed to open %s", unpacker.toString().c_str());
+
+	int originalSize = size;
+	size = file.size();
+	byte *unpackArray = (byte *)malloc(size);
+	file.read(unpackArray, size);
+	file.close();
+
+	byte *unpackArrayPtr = unpackArray + unpackArrayOffset;
+	uint32 i = 2 * 1024;
+	do {
+		uint8 ptr0 = unpackArrayPtr[2 * i];
+		uint8 ptr1 = unpackArrayPtr[2 * i + 1];
+		uint8 val0 = unpackArrayPtr[2 * (i - 1)];
+		uint8 val1 = unpackArrayPtr[2 * (i - 1) + 1];
+
+		encryptedBuffer[2 * (ptr1 + 256 * ptr0)] = val0;
+		encryptedBuffer[2 * (ptr1 + 256 * ptr0) + 1] = val1;
+
+		i = i - 2;
+	} while (i > 0);
+
+	return (new Common::MemoryReadStream(encryptedBuffer, originalSize));
 }
 
 void DarkEngine::loadAssetsAmigaFullGame() {
-	Common::SeekableReadStream *stream = decryptFile("1.drk");
+	Common::SeekableReadStream *stream = decryptFile("1.drk", "0.drk", 798);
 	_border = loadAndConvertNeoImage(stream, 0x1b762);
 	load8bitBinary(stream, 0x2e96a, 16);
 	loadPalettes(stream, 0x2e638);
 	loadGlobalObjects(stream, 0x30f0 - 50, 24);
 	loadMessagesVariableSize(stream, 0x3d37, 66);
-	_areaMap[255]->changeObjectID(11, 250);
 
 	for (auto &it : _areaMap) {
 		addWalls(it._value);
diff --git a/engines/freescape/games/dark/atari.cpp b/engines/freescape/games/dark/atari.cpp
new file mode 100644
index 00000000000..8bf481e230e
--- /dev/null
+++ b/engines/freescape/games/dark/atari.cpp
@@ -0,0 +1,45 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#include "common/file.h"
+#include "common/memstream.h"
+
+#include "freescape/freescape.h"
+#include "freescape/games/dark/dark.h"
+#include "freescape/language/8bitDetokeniser.h"
+
+namespace Freescape {
+
+void DarkEngine::loadAssetsAtariFullGame() {
+	Common::SeekableReadStream *stream = decryptFile("1.drk", "0.drk", 840);
+	_border = loadAndConvertNeoImage(stream, 0xd710);
+	load8bitBinary(stream, 0x20918, 16);
+	loadMessagesVariableSize(stream, 0x3f6f, 66);
+	loadPalettes(stream, 0x205e6);
+	loadGlobalObjects(stream, 0x32f6, 24);
+
+	for (auto &it : _areaMap) {
+		addWalls(it._value);
+		addECDs(it._value);
+		addSkanner(it._value);
+	}
+}
+
+} // End of namespace Freescape
diff --git a/engines/freescape/games/dark/dark.h b/engines/freescape/games/dark/dark.h
index 8ccf168d091..75a20278550 100644
--- a/engines/freescape/games/dark/dark.h
+++ b/engines/freescape/games/dark/dark.h
@@ -65,6 +65,8 @@ public:
 	void loadAssetsDOSFullGame() override;
 	void loadAssetsDOSDemo() override;
 	void loadAssetsAmigaFullGame() override;
+	void loadAssetsAtariFullGame() override;
+
 
 	void loadAssetsCPCFullGame() override;
 
@@ -99,7 +101,7 @@ private:
 	bool tryDestroyECD(int index);
 	bool tryDestroyECDFullGame(int index);
 	void addWalls(Area *area);
-	Common::SeekableReadStream *decryptFile(const Common::Path &filename);
+	Common::SeekableReadStream *decryptFile(const Common::Path &packed, const Common::Path &unpacker, uint32 unpackArrayOffset);
 	Common::HashMap<uint16, bool> _exploredAreas;
 };
 
diff --git a/engines/freescape/loaders/8bitBinaryLoader.cpp b/engines/freescape/loaders/8bitBinaryLoader.cpp
index 1961ba080da..cce00b8345a 100644
--- a/engines/freescape/loaders/8bitBinaryLoader.cpp
+++ b/engines/freescape/loaders/8bitBinaryLoader.cpp
@@ -625,7 +625,7 @@ Area *FreescapeEngine::load8bitArea(Common::SeekableReadStream *file, uint16 nco
 
 	int64 endLastObject = file->pos();
 	debugC(1, kFreescapeDebugParser, "Last position %lx", endLastObject);
-	if (isDark() && isAmiga())
+	if (isDark() && (isAmiga() || isAtariST()))
 		assert(endLastObject <= static_cast<int64>(base + cPtr));
 	else
 		assert(endLastObject == static_cast<int64>(base + cPtr) || areaNumber == 192);
diff --git a/engines/freescape/module.mk b/engines/freescape/module.mk
index 66ee16abfd1..e4df9695d3c 100644
--- a/engines/freescape/module.mk
+++ b/engines/freescape/module.mk
@@ -8,6 +8,7 @@ MODULE_OBJS := \
 	freescape.o \
 	games/castle/castle.o \
 	games/dark/amiga.o \
+	games/dark/atari.o \
 	games/dark/cpc.o \
 	games/dark/dark.o \
 	games/dark/dos.o \


Commit: 5598be22b8376c2dc0a592861391b2d801ed493e
    https://github.com/scummvm/scummvm/commit/5598be22b8376c2dc0a592861391b2d801ed493e
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-04-05T11:25:59+02:00

Commit Message:
FREESCAPE: initial parsing of filename table for dark releases from amiga/atari

Changed paths:
    engines/freescape/games/dark/amiga.cpp
    engines/freescape/games/dark/atari.cpp
    engines/freescape/games/dark/dark.h


diff --git a/engines/freescape/games/dark/amiga.cpp b/engines/freescape/games/dark/amiga.cpp
index bc2a008bfa6..12c6decbde6 100644
--- a/engines/freescape/games/dark/amiga.cpp
+++ b/engines/freescape/games/dark/amiga.cpp
@@ -95,8 +95,27 @@ Common::SeekableReadStream *DarkEngine::decryptFile(const Common::Path &packed,
 	return (new Common::MemoryReadStream(encryptedBuffer, originalSize));
 }
 
+void DarkEngine::parseAmigaAtariHeader(Common::SeekableReadStream *stream) {
+	stream->seek(0x22);
+	int size = stream->readUint16BE();
+	debugC(1, kFreescapeDebugParser, "Header table size %d", size);
+	for (int i = 0; i < size; i++) {
+		debugC(1, kFreescapeDebugParser, "Location: %x ", stream->readUint32BE());
+		Common::String filename;
+		while (char c = stream->readByte())
+			filename += c;
+
+		for (int j = filename.size() + 1; j < 16; j++)
+			stream->readByte();
+
+		debugC(1, kFreescapeDebugParser, "Filename: %s", filename.c_str());
+	}
+}
+
 void DarkEngine::loadAssetsAmigaFullGame() {
 	Common::SeekableReadStream *stream = decryptFile("1.drk", "0.drk", 798);
+	parseAmigaAtariHeader(stream);
+
 	_border = loadAndConvertNeoImage(stream, 0x1b762);
 	load8bitBinary(stream, 0x2e96a, 16);
 	loadPalettes(stream, 0x2e638);
diff --git a/engines/freescape/games/dark/atari.cpp b/engines/freescape/games/dark/atari.cpp
index 8bf481e230e..00d5d2dde66 100644
--- a/engines/freescape/games/dark/atari.cpp
+++ b/engines/freescape/games/dark/atari.cpp
@@ -29,6 +29,8 @@ namespace Freescape {
 
 void DarkEngine::loadAssetsAtariFullGame() {
 	Common::SeekableReadStream *stream = decryptFile("1.drk", "0.drk", 840);
+	parseAmigaAtariHeader(stream);
+
 	_border = loadAndConvertNeoImage(stream, 0xd710);
 	load8bitBinary(stream, 0x20918, 16);
 	loadMessagesVariableSize(stream, 0x3f6f, 66);
diff --git a/engines/freescape/games/dark/dark.h b/engines/freescape/games/dark/dark.h
index 75a20278550..ad8e160da2f 100644
--- a/engines/freescape/games/dark/dark.h
+++ b/engines/freescape/games/dark/dark.h
@@ -66,7 +66,7 @@ public:
 	void loadAssetsDOSDemo() override;
 	void loadAssetsAmigaFullGame() override;
 	void loadAssetsAtariFullGame() override;
-
+	void parseAmigaAtariHeader(Common::SeekableReadStream *file);
 
 	void loadAssetsCPCFullGame() override;
 




More information about the Scummvm-git-logs mailing list