[radiant] allow to load pk4/dpk vfs in addition to pk3 vfs

- load also pk4/pk4dir and dpk/dpkdir
- dpk/dpkdir are not versionned yet
This commit is contained in:
Thomas Debesse 2017-08-06 01:52:03 +02:00
parent 721da8cdb1
commit ba300b1751
3 changed files with 20 additions and 9 deletions

View file

@ -83,6 +83,9 @@ static char g_strDirs[VFS_MAXDIRS][PATH_MAX];
static int g_numDirs;
static bool g_bUsePak = true;
// suported pak extension list
const char* pak_ext_list[4] = { ".pk3", ".pk4", ".dpk", NULL };
// =============================================================================
// Static functions
@ -368,7 +371,6 @@ static int vfsPakSort( const void *a, const void *b ){
*/
void vfsInitDirectory( const char *path ){
char filename[PATH_MAX];
const char* pak_ext = ".pk3";
const char* pakdir_suf = "dir";
GDir *dir;
GSList *dirlist = NULL;
@ -421,7 +423,8 @@ void vfsInitDirectory( const char *path ){
gboolean is_pak = FALSE;
const char* cur_ext = pak_ext;
for ( int i = 0; pak_ext_list[i] != NULL ; i++ ) {
const char* cur_ext = pak_ext_list[i];
if ( strcasecmp( ext, cur_ext ) == 0 ) {
is_pak = TRUE;
}
@ -429,6 +432,7 @@ void vfsInitDirectory( const char *path ){
if ( strcasecmp( ext, cur_ext ) == 0 ) {
is_pak = TRUE;
}
}
if ( !is_pak ) {
continue;

View file

@ -65,4 +65,7 @@ char* vfsExtractRelativePath( const char *in );
// see ifilesystem.h for more notes
char* vfsGetFullPath( const char*, int index = 0, int flag = 0 );
// suported pak extension list
extern const char* pak_ext_list[];
#endif // _VFS_H_

View file

@ -67,7 +67,11 @@ extern "C" CSynapseClient * SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces( cons
g_pSynapseServer->IncRef();
Set_Syn_Printf( g_pSynapseServer->Get_Syn_Printf() );
g_SynapseClient.AddAPI( VFS_MAJOR, "pk3", sizeof( _QERFileSystemTable ) );
for ( int i = 0; pak_ext_list[i] != NULL ; i++ ) {
// ".pk3" -> "pk3"
g_SynapseClient.AddAPI( VFS_MAJOR, pak_ext_list[i] + sizeof('.'), sizeof( _QERFileSystemTable ) );
}
g_SynapseClient.AddAPI( RADIANT_MAJOR, NULL, sizeof( _QERFuncTable_1 ), SYN_REQUIRE, &g_FuncTable );
return &g_SynapseClient;