mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-03-10 10:31:40 +00:00
- added autodetection for Cryptic Passage and Route 66 add-ons in their originally (messed up) form.
Cryptic Passage will also be detected in a Fresh Supply installation now.
This commit is contained in:
parent
ca593f7dda
commit
5d55f768e0
4 changed files with 46 additions and 11 deletions
|
@ -127,6 +127,7 @@ struct GrpInfo
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
bool loaddirectory = false;
|
bool loaddirectory = false;
|
||||||
|
bool isAddon = false;
|
||||||
TArray<FString> mustcontain;
|
TArray<FString> mustcontain;
|
||||||
TArray<FString> tobedeleted;
|
TArray<FString> tobedeleted;
|
||||||
TArray<FString> loadfiles;
|
TArray<FString> loadfiles;
|
||||||
|
|
|
@ -486,19 +486,20 @@ void InitFileSystem(TArray<GrpEntry>& groups)
|
||||||
bool insertdirectoriesafter = Args->CheckParm("-insertdirafter");
|
bool insertdirectoriesafter = Args->CheckParm("-insertdirafter");
|
||||||
|
|
||||||
int i = groups.Size()-1;
|
int i = groups.Size()-1;
|
||||||
|
FString fn;
|
||||||
for (auto &grp : groups)
|
for (auto &grp : groups)
|
||||||
{
|
{
|
||||||
// Add all dependencies, plus the directory of the base dependency.
|
// Add all dependencies, plus the directory of the base dependency.
|
||||||
// Directories of addon content are not added if they differ from the main directory.
|
// Directories of addon content are not added if they differ from the main directory.
|
||||||
// Also, the directory is inserted after the base dependency, allowing the addons to override directory content.
|
// Also, the directory is inserted after the base dependency, allowing the addons to override directory content.
|
||||||
// This can be overridden via command line switch if needed.
|
// This can be overridden via command line switch if needed.
|
||||||
if (!grp.FileInfo.loaddirectory)
|
if (!grp.FileInfo.loaddirectory && grp.FileName.IsNotEmpty())
|
||||||
|
{
|
||||||
D_AddFile(Files, grp.FileName);
|
D_AddFile(Files, grp.FileName);
|
||||||
|
fn = ExtractFilePath(grp.FileName);
|
||||||
|
if (fn.Len() > 0 && fn.Back() != '/') fn += '/';
|
||||||
|
}
|
||||||
|
|
||||||
auto fn = grp.FileName;
|
|
||||||
fn.Substitute("\\", "/");
|
|
||||||
auto index = fn.LastIndexOf("/");
|
|
||||||
fn.Truncate(index+1); // right after the last slash.
|
|
||||||
for (auto& fname : grp.FileInfo.loadfiles)
|
for (auto& fname : grp.FileInfo.loadfiles)
|
||||||
{
|
{
|
||||||
FString newname = fn + fname;
|
FString newname = fn + fname;
|
||||||
|
|
|
@ -403,10 +403,11 @@ static TArray<GrpInfo> ParseGrpInfo(const char *fn, FileReader &fr, TMap<FString
|
||||||
CRCMap.Insert(key, (uint32_t)sc.BigNumber);
|
CRCMap.Insert(key, (uint32_t)sc.BigNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (sc.Compare("grpinfo"))
|
else if (sc.Compare("grpinfo") || sc.Compare("addon"))
|
||||||
{
|
{
|
||||||
groups.Reserve(1);
|
groups.Reserve(1);
|
||||||
auto& grp = groups.Last();
|
auto& grp = groups.Last();
|
||||||
|
grp.isAddon = sc.Compare("addon");
|
||||||
sc.MustGetToken('{');
|
sc.MustGetToken('{');
|
||||||
while (!sc.CheckToken('}'))
|
while (!sc.CheckToken('}'))
|
||||||
{
|
{
|
||||||
|
@ -645,6 +646,25 @@ GrpInfo *IdentifyGroup(FileEntry *entry, TArray<GrpInfo *> &groups)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
|
static bool CheckAddon(GrpInfo* addon, GrpInfo* main, const char* filename)
|
||||||
|
{
|
||||||
|
if (addon->dependencyCRC != main->CRC) return false;
|
||||||
|
FString path = ExtractFilePath(filename);
|
||||||
|
if (path.Len() > 0 && path.Back() != '/') path += '/';
|
||||||
|
for (auto& fn : addon->mustcontain)
|
||||||
|
{
|
||||||
|
FString check = path + fn;
|
||||||
|
if (!FileExists(check)) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
TArray<GrpEntry> GrpScan()
|
TArray<GrpEntry> GrpScan()
|
||||||
{
|
{
|
||||||
TArray<GrpEntry> foundGames;
|
TArray<GrpEntry> foundGames;
|
||||||
|
@ -652,6 +672,7 @@ TArray<GrpEntry> GrpScan()
|
||||||
TArray<FileEntry*> sortedFileList;
|
TArray<FileEntry*> sortedFileList;
|
||||||
TArray<GrpInfo*> sortedGroupList;
|
TArray<GrpInfo*> sortedGroupList;
|
||||||
TArray<GrpInfo*> contentGroupList;
|
TArray<GrpInfo*> contentGroupList;
|
||||||
|
TArray<GrpInfo*> addonList;
|
||||||
|
|
||||||
auto allFiles = CollectAllFilesInSearchPath();
|
auto allFiles = CollectAllFilesInSearchPath();
|
||||||
auto allGroups = ParseAllGrpInfos(allFiles);
|
auto allGroups = ParseAllGrpInfos(allFiles);
|
||||||
|
@ -667,7 +688,9 @@ TArray<GrpEntry> GrpScan()
|
||||||
for (auto& f : allFiles) sortedFileList.Push(&f);
|
for (auto& f : allFiles) sortedFileList.Push(&f);
|
||||||
for (auto& g : allGroups)
|
for (auto& g : allGroups)
|
||||||
{
|
{
|
||||||
if (g.CRC == 0 && g.mustcontain.Size() > 0)
|
if (g.isAddon)
|
||||||
|
addonList.Push(&g);
|
||||||
|
else if (g.CRC == 0 && g.mustcontain.Size() > 0)
|
||||||
contentGroupList.Push(&g);
|
contentGroupList.Push(&g);
|
||||||
else
|
else
|
||||||
sortedGroupList.Push(&g);
|
sortedGroupList.Push(&g);
|
||||||
|
@ -761,6 +784,16 @@ TArray<GrpEntry> GrpScan()
|
||||||
fg.FileInfo = *grp;
|
fg.FileInfo = *grp;
|
||||||
fg.FileName = entry->FileName;
|
fg.FileName = entry->FileName;
|
||||||
fg.FileIndex = entry->Index;
|
fg.FileIndex = entry->Index;
|
||||||
|
for (auto addon : addonList)
|
||||||
|
{
|
||||||
|
if (CheckAddon(addon, grp, entry->FileName))
|
||||||
|
{
|
||||||
|
foundGames.Reserve(1);
|
||||||
|
auto& fga = foundGames.Last();
|
||||||
|
fga.FileInfo = *addon;
|
||||||
|
fga.FileIndex = entry->Index;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -875,8 +908,8 @@ const char* G_DefaultConFile(void)
|
||||||
if (fileSystem.FindFile("ww2gi.con") >= 0) return "ww2gi.con";
|
if (fileSystem.FindFile("ww2gi.con") >= 0) return "ww2gi.con";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_gameType & GAMEFLAG_SW)
|
if (g_gameType & (GAMEFLAG_SW|GAMEFLAG_PSEXHUMED))
|
||||||
return nullptr; // SW has no scripts of any kind.
|
return nullptr; // Exhumed and SW have no scripts of any kind.
|
||||||
|
|
||||||
if (g_gameType & GAMEFLAG_NAM)
|
if (g_gameType & GAMEFLAG_NAM)
|
||||||
{
|
{
|
||||||
|
|
|
@ -419,7 +419,7 @@ addon
|
||||||
name "BLOOD: Cryptic Passage"
|
name "BLOOD: Cryptic Passage"
|
||||||
scriptname "CRYPTIC.INI"
|
scriptname "CRYPTIC.INI"
|
||||||
mustcontain "cryptic/CRYPTIC.INI", "cryptic/CP01.MAP", "cryptic/CP02.MAP"
|
mustcontain "cryptic/CRYPTIC.INI", "cryptic/CP01.MAP", "cryptic/CP02.MAP"
|
||||||
addresource "cryptic"
|
loadgrp "cryptic"
|
||||||
flags GAMEFLAG_BLOOD|GAMEFLAG_ADDON
|
flags GAMEFLAG_BLOOD|GAMEFLAG_ADDON
|
||||||
dependency BLOOD_CRC
|
dependency BLOOD_CRC
|
||||||
loadart "CPART07.AR_", "CPART15.AR_"
|
loadart "CPART07.AR_", "CPART15.AR_"
|
||||||
|
@ -432,7 +432,7 @@ addon
|
||||||
name "BLOOD: Cryptic Passage"
|
name "BLOOD: Cryptic Passage"
|
||||||
scriptname "CRYPTIC.INI"
|
scriptname "CRYPTIC.INI"
|
||||||
mustcontain "addons/Cryptic Passage/CRYPTIC.INI", "addons/Cryptic Passage/CP01.MAP", "addons/Cryptic Passage/CP02.MAP"
|
mustcontain "addons/Cryptic Passage/CRYPTIC.INI", "addons/Cryptic Passage/CP01.MAP", "addons/Cryptic Passage/CP02.MAP"
|
||||||
addresource "addons/Cryptic Passage"
|
loadgrp "addons/Cryptic Passage"
|
||||||
flags GAMEFLAG_BLOOD|GAMEFLAG_ADDON
|
flags GAMEFLAG_BLOOD|GAMEFLAG_ADDON
|
||||||
dependency BLOOD_CRC
|
dependency BLOOD_CRC
|
||||||
gamefilter "Blood.Cryptic"
|
gamefilter "Blood.Cryptic"
|
||||||
|
|
Loading…
Reference in a new issue