mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-10 22:22:10 +08:00
Merge branch 'master' into master
This commit is contained in:
@@ -109,7 +109,7 @@ void CRC32_ProcessByte( dword *pulCRC, byte ch )
|
||||
|
||||
void CRC32_ProcessBuffer( dword *pulCRC, const void *pBuffer, int nBuffer )
|
||||
{
|
||||
dword ulCrc = *pulCRC;
|
||||
dword ulCrc = *pulCRC, tmp;
|
||||
byte *pb = (byte *)pBuffer;
|
||||
uint nFront;
|
||||
int nMain;
|
||||
@@ -120,7 +120,8 @@ JustAfew:
|
||||
case 6: ulCrc = crc32table[*pb++ ^ (byte)ulCrc] ^ (ulCrc >> 8);
|
||||
case 5: ulCrc = crc32table[*pb++ ^ (byte)ulCrc] ^ (ulCrc >> 8);
|
||||
case 4:
|
||||
ulCrc ^= *(dword *)pb; // warning, this only works on little-endian.
|
||||
memcpy( &tmp, pb, sizeof(dword));
|
||||
ulCrc ^= tmp; // warning, this only works on little-endian.
|
||||
ulCrc = crc32table[(byte)ulCrc] ^ (ulCrc >> 8);
|
||||
ulCrc = crc32table[(byte)ulCrc] ^ (ulCrc >> 8);
|
||||
ulCrc = crc32table[(byte)ulCrc] ^ (ulCrc >> 8);
|
||||
@@ -151,12 +152,14 @@ JustAfew:
|
||||
nMain = nBuffer >> 3;
|
||||
while( nMain-- )
|
||||
{
|
||||
ulCrc ^= *(dword *)pb; // warning, this only works on little-endian.
|
||||
memcpy( &tmp, pb, sizeof(dword));
|
||||
ulCrc ^= tmp; // warning, this only works on little-endian.
|
||||
ulCrc = crc32table[(byte)ulCrc] ^ (ulCrc >> 8);
|
||||
ulCrc = crc32table[(byte)ulCrc] ^ (ulCrc >> 8);
|
||||
ulCrc = crc32table[(byte)ulCrc] ^ (ulCrc >> 8);
|
||||
ulCrc = crc32table[(byte)ulCrc] ^ (ulCrc >> 8);
|
||||
ulCrc ^= *(dword *)(pb + 4);// warning, this only works on little-endian.
|
||||
memcpy( &tmp, pb + 4, sizeof(dword));
|
||||
ulCrc ^= tmp; // warning, this only works on little-endian.
|
||||
ulCrc = crc32table[(byte)ulCrc] ^ (ulCrc >> 8);
|
||||
ulCrc = crc32table[(byte)ulCrc] ^ (ulCrc >> 8);
|
||||
ulCrc = crc32table[(byte)ulCrc] ^ (ulCrc >> 8);
|
||||
|
||||
@@ -71,7 +71,7 @@ typedef struct stringlist_s
|
||||
typedef struct wadtype_s
|
||||
{
|
||||
char *ext;
|
||||
char type;
|
||||
signed char type;
|
||||
} wadtype_t;
|
||||
|
||||
typedef struct file_s
|
||||
@@ -150,7 +150,7 @@ qboolean fs_caseinsensitive = true; // try to search missing files
|
||||
|
||||
static void FS_InitMemory( void );
|
||||
static searchpath_t *FS_FindFile( const char *name, int *index, qboolean gamedironly );
|
||||
static dlumpinfo_t *W_FindLump( wfile_t *wad, const char *name, const char matchtype );
|
||||
static dlumpinfo_t *W_FindLump( wfile_t *wad, const char *name, const signed char matchtype );
|
||||
static dpackfile_t *FS_AddFileToPack( const char* name, pack_t *pack, fs_offset_t offset, fs_offset_t size );
|
||||
void Zip_Close( zip_t *zip );
|
||||
static byte *W_LoadFile( const char *path, fs_offset_t *filesizeptr, qboolean gamedironly );
|
||||
@@ -2367,7 +2367,7 @@ static searchpath_t *FS_FindFile( const char *name, int *index, qboolean gamedir
|
||||
else if( search->wad )
|
||||
{
|
||||
dlumpinfo_t *lump;
|
||||
char type = W_TypeFromExt( name );
|
||||
signed char type = W_TypeFromExt( name );
|
||||
qboolean anywadname = true;
|
||||
string wadname, wadfolder;
|
||||
string shortname;
|
||||
@@ -3381,7 +3381,7 @@ search_t *FS_Search( const char *pattern, int caseinsensitive, int gamedironly )
|
||||
else if( searchpath->wad )
|
||||
{
|
||||
string wadpattern, wadname, temp2;
|
||||
char type = W_TypeFromExt( pattern );
|
||||
signed char type = W_TypeFromExt( pattern );
|
||||
qboolean anywadname = true;
|
||||
string wadfolder;
|
||||
|
||||
@@ -3594,7 +3594,7 @@ W_FindLump
|
||||
Serach for already existed lump
|
||||
===========
|
||||
*/
|
||||
static dlumpinfo_t *W_FindLump( wfile_t *wad, const char *name, const char matchtype )
|
||||
static dlumpinfo_t *W_FindLump( wfile_t *wad, const char *name, const signed char matchtype )
|
||||
{
|
||||
int left, right;
|
||||
|
||||
|
||||
@@ -78,8 +78,8 @@ typedef struct
|
||||
int size; // uncompressed
|
||||
signed char type; // TYP_*
|
||||
signed char attribs; // file attribs
|
||||
char pad0;
|
||||
char pad1;
|
||||
signed char pad0;
|
||||
signed char pad1;
|
||||
char name[WAD3_NAMELEN]; // must be null terminated
|
||||
} dlumpinfo_t;
|
||||
|
||||
|
||||
@@ -43,25 +43,11 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, fs_offset_t filesi
|
||||
qboolean load_qfont = false;
|
||||
bmp_t bhdr;
|
||||
|
||||
if( filesize < sizeof( bhdr )) return false;
|
||||
if( filesize < sizeof( bhdr )) return false;
|
||||
|
||||
buf_p = (byte *)buffer;
|
||||
bhdr.id[0] = *buf_p++;
|
||||
bhdr.id[1] = *buf_p++; // move pointer
|
||||
bhdr.fileSize = *(int *)buf_p; buf_p += 4;
|
||||
bhdr.reserved0 = *(int *)buf_p; buf_p += 4;
|
||||
bhdr.bitmapDataOffset = *(int *)buf_p; buf_p += 4;
|
||||
bhdr.bitmapHeaderSize = *(int *)buf_p; buf_p += 4;
|
||||
bhdr.width = *(int *)buf_p; buf_p += 4;
|
||||
bhdr.height = *(int *)buf_p; buf_p += 4;
|
||||
bhdr.planes = *(short *)buf_p; buf_p += 2;
|
||||
bhdr.bitsPerPixel = *(short *)buf_p; buf_p += 2;
|
||||
bhdr.compression = *(int *)buf_p; buf_p += 4;
|
||||
bhdr.bitmapDataSize = *(int *)buf_p; buf_p += 4;
|
||||
bhdr.hRes = *(int *)buf_p; buf_p += 4;
|
||||
bhdr.vRes = *(int *)buf_p; buf_p += 4;
|
||||
bhdr.colors = *(int *)buf_p; buf_p += 4;
|
||||
bhdr.importantColors = *(int *)buf_p; buf_p += 4;
|
||||
memcpy( &bhdr, buf_p, sizeof( bmp_t ));
|
||||
buf_p += sizeof( bmp_t );
|
||||
|
||||
// bogus file header check
|
||||
if( bhdr.reserved0 != 0 ) return false;
|
||||
|
||||
Reference in New Issue
Block a user