integrated the CRP with the file system

This commit is contained in:
myT 2024-02-20 00:32:58 +01:00
parent b5b16e6033
commit aef3beb203
3 changed files with 41 additions and 1 deletions

View file

@ -228,6 +228,10 @@ static int fs_packFiles; // total number of files in packs
static int fs_checksumFeed;
static char fs_savedGamedir[MAX_OSPATH];
static qbool fs_cnq3folderEnabled;
static qbool fs_cnq3folderWritesEnabled;
typedef union {
FILE* o;
unzFile z;
@ -2362,7 +2366,9 @@ static void FS_AddGameDirectory( const char *path, const char *dir )
}
}
Q_strncpyz( fs_gamedir, dir, sizeof( fs_gamedir ) );
if ( Q_stricmp( dir, "cnq3" ) != 0 ) {
Q_strncpyz( fs_gamedir, dir, sizeof( fs_gamedir ) );
}
// add the directory to the search path
searchpath_t* search = Z_New<searchpath_t>();
@ -2747,6 +2753,10 @@ static void FS_Startup( const char *gameName )
}
}
if ( fs_basepath->string[0] && fs_cnq3folderEnabled ) {
FS_AddGameDirectory( fs_basepath->string, "cnq3" );
}
Com_ReadCDKey(BASEGAME);
if (fs_gamedirvar && fs_gamedirvar->string[0] != 0) {
Com_AppendCDKey( fs_gamedirvar->string );
@ -3318,3 +3328,28 @@ qbool FS_GetPakPath( char *name, int nameSize, int pakChecksum ) {
return qfalse;
}
void FS_EnableCNQ3Folder( qbool enable )
{
if ( enable != fs_cnq3folderEnabled ) {
fs_cnq3folderEnabled = enable;
FS_Restart( fs_checksumFeed );
}
}
void FS_EnableCNQ3FolderWrites( qbool enable )
{
Q_assert( fs_cnq3folderEnabled && enable != fs_cnq3folderWritesEnabled );
if ( !fs_cnq3folderEnabled || enable == fs_cnq3folderWritesEnabled ) {
return;
}
fs_cnq3folderWritesEnabled = enable;
if ( enable ) {
Q_strncpyz( fs_savedGamedir, fs_gamedir, sizeof( fs_savedGamedir ) );
Q_strncpyz( fs_gamedir, "cnq3", sizeof( fs_gamedir ) );
} else {
Q_strncpyz( fs_gamedir, fs_savedGamedir, sizeof( fs_gamedir ) );
}
}

View file

@ -795,6 +795,9 @@ void FS_FilenameCompletion( const char *dir, const char *ext, qbool stripExt,
qbool FS_GetPakPath( char *name, int nameSize, int pakChecksum );
void FS_EnableCNQ3Folder( qbool enable );
void FS_EnableCNQ3FolderWrites( qbool enable );
/*
==============================================================

View file

@ -227,10 +227,12 @@ void R_SelectRenderPipeline()
if(r_pipeline->integer == 0)
{
renderPipeline = grpp;
FS_EnableCNQ3Folder(qfalse);
}
else
{
renderPipeline = crpp;
FS_EnableCNQ3Folder(qtrue);
}
}