[Scummvm-git-logs] scummvm master -> 034df5c465c3daf2036aec2bbd3605f9e6f58679

neuromancer noreply at scummvm.org
Sun May 28 17:31:49 UTC 2023


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:
70c94e3a71 FREESCAPE: added code to decrypt dark for amiga/atari
415efcc2c9 FREESCAPE: added code to decrypt some driller releases for atari
034df5c465 FREESCAPE: added better detection of driller releases for atari


Commit: 70c94e3a7159355a03568ae6afeaa86e68253cf2
    https://github.com/scummvm/scummvm/commit/70c94e3a7159355a03568ae6afeaa86e68253cf2
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-05-28T19:33:43+02:00

Commit Message:
FREESCAPE: added code to decrypt dark for amiga/atari

Changed paths:
  A engines/freescape/games/dark/amiga.cpp
    engines/freescape/detection.cpp
    engines/freescape/freescape.h
    engines/freescape/module.mk


diff --git a/engines/freescape/detection.cpp b/engines/freescape/detection.cpp
index 01b3f1d2412..118996af34e 100644
--- a/engines/freescape/detection.cpp
+++ b/engines/freescape/detection.cpp
@@ -252,6 +252,19 @@ static const ADGameDescription gameDescriptions[] = {
 		ADGF_UNSUPPORTED | ADGF_DEMO,
 		GUIO2(GUIO_NOMIDI, GAMEOPTION_AUTOMATIC_DRILLING)
 	},
