struct ICryArchive : public _reference_target_t { enum ECompressionMethods { METHOD_STORE = 0, METHOD_COMPRESS = 8, METHOD_DEFLATE = 8, METHOD_COMPRESS_AND_ENCRYPT = 11 }; enum ECompressionLevels { LEVEL_FASTEST = 0, LEVEL_FASTER = 2, LEVEL_NORMAL = 8, LEVEL_BETTER = 8, LEVEL_BEST = 9, LEVEL_DEFAULT = -1 }; enum EPakFlags { FLAGS_ABSOLUTE_PATHS = 1, FLAGS_RELATIVE_PATHS_ONLY = 1<<1, FLAGS_READ_ONLY = 1<<2, FLAGS_OPTIMIZED_READ_ONLY = (1 << 3), FLAGS_CREATE_NEW = 1<<4, FLAGS_DONT_COMPACT = 1<<5, FLAGS_IN_MEMORY = BIT(6), FLAGS_IN_MEMORY_CPU = BIT(7), FLAGS_IN_MEMORY_MASK = FLAGS_IN_MEMORY|FLAGS_IN_MEMORY_CPU, FLAGS_FILENAMES_AS_CRC32 = BIT(8), FLAGS_ON_HDD = BIT(9), FLAGS_OVERRIDE_PAK = BIT(10), FLAGS_DISABLE_PAK = BIT(11) }; struct IEnumerateArchiveEntries { }; };
ICryPak.h
This represents one particular archive filcare.
enum ECompressionLevels { LEVEL_FASTEST = 0, LEVEL_FASTER = 2, LEVEL_NORMAL = 8, LEVEL_BETTER = 8, LEVEL_BEST = 9, LEVEL_DEFAULT = -1 };
ICryPak.h
Compression levels
enum ECompressionMethods { METHOD_STORE = 0, METHOD_COMPRESS = 8, METHOD_DEFLATE = 8, METHOD_COMPRESS_AND_ENCRYPT = 11 };
ICryPak.h
Compression methods
enum EPakFlags { FLAGS_ABSOLUTE_PATHS = 1, FLAGS_RELATIVE_PATHS_ONLY = 1<<1, FLAGS_READ_ONLY = 1<<2, FLAGS_OPTIMIZED_READ_ONLY = (1 << 3), FLAGS_CREATE_NEW = 1<<4, FLAGS_DONT_COMPACT = 1<<5, FLAGS_IN_MEMORY = BIT(6), FLAGS_IN_MEMORY_CPU = BIT(7), FLAGS_IN_MEMORY_MASK = FLAGS_IN_MEMORY|FLAGS_IN_MEMORY_CPU, FLAGS_FILENAMES_AS_CRC32 = BIT(8), FLAGS_ON_HDD = BIT(9), FLAGS_OVERRIDE_PAK = BIT(10), FLAGS_DISABLE_PAK = BIT(11) };
ICryPak.h
Members |
Description |
FLAGS_ABSOLUTE_PATHS = 1 |
support for absolute and other complex path specifications - all paths will be treated relatively to the current directory (normally MasterCD) |
FLAGS_RELATIVE_PATHS_ONLY = 1<<1 |
if this is set, the object will only understand relative to the zip file paths, but this can give an opportunity to optimize for frequent quick accesses FLAGS_SIMPLE_RELATIVE_PATHS and FLAGS_ABSOLUTE_PATHS are mutually exclusive |
FLAGS_READ_ONLY = 1<<2 |
if this flag is set, the archive update/remove operations will not work this is useful when you open a read-only or already opened for reading files. If FLAGS_OPEN_READ_ONLY | FLAGS_SIMPLE_RELATIVE_PATHS are set, ICryPak will try to return an object optimized for memory, with long life cycle |
FLAGS_OPTIMIZED_READ_ONLY = (1 << 3) |
if this flag is set, FLAGS_OPEN_READ_ONLY flags are also implied. The returned object will be optimized for quick access and memory footprint |
FLAGS_CREATE_NEW = 1<<4 |
if this is set, the existing file (if any) will be overwritten |
FLAGS_DONT_COMPACT = 1<<5 |
if this flag is set, and the file is opened for writing, and some files were updated so that the archive is no more continuous, the archive will nevertheless NOT be compacted upon closing the archive file. This can be faster if you open/close the archive for writing multiple times |
FLAGS_IN_MEMORY = BIT(6) |
flag is set when complete pak has been loaded into memory |
FLAGS_FILENAMES_AS_CRC32 = BIT(8) |
Store all file names as crc32 in a flat directory structure. |
FLAGS_ON_HDD = BIT(9) |
flag is set when pak is stored on HDD |
FLAGS_OVERRIDE_PAK = BIT(10) |
Override pak - paks opened with this flag go at the end of the list and contents will be found before other paks Used for patching |
FLAGS_DISABLE_PAK = BIT(11) |
Disable a pak file without unloading it, this flag is used in combination with patches and multiplayer to ensure that specific paks stay in the position(to keep the same priority) but beeing disabled when running multiplayer |
struct IEnumerateArchiveEntries { };
ICryPak.h
virtual ~IEnumerateArchiveEntries();
virtual bool OnEnumArchiveEntry(const char* pFilename, Handle hEntry, bool bIsFolder, int aSize, int64 aModifiedTime) = 0;
virtual ~ICryArchive();
virtual int EnumEntries(Handle hFolder, IEnumerateArchiveEntries* pEnum) = 0;
enumerate the file entries found in the specified folder return the number of entries
Finds the file; you don't have to close the returned handle.
virtual Handle FindFile(const char* szPath) = 0;
NULL if the file doesn't exist
Get the class id.
virtual unsigned GetClassId() const = 0;
Get the file size (uncompressed).
virtual unsigned GetFileSize(Handle) = 0;
The size of the file (unpacked) by the handle
Get the flags of this object.
virtual unsigned GetFlags() const = 0;
The possibles flags are defined in EPakFlags.
Get the full path to the archive file.
virtual const char* GetFullPath() const = 0;
Collect allocated memory in CrySizer
virtual void GetMemoryUsage(ICrySizer * pSizer) const = 0;
virtual Handle GetRootFolderHandle() = 0;
Get archive's root folder
Determines if the archive is read only.
inline bool IsReadOnly() const;
true if this archive is read-only
Reads the file into the preallocated buffer
virtual int ReadFile(Handle, void* pBuffer) = 0;
Must be at least the size returned by GetFileSize.
Deletes all files and directories in the archive.
virtual int RemoveAll() = 0;
Deletes the directory, with all its descendants (files and subdirs).
virtual int RemoveDir(const char* szRelativePath) = 0;
Deletes the file from the archive.
virtual int RemoveFile(const char* szRelativePath) = 0;
Resets the flags of this object.
virtual bool ResetFlags(unsigned nFlagsToSet) = 0;
Sets the flags of this object.
virtual bool SetFlags(unsigned nFlagsToSet) = 0;
The possibles flags are defined in EPakFlags.
Control if files in this pack can be accessed
virtual bool SetPackAccessible(bool bAccessible) = 0;
true if archive state was changed
Adds a new file to the zip or update an existing one if it is not compressed - just stored - start a big file ( name might be misleading as if nOverwriteSeekPos is used the update is not continuous )
virtual int StartContinuousFileUpdate(const char* szRelativePath, unsigned nSize) = 0;
First step for the UpdateFileConinouseSegment
Adds a new file to the zip or update an existing one.
virtual int UpdateFile(const char* szRelativePath, void* pUncompressed, unsigned nSize, unsigned nCompressionMethod = 0, int nCompressionLevel = -1) = 0;
Adds a new file to the zip or update an existing one adds a directory (creates several nested directories if needed) compression methods supported are METHOD_STORE == 0 (store) and METHOD_DEFLATE == METHOD_COMPRESS == 8 (deflate) , compression level is LEVEL_FASTEST == 0 till LEVEL_BEST == 9 or LEVEL_DEFAULT == -1 for default (like in zlib)
Adds a new file to the zip or update an existing's segment if it is not compressed - just stored adds a directory (creates several nested directories if needed) ( name might be misleading as if nOverwriteSeekPos is used the update is not continuous )
virtual int UpdateFileContinuousSegment(const char* szRelativePath, unsigned nSize, void* pUncompressed, unsigned nSegmentSize, unsigned nOverwriteSeekPos = 0xffffffff) = 0;
Parameters |
Description |
unsigned nOverwriteSeekPos = 0xffffffff |
0xffffffff means the seek pos should not be overwritten (then it needs UpdateFileCRC() to update CRC) |
needed to update CRC if UpdateFileContinuousSegment() was used with nOverwriteSeekPos
virtual int UpdateFileCRC(const char* szRelativePath, const uint32 dwCRC) = 0;
typedef void* Handle;