mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
*** Merged Code from Multiplayer Branch Revision 2960 ***
- Virtual File System (VFS) by birdflu. This is needed for Multiplayer and is also used for Single Player. Very neat system :-) - Multiplayer Version 1.1 + some additional features and bugfixes * INFO: If you compile a new EXE and want to test, be sure to also use the latest SVN GameDir files in your JA2 install directory * git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2961 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
#ifndef _VFS_UNCOMPRESSED_LIB_BASE_H_
|
||||
#define _VFS_UNCOMPRESSED_LIB_BASE_H_
|
||||
|
||||
#include "../Interface/vfs_library_interface.h"
|
||||
#include "../Interface/vfs_directory_interface.h"
|
||||
#include <sstream>
|
||||
|
||||
namespace vfs
|
||||
{
|
||||
|
||||
class CUncompressedLibraryBase : public vfs::ILibrary
|
||||
{
|
||||
protected:
|
||||
typedef std::map<vfs::Path, vfs::IDirectory<ILibrary::tWriteType>*, vfs::Path::Less> tDirCatalogue;
|
||||
struct sFileData
|
||||
{
|
||||
sFileData(UInt32 const& fileSize, UInt32 const& fileOffset)
|
||||
: uiFileSize(fileSize), uiFileOffset(fileOffset), uiCurrentReadPosition(0)
|
||||
{};
|
||||
UInt32 uiFileSize,uiFileOffset,uiCurrentReadPosition;
|
||||
};
|
||||
typedef std::map<tFileType*, sFileData> tLibData;
|
||||
|
||||
class IterImpl : public tClassType::Iterator::IImplemetation
|
||||
{
|
||||
public:
|
||||
IterImpl(CUncompressedLibraryBase& lib);
|
||||
virtual ~IterImpl();
|
||||
virtual tFileType* value();
|
||||
virtual void next();
|
||||
private:
|
||||
CUncompressedLibraryBase* _lib;
|
||||
tLibData::iterator _iter;
|
||||
};
|
||||
public:
|
||||
CUncompressedLibraryBase(tReadableFile *pLibraryFile, vfs::Path const& sMountPoint, bool bOwnFile = false)
|
||||
: vfs::ILibrary(pLibraryFile,sMountPoint,bOwnFile), m_uiNumberOfOpenedFiles(0)
|
||||
{};
|
||||
virtual ~CUncompressedLibraryBase();
|
||||
|
||||
/**
|
||||
* IVFSLocation interface
|
||||
*/
|
||||
virtual bool FileExists(vfs::Path const& sFileName);
|
||||
virtual vfs::IBaseFile* GetFile(vfs::Path const& sFileName);
|
||||
virtual tFileType* GetFileTyped(vfs::Path const& sFileName);
|
||||
virtual void GetSubDirList(std::list<vfs::Path>& rlSubDirs);
|
||||
|
||||
/**
|
||||
* ILibrary interface
|
||||
*/
|
||||
virtual bool Init() = 0;
|
||||
virtual bool CloseLibrary();
|
||||
|
||||
virtual bool Close(tFileType *pFileHandle);
|
||||
virtual bool OpenRead(tFileType *pFileHandle);
|
||||
virtual bool Read(tFileType *pFileHandle, Byte* pData, UInt32 uiBytesToRead, UInt32& uiBytesRead);
|
||||
|
||||
virtual UInt32 GetReadLocation(tFileType *pFileHandle);
|
||||
virtual bool SetReadLocation(tFileType *pFileHandle, UInt32 uiPositionInBytes);
|
||||
virtual bool SetReadLocation(tFileType *pFileHandle, Int32 uiOffsetInBytes, IBaseFile::ESeekDir eSeekDir);
|
||||
|
||||
virtual bool GetFileSize(tFileType *pFileHandle, UInt32& uiFileSize);
|
||||
|
||||
virtual Iterator begin();
|
||||
protected:
|
||||
tDirCatalogue m_catDirs;
|
||||
tLibData m_mapLibData;
|
||||
UInt32 m_uiNumberOfOpenedFiles;
|
||||
};
|
||||
} // end namespace
|
||||
|
||||
#endif // _VFS_UNCOMPRESSED_LIB_BASE_H_
|
||||
|
||||
Reference in New Issue
Block a user