mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-29 16:24:16 +00:00
engine: rename library naming function, as it returns a full path and not just library name
This commit is contained in:
parent
d01a33814c
commit
54920f13df
@ -3957,16 +3957,16 @@ qboolean CL_LoadProgs( const char *name )
|
|||||||
#if XASH_WIN32
|
#if XASH_WIN32
|
||||||
if( ( clgame.client_dll_uses_sdl = COM_CheckLibraryDirectDependency( name, OS_LIB_PREFIX "SDL2." OS_LIB_EXT, false ) ) )
|
if( ( clgame.client_dll_uses_sdl = COM_CheckLibraryDirectDependency( name, OS_LIB_PREFIX "SDL2." OS_LIB_EXT, false ) ) )
|
||||||
{
|
{
|
||||||
Con_Printf( S_NOTE "client.dll uses SDL2 for mouse input\n" );
|
Con_Printf( S_NOTE "%s uses SDL2 for mouse input\n", name );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Con_Printf( S_NOTE "client.dll uses Windows API for mouse input\n" );
|
Con_Printf( S_NOTE "%s uses Windows API for mouse input\n", name );
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// this doesn't mean other platforms uses SDL2 in any case
|
// this doesn't mean other platforms uses SDL2 in any case
|
||||||
// it just helps input code to stay platform-independent
|
// it just helps input code to stay platform-independent
|
||||||
clgame.client_dll_uses_sdl = true;
|
clgame.client_dll_uses_sdl = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
clgame.hInstance = COM_LoadLibrary( name, false, false );
|
clgame.hInstance = COM_LoadLibrary( name, false, false );
|
||||||
|
@ -901,7 +901,7 @@ int pfnCheckGameDll( void )
|
|||||||
if( svgame.hInstance )
|
if( svgame.hInstance )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
COM_GetCommonLibraryName( LIBRARY_SERVER, dllpath, sizeof( dllpath ));
|
COM_GetCommonLibraryPath( LIBRARY_SERVER, dllpath, sizeof( dllpath ));
|
||||||
|
|
||||||
if(( hInst = COM_LoadLibrary( dllpath, true, false )) != NULL )
|
if(( hInst = COM_LoadLibrary( dllpath, true, false )) != NULL )
|
||||||
{
|
{
|
||||||
@ -1086,16 +1086,18 @@ qboolean UI_LoadProgs( void )
|
|||||||
// setup globals
|
// setup globals
|
||||||
gameui.globals = &gpGlobals;
|
gameui.globals = &gpGlobals;
|
||||||
|
|
||||||
COM_GetCommonLibraryName( LIBRARY_GAMEUI, dllpath, sizeof( dllpath ));
|
COM_GetCommonLibraryPath( LIBRARY_GAMEUI, dllpath, sizeof( dllpath ));
|
||||||
|
|
||||||
if(!( gameui.hInstance = COM_LoadLibrary( dllpath, false, false )))
|
if(!( gameui.hInstance = COM_LoadLibrary( dllpath, false, false )))
|
||||||
{
|
{
|
||||||
|
string path = OS_LIB_PREFIX "menu." OS_LIB_EXT;
|
||||||
|
|
||||||
FS_AllowDirectPaths( true );
|
FS_AllowDirectPaths( true );
|
||||||
|
|
||||||
// no use to load it from engine directory, as library loader
|
// no use to load it from engine directory, as library loader
|
||||||
// that implements internal gamelibs already knows how to load it
|
// that implements internal gamelibs already knows how to load it
|
||||||
#ifndef XASH_INTERNAL_GAMELIBS
|
#ifndef XASH_INTERNAL_GAMELIBS
|
||||||
if(!( gameui.hInstance = COM_LoadLibrary( OS_LIB_PREFIX "menu." OS_LIB_EXT, false, false )))
|
if(!( gameui.hInstance = COM_LoadLibrary( path, false, true )))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
FS_AllowDirectPaths( false );
|
FS_AllowDirectPaths( false );
|
||||||
|
@ -2983,7 +2983,7 @@ void CL_Init( void )
|
|||||||
// IN_TouchInit();
|
// IN_TouchInit();
|
||||||
Con_LoadHistory();
|
Con_LoadHistory();
|
||||||
|
|
||||||
COM_GetCommonLibraryName( LIBRARY_CLIENT, libpath, sizeof( libpath ));
|
COM_GetCommonLibraryPath( LIBRARY_CLIENT, libpath, sizeof( libpath ));
|
||||||
|
|
||||||
if( !CL_LoadProgs( libpath ) )
|
if( !CL_LoadProgs( libpath ) )
|
||||||
Host_Error( "can't initialize %s: %s\n", libpath, COM_GetLibraryError() );
|
Host_Error( "can't initialize %s: %s\n", libpath, COM_GetLibraryError() );
|
||||||
|
@ -61,56 +61,49 @@ const char *COM_OffsetNameForFunction( void *function )
|
|||||||
=============================================================================
|
=============================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
static void COM_GenerateCommonLibraryName( const char *name, const char *ext, char *out, size_t size )
|
||||||
==============
|
|
||||||
COM_GenerateClientLibraryName
|
|
||||||
|
|
||||||
Generates platform-unique and compatible name for client libraries
|
|
||||||
==============
|
|
||||||
*/
|
|
||||||
static void COM_GenerateClientLibraryName( const char *name, char *out, size_t size )
|
|
||||||
{
|
{
|
||||||
#ifdef XASH_INTERNAL_GAMELIBS // assuming library loader knows where to get libraries
|
#if ( XASH_WIN32 || XASH_LINUX || XASH_APPLE ) && XASH_X86
|
||||||
|
Q_snprintf( out, size, "%s.%s", name, ext );
|
||||||
Q_strncpy( out, name, size );
|
|
||||||
|
|
||||||
#elif ( XASH_WIN32 || XASH_LINUX || XASH_APPLE ) && XASH_X86
|
|
||||||
|
|
||||||
Q_snprintf( out, size, "%s/%s." OS_LIB_EXT,
|
|
||||||
GI->dll_path,
|
|
||||||
name );
|
|
||||||
|
|
||||||
#elif ( XASH_WIN32 || XASH_LINUX || XASH_APPLE )
|
#elif ( XASH_WIN32 || XASH_LINUX || XASH_APPLE )
|
||||||
|
Q_snprintf( out, size, "%s_%s.%s", name, Q_buildarch(), ext );
|
||||||
Q_snprintf( out, size, "%s/%s_%s." OS_LIB_EXT,
|
|
||||||
GI->dll_path,
|
|
||||||
name,
|
|
||||||
Q_buildarch() );
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
Q_snprintf( out, size, "%s_%s_%s.%s", name, Q_buildos(), Q_buildarch(), ext );
|
||||||
Q_snprintf( out, size, "%s/%s_%s_%s." OS_LIB_EXT,
|
|
||||||
GI->dll_path,
|
|
||||||
name,
|
|
||||||
Q_buildos(),
|
|
||||||
Q_buildarch() );
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============
|
==============
|
||||||
COM_GenerateClientLibraryName
|
COM_GenerateClientLibraryPath
|
||||||
|
|
||||||
|
Generates platform-unique and compatible name for client libraries
|
||||||
|
==============
|
||||||
|
*/
|
||||||
|
static void COM_GenerateClientLibraryPath( const char *name, char *out, size_t size )
|
||||||
|
{
|
||||||
|
#ifdef XASH_INTERNAL_GAMELIBS // assuming library loader knows where to get libraries
|
||||||
|
Q_strncpy( out, name, size );
|
||||||
|
#else
|
||||||
|
string dllpath;
|
||||||
|
|
||||||
|
// we don't have any library prefixes, so we can safely append dll_path here
|
||||||
|
Q_snprintf( dllpath, sizeof( dllpath ), "%s/%s", GI->dll_path, name );
|
||||||
|
|
||||||
|
COM_GenerateCommonLibraryName( dllpath, OS_LIB_EXT, out, size );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
==============
|
||||||
|
COM_GenerateServerLibraryPath
|
||||||
|
|
||||||
Generates platform-unique and compatible name for server library
|
Generates platform-unique and compatible name for server library
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
static void COM_GenerateServerLibraryName( char *out, size_t size )
|
static void COM_GenerateServerLibraryPath( char *out, size_t size )
|
||||||
{
|
{
|
||||||
#ifdef XASH_INTERNAL_GAMELIBS // assuming library loader knows where to get libraries
|
#ifdef XASH_INTERNAL_GAMELIBS // assuming library loader knows where to get libraries
|
||||||
|
|
||||||
Q_strncpy( out, "server", size );
|
Q_strncpy( out, "server", size );
|
||||||
|
|
||||||
#elif ( XASH_WIN32 || XASH_LINUX || XASH_APPLE ) && XASH_X86
|
#elif ( XASH_WIN32 || XASH_LINUX || XASH_APPLE ) && XASH_X86
|
||||||
|
|
||||||
#if XASH_WIN32
|
#if XASH_WIN32
|
||||||
@ -136,29 +129,24 @@ static void COM_GenerateServerLibraryName( char *out, size_t size )
|
|||||||
ext = COM_FileExtension( dllpath );
|
ext = COM_FileExtension( dllpath );
|
||||||
COM_StripExtension( dllpath );
|
COM_StripExtension( dllpath );
|
||||||
|
|
||||||
#if ( XASH_WIN32 || XASH_LINUX || XASH_APPLE )
|
COM_GenerateCommonLibraryName( dllpath, ext, out, size );
|
||||||
Q_snprintf( out, size, "%s_%s.%s", dllpath, Q_buildarch(), ext );
|
|
||||||
#else
|
|
||||||
Q_snprintf( out, size, "%s_%s_%s.%s", dllpath, Q_buildos(), Q_buildarch(), ext );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============
|
==============
|
||||||
COM_GetCommonLibraryName
|
COM_GetCommonLibraryPath
|
||||||
|
|
||||||
Generates platform-unique and compatible name for server library
|
Generates platform-unique and compatible name for server library
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void COM_GetCommonLibraryName( ECommonLibraryType eLibType, char *out, size_t size )
|
void COM_GetCommonLibraryPath( ECommonLibraryType eLibType, char *out, size_t size )
|
||||||
{
|
{
|
||||||
switch( eLibType )
|
switch( eLibType )
|
||||||
{
|
{
|
||||||
case LIBRARY_GAMEUI:
|
case LIBRARY_GAMEUI:
|
||||||
COM_GenerateClientLibraryName( "menu", out, size );
|
COM_GenerateClientLibraryPath( "menu", out, size );
|
||||||
break;
|
break;
|
||||||
case LIBRARY_CLIENT:
|
case LIBRARY_CLIENT:
|
||||||
if( SI.clientlib[0] )
|
if( SI.clientlib[0] )
|
||||||
@ -167,7 +155,7 @@ void COM_GetCommonLibraryName( ECommonLibraryType eLibType, char *out, size_t si
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
COM_GenerateClientLibraryName( "client", out, size );
|
COM_GenerateClientLibraryPath( "client", out, size );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LIBRARY_SERVER:
|
case LIBRARY_SERVER:
|
||||||
@ -177,7 +165,7 @@ void COM_GetCommonLibraryName( ECommonLibraryType eLibType, char *out, size_t si
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
COM_GenerateServerLibraryName( out, size );
|
COM_GenerateServerLibraryPath( out, size );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -56,6 +56,6 @@ typedef enum
|
|||||||
LIBRARY_GAMEUI
|
LIBRARY_GAMEUI
|
||||||
} ECommonLibraryType;
|
} ECommonLibraryType;
|
||||||
|
|
||||||
void COM_GetCommonLibraryName( ECommonLibraryType eLibType, char *out, size_t size );
|
void COM_GetCommonLibraryPath( ECommonLibraryType eLibType, char *out, size_t size );
|
||||||
|
|
||||||
#endif//LIBRARY_H
|
#endif//LIBRARY_H
|
||||||
|
@ -673,7 +673,7 @@ qboolean SV_InitGame( void )
|
|||||||
// first initialize?
|
// first initialize?
|
||||||
COM_ResetLibraryError();
|
COM_ResetLibraryError();
|
||||||
|
|
||||||
COM_GetCommonLibraryName( LIBRARY_SERVER, dllpath, sizeof( dllpath ));
|
COM_GetCommonLibraryPath( LIBRARY_SERVER, dllpath, sizeof( dllpath ));
|
||||||
|
|
||||||
if( !SV_LoadProgs( dllpath ))
|
if( !SV_LoadProgs( dllpath ))
|
||||||
{
|
{
|
||||||
@ -1000,7 +1000,7 @@ void SV_InitGameProgs( void )
|
|||||||
|
|
||||||
if( svgame.hInstance ) return; // already loaded
|
if( svgame.hInstance ) return; // already loaded
|
||||||
|
|
||||||
COM_GetCommonLibraryName( LIBRARY_SERVER, dllpath, sizeof( dllpath ));
|
COM_GetCommonLibraryPath( LIBRARY_SERVER, dllpath, sizeof( dllpath ));
|
||||||
|
|
||||||
// just try to initialize
|
// just try to initialize
|
||||||
SV_LoadProgs( dllpath );
|
SV_LoadProgs( dllpath );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user