Browse Source

engine: client: fixed checking client library for vgui_support interface export

pull/2/head
SNMetamorph 3 years ago committed by a1batross
parent
commit
87ceb0f9cb
  1. 4
      engine/client/cl_scrn.c
  2. 24
      engine/client/vgui/vgui_draw.c

4
engine/client/cl_scrn.c

@ -781,6 +781,7 @@ SCR_VidInit
*/ */
void SCR_VidInit( void ) void SCR_VidInit( void )
{ {
string libpath;
if( !ref.initialized ) // don't call VidInit too soon if( !ref.initialized ) // don't call VidInit too soon
return; return;
@ -795,7 +796,8 @@ void SCR_VidInit( void )
gameui.globals->scrHeight = refState.height; gameui.globals->scrHeight = refState.height;
} }
VGui_Startup( NULL, refState.width, refState.height ); // initialized already, so pass NULL COM_GetCommonLibraryPath( LIBRARY_CLIENT, libpath, sizeof( libpath ));
VGui_Startup( libpath, refState.width, refState.height );
CL_ClearSpriteTextures(); // now all hud sprites are invalid CL_ClearSpriteTextures(); // now all hud sprites are invalid

24
engine/client/vgui/vgui_draw.c

@ -152,7 +152,6 @@ void VGui_Startup( const char *clientlib, int width, int height )
VGui_FillAPIFromRef( &vgui, &ref.dllFuncs ); VGui_FillAPIFromRef( &vgui, &ref.dllFuncs );
#ifdef XASH_INTERNAL_GAMELIBS
s_pVGuiSupport = COM_LoadLibrary( clientlib, false, false ); s_pVGuiSupport = COM_LoadLibrary( clientlib, false, false );
if( s_pVGuiSupport ) if( s_pVGuiSupport )
@ -162,29 +161,29 @@ void VGui_Startup( const char *clientlib, int width, int height )
{ {
F( &vgui ); F( &vgui );
vgui.initialized = true; vgui.initialized = true;
VGUI_InitCursors(); Con_Reportf( "vgui_support: found internal client support\n" );
Con_Reportf( "vgui_support: found interal client support\n" );
} }
} }
#endif // XASH_INTERNAL_GAMELIBS
if( !vgui.initialized )
{
// HACKHACK: load vgui with correct path first if specified. // HACKHACK: load vgui with correct path first if specified.
// it will be reused while resolving vgui support and client deps // it will be reused while resolving vgui support and client deps
if( Sys_GetParmFromCmdLine( "-vguilib", vguilib ) ) if( Sys_GetParmFromCmdLine( "-vguilib", vguilib ))
{ {
if( Q_strstr( vguilib, ".dll") ) if( Q_strstr( vguilib, ".dll" ))
Q_strncpy( vguiloader, "vgui_support.dll", 256 ); Q_strncpy( vguiloader, "vgui_support.dll", 256 );
else else
Q_strncpy( vguiloader, VGUI_SUPPORT_DLL, 256 ); Q_strncpy( vguiloader, VGUI_SUPPORT_DLL, 256 );
if( !COM_LoadLibrary( vguilib, false, false ) ) if( !COM_LoadLibrary( vguilib, false, false ))
Con_Reportf( S_WARN "VGUI preloading failed. Default library will be used! Reason: %s\n", COM_GetLibraryError()); Con_Reportf( S_WARN "VGUI preloading failed. Default library will be used! Reason: %s\n", COM_GetLibraryError() );
} }
if( Q_strstr( clientlib, ".dll" ) ) if( Q_strstr( clientlib, ".dll" ))
Q_strncpy( vguiloader, "vgui_support.dll", 256 ); Q_strncpy( vguiloader, "vgui_support.dll", 256 );
if( !vguiloader[0] && !Sys_GetParmFromCmdLine( "-vguiloader", vguiloader ) ) if( !vguiloader[0] && !Sys_GetParmFromCmdLine( "-vguiloader", vguiloader ))
Q_strncpy( vguiloader, VGUI_SUPPORT_DLL, 256 ); Q_strncpy( vguiloader, VGUI_SUPPORT_DLL, 256 );
s_pVGuiSupport = COM_LoadLibrary( vguiloader, false, false ); s_pVGuiSupport = COM_LoadLibrary( vguiloader, false, false );
@ -196,7 +195,7 @@ void VGui_Startup( const char *clientlib, int width, int height )
if( !s_pVGuiSupport ) if( !s_pVGuiSupport )
{ {
if( FS_FileExists( vguiloader, false ) ) if( FS_FileExists( vguiloader, false ))
Con_Reportf( S_ERROR "Failed to load vgui_support library: %s\n", COM_GetLibraryError() ); Con_Reportf( S_ERROR "Failed to load vgui_support library: %s\n", COM_GetLibraryError() );
else else
Con_Reportf( "vgui_support: not found\n" ); Con_Reportf( "vgui_support: not found\n" );
@ -208,12 +207,11 @@ void VGui_Startup( const char *clientlib, int width, int height )
{ {
F( &vgui ); F( &vgui );
vgui.initialized = true; vgui.initialized = true;
VGUI_InitCursors();
} }
else else
Con_Reportf( S_ERROR "Failed to find vgui_support library entry point!\n" ); Con_Reportf( S_ERROR "Failed to find vgui_support library entry point!\n" );
} }
}
} }
if( height < 480 ) if( height < 480 )

Loading…
Cancel
Save