Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
3.0 KiB

  1. //===== Copyright c 1996-2008, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose: Describes our resource format. Resource files consist of two files:
  4. // The first is a resource descriptor file containing various blocks of
  5. // arbitrary data, including a resource dictionary describing raw data which
  6. // is stored in a second, parallel file.
  7. //
  8. // $NoKeywords: $
  9. //===========================================================================//
  10. #ifndef RESOURCEDICTIONARY_H
  11. #define RESOURCEDICTIONARY_H
  12. #pragma once
  13. #include "resourcefile/schema.h"
  14. //-----------------------------------------------------------------------------
  15. // Forward declarations
  16. //-----------------------------------------------------------------------------
  17. struct ResourceDictionary_t;
  18. struct ResourceDictionaryGroup_t;
  19. struct ResourceDescription_t;
  20. //-----------------------------------------------------------------------------
  21. // Type definitions
  22. //-----------------------------------------------------------------------------
  23. schema typedef uint32 ResourceId_t;
  24. //-----------------------------------------------------------------------------
  25. // Enum definitions
  26. //-----------------------------------------------------------------------------
  27. schema enum ResourceDictionaryVersion_t
  28. {
  29. RESOURCE_DICT_VERSION = 1,// (explicit)
  30. };
  31. schema enum ResourceCompressionType_t
  32. {
  33. RESOURCE_COMPRESSION_NONE = 0,
  34. };
  35. schema enum ResourceStandardIds_t
  36. {
  37. RESOURCE_ID_INVALID = 0,
  38. };
  39. //-----------------------------------------------------------------------------
  40. // Structure definitions
  41. //-----------------------------------------------------------------------------
  42. //! resourceBlockType = "RESD"
  43. schema struct ResourceDictionary_t
  44. {
  45. uint32 m_nCompressionType;
  46. uint32 m_nUncompressedLength;
  47. uint32 m_nPageSize;
  48. uint32 m_nAlignment;
  49. CResourceArray< ResourceDictionaryGroup_t > m_ResourceGroups;
  50. };
  51. DEFINE_RESOURCE_BLOCK_TYPE( ResourceDictionary_t, 'R', 'E', 'S', 'D' )
  52. schema struct ResourceDictionaryGroup_t
  53. {
  54. uint32 m_nResourceType; // see ResourceType_t
  55. uint16 m_nCompressionType;
  56. uint16 m_nFlags;
  57. CResourceArray< ResourceDescription_t > m_Resources;
  58. };
  59. schema struct ResourceDescription_t
  60. {
  61. uint32 m_nId;
  62. uint32 m_nStartOffset;
  63. uint32 m_nSize;
  64. uint32 m_nUncompressedSize;
  65. };
  66. //-----------------------------------------------------------------------------
  67. // Computes a resource id given a resource name
  68. // NOTE: Most resource names are of the format:
  69. // <relative file name under content>::<subresource name>
  70. //-----------------------------------------------------------------------------
  71. ResourceId_t ComputeResourceIdHash( const char *pResourceName );
  72. ResourceId_t ComputeResourceIdHash( const char *pFileName, const char *pSubResourceName );
  73. void GenerateResourceName( const char *pFileName, const char *pSubResourceName, char *pResourceName, size_t pBufLen );
  74. void GenerateResourceFileName( const char *pFileName, char *pResourceFileName, size_t nBufLen );
  75. #endif // RESOURCEDICTIONARY_H