1 /* 2 * HLLib 3 * Copyright (C) 2006-2010 Ryan Gregg 4 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2.1 of the License, or (at your option) any later 9 * version. 10 */ 11 12 #ifndef PAKFILE_H 13 #define PAKFILE_H 14 15 #include "stdafx.h" 16 #include "Package.h" 17 18 namespace HLLib 19 { 20 class HLLIB_API CPAKFile : public CPackage 21 { 22 private: 23 #pragma pack(1) 24 25 struct PAKHeader 26 { 27 hlChar lpSignature[4]; 28 hlUInt uiDirectoryOffset; 29 hlUInt uiDirectoryLength; 30 }; 31 32 struct PAKDirectoryItem 33 { 34 hlChar lpItemName[56]; 35 hlUInt uiItemOffset; 36 hlUInt uiItemLength; 37 }; 38 39 #pragma pack() 40 41 private: 42 Mapping::CView *pHeaderView; 43 Mapping::CView *pDirectoryItemView; 44 45 const PAKHeader *pHeader; 46 const PAKDirectoryItem *lpDirectoryItems; 47 48 public: 49 CPAKFile(); 50 virtual ~CPAKFile(); 51 52 virtual HLPackageType GetType() const; 53 virtual const hlChar *GetExtension() const; 54 virtual const hlChar *GetDescription() const; 55 56 protected: 57 virtual hlBool MapDataStructures(); 58 virtual hlVoid UnmapDataStructures(); 59 60 virtual CDirectoryFolder *CreateRoot(); 61 62 virtual hlBool GetFileSizeInternal(const CDirectoryFile *pFile, hlUInt &uiSize) const; 63 virtual hlBool GetFileSizeOnDiskInternal(const CDirectoryFile *pFile, hlUInt &uiSize) const; 64 65 virtual hlBool CreateStreamInternal(const CDirectoryFile *pFile, Streams::IStream *&pStream) const; 66 }; 67 } 68 69 #endif 70