|
|
@ -565,66 +565,62 @@ static void SetWidthAndHeightFromCommandLine( void ) |
|
|
|
static void SetFullscreenModeFromCommandLine( void ) |
|
|
|
static void SetFullscreenModeFromCommandLine( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
#if !XASH_MOBILE_PLATFORM |
|
|
|
#if !XASH_MOBILE_PLATFORM |
|
|
|
if ( Sys_CheckParm("-fullscreen") ) |
|
|
|
if( Sys_CheckParm( "-fullscreen" )) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Cvar_Set( "fullscreen", "1" ); |
|
|
|
Cvar_Set( "fullscreen", "1" ); |
|
|
|
} |
|
|
|
} |
|
|
|
else if ( Sys_CheckParm( "-windowed" ) ) |
|
|
|
else if( Sys_CheckParm( "-windowed" )) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Cvar_Set( "fullscreen", "0" ); |
|
|
|
Cvar_Set( "fullscreen", "0" ); |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void R_CollectRendererNames( void ) |
|
|
|
static void R_CollectRendererNames( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const char *renderers[] = DEFAULT_RENDERERS; |
|
|
|
// ordering is important!
|
|
|
|
int i, cur; |
|
|
|
static const char *shortNames[] = |
|
|
|
|
|
|
|
|
|
|
|
cur = 0; |
|
|
|
|
|
|
|
for( i = 0; i < DEFAULT_RENDERERS_LEN; i++ ) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
string temp; |
|
|
|
#if XASH_REF_GL_ENABLED |
|
|
|
void *dll, *pfn; |
|
|
|
"gl", |
|
|
|
|
|
|
|
#endif |
|
|
|
R_GetRendererName( temp, sizeof( temp ), renderers[i] ); |
|
|
|
#if XASH_REF_NANOGL_ENABLED |
|
|
|
|
|
|
|
"gles1", |
|
|
|
dll = COM_LoadLibrary( temp, false, true ); |
|
|
|
#endif |
|
|
|
if( !dll ) |
|
|
|
#if XASH_REF_GLWES_ENABLED |
|
|
|
{ |
|
|
|
"gles2", |
|
|
|
Con_Reportf( "R_CollectRendererNames: can't load library %s: %s\n", temp, COM_GetLibraryError() ); |
|
|
|
#endif |
|
|
|
continue; |
|
|
|
#if XASH_REF_GL4ES_ENABLED |
|
|
|
} |
|
|
|
"gl4es", |
|
|
|
|
|
|
|
#endif |
|
|
|
pfn = COM_GetProcAddress( dll, GET_REF_API ); |
|
|
|
#if XASH_REF_SOFT_ENABLED |
|
|
|
if( !pfn ) |
|
|
|
"soft", |
|
|
|
{ |
|
|
|
#endif |
|
|
|
Con_Reportf( "R_CollectRendererNames: can't find API entry point in %s\n", temp ); |
|
|
|
}; |
|
|
|
COM_FreeLibrary( dll ); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Q_strncpy( ref.shortNames[cur], renderers[i], sizeof( ref.shortNames[cur] )); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pfn = COM_GetProcAddress( dll, GET_REF_HUMANREADABLE_NAME ); |
|
|
|
|
|
|
|
if( !pfn ) // just in case
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Con_Reportf( "R_CollectRendererNames: can't find GetHumanReadableName export in %s\n", temp ); |
|
|
|
|
|
|
|
Q_strncpy( ref.readableNames[cur], renderers[i], sizeof( ref.readableNames[cur] )); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
REF_HUMANREADABLE_NAME GetHumanReadableName = (REF_HUMANREADABLE_NAME)pfn; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GetHumanReadableName( ref.readableNames[cur], sizeof( ref.readableNames[cur] )); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Con_Printf( "Found renderer %s: %s\n", ref.shortNames[cur], ref.readableNames[cur] ); |
|
|
|
// ordering is important here too!
|
|
|
|
|
|
|
|
static const char *readableNames[ARRAYSIZE( shortNames )] = |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
#if XASH_REF_GL_ENABLED |
|
|
|
|
|
|
|
"OpenGL", |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
#if XASH_REF_NANOGL_ENABLED |
|
|
|
|
|
|
|
"GLES1 (NanoGL)", |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
#if XASH_REF_GLWES_ENABLED |
|
|
|
|
|
|
|
"GLES2 (gl-wes-v2)", |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
#if XASH_REF_GL4ES_ENABLED |
|
|
|
|
|
|
|
"GL4ES", |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
#if XASH_REF_SOFT_ENABLED |
|
|
|
|
|
|
|
"Software", |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
cur++; |
|
|
|
ref.numRenderers = ARRAYSIZE( shortNames ); |
|
|
|
COM_FreeLibrary( dll ); |
|
|
|
ref.shortNames = shortNames; |
|
|
|
} |
|
|
|
ref.readableNames = readableNames; |
|
|
|
ref.numRenderers = cur; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
qboolean R_Init( void ) |
|
|
|
qboolean R_Init( void ) |
|
|
@ -678,30 +674,28 @@ qboolean R_Init( void ) |
|
|
|
// 1. Command line `-ref` argument.
|
|
|
|
// 1. Command line `-ref` argument.
|
|
|
|
// 2. `ref_dll` cvar.
|
|
|
|
// 2. `ref_dll` cvar.
|
|
|
|
// 3. Detected renderers in `DEFAULT_RENDERERS` order.
|
|
|
|
// 3. Detected renderers in `DEFAULT_RENDERERS` order.
|
|
|
|
requested[0] = '\0'; |
|
|
|
requested[0] = 0; |
|
|
|
if( !Sys_GetParmFromCmdLine( "-ref", requested ) && COM_CheckString( r_refdll->string ) ) |
|
|
|
|
|
|
|
// r_refdll is set to empty by default, so we can change hardcoded defaults just in case
|
|
|
|
if( !success && Sys_GetParmFromCmdLine( "-ref", requested )) |
|
|
|
Q_strncpy( requested, r_refdll->string, sizeof( requested ) ); |
|
|
|
success = R_LoadRenderer( requested ); |
|
|
|
|
|
|
|
|
|
|
|
if ( requested[0] ) |
|
|
|
if( !success && COM_CheckString( r_refdll->string )) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Q_strncpy( requested, r_refdll->string, sizeof( requested )); |
|
|
|
success = R_LoadRenderer( requested ); |
|
|
|
success = R_LoadRenderer( requested ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if( !success ) |
|
|
|
if( !success ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int i; |
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
|
|
// cycle through renderers that we collected in CollectRendererNames
|
|
|
|
for( i = 0; i < ref.numRenderers && !success; i++ ) |
|
|
|
for( i = 0; i < ref.numRenderers; i++ ) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
// skip renderer that was requested but failed to load
|
|
|
|
// skip renderer that was requested but failed to load
|
|
|
|
if( !Q_strcmp( requested, ref.shortNames[i] ) ) |
|
|
|
if( !Q_strcmp( requested, ref.shortNames[i] )) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
success = R_LoadRenderer( ref.shortNames[i] ); |
|
|
|
success = R_LoadRenderer( ref.shortNames[i] ); |
|
|
|
|
|
|
|
|
|
|
|
// yay, found working one
|
|
|
|
|
|
|
|
if( success ) |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|