[Scummvm-git-logs] scummvm master -> f2e12bf04a477f6199913a4b495f3317c78e3952
neuromancer
noreply at scummvm.org
Wed Jun 5 21:04:45 UTC 2024
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
f2e12bf04a FREESCAPE: initial support for eclipse for atari st
Commit: f2e12bf04a477f6199913a4b495f3317c78e3952
https://github.com/scummvm/scummvm/commit/f2e12bf04a477f6199913a4b495f3317c78e3952
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-06-05T23:01:16+02:00
Commit Message:
FREESCAPE: initial support for eclipse for atari st
Changed paths:
A engines/freescape/games/eclipse/atari.cpp
engines/freescape/detection.cpp
engines/freescape/freescape.h
engines/freescape/games/dark/amiga.cpp
engines/freescape/games/dark/atari.cpp
engines/freescape/games/dark/dark.h
engines/freescape/games/eclipse/eclipse.cpp
engines/freescape/games/eclipse/eclipse.h
engines/freescape/games/palettes.cpp
engines/freescape/loaders/8bitBinaryLoader.cpp
engines/freescape/module.mk
diff --git a/engines/freescape/detection.cpp b/engines/freescape/detection.cpp
index 35e840c5b16..c824cb6bbc6 100644
--- a/engines/freescape/detection.cpp
+++ b/engines/freescape/detection.cpp
@@ -597,6 +597,19 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_UNSUPPORTED,
GUIO1(GUIO_NOMIDI)
},
+ {
+ "totaleclipse",
+ "",
+ {
+ {"0.TEC", 0, "01a2a7b2ce34b121e7ee4dab3bdac114", 45860},
+ {"1.TEC", 0, "fb65655f60b11040285aa947d4ed1193", 263453},
+ AD_LISTEND
+ },
+ Common::EN_ANY,
+ Common::kPlatformAtariST,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NOMIDI)
+ },
{ // Stampede Atari, Issue 7
"totaleclipse",
"",
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index b7ff4919681..85e096235c7 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -245,6 +245,9 @@ public:
int execute8bitBinImageSingleCommand(Common::SeekableReadStream *file, Graphics::ManagedSurface *surface, int row, int pixels, int bit, int count);
int execute8bitBinImageMultiCommand(Common::SeekableReadStream *file, Graphics::ManagedSurface *surface, int row, int pixels, int bit, int count);
+ void parseAmigaAtariHeader(Common::SeekableReadStream *file);
+ Common::SeekableReadStream *decryptFileAmigaAtari(const Common::Path &packed, const Common::Path &unpacker, uint32 unpackArrayOffset);
+
// Areas
uint16 _startArea;
uint16 _endArea;
diff --git a/engines/freescape/games/dark/amiga.cpp b/engines/freescape/games/dark/amiga.cpp
index e2efd817210..7591ce0a24b 100644
--- a/engines/freescape/games/dark/amiga.cpp
+++ b/engines/freescape/games/dark/amiga.cpp
@@ -19,7 +19,6 @@
*
*/
#include "common/file.h"
-#include "common/memstream.h"
#include "freescape/freescape.h"
#include "freescape/games/dark/dark.h"
@@ -27,93 +26,8 @@
namespace Freescape {
-Common::SeekableReadStream *DarkEngine::decryptFile(const Common::Path &packed, const Common::Path &unpacker, uint32 unpackArrayOffset) {
- Common::File file;
- file.open(packed);
- if (!file.isOpen())
- 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;
- 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;
- }
-
- 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::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);
+ Common::SeekableReadStream *stream = decryptFileAmigaAtari("1.drk", "0.drk", 798);
parseAmigaAtariHeader(stream);
_border = loadAndConvertNeoImage(stream, 0x1b762);
diff --git a/engines/freescape/games/dark/atari.cpp b/engines/freescape/games/dark/atari.cpp
index 3ddf57e9a97..bfcf38c8617 100644
--- a/engines/freescape/games/dark/atari.cpp
+++ b/engines/freescape/games/dark/atari.cpp
@@ -19,7 +19,6 @@
*
*/
#include "common/file.h"
-#include "common/memstream.h"
#include "freescape/freescape.h"
#include "freescape/games/dark/dark.h"
@@ -50,7 +49,7 @@ Common::String centerAndPadString(const Common::String &str, int size) {
}
void DarkEngine::loadAssetsAtariFullGame() {
- Common::SeekableReadStream *stream = decryptFile("1.drk", "0.drk", 840);
+ Common::SeekableReadStream *stream = decryptFileAmigaAtari("1.drk", "0.drk", 840);
parseAmigaAtariHeader(stream);
_border = loadAndConvertNeoImage(stream, 0xd710);
diff --git a/engines/freescape/games/dark/dark.h b/engines/freescape/games/dark/dark.h
index 76ef91693da..eb6630cd3e8 100644
--- a/engines/freescape/games/dark/dark.h
+++ b/engines/freescape/games/dark/dark.h
@@ -72,7 +72,6 @@ public:
void loadAssetsDOSDemo() override;
void loadAssetsAmigaFullGame() override;
void loadAssetsAtariFullGame() override;
- void parseAmigaAtariHeader(Common::SeekableReadStream *file);
void loadAssetsCPCFullGame() override;
@@ -111,7 +110,6 @@ private:
bool tryDestroyECD(int index);
bool tryDestroyECDFullGame(int index);
void addWalls(Area *area);
- Common::SeekableReadStream *decryptFile(const Common::Path &packed, const Common::Path &unpacker, uint32 unpackArrayOffset);
Common::HashMap<uint16, bool> _exploredAreas;
};
diff --git a/engines/freescape/games/eclipse/atari.cpp b/engines/freescape/games/eclipse/atari.cpp
new file mode 100644
index 00000000000..8e878191424
--- /dev/null
+++ b/engines/freescape/games/eclipse/atari.cpp
@@ -0,0 +1,190 @@
+
+/* 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/eclipse/eclipse.h"
+#include "freescape/language/8bitDetokeniser.h"
+
+namespace Freescape {
+
+void EclipseEngine::initAmigaAtari() {
+ _viewArea = Common::Rect(32, 16, 288, 118);
+}
+
+/*void EclipseEngine::loadAssetsCPCFullGame() {
+ Common::File file;
+
+ if (isEclipse2())
+ file.open("TE2.BI1");
+ else
+ file.open("TESCR.SCR");
+
+ if (!file.isOpen())
+ error("Failed to open TESCR.SCR/TE2.BI1");
+
+ _title = readCPCImage(&file, true);
+ _title->setPalette((byte*)&kCPCPaletteTitleData, 0, 4);
+
+ file.close();
+ if (isEclipse2())
+ file.open("TE2.BI3");
+ else
+ file.open("TECON.SCR");
+
+ if (!file.isOpen())
+ error("Failed to open TECON.SCR/TE2.BI3");
+
+ _border = readCPCImage(&file, true);
+ _border->setPalette((byte*)&kCPCPaletteTitleData, 0, 4);
+
+ file.close();
+ if (isEclipse2())
+ file.open("TE2.BI2");
+ else
+ file.open("TECODE.BIN");
+
+ if (!file.isOpen())
+ error("Failed to open TECODE.BIN/TE2.BI2");
+
+ if (isEclipse2()) {
+ loadFonts(&file, 0x60bc, _font);
+ loadMessagesFixedSize(&file, 0x326, 16, 30);
+ load8bitBinary(&file, 0x62b4, 16);
+ } else {
+ loadFonts(&file, 0x6076, _font);
+ loadMessagesFixedSize(&file, 0x326, 16, 30);
+ load8bitBinary(&file, 0x626e, 16);
+ }
+
+ for (auto &it : _areaMap) {
+ it._value->addStructure(_areaMap[255]);
+
+ if (isEclipse2() && it._value->getAreaID() == 1)
+ continue;
+
+ if (isEclipse2() && it._value->getAreaID() == _startArea)
+ continue;
+
+ for (int16 id = 183; id < 207; id++)
+ it._value->addObjectFromArea(id, _areaMap[255]);
+ }
+ loadColorPalette();
+ swapPalette(1);
+
+ _indicators.push_back(loadBundledImage("eclipse_ankh_indicator"));
+
+ for (auto &it : _indicators)
+ it->convertToInPlace(_gfx->_texturePixelFormat);
+}
+
+void EclipseEngine::drawCPCUI(Graphics::Surface *surface) {
+ uint32 color = _currentArea->_underFireBackgroundColor;
+ uint8 r, g, b;
+
+ _gfx->readFromPalette(color, r, g, b);
+ uint32 front = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
+
+ color = _currentArea->_usualBackgroundColor;
+ if (_gfx->_colorRemaps && _gfx->_colorRemaps->contains(color)) {
+ color = (*_gfx->_colorRemaps)[color];
+ }
+
+ _gfx->readFromPalette(color, r, g, b);
+ uint32 back = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
+
+ color = _currentArea->_inkColor;
+
+ _gfx->readFromPalette(color, r, g, b);
+ uint32 other = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
+
+ int score = _gameStateVars[k8bitVariableScore];
+ int shield = _gameStateVars[k8bitVariableShield] * 100 / _maxShield;
+ shield = shield < 0 ? 0 : shield;
+
+ Common::String message;
+ int deadline;
+ getLatestMessages(message, deadline);
+ if (deadline <= _countdown) {
+ drawStringInSurface(message, 102, 135, back, front, surface);
+ _temporaryMessages.push_back(message);
+ _temporaryMessageDeadlines.push_back(deadline);
+ } else if (!_currentAreaMessages.empty())
+ drawStringInSurface(_currentArea->_name, 102, 135, back, front, surface);
+
+ Common::String scoreStr = Common::String::format("%07d", score);
+ drawStringInSurface(scoreStr, 136, 6, back, other, surface, 'Z' - '0' + 1);
+
+ int x = 171;
+ if (shield < 10)
+ x = 179;
+ else if (shield < 100)
+ x = 175;
+
+ Common::String shieldStr = Common::String::format("%d", shield);
+ drawStringInSurface(shieldStr, x, 162, back, other, surface);
+
+ drawStringInSurface(Common::String('0' + _angleRotationIndex - 3), 79, 135, back, front, surface, 'Z' - '$' + 1);
+ drawStringInSurface(Common::String('3' - _playerStepIndex), 63, 135, back, front, surface, 'Z' - '$' + 1);
+ drawStringInSurface(Common::String('7' - _playerHeightNumber), 240, 135, back, front, surface, 'Z' - '$' + 1);
+
+ if (_shootingFrames > 0) {
+ drawStringInSurface("4", 232, 135, back, front, surface, 'Z' - '$' + 1);
+ drawStringInSurface("<", 240, 135, back, front, surface, 'Z' - '$' + 1);
+ }
+ drawAnalogClock(surface, 90, 172, back, other, front);
+ drawIndicator(surface, 45, 4, 12);
+ drawEclipseIndicator(surface, 228, 0, front, other);
+}*/
+
+void EclipseEngine::loadAssetsAtariFullGame() {
+ Common::SeekableReadStream *stream = decryptFileAmigaAtari("1.tec", "0.tec", 0x1774 - 4 * 1024);
+ parseAmigaAtariHeader(stream);
+
+ loadMessagesVariableSize(stream, 0x87a6, 28);
+ load8bitBinary(stream, 0x2a53c, 16);
+
+ _border = loadAndConvertNeoImage(stream, 0x139c8);
+ loadPalettes(stream, 0x2a0fa);
+
+ for (auto &it : _areaMap) {
+ it._value->addStructure(_areaMap[255]);
+ for (int16 id = 183; id < 207; id++)
+ it._value->addObjectFromArea(id, _areaMap[255]);
+ }
+
+ /*
+ loadFonts(stream, 0xd06b, _fontBig);
+ loadFonts(stream, 0xd49a, _fontMedium);
+ loadFonts(stream, 0xd49b, _fontSmall);
+
+ load8bitBinary(stream, 0x20918, 16);
+ loadMessagesVariableSize(stream, 0x3f6f, 66);
+
+ loadPalettes(stream, 0x204d6);
+ loadGlobalObjects(stream, 0x32f6, 24);
+ loadSoundsFx(stream, 0x266e8, 11);*/
+}
+
+} // End of namespace Freescape
diff --git a/engines/freescape/games/eclipse/eclipse.cpp b/engines/freescape/games/eclipse/eclipse.cpp
index 801f72a4847..26dc3e12130 100644
--- a/engines/freescape/games/eclipse/eclipse.cpp
+++ b/engines/freescape/games/eclipse/eclipse.cpp
@@ -34,6 +34,8 @@ EclipseEngine::EclipseEngine(OSystem *syst, const ADGameDescription *gd) : Frees
initCPC();
else if (isSpectrum())
initZX();
+ else if (isAmiga() || isAtariST())
+ initAmigaAtari();
_playerHeightNumber = 1;
_playerHeights.push_back(32);
@@ -197,6 +199,8 @@ void EclipseEngine::gotoArea(uint16 areaID, int entranceID) {
_gfx->_keyColor = 0;
swapPalette(areaID);
_currentArea->_usualBackgroundColor = isCPC() ? 1 : 0;
+ if (isAmiga() || isAtariST())
+ _currentArea->_skyColor = 15;
resetInput();
}
@@ -220,6 +224,9 @@ void EclipseEngine::drawBackground() {
if (isSpectrum() || isCPC()) {
color1 = 2;
color2 = 10;
+ } else if (isAmiga() || isAtariST()) {
+ color1 = 8;
+ color2 = 14;
}
_gfx->drawEclipse(color1, color2, progress);
diff --git a/engines/freescape/games/eclipse/eclipse.h b/engines/freescape/games/eclipse/eclipse.h
index 492b654a158..67d197fd8cb 100644
--- a/engines/freescape/games/eclipse/eclipse.h
+++ b/engines/freescape/games/eclipse/eclipse.h
@@ -62,9 +62,11 @@ public:
void initDOS();
void initCPC();
void initZX();
+ void initAmigaAtari();
void loadAssetsZXFullGame() override;
void loadAssetsCPCFullGame() override;
+ void loadAssetsAtariFullGame() override;
void loadAssetsCPCDemo() override;
void loadAssetsZXDemo() override;
diff --git a/engines/freescape/games/palettes.cpp b/engines/freescape/games/palettes.cpp
index 7f3d30cd395..4b087ff1e74 100644
--- a/engines/freescape/games/palettes.cpp
+++ b/engines/freescape/games/palettes.cpp
@@ -142,6 +142,8 @@ void FreescapeEngine::loadPalettes(Common::SeekableReadStream *file, int offset)
for (uint i = 0; i < numberOfAreas; i++) {
int label = readField(file, 8);
+ if (label == 255)
+ break;
auto palette = new byte[16][3];
debugC(1, kFreescapeDebugParser, "Loading palette for area: %d at %lx", label, file->pos());
for (int c = 0; c < 16; c++) {
diff --git a/engines/freescape/loaders/8bitBinaryLoader.cpp b/engines/freescape/loaders/8bitBinaryLoader.cpp
index 539085f136e..05bbb35f8ea 100644
--- a/engines/freescape/loaders/8bitBinaryLoader.cpp
+++ b/engines/freescape/loaders/8bitBinaryLoader.cpp
@@ -22,6 +22,9 @@
// Based on Phantasma code by Thomas Harte (2013),
// available at https://github.com/TomHarte/Phantasma/ (MIT)
+#include "common/memstream.h"
+#include "common/file.h"
+
#include "freescape/freescape.h"
#include "freescape/language/8bitDetokeniser.h"
#include "freescape/objects/connections.h"
@@ -83,7 +86,7 @@ Common::Array<uint16> FreescapeEngine::readArray(Common::SeekableReadStream *fil
}
Group *FreescapeEngine::load8bitGroup(Common::SeekableReadStream *file, byte rawFlagsAndType) {
- if (isDark())
+ if (isDark() || isEclipse())
return load8bitGroupV1(file, rawFlagsAndType);
else
return load8bitGroupV2(file, rawFlagsAndType);
@@ -556,15 +559,20 @@ Area *FreescapeEngine::load8bitArea(Common::SeekableReadStream *file, uint16 nco
// Castle specific
uint8 extraColor[4] = {};
if (isEclipse()) {
- byte idx = file->readByte();
+ byte idx = readField(file, 8);
name = idx < 8 ? eclipseRoomName[idx] : eclipseRoomName[8];
- name = name + "-" + char(file->readByte()) + " ";
+ name = name + "-" + char(readField(file, 8)) + " ";
int i = 0;
while (i < 3) {
- name = name + char(file->readByte());
+ name = name + char(readField(file, 8));
i++;
}
+
+ if (isAmiga() || isAtariST()) {
+ groundColor = skyColor;
+ skyColor = 0;
+ }
} else if (isDriller() || isDark()) {
if (isDriller()) {
gasPocketX = readField(file, 8);
@@ -635,8 +643,9 @@ Area *FreescapeEngine::load8bitArea(Common::SeekableReadStream *file, uint16 nco
int64 endLastObject = file->pos();
debugC(1, kFreescapeDebugParser, "Last position %lx", endLastObject);
- if (isDark() && (isAmiga() || isAtariST()))
- assert(endLastObject <= static_cast<int64>(base + cPtr));
+ debugC(1, kFreescapeDebugParser, "endLastObject is supposed to be %x", base + cPtr);
+ if ((isDark() || isEclipse()) && (isAmiga() || isAtariST()))
+ assert(endLastObject <= static_cast<int64>(base + cPtr) + 4);
else
assert(endLastObject == static_cast<int64>(base + cPtr) || areaNumber == 192);
file->seek(base + cPtr);
@@ -961,5 +970,93 @@ void FreescapeEngine::loadGlobalObjects(Common::SeekableReadStream *file, int of
_areaMap[255] = new Area(255, 0, globalObjectsByID, nullptr);
}
+void FreescapeEngine::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());
+ }
+}
+
+Common::SeekableReadStream *FreescapeEngine::decryptFileAmigaAtari(const Common::Path &packed, const Common::Path &unpacker, uint32 unpackArrayOffset) {
+ Common::File file;
+ file.open(packed);
+ if (!file.isOpen())
+ error("Failed to open %s", packed.toString().c_str());
+
+ int size = file.size();
+ size -= size % 4;
+ 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;
+ }
+
+ 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];
+ //debug("%x -> %x", unpackArrayOffset + 2 * i, ptr0);
+ uint8 ptr1 = unpackArrayPtr[2 * i + 1];
+ //debug("%x -> %x", unpackArrayOffset + 2 * i + 1, ptr1);
+ 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));
+}
+
} // namespace Freescape
diff --git a/engines/freescape/module.mk b/engines/freescape/module.mk
index df4c96fb3e4..f1dc467271c 100644
--- a/engines/freescape/module.mk
+++ b/engines/freescape/module.mk
@@ -22,6 +22,7 @@ MODULE_OBJS := \
games/driller/dos.o \
games/driller/driller.o \
games/driller/zx.o \
+ games/eclipse/atari.o \
games/eclipse/dos.o \
games/eclipse/eclipse.o \
games/eclipse/cpc.o \
More information about the Scummvm-git-logs
mailing list