|
|
|
@ -49,6 +49,18 @@ const char *HPAK_TypeFromIndex( int type )
@@ -49,6 +49,18 @@ const char *HPAK_TypeFromIndex( int type )
|
|
|
|
|
return "?"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static inline void HPAK_ResourceToCompat( dresource_t *dest, resource_t *src ) |
|
|
|
|
{ |
|
|
|
|
memcpy( dest, src, sizeof( *dest )); |
|
|
|
|
dest->pNext = dest->pPrev = 0xDEADBEEF; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static inline void HPAK_ResourceFromCompat( resource_t *dest, dresource_t *src ) |
|
|
|
|
{ |
|
|
|
|
memcpy( dest, src, sizeof( *src )); |
|
|
|
|
dest->pNext = dest->pPrev = (void*)0xDEADBEEF; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void HPAK_AddToQueue( const char *name, resource_t *pResource, void *data, file_t *f ) |
|
|
|
|
{ |
|
|
|
|
hash_pack_queue_t *p; |
|
|
|
@ -89,6 +101,7 @@ void HPAK_CreatePak( const char *filename, resource_t *pResource, byte *pData, f
@@ -89,6 +101,7 @@ void HPAK_CreatePak( const char *filename, resource_t *pResource, byte *pData, f
|
|
|
|
|
byte md5[16]; |
|
|
|
|
file_t *fout; |
|
|
|
|
MD5Context_t ctx; |
|
|
|
|
dresource_t dresource; |
|
|
|
|
|
|
|
|
|
if( !COM_CheckString( filename )) |
|
|
|
|
return; |
|
|
|
@ -145,7 +158,7 @@ void HPAK_CreatePak( const char *filename, resource_t *pResource, byte *pData, f
@@ -145,7 +158,7 @@ void HPAK_CreatePak( const char *filename, resource_t *pResource, byte *pData, f
|
|
|
|
|
|
|
|
|
|
hash_pack_info.count = 1; |
|
|
|
|
hash_pack_info.entries = Z_Malloc( sizeof( hpak_lump_t )); |
|
|
|
|
hash_pack_info.entries[0].resource = *pResource; |
|
|
|
|
HPAK_ResourceToCompat( &hash_pack_info.entries[0].resource, pResource ); |
|
|
|
|
hash_pack_info.entries[0].filepos = FS_Tell( fout ); |
|
|
|
|
hash_pack_info.entries[0].disksize = pResource->nDownloadSize; |
|
|
|
|
|
|
|
|
@ -181,7 +194,7 @@ static qboolean HPAK_FindResource( hpak_info_t *hpk, byte *hash, resource_t *pRe
@@ -181,7 +194,7 @@ static qboolean HPAK_FindResource( hpak_info_t *hpk, byte *hash, resource_t *pRe
|
|
|
|
|
if( !memcmp( hpk->entries[i].resource.rgucMD5_hash, hash, 16 )) |
|
|
|
|
{ |
|
|
|
|
if( pResource ) |
|
|
|
|
*pResource = hpk->entries[i].resource; |
|
|
|
|
HPAK_ResourceFromCompat( pResource, &hpk->entries[i].resource ); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -330,7 +343,7 @@ void HPAK_AddLump( qboolean bUseQueue, const char *name, resource_t *pResource,
@@ -330,7 +343,7 @@ void HPAK_AddLump( qboolean bUseQueue, const char *name, resource_t *pResource,
|
|
|
|
|
|
|
|
|
|
memset( pCurrentEntry, 0, sizeof( hpak_lump_t )); |
|
|
|
|
FS_Seek( file_dst, hash_pack_header.infotableofs, SEEK_SET ); |
|
|
|
|
pCurrentEntry->resource = *pResource; |
|
|
|
|
HPAK_ResourceToCompat( &pCurrentEntry->resource, pResource ); |
|
|
|
|
pCurrentEntry->filepos = FS_Tell( file_dst ); |
|
|
|
|
pCurrentEntry->disksize = pResource->nDownloadSize; |
|
|
|
|
|
|
|
|
@ -370,7 +383,7 @@ static qboolean HPAK_Validate( const char *filename, qboolean quiet )
@@ -370,7 +383,7 @@ static qboolean HPAK_Validate( const char *filename, qboolean quiet )
|
|
|
|
|
int i, num_lumps; |
|
|
|
|
MD5Context_t MD5_Hash; |
|
|
|
|
string pakname; |
|
|
|
|
resource_t *pRes; |
|
|
|
|
dresource_t *pRes; |
|
|
|
|
byte md5[16]; |
|
|
|
|
|
|
|
|
|
if( quiet ) HPAK_FlushHostQueue(); |
|
|
|
@ -621,7 +634,7 @@ static qboolean HPAK_ResourceForIndex( const char *filename, int index, resource
@@ -621,7 +634,7 @@ static qboolean HPAK_ResourceForIndex( const char *filename, int index, resource
|
|
|
|
|
|
|
|
|
|
directory.entries = Z_Malloc( sizeof( hpak_lump_t ) * directory.count ); |
|
|
|
|
FS_Read( f, directory.entries, sizeof( hpak_lump_t ) * directory.count ); |
|
|
|
|
*pResource = directory.entries[index-1].resource; |
|
|
|
|
HPAK_ResourceFromCompat( pResource, &directory.entries[index-1].resource ); |
|
|
|
|
Z_Free( directory.entries ); |
|
|
|
|
FS_Close( f ); |
|
|
|
|
|
|
|
|
|