[Scummvm-git-logs] scummvm master -> 0ade566d649fd9b1803276944d2cae77130aeca7
dreammaster
paulfgilbert at gmail.com
Thu Dec 27 09:11:13 CET 2018
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:
f70180e78e GLK: MAGNETIC: Initial skeleton sub-engine
0ade566d64 GLK: FROTZ: Don't show Beyond Zork title when loading save from launcher
Commit: f70180e78e09bc802bf1ba848fac903834e0b78e
https://github.com/scummvm/scummvm/commit/f70180e78e09bc802bf1ba848fac903834e0b78e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-12-27T00:10:38-08:00
Commit Message:
GLK: MAGNETIC: Initial skeleton sub-engine
Changed paths:
A engines/glk/magnetic/detection.cpp
A engines/glk/magnetic/detection.h
A engines/glk/magnetic/detection_tables.h
A engines/glk/magnetic/magnetic.cpp
A engines/glk/magnetic/magnetic.h
engines/glk/module.mk
diff --git a/engines/glk/magnetic/detection.cpp b/engines/glk/magnetic/detection.cpp
new file mode 100644
index 0000000..279f509
--- /dev/null
+++ b/engines/glk/magnetic/detection.cpp
@@ -0,0 +1,118 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "glk/magnetic/detection.h"
+#include "glk/magnetic/detection_tables.h"
+#include "common/debug.h"
+#include "common/file.h"
+#include "common/md5.h"
+#include "engines/game.h"
+
+namespace Glk {
+namespace Magnetic {
+
+void MagneticMetaEngine::getSupportedGames(PlainGameList &games) {
+ for (const MagneticDescriptor *pd = MAGNETIC_GAME_LIST; pd->gameId; ++pd) {
+ games.push_back(*pd);
+ }
+}
+
+MagneticDescriptor MagneticMetaEngine::findGame(const char *gameId) {
+ for (const MagneticDescriptor *pd = MAGNETIC_GAME_LIST; pd->gameId; ++pd) {
+ if (!strcmp(gameId, pd->gameId))
+ return *pd;
+ }
+
+ return MagneticDescriptor();
+}
+
+bool MagneticMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) {
+ const char *const EXTENSIONS[3] = { ".magnetic" };
+
+ // Loop through the files of the folder
+ for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
+ // Check for a recognised filename
+ if (file->isDirectory())
+ continue;
+ Common::String filename = file->getName();
+ bool hasExt = false;
+ for (int idx = 0; idx < 3 && !hasExt; ++idx)
+ hasExt = filename.hasSuffixIgnoreCase(EXTENSIONS[idx]);
+ if (!hasExt)
+ continue;
+
+ // Open up the file and calculate the md5
+ Common::File gameFile;
+ if (!gameFile.open(*file))
+ continue;
+ Common::String md5 = Common::computeStreamMD5AsString(gameFile, 5000);
+ size_t filesize = gameFile.size();
+ gameFile.close();
+
+ // Check for known games
+ const MagneticGameDescription *p = MAGNETIC_GAMES;
+ while (p->_gameId && (md5 != p->_md5 || filesize != p->_filesize))
+ ++p;
+
+ DetectedGame gd;
+ if (!p->_gameId) {
+ if (filename.hasSuffixIgnoreCase(".blb"))
+ continue;
+
+ if (gDebugLevel > 0) {
+ // Print an entry suitable for putting into the detection_tables.h, using the
+ // name of the parent folder the game is in as the presumed game Id
+ Common::String folderName = file->getParent().getName();
+ if (folderName.hasSuffix("\\"))
+ folderName.deleteLastChar();
+ Common::String fname = filename;
+ const char *dot = strchr(fname.c_str(), '.');
+ if (dot)
+ fname = Common::String(fname.c_str(), dot);
+
+ debug("ENTRY0(\"%s\", \"%s\", %u),", fname.c_str(), md5.c_str(), (uint)filesize);
+ }
+ const PlainGameDescriptor &desc = MAGNETIC_GAME_LIST[0];
+ gd = DetectedGame(desc.gameId, desc.description, Common::UNK_LANG, Common::kPlatformUnknown);
+ } else {
+ PlainGameDescriptor gameDesc = findGame(p->_gameId);
+ gd = DetectedGame(p->_gameId, gameDesc.description, p->_language, Common::kPlatformUnknown, p->_extra);
+ gd.setGUIOptions(GUIO4(GUIO_NOSPEECH, GUIO_NOSFX, GUIO_NOMUSIC, GUIO_NOSUBTITLES));
+ }
+
+ gd.addExtraEntry("filename", filename);
+ gameList.push_back(gd);
+ }
+
+ return !gameList.empty();
+}
+
+void MagneticMetaEngine::detectClashes(Common::StringMap &map) {
+ for (const MagneticDescriptor *pd = MAGNETIC_GAME_LIST; pd->gameId; ++pd) {
+ if (map.contains(pd->gameId))
+ error("Duplicate game Id found - %s", pd->gameId);
+ map[pd->gameId] = "";
+ }
+}
+
+} // End of namespace Magnetic
+} // End of namespace Glk
diff --git a/engines/glk/magnetic/detection.h b/engines/glk/magnetic/detection.h
new file mode 100644
index 0000000..3ea8810
--- /dev/null
+++ b/engines/glk/magnetic/detection.h
@@ -0,0 +1,77 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef GLK_GLULXE_DETECTION
+#define GLK_GLULXE_DETECTION
+
+#include "common/fs.h"
+#include "common/hash-str.h"
+#include "engines/game.h"
+
+namespace Glk {
+namespace Magnetic {
+
+/**
+ * Magnetic game descriptior
+ */
+struct MagneticDescriptor {
+ const char *gameId;
+ const char *description;
+
+ operator PlainGameDescriptor() const {
+ PlainGameDescriptor pd;
+ pd.gameId = gameId;
+ pd.description = description;
+ return pd;
+ }
+};
+
+/**
+ * Meta engine for Magnetic interpreter
+ */
+class MagneticMetaEngine {
+public:
+ /**
+ * Get a list of supported games
+ */
+ static void getSupportedGames(PlainGameList &games);
+
+ /**
+ * Returns a game description for the given game Id, if it's supported
+ */
+ static MagneticDescriptor findGame(const char *gameId);
+
+ /**
+ * Detect supported games
+ */
+ static bool detectGames(const Common::FSList &fslist, DetectedGames &gameList);
+
+ /**
+ * Check for game Id clashes with other sub-engines
+ */
+ static void detectClashes(Common::StringMap &map);
+};
+
+} // End of namespace Magnetic
+} // End of namespace Glk
+
+#endif
diff --git a/engines/glk/magnetic/detection_tables.h b/engines/glk/magnetic/detection_tables.h
new file mode 100644
index 0000000..a67d2a9
--- /dev/null
+++ b/engines/glk/magnetic/detection_tables.h
@@ -0,0 +1,55 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "engines/game.h"
+#include "common/gui_options.h"
+#include "common/language.h"
+
+namespace Glk {
+namespace Magnetic {
+
+/**
+ * Game description
+ */
+struct MagneticGameDescription {
+ const char *const _gameId;
+ const char *const _extra;
+ const char *const _md5;
+ size_t _filesize;
+ Common::Language _language;
+};
+
+const MagneticDescriptor MAGNETIC_GAME_LIST[] = {
+ { "magnetic", "Magnetic Scrolls Game" },
+
+ { nullptr, nullptr }
+};
+
+#define ENTRY0(ID, MD5, FILESIZE) { ID, nullptr, MD5, FILESIZE, Common::EN_ANY }
+#define TABLE_END_MARKER { nullptr, nullptr, nullptr, 0, Common::EN_ANY }
+
+const MagneticGameDescription MAGNETIC_GAMES[] = {
+ TABLE_END_MARKER
+};
+
+} // End of namespace Magnetic
+} // End of namespace Glk
diff --git a/engines/glk/magnetic/magnetic.cpp b/engines/glk/magnetic/magnetic.cpp
new file mode 100644
index 0000000..f3f3e79
--- /dev/null
+++ b/engines/glk/magnetic/magnetic.cpp
@@ -0,0 +1,79 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "glk/magnetic/magnetic.h"
+#include "common/config-manager.h"
+#include "common/translation.h"
+
+namespace Glk {
+namespace Magnetic {
+
+Magnetic::Magnetic(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gameDesc),
+ vm_exited_cleanly(false) {
+}
+
+void Magnetic::runGame(Common::SeekableReadStream *gameFile) {
+ _gameFile = gameFile;
+
+ if (!is_gamefile_valid())
+ return;
+
+ // TODO
+}
+
+Common::Error Magnetic::loadGameData(strid_t file) {
+ // TODO
+ return Common::kNoError;
+}
+
+Common::Error Magnetic::saveGameData(strid_t file, const Common::String &desc) {
+ // TODO
+ return Common::kNoError;
+}
+
+bool Magnetic::is_gamefile_valid() {
+ if (_gameFile->size() < 8) {
+ GUIErrorMessage(_("This is too short to be a valid Glulx file."));
+ return false;
+ }
+
+ if (_gameFile->readUint32BE() != MKTAG('G', 'l', 'u', 'l')) {
+ GUIErrorMessage(_("This is not a valid Glulx file."));
+ return false;
+ }
+
+ // We support version 2.0 through 3.1.*
+ uint version = _gameFile->readUint32BE();
+ if (version < 0x20000) {
+ GUIErrorMessage(_("This Glulx file is too old a version to execute."));
+ return false;
+ }
+ if (version >= 0x30200) {
+ GUIErrorMessage(_("This Glulx file is too new a version to execute."));
+ return false;
+ }
+
+ return true;
+}
+
+} // End of namespace Magnetic
+} // End of namespace Glk
diff --git a/engines/glk/magnetic/magnetic.h b/engines/glk/magnetic/magnetic.h
new file mode 100644
index 0000000..6f30768
--- /dev/null
+++ b/engines/glk/magnetic/magnetic.h
@@ -0,0 +1,74 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef GLK_GLULXE
+#define GLK_GLULXE
+
+#include "common/scummsys.h"
+#include "glk/glk_api.h"
+
+namespace Glk {
+namespace Magnetic {
+
+/**
+ * Magnetic game interpreter
+ */
+class Magnetic : public GlkAPI {
+public:
+ Common::SeekableReadStream *_gameFile;
+ bool vm_exited_cleanly;
+private:
+ /**
+ * Validates the game file, and if it's invalid, displays an error dialog
+ */
+ bool is_gamefile_valid();
+public:
+ /**
+ * Constructor
+ */
+ Magnetic(OSystem *syst, const GlkGameDescription &gameDesc);
+
+ /**
+ * Run the game
+ */
+ void runGame(Common::SeekableReadStream *gameFile);
+
+ /**
+ * Returns the running interpreter type
+ */
+ virtual InterpreterType getInterpreterType() const override { return INTERPRETER_GLULXE; }
+
+ /**
+ * Load a savegame from the passed stream
+ */
+ virtual Common::Error loadGameData(strid_t file) override;
+
+ /**
+ * Save the game to the passed stream
+ */
+ virtual Common::Error saveGameData(strid_t file, const Common::String &desc) override;
+};
+
+} // End of namespace Magnetic
+} // End of namespace Glk
+
+#endif
diff --git a/engines/glk/module.mk b/engines/glk/module.mk
index 7164481..1af4ce6 100644
--- a/engines/glk/module.mk
+++ b/engines/glk/module.mk
@@ -46,6 +46,8 @@ MODULE_OBJS := \
frotz/sound_folder.o \
glulxe/detection.o \
glulxe/glulxe.o \
+ magnetic/detection.o \
+ magnetic/magnetic.o \
scott/detection.o \
scott/scott.o \
tads/detection.o \
Commit: 0ade566d649fd9b1803276944d2cae77130aeca7
https://github.com/scummvm/scummvm/commit/0ade566d649fd9b1803276944d2cae77130aeca7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-12-27T00:10:38-08:00
Commit Message:
GLK: FROTZ: Don't show Beyond Zork title when loading save from launcher
Changed paths:
engines/glk/frotz/glk_interface.cpp
diff --git a/engines/glk/frotz/glk_interface.cpp b/engines/glk/frotz/glk_interface.cpp
index b78a067..74d6e45 100644
--- a/engines/glk/frotz/glk_interface.cpp
+++ b/engines/glk/frotz/glk_interface.cpp
@@ -477,16 +477,20 @@ void GlkInterface::gos_cancel_pending_line() {
}
void GlkInterface::showBeyondZorkTitle() {
- uint winW, winH, imgW, imgH;
- winid_t win = glk_window_open(0, 0, 0, wintype_Graphics, 0);
- glk_window_get_size(win, &winW, &winH);
+ int saveSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1;
- if (os_picture_data(1, &imgW, &imgH)) {
- os_draw_picture(1, win, Common::Rect(0, 0, winW, winH));
- _events->waitForPress();
- }
+ if (saveSlot == -1) {
+ uint winW, winH, imgW, imgH;
+ winid_t win = glk_window_open(0, 0, 0, wintype_Graphics, 0);
+ glk_window_get_size(win, &winW, &winH);
+
+ if (os_picture_data(1, &imgW, &imgH)) {
+ os_draw_picture(1, win, Common::Rect(0, 0, winW, winH));
+ _events->waitForPress();
+ }
- glk_window_close(win, nullptr);
+ glk_window_close(win, nullptr);
+ }
}
void GlkInterface::os_draw_picture(int picture, winid_t win, const Common::Point &pos) {
More information about the Scummvm-git-logs
mailing list