engine: allow to change hardcoded path to custom.hpk
This commit is contained in:
parent
1b36785177
commit
95b48da37d
12 changed files with 25 additions and 25 deletions
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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" );
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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 ))
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue