mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2025-01-25 02:41:22 +00:00
[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:
parent
721da8cdb1
commit
ba300b1751
3 changed files with 20 additions and 9 deletions
|
@ -83,6 +83,9 @@ static char g_strDirs[VFS_MAXDIRS][PATH_MAX];
|
||||||
static int g_numDirs;
|
static int g_numDirs;
|
||||||
static bool g_bUsePak = true;
|
static bool g_bUsePak = true;
|
||||||
|
|
||||||
|
// suported pak extension list
|
||||||
|
const char* pak_ext_list[4] = { ".pk3", ".pk4", ".dpk", NULL };
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// Static functions
|
// Static functions
|
||||||
|
|
||||||
|
@ -368,7 +371,6 @@ static int vfsPakSort( const void *a, const void *b ){
|
||||||
*/
|
*/
|
||||||
void vfsInitDirectory( const char *path ){
|
void vfsInitDirectory( const char *path ){
|
||||||
char filename[PATH_MAX];
|
char filename[PATH_MAX];
|
||||||
const char* pak_ext = ".pk3";
|
|
||||||
const char* pakdir_suf = "dir";
|
const char* pakdir_suf = "dir";
|
||||||
GDir *dir;
|
GDir *dir;
|
||||||
GSList *dirlist = NULL;
|
GSList *dirlist = NULL;
|
||||||
|
@ -421,13 +423,15 @@ void vfsInitDirectory( const char *path ){
|
||||||
|
|
||||||
gboolean is_pak = FALSE;
|
gboolean is_pak = FALSE;
|
||||||
|
|
||||||
const char* cur_ext = pak_ext;
|
for ( int i = 0; pak_ext_list[i] != NULL ; i++ ) {
|
||||||
if ( strcasecmp( ext, cur_ext ) == 0 ) {
|
const char* cur_ext = pak_ext_list[i];
|
||||||
is_pak = TRUE;
|
if ( strcasecmp( ext, cur_ext ) == 0 ) {
|
||||||
}
|
is_pak = TRUE;
|
||||||
cur_ext = g_strconcat(cur_ext, pakdir_suf, NULL);
|
}
|
||||||
if ( strcasecmp( ext, cur_ext ) == 0 ) {
|
cur_ext = g_strconcat(cur_ext, pakdir_suf, NULL);
|
||||||
is_pak = TRUE;
|
if ( strcasecmp( ext, cur_ext ) == 0 ) {
|
||||||
|
is_pak = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !is_pak ) {
|
if ( !is_pak ) {
|
||||||
|
|
|
@ -65,4 +65,7 @@ char* vfsExtractRelativePath( const char *in );
|
||||||
// see ifilesystem.h for more notes
|
// see ifilesystem.h for more notes
|
||||||
char* vfsGetFullPath( const char*, int index = 0, int flag = 0 );
|
char* vfsGetFullPath( const char*, int index = 0, int flag = 0 );
|
||||||
|
|
||||||
|
// suported pak extension list
|
||||||
|
extern const char* pak_ext_list[];
|
||||||
|
|
||||||
#endif // _VFS_H_
|
#endif // _VFS_H_
|
||||||
|
|
|
@ -67,7 +67,11 @@ extern "C" CSynapseClient * SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces( cons
|
||||||
g_pSynapseServer->IncRef();
|
g_pSynapseServer->IncRef();
|
||||||
Set_Syn_Printf( g_pSynapseServer->Get_Syn_Printf() );
|
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 );
|
g_SynapseClient.AddAPI( RADIANT_MAJOR, NULL, sizeof( _QERFuncTable_1 ), SYN_REQUIRE, &g_FuncTable );
|
||||||
|
|
||||||
return &g_SynapseClient;
|
return &g_SynapseClient;
|
||||||
|
|
Loading…
Reference in a new issue