mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 22:28:10 +00:00
DIRECTOR: Skip SearchMan detour in fallback detection
This commit is contained in:
parent
1515bb31a6
commit
6a7d43288f
@ -165,26 +165,20 @@ const ADGameDescription *DirectorMetaEngine::fallbackDetect(const FileMap &allFi
|
|||||||
if (!fileName.hasSuffix(".exe"))
|
if (!fileName.hasSuffix(".exe"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SearchMan.clear();
|
Common::File f;
|
||||||
SearchMan.addDirectory(file->getParent().getName(), file->getParent());
|
if (!f.open(*file))
|
||||||
|
|
||||||
Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(file->getName());
|
|
||||||
|
|
||||||
if (!stream)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
stream->seek(-4, SEEK_END);
|
f.seek(-4, SEEK_END);
|
||||||
|
|
||||||
uint32 offset = stream->readUint32LE();
|
uint32 offset = f.readUint32LE();
|
||||||
|
|
||||||
if (stream->eos() || offset == 0 || offset >= (uint32)(stream->size() - 4)) {
|
if (f.eos() || offset == 0 || offset >= (uint32)(f.size() - 4))
|
||||||
delete stream;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
stream->seek(offset);
|
f.seek(offset);
|
||||||
|
|
||||||
uint32 tag = stream->readUint32LE();
|
uint32 tag = f.readUint32LE();
|
||||||
|
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case MKTAG('3', '9', 'J', 'P'):
|
case MKTAG('3', '9', 'J', 'P'):
|
||||||
@ -200,41 +194,31 @@ const ADGameDescription *DirectorMetaEngine::fallbackDetect(const FileMap &allFi
|
|||||||
// Prior to version 4, there was no tag here. So we'll use a bit of a
|
// Prior to version 4, there was no tag here. So we'll use a bit of a
|
||||||
// heuristic to detect. The first field is the entry count, of which
|
// heuristic to detect. The first field is the entry count, of which
|
||||||
// there should only be one.
|
// there should only be one.
|
||||||
if ((tag & 0xFFFF) != 1) {
|
if ((tag & 0xFFFF) != 1)
|
||||||
delete stream;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
stream->skip(3);
|
f.skip(3);
|
||||||
|
|
||||||
uint32 mmmSize = stream->readUint32LE();
|
uint32 mmmSize = f.readUint32LE();
|
||||||
|
|
||||||
if (stream->eos() || mmmSize == 0) {
|
if (f.eos() || mmmSize == 0)
|
||||||
delete stream;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
byte fileNameSize = stream->readByte();
|
byte fileNameSize = f.readByte();
|
||||||
|
|
||||||
if (stream->eos()) {
|
if (f.eos())
|
||||||
delete stream;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
stream->skip(fileNameSize);
|
f.skip(fileNameSize);
|
||||||
byte directoryNameSize = stream->readByte();
|
byte directoryNameSize = f.readByte();
|
||||||
|
|
||||||
if (stream->eos()) {
|
if (f.eos())
|
||||||
delete stream;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
stream->skip(directoryNameSize);
|
f.skip(directoryNameSize);
|
||||||
|
|
||||||
if (stream->pos() != stream->size() - 4) {
|
if (f.pos() != f.size() - 4)
|
||||||
delete stream;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
// Assume v3 at this point (for now at least)
|
// Assume v3 at this point (for now at least)
|
||||||
desc->version = 3;
|
desc->version = 3;
|
||||||
|
Loading…
Reference in New Issue
Block a user