diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 613369f8..08f7c0bb 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -938,16 +938,16 @@ static void CL_BeginUpload_f( void ) memset( &custResource, 0, sizeof( custResource )); COM_HexConvert( name + 4, 32, md5 ); - if( HPAK_ResourceForHash( CUSTOM_RES_PATH, md5, &custResource )) + if( HPAK_ResourceForHash( hpk_custom_file.string, md5, &custResource )) { if( memcmp( md5, custResource.rgucMD5_hash, 16 )) { - Con_Reportf( "Bogus data retrieved from %s, attempting to delete entry\n", CUSTOM_RES_PATH ); - HPAK_RemoveLump( CUSTOM_RES_PATH, &custResource ); + Con_Reportf( "Bogus data retrieved from %s, attempting to delete entry\n", hpk_custom_file.string ); + HPAK_RemoveLump( hpk_custom_file.string, &custResource ); return; } - if( HPAK_GetDataPointer( CUSTOM_RES_PATH, &custResource, &buf, &size )) + if( HPAK_GetDataPointer( hpk_custom_file.string, &custResource, &buf, &size )) { byte md5[16]; MD5Context_t ctx; @@ -963,7 +963,7 @@ static void CL_BeginUpload_f( void ) Con_Reportf( "Purported: %s\n", MD5_Print( custResource.rgucMD5_hash ) ); Con_Reportf( "Actual : %s\n", MD5_Print( md5 ) ); Con_Reportf( "Removing conflicting lump\n" ); - HPAK_RemoveLump( CUSTOM_RES_PATH, &custResource ); + HPAK_RemoveLump( hpk_custom_file.string, &custResource ); return; } } @@ -1254,7 +1254,7 @@ static void CL_CreateResourceList( void ) { SetBits( pNewResource->ucFlags, RES_CUSTOM ); memcpy( pNewResource->rgucMD5_hash, rgucMD5_hash, 16 ); - HPAK_AddLump( false, CUSTOM_RES_PATH, pNewResource, NULL, fp ); + HPAK_AddLump( false, hpk_custom_file.string, pNewResource, NULL, fp ); } } @@ -2634,7 +2634,7 @@ void CL_ProcessFile( qboolean successfully_received, const char *filename ) { if( p->ucFlags & RES_CUSTOM ) { - HPAK_AddLump( true, CUSTOM_RES_PATH, p, cls.netchan.tempbuffer, NULL ); + HPAK_AddLump( true, hpk_custom_file.string, p, cls.netchan.tempbuffer, NULL ); CL_RegisterCustomization( p ); } } diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 4e8e3934..93b923d7 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -498,7 +498,7 @@ void CL_BatchResourceRequest( qboolean initialize ) CL_MoveToOnHandList( p ); break; case t_decal: - if( !HPAK_GetDataPointer( CUSTOM_RES_PATH, p, NULL, NULL )) + if( !HPAK_GetDataPointer( hpk_custom_file.string, p, NULL, NULL )) { if( !FBitSet( p->ucFlags, RES_REQUESTED )) { @@ -722,7 +722,7 @@ void CL_ParseCustomization( sizebuf_t *msg ) } } - if( HPAK_GetDataPointer( CUSTOM_RES_PATH, pRes, NULL, NULL )) + if( HPAK_GetDataPointer( hpk_custom_file.string, pRes, NULL, NULL )) { qboolean bError = false; @@ -854,7 +854,7 @@ void CL_ParseServerData( sizebuf_t *msg, qboolean legacy ) int i; uint32_t mapCRC; - HPAK_CheckSize( CUSTOM_RES_PATH ); + HPAK_CheckSize( hpk_custom_file.string ); Con_Reportf( "%s packet received.\n", legacy ? "Legacy serverdata" : "Serverdata" ); diff --git a/engine/client/in_joy.c b/engine/client/in_joy.c index 21feb9c9..5caa470d 100644 --- a/engine/client/in_joy.c +++ b/engine/client/in_joy.c @@ -218,7 +218,7 @@ static void Joy_ProcessStick( const engineAxis_t engineAxis, short value ) // fwd/side axis simulate hat movement if( ( engineAxis == JOY_AXIS_SIDE || engineAxis == JOY_AXIS_FWD ) && - ( CL_IsInMenu() || CL_IsInConsole() ) ) + ( cls.key_dest == key_menu || cls.key_dest == key_console )) { int val = 0; diff --git a/engine/common/com_strings.h b/engine/common/com_strings.h index b4bc9ece..f84b7b57 100644 --- a/engine/common/com_strings.h +++ b/engine/common/com_strings.h @@ -39,9 +39,6 @@ GNU General Public License for more details. // end game final default message #define DEFAULT_ENDGAME_MESSAGE "The End" -// path to the hash-pak that contain custom player decals -#define CUSTOM_RES_PATH "custom.hpk" - // path to default playermodel in GoldSrc #define DEFAULT_PLAYER_PATH_HALFLIFE "models/player.mdl" diff --git a/engine/common/common.h b/engine/common/common.h index d397ccc5..c64f200e 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -164,6 +164,7 @@ extern convar_t host_maxfps; extern convar_t sys_timescale; extern convar_t cl_filterstuffcmd; extern convar_t rcon_password; +extern convar_t hpk_custom_file; #define Mod_AllowMaterials() ( host_allow_materials.value != 0.0f && !FBitSet( host.features, ENGINE_DISABLE_HDTEXTURES )) diff --git a/engine/common/custom.c b/engine/common/custom.c index 65997f41..0d691852 100644 --- a/engine/common/custom.c +++ b/engine/common/custom.c @@ -94,7 +94,7 @@ qboolean COM_CreateCustomization( customization_t *pListHead, resource_t *pResou if( FBitSet( flags, FCUST_FROMHPAK )) { - if( !HPAK_GetDataPointer( CUSTOM_RES_PATH, pResource, (byte **)&pCust->pBuffer, NULL )) + if( !HPAK_GetDataPointer( hpk_custom_file.string, pResource, (byte **)&pCust->pBuffer, NULL )) bError = true; } else diff --git a/engine/common/host.c b/engine/common/host.c index 51b20676..e1c62710 100644 --- a/engine/common/host.c +++ b/engine/common/host.c @@ -1197,9 +1197,6 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa } else Cmd_AddRestrictedCommand( "minimize", Host_Minimize_f, "minimize main window to tray" ); - HPAK_CheckIntegrity( CUSTOM_RES_PATH ); - - host.errorframe = 0; if( progname[0] == '#' ) @@ -1264,6 +1261,9 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa Cbuf_Execute(); } + // check after all configs were executed + HPAK_CheckIntegrity( hpk_custom_file.string ); + // main window message loop while( !host.crashed ) { diff --git a/engine/common/hpak.c b/engine/common/hpak.c index 659d1254..e031fafc 100644 --- a/engine/common/hpak.c +++ b/engine/common/hpak.c @@ -28,6 +28,7 @@ typedef struct hash_pack_queue_s } hash_pack_queue_t; static CVAR_DEFINE( hpk_maxsize, "hpk_max_size", "64", FCVAR_ARCHIVE|FCVAR_PRIVILEGED, "set limit by size for all HPK-files in megabytes ( 0 - unlimited )" ); +CVAR_DEFINE_AUTO( hpk_custom_file, "custom.hpk", FCVAR_ARCHIVE|FCVAR_PRIVILEGED, "set custom path for players customizations cache file" ); static hash_pack_queue_t *gp_hpak_queue = NULL; static hpak_header_t hash_pack_header; static hpak_info_t hash_pack_info; @@ -1106,6 +1107,7 @@ void HPAK_Init( void ) Cmd_AddRestrictedCommand( "hpkextract", HPAK_Extract_f, "extract all lumps from specified HPK-file" ); Cmd_AddRestrictedCommand( "hpk_maxsize", HPAK_MaxSize_f, "deprecation notice for hpk_maxsize" ); Cvar_RegisterVariable( &hpk_maxsize ); + Cvar_RegisterVariable( &hpk_custom_file ); gp_hpak_queue = NULL; } diff --git a/engine/server/sv_client.c b/engine/server/sv_client.c index 017c62b6..f249a143 100644 --- a/engine/server/sv_client.c +++ b/engine/server/sv_client.c @@ -2157,9 +2157,9 @@ static qboolean SV_DownloadFile_f( sv_client_t *cl ) memset( &custResource, 0, sizeof( custResource ) ); COM_HexConvert( name + 4, 32, md5 ); - if( HPAK_ResourceForHash( CUSTOM_RES_PATH, md5, &custResource )) + if( HPAK_ResourceForHash( hpk_custom_file.string, md5, &custResource )) { - if( HPAK_GetDataPointer( CUSTOM_RES_PATH, &custResource, &pbuf, &size )) + if( HPAK_GetDataPointer( hpk_custom_file.string, &custResource, &pbuf, &size )) { if( size ) { diff --git a/engine/server/sv_custom.c b/engine/server/sv_custom.c index 5e09e832..027180e4 100644 --- a/engine/server/sv_custom.c +++ b/engine/server/sv_custom.c @@ -298,7 +298,7 @@ static qboolean SV_CheckFile( sizebuf_t *msg, const char *filename ) { COM_HexConvert( filename + 4, 32, p.rgucMD5_hash ); - if( HPAK_GetDataPointer( CUSTOM_RES_PATH, &p, NULL, NULL )) + if( HPAK_GetDataPointer( hpk_custom_file.string, &p, NULL, NULL )) return true; } @@ -393,7 +393,7 @@ int SV_EstimateNeededResources( sv_client_t *cl ) if( p->type != t_decal ) continue; - if( !HPAK_ResourceForHash( CUSTOM_RES_PATH, p->rgucMD5_hash, NULL )) + if( !HPAK_ResourceForHash( hpk_custom_file.string, p->rgucMD5_hash, NULL )) { if( p->nDownloadSize != 0 ) { diff --git a/engine/server/sv_init.c b/engine/server/sv_init.c index ae9a68c5..8c3cef2c 100644 --- a/engine/server/sv_init.c +++ b/engine/server/sv_init.c @@ -1069,8 +1069,8 @@ qboolean SV_SpawnServer( const char *mapname, const char *startspot, qboolean ba current_skill = bound( 0, current_skill, 3 ); Cvar_SetValue( "skill", (float)current_skill ); - // enforce hpk_maxsize - HPAK_CheckSize( CUSTOM_RES_PATH ); + // enforce hpk_max_size + HPAK_CheckSize( hpk_custom_file.string ); // force normal player collisions for single player if( svs.maxclients == 1 ) diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index 47c45aef..a00719b4 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -338,7 +338,7 @@ static void SV_ProcessFile( sv_client_t *cl, const char *filename ) return; } - HPAK_AddLump( true, CUSTOM_RES_PATH, resource, cl->netchan.tempbuffer, NULL ); + HPAK_AddLump( true, hpk_custom_file.string, resource, cl->netchan.tempbuffer, NULL ); ClearBits( resource->ucFlags, RES_WASMISSING ); SV_MoveToOnHandList( cl, resource );