+	{
+		"darkside",
+		"",
+		{
+			{"0.DRK", 0, "9e51b8f93a9af886fb88ab92ed43cf01", 81544},
+			{"1.DRK", 0, "50bbaa2b19fc4072ad85efe93116e561", 280704},
+			AD_LISTEND
+		},
+		Common::EN_ANY,
+		Common::kPlatformAmiga,
+		ADGF_UNSTABLE,
+		GUIO1(GUIO_NOMIDI)
+	},
 	{
 		"darkside",
 		"",
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 299cebcfbd9..d6816326828 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -531,6 +531,7 @@ public:
 
 	void loadAssetsDOSFullGame() override;
 	void loadAssetsDOSDemo() override;
+	void loadAssetsAmigaFullGame() override;
 
 	void loadAssetsZXDemo() override;
 
@@ -548,6 +549,7 @@ private:
 	void addECDs(Area *area);
 	void addECD(Area *area, const Math::Vector3d position, int index);
 	void addWalls(Area *area);
+	Common::SeekableReadStream *decryptFile(const Common::String filename);
 };
 
 class EclipseEngine : public FreescapeEngine {
diff --git a/engines/freescape/games/dark/amiga.cpp b/engines/freescape/games/dark/amiga.cpp
new file mode 100644
index 00000000000..fcc2b4c8f71
--- /dev/null
+++ b/engines/freescape/games/dark/amiga.cpp
@@ -0,0 +1,78 @@
+/* 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/language/8bitDetokeniser.h"
+
+namespace Freescape {
+
+Common::SeekableReadStream *DarkEngine::decryptFile(const Common::String filename) {
+	Common::File file;
+	file.open(filename);
+	if (!file.isOpen())
+		error("Failed to open %s", filename.c_str());
+
+	int size = file.size();
+	byte *encryptedBuffer = (byte *)malloc(size);
+	file.read(encryptedBuffer, size);
+	file.close();
+
+    uint32 d7 = 0;
+    uint32 d6 = 0;
+	byte *a6 = encryptedBuffer;
+    byte *a5 = encryptedBuffer + size - 1;
+
+	while (a6 <= a5) {
+		uint64 d0 = (a6[0] << 24) | (a6[1] << 16) | (a6[2] << 8) | a6[3];
+		d0 = d0 + d6;
+		d0 = uint32(d0);
+		d0 = ((d0 << 3) & 0xFFFFFFFF) | ((d0 >> 29) & 0xFFFFFFFF);
+		d0 ^= 0x71049763;
+		d0 -= d7;
+		d0 = ((d0 << 16) & 0xFFFF0000) | ((d0 >> 16) & 0xFFFF);
+
+        a6[0] = byte((d0 >> 24) & 0xFF);
+		//debug("%c", a6[0]);
+        a6[1] = byte((d0 >> 16) & 0xFF);
+		//debug("%c", a6[1]);
+        a6[2] = byte((d0 >> 8) & 0xFF);
+		//debug("%c", a6[2]);
+        a6[3] = byte(d0 & 0xFF);
+		//debug("%c", a6[3]);
+
+		d6 += 5;
+		d6 = ((d6 >> 3) & 0xFFFFFFFF) | ((d6 << 29) & 0xFFFFFFFF);
+		d6 ^= 0x04000000;
+		d7 += 4;
+		a6 += 4;
+	}
+
+	return (new Common::MemoryReadStream(encryptedBuffer, size));
+}
+
+void DarkEngine::loadAssetsAmigaFullGame() {
+	Common::SeekableReadStream *stream = decryptFile("1.drk");
+	load8bitBinary(stream, 0x2e96a, 16);
+}
+
+} // End of namespace Freescape
\ No newline at end of file
diff --git a/engines/freescape/module.mk b/engines/freescape/module.mk
index 3db7785ab67..2cd78466e42 100644
--- a/engines/freescape/module.mk
+++ b/engines/freescape/module.mk
@@ -6,6 +6,7 @@ MODULE_OBJS := \
 	demo.o \
 	freescape.o \
 	games/castle.o \
+	games/dark/amiga.o \
 	games/dark/dark.o \
 	games/dark/dos.o \
 	games/dark/zx.o \


Commit: 415efcc2c9cb25efe9dea9d38255b725784e26dc
    https://github.com/scummvm/scummvm/commit/415efcc2c9cb25efe9dea9d38255b725784e26dc
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-05-28T19:33:43+02:00

Commit Message:
FREESCAPE: added code to decrypt some driller releases for atari

Changed paths:
    engines/freescape/detection.cpp
    engines/freescape/freescape.h
    engines/freescape/games/driller/atari.cpp


diff --git a/engines/freescape/detection.cpp b/engines/freescape/detection.cpp
index 118996af34e..6577c2a919f 100644
--- a/engines/freescape/detection.cpp
+++ b/engines/freescape/detection.cpp
@@ -157,7 +157,20 @@ static const ADGameDescription gameDescriptions[] = {
 		ADGF_NO_FLAGS,
 		GUIO4(GUIO_NOMIDI, GUIO_RENDEREGA, GUIO_RENDERCGA, GAMEOPTION_AUTOMATIC_DRILLING)
 	},
-	{
+	{ // Retail release
+		"driller",
+		"",
+		{
+			{"x.prg", 0, "d002983a8b652f25b18a09425db78c4c", 293159},
+			{"playseq.prg", 0, "535e9f6baf132831aa7fa066a06f242e", 973},
+			AD_LISTEND
+		},
+		Common::EN_ANY,
+		Common::kPlatformAtariST,
+		GF_ATARI_RETAIL,
+		GUIO2(GUIO_NOMIDI, GAMEOPTION_AUTOMATIC_DRILLING)
+	},
+	{ // Budget release
 		"driller",
 		"",
 		{
@@ -167,7 +180,7 @@ static const ADGameDescription gameDescriptions[] = {
 		},
 		Common::EN_ANY,
 		Common::kPlatformAtariST,
-		ADGF_NO_FLAGS,
+		GF_ATARI_BUDGET,
 		GUIO2(GUIO_NOMIDI, GAMEOPTION_AUTOMATIC_DRILLING)
 	},
 	{
@@ -340,7 +353,7 @@ static const ADGameDescription gameDescriptions[] = {
 		"spacestationoblivion",
 		"",
 		{
-			{"x.prg", 0, "10c556ee637bf03bcc1a051277542102", 293264},
+			{"x.prg", 0, "bf546ee243c38f51d9beb25c203ccb93", 292624},
 			AD_LISTEND
 		},
 		Common::EN_ANY,
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index d6816326828..e011af256f7 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -427,6 +427,8 @@ enum DrillerReleaseFlags {
 		GF_CPC_RETAIL2 = (1 << 6),
 		GF_CPC_BUDGET = (1 << 7),
 		GF_CPC_VIRTUALWORLDS = (1 << 8),
+		GF_ATARI_RETAIL = (1 << 9),
+		GF_ATARI_BUDGET = (1 << 10),
 };
 
 class DrillerEngine : public FreescapeEngine {
@@ -509,6 +511,8 @@ private:
 
 	uint32 getPixel8bitTitleImage(int index);
 	void renderPixels8bitTitleImage(Graphics::ManagedSurface *surface, int &i, int &j, int pixels);
+
+	Common::SeekableReadStream *decryptFileAtari(const Common::String filename);
 };
 
 class DarkEngine : public FreescapeEngine {
diff --git a/engines/freescape/games/driller/atari.cpp b/engines/freescape/games/driller/atari.cpp
index 143920cb119..df588dd62b6 100644
--- a/engines/freescape/games/driller/atari.cpp
+++ b/engines/freescape/games/driller/atari.cpp
@@ -19,34 +19,83 @@
  *
  */
 #include "common/file.h"
+#include "common/memstream.h"
 
 #include "freescape/freescape.h"
 #include "freescape/language/8bitDetokeniser.h"
 
 namespace Freescape {
 
-void DrillerEngine::loadAssetsAtariFullGame() {
+Common::SeekableReadStream *DrillerEngine::decryptFileAtari(const Common::String filename) {
 	Common::File file;
-	file.open("x.prg");
-
+	file.open(filename);
 	if (!file.isOpen())
-		error("Failed to open 'x.prg' executable for AtariST");
-
-	_border = loadAndConvertNeoImage(&file, 0x1371a);
-	byte *palette = (byte *)malloc(16 * 3);
-	for (int i = 0; i < 16; i++) { // gray scale palette
-		palette[i * 3 + 0] = i * (255 / 16);
-		palette[i * 3 + 1] = i * (255 / 16);
-		palette[i * 3 + 2] = i * (255 / 16);
+		error("Failed to open %s", filename.c_str());
+
+	int size = file.size();
+	byte *encryptedBuffer = (byte *)malloc(size);
+	file.read(encryptedBuffer, size);
+	file.close();
+
+	byte *a6 = encryptedBuffer + 0x118;
+	byte *a5 = encryptedBuffer + size - 4;
+	uint64 key = 0xb9f11bce;
+
+	while (a6 <= a5) {
+		uint64 d0 = (a6[0] << 24) | (a6[1] << 16) | (a6[2] << 8) | a6[3];
+		d0 += key;
+		d0 = uint32(d0);
+
+		a6[0] = byte((d0 >> 24) & 0xFF);
+		a6[1] = byte((d0 >> 16) & 0xFF);
+		a6[2] = byte((d0 >> 8) & 0xFF);
+		a6[3] = byte(d0 & 0xFF);
+
+		key += 0x51684624;
+		key = uint32(key);
+		a6 += 4;
+	}
+
+	return (new Common::MemoryReadStream(encryptedBuffer, size));
+}
+
+void DrillerEngine::loadAssetsAtariFullGame() {
+
+	if (_variant & GF_ATARI_RETAIL) {
+		Common::SeekableReadStream *stream = decryptFileAtari("x.prg");
+
+		_border = loadAndConvertNeoImage(stream, 0x14b96);
+		_title = loadAndConvertNeoImage(stream, 0x1c916);
+
+		loadFonts(stream, 0x8a92);
+		loadMessagesFixedSize(stream, 0xda22, 14, 20);
+		loadGlobalObjects(stream, 0xd116, 8);
+		load8bitBinary(stream, 0x2afb8, 16);
+		loadPalettes(stream, 0x2ab76);
+		//loadSoundsFx(&file, 0x30da6, 25);
+	} else if (_variant & GF_ATARI_BUDGET) {
+		Common::File file;
+		file.open("x.prg");
+
+		if (!file.isOpen())
+			error("Failed to open 'x.prg' executable for AtariST");
+
+		_border = loadAndConvertNeoImage(&file, 0x1371a);
+		byte *palette = (byte *)malloc(16 * 3);
+		for (int i = 0; i < 16; i++) { // gray scale palette
+			palette[i * 3 + 0] = i * (255 / 16);
+			palette[i * 3 + 1] = i * (255 / 16);
+			palette[i * 3 + 2] = i * (255 / 16);
+		}
+		_title = loadAndConvertNeoImage(&file, 0x10, palette);
+
+		loadFonts(&file, 0x8a32);
+		loadMessagesFixedSize(&file, 0xc5d8, 14, 20);
+		loadGlobalObjects(&file, 0xbccc, 8);
+		load8bitBinary(&file, 0x29b3c, 16);
+		loadPalettes(&file, 0x296fa);
+		loadSoundsFx(&file, 0x30da6, 25);
 	}
-	_title = loadAndConvertNeoImage(&file, 0x10, palette);
-
-	loadFonts(&file, 0x8a32);
-	loadMessagesFixedSize(&file, 0xc5d8, 14, 20);
-	loadGlobalObjects(&file, 0xbccc, 8);
-	load8bitBinary(&file, 0x29b3c, 16);
-	loadPalettes(&file, 0x296fa);
-	loadSoundsFx(&file, 0x30da6, 25);
 }
 
 void DrillerEngine::loadAssetsAtariDemo() {


Commit: 034df5c465c3daf2036aec2bbd3605f9e6f58679
    https://github.com/scummvm/scummvm/commit/034df5c465c3daf2036aec2bbd3605f9e6f58679
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-05-28T19:33:43+02:00

Commit Message:
FREESCAPE: added better detection of driller releases for atari

Changed paths:
    engines/freescape/detection.cpp


diff --git a/engines/freescape/detection.cpp b/engines/freescape/detection.cpp
index 6577c2a919f..6c70c1e1895 100644
--- a/engines/freescape/detection.cpp
+++ b/engines/freescape/detection.cpp
@@ -162,7 +162,6 @@ static const ADGameDescription gameDescriptions[] = {
 		"",
 		{
 			{"x.prg", 0, "d002983a8b652f25b18a09425db78c4c", 293159},
-			{"playseq.prg", 0, "535e9f6baf132831aa7fa066a06f242e", 973},
 			AD_LISTEND
 		},
 		Common::EN_ANY,
@@ -175,7 +174,6 @@ static const ADGameDescription gameDescriptions[] = {
 		"",
 		{
 			{"x.prg", 0, "1a79e68e6c2c223c96de0ca2d65149ae", 293062},
-			{"playseq.prg", 0, "535e9f6baf132831aa7fa066a06f242e", 973},
 			AD_LISTEND
 		},
 		Common::EN_ANY,
@@ -183,6 +181,19 @@ static const ADGameDescription gameDescriptions[] = {
 		GF_ATARI_BUDGET,
 		GUIO2(GUIO_NOMIDI, GAMEOPTION_AUTOMATIC_DRILLING)
 	},
+	{ // Virtual Worlds release
+		"driller",
+		"This relese requieres unpacking, check the wiki for instructions:\nhttps://wiki.scummvm.org/index.php?title=Driller#AtariST_releases",
+		{
+			{"d.pak", 0, "607b44b9d31e0da5668b653e03d25efe", 706},
+			{"dril.all", 0, "65277222effa1eb4d73b234245001d75", 158158},
+			AD_LISTEND
+		},
+		Common::EN_ANY,
+		Common::kPlatformAtariST,
+		ADGF_UNSUPPORTED,
+		GUIO2(GUIO_NOMIDI, GAMEOPTION_AUTOMATIC_DRILLING)
+	},
 	{
 		"driller",
 		"",
@@ -361,6 +372,18 @@ static const ADGameDescription gameDescriptions[] = {
 		ADGF_UNSUPPORTED,
 		GUIO2(GUIO_NOMIDI, GAMEOPTION_AUTOMATIC_DRILLING)
 	},
+	{
+		"spacestationoblivion",
+		"",
+		{
+			{"x.prg", 0, "10c556ee637bf03bcc1a051277542102", 293264},
+			AD_LISTEND
+		},
+		Common::EN_ANY,
+		Common::kPlatformAtariST,
+		ADGF_UNSUPPORTED,
+		GUIO2(GUIO_NOMIDI, GAMEOPTION_AUTOMATIC_DRILLING)
+	},
 	{
 		"castlemaster",
 		"Demo",




More information about the Scummvm-git-logs mailing list