mirror of
https://github.com/libretro/scummvm.git
synced 2024-11-30 21:00:39 +00:00
WINTERMUTE: Avoid REQUIRING wintermute.zip during detection.
This commit is contained in:
parent
94893636e4
commit
dedde93d1e
@ -53,7 +53,8 @@ namespace Wintermute {
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
BaseFileManager::BaseFileManager(Common::Language lang) {
|
||||
BaseFileManager::BaseFileManager(Common::Language lang, bool detectionMode) {
|
||||
_detectionMode = detectionMode;
|
||||
_language = lang;
|
||||
_resources = nullptr;
|
||||
initResources();
|
||||
@ -232,12 +233,14 @@ bool BaseFileManager::registerPackage(Common::FSNode file, const Common::String
|
||||
|
||||
void BaseFileManager::initResources() {
|
||||
_resources = Common::makeZipArchive("wintermute.zip");
|
||||
if (!_resources) {
|
||||
if (!_resources && !_detectionMode) { // Wintermute.zip is unavailable during detection
|
||||
error("Couldn't load wintermute.zip");
|
||||
}
|
||||
assert(_resources->hasFile("syste_font.bmp"));
|
||||
assert(_resources->hasFile("invalid.bmp"));
|
||||
assert(_resources->hasFile("invalid_debug.bmp"));
|
||||
if (_resources) {
|
||||
assert(_resources->hasFile("syste_font.bmp"));
|
||||
assert(_resources->hasFile("invalid.bmp"));
|
||||
assert(_resources->hasFile("invalid_debug.bmp"));
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -277,7 +280,7 @@ bool BaseFileManager::hasFile(const Common::String &filename) {
|
||||
if (_packages.hasFile(filename)) {
|
||||
return true; // We don't bother checking if the file can actually be opened, something bigger is wrong if that is the case.
|
||||
}
|
||||
if (_resources->hasFile(filename)) {
|
||||
if (!_detectionMode && _resources->hasFile(filename)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -337,7 +340,9 @@ Common::SeekableReadStream *BaseFileManager::openFileRaw(const Common::String &f
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = _resources->createReadStreamForMember(filename);
|
||||
if (!_detectionMode) {
|
||||
ret = _resources->createReadStreamForMember(filename);
|
||||
}
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
Common::SeekableReadStream *openFile(const Common::String &filename, bool absPathWarning = true, bool keepTrackOf = true);
|
||||
byte *readWholeFile(const Common::String &filename, uint32 *size = nullptr, bool mustExist = true);
|
||||
|
||||
BaseFileManager(Common::Language lang);
|
||||
BaseFileManager(Common::Language lang, bool detectionMode = false);
|
||||
virtual ~BaseFileManager();
|
||||
// Used only for detection
|
||||
bool registerPackages(const Common::FSList &fslist);
|
||||
@ -65,6 +65,7 @@ private:
|
||||
Common::FSList _packagePaths;
|
||||
bool findPackageSignature(Common::SeekableReadStream *f, uint32 *offset);
|
||||
bool registerPackage(Common::FSNode package, const Common::String &filename = "", bool searchSignature = false);
|
||||
bool _detectionMode;
|
||||
Common::SearchSet _packages;
|
||||
Common::Array<Common::SeekableReadStream *> _openFiles;
|
||||
Common::Language _language;
|
||||
|
@ -311,7 +311,7 @@ bool WintermuteEngine::getGameInfo(const Common::FSList &fslist, Common::String
|
||||
caption = name = "(invalid)";
|
||||
Common::SeekableReadStream *stream = nullptr;
|
||||
// Quick-fix, instead of possibly breaking the persistence-system, let's just roll with it
|
||||
BaseFileManager *fileMan = new BaseFileManager(Common::UNK_LANG);
|
||||
BaseFileManager *fileMan = new BaseFileManager(Common::UNK_LANG, true);
|
||||
fileMan->registerPackages(fslist);
|
||||
stream = fileMan->openFile("startup.settings", false, false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user