From 258822ef3bab753113eec96c6196f0fd2dc69a7b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 6 Apr 2015 11:57:12 +0200 Subject: [PATCH] - redid autoload handler and resource file filtering to use the newly defined method with multi-part names. As a result the old 'Group' property could be removed and all other means to get a section name were disabled. As an example, if the code gets 'doom.doom2.commercial' it will use the following sections in this order: global.autoload doom.autoload doom.doom2.autoload doom.doom2.commercial.autoload. --- src/d_iwad.cpp | 6 ------ src/d_main.cpp | 28 ++++++++-------------------- src/d_main.h | 1 - src/doomstat.cpp | 2 +- src/doomstat.h | 2 +- src/gameconfigfile.cpp | 5 ++--- src/resourcefiles/resourcefile.cpp | 13 ++++++++++--- 7 files changed, 22 insertions(+), 35 deletions(-) diff --git a/src/d_iwad.cpp b/src/d_iwad.cpp index 4a46a93cd..e09baa26d 100644 --- a/src/d_iwad.cpp +++ b/src/d_iwad.cpp @@ -138,12 +138,6 @@ void FIWadManager::ParseIWadInfo(const char *fn, const char *data, int datasize) sc.MustGetString(); iwad->Autoname = sc.String; } - else if (sc.Compare("Group")) - { - sc.MustGetStringName("="); - sc.MustGetString(); - iwad->Group = sc.String; - } else if (sc.Compare("Config")) { sc.MustGetStringName("="); diff --git a/src/d_main.cpp b/src/d_main.cpp index 5dc5c7a78..78d12e651 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -1990,10 +1990,9 @@ static void D_DoomInit() // //========================================================================== -static void AddAutoloadFiles(const char *group, const char *autoname) +static void AddAutoloadFiles(const char *autoname) { - LumpFilterGroup = group; - LumpFilterIWAD = autoname; + LumpFilterIWAD.Format("%s.", autoname); // The '.' is appened to simplify parsing the string if (!(gameinfo.flags & GI_SHAREWARE) && !Args->CheckParm("-noautoload")) { @@ -2025,25 +2024,14 @@ static void AddAutoloadFiles(const char *group, const char *autoname) // Add common (global) wads D_AddConfigWads (allwads, "Global.Autoload"); - // Add game-specific wads - file = gameinfo.ConfigName; - file += ".Autoload"; - D_AddConfigWads (allwads, file); + long len; + int lastpos = -1; - // Add group-specific wads - if (group != NULL && group[0] != 0) - { - file = group; - file += ".Autoload"; - D_AddConfigWads(allwads, file); - } - - // Add IWAD-specific wads - if (autoname != NULL && autoname[0] != 0) + while ((len = LumpFilterIWAD.IndexOf('.', lastpos+1)) > 0) { - file = autoname; - file += ".Autoload"; + file = LumpFilterIWAD.Left(len) + ".Autoload"; D_AddConfigWads(allwads, file); + lastpos = len; } } } @@ -2294,7 +2282,7 @@ void D_DoomMain (void) FBaseCVar::DisableCallbacks(); GameConfig->DoGameSetup (gameinfo.ConfigName); - AddAutoloadFiles(iwad_info->Group, iwad_info->Autoname); + AddAutoloadFiles(iwad_info->Autoname); // Run automatically executed files execFiles = new DArgs; diff --git a/src/d_main.h b/src/d_main.h index dd2ffc409..e4641c41d 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -75,7 +75,6 @@ struct FIWADInfo { FString Name; // Title banner text for this IWAD FString Autoname; // Name of autoload ini section for this IWAD - FString Group; // Groupname for this IWAD FString Configname; // Name of config section for this IWAD FString Required; // Requires another IWAD DWORD FgColor; // Foreground color for title banner diff --git a/src/doomstat.cpp b/src/doomstat.cpp index 697ef3afe..2ec72db9d 100644 --- a/src/doomstat.cpp +++ b/src/doomstat.cpp @@ -69,4 +69,4 @@ int SinglePlayerClass[MAXPLAYERS]; bool ToggleFullscreen; int BorderTopRefresh; -FString LumpFilterGroup, LumpFilterIWAD; +FString LumpFilterIWAD; diff --git a/src/doomstat.h b/src/doomstat.h index d7f3796ac..835ef73fb 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -251,6 +251,6 @@ EXTERN_CVAR (Int, compatflags2); extern int i_compatflags, i_compatflags2, ii_compatflags, ii_compatflags2, ib_compatflags; // Filters from AddAutoloadFiles(). Used to filter files from archives. -extern FString LumpFilterGroup, LumpFilterIWAD; +extern FString LumpFilterIWAD; #endif diff --git a/src/gameconfigfile.cpp b/src/gameconfigfile.cpp index 9121e79d6..e17a3e127 100644 --- a/src/gameconfigfile.cpp +++ b/src/gameconfigfile.cpp @@ -163,6 +163,7 @@ FGameConfigFile::FGameConfigFile () // Create auto-load sections, so users know what's available. // Note that this totem pole is the reverse of the order that // they will appear in the file. +#if 0 CreateSectionAtStart("Harmony.Autoload"); CreateSectionAtStart("UrbanBrawl.Autoload"); CreateSectionAtStart("Chex3.Autoload"); @@ -185,6 +186,7 @@ FGameConfigFile::FGameConfigFile () CreateSectionAtStart("DoomU.Autoload"); CreateSectionAtStart("Doom1.Autoload"); CreateSectionAtStart("Doom.Autoload"); +#endif CreateSectionAtStart("Global.Autoload"); // The same goes for auto-exec files. @@ -336,9 +338,6 @@ void FGameConfigFile::DoGlobalSetup () } if (last < 211) { - //RenameSection("Hacx2.Autoload", "hacx.2_0.Autoload"); - //RenameSection("Hacx12.Autoload", "hacx.1_2.Autoload"); - //RenameSection("Hexen1.Autoload", "hexen.hexen.Autoload"); RenameSection("Chex3.Autoload", "chex.3.Autoload"); RenameSection("Chex1.Autoload", "chex.1.Autoload"); RenameSection("HexenDK.Autoload", "hexen.deathkings.Autoload"); diff --git a/src/resourcefiles/resourcefile.cpp b/src/resourcefiles/resourcefile.cpp index d5ad659af..e5c12b0ef 100644 --- a/src/resourcefiles/resourcefile.cpp +++ b/src/resourcefiles/resourcefile.cpp @@ -345,9 +345,16 @@ void FResourceFile::PostProcessArchive(void *lumps, size_t lumpsize) // each one so that we don't risk refiltering already filtered lumps. DWORD max = NumLumps; max -= FilterLumpsByGameType(gameinfo.gametype, lumps, lumpsize, max); - max -= FilterLumps(gameinfo.ConfigName, lumps, lumpsize, max); - max -= FilterLumps(LumpFilterGroup, lumps, lumpsize, max); - max -= FilterLumps(LumpFilterIWAD, lumps, lumpsize, max); + + long len; + int lastpos = -1; + FString file; + + while ((len = LumpFilterIWAD.IndexOf('.', lastpos+1)) > 0) + { + max -= FilterLumps(LumpFilterIWAD.Left(len), lumps, lumpsize, max); + lastpos = len; + } JunkLeftoverFilters(lumps, lumpsize, max); }