|
|
@ -430,23 +430,16 @@ static qboolean R_LoadProgs( const char *name ) |
|
|
|
|
|
|
|
|
|
|
|
if( ref.hInstance ) R_UnloadProgs(); |
|
|
|
if( ref.hInstance ) R_UnloadProgs(); |
|
|
|
|
|
|
|
|
|
|
|
#ifdef XASH_INTERNAL_GAMELIBS |
|
|
|
|
|
|
|
if( !(ref.hInstance = COM_LoadLibrary( name, false, true ) )) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
FS_AllowDirectPaths( true ); |
|
|
|
FS_AllowDirectPaths( true ); |
|
|
|
if( !(ref.hInstance = COM_LoadLibrary( name, false, true ) )) |
|
|
|
if( !(ref.hInstance = COM_LoadLibrary( name, false, true ) )) |
|
|
|
{ |
|
|
|
{ |
|
|
|
FS_AllowDirectPaths( false ); |
|
|
|
FS_AllowDirectPaths( false ); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FS_AllowDirectPaths( false ); |
|
|
|
FS_AllowDirectPaths( false ); |
|
|
|
|
|
|
|
|
|
|
|
if( ( GetRefAPI = (REFAPI)COM_GetProcAddress( ref.hInstance, "GetRefAPI" )) == NULL ) |
|
|
|
if( !( GetRefAPI = (REFAPI)COM_GetProcAddress( ref.hInstance, GET_REF_API )) ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
COM_FreeLibrary( ref.hInstance ); |
|
|
|
COM_FreeLibrary( ref.hInstance ); |
|
|
|
Con_Reportf( "R_LoadProgs: can't init renderer API\n" ); |
|
|
|
Con_Reportf( "R_LoadProgs: can't init renderer API\n" ); |
|
|
@ -509,13 +502,12 @@ static void R_GetRendererName( char *dest, size_t size, const char *opt ) |
|
|
|
if( !Q_strstr( opt, va( ".%s", OS_LIB_EXT ))) |
|
|
|
if( !Q_strstr( opt, va( ".%s", OS_LIB_EXT ))) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// shortened renderer name
|
|
|
|
// shortened renderer name
|
|
|
|
Q_snprintf( dest, size, "%sref_%s.%s", |
|
|
|
#ifdef XASH_INTERNAL_GAMELIBS |
|
|
|
#ifdef OS_LIB_PREFIX |
|
|
|
Q_snprintf( dest, size, "ref_%s", opt ); |
|
|
|
OS_LIB_PREFIX, |
|
|
|
|
|
|
|
#else |
|
|
|
#else |
|
|
|
"", |
|
|
|
Q_snprintf( dest, size, "%sref_%s.%s", |
|
|
|
|
|
|
|
OS_LIB_PREFIX, opt, OS_LIB_EXT ); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
opt, OS_LIB_EXT ); |
|
|
|
|
|
|
|
Con_Printf( "Loading renderer by short name: %s\n", opt ); |
|
|
|
Con_Printf( "Loading renderer by short name: %s\n", opt ); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -574,10 +566,57 @@ static void SetFullscreenModeFromCommandLine( ) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void R_CollectRendererNames( void ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
const char *renderers[] = DEFAULT_RENDERERS; |
|
|
|
|
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ref.numRenderers = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for( i = 0; i < ARRAYSIZE( ref.renderers ); i++ ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ref_renderer_t *refdll = ref.renderers + ref.numRenderers; |
|
|
|
|
|
|
|
string temp; |
|
|
|
|
|
|
|
void *dll, *pfn; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
R_GetRendererName( temp, sizeof( temp ), renderers[i] ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dll = COM_LoadLibrary( temp, false, true ); |
|
|
|
|
|
|
|
if( !dll ) |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pfn = COM_GetProcAddress( dll, GET_REF_API ); |
|
|
|
|
|
|
|
if( !pfn ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
COM_FreeLibrary( dll ); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Q_strncpy( refdll->shortenedName, renderers[i], sizeof( refdll->shortenedName )); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pfn = COM_GetProcAddress( dll, GET_REF_HUMANREADABLE_NAME ); |
|
|
|
|
|
|
|
if( !pfn ) // just in case
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Q_strncpy( refdll->humanReadable, renderers[i], sizeof( refdll->humanReadable )); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
REF_HUMANREADABLE_NAME GetHumanReadableName = (REF_HUMANREADABLE_NAME)pfn; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GetHumanReadableName( refdll->humanReadable, sizeof( refdll->humanReadable )); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Con_Printf( "Found renderer %s: %s\n", refdll->shortenedName, refdll->humanReadable ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ref.numRenderers++; |
|
|
|
|
|
|
|
COM_FreeLibrary( dll ); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
qboolean R_Init( void ) |
|
|
|
qboolean R_Init( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
qboolean success = false; |
|
|
|
qboolean success = false; |
|
|
|
int i; |
|
|
|
|
|
|
|
string refopt; |
|
|
|
string refopt; |
|
|
|
|
|
|
|
|
|
|
|
gl_vsync = Cvar_Get( "gl_vsync", "0", FCVAR_ARCHIVE, "enable vertical syncronization" ); |
|
|
|
gl_vsync = Cvar_Get( "gl_vsync", "0", FCVAR_ARCHIVE, "enable vertical syncronization" ); |
|
|
@ -598,6 +637,8 @@ qboolean R_Init( void ) |
|
|
|
SetWidthAndHeightFromCommandLine(); |
|
|
|
SetWidthAndHeightFromCommandLine(); |
|
|
|
SetFullscreenModeFromCommandLine(); |
|
|
|
SetFullscreenModeFromCommandLine(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
R_CollectRendererNames(); |
|
|
|
|
|
|
|
|
|
|
|
// command line have priority
|
|
|
|
// command line have priority
|
|
|
|
if( !Sys_GetParmFromCmdLine( "-ref", refopt ) ) |
|
|
|
if( !Sys_GetParmFromCmdLine( "-ref", refopt ) ) |
|
|
|
{ |
|
|
|
{ |
|
|
|