From 88772a1c3420c4ecadb204623b43dbbb0e20af60 Mon Sep 17 00:00:00 2001 From: Wei Mingzhi Date: Mon, 7 Oct 2019 11:59:21 +0800 Subject: [PATCH] engine: GetGameDir should return gamedir only. Add proper stub functions for some engine APIs. --- engine/client/cl_game.c | 2 +- engine/common/common.c | 2 +- engine/eiface.h | 22 +++++++++++----------- engine/server/sv_game.c | 35 ++++++++++++++++++++++------------- 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/engine/client/cl_game.c b/engine/client/cl_game.c index 3e4b8ce5..468542c0 100644 --- a/engine/client/cl_game.c +++ b/engine/client/cl_game.c @@ -2607,7 +2607,7 @@ const char *pfnGetGameDirectory( void ) { static char szGetGameDir[MAX_SYSPATH]; - Q_sprintf( szGetGameDir, "%s/%s", host.rootdir, GI->gamefolder ); + Q_strcpy( szGetGameDir, GI->gamefolder ); return szGetGameDir; } diff --git a/engine/common/common.c b/engine/common/common.c index af2718f4..2656e25d 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -1123,7 +1123,7 @@ pfnGetGameDir void pfnGetGameDir( char *szGetGameDir ) { if( !szGetGameDir ) return; - Q_sprintf( szGetGameDir, "%s/%s", host.rootdir, GI->gamefolder ); + Q_strcpy( szGetGameDir, GI->gamefolder ); } qboolean COM_IsSafeFileToDownload( const char *filename ) diff --git a/engine/eiface.h b/engine/eiface.h index ae9eac68..a7798927 100644 --- a/engine/eiface.h +++ b/engine/eiface.h @@ -262,17 +262,17 @@ typedef struct enginefuncs_s const char *(*pfnGetPlayerAuthId) ( edict_t *e ); - void (*pfnUnused1)( void ); - void (*pfnUnused2)( void ); - void (*pfnUnused3)( void ); - void (*pfnUnused4)( void ); - void (*pfnUnused5)( void ); - void (*pfnUnused6)( void ); - void (*pfnUnused7)( void ); - void (*pfnUnused8)( void ); - void (*pfnUnused9)( void ); - void (*pfnUnused10)( void ); - void (*pfnUnused11)( void ); + void* (*pfnSequenceGet) ( const char* fileName, const char* entryName ); + void* (*pfnSequencePickSentence) ( const char* groupName, int pickMethod, int *picked ); + int (*pfnGetFileSize) ( char *filename ); + unsigned int (*pfnGetApproxWavePlayLen) (const char *filepath); + int (*pfnIsCareerMatch) ( void ); + int (*pfnGetLocalizedStringLength) (const char *label); + void (*pfnRegisterTutorMessageShown) (int mid); + int (*pfnGetTimesTutorMessageShown) (int mid); + void (*pfnProcessTutorMessageDecayBuffer) (int *buffer, int bufferLength); + void (*pfnConstructTutorMessageDecayBuffer) (int *buffer, int bufferLength); + void (*pfnResetTutorMessageDecayData) ( void ); // three useable funcs void (*pfnQueryClientCvarValue)( const edict_t *player, const char *cvarName ); diff --git a/engine/server/sv_game.c b/engine/server/sv_game.c index a0a7cddb..a1ac66ba 100644 --- a/engine/server/sv_game.c +++ b/engine/server/sv_game.c @@ -4550,10 +4550,19 @@ pfnEngineStub extended iface stubs ============= */ -static void pfnEngineStub( void ) +static int pfnGetFileSize( char *filename ) { + return 0; +} +static unsigned int pfnGetApproxWavePlayLen(const char *filepath) +{ + return 0; } - +static int pfnGetLocalizedStringLength(const char *label) +{ + return 0; +} + // engine callbacks static enginefuncs_t gEngfuncs = { @@ -4701,17 +4710,17 @@ static enginefuncs_t gEngfuncs = pfnVoice_GetClientListening, pfnVoice_SetClientListening, pfnGetPlayerAuthId, - pfnEngineStub, - pfnEngineStub, - pfnEngineStub, - pfnEngineStub, - pfnEngineStub, - pfnEngineStub, - pfnEngineStub, - pfnEngineStub, - pfnEngineStub, - pfnEngineStub, - pfnEngineStub, + pfnSequenceGet, + pfnSequencePickSentence, + pfnGetFileSize, + pfnGetApproxWavePlayLen, + pfnIsCareerMatch, + pfnGetLocalizedStringLength, + pfnRegisterTutorMessageShown, + pfnGetTimesTutorMessageShown, + pfnProcessTutorMessageDecayBuffer, + pfnConstructTutorMessageDecayBuffer, + pfnResetTutorMessageDecayData, pfnQueryClientCvarValue, pfnQueryClientCvarValue2, COM_CheckParm,