Merge pull request #575 from illwieckz/shaderlists

load shaderlist.txt from more than one VFS, fix #573
This commit is contained in:
Timothee "TTimo" Besset 2018-01-21 15:01:50 -06:00 committed by GitHub
commit ac48f23d4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -469,7 +469,7 @@ void DumpUnreferencedShaders(){
==================
*/
void BuildShaderList(){
int count;
int count, i;
char filename[1024];
char *pBuff;
char dirstring[NAME_MAX];
@ -486,15 +486,18 @@ void BuildShaderList(){
Sys_FPrintf( SYS_ERR, "Couldn't find '%s'\n", g_pGameDescription->mShaderlist.GetBuffer() );
return;
}
for ( i = 0; i < count; i++ )
{
// NOTE TTimo we use vfsGetFullPath solely to get the full path of the shader list we are gonna load
// but we actually send the relative path to vfsLoadFile
// so let's hope there is no disparity between the two functions
if ( !vfsGetFullPath( filename, 0, 0 ) ) {
if ( !vfsGetFullPath( filename, i, 0 ) ) {
Sys_FPrintf( SYS_ERR, "Couldn't find full path for '%s'\n", g_pGameDescription->mShaderlist.GetBuffer() );
return;
}
Sys_Printf( "Parsing shader files from %s\n", vfsGetFullPath( filename, 0, 0 ) );
nLen = vfsLoadFile( filename, reinterpret_cast<void**>( &pBuff ), 0 );
Sys_Printf( "Parsing shader files from %s\n", vfsGetFullPath( filename, i, 0 ) );
nLen = vfsLoadFile( filename, reinterpret_cast<void**>( &pBuff ), i );
if ( nLen > 0 ) {
StartTokenParsing( pBuff );
nLen = 0;
@ -524,6 +527,7 @@ void BuildShaderList(){
}
}
}
}
/*
==================
@ -1088,7 +1092,7 @@ void Texture_ShowStartupShaders(){
}
if ( g_PrefsDlg.m_nShader == PrefsDlg::SHADER_ALL ) {
int count;
int count, i;
char filename[1024];
char *pBuff;
char dirstring[NAME_MAX];
@ -1107,8 +1111,10 @@ void Texture_ShowStartupShaders(){
return;
}
Sys_Printf( "Parsing shader files from %s\n", vfsGetFullPath( filename, 0, 0 ) );
nLen = vfsLoadFile( filename, reinterpret_cast<void**>( &pBuff ), 0 );
for ( i = 0; i < count; i++ )
{
Sys_Printf( "Parsing shader files from %s\n", vfsGetFullPath( filename, i, 0 ) );
nLen = vfsLoadFile( filename, reinterpret_cast<void**>( &pBuff ), i );
if ( nLen > 0 ) {
StartTokenParsing( pBuff );
nLen = 0;
@ -1140,6 +1146,7 @@ void Texture_ShowStartupShaders(){
}
}
}
}
/*
============================================================================