Rip out the Pak folder feature. We organize using pk3dirs anyway

This commit is contained in:
Marco Cawthorne 2021-06-05 15:25:28 +02:00
parent 13aa866ef3
commit 9d6c13a01c
5 changed files with 0 additions and 245 deletions

View file

@ -353,62 +353,6 @@ void paths_init()
g_strGameToolsPath = g_strAppPath;
}
bool check_version_file(const char *filename, const char *version)
{
TextFileInputStream file(filename);
if (!file.failed()) {
char buf[10];
buf[file.read(buf, 9)] = '\0';
// chomp it (the hard way)
int chomp = 0;
while (buf[chomp] >= '0' && buf[chomp] <= '9') {
chomp++;
}
buf[chomp] = '\0';
return string_equal(buf, version);
}
return false;
}
bool check_version()
{
return true;
#if 0
// a safe check to avoid people running broken installations
// (otherwise, they run it, crash it, and blame us for not forcing them hard enough to pay attention while installing)
// make something idiot proof and someone will make better idiots, this may be overkill
// let's leave it disabled in debug mode in any case
// http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=431
if (GDEF_DEBUG) {
return true;
}
// locate and open WorldSpawn_MAJOR and WorldSpawn_MINOR
bool bVerIsGood = true;
{
StringOutputStream ver_file_name(256);
ver_file_name << AppPath_get() << "WorldSpawn_MAJOR";
bVerIsGood = check_version_file(ver_file_name.c_str(), WorldSpawn_MAJOR_VERSION);
}
{
StringOutputStream ver_file_name(256);
ver_file_name << AppPath_get() << "WorldSpawn_MINOR";
bVerIsGood = check_version_file(ver_file_name.c_str(), WorldSpawn_MINOR_VERSION);
}
if (!bVerIsGood) {
StringOutputStream msg(256);
msg
<< "This editor binary (" WorldSpawn_VERSION ") doesn't match what the latest setup has configured in this directory\n"
"Make sure you run the right/latest editor binary you installed\n"
<< AppPath_get();
ui::alert(ui::root, msg.c_str(), "Radiant", ui::alert_type::OK, ui::alert_icon::Default);
}
return bVerIsGood;
#endif
}
void create_global_pid()
{
/*!
@ -611,12 +555,6 @@ int main(int argc, char *argv[])
paths_init();
if (!check_version()) {
return EXIT_FAILURE;
}
create_global_pid();
GlobalPreferences_Init();

View file

@ -331,66 +331,6 @@ void setEnginePath(const char *path)
}
}
// 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
CopiedString g_strAppPath; ///< holds the full path of the executable
@ -428,7 +368,6 @@ const char *SettingsPath_get()
(or other games)
this is one of the main variables that are configured by the game selection on startup
[GameToolsPath]/plugins
[GameToolsPath]/modules
and also q3map, bspc
*/
CopiedString g_strGameToolsPath; ///< this is set by g_GamesDialog
@ -450,66 +389,6 @@ struct EnginePath {
}
};
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;
@ -526,27 +405,6 @@ void Paths_constructPreferences(PreferencesPage &page)
"", "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)
@ -688,12 +546,6 @@ void Radiant_loadModulesFromRoot(const char *directory)
path << directory << g_pluginsDir;
Radiant_loadModules(path.c_str());
}
if (!string_equal(g_pluginsDir, g_modulesDir)) {
StringOutputStream path(256);
path << directory << g_modulesDir;
Radiant_loadModules(path.c_str());
}
}
//! Make COLOR_BRUSHES override worldspawn eclass colour.
@ -3586,11 +3438,6 @@ void MainFrame_Construct()
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_enablePluginToolbar.useLatched();
Layout_registerPreferencesPage();

View file

@ -231,11 +231,6 @@ 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();
@ -247,7 +242,6 @@ const char *SettingsPath_get();
const char *LocalRcPath_get(void);
const char *const g_pluginsDir = "plugins/"; ///< name of plugins directory, always sub-directory of toolspath
const char *const g_modulesDir = "modules/"; ///< name of modules directory, always sub-directory of toolspath
extern CopiedString g_strGameToolsPath;

View file

@ -1649,15 +1649,6 @@ bool Map_ImportFile(const char *filename)
output.push_string(g_qeglobals.m_userEnginePath.c_str());
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 ");

View file

@ -100,13 +100,6 @@ void QE_InitVFS()
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;
@ -166,14 +159,6 @@ void bsp_init()
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) {