WIP SVC_CreateStringTable data parsing

This commit is contained in:
Jordan Cristiano
2016-04-20 21:18:56 -04:00
parent a416145e27
commit afad200209
4 changed files with 198 additions and 13 deletions

View File

@ -0,0 +1,8 @@
#include "valve_support.h"
uint32 COM_BufferToBufferDecompress(uint8* dest, uint32 destLen, const uint8* src, uint32 srcLen);
uint32 COM_GetUncompressedSize(const uint8* data, uint32 numBytes);
uint32 COM_GetIdealDestinationCompressionBufferSize_Snappy(uint32 srcLen);
uint32 COM_CompressBuffer_Snappy(const uint8* src, uint32 srcLen, uint8* dest, uint32 destLen);

View File

@ -59,17 +59,6 @@ inline bool is_little_endian()
#define NORMAL_DENOMINATOR ( (1<<(NORMAL_FRACTIONAL_BITS)) - 1 )
#define NORMAL_RESOLUTION (1.0/(NORMAL_DENOMINATOR))
template <typename T>
inline T DWordSwapC( T dw )
{
uint32 temp;
temp = *((uint32 *)&dw) >> 24;
temp |= ((*((uint32 *)&dw) & 0x00FF0000) >> 8);
temp |= ((*((uint32 *)&dw) & 0x0000FF00) << 8);
temp |= ((*((uint32 *)&dw) & 0x000000FF) << 24);
return *((T*)&temp);
}
#if defined( _MSC_VER ) && !defined( PLATFORM_WINDOWS_PC64 )
#define DWordSwap DWordSwapAsm
#pragma warning(push)
@ -85,7 +74,7 @@ inline T DWordSwapC( T dw )
}
#pragma warning(pop)
#else
#define DWordSwap DWordSwapC
#error write the 64 bit swaps
#endif
inline unsigned long LoadLittleDWord(const unsigned long *base, unsigned int dwordIndex)
@ -114,6 +103,11 @@ inline void LittleFloat(float* pOut, float* pIn)
}
}
inline long BigLong(long val)
{
return is_little_endian() ? DWordSwap(val) : val;
}
#define BITS_PER_INT 32
inline int GetBitForBitnum( int bitNum )