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.

83 lines
2.9 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //===========================================================================//
  8. #ifndef IRESOURCECOMPILER_H
  9. #define IRESOURCECOMPILER_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include "appframework/IAppSystem.h"
  14. #include "resourcefile/resourcetype.h"
  15. #include "resourcefile/resourcedictionary.h"
  16. #include "resourcefile/resourceintrospection.h"
  17. //-----------------------------------------------------------------------------
  18. // Forward declarations
  19. //-----------------------------------------------------------------------------
  20. class CDmElement;
  21. class CResourceStream;
  22. class CUtlBuffer;
  23. //-----------------------------------------------------------------------------
  24. // Used for resource registration
  25. //-----------------------------------------------------------------------------
  26. struct RegisterResourceInfo_t
  27. {
  28. ResourceType_t m_nType;
  29. ResourceId_t m_nId;
  30. uint32 m_nFlags;
  31. // Describes cacheable data
  32. uint32 m_nDataOffset;
  33. ResourceCompressionType_t m_nCompressionType;
  34. uint32 m_nDataSize;
  35. uint32 m_nUncompressedDataSize;
  36. // Describes permanent data
  37. uint32 m_nPermanentDataOffset;
  38. uint32 m_nPermanentDataSize;
  39. };
  40. //-----------------------------------------------------------------------------
  41. // Resource compiler
  42. //-----------------------------------------------------------------------------
  43. abstract_class IResourceCompilerRegistry
  44. {
  45. public:
  46. virtual void RegisterResource( const RegisterResourceInfo_t &info ) = 0;
  47. virtual ResourceId_t RegisterResourceReference( ResourceType_t nType, const char *pFileName, const char *pResourceSubName ) = 0;
  48. virtual void RegisterUsedType( const char *pStructName, bool bPermanentData ) = 0;
  49. virtual void RegisterUsedType( ResourceStructureId_t id, bool bPermanentData ) = 0;
  50. virtual bool CompileResource( ResourceType_t nResourceType, CUtlBuffer &buf, const char *pElementFileName, CResourceStream *pPermanentStream, CResourceStream *pDataStream ) = 0;
  51. };
  52. //-----------------------------------------------------------------------------
  53. // Resource compiler
  54. //-----------------------------------------------------------------------------
  55. abstract_class IResourceCompiler : public IAppSystem
  56. {
  57. public:
  58. // This version of compile resource will potentially read multiple files
  59. // in a gather operation
  60. virtual bool CompileResource( const char *pFullPath, IResourceCompilerRegistry *pRegistry, CResourceStream *pPermanentStream, CResourceStream *pDataStream ) = 0;
  61. // This version of compile resource has already had the gather applied to it
  62. // and the data in the utlbuffer is all the data it will ever need
  63. virtual bool CompileResource( CUtlBuffer &buf, const char *pFullPath, IResourceCompilerRegistry *pRegistry, CResourceStream *pPermanentStream, CResourceStream *pDataStream ) = 0;
  64. };
  65. #define RESOURCE_COMPILER_INTERFACE_VERSION "RESOURCE_COMPILER_001"
  66. #endif // IRESOURCECOMPILER_H