}
}
+// Pak Path
+
+CopiedString g_strPakPath[g_pakPathCount] = { "", "", "", "", "" };
+ModuleObservers g_pakPathObservers[g_pakPathCount];
+std::size_t g_pakpath_unrealised[g_pakPathCount] = { 1, 1, 1, 1, 1 };
+
+void Radiant_attachPakPathObserver( int num, ModuleObserver& observer ){
+ g_pakPathObservers[num].attach( observer );
+}
+
+void Radiant_detachPakPathObserver( int num, ModuleObserver& observer ){
+ g_pakPathObservers[num].detach( observer );
+}
+
+
+void PakPath_Realise( int num ){
+ if ( --g_pakpath_unrealised[num] == 0 ) {
+ g_pakPathObservers[num].realise();
+ }
+}
+
+const char* PakPath_get( int num ){
+ std::string message = "PakPath_get: pak path " + std::to_string(num) + " not realised";
+ ASSERT_MESSAGE( g_pakpath_unrealised[num] == 0, message.c_str() );
+ return g_strPakPath[num].c_str();
+}
+
+void PakPath_Unrealise( int num ){
+ if ( ++g_pakpath_unrealised[num] == 1 ) {
+ g_pakPathObservers[num].unrealise();
+ }
+}
+
+void setPakPath( int num, const char* path ){
+ if (!g_strcmp0( path, "")) {
+ g_strPakPath[num] = "";
+ return;
+ }
+
+ StringOutputStream buffer( 256 );
+ buffer << DirectoryCleaned( path );
+ if ( !path_equal( buffer.c_str(), g_strPakPath[num].c_str() ) ) {
+ std::string message = "Changing Pak Path " + std::to_string(num);
+ ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", message.c_str() );
+
+ PakPath_Unrealise(num);
+
+ g_strPakPath[num] = buffer.c_str();
+
+ PakPath_Realise(num);
+ }
+}
+
// App Path
}
static void Import(CopiedString &self, const char *value) {
- setEnginePath(value);
+ setEnginePath( value );
+}
+};
+
+struct PakPath0 {
+ static void Export( const CopiedString &self, const Callback<void(const char*)> &returnz ) {
+ returnz( self.c_str() );
+ }
+
+ static void Import( CopiedString &self, const char *value ) {
+ setPakPath( 0, value );
}
};
+struct PakPath1 {
+ static void Export( const CopiedString &self, const Callback<void(const char*)> &returnz ) {
+ returnz( self.c_str() );
+ }
+
+ static void Import( CopiedString &self, const char *value ) {
+ setPakPath( 1, value );
+ }
+};
+struct PakPath2 {
+ static void Export( const CopiedString &self, const Callback<void(const char*)> &returnz ) {
+ returnz( self.c_str() );
+ }
+
+ static void Import( CopiedString &self, const char *value ) {
+ setPakPath( 2, value );
+ }
+};
+struct PakPath3 {
+ static void Export( const CopiedString &self, const Callback<void(const char*)> &returnz ) {
+ returnz( self.c_str() );
+ }
+
+ static void Import( CopiedString &self, const char *value ) {
+ setPakPath( 3, value );
+ }
+};
+struct PakPath4 {
+ static void Export( const CopiedString &self, const Callback<void(const char*)> &returnz ) {
+ returnz( self.c_str() );
+ }
+
+ static void Import( CopiedString &self, const char *value ) {
+ setPakPath( 4, value );
+ }
+};
+
+bool g_disableEnginePath = false;
+bool g_disableHomePath = false;
void Paths_constructPreferences( PreferencesPage& page ){
page.appendPathEntry( "Engine Path", true, make_property<EnginePath>(g_strEnginePath) );
+
+ page.appendCheckBox(
+ "", "Do not use Engine Path",
+ g_disableEnginePath
+ );
+
+ page.appendCheckBox(
+ "", "Do not use Home Path",
+ g_disableHomePath
+ );
+
+ for ( int i = 0; i < g_pakPathCount; i++ ) {
+ std::string label = "Pak Path " + std::to_string(i);
+ switch (i) {
+ case 0:
+ page.appendPathEntry( label.c_str(), true, make_property<PakPath0>( g_strPakPath[i] ) );
+ break;
+ case 1:
+ page.appendPathEntry( label.c_str(), true, make_property<PakPath1>( g_strPakPath[i] ) );
+ break;
+ case 2:
+ page.appendPathEntry( label.c_str(), true, make_property<PakPath2>( g_strPakPath[i] ) );
+ break;
+ case 3:
+ page.appendPathEntry( label.c_str(), true, make_property<PakPath3>( g_strPakPath[i] ) );
+ break;
+ case 4:
+ page.appendPathEntry( label.c_str(), true, make_property<PakPath4>( g_strPakPath[i] ) );
+ break;
+ }
+ }
}
void Paths_constructPage( PreferenceGroup& group ){
PreferencesPage page( group.createPage( "Paths", "Path Settings" ) );
gtk_window_set_decorated(window, false);
gtk_window_set_resizable(window, false);
gtk_window_set_modal(window, true);
- gtk_window_set_default_size(window, -1, -1);
- gtk_window_set_position(window, GTK_WIN_POS_CENTER);
+ gtk_window_set_default_size( window, -1, -1 );
+ gtk_window_set_position( window, GTK_WIN_POS_CENTER );
gtk_container_set_border_width(window, 0);
- auto image = new_local_image("splash.png");
+ auto image = new_local_image( "splash.png" );
image.show();
window.add(image);
GlobalPreferenceSystem().registerPreference( "EnginePath", make_property_string( g_strEnginePath ) );
+ GlobalPreferenceSystem().registerPreference( "DisableEnginePath", make_property_string( g_disableEnginePath ) );
+ GlobalPreferenceSystem().registerPreference( "DisableHomePath", make_property_string( g_disableHomePath ) );
+
+ for ( int i = 0; i < g_pakPathCount; i++ ) {
+ std::string label = "PakPath" + std::to_string(i);
+ GlobalPreferenceSystem().registerPreference( label.c_str(), make_property_string( g_strPakPath[i] ) );
+ }
+
g_Layout_viewStyle.useLatched();
g_Layout_enableDetachableMenus.useLatched();
g_Layout_enablePatchToolbar.useLatched();
const char* EnginePath_get();
const char* QERApp_GetGamePath();
+extern bool g_disableEnginePath;
+extern bool g_disableHomePath;
+
+const int g_pakPathCount = 5;
+extern CopiedString g_strPakPath[g_pakPathCount];
+const char* PakPath_get( int num );
+
extern CopiedString g_strAppPath;
const char* AppPath_get();
output.push_string( EnginePath_get() );
output.push_string( "\" -fs_homepath \"" );
output.push_string( g_qeglobals.m_userEnginePath.c_str() );
- output.push_string( "\" -fs_game " );
+ output.push_string( "\"" );
+
+ // extra pakpaths
+ for ( int i = 0; i < g_pakPathCount; i++ ) {
+ if ( g_strcmp0( g_strPakPath[i].c_str(), "") ) {
+ output.push_string( " -fs_pakpath \"" );
+ output.push_string( g_strPakPath[i].c_str() );
+ output.push_string( "\"" );
+ }
+ }
+
+ // extra switches
+ if ( g_disableEnginePath ) {
+ output.push_string( " -fs_nobasepath " );
+ }
+
+ if ( g_disableHomePath ) {
+ output.push_string( " -fs_nohomepath " );
+ }
+
+ output.push_string( " -fs_game " );
output.push_string( gamename_get() );
output.push_string( " -convert -format " );
output.push_string( Brush::m_type == eBrushTypeQuake3BP ? "map_bp" : "map" );
// if we have a mod dir
if ( !string_equal( gamename, basegame ) ) {
// ~/.<gameprefix>/<fs_game>
- if ( userRoot ) {
+ if ( userRoot && !g_disableHomePath ) {
StringOutputStream userGamePath( 256 );
userGamePath << userRoot << gamename << '/';
GlobalFileSystem().initDirectory( userGamePath.c_str() );
}
// <fs_basepath>/<fs_game>
- {
+ if ( !g_disableEnginePath ) {
StringOutputStream globalGamePath( 256 );
globalGamePath << globalRoot << gamename << '/';
GlobalFileSystem().initDirectory( globalGamePath.c_str() );
}
// ~/.<gameprefix>/<fs_main>
- if ( userRoot ) {
+ if ( userRoot && !g_disableHomePath ) {
StringOutputStream userBasePath( 256 );
userBasePath << userRoot << basegame << '/';
GlobalFileSystem().initDirectory( userBasePath.c_str() );
}
// <fs_basepath>/<fs_main>
- {
+ if ( !g_disableEnginePath ) {
StringOutputStream globalBasePath( 256 );
globalBasePath << globalRoot << basegame << '/';
GlobalFileSystem().initDirectory( globalBasePath.c_str() );
}
+
+ // extra pakpaths
+ for ( int i = 0; i < g_pakPathCount; i++ ) {
+ if (g_strcmp0( g_strPakPath[i].c_str(), "")) {
+ GlobalFileSystem().initDirectory( g_strPakPath[i].c_str() );
+ }
+ }
}
int g_numbrushes = 0;
build_set_variable( "MonitorAddress", ( g_WatchBSP_Enabled ) ? "127.0.0.1:39000" : "" );
build_set_variable( "GameName", gamename_get() );
+ StringBuffer ExtraQ3map2Args;
+ // extra pakpaths
+ for ( int i = 0; i < g_pakPathCount; i++ ) {
+ if ( g_strcmp0( g_strPakPath[i].c_str(), "") ) {
+ ExtraQ3map2Args.push_string( " -fs_pakpath \"" );
+ ExtraQ3map2Args.push_string( g_strPakPath[i].c_str() );
+ ExtraQ3map2Args.push_string( "\"" );
+ }
+ }
+
+ // extra switches
+ if ( g_disableEnginePath ) {
+ ExtraQ3map2Args.push_string( " -fs_nobasepath " );
+ }
+
+ if ( g_disableHomePath ) {
+ ExtraQ3map2Args.push_string( " -fs_nohomepath " );
+ }
+
+ build_set_variable( "ExtraQ3map2Args", ExtraQ3map2Args.c_str() );
+
const char* mapname = Map_Name( g_map );
StringOutputStream name( 256 );
name << StringRange( mapname, path_get_filename_base_end( mapname ) ) << ".bsp";
{"-fs_basepath <path>", "Sets the given path as main directory of the game (can be used more than once to look in multiple paths)"},
{"-fs_game <gamename>", "Sets a different game directory name (default for Q3A: baseq3, can be used more than once)"},
{"-fs_homebase <dir>", "Specifies where the user home directory name is on Linux (default for Q3A: .q3a)"},
- {"-fs_pakpath <dir>", "Specify a package directory (can be used more than once to look in multiple paths)"},
+ {"-fs_homepath <path>", "Sets the given path as home directory name"},
+ {"-fs_nobasepath", "Do not load base paths in VFS"},
+ {"-fs_nohomepath", "Do not load home path in VFS"},
+ {"-fs_pakpath <path>", "Specify a package directory (can be used more than once to look in multiple paths)"},
{"-game <gamename>", "Load settings for the given game (default: quake3)"},
{"-subdivisions <F>", "multiplier for patch subdivisions quality"},
{"-threads <N>", "number of threads to use"},
int i, j, k, len, len2;
char temp[ MAX_OS_PATH ];
+ int noBasePath = 0;
+ int noHomePath = 0;
/* note it */
Sys_FPrintf( SYS_VRB, "--- InitPaths ---\n" );
argv[ i ] = NULL;
}
+ /* -fs_nobasepath */
+ else if ( strcmp( argv[ i ], "-fs_nobasepath" ) == 0 ) {
+ noBasePath = 1;
+ argv[ i ] = NULL;
+ }
+
/* -fs_basepath */
else if ( strcmp( argv[ i ], "-fs_basepath" ) == 0 ) {
if ( ++i >= *argc ) {
argv[ i ] = NULL;
}
+ /* -fs_nohomepath */
+ else if ( strcmp( argv[ i ], "-fs_nohomepath" ) == 0 ) {
+ noHomePath = 1;
+ argv[ i ] = NULL;
+ }
+
/* -fs_homebase */
else if ( strcmp( argv[ i ], "-fs_homebase" ) == 0 ) {
if ( ++i >= *argc ) {
AddGamePath( game->gamePath );
/* if there is no base path set, figure it out */
- if ( numBasePaths == 0 ) {
+ if ( numBasePaths == 0 && noBasePath == 0 ) {
/* this is another crappy replacement for SetQdirFromPath() */
len2 = strlen( game->magic );
for ( i = 0; i < *argc && numBasePaths == 0; i++ )
}
}
- /* this only affects unix */
- if ( homeBasePath ) {
- AddHomeBasePath( homeBasePath );
+ if ( noBasePath == 1 ) {
+ numBasePaths = 0;
}
- else{
- AddHomeBasePath( game->homeBasePath );
+
+ if ( noHomePath == 0 ) {
+ /* this only affects unix */
+ if ( homeBasePath ) {
+ AddHomeBasePath( homeBasePath );
+ }
+ else{
+ AddHomeBasePath( game->homeBasePath );
+ }
}
/* initialize vfs paths */