[Scummvm-git-logs] scummvm master -> 92a2d1659928a147a6a209e76e8daa7c1a5282bc
dreammaster
noreply at scummvm.org
Sat May 30 10:40:23 UTC 2026
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
31b4951a5f GLK: SCOTT: Split off the Spectrum code needed for the detection
92a2d16599 GLK: SCOTT: Move spectrum title screen array to Scott engine
Commit: 31b4951a5f94c2ec6e83d4b6cba9b30f915d9f3c
https://github.com/scummvm/scummvm/commit/31b4951a5f94c2ec6e83d4b6cba9b30f915d9f3c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-05-30T20:37:20+10:00
Commit Message:
GLK: SCOTT: Split off the Spectrum code needed for the detection
Changed paths:
A engines/glk/scott/zx_spectrum.cpp
A engines/glk/scott/zx_spectrum.h
engines/glk/module.mk
engines/glk/scott/detection.cpp
engines/glk/scott/load_zx_spectrum.cpp
engines/glk/scott/load_zx_spectrum.h
diff --git a/engines/glk/module.mk b/engines/glk/module.mk
index a067b26207e..c2638de4e23 100644
--- a/engines/glk/module.mk
+++ b/engines/glk/module.mk
@@ -251,6 +251,7 @@ MODULE_OBJS := \
scott/line_drawing.o \
scott/load_ti99_4a.o \
scott/load_zx_spectrum.o \
+ scott/zx_spectrum.o \
scott/resource.o \
scott/restore_state.o \
scott/ring_buffer.o \
diff --git a/engines/glk/scott/detection.cpp b/engines/glk/scott/detection.cpp
index 855cd393eaa..6cacd13f793 100644
--- a/engines/glk/scott/detection.cpp
+++ b/engines/glk/scott/detection.cpp
@@ -36,7 +36,7 @@
#include "glk/blorb.h"
#include "glk/scott/detection.h"
#include "glk/scott/detection_tables.h"
-#include "glk/scott/load_zx_spectrum.h"
+#include "glk/scott/zx_spectrum.h"
namespace Glk {
namespace Scott {
diff --git a/engines/glk/scott/load_zx_spectrum.cpp b/engines/glk/scott/load_zx_spectrum.cpp
index 64de16dfc60..97b1cfdcba6 100644
--- a/engines/glk/scott/load_zx_spectrum.cpp
+++ b/engines/glk/scott/load_zx_spectrum.cpp
@@ -39,6 +39,7 @@
#include "glk/scott/decompress_z80.h"
#include "glk/scott/globals.h"
#include "glk/scott/load_zx_spectrum.h"
+#include "glk/scott/zx_spectrum.h"
#include "glk/scott/resource.h"
#include "glk/scott/scott.h"
#include "image/scr.h"
@@ -48,53 +49,6 @@ namespace Scott {
static Common::Array<byte> g_zxSpectrumTapeTitleScreen;
-struct ZXSpectrumTapeData {
- Common::Array<byte> screen;
- Common::Array<byte> code;
-};
-
-static bool extractZXSpectrumTapeData(Common::SeekableReadStream &stream, ZXSpectrumTapeData &tape) {
- Common::SpectrumTapeBlocks blocks;
- if (!Common::parseSpectrumTape(stream, blocks))
- return false;
-
- Common::SpectrumTapeArchive archive(blocks);
- Common::ArchiveMemberList files;
- archive.listMembers(files);
-
- tape.screen.clear();
- tape.code.clear();
- for (const Common::ArchiveMemberPtr &file : files) {
- Common::ScopedPtr<Common::SeekableReadStream> payload(file->createReadStream());
- if (!payload)
- continue;
-
- Common::Array<byte> data;
- data.resize(payload->size());
- if (!data.empty() && payload->read(data.data(), data.size()) != data.size())
- return false;
-
- if (file->getPathInArchive().baseName().hasSuffixIgnoreCase(".scr"))
- tape.screen = data;
- else if (data.size() >= tape.code.size())
- tape.code = data;
- }
-
- return !tape.code.empty();
-}
-
-Common::String computeZXSpectrumTapeCodeMD5(Common::SeekableReadStream &stream, uint32 *codeSize) {
- ZXSpectrumTapeData tape;
- if (!extractZXSpectrumTapeData(stream, tape))
- return Common::String();
-
- if (codeSize)
- *codeSize = tape.code.size();
-
- Common::MemoryReadStream codeStream(tape.code.data(), tape.code.size());
- return Common::computeStreamMD5AsString(codeStream);
-}
-
static void loadZXSpectrumGame(Common::String md5) {
int offset;
DictionaryType dict_type = getId(&offset);
diff --git a/engines/glk/scott/load_zx_spectrum.h b/engines/glk/scott/load_zx_spectrum.h
index b8e70ec9ce1..a0cc183e7ac 100644
--- a/engines/glk/scott/load_zx_spectrum.h
+++ b/engines/glk/scott/load_zx_spectrum.h
@@ -43,7 +43,6 @@ namespace Scott {
void loadZXSpectrum(Common::SeekableReadStream *f, Common::String md5);
void loadZXSpectrumTape(Common::SeekableReadStream *f);
void showZXSpectrumTapeTitleScreen();
-Common::String computeZXSpectrumTapeCodeMD5(Common::SeekableReadStream &stream, uint32 *codeSize = nullptr);
} // End of namespace Scott
} // End of namespace Glk
diff --git a/engines/glk/scott/zx_spectrum.cpp b/engines/glk/scott/zx_spectrum.cpp
new file mode 100644
index 00000000000..2213e6fa9ea
--- /dev/null
+++ b/engines/glk/scott/zx_spectrum.cpp
@@ -0,0 +1,84 @@
+/* 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/>.
+ *
+ */
+
+/*
+ * Based on ScottFree interpreter version 1.14 developed by Swansea
+ * University Computer Society without disassembly of any other game
+ * drivers, only of game databases as permitted by EEC law (for purposes
+ * of compatibility).
+ *
+ * Licensed under GPLv2
+ *
+ * https://github.com/angstsmurf/spatterlight/tree/master/terps/scott
+ */
+
+#include "common/formats/spectrum_tape.h"
+#include "common/md5.h"
+#include "common/memstream.h"
+#include "glk/scott/zx_spectrum.h"
+
+namespace Glk {
+namespace Scott {
+
+bool extractZXSpectrumTapeData(Common::SeekableReadStream &stream, ZXSpectrumTapeData &tape) {
+ Common::SpectrumTapeBlocks blocks;
+ if (!Common::parseSpectrumTape(stream, blocks))
+ return false;
+
+ Common::SpectrumTapeArchive archive(blocks);
+ Common::ArchiveMemberList files;
+ archive.listMembers(files);
+
+ tape.screen.clear();
+ tape.code.clear();
+ for (const Common::ArchiveMemberPtr &file : files) {
+ Common::ScopedPtr<Common::SeekableReadStream> payload(file->createReadStream());
+ if (!payload)
+ continue;
+
+ Common::Array<byte> data;
+ data.resize(payload->size());
+ if (!data.empty() && payload->read(data.data(), data.size()) != data.size())
+ return false;
+
+ if (file->getPathInArchive().baseName().hasSuffixIgnoreCase(".scr"))
+ tape.screen = data;
+ else if (data.size() >= tape.code.size())
+ tape.code = data;
+ }
+
+ return !tape.code.empty();
+}
+
+Common::String computeZXSpectrumTapeCodeMD5(Common::SeekableReadStream &stream, uint32 *codeSize) {
+ ZXSpectrumTapeData tape;
+ if (!extractZXSpectrumTapeData(stream, tape))
+ return Common::String();
+
+ if (codeSize)
+ *codeSize = tape.code.size();
+
+ Common::MemoryReadStream codeStream(tape.code.data(), tape.code.size());
+ return Common::computeStreamMD5AsString(codeStream);
+}
+
+} // End of namespace Scott
+} // End of namespace Glk
diff --git a/engines/glk/scott/zx_spectrum.h b/engines/glk/scott/zx_spectrum.h
new file mode 100644
index 00000000000..165d3facca6
--- /dev/null
+++ b/engines/glk/scott/zx_spectrum.h
@@ -0,0 +1,43 @@
+/* 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/>.
+ *
+ */
+
+#ifndef GLK_SCOTT_ZX_SPECTRUM_H
+#define GLK_SCOTT_ZX_SPECTRUM_H
+
+#include "common/str.h"
+#include "common/stream.h"
+#include "glk/scott/types.h"
+
+namespace Glk {
+namespace Scott {
+
+struct ZXSpectrumTapeData {
+ Common::Array<byte> screen;
+ Common::Array<byte> code;
+};
+
+extern bool extractZXSpectrumTapeData(Common::SeekableReadStream &stream, ZXSpectrumTapeData &tape);
+extern Common::String computeZXSpectrumTapeCodeMD5(Common::SeekableReadStream &stream, uint32 *codeSize = nullptr);
+
+} // End of namespace Scott
+} // End of namespace Glk
+
+#endif
Commit: 92a2d1659928a147a6a209e76e8daa7c1a5282bc
https://github.com/scummvm/scummvm/commit/92a2d1659928a147a6a209e76e8daa7c1a5282bc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-05-30T20:40:06+10:00
Commit Message:
GLK: SCOTT: Move spectrum title screen array to Scott engine
Changed paths:
engines/glk/scott/load_zx_spectrum.cpp
engines/glk/scott/scott.h
diff --git a/engines/glk/scott/load_zx_spectrum.cpp b/engines/glk/scott/load_zx_spectrum.cpp
index 97b1cfdcba6..8a6ae4af7e5 100644
--- a/engines/glk/scott/load_zx_spectrum.cpp
+++ b/engines/glk/scott/load_zx_spectrum.cpp
@@ -47,7 +47,7 @@
namespace Glk {
namespace Scott {
-static Common::Array<byte> g_zxSpectrumTapeTitleScreen;
+#define TITLE_SCREEN g_scott->_spectrumTitleScreen
static void loadZXSpectrumGame(Common::String md5) {
int offset;
@@ -62,7 +62,7 @@ static void loadZXSpectrumGame(Common::String md5) {
}
void loadZXSpectrum(Common::SeekableReadStream *f, Common::String md5) {
- g_zxSpectrumTapeTitleScreen.clear();
+ TITLE_SCREEN.clear();
_G(_entireFile) = new uint8_t[_G(_fileLength)];
size_t result = f->read(_G(_entireFile), _G(_fileLength));
@@ -80,13 +80,13 @@ void loadZXSpectrum(Common::SeekableReadStream *f, Common::String md5) {
}
void loadZXSpectrumTape(Common::SeekableReadStream *f) {
- g_zxSpectrumTapeTitleScreen.clear();
+ TITLE_SCREEN.clear();
ZXSpectrumTapeData tape;
if (!extractZXSpectrumTapeData(*f, tape))
return;
- g_zxSpectrumTapeTitleScreen = tape.screen;
+ TITLE_SCREEN = tape.screen;
_G(_fileLength) = tape.code.size();
_G(_entireFile) = new uint8_t[_G(_fileLength)];
@@ -99,10 +99,10 @@ void loadZXSpectrumTape(Common::SeekableReadStream *f) {
}
static Graphics::ManagedSurface *decodeZXSpectrumTitleScreen() {
- if (g_zxSpectrumTapeTitleScreen.size() != 6912)
+ if (TITLE_SCREEN.size() != 6912)
return nullptr;
- Common::Array<byte> titleScreen = g_zxSpectrumTapeTitleScreen;
+ Common::Array<byte> titleScreen = TITLE_SCREEN;
if (CURRENT_GAME == HULK) {
byte *attrs = titleScreen.data() + 6144;
for (int row = 22; row < 24; row++) {
@@ -165,7 +165,7 @@ static void drawZXSpectrumTitleScreen(winid_t win, const Graphics::ManagedSurfac
}
void showZXSpectrumTapeTitleScreen() {
- if (!g_scott->glk_gestalt(gestalt_Graphics, 0) || g_zxSpectrumTapeTitleScreen.empty())
+ if (!g_scott->glk_gestalt(gestalt_Graphics, 0) || TITLE_SCREEN.empty())
return;
Graphics::ManagedSurface *surface = decodeZXSpectrumTitleScreen();
diff --git a/engines/glk/scott/scott.h b/engines/glk/scott/scott.h
index 2aa769c2fb5..bd31302840b 100644
--- a/engines/glk/scott/scott.h
+++ b/engines/glk/scott/scott.h
@@ -192,6 +192,9 @@ private:
void printTitleScreenBuffer();
void printTitleScreenGrid();
+public:
+ Common::Array<byte> _spectrumTitleScreen;
+
public:
void drawImage(int image);
void output(const Common::String &a);
More information about the Scummvm-git-logs
mailing list