mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 12:30:46 +00:00
- used the newly added game ID as reference for GAMEINFO to autoselect which game to start a mod with.
While in GZDoom this uses the IWAD name, the same approach is a lot more problematic here because of name duplications with far more incompatible content. So this allows targeting a group of base games instead of one specific version.
This commit is contained in:
parent
6ad3ac8ef9
commit
4fe3c50c7c
3 changed files with 26 additions and 14 deletions
|
@ -123,7 +123,7 @@ FMemArena dump; // this is for memory blocks than cannot be deallocated without
|
||||||
|
|
||||||
InputState inputState;
|
InputState inputState;
|
||||||
int ShowStartupWindow(TArray<GrpEntry> &);
|
int ShowStartupWindow(TArray<GrpEntry> &);
|
||||||
FString GetGameFronUserFiles();
|
TArray<FString> GetGameFronUserFiles();
|
||||||
void InitFileSystem(TArray<GrpEntry>&);
|
void InitFileSystem(TArray<GrpEntry>&);
|
||||||
void I_SetWindowTitle(const char* caption);
|
void I_SetWindowTitle(const char* caption);
|
||||||
void S_ParseSndInfo();
|
void S_ParseSndInfo();
|
||||||
|
@ -643,14 +643,25 @@ static TArray<GrpEntry> SetupGame()
|
||||||
|
|
||||||
int groupno = -1;
|
int groupno = -1;
|
||||||
|
|
||||||
// If the user has specified a file name, let's see if we know it.
|
auto game = GetGameFronUserFiles();
|
||||||
//
|
|
||||||
FString game = GetGameFronUserFiles();
|
|
||||||
if (userConfig.gamegrp.IsEmpty())
|
if (userConfig.gamegrp.IsEmpty())
|
||||||
{
|
{
|
||||||
userConfig.gamegrp = game;
|
for (auto& str : game)
|
||||||
|
{
|
||||||
|
for (auto& grp : groups)
|
||||||
|
{
|
||||||
|
if (grp.FileInfo.gameid.CompareNoCase(str) == 0)
|
||||||
|
{
|
||||||
|
userConfig.gamegrp = grp.FileName;
|
||||||
|
goto foundit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
foundit:
|
||||||
|
|
||||||
|
// If the user has specified a file name, let's see if we know it.
|
||||||
|
//
|
||||||
if (userConfig.gamegrp.Len())
|
if (userConfig.gamegrp.Len())
|
||||||
{
|
{
|
||||||
FString gamegrplower = "/" + userConfig.gamegrp.MakeLower();
|
FString gamegrplower = "/" + userConfig.gamegrp.MakeLower();
|
||||||
|
|
|
@ -139,6 +139,7 @@ struct GrpInfo
|
||||||
FString defname;
|
FString defname;
|
||||||
FString rtsname;
|
FString rtsname;
|
||||||
FString gamefilter;
|
FString gamefilter;
|
||||||
|
FString gameid;
|
||||||
uint32_t CRC = 0;
|
uint32_t CRC = 0;
|
||||||
uint32_t dependencyCRC = 0;
|
uint32_t dependencyCRC = 0;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
|
|
|
@ -60,10 +60,10 @@ static const char* validexts[] = { "*.grp", "*.zip", "*.pk3", "*.pk4", "*.7z", "
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
static FString ParseGameInfo(TArray<FString>& pwads, const char* fn, const char* data, int size)
|
static TArray<FString> ParseGameInfo(TArray<FString>& pwads, const char* fn, const char* data, int size)
|
||||||
{
|
{
|
||||||
FScanner sc;
|
FScanner sc;
|
||||||
FString iwad;
|
TArray<FString> bases;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
const char* lastSlash = strrchr(fn, '/');
|
const char* lastSlash = strrchr(fn, '/');
|
||||||
|
@ -78,7 +78,7 @@ static FString ParseGameInfo(TArray<FString>& pwads, const char* fn, const char*
|
||||||
if (!nextKey.CompareNoCase("GAME"))
|
if (!nextKey.CompareNoCase("GAME"))
|
||||||
{
|
{
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
iwad = sc.String;
|
bases.Push(sc.String);
|
||||||
}
|
}
|
||||||
else if (!nextKey.CompareNoCase("LOAD"))
|
else if (!nextKey.CompareNoCase("LOAD"))
|
||||||
{
|
{
|
||||||
|
@ -136,7 +136,7 @@ static FString ParseGameInfo(TArray<FString>& pwads, const char* fn, const char*
|
||||||
} while (sc.CheckToken(','));
|
} while (sc.CheckToken(','));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return iwad;
|
return bases;
|
||||||
}
|
}
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
|
@ -144,7 +144,7 @@ static FString ParseGameInfo(TArray<FString>& pwads, const char* fn, const char*
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
static FString CheckGameInfo(TArray<FString>& pwads)
|
static TArray<FString> CheckGameInfo(TArray<FString>& pwads)
|
||||||
{
|
{
|
||||||
// scan the list of WADs backwards to find the last one that contains a GAMEINFO lump
|
// scan the list of WADs backwards to find the last one that contains a GAMEINFO lump
|
||||||
for (int i = pwads.Size() - 1; i >= 0; i--)
|
for (int i = pwads.Size() - 1; i >= 0; i--)
|
||||||
|
@ -184,15 +184,15 @@ static FString CheckGameInfo(TArray<FString>& pwads)
|
||||||
if (FName(lmp->getName(), true) == gameinfo)
|
if (FName(lmp->getName(), true) == gameinfo)
|
||||||
{
|
{
|
||||||
// Found one!
|
// Found one!
|
||||||
FString iwad = ParseGameInfo(pwads, resfile->FileName, (const char*)lmp->Lock(), lmp->LumpSize);
|
auto bases = ParseGameInfo(pwads, resfile->FileName, (const char*)lmp->Lock(), lmp->LumpSize);
|
||||||
delete resfile;
|
delete resfile;
|
||||||
return iwad;
|
return bases;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete resfile;
|
delete resfile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
return TArray<FString>();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -201,7 +201,7 @@ static FString CheckGameInfo(TArray<FString>& pwads)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
FString GetGameFronUserFiles()
|
TArray<FString> GetGameFronUserFiles()
|
||||||
{
|
{
|
||||||
TArray<FString> Files;
|
TArray<FString> Files;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue