mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 04:00:42 +00:00
- added an option to dump the list of discovered games to a JSON file.
This commit is contained in:
parent
7b45144023
commit
72e4220929
1 changed files with 53 additions and 2 deletions
|
@ -818,6 +818,56 @@ void CreateStatusBar()
|
|||
StatusBar = static_cast<DBaseStatusBar*>(stbarclass->CreateNew());
|
||||
}
|
||||
|
||||
|
||||
void GetGames()
|
||||
{
|
||||
auto getgames = Args->CheckValue("-getgames");
|
||||
if (getgames)
|
||||
{
|
||||
try
|
||||
{
|
||||
auto groups = GrpScan();
|
||||
FSerializer arc;
|
||||
if (arc.OpenWriter())
|
||||
{
|
||||
if (arc.BeginArray("games"))
|
||||
{
|
||||
for (auto& entry : groups)
|
||||
{
|
||||
if (arc.BeginObject(nullptr))
|
||||
{
|
||||
arc("filename", entry.FileName)
|
||||
("description", entry.FileInfo.name)
|
||||
("defname", entry.FileInfo.defname)
|
||||
("scriptname", entry.FileInfo.scriptname)
|
||||
("gamefilter", entry.FileInfo.gamefilter)
|
||||
("gameid", entry.FileInfo.gameid)
|
||||
("fgcolor", entry.FileInfo.FgColor)
|
||||
("bkcolor", entry.FileInfo.BgColor)
|
||||
("addon", entry.FileInfo.isAddon)
|
||||
.EndObject();
|
||||
}
|
||||
}
|
||||
arc.EndArray();
|
||||
}
|
||||
unsigned int len;
|
||||
auto p = arc.GetOutput(&len);
|
||||
FILE* f = fopen(getgames, "wb");
|
||||
if (f)
|
||||
{
|
||||
fwrite(p, 1, len, f);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// Ignore all errors
|
||||
}
|
||||
throw CExitEvent(0);
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
@ -844,6 +894,7 @@ int RunGame()
|
|||
I_DetectOS();
|
||||
userConfig.ProcessOptions();
|
||||
G_LoadConfig();
|
||||
GetGames();
|
||||
auto usedgroups = SetupGame();
|
||||
|
||||
bool colorset = false;
|
||||
|
|
Loading…
Reference in a new issue