diff options
-rw-r--r-- | engines/wintermute/Base/BFileManager.cpp | 132 | ||||
-rw-r--r-- | engines/wintermute/Base/BFileManager.h | 1 |
2 files changed, 0 insertions, 133 deletions
diff --git a/engines/wintermute/Base/BFileManager.cpp b/engines/wintermute/Base/BFileManager.cpp index 88dad41e50..a143231abc 100644 --- a/engines/wintermute/Base/BFileManager.cpp +++ b/engines/wintermute/Base/BFileManager.cpp @@ -518,138 +518,6 @@ ERRORCODE CBFileManager::registerPackage(const Common::String &filename , bool s delete package;
return STATUS_OK;
}
-//////////////////////////////////////////////////////////////////////////
-ERRORCODE CBFileManager::registerPackage(const char *Path, const char *name, bool SearchSignature) {
-// TODO
- error("Implement RegisterPackage, this is the old one");
-#if 0
- char Filename[MAX_PATH_LENGTH];
- sprintf(filename, "%s%s", Path, name);
-
- FILE *f = fopen(filename, "rb");
- if (!f) {
- Game->LOG(0, " Error opening package file '%s'. Ignoring.", filename);
- return STATUS_OK;
- }
-
- uint32 AbsoluteOffset = 0;
- bool BoundToExe = false;
-
- if (SearchSignature) {
- uint32 Offset;
- if (!FindPackageSignature(f, &Offset)) {
- fclose(f);
- return STATUS_OK;
- } else {
- fseek(f, Offset, SEEK_SET);
- AbsoluteOffset = Offset;
- BoundToExe = true;
- }
- }
-
- TPackageHeader hdr;
- fread(&hdr, sizeof(TPackageHeader), 1, f);
- if (hdr.Magic1 != PACKAGE_MAGIC_1 || hdr.Magic2 != PACKAGE_MAGIC_2 || hdr.PackageVersion > PACKAGE_VERSION) {
- Game->LOG(0, " Invalid header in package file '%s'. Ignoring.", filename);
- fclose(f);
- return STATUS_OK;
- }
-
- if (hdr.PackageVersion != PACKAGE_VERSION) {
- Game->LOG(0, " Warning: package file '%s' is outdated.", filename);
- }
-
- // new in v2
- if (hdr.PackageVersion == PACKAGE_VERSION) {
- uint32 DirOffset;
- fread(&DirOffset, sizeof(uint32), 1, f);
- DirOffset += AbsoluteOffset;
- fseek(f, DirOffset, SEEK_SET);
- }
-
- for (int i = 0; i < hdr.NumDirs; i++) {
- CBPackage *pkg = new CBPackage(Game);
- if (!pkg) return STATUS_FAILED;
-
- pkg->_boundToExe = BoundToExe;
-
- // read package info
- byte nameLength;
- fread(&nameLength, sizeof(byte), 1, f);
- pkg->_name = new char[nameLength];
- fread(pkg->_name, nameLength, 1, f);
- fread(&pkg->_cD, sizeof(byte), 1, f);
- pkg->_priority = hdr.Priority;
-
- if (!hdr.MasterIndex) pkg->_cD = 0; // override CD to fixed disk
- _packages.add(pkg);
-
-
- // read file entries
- uint32 NumFiles;
- fread(&NumFiles, sizeof(uint32), 1, f);
-
- for (int j = 0; j < NumFiles; j++) {
- char *name;
- uint32 Offset, Length, CompLength, Flags, TimeDate1, TimeDate2;
-
- fread(&nameLength, sizeof(byte), 1, f);
- name = new char[nameLength];
- fread(name, nameLength, 1, f);
-
- // v2 - xor name
- if (hdr.PackageVersion == PACKAGE_VERSION) {
- for (int k = 0; k < nameLength; k++) {
- ((byte *)name)[k] ^= 'D';
- }
- }
-
- // some old version of ProjectMan writes invalid directory entries
- // so at least prevent strupr from corrupting memory
- name[nameLength - 1] = '\0';
-
-
- CBPlatform::strupr(name);
-
- fread(&Offset, sizeof(uint32), 1, f);
- Offset += AbsoluteOffset;
- fread(&Length, sizeof(uint32), 1, f);
- fread(&CompLength, sizeof(uint32), 1, f);
- fread(&Flags, sizeof(uint32), 1, f);
-
- if (hdr.PackageVersion == PACKAGE_VERSION) {
- fread(&TimeDate1, sizeof(uint32), 1, f);
- fread(&TimeDate2, sizeof(uint32), 1, f);
- }
- _filesIter = _files.find(name);
- if (_filesIter == _files.end()) {
- CBFileEntry *file = new CBFileEntry(Game);
- file->_package = pkg;
- file->_offset = Offset;
- file->_length = Length;
- file->_compressedLength = CompLength;
- file->_flags = Flags;
-
- _files[name] = file;
- } else {
- // current package has lower CD number or higher priority, than the registered
- if (pkg->_cD < _filesIter->_value->_package->_cD || pkg->_priority > _filesIter->_value->_package->_priority) {
- _filesIter->_value->_package = pkg;
- _filesIter->_value->_offset = Offset;
- _filesIter->_value->_length = Length;
- _filesIter->_value->_compressedLength = CompLength;
- _filesIter->_value->_flags = Flags;
- }
- }
- delete [] name;
- }
- }
-
-
- fclose(f);
-#endif
- return STATUS_OK;
-}
//////////////////////////////////////////////////////////////////////////
bool CBFileManager::isValidPackage(const AnsiString &fileName) const {
diff --git a/engines/wintermute/Base/BFileManager.h b/engines/wintermute/Base/BFileManager.h index 2b54679b29..06c812199c 100644 --- a/engines/wintermute/Base/BFileManager.h +++ b/engines/wintermute/Base/BFileManager.h @@ -75,7 +75,6 @@ public: Common::HashMap<Common::String, CBFileEntry *> _files;
private:
- ERRORCODE registerPackage(const char *path, const char *name, bool searchSignature = false);
ERRORCODE registerPackage(const Common::String &filename, bool searchSignature = false);
Common::HashMap<Common::String, CBFileEntry *>::iterator _filesIter;
bool isValidPackage(const AnsiString &fileName) const;
|