From f4b27bbd27b0f424c92278f56c0469c47125930e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 12 Mar 2021 23:45:03 +0100 Subject: [PATCH] - sort the game selection list by definition order in grpinfo.txt. This is to have consistent ordering, independent of where the files are found. Game order is: Duke, Blood, Shadow Warrior, Redneck Rampage, Nam, WW2GI, Exhumed, all the official mission packs are grouped below the game they belong to. --- source/core/gamecontrol.h | 2 +- source/core/searchpaths.cpp | 8 +- wadsrc/static/engine/grpinfo.txt | 177 +++++++++++++++---------------- 3 files changed, 92 insertions(+), 95 deletions(-) diff --git a/source/core/gamecontrol.h b/source/core/gamecontrol.h index 7c5331900..66ae96da2 100644 --- a/source/core/gamecontrol.h +++ b/source/core/gamecontrol.h @@ -143,6 +143,7 @@ struct GrpInfo int flags = 0; bool loaddirectory = false; bool isAddon = false; + int index = -1; TArray mustcontain; TArray tobedeleted; TArray loadfiles; @@ -154,7 +155,6 @@ struct GrpEntry { FString FileName; GrpInfo FileInfo; - uint32_t FileIndex; }; extern int g_gameType; const char* G_DefaultDefFile(void); diff --git a/source/core/searchpaths.cpp b/source/core/searchpaths.cpp index 60d73b7ae..ca679c51f 100644 --- a/source/core/searchpaths.cpp +++ b/source/core/searchpaths.cpp @@ -709,6 +709,9 @@ TArray GrpScan() auto cachedCRCs = LoadCRCCache(); auto numCRCs = cachedCRCs.Size(); + for (unsigned i = 0; i < allGroups.Size(); i++) + allGroups[i].index = i; + // Remove all unnecessary content from the file list. Since this contains all data from the search path's directories it can be quite large. // Sort both lists by file size so that we only need to pass over each list once to weed out all unrelated content. Go backward to avoid too much item movement // (most will be deleted anyway.) @@ -756,7 +759,6 @@ TArray GrpScan() auto& fg = foundGames.Last(); fg.FileInfo = *grp; fg.FileName = fe->FileName; - fg.FileIndex = fe->Index; break; } } @@ -812,7 +814,6 @@ TArray GrpScan() auto& fg = foundGames.Last(); fg.FileInfo = *grp; fg.FileName = entry->FileName; - fg.FileIndex = entry->Index; for (auto addon : addonList) { if (CheckAddon(addon, grp, entry->FileName)) @@ -820,7 +821,6 @@ TArray GrpScan() foundGames.Reserve(1); auto& fga = foundGames.Last(); fga.FileInfo = *addon; - fga.FileIndex = entry->Index; } } } @@ -850,7 +850,7 @@ TArray GrpScan() { auto A = (const GrpEntry*)a; auto B = (const GrpEntry*)b; - return (int)A->FileIndex - (int)B->FileIndex; + return (int)A->FileInfo.index - (int)B->FileInfo.index; }); // Finally, scan the list for duplicstes. Only the first occurence should count. diff --git a/wadsrc/static/engine/grpinfo.txt b/wadsrc/static/engine/grpinfo.txt index 1703a0fac..0643099d6 100644 --- a/wadsrc/static/engine/grpinfo.txt +++ b/wadsrc/static/engine/grpinfo.txt @@ -286,95 +286,6 @@ grpinfo gamefilter "Duke.Zone" } -grpinfo -{ - name "NAM" - size 43448927 - crc NAM_CRC - flags GAMEFLAG_NAM - dependency 0 - gamefilter "Nam.Nam" -} - -grpinfo -{ - name "NAPALM" - size 44365728 - crc NAPALM_CRC - flags GAMEFLAG_NAM|GAMEFLAG_NAPALM - dependency 0 - gamefilter "Nam.Napalm" -} - -grpinfo -{ - name "WWII GI" - size 77939508 - crc WW2GI_CRC - flags GAMEFLAG_WW2GI - dependency 0 - gamefilter "WW2GI.WW2GI" -} - -grpinfo -{ - name "Platoon Leader" - scriptname "PLATOONL.DEF" - size 37852572 - crc PLATOONL_CRC - flags GAMEFLAG_WW2GI|GAMEFLAG_ADDON - dependency WW2GI_CRC - gamefilter "WW2GI.Platoon" -} - -grpinfo -{ - name "Redneck Rampage" - size 141174222 - crc RR_CRC - defname "rr.def" - flags GAMEFLAG_RR - dependency 0 - gamefilter "Redneck.Redneck" -} - -grpinfo -{ - name "Redneck Rampage Rides Again" - size 191798609 - crc RRRA_CRC - defname "rrra.def" - flags GAMEFLAG_RRRA - dependency 0 - gamefilter "Redneck.RidesAgain" -} - -grpinfo -{ - // This is for detecting zipped versions of the mod. - name "Redneck Rampage: Suckin' Grits on Route 66" - scriptname "GAME66.CON" - mustcontain "TILESA66.ART", "TILESB66.ART", "ROUTE66/CARNIVAL.MAP", "ROUTE66/TRUCKSTP.MAP", "GAME66.CON" - flags GAMEFLAG_RR|GAMEFLAG_ADDON - dependency RR_CRC - loadart "TILESA66.ART", "TILESB66.ART" // replaces TILES009 and TILES023. - gamefilter "Redneck.Route66" - deletecontent "turd66.anm*turdmov.anm", "turd66.voc*turdmov.voc", "end66.anm*rr_outro.anm", "end66.voc*rr_outro.voc" // This renames instead of deleting -} - -addon -{ - // this is for detecting the files within the game directory. - name "Redneck Rampage: Suckin' Grits on Route 66" - scriptname "GAME66.CON" - mustcontain "TILESA66.ART", "TILESB66.ART", "ROUTE66/CARNIVAL.MAP", "ROUTE66/TRUCKSTP.MAP", "GAME66.CON" - flags GAMEFLAG_RR|GAMEFLAG_ADDON - dependency RR_CRC - loadart "TILESA66.ART", "TILESB66.ART" // replaces TILES009 and TILES023. - gamefilter "Redneck.Route66" - deletecontent "turd66.anm*turdmov.anm", "turd66.voc*turdmov.voc", "end66.anm*rr_outro.anm", "end66.voc*rr_outro.voc" // This renames instead of deleting -} - grpinfo { name "Blood 1.0" @@ -639,8 +550,94 @@ grpinfo gamefilter "ShadowWarrior.TwinDragon" } +grpinfo +{ + name "Redneck Rampage" + size 141174222 + crc RR_CRC + defname "rr.def" + flags GAMEFLAG_RR + dependency 0 + gamefilter "Redneck.Redneck" +} - +grpinfo +{ + name "Redneck Rampage Rides Again" + size 191798609 + crc RRRA_CRC + defname "rrra.def" + flags GAMEFLAG_RRRA + dependency 0 + gamefilter "Redneck.RidesAgain" +} + +grpinfo +{ + // This is for detecting zipped versions of the mod. + name "Redneck Rampage: Suckin' Grits on Route 66" + scriptname "GAME66.CON" + mustcontain "TILESA66.ART", "TILESB66.ART", "ROUTE66/CARNIVAL.MAP", "ROUTE66/TRUCKSTP.MAP", "GAME66.CON" + flags GAMEFLAG_RR|GAMEFLAG_ADDON + dependency RR_CRC + loadart "TILESA66.ART", "TILESB66.ART" // replaces TILES009 and TILES023. + gamefilter "Redneck.Route66" + deletecontent "turd66.anm*turdmov.anm", "turd66.voc*turdmov.voc", "end66.anm*rr_outro.anm", "end66.voc*rr_outro.voc" // This renames instead of deleting +} + +addon +{ + // this is for detecting the files within the game directory. + name "Redneck Rampage: Suckin' Grits on Route 66" + scriptname "GAME66.CON" + mustcontain "TILESA66.ART", "TILESB66.ART", "ROUTE66/CARNIVAL.MAP", "ROUTE66/TRUCKSTP.MAP", "GAME66.CON" + flags GAMEFLAG_RR|GAMEFLAG_ADDON + dependency RR_CRC + loadart "TILESA66.ART", "TILESB66.ART" // replaces TILES009 and TILES023. + gamefilter "Redneck.Route66" + deletecontent "turd66.anm*turdmov.anm", "turd66.voc*turdmov.voc", "end66.anm*rr_outro.anm", "end66.voc*rr_outro.voc" // This renames instead of deleting +} + +grpinfo +{ + name "NAM" + size 43448927 + crc NAM_CRC + flags GAMEFLAG_NAM + dependency 0 + gamefilter "Nam.Nam" +} + +grpinfo +{ + name "NAPALM" + size 44365728 + crc NAPALM_CRC + flags GAMEFLAG_NAM|GAMEFLAG_NAPALM + dependency 0 + gamefilter "Nam.Napalm" +} + +grpinfo +{ + name "WWII GI" + size 77939508 + crc WW2GI_CRC + flags GAMEFLAG_WW2GI + dependency 0 + gamefilter "WW2GI.WW2GI" +} + +grpinfo +{ + name "Platoon Leader" + scriptname "PLATOONL.DEF" + size 37852572 + crc PLATOONL_CRC + flags GAMEFLAG_WW2GI|GAMEFLAG_ADDON + dependency WW2GI_CRC + gamefilter "WW2GI.Platoon" +} grpinfo {