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.

50 lines
2.8 KiB

  1. //========= Copyright � 1996-2006, Valve LLC, All rights reserved. ============
  2. //
  3. // Purpose: StudioMDL byteswapping functions.
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #ifndef STUDIOBYTESWAP_H
  8. #define STUDIOBYTESWAP_H
  9. #if defined(_WIN32)
  10. #pragma once
  11. #endif
  12. #include "byteswap.h"
  13. struct studiohdr_t;
  14. class IPhysicsCollision;
  15. namespace StudioByteSwap
  16. {
  17. typedef bool (*CompressFunc_t)( const void *pInput, int inputSize, void **pOutput, int *pOutputSize );
  18. //void SetTargetBigEndian( bool bigEndian );
  19. void ActivateByteSwapping( bool bActivate );
  20. void SourceIsNative( bool bActivate );
  21. void SetVerbose( bool bVerbose );
  22. void SetCollisionInterface( IPhysicsCollision *pPhysicsCollision );
  23. int ByteswapStudioFile( const char *pFilename, void *pOutBase, int outBaseSize, const void *pFileBase, int fileSize, studiohdr_t *pHdr, CompressFunc_t pCompressFunc = NULL );
  24. int ByteswapPHY( void *pOutBase, int outBaseSize, const void *pFileBase, int fileSize, CompressFunc_t pCompressFunc );
  25. int ByteswapANI( studiohdr_t* pHdr, void *pOutBase, int outBaseSize, const void *pFileBase, int filesize, CompressFunc_t pCompressFunc );
  26. int ByteswapVVD( void *pOutBase, int outBaseSize, const void *pFileBase, int fileSize, CompressFunc_t pCompressFunc );
  27. int ByteswapVTX( void *pOutBase, int outBaseSize, const void *pFileBase, int fileSize, CompressFunc_t pCompressFunc );
  28. int ByteswapMDL( void *pOutBase, int OutBaseSize, const void *pFileBase, int fileSize, CompressFunc_t pCompressFunc );
  29. // default versions of the above for all the cases that had function pointers to a signature without the CompressFunc_t.
  30. // we need an actual different function here, rather than just a default param, because of all those other modules that
  31. // retain function pointers to (*int)(void *,int, const void *, int) etc
  32. inline int ByteswapPHY( void *pOutBase, int outBaseSize, const void *pFileBase, int fileSize) { return ByteswapPHY( pOutBase, outBaseSize, pFileBase, fileSize, NULL); }
  33. inline int ByteswapANI( studiohdr_t* pHdr, void *pOutBase, int outBaseSize, const void *pFileBase, int filesize ) { return ByteswapANI( pHdr, pOutBase, outBaseSize, pFileBase, filesize, NULL ); }
  34. inline int ByteswapVVD( void *pOutBase, int outBaseSize, const void *pFileBase, int fileSize ) { return ByteswapVVD( pOutBase, outBaseSize, pFileBase, fileSize, NULL ); }
  35. inline int ByteswapVTX( void *pOutBase, int outBaseSize, const void *pFileBase, int fileSize ) { return ByteswapVTX( pOutBase, outBaseSize, pFileBase, fileSize, NULL ); }
  36. inline int ByteswapMDL( void *pOutBase, int OutBaseSize, const void *pFileBase, int fileSize ) { return ByteswapMDL( pOutBase, OutBaseSize, pFileBase, fileSize, NULL ); }
  37. #define BYTESWAP_ALIGNMENT_PADDING 4096
  38. #define ERROR_MISALIGNED_DATA -1
  39. #define ERROR_VERSION -2
  40. }
  41. #endif // STUDIOBYTESWAP_H