engine: ensure that we loading same client library

This commit is contained in:
Alibek Omarov 2019-05-12 03:08:51 +03:00
parent e9e4a1296d
commit 5af6506d86
6 changed files with 11 additions and 7 deletions

View File

@ -3950,7 +3950,7 @@ qboolean CL_LoadProgs( const char *name )
// NOTE: important stuff! // NOTE: important stuff!
// vgui must startup BEFORE loading client.dll to avoid get error ERROR_NOACESS // vgui must startup BEFORE loading client.dll to avoid get error ERROR_NOACESS
// during LoadLibrary // during LoadLibrary
VGui_Startup( gameui.globals->scrWidth, gameui.globals->scrHeight ); VGui_Startup( name, gameui.globals->scrWidth, gameui.globals->scrHeight );
clgame.hInstance = COM_LoadLibrary( name, false, false ); clgame.hInstance = COM_LoadLibrary( name, false, false );
if( !clgame.hInstance ) return false; if( !clgame.hInstance ) return false;

View File

@ -2980,7 +2980,11 @@ void CL_Init( void )
// IN_TouchInit(); // IN_TouchInit();
Con_LoadHistory(); Con_LoadHistory();
#ifdef XASH_INTERNAL_GAMELIBS
if( !CL_LoadProgs( "client" ) )
#else
if( !CL_LoadProgs( va( "%s/%s", GI->dll_path, SI.clientlib))) if( !CL_LoadProgs( va( "%s/%s", GI->dll_path, SI.clientlib)))
#endif
Host_Error( "can't initialize %s: %s\n", SI.clientlib, COM_GetLibraryError() ); Host_Error( "can't initialize %s: %s\n", SI.clientlib, COM_GetLibraryError() );
cls.initialized = true; cls.initialized = true;

View File

@ -731,7 +731,7 @@ void SCR_VidInit( void )
gameui.globals->scrHeight = refState.height; gameui.globals->scrHeight = refState.height;
} }
VGui_Startup( refState.width, refState.height ); VGui_Startup( NULL, refState.width, refState.height ); // initialized already, so pass NULL
CL_ClearSpriteTextures(); // now all hud sprites are invalid CL_ClearSpriteTextures(); // now all hud sprites are invalid

View File

@ -218,7 +218,7 @@ VGui_Startup
Load vgui_support library and call VGui_Startup Load vgui_support library and call VGui_Startup
================ ================
*/ */
void VGui_Startup( int width, int height ) void VGui_Startup( const char *clientlib, int width, int height )
{ {
static qboolean failed = false; static qboolean failed = false;
@ -238,7 +238,7 @@ void VGui_Startup( int width, int height )
VGui_FillAPIFromRef( &vgui, &ref.dllFuncs ); VGui_FillAPIFromRef( &vgui, &ref.dllFuncs );
#ifdef XASH_INTERNAL_GAMELIBS #ifdef XASH_INTERNAL_GAMELIBS
s_pVGuiSupport = COM_LoadLibrary( "client", false, false ); s_pVGuiSupport = COM_LoadLibrary( clientlib, false, false );
if( s_pVGuiSupport ) if( s_pVGuiSupport )
{ {

View File

@ -25,7 +25,7 @@ extern "C" {
// //
// vgui_draw.c // vgui_draw.c
// //
void VGui_Startup( int width, int height ); void VGui_Startup( const char *clientlib, int width, int height );
void VGui_Shutdown( void ); void VGui_Shutdown( void );
void VGui_Paint(); void VGui_Paint();
void VGui_RunFrame(); void VGui_RunFrame();

View File

@ -1544,8 +1544,8 @@ void FS_LoadGameInfo( const char *rootfolder )
} }
if( !Sys_GetParmFromCmdLine( "-clientlib", SI.clientlib ) ) if( !Sys_GetParmFromCmdLine( "-clientlib", SI.clientlib ) )
{ {
#ifdef __ANDROID__ #ifdef XASH_INTERNAL_GAMELIBS
Q_strncpy( SI.clientlib, CLIENTDLL, sizeof( SI.clientlib ) ); Q_strncpy( SI.clientlib, "client", sizeof( SI.clientlib ) );
#else #else
Q_strncpy( SI.clientlib, GI->client_lib, sizeof( SI.clientlib ) ); Q_strncpy( SI.clientlib, GI->client_lib, sizeof( SI.clientlib ) );
#endif #endif