From 4a10bc8b141f575ceb9c4d87563290d2791e3380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Einar=20Johan=20Tr=C3=B8an=20S=C3=B8ma=CC=8Aen?= Date: Sat, 2 Jun 2012 11:09:22 +0200 Subject: [PATCH] WINTERMUTE: Revamp the file-system to deliver Common::-streams directly --- engines/wintermute/Ad/AdGame.cpp | 2 +- engines/wintermute/Ad/AdSentence.cpp | 2 +- engines/wintermute/Base/BFileManager.cpp | 49 ++-- engines/wintermute/Base/BFileManager.h | 8 +- engines/wintermute/Base/BFontTT.cpp | 2 +- engines/wintermute/Base/BGame.cpp | 13 +- engines/wintermute/Base/BResources.cpp | 28 +- engines/wintermute/Base/BResources.h | 5 +- engines/wintermute/Base/BSoundBuffer.cpp | 2 +- engines/wintermute/Base/BSoundBuffer.h | 4 +- engines/wintermute/Base/BSoundMgr.cpp | 2 +- engines/wintermute/Base/BSprite.cpp | 2 +- engines/wintermute/Base/BSurfaceSDL.cpp | 4 +- engines/wintermute/Base/BSurfaceStorage.cpp | 2 +- engines/wintermute/Base/PartEmitter.cpp | 2 +- engines/wintermute/Base/file/BDiskFile.cpp | 270 ++++++------------ engines/wintermute/Base/file/BDiskFile.h | 19 +- engines/wintermute/Base/file/BFile.h | 1 + engines/wintermute/Base/file/BPkgFile.cpp | 136 +++------ engines/wintermute/Base/file/BPkgFile.h | 22 +- .../wintermute/Base/file/BResourceFile.cpp | 103 ------- engines/wintermute/Base/file/BResourceFile.h | 50 ---- .../wintermute/Base/scriptables/SXFile.cpp | 34 +-- engines/wintermute/Base/scriptables/SXFile.h | 3 +- engines/wintermute/module.mk | 1 - 25 files changed, 200 insertions(+), 566 deletions(-) delete mode 100644 engines/wintermute/Base/file/BResourceFile.cpp delete mode 100644 engines/wintermute/Base/file/BResourceFile.h diff --git a/engines/wintermute/Ad/AdGame.cpp b/engines/wintermute/Ad/AdGame.cpp index 175cc98b388..584504b7c66 100644 --- a/engines/wintermute/Ad/AdGame.cpp +++ b/engines/wintermute/Ad/AdGame.cpp @@ -1903,7 +1903,7 @@ char *CAdGame::FindSpeechFile(char *StringID) { for (int i = 0; i < _speechDirs.GetSize(); i++) { sprintf(Ret, "%s%s.ogg", _speechDirs[i], StringID); - CBFile *File = _fileManager->OpenFile(Ret); + Common::SeekableReadStream *File = _fileManager->OpenFile(Ret); if (File) { _fileManager->CloseFile(File); return Ret; diff --git a/engines/wintermute/Ad/AdSentence.cpp b/engines/wintermute/Ad/AdSentence.cpp index 28e5b2cf260..e513d1f3ed9 100644 --- a/engines/wintermute/Ad/AdSentence.cpp +++ b/engines/wintermute/Ad/AdSentence.cpp @@ -251,7 +251,7 @@ HRESULT CAdSentence::SetupTalkFile(const char *SoundFilename) { AnsiString talkDefFileName = PathUtil::Combine(path, name + ".talk"); - CBFile *file = Game->_fileManager->OpenFile(talkDefFileName.c_str()); + Common::SeekableReadStream *file = Game->_fileManager->OpenFile(talkDefFileName.c_str()); if (file) { Game->_fileManager->CloseFile(file); } else return S_OK; // no talk def file found diff --git a/engines/wintermute/Base/BFileManager.cpp b/engines/wintermute/Base/BFileManager.cpp index 8ba77b90b40..ce33e1a13c5 100644 --- a/engines/wintermute/Base/BFileManager.cpp +++ b/engines/wintermute/Base/BFileManager.cpp @@ -33,10 +33,10 @@ #include "engines/wintermute/utils/StringUtil.h" #include "engines/wintermute/utils/PathUtil.h" #include "engines/wintermute/Base/file/BDiskFile.h" -#include "engines/wintermute/Base/file/BResourceFile.h" #include "engines/wintermute/Base/file/BSaveThumbFile.h" #include "engines/wintermute/Base/BFileEntry.h" #include "engines/wintermute/Base/file/BPkgFile.h" +#include "engines/wintermute/Base/BResources.h" #include "engines/wintermute/Base/BPackage.h" #include "engines/wintermute/Base/BRegistry.h" #include "engines/wintermute/Base/BGame.h" @@ -96,7 +96,6 @@ HRESULT CBFileManager::Cleanup() { // close open files for (i = 0; i < _openFiles.GetSize(); i++) { - _openFiles[i]->Close(); delete _openFiles[i]; } _openFiles.RemoveAll(); @@ -121,7 +120,7 @@ byte *CBFileManager::ReadWholeFile(const char *Filename, uint32 *Size, bool Must byte *buffer = NULL; - CBFile *File = OpenFile(Filename); + Common::SeekableReadStream *File = OpenFile(Filename); if (!File) { if (MustExist) Game->LOG(0, "Error opening file '%s'", Filename); return NULL; @@ -136,22 +135,22 @@ byte *CBFileManager::ReadWholeFile(const char *Filename, uint32 *Size, bool Must */ - buffer = new byte[File->getSize() + 1]; + buffer = new byte[File->size() + 1]; if (buffer == NULL) { - Game->LOG(0, "Error allocating buffer for file '%s' (%d bytes)", Filename, File->getSize() + 1); + Game->LOG(0, "Error allocating buffer for file '%s' (%d bytes)", Filename, File->size() + 1); CloseFile(File); return NULL; } - if (FAILED(File->Read(buffer, File->getSize()))) { + if (File->read(buffer, File->size()) != File->size()) { Game->LOG(0, "Error reading file '%s'", Filename); CloseFile(File); delete [] buffer; return NULL; }; - buffer[File->getSize()] = '\0'; - if (Size != NULL) *Size = File->getSize(); + buffer[File->size()] = '\0'; + if (Size != NULL) *Size = File->size(); CloseFile(File); return buffer; @@ -751,10 +750,10 @@ CBFileEntry *CBFileManager::GetPackageEntry(const char *Filename) { ////////////////////////////////////////////////////////////////////////// -CBFile *CBFileManager::OpenFile(const char *Filename, bool AbsPathWarning) { +Common::SeekableReadStream *CBFileManager::OpenFile(const char *Filename, bool AbsPathWarning) { if (strcmp(Filename, "") == 0) return NULL; //Game->LOG(0, "open file: %s", Filename); -#ifdef __WIN32__ +/*#ifdef __WIN32__ if (Game->_dEBUG_DebugMode && Game->_dEBUG_AbsolutePathWarning && AbsPathWarning) { char Drive[_MAX_DRIVE]; _splitpath(Filename, Drive, NULL, NULL, NULL); @@ -762,19 +761,18 @@ CBFile *CBFileManager::OpenFile(const char *Filename, bool AbsPathWarning) { Game->LOG(0, "WARNING: Referencing absolute path '%s'. The game will NOT work on another computer.", Filename); } } -#endif +#endif*/ - CBFile *File = OpenFileRaw(Filename); + Common::SeekableReadStream *File = OpenFileRaw(Filename); if (File) _openFiles.Add(File); return File; } ////////////////////////////////////////////////////////////////////////// -HRESULT CBFileManager::CloseFile(CBFile *File) { +HRESULT CBFileManager::CloseFile(Common::SeekableReadStream *File) { for (int i = 0; i < _openFiles.GetSize(); i++) { if (_openFiles[i] == File) { - _openFiles[i]->Close(); delete _openFiles[i]; _openFiles.RemoveAt(i); return S_OK; @@ -785,30 +783,29 @@ HRESULT CBFileManager::CloseFile(CBFile *File) { ////////////////////////////////////////////////////////////////////////// -CBFile *CBFileManager::OpenFileRaw(const Common::String &Filename) { +Common::SeekableReadStream *CBFileManager::OpenFileRaw(const Common::String &Filename) { RestoreCurrentDir(); if (scumm_strnicmp(Filename.c_str(), "savegame:", 9) == 0) { CBSaveThumbFile *SaveThumbFile = new CBSaveThumbFile(Game); - if (SUCCEEDED(SaveThumbFile->Open(Filename))) return SaveThumbFile; + if (SUCCEEDED(SaveThumbFile->Open(Filename))) return SaveThumbFile->getMemStream(); else { delete SaveThumbFile; return NULL; } } - CBDiskFile *DiskFile = new CBDiskFile(Game); - if (SUCCEEDED(DiskFile->Open(Filename))) return DiskFile; + Common::SeekableReadStream *ret = NULL; + + ret = openDiskFile(Filename, this); + if (ret) return ret; - delete DiskFile; - CBPkgFile *PkgFile = new CBPkgFile(Game); - if (SUCCEEDED(PkgFile->Open(Filename))) return PkgFile; + ret = openPkgFile(Filename, this); + if (ret) return ret; + + ret = CBResources::getFile(Filename); + if (ret) return ret; - delete PkgFile; - CBResourceFile *ResFile = new CBResourceFile(Game); - if (SUCCEEDED(ResFile->Open(Filename))) return ResFile; - - delete ResFile; warning("BFileManager::OpenFileRaw - Failed to open %s", Filename.c_str()); return NULL; } diff --git a/engines/wintermute/Base/BFileManager.h b/engines/wintermute/Base/BFileManager.h index cf0e284cc15..77f99c8570e 100644 --- a/engines/wintermute/Base/BFileManager.h +++ b/engines/wintermute/Base/BFileManager.h @@ -50,9 +50,9 @@ public: HRESULT RestoreCurrentDir(); char *_basePath; bool GetFullPath(const char *Filename, char *Fullname); - CBFile *OpenFileRaw(const Common::String &filename); - HRESULT CloseFile(CBFile *File); - CBFile *OpenFile(const char *Filename, bool AbsPathWarning = true); + Common::SeekableReadStream *OpenFileRaw(const Common::String &filename); + HRESULT CloseFile(Common::SeekableReadStream *File); + Common::SeekableReadStream *OpenFile(const char *Filename, bool AbsPathWarning = true); CBFileEntry *GetPackageEntry(const char *Filename); Common::File *OpenSingleFile(const char *Name); Common::File *OpenPackage(const char *Name); @@ -71,7 +71,7 @@ public: CBArray _singlePaths; CBArray _packagePaths; CBArray _packages; - CBArray _openFiles; + CBArray _openFiles; Common::HashMap _files; private: diff --git a/engines/wintermute/Base/BFontTT.cpp b/engines/wintermute/Base/BFontTT.cpp index 6ec9382a633..e18279a73da 100644 --- a/engines/wintermute/Base/BFontTT.cpp +++ b/engines/wintermute/Base/BFontTT.cpp @@ -611,7 +611,7 @@ HRESULT CBFontTT::InitFont() { if (!_fontFile) return E_FAIL; warning("BFontTT::InitFont - Not ported yet"); - CBFile *file = Game->_fileManager->OpenFile(_fontFile); + Common::SeekableReadStream *file = Game->_fileManager->OpenFile(_fontFile); if (!file) { // the requested font file is not in wme file space; try loading a system font AnsiString fontFileName = PathUtil::Combine(CBPlatform::GetSystemFontPath(), PathUtil::GetFileName(_fontFile)); diff --git a/engines/wintermute/Base/BGame.cpp b/engines/wintermute/Base/BGame.cpp index 9b840cd273e..c9b122759dd 100644 --- a/engines/wintermute/Base/BGame.cpp +++ b/engines/wintermute/Base/BGame.cpp @@ -1722,7 +1722,7 @@ HRESULT CBGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *ThisS Stack->CorrectParams(1); const char *Filename = Stack->Pop()->GetString(); - CBFile *File = _fileManager->OpenFile(Filename, false); + Common::SeekableReadStream *File = _fileManager->OpenFile(Filename, false); if (!File) Stack->PushBool(false); else { _fileManager->CloseFile(File); @@ -2073,17 +2073,16 @@ HRESULT CBGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *ThisS const char *Filename = Stack->Pop()->GetString(); bool AsHex = Stack->Pop()->GetBool(false); - CBFile *File = _fileManager->OpenFile(Filename, false); + Common::SeekableReadStream *File = _fileManager->OpenFile(Filename, false); if (File) { crc remainder = crc_initialize(); byte Buf[1024]; int BytesRead = 0; - while (BytesRead < File->getSize()) { - int BufSize = MIN((uint32)1024, File->getSize() - BytesRead); - BytesRead += BufSize; + while (BytesRead < File->size()) { + int BufSize = MIN((uint32)1024, (uint32)(File->size() - BytesRead)); + BytesRead += File->read(Buf, BufSize); - File->Read(Buf, BufSize); for (int i = 0; i < BufSize; i++) { remainder = crc_process_byte(Buf[i], remainder); } @@ -3922,7 +3921,7 @@ bool CBGame::IsSaveSlotUsed(int Slot) { char Filename[MAX_PATH + 1]; GetSaveSlotFilename(Slot, Filename); - CBFile *File = _fileManager->OpenFile(Filename, false); + Common::SeekableReadStream *File = _fileManager->OpenFile(Filename, false); if (!File) return false; _fileManager->CloseFile(File); diff --git a/engines/wintermute/Base/BResources.cpp b/engines/wintermute/Base/BResources.cpp index d0714abaf2e..3b6d0a264c5 100644 --- a/engines/wintermute/Base/BResources.cpp +++ b/engines/wintermute/Base/BResources.cpp @@ -29,6 +29,7 @@ #include "engines/wintermute/PlatformSDL.h" #include "engines/wintermute/Base/BResources.h" #include "common/str.h" +#include "common/memstream.h" namespace WinterMute { @@ -2805,26 +2806,15 @@ unsigned char systemfont[] = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 } ; - -////////////////////////////////////////////////////////////////////////// -bool CBResources::GetFile(const char *fileName, byte *&buffer, uint32 &size) { - // better! - if (scumm_stricmp(fileName, "invalid.bmp") == 0) { - buffer = invalid; - size = sizeof(invalid); - return true; - } else if (scumm_stricmp(fileName, "invalid_debug.bmp") == 0) { - buffer = invaliddebug; - size = sizeof(invaliddebug); - return true; - } else if (scumm_stricmp(fileName, "syste_font.bmp") == 0) { - buffer = systemfont; - size = sizeof(systemfont); - return true; +Common::SeekableReadStream *CBResources::getFile(const Common::String& fileName) { + if (scumm_stricmp(fileName.c_str(), "invalid.bmp") == 0) { + return new Common::MemoryReadStream(invalid, sizeof(invalid), DisposeAfterUse::NO); + } else if (scumm_stricmp(fileName.c_str(), "invalid_debug.bmp") == 0) { + return new Common::MemoryReadStream(invaliddebug, sizeof(invalid), DisposeAfterUse::NO); + } else if (scumm_stricmp(fileName.c_str(), "syste_font.bmp") == 0) { + return new Common::MemoryReadStream(systemfont, sizeof(invalid), DisposeAfterUse::NO); } - - - return false; + return NULL; } } // end of namespace WinterMute diff --git a/engines/wintermute/Base/BResources.h b/engines/wintermute/Base/BResources.h index 26d92af5259..f9a28865b4c 100644 --- a/engines/wintermute/Base/BResources.h +++ b/engines/wintermute/Base/BResources.h @@ -29,11 +29,14 @@ #ifndef WINTERMUTE_BRESOURCES_H #define WINTERMUTE_BRESOURCES_H +#include "common/stream.h" +#include "common/str.h" + namespace WinterMute { class CBResources { public: - static bool GetFile(const char *fileName, byte *&buffer, uint32 &size); + static Common::SeekableReadStream *getFile(const Common::String& fileName); }; } // end of namespace WinterMute diff --git a/engines/wintermute/Base/BSoundBuffer.cpp b/engines/wintermute/Base/BSoundBuffer.cpp index dd269d5b4ee..62a9bd78b6c 100644 --- a/engines/wintermute/Base/BSoundBuffer.cpp +++ b/engines/wintermute/Base/BSoundBuffer.cpp @@ -112,7 +112,7 @@ HRESULT CBSoundBuffer::LoadFromFile(const char *Filename, bool ForceReload) { return E_FAIL; } - _stream = Audio::makeVorbisStream(_file->getMemStream(), DisposeAfterUse::YES); + _stream = Audio::makeVorbisStream(_file, DisposeAfterUse::NO); CBUtils::SetString(&_filename, Filename); return S_OK; diff --git a/engines/wintermute/Base/BSoundBuffer.h b/engines/wintermute/Base/BSoundBuffer.h index 54453765552..9fa9dec1cf5 100644 --- a/engines/wintermute/Base/BSoundBuffer.h +++ b/engines/wintermute/Base/BSoundBuffer.h @@ -31,7 +31,7 @@ #include "engines/wintermute/Base/BBase.h" -//#include "bass.h" +#include "common/stream.h" namespace Audio { class SeekableAudioStream; @@ -84,7 +84,7 @@ public: uint32 _loopStart; TSoundType _type; bool _looping; - CBFile *_file; + Common::SeekableReadStream *_file; char *_filename; bool _streamed; int _privateVolume; diff --git a/engines/wintermute/Base/BSoundMgr.cpp b/engines/wintermute/Base/BSoundMgr.cpp index 8c98f83dc2e..bac53f6b221 100644 --- a/engines/wintermute/Base/BSoundMgr.cpp +++ b/engines/wintermute/Base/BSoundMgr.cpp @@ -137,7 +137,7 @@ CBSoundBuffer *CBSoundMgr::addSound(const char *Filename, TSoundType Type, bool AnsiString name = PathUtil::GetFileNameWithoutExtension(Filename); AnsiString newFile = PathUtil::Combine(path, name + "ogg"); - CBFile *file = Game->_fileManager->OpenFile(newFile.c_str()); + Common::SeekableReadStream *file = Game->_fileManager->OpenFile(newFile.c_str()); if (file) { Filename = newFile.c_str(); Game->_fileManager->CloseFile(file); diff --git a/engines/wintermute/Base/BSprite.cpp b/engines/wintermute/Base/BSprite.cpp index 87da65e9d05..f3f35a83642 100644 --- a/engines/wintermute/Base/BSprite.cpp +++ b/engines/wintermute/Base/BSprite.cpp @@ -123,7 +123,7 @@ HRESULT CBSprite::Draw(int X, int Y, CBObject *Register, float ZoomX, float Zoom ////////////////////////////////////////////////////////////////////// HRESULT CBSprite::LoadFile(const char *Filename, int LifeTime, TSpriteCacheType CacheType) { - CBFile *File = Game->_fileManager->OpenFile(Filename); + Common::SeekableReadStream *File = Game->_fileManager->OpenFile(Filename); if (!File) { Game->LOG(0, "CBSprite::LoadFile failed for file '%s'", Filename); if (Game->_dEBUG_DebugMode) return LoadFile("invalid_debug.bmp", LifeTime, CacheType); diff --git a/engines/wintermute/Base/BSurfaceSDL.cpp b/engines/wintermute/Base/BSurfaceSDL.cpp index 166fbc171bc..f41839a2442 100644 --- a/engines/wintermute/Base/BSurfaceSDL.cpp +++ b/engines/wintermute/Base/BSurfaceSDL.cpp @@ -85,10 +85,10 @@ HRESULT CBSurfaceSDL::Create(const char *Filename, bool default_ck, byte ck_red, error("CBSurfaceSDL::Create : Unsupported fileformat %s", Filename); } - CBFile *file = Game->_fileManager->OpenFile(Filename); + Common::SeekableReadStream *file = Game->_fileManager->OpenFile(Filename); if (!file) return E_FAIL; - imgDecoder->loadStream(*file->getMemStream()); + imgDecoder->loadStream(*file); const Graphics::Surface *surface = imgDecoder->getSurface(); Game->_fileManager->CloseFile(file); diff --git a/engines/wintermute/Base/BSurfaceStorage.cpp b/engines/wintermute/Base/BSurfaceStorage.cpp index 538b9a26493..1ff31e1338a 100644 --- a/engines/wintermute/Base/BSurfaceStorage.cpp +++ b/engines/wintermute/Base/BSurfaceStorage.cpp @@ -105,7 +105,7 @@ CBSurface *CBSurfaceStorage::AddSurface(const char *Filename, bool default_ck, b } } - CBFile *File = Game->_fileManager->OpenFile(Filename); + Common::SeekableReadStream *File = Game->_fileManager->OpenFile(Filename); if (!File) { if (Filename) Game->LOG(0, "Missing image: '%s'", Filename); if (Game->_dEBUG_DebugMode) diff --git a/engines/wintermute/Base/PartEmitter.cpp b/engines/wintermute/Base/PartEmitter.cpp index e37d0f1373e..29d51c063d5 100644 --- a/engines/wintermute/Base/PartEmitter.cpp +++ b/engines/wintermute/Base/PartEmitter.cpp @@ -123,7 +123,7 @@ HRESULT CPartEmitter::AddSprite(const char *Filename) { } // check if file exists - CBFile *File = Game->_fileManager->OpenFile(Filename); + Common::SeekableReadStream *File = Game->_fileManager->OpenFile(Filename); if (!File) { Game->LOG(0, "Sprite '%s' not found", Filename); return E_FAIL; diff --git a/engines/wintermute/Base/file/BDiskFile.cpp b/engines/wintermute/Base/file/BDiskFile.cpp index 8540829f095..57e9a0a0f00 100644 --- a/engines/wintermute/Base/file/BDiskFile.cpp +++ b/engines/wintermute/Base/file/BDiskFile.cpp @@ -33,198 +33,98 @@ #include "engines/wintermute/Base/file/BDiskFile.h" #include "engines/wintermute/Base/BFileManager.h" #include "common/stream.h" +#include "common/memstream.h" #include "common/file.h" +#include "common/zlib.h" namespace WinterMute { -////////////////////////////////////////////////////////////////////////// -CBDiskFile::CBDiskFile(CBGame *inGame): CBFile(inGame) { - _file = NULL; - _data = NULL; - _compressed = false; - _prefixSize = 0; -} - - -////////////////////////////////////////////////////////////////////////// -CBDiskFile::~CBDiskFile() { - Close(); -} - - -////////////////////////////////////////////////////////////////////////// -HRESULT CBDiskFile::Open(const Common::String &Filename) { - Close(); - - char FullPath[MAX_PATH]; - - for (int i = 0; i < Game->_fileManager->_singlePaths.GetSize(); i++) { - sprintf(FullPath, "%s%s", Game->_fileManager->_singlePaths[i], Filename.c_str()); - correctSlashes(FullPath); - //_file = Common::createFileStream(FullPath); - Common::File *tempFile = new Common::File(); - if (tempFile->open(FullPath)) { - _file = tempFile; - } else { - delete tempFile; - } - /* if (_file != NULL) { - error("Tried to open %s, but failed", Filename.c_str()); - break; - }*/ - } - - // if we didn't find it in search paths, try to open directly - if (!_file) { - strcpy(FullPath, Filename.c_str()); - correctSlashes(FullPath); - //error("Tried to open %s, TODO: add SearchMan-support", Filename.c_str()); - //_file = Common::createFileStream(FullPath); - Common::File *tempFile = new Common::File(); - if (tempFile->open(FullPath)) { - _file = tempFile; - } else { - delete tempFile; - } - } - - if (_file) { - uint32 magic1, magic2; - magic1 = _file->readUint32LE(); - magic2 = _file->readUint32LE(); - - if (magic1 == DCGF_MAGIC && magic2 == COMPRESSED_FILE_MAGIC) _compressed = true; - - if (_compressed) { - uint32 DataOffset, CompSize, UncompSize; - DataOffset = _file->readUint32LE(); - CompSize = _file->readUint32LE(); - UncompSize = _file->readUint32LE(); - - byte *CompBuffer = new byte[CompSize]; - if (!CompBuffer) { - Game->LOG(0, "Error allocating memory for compressed file '%s'", Filename.c_str()); - Close(); - return E_FAIL; - } - - _data = new byte[UncompSize]; - if (!_data) { - Game->LOG(0, "Error allocating buffer for file '%s'", Filename.c_str()); - delete [] CompBuffer; - Close(); - return E_FAIL; - } - _file->seek(DataOffset + _prefixSize, SEEK_SET); - _file->read(CompBuffer, CompSize); - - if (uncompress(_data, (uLongf *)&UncompSize, CompBuffer, CompSize) != Z_OK) { - Game->LOG(0, "Error uncompressing file '%s'", Filename.c_str()); - delete [] CompBuffer; - Close(); - return E_FAIL; - } - - delete [] CompBuffer; - _size = UncompSize; - _pos = 0; - delete _file; - _file = NULL; - } else { - _pos = 0; - _file->seek(0, SEEK_END); - _size = _file->pos() - _prefixSize; - _file->seek(_prefixSize, SEEK_SET); - } - - return S_OK; - } else return E_FAIL; -} - - -////////////////////////////////////////////////////////////////////////// -HRESULT CBDiskFile::Close() { - if (_file) { - delete _file; - } - _file = NULL; - _pos = 0; - _size = 0; - - delete[] _data; - _data = NULL; - - _compressed = false; - - return S_OK; -} - - -////////////////////////////////////////////////////////////////////////// -HRESULT CBDiskFile::Read(void *buffer, uint32 size) { - if (_compressed) { - memcpy(buffer, _data + _pos, size); - _pos += size; - return S_OK; - } else { - - if (_file) { - size_t count = _file->read(buffer, size); - _pos += count; - return S_OK; - } else return E_FAIL; - } -} - - -////////////////////////////////////////////////////////////////////////// -HRESULT CBDiskFile::Seek(uint32 pos, TSeek origin) { - // TODO: Should this really need to use uint32? - if (_compressed) { - uint32 newPos = 0; - - switch (origin) { - case SEEK_TO_BEGIN: - newPos = pos; - break; - case SEEK_TO_END: - newPos = _size + pos; - break; - case SEEK_TO_CURRENT: - newPos = _pos + pos; - break; - } - - if (newPos < 0 || newPos > _size) return E_FAIL; - else _pos = newPos; - return S_OK; - } else { - if (!_file) return E_FAIL; - int ret = 1; - - switch (origin) { - case SEEK_TO_BEGIN: - ret = _file->seek(_prefixSize + pos, SEEK_SET); - break; - case SEEK_TO_END: - ret = _file->seek(pos, SEEK_END); - break; - case SEEK_TO_CURRENT: - ret = _file->seek(pos, SEEK_CUR); - break; - } - if (ret == 0) { - _pos = _file->pos() - _prefixSize; - return S_OK; - } else return E_FAIL; - } -} - -////////////////////////////////////////////////////////////////////////// -void CBDiskFile::correctSlashes(char *fileName) { +void correctSlashes(char *fileName) { for (size_t i = 0; i < strlen(fileName); i++) { if (fileName[i] == '\\') fileName[i] = '/'; } } +Common::SeekableReadStream *openDiskFile(const Common::String &Filename, CBFileManager *fileManager) { + char FullPath[MAX_PATH]; + uint32 prefixSize = 0; + Common::SeekableReadStream *file = NULL; + + for (int i = 0; i < fileManager->_singlePaths.GetSize(); i++) { + sprintf(FullPath, "%s%s", fileManager->_singlePaths[i], Filename.c_str()); + correctSlashes(FullPath); + Common::File *tempFile = new Common::File(); + if (tempFile->open(FullPath)) { + file = tempFile; + } else { + delete tempFile; + } + } + + // if we didn't find it in search paths, try to open directly + if (!file) { + strcpy(FullPath, Filename.c_str()); + correctSlashes(FullPath); + + Common::File *tempFile = new Common::File(); + if (tempFile->open(FullPath)) { + file = tempFile; + } else { + delete tempFile; + } + } + + if (file) { + uint32 magic1, magic2; + magic1 = file->readUint32LE(); + magic2 = file->readUint32LE(); + + bool compressed = false; + if (magic1 == DCGF_MAGIC && magic2 == COMPRESSED_FILE_MAGIC) compressed = true; + + if (compressed) { + uint32 DataOffset, CompSize, UncompSize; + DataOffset = file->readUint32LE(); + CompSize = file->readUint32LE(); + UncompSize = file->readUint32LE(); + + byte *CompBuffer = new byte[CompSize]; + if (!CompBuffer) { + error("Error allocating memory for compressed file '%s'", Filename.c_str()); + delete file; + return NULL; + } + + byte *data = new byte[UncompSize]; + if (!data) { + error("Error allocating buffer for file '%s'", Filename.c_str()); + delete [] CompBuffer; + delete file; + return NULL; + } + file->seek(DataOffset + prefixSize, SEEK_SET); + file->read(CompBuffer, CompSize); + + if (Common::uncompress(data, (unsigned long *)&UncompSize, CompBuffer, CompSize) != true) { + error("Error uncompressing file '%s'", Filename.c_str()); + delete [] CompBuffer; + delete file; + return NULL; + } + + delete [] CompBuffer; + + return new Common::MemoryReadStream(data, UncompSize, DisposeAfterUse::YES); + delete file; + file = NULL; + } else { + return file; + } + + return file; + + } + return NULL; +} + } // end of namespace WinterMute diff --git a/engines/wintermute/Base/file/BDiskFile.h b/engines/wintermute/Base/file/BDiskFile.h index d9e7af548f7..ebe1400128f 100644 --- a/engines/wintermute/Base/file/BDiskFile.h +++ b/engines/wintermute/Base/file/BDiskFile.h @@ -29,30 +29,13 @@ #ifndef WINTERMUTE_BDISKFILE_H #define WINTERMUTE_BDISKFILE_H - -#include "engines/wintermute/Base/file/BFile.h" - namespace Common { class SeekableReadStream; } namespace WinterMute { -class CBDiskFile : public CBFile { -public: - CBDiskFile(CBGame *inGame); - virtual ~CBDiskFile(); - virtual HRESULT Seek(uint32 pos, TSeek origin = SEEK_TO_BEGIN); - virtual HRESULT Read(void *buffer, uint32 size); - virtual HRESULT Close(); - virtual HRESULT Open(const Common::String &filename); -private: - void correctSlashes(char *fileName); - Common::SeekableReadStream *_file; - byte *_data; - bool _compressed; - uint32 _prefixSize; -}; +Common::SeekableReadStream *openDiskFile(const Common::String &Filename, CBFileManager *fileManager); } // end of namespace WinterMute diff --git a/engines/wintermute/Base/file/BFile.h b/engines/wintermute/Base/file/BFile.h index fa6fafcb254..caeac3e14bb 100644 --- a/engines/wintermute/Base/file/BFile.h +++ b/engines/wintermute/Base/file/BFile.h @@ -32,6 +32,7 @@ #include "engines/wintermute/Base/BBase.h" #include "common/str.h" +#include "common/stream.h" namespace Common { class SeekableReadStream; diff --git a/engines/wintermute/Base/file/BPkgFile.cpp b/engines/wintermute/Base/file/BPkgFile.cpp index fe04b816d2e..ed3a24f3133 100644 --- a/engines/wintermute/Base/file/BPkgFile.cpp +++ b/engines/wintermute/Base/file/BPkgFile.cpp @@ -39,24 +39,23 @@ namespace WinterMute { -////////////////////////////////////////////////////////////////////////// -CBPkgFile::CBPkgFile(CBGame *inGame): CBFile(inGame) { - _fileEntry = NULL; - _file = NULL; - _compressed = false; - -} - -////////////////////////////////////////////////////////////////////////// -CBPkgFile::~CBPkgFile() { - Close(); -} - - -////////////////////////////////////////////////////////////////////////// -HRESULT CBPkgFile::Open(const Common::String &Filename) { - Close(); +// HACK: wrapCompressedStream might set the size to 0, so we need a way to override it. +class CBPkgFile : public Common::SeekableReadStream { + uint32 _size; + Common::SeekableReadStream *_stream; +public: + CBPkgFile(Common::SeekableReadStream *stream, uint32 knownLength) : _size(knownLength), _stream(stream) {} + virtual ~CBPkgFile() { delete _stream; } + virtual uint32 read(void *dataPtr, uint32 dataSize) { return _stream->read(dataPtr, dataSize); } + virtual bool eos() const { return _stream->eos(); } + virtual int32 pos() const { return _stream->pos(); } + virtual int32 size() const { return _size; } + virtual bool seek(int32 offset, int whence = SEEK_SET) { return _stream->seek(offset, whence); } +}; +Common::SeekableReadStream *openPkgFile(const Common::String &Filename, CBFileManager *fileManager) { + CBFileEntry *fileEntry; + Common::SeekableReadStream *file = NULL; char fileName[MAX_PATH]; strcpy(fileName, Filename.c_str()); @@ -65,97 +64,30 @@ HRESULT CBPkgFile::Open(const Common::String &Filename) { if (fileName[i] == '/') fileName[i] = '\\'; } - _fileEntry = Game->_fileManager->GetPackageEntry(fileName); - if (!_fileEntry) return E_FAIL; - - _file = _fileEntry->_package->GetFilePointer(); - if (!_file) return E_FAIL; - + fileEntry = fileManager->GetPackageEntry(fileName); + if (!fileEntry) return NULL; + + file = fileEntry->_package->GetFilePointer(); + if (!file) return NULL; + // TODO: Cleanup - _compressed = (_fileEntry->_compressedLength != 0); - _size = _fileEntry->_length; - - if (_compressed) { + bool compressed = (fileEntry->_compressedLength != 0); + /* _size = fileEntry->_length; */ + + if (compressed) { // TODO: Really, most of this logic might be doable directly in the fileEntry? // But for now, this should get us rolling atleast. - _file = Common::wrapCompressedReadStream(new Common::SeekableSubReadStream(_file, _fileEntry->_offset, _fileEntry->_offset + _fileEntry->_length, DisposeAfterUse::YES)); + file = Common::wrapCompressedReadStream(new Common::SeekableSubReadStream(file, fileEntry->_offset, fileEntry->_offset + fileEntry->_length, DisposeAfterUse::YES)); } else { - _file = new Common::SeekableSubReadStream(_file, _fileEntry->_offset, _fileEntry->_offset + _fileEntry->_length, DisposeAfterUse::YES); + file = new Common::SeekableSubReadStream(file, fileEntry->_offset, fileEntry->_offset + fileEntry->_length, DisposeAfterUse::YES); + } + if (file->size() == 0) { + file = new CBPkgFile(file, fileEntry->_length); } - SeekToPos(0); - - return S_OK; -} - - -////////////////////////////////////////////////////////////////////////// -HRESULT CBPkgFile::Close() { - if (_fileEntry) { - _fileEntry->_package->CloseFilePointer(_file); - _fileEntry = NULL; - } - _file = NULL; - - // TODO: Do we really need to take care of our position and size at all (or could (Safe)SubStreams fix that for us? - _pos = 0; - _size = 0; - - return S_OK; -} - - -////////////////////////////////////////////////////////////////////////// -HRESULT CBPkgFile::Read(void *Buffer, uint32 Size) { - if (!_fileEntry) return E_FAIL; - - HRESULT ret = S_OK; - - if (_pos + Size > _size) { - Size = _size - _pos; - if (Size == 0) return E_FAIL; - } - - ret = _file->read(Buffer, Size); - - _pos += Size; - - return ret; -} - - -////////////////////////////////////////////////////////////////////////// -HRESULT CBPkgFile::Seek(uint32 pos, TSeek origin) { - if (!_fileEntry) return E_FAIL; - - uint32 newPos = 0; - - switch (origin) { - case SEEK_TO_BEGIN: - newPos = pos; - break; - case SEEK_TO_END: - newPos = _size + pos; - break; - case SEEK_TO_CURRENT: - newPos = _pos + pos; - break; - } - - if (newPos < 0 || newPos > _size) return E_FAIL; - - return SeekToPos(newPos); -} - - -#define STREAM_BUFFER_SIZE 4096 -////////////////////////////////////////////////////////////////////////// -HRESULT CBPkgFile::SeekToPos(uint32 newPos) { - HRESULT ret = S_OK; - - // seek compressed stream to NewPos - _pos = newPos; - return ret; + file->seek(0); + + return file; } } // end of namespace WinterMute diff --git a/engines/wintermute/Base/file/BPkgFile.h b/engines/wintermute/Base/file/BPkgFile.h index 912b351ac87..e2d90e2b505 100644 --- a/engines/wintermute/Base/file/BPkgFile.h +++ b/engines/wintermute/Base/file/BPkgFile.h @@ -29,12 +29,7 @@ #ifndef WINTERMUTE_BPKGFILE_H #define WINTERMUTE_BPKGFILE_H - -#include "engines/wintermute/Base/file/BFile.h" #include "engines/wintermute/Base/BFileEntry.h" -#include // Added by ClassView - -#define COMPRESSED_BUFFER_SIZE 4096 namespace Common { class SeekableReadStream; @@ -43,21 +38,8 @@ class File; namespace WinterMute { -class CBPkgFile : public CBFile { -public: - CBPkgFile(CBGame *inGame); - virtual ~CBPkgFile(); - virtual HRESULT Seek(uint32 pos, TSeek origin = SEEK_TO_BEGIN); - virtual HRESULT Read(void *buffer, uint32 size); - virtual HRESULT Close(); - virtual HRESULT Open(const Common::String &filename); -private: - bool _inflateInit; - HRESULT SeekToPos(uint32 newPos); - bool _compressed; - CBFileEntry *_fileEntry; - Common::SeekableReadStream *_file; -}; +class CBFileManager; +Common::SeekableReadStream *openPkgFile(const Common::String &Filename, CBFileManager *fileManager); } // end of namespace WinterMute diff --git a/engines/wintermute/Base/file/BResourceFile.cpp b/engines/wintermute/Base/file/BResourceFile.cpp deleted file mode 100644 index 9ac93c4f9b4..00000000000 --- a/engines/wintermute/Base/file/BResourceFile.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This file is based on WME Lite. - * http://dead-code.org/redir.php?target=wmelite - * Copyright (c) 2011 Jan Nedoma - */ - -#include "engines/wintermute/dcgf.h" -#include "engines/wintermute/Base/file/BResourceFile.h" -#include "engines/wintermute/Base/BResources.h" - -namespace WinterMute { - -////////////////////////////////////////////////////////////////////////// -CBResourceFile::CBResourceFile(CBGame *inGame): CBFile(inGame) { - _data = NULL; -} - - -////////////////////////////////////////////////////////////////////////// -CBResourceFile::~CBResourceFile() { - Close(); -} - - -////////////////////////////////////////////////////////////////////////// -HRESULT CBResourceFile::Open(const Common::String &filename) { - Close(); - - if (CBResources::GetFile(filename.c_str(), _data, _size)) { - _pos = 0; - return S_OK; - } - return E_FAIL; -} - -////////////////////////////////////////////////////////////////////////// -HRESULT CBResourceFile::Close() { - _data = NULL; - _pos = 0; - _size = 0; - - return S_OK; -} - - -////////////////////////////////////////////////////////////////////////// -HRESULT CBResourceFile::Read(void *buffer, uint32 size) { - if (!_data || _pos + size > _size) return E_FAIL; - - memcpy(buffer, (byte *)_data + _pos, size); - _pos += size; - - return S_OK; -} - - -////////////////////////////////////////////////////////////////////////// -HRESULT CBResourceFile::Seek(uint32 pos, TSeek origin) { - if (!_data) return E_FAIL; - - int32 newPos = 0; - - switch (origin) { - case SEEK_TO_BEGIN: - newPos = pos; - break; - case SEEK_TO_END: - newPos = _size + pos; - break; - case SEEK_TO_CURRENT: - newPos = _pos + pos; - break; - } - - if (newPos < 0 || newPos > _size) return E_FAIL; - else _pos = newPos; - - return S_OK; -} - -} // end of namespace WinterMute diff --git a/engines/wintermute/Base/file/BResourceFile.h b/engines/wintermute/Base/file/BResourceFile.h deleted file mode 100644 index 77d8b629b1e..00000000000 --- a/engines/wintermute/Base/file/BResourceFile.h +++ /dev/null @@ -1,50 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This file is based on WME Lite. - * http://dead-code.org/redir.php?target=wmelite - * Copyright (c) 2011 Jan Nedoma - */ - -#ifndef WINTERMUTE_BRESOURCEFILE_H -#define WINTERMUTE_BRESOURCEFILE_H - -#include "engines/wintermute/Base/file/BFile.h" - -namespace WinterMute { - -class CBResourceFile : public CBFile { -public: - CBResourceFile(CBGame *inGame); - virtual ~CBResourceFile(); - virtual HRESULT Seek(uint32 Pos, TSeek Origin = SEEK_TO_BEGIN); - virtual HRESULT Read(void *Buffer, uint32 Size); - virtual HRESULT Close(); - virtual HRESULT Open(const Common::String &Filename); -private: - byte *_data; -}; - -} // end of namespace WinterMute - -#endif diff --git a/engines/wintermute/Base/scriptables/SXFile.cpp b/engines/wintermute/Base/scriptables/SXFile.cpp index e73f244f003..c869b6985d5 100644 --- a/engines/wintermute/Base/scriptables/SXFile.cpp +++ b/engines/wintermute/Base/scriptables/SXFile.cpp @@ -209,8 +209,8 @@ HRESULT CSXFile::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This bool FoundNewLine = false; HRESULT Ret = E_FAIL; do { - Ret = _readFile->Read(&b, 1); - if (FAILED(Ret)) break; + Ret = _readFile->read(&b, 1); + if (Ret != 1) break; if (Counter > BufSize) { Buf = (byte *)realloc(Buf, BufSize + FILE_BUFFER_SIZE); @@ -260,8 +260,8 @@ HRESULT CSXFile::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This HRESULT Ret = E_FAIL; while (Counter < TextLen) { - Ret = _readFile->Read(&b, 1); - if (FAILED(Ret)) break; + Ret = _readFile->read(&b, 1); + if (Ret != 1) break; if (Counter > BufSize) { Buf = (byte *)realloc(Buf, BufSize + FILE_BUFFER_SIZE); @@ -321,7 +321,7 @@ HRESULT CSXFile::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This return S_OK; } bool Val; - if (SUCCEEDED(_readFile->Read(&Val, sizeof(bool)))) Stack->PushBool(Val); + if (_readFile->read(&Val, sizeof(bool)) == sizeof(bool)) Stack->PushBool(Val); else Stack->PushNULL(); return S_OK; @@ -338,7 +338,7 @@ HRESULT CSXFile::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This return S_OK; } byte Val; - if (SUCCEEDED(_readFile->Read(&Val, sizeof(byte)))) Stack->PushInt(Val); + if (_readFile->read(&Val, sizeof(byte)) == sizeof(byte)) Stack->PushInt(Val); else Stack->PushNULL(); return S_OK; @@ -355,7 +355,7 @@ HRESULT CSXFile::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This return S_OK; } short Val; - if (SUCCEEDED(_readFile->Read(&Val, sizeof(short)))) Stack->PushInt(65536 + Val); + if (_readFile->read(&Val, sizeof(short)) == sizeof(short)) Stack->PushInt(65536 + Val); else Stack->PushNULL(); return S_OK; @@ -372,7 +372,7 @@ HRESULT CSXFile::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This return S_OK; } int Val; - if (SUCCEEDED(_readFile->Read(&Val, sizeof(int)))) Stack->PushInt(Val); + if (_readFile->read(&Val, sizeof(int)) == sizeof(int)) Stack->PushInt(Val); else Stack->PushNULL(); return S_OK; @@ -389,7 +389,7 @@ HRESULT CSXFile::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This return S_OK; } float Val; - if (SUCCEEDED(_readFile->Read(&Val, sizeof(float)))) Stack->PushFloat(Val); + if (_readFile->read(&Val, sizeof(float)) == sizeof(float)) Stack->PushFloat(Val); else Stack->PushNULL(); return S_OK; @@ -406,7 +406,7 @@ HRESULT CSXFile::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This return S_OK; } double Val; - if (SUCCEEDED(_readFile->Read(&Val, sizeof(double)))) Stack->PushFloat(Val); + if (_readFile->read(&Val, sizeof(double)) == sizeof(double)) Stack->PushFloat(Val); else Stack->PushNULL(); return S_OK; @@ -423,10 +423,10 @@ HRESULT CSXFile::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This return S_OK; } uint32 Size; - if (SUCCEEDED(_readFile->Read(&Size, sizeof(uint32)))) { + if (_readFile->read(&Size, sizeof(uint32)) == sizeof(uint32)) { byte *Str = new byte[Size + 1]; if (Str) { - if (SUCCEEDED(_readFile->Read(Str, Size))) { + if (_readFile->read(Str, Size) == Size) { Str[Size] = '\0'; Stack->PushString((char *)Str); } @@ -652,21 +652,21 @@ HRESULT CSXFile::ScSetProperty(const char *Name, CScValue *Value) { ////////////////////////////////////////////////////////////////////////// uint32 CSXFile::GetPos() { - if (_mode == 1 && _readFile) return _readFile->getPos(); + if (_mode == 1 && _readFile) return _readFile->pos(); else if ((_mode == 2 || _mode == 3) && _writeFile) return ftell(_writeFile); else return 0; } ////////////////////////////////////////////////////////////////////////// -bool CSXFile::SetPos(uint32 Pos, TSeek Origin) { - if (_mode == 1 && _readFile) return SUCCEEDED(_readFile->Seek(Pos, Origin)); - else if ((_mode == 2 || _mode == 3) && _writeFile) return fseek(_writeFile, Pos, (int)Origin) == 0; +bool CSXFile::SetPos(uint32 pos, TSeek origin) { + if (_mode == 1 && _readFile) return _readFile->seek(pos, origin); + else if ((_mode == 2 || _mode == 3) && _writeFile) return fseek(_writeFile, pos, (int)origin) == 0; else return false; } ////////////////////////////////////////////////////////////////////////// uint32 CSXFile::GetLength() { - if (_mode == 1 && _readFile) return _readFile->getSize(); + if (_mode == 1 && _readFile) return _readFile->size(); else if ((_mode == 2 || _mode == 3) && _writeFile) { uint32 CurrentPos = ftell(_writeFile); fseek(_writeFile, 0, SEEK_END); diff --git a/engines/wintermute/Base/scriptables/SXFile.h b/engines/wintermute/Base/scriptables/SXFile.h index f05a0e11ecb..f1c6552a71b 100644 --- a/engines/wintermute/Base/scriptables/SXFile.h +++ b/engines/wintermute/Base/scriptables/SXFile.h @@ -31,6 +31,7 @@ #include "engines/wintermute/Base/BScriptable.h" +#include "common/stream.h" namespace WinterMute { @@ -46,7 +47,7 @@ public: CSXFile(CBGame *inGame, CScStack *Stack); virtual ~CSXFile(); private: - CBFile *_readFile; + Common::SeekableReadStream *_readFile; FILE *_writeFile; int _mode; // 0..none, 1..read, 2..write, 3..append bool _textMode; diff --git a/engines/wintermute/module.mk b/engines/wintermute/module.mk index 47c41be5cc3..217317ece67 100644 --- a/engines/wintermute/module.mk +++ b/engines/wintermute/module.mk @@ -42,7 +42,6 @@ MODULE_OBJS := \ Base/scriptables/SXString.o \ Base/file/BDiskFile.o \ Base/file/BFile.o \ - Base/file/BResourceFile.o \ Base/file/BSaveThumbFile.o \ Base/file/BPkgFile.o \ Base/BActiveRect.o \