[Scummvm-git-logs] scummvm master -> 08406b4510d4e6cbf17d2035e0f945a756d3be48
sev-
noreply at scummvm.org
Sun Jan 15 22:32:11 UTC 2023
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:
6af5e86a77 DIRECTOR: openMainArchive may be opening an EXE
08406b4510 DIRECTOR: add SearchMan check
Commit: 6af5e86a77c5401f2d022279e2ce4ff9c463fd1d
https://github.com/scummvm/scummvm/commit/6af5e86a77c5401f2d022279e2ce4ff9c463fd1d
Author: Misty De Meo (mistydemeo at gmail.com)
Date: 2023-01-15T23:32:06+01:00
Commit Message:
DIRECTOR: openMainArchive may be opening an EXE
This fixes Fukuoka-Go-Round, which ends up passing the main EXE as a movie
to (re)open at runtime instead of a movie. Without this, clicking back to
the main menu crashes the disc.
Changed paths:
engines/director/cast.cpp
engines/director/detection_tables.h
engines/director/resource.cpp
engines/director/window.h
diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index 65ea9d08dc7..bfccb441b1b 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -91,7 +91,9 @@ Cast::~Cast() {
for (Common::HashMap<int, const Stxt *>::iterator it = _loadedStxts->begin(); it != _loadedStxts->end(); ++it)
delete it->_value;
- if (_castArchive) {
+ // There may be another open reference to the same file, in which
+ // case attempting to free it now would be dangerous.
+ if (_castArchive && !g_director->_allOpenResFiles.contains(_castArchive->getPathName())) {
_castArchive->close();
delete _castArchive;
_castArchive = nullptr;
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index 1bed475355d..c80f2f4f34c 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -1071,6 +1071,7 @@ static const PlainGameDescriptor directorGames[] = {
{ "fantasystudio", "Fantasy Studio" }, // RPG Maker-style creation toolkit
{ "fototune", "FotoTune Multimedia Show" },
{ "fukuda", "Fukuda Shigeo Retrospective Collection" },
+ { "fukuokagoround", "Fukuoka Go-Round" },
{ "furbydentaku", "ãã¡ã¼ãã¼é»å" }, // Furby Calculator
{ "futarinoryori", "ãµããã®æçç©èª" }, // A Tale of Two Chefs
{ "futurepromotion", "Towa Tei: Future Promotion" },
@@ -3692,6 +3693,9 @@ static const DirectorGameDescription gameDescriptions[] = {
MACGAME1("fukuda", "", "Mac/FUKUDA", "0b55676d539ba5e29560e7c4da4fbad6", 483187, 404),
WINGAME1t("fukuda", "", "WIN/MAIN/FUKUDA.EXE", "71eec68c19354b67badc7c82f159374b", 739951, 404),
+ MACGAME2_l("fukuokagoround", "", "Fukuoka Go-Round", "0c7bbb4b24823e5ab871cb4c1d6f3710", 484167, "shared.dir", "b83bfaec3666b328ec743e074a94115f", 20900286, Common::JA_JPN, 404),
+ WINGAME2t_l("fukuokagoround", "", "FGR.EXE", "dc2da038ba67c2bd2f5bb31b97261db9", 5293611, "SHARED.DIR", "6bf95a48f366bdf8af3a198c7b723c77", 16038266, Common::JA_JPN, 404),
+
// Original filename is ã»ãµããã®æçç©èª
MACDEMO1_l("futarinoryori", "Demo", "A Tale of Two Chefs", "22815cf659b911c4e07d0015cac5d98f", 301681, Common::JA_JPN, 400),
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index 44bbcad45a1..86130a4b116 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -196,20 +196,45 @@ void Window::probeMacBinary(MacArchive *archive) {
Archive *Window::openMainArchive(const Common::String movie) {
debug(1, "openMainArchive(\"%s\")", movie.c_str());
+ // If the archive is already open, don't reopen it;
+ // just init from the existing archive. This prevents errors that
+ // can happen when trying to load the same archive more than once.
+ if (g_director->_allOpenResFiles.contains(movie)) {
+ _mainArchive = g_director->_allOpenResFiles.getVal(movie);
+
+ if (g_director->getPlatform() == Common::kPlatformWindows) {
+ return loadEXE(movie);
+ } else {
+ probeProjector(movie);
+ return loadMac(movie);
+ }
+ }
+
_mainArchive = g_director->createArchive();
if (!_mainArchive->openFile(movie)) {
- delete _mainArchive;
- _mainArchive = nullptr;
+ if (!SearchMan.hasFile(movie)) {
+ delete _mainArchive;
+ _mainArchive = nullptr;
- warning("openMainArchive(): Could not open '%s'", movie.c_str());
- return nullptr;
+ warning("openMainArchive(): Could not open '%s'", movie.c_str());
+ return nullptr;
+ } else {
+ warning("openMainArchive(): Could not open '%s'; trying EXE", movie.c_str());
+
+ if (g_director->getPlatform() == Common::kPlatformWindows) {
+ return loadEXE(movie);
+ } else {
+ probeProjector(movie);
+ return loadMac(movie);
+ }
+ }
}
return _mainArchive;
}
-void Window::loadEXE(const Common::String movie) {
+Archive *Window::loadEXE(const Common::String movie) {
Common::SeekableReadStream *iniStream = SearchMan.createReadStreamForMember("LINGO.INI");
if (iniStream) {
char *script = (char *)calloc(iniStream->size() + 1, 1);
@@ -229,7 +254,7 @@ void Window::loadEXE(const Common::String movie) {
Common::SeekableReadStream *exeStream = SearchMan.createReadStreamForMember(Common::Path(movie, g_director->_dirSeparator));
if (!exeStream)
- error("Failed to open EXE '%s'", g_director->getEXEName().c_str());
+ return nullptr;
uint32 initialTag = exeStream->readUint32LE();
if (initialTag == MKTAG('R', 'I', 'F', 'X') || initialTag == MKTAG('X', 'F', 'I', 'R')) {
@@ -239,11 +264,11 @@ void Window::loadEXE(const Common::String movie) {
_mainArchive = new RIFFArchive();
if (!_mainArchive->openStream(exeStream, 0))
- error("Failed to load RIFF");
+ return nullptr;
} else {
Common::WinResources *exe = Common::WinResources::createFromEXE(movie);
if (!exe)
- error("Failed to open EXE '%s'", g_director->getEXEName().c_str());
+ return nullptr;
const Common::Array<Common::WinResourceID> versions = exe->getIDList(Common::kWinVersion);
for (uint i = 0; i < versions.size(); i++) {
@@ -276,12 +301,17 @@ void Window::loadEXE(const Common::String movie) {
} else if (g_director->getVersion() >= 200) {
loadEXEv3(exeStream);
} else {
- error("Unhandled Windows EXE version %d", g_director->getVersion());
+ warning("Unhandled Windows EXE version %d", g_director->getVersion());
+ return nullptr;
}
}
- if (_mainArchive)
+ if (_mainArchive) {
_mainArchive->setPathName(movie);
+ return _mainArchive;
+ } else {
+ return nullptr;
+ }
}
void Window::loadEXEv3(Common::SeekableReadStream *stream) {
@@ -426,15 +456,17 @@ void Window::loadEXERIFX(Common::SeekableReadStream *stream, uint32 offset) {
error("Failed to load RIFX from EXE");
}
-void Window::loadMac(const Common::String movie) {
+Archive *Window::loadMac(const Common::String movie) {
if (g_director->getVersion() < 400) {
// The data is part of the resource fork of the executable
- openMainArchive(movie);
+ return openMainArchive(movie);
} else {
// The RIFX is located in the data fork of the executable
Common::SeekableReadStream *dataFork = Common::MacResManager::openFileOrDataFork(Common::Path(movie, g_director->_dirSeparator));
- if (!dataFork)
- error("Failed to open Mac binary '%s'", movie.c_str());
+ if (!dataFork) {
+ warning("Failed to open Mac binary '%s'", movie.c_str());
+ return nullptr;
+ }
_mainArchive = new RIFXArchive();
_mainArchive->setPathName(movie);
@@ -456,6 +488,8 @@ void Window::loadMac(const Common::String movie) {
delete _currentMovie;
_currentMovie = nullptr;
}
+
+ return _mainArchive;
}
}
diff --git a/engines/director/window.h b/engines/director/window.h
index 9ee9fc746ba..9474373f1f2 100644
--- a/engines/director/window.h
+++ b/engines/director/window.h
@@ -172,13 +172,13 @@ public:
void probeProjector(const Common::String &movie);
void probeMacBinary(MacArchive *archive);
Archive *openMainArchive(const Common::String movie);
- void loadEXE(const Common::String movie);
+ Archive *loadEXE(const Common::String movie);
void loadEXEv3(Common::SeekableReadStream *stream);
void loadEXEv4(Common::SeekableReadStream *stream);
void loadEXEv5(Common::SeekableReadStream *stream);
void loadEXEv7(Common::SeekableReadStream *stream);
void loadEXERIFX(Common::SeekableReadStream *stream, uint32 offset);
- void loadMac(const Common::String movie);
+ Archive *loadMac(const Common::String movie);
void loadStartMovieXLibs();
// lingo/lingo-object.cpp
Commit: 08406b4510d4e6cbf17d2035e0f945a756d3be48
https://github.com/scummvm/scummvm/commit/08406b4510d4e6cbf17d2035e0f945a756d3be48
Author: Misty De Meo (mistydemeo at gmail.com)
Date: 2023-01-15T23:32:06+01:00
Commit Message:
DIRECTOR: add SearchMan check
Changed paths:
engines/director/resource.cpp
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index 86130a4b116..ec075686ff3 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -199,7 +199,7 @@ Archive *Window::openMainArchive(const Common::String movie) {
// If the archive is already open, don't reopen it;
// just init from the existing archive. This prevents errors that
// can happen when trying to load the same archive more than once.
- if (g_director->_allOpenResFiles.contains(movie)) {
+ if (g_director->_allOpenResFiles.contains(movie) && SearchMan.hasFile(movie)) {
_mainArchive = g_director->_allOpenResFiles.getVal(movie);
if (g_director->getPlatform() == Common::kPlatformWindows) {
More information about the Scummvm-git-logs
mailing list