COMPOSER: Support full macbinary dump

Currently the code assumes that normal file opening is good enough but it's a
problem if the disk has been dumped as macbinary
This commit is contained in:
Vladimir Serbinenko 2022-12-28 23:57:48 +01:00 committed by Eugene Sandulenko
parent 52b9d064d9
commit 778106a67b
2 changed files with 8 additions and 5 deletions

View File

@ -26,6 +26,7 @@
#include "common/substream.h"
#include "common/util.h"
#include "common/textconsole.h"
#include "common/macresman.h"
namespace Composer {
@ -41,10 +42,10 @@ Archive::~Archive() {
}
bool Archive::openFile(const Common::String &fileName) {
Common::File *file = new Common::File();
Common::SeekableReadStream *file
= Common::MacResManager::openFileOrDataFork(fileName);
if (!file->open(fileName)) {
delete file;
if (!file) {
return false;
}

View File

@ -24,6 +24,7 @@
#include "composer/composer.h"
#include "composer/graphics.h"
#include "composer/resource.h"
#include "common/macresman.h"
namespace Composer {
@ -616,8 +617,9 @@ int16 ComposerEngine::scriptFuncCall(uint16 id, int16 param1, int16 param2, int1
if (!_bookIni.hasKey(Common::String::format("%d", param1), "Data"))
return 0;
filename = getFilename("Data", param1);
Common::File *file = new Common::File();
if (!file->open(filename))
Common::SeekableReadStream *file =
Common::MacResManager::openFileOrDataFork(filename);
if (!file)
error("couldn't open '%s' to get vars id '%d'", filename.c_str(), param1);
stream = file;
}