/ghost-legacy/packed.h

http://ghostcb.googlecode.com/ · C++ Header · 79 lines · 47 code · 10 blank · 22 comment · 0 complexity · e15d71b64e6ebc311c46a309c8282292 MD5 · raw file

  1. /*
  2. Copyright [2008] [Trevor Hogan]
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. CODE PORTED FROM THE ORIGINAL GHOST PROJECT: http://ghost.pwner.org/
  13. */
  14. #ifndef PACKED_H
  15. #define PACKED_H
  16. //
  17. // CPacked
  18. //
  19. class CCRC32;
  20. class CPacked
  21. {
  22. public:
  23. CCRC32 *m_CRC;
  24. protected:
  25. bool m_Valid;
  26. string m_Compressed;
  27. string m_Decompressed;
  28. uint32_t m_HeaderSize;
  29. uint32_t m_CompressedSize;
  30. uint32_t m_HeaderVersion;
  31. uint32_t m_DecompressedSize;
  32. uint32_t m_NumBlocks;
  33. uint32_t m_War3Identifier;
  34. uint32_t m_War3Version;
  35. uint16_t m_BuildNumber;
  36. uint16_t m_Flags;
  37. uint32_t m_ReplayLength;
  38. public:
  39. CPacked( );
  40. virtual ~CPacked( );
  41. virtual bool GetValid( ) { return m_Valid; }
  42. virtual uint32_t GetHeaderSize( ) { return m_HeaderSize; }
  43. virtual uint32_t GetCompressedSize( ) { return m_CompressedSize; }
  44. virtual uint32_t GetHeaderVersion( ) { return m_HeaderVersion; }
  45. virtual uint32_t GetDecompressedSize( ) { return m_DecompressedSize; }
  46. virtual uint32_t GetNumBlocks( ) { return m_NumBlocks; }
  47. virtual uint32_t GetWar3Identifier( ) { return m_War3Identifier; }
  48. virtual uint32_t GetWar3Version( ) { return m_War3Version; }
  49. virtual uint16_t GetBuildNumber( ) { return m_BuildNumber; }
  50. virtual uint16_t GetFlags( ) { return m_Flags; }
  51. virtual uint32_t GetReplayLength( ) { return m_ReplayLength; }
  52. virtual void SetWar3Version( uint32_t nWar3Version ) { m_War3Version = nWar3Version; }
  53. virtual void SetBuildNumber( uint16_t nBuildNumber ) { m_BuildNumber = nBuildNumber; }
  54. virtual void SetFlags( uint16_t nFlags ) { m_Flags = nFlags; }
  55. virtual void SetReplayLength( uint32_t nReplayLength ) { m_ReplayLength = nReplayLength; }
  56. virtual void Load( string fileName, bool allBlocks );
  57. virtual bool Save( bool TFT, string fileName );
  58. virtual bool Extract( string inFileName, string outFileName );
  59. virtual bool Pack( bool TFT, string inFileName, string outFileName );
  60. virtual void Decompress( bool allBlocks );
  61. virtual void Compress( bool TFT );
  62. };
  63. #endif