2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2025-01-11 19:05:06 +01:00

engine: provide compatible replacement for CompareFileTime function

This commit is contained in:
Alibek Omarov 2024-11-17 04:33:13 +03:00
parent 30db748dcb
commit 0ceb0d9e11
6 changed files with 21 additions and 21 deletions

View File

@ -1249,7 +1249,7 @@ static const ui_enginefuncs_t gEngfuncs =
pfnSetCursor, pfnSetCursor,
pfnIsMapValid, pfnIsMapValid,
GL_ProcessTexture, GL_ProcessTexture,
COM_CompareFileTime, pfnCompareFileTime,
VID_GetModeString, VID_GetModeString,
(void*)COM_SaveFile, (void*)COM_SaveFile,
pfnDelete pfnDelete

View File

@ -296,7 +296,7 @@ static render_api_t gRenderAPI =
R_Mem_Free, R_Mem_Free,
pfnGetFilesList, pfnGetFilesList,
pfnFileBufferCRC32, pfnFileBufferCRC32,
COM_CompareFileTime, pfnCompareFileTime,
Host_Error, Host_Error,
(void*)CL_ModelHandle, (void*)CL_ModelHandle,
pfnTime, pfnTime,

View File

@ -840,30 +840,30 @@ cvar_t *GAME_EXPORT pfnCVarGetPointer( const char *szVarName )
/* /*
============= =============
COM_CompareFileTime pfnCompareFileTime
============= =============
*/ */
int GAME_EXPORT COM_CompareFileTime( const char *filename1, const char *filename2, int *iCompare ) int GAME_EXPORT pfnCompareFileTime( const char *path1, const char *path2, int *retval )
{ {
int bRet = 0; int t1, t2;
*retval = 0;
*iCompare = 0; if( !path1 || !path2 )
return 0;
if( filename1 && filename2 ) if(( t1 = g_fsapi.FileTime( path1, false )) == -1 )
{ return 0;
int ft1 = FS_FileTime( filename1, false );
int ft2 = FS_FileTime( filename2, false );
// one of files is missing if(( t2 = g_fsapi.FileTime( path2, false )) == -1 )
if( ft1 == -1 || ft2 == -1 ) return 0;
return bRet;
*iCompare = ft1 < ft2 ? -1 : ( ft1 > ft2 ? 1 : 0 ); if( t1 < t2 )
bRet = 1; *retval = -1;
} else if( t1 > t2 )
*retval = 1;
return bRet; return 1;
} }
/* /*

View File

@ -773,7 +773,7 @@ void Rcon_Print( host_redirect_t *rd, const char *pMsg );
qboolean COM_ParseVector( char **pfile, float *v, size_t size ); qboolean COM_ParseVector( char **pfile, float *v, size_t size );
int COM_FileSize( const char *filename ); int COM_FileSize( const char *filename );
void COM_FreeFile( void *buffer ); void COM_FreeFile( void *buffer );
int COM_CompareFileTime( const char *filename1, const char *filename2, int *iCompare ); int pfnCompareFileTime( const char *path1, const char *path2, int *retval );
char *va( const char *format, ... ) FORMAT_CHECK( 1 ) RETURNS_NONNULL; char *va( const char *format, ... ) FORMAT_CHECK( 1 ) RETURNS_NONNULL;
qboolean CRC32_MapFile( dword *crcvalue, const char *filename, qboolean multiplayer ); qboolean CRC32_MapFile( dword *crcvalue, const char *filename, qboolean multiplayer );

View File

@ -1699,7 +1699,7 @@ static qboolean Mod_LoadColoredLighting( model_t *mod, dbspmodel_t *bmod )
Q_snprintf( path, sizeof( path ), "maps/%s.lit", modelname ); Q_snprintf( path, sizeof( path ), "maps/%s.lit", modelname );
// make sure what deluxemap is actual // make sure what deluxemap is actual
if( !COM_CompareFileTime( path, mod->name, &iCompare )) if( !pfnCompareFileTime( path, mod->name, &iCompare ))
return false; return false;
if( iCompare < 0 ) // this may happens if level-designer used -onlyents key for hlcsg if( iCompare < 0 ) // this may happens if level-designer used -onlyents key for hlcsg
@ -1754,7 +1754,7 @@ static void Mod_LoadDeluxemap( model_t *mod, dbspmodel_t *bmod )
Q_snprintf( path, sizeof( path ), "maps/%s.dlit", modelname ); Q_snprintf( path, sizeof( path ), "maps/%s.dlit", modelname );
// make sure what deluxemap is actual // make sure what deluxemap is actual
if( !COM_CompareFileTime( path, mod->name, &iCompare )) if( !pfnCompareFileTime( path, mod->name, &iCompare ))
return; return;
if( iCompare < 0 ) // this may happens if level-designer used -onlyents key for hlcsg if( iCompare < 0 ) // this may happens if level-designer used -onlyents key for hlcsg

View File

@ -4732,7 +4732,7 @@ static enginefuncs_t gEngfuncs =
COM_LoadFileForMe, COM_LoadFileForMe,
COM_FreeFile, COM_FreeFile,
pfnEndSection, pfnEndSection,
COM_CompareFileTime, pfnCompareFileTime,
pfnGetGameDir, pfnGetGameDir,
pfnCvar_RegisterEngineVariable, pfnCvar_RegisterEngineVariable,
pfnFadeClientVolume, pfnFadeClientVolume,