engine: make use of platform-unique library naming scheme

This commit is contained in:
Alibek Omarov
2019-07-01 05:50:04 +03:00
parent ec18dd9535
commit 89a3fd6323
6 changed files with 37 additions and 40 deletions
+14 -10
View File
@@ -888,6 +888,7 @@ pfnCheckGameDll
*/
int pfnCheckGameDll( void )
{
string dllpath;
void *hInst;
#if TARGET_OS_IPHONE
@@ -900,7 +901,9 @@ int pfnCheckGameDll( void )
if( svgame.hInstance )
return true;
if(( hInst = COM_LoadLibrary( SI.gamedll, true, false )) != NULL )
COM_GetCommonLibraryName( LIBRARY_SERVER, dllpath, sizeof( dllpath ));
if(( hInst = COM_LoadLibrary( dllpath, true, false )) != NULL )
{
COM_FreeLibrary( hInst ); // don't increase linker's reference counter
return true;
@@ -1075,6 +1078,7 @@ qboolean UI_LoadProgs( void )
static ui_textfuncs_t gpTextfuncs;
static ui_globalvars_t gpGlobals;
UITEXTAPI GiveTextApi;
string dllpath;
int i;
if( gameui.hInstance ) UI_UnloadProgs();
@@ -1082,23 +1086,23 @@ qboolean UI_LoadProgs( void )
// setup globals
gameui.globals = &gpGlobals;
#ifdef XASH_INTERNAL_GAMELIBS
if(!( gameui.hInstance = COM_LoadLibrary( "menu", false, false )))
return false;
#else
if(!( gameui.hInstance = COM_LoadLibrary( va( "%s/" MENUDLL, GI->dll_path ), false, false )))
COM_GetCommonLibraryName( LIBRARY_GAMEUI, dllpath, sizeof( dllpath ));
if(!( gameui.hInstance = COM_LoadLibrary( dllpath, false, false )))
{
FS_AllowDirectPaths( true );
if(!( gameui.hInstance = COM_LoadLibrary( "../" MENUDLL, false, false ))
&& !( gameui.hInstance = COM_LoadLibrary( MENUDLL, false, false )))
// no use to load it from engine directory, as library loader
// that implements internal gamelibs already knows how to load it
#ifndef XASH_INTERNAL_GAMELIBS
if(!( gameui.hInstance = COM_LoadLibrary( OS_LIB_PREFIX "menu." OS_LIB_EXT, false, false )))
#endif
{
FS_AllowDirectPaths( false );
return false;
}
}
#endif
FS_AllowDirectPaths( false );
if(( GetMenuAPI = (MENUAPI)COM_GetProcAddress( gameui.hInstance, "GetMenuAPI" )) == NULL )
+6 -6
View File
@@ -2967,6 +2967,8 @@ CL_Init
*/
void CL_Init( void )
{
string libpath;
if( host.type == HOST_DEDICATED )
return; // nothing running on the client
@@ -2981,12 +2983,10 @@ void CL_Init( void )
// IN_TouchInit();
Con_LoadHistory();
#ifdef XASH_INTERNAL_GAMELIBS
if( !CL_LoadProgs( "client" ) )
#else
if( !CL_LoadProgs( va( "%s/%s", GI->dll_path, SI.clientlib)))
#endif
Host_Error( "can't initialize %s: %s\n", SI.clientlib, COM_GetLibraryError() );
COM_GetCommonLibraryName( LIBRARY_CLIENT, libpath, sizeof( libpath ));
if( !CL_LoadProgs( libpath ) )
Host_Error( "can't initialize %s: %s\n", libpath, COM_GetLibraryError() );
cls.initialized = true;
cl.maxclients = 1; // allow to drawing player in menu
+1 -1
View File
@@ -266,7 +266,7 @@ void VGui_Startup( const char *clientlib, int width, int height )
Con_Reportf( S_WARN "VGUI preloading failed. Default library will be used! Reason: %s\n", COM_GetLibraryError());
}
if( Q_strstr( GI->client_lib, ".dll" ) )
if( Q_strstr( clientlib, ".dll" ) )
Q_strncpy( vguiloader, "vgui_support.dll", 256 );
if( !vguiloader[0] && !Sys_GetParmFromCmdLine( "-vguiloader", vguiloader ) )