HADESCH: Support files in MacBinary format

This commit is contained in:
Vladimir Serbinenko
2022-11-20 17:21:44 +01:00
committed by Eugene Sandulenko
parent c92ec629db
commit 64cd45c30e
3 changed files with 17 additions and 10 deletions
+5 -5
View File
@@ -490,10 +490,10 @@ Common::Error HadeschEngine::run() {
};
debug("HadeschEngine: loading wd.pod");
for (uint i = 0; i < ARRAYSIZE(wdpodpaths); ++i) {
Common::SharedPtr<Common::File> file(new Common::File());
if (file->open(wdpodpaths[i])) {
Common::SharedPtr<Common::SeekableReadStream> stream(Common::MacResManager::openFileOrDataFork(wdpodpaths[i]));
if (stream) {
_wdPodFile = Common::SharedPtr<PodFile>(new PodFile("WD.POD"));
_wdPodFile->openStore(file);
_wdPodFile->openStore(stream);
break;
}
}
@@ -511,8 +511,8 @@ Common::Error HadeschEngine::run() {
// on cdScenePath
const char *const scenepaths[] = {"CDAssets/", "Scenes/"};
for (uint i = 0; i < ARRAYSIZE(scenepaths); ++i) {
Common::ScopedPtr<Common::File> file(new Common::File());
if (file->open(Common::String(scenepaths[i]) + "OLYMPUS/OL.POD")) {
Common::ScopedPtr<Common::SeekableReadStream> stream(Common::MacResManager::openFileOrDataFork(Common::String(scenepaths[i]) + "OLYMPUS/OL.POD"));
if (stream) {
_cdScenesPath = scenepaths[i];
break;
}
+8 -3
View File
@@ -22,6 +22,7 @@
*/
#include "common/debug.h"
#include "common/file.h"
#include "common/macresman.h"
#include "common/memstream.h"
#include "hadesch/hadesch.h"
@@ -75,12 +76,16 @@ bool PodFile::openStore(const Common::SharedPtr<Common::SeekableReadStream> &par
}
bool PodFile::openStore(const Common::String &name) {
Common::SharedPtr<Common::File> file(new Common::File());
if (name.empty() || !file->open(name)) {
if (name.empty()) {
return false;
}
return openStore(file);
Common::SharedPtr<Common::SeekableReadStream> stream(Common::MacResManager::openFileOrDataFork(name));
if (!stream) {
return false;
}
return openStore(stream);
}
// It's tempting to use substream but substream is not thread safe
+4 -2
View File
@@ -32,6 +32,7 @@
#include "hadesch/pod_file.h"
#include "hadesch/baptr.h"
#include "common/translation.h"
#include "common/macresman.h"
static const int kVideoMaxW = 1280;
static const int kVideoMaxH = 480;
@@ -758,12 +759,13 @@ void VideoRoom::playVideo(const Common::String &name, int zValue,
Common::SharedPtr<Video::SmackerDecoder> decoder
= Common::SharedPtr<Video::SmackerDecoder>(new Video::SmackerDecoder());
Common::File *file = new Common::File;
Common::String mappedName = _assetMap.get(name, 1);
if (mappedName == "") {
mappedName = name;
}
if (!file->open(_smkPath + "/" + mappedName + ".SMK") || !decoder->loadStream(file)) {
Common::SeekableReadStream *stream = Common::MacResManager::openFileOrDataFork(_smkPath + "/" + mappedName + ".SMK");
if (!stream || !decoder->loadStream(stream)) {
debug("Video file %s can't be opened", name.c_str());
g_vm->handleEvent(callbackEvent);
return;