mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 12:30:46 +00:00
- Move all the timing code from LoadDefinitions()
to loaddefinitionsfile()
This commit is contained in:
parent
27767f61ae
commit
733f4f7aea
2 changed files with 12 additions and 27 deletions
|
@ -2124,6 +2124,16 @@ void loaddefinitionsfile(const char* fn, bool cumulative)
|
||||||
Printf(PRINT_NONOTIFY, "\n");
|
Printf(PRINT_NONOTIFY, "\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
cycle_t deftimer;
|
||||||
|
deftimer.Reset();
|
||||||
|
deftimer.Clock();
|
||||||
|
|
||||||
|
auto printtimer = [&](const char* fn)
|
||||||
|
{
|
||||||
|
deftimer.Unclock();
|
||||||
|
DPrintf(DMSG_SPAMMY, "Definitions file \"%s\" loaded, %f ms.\n", fn, deftimer.TimeMS());
|
||||||
|
};
|
||||||
|
|
||||||
if (!cumulative)
|
if (!cumulative)
|
||||||
{
|
{
|
||||||
int lump = fileSystem.FindFile(fn);
|
int lump = fileSystem.FindFile(fn);
|
||||||
|
@ -2131,6 +2141,7 @@ void loaddefinitionsfile(const char* fn, bool cumulative)
|
||||||
{
|
{
|
||||||
Printf(PRINT_NONOTIFY, "Loading \"%s\"\n", fn);
|
Printf(PRINT_NONOTIFY, "Loading \"%s\"\n", fn);
|
||||||
parseit(lump);
|
parseit(lump);
|
||||||
|
printtimer(fn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2140,6 +2151,7 @@ void loaddefinitionsfile(const char* fn, bool cumulative)
|
||||||
{
|
{
|
||||||
Printf(PRINT_NONOTIFY, "Loading \"%s\"\n", fileSystem.GetFileFullPath(lump).GetChars());
|
Printf(PRINT_NONOTIFY, "Loading \"%s\"\n", fileSystem.GetFileFullPath(lump).GetChars());
|
||||||
parseit(lump);
|
parseit(lump);
|
||||||
|
printtimer(fn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1340,26 +1340,11 @@ void DrawCrosshair(int deftile, int health, double xdelta, double ydelta, double
|
||||||
|
|
||||||
void LoadDefinitions()
|
void LoadDefinitions()
|
||||||
{
|
{
|
||||||
cycle_t deftimer;
|
|
||||||
|
|
||||||
const char* defsfile = G_DefFile();
|
const char* defsfile = G_DefFile();
|
||||||
FString razedefsfile = defsfile;
|
FString razedefsfile = defsfile;
|
||||||
razedefsfile.Substitute(".def", "-raze.def");
|
razedefsfile.Substitute(".def", "-raze.def");
|
||||||
|
|
||||||
auto starttimer = [&]()
|
|
||||||
{
|
|
||||||
deftimer.Reset();
|
|
||||||
deftimer.Clock();
|
|
||||||
};
|
|
||||||
auto printtimer = [&](const char* fn)
|
|
||||||
{
|
|
||||||
deftimer.Unclock();
|
|
||||||
DPrintf(DMSG_SPAMMY, "Definitions file \"%s\" loaded, %f ms.\n", fn, deftimer.TimeMS());
|
|
||||||
};
|
|
||||||
|
|
||||||
starttimer();
|
|
||||||
loaddefinitionsfile("engine/engine.def"); // Internal stuff that is required.
|
loaddefinitionsfile("engine/engine.def"); // Internal stuff that is required.
|
||||||
printtimer("engine/engine.def");
|
|
||||||
|
|
||||||
// check what we have.
|
// check what we have.
|
||||||
// user .defs override the default ones and are not cumulative.
|
// user .defs override the default ones and are not cumulative.
|
||||||
|
@ -1367,23 +1352,17 @@ void LoadDefinitions()
|
||||||
// otherwise the default rules inherited from older ports apply.
|
// otherwise the default rules inherited from older ports apply.
|
||||||
if (userConfig.UserDef.IsNotEmpty())
|
if (userConfig.UserDef.IsNotEmpty())
|
||||||
{
|
{
|
||||||
starttimer();
|
|
||||||
loaddefinitionsfile(userConfig.UserDef, false);
|
loaddefinitionsfile(userConfig.UserDef, false);
|
||||||
printtimer(userConfig.UserDef);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (fileSystem.FileExists(razedefsfile))
|
if (fileSystem.FileExists(razedefsfile))
|
||||||
{
|
{
|
||||||
starttimer();
|
|
||||||
loaddefinitionsfile(razedefsfile, true);
|
loaddefinitionsfile(razedefsfile, true);
|
||||||
printtimer(razedefsfile);
|
|
||||||
}
|
}
|
||||||
else if (fileSystem.FileExists(defsfile))
|
else if (fileSystem.FileExists(defsfile))
|
||||||
{
|
{
|
||||||
starttimer();
|
|
||||||
loaddefinitionsfile(defsfile, false);
|
loaddefinitionsfile(defsfile, false);
|
||||||
printtimer(defsfile);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1391,26 +1370,20 @@ void LoadDefinitions()
|
||||||
{
|
{
|
||||||
for (auto& m : *userConfig.AddDefs)
|
for (auto& m : *userConfig.AddDefs)
|
||||||
{
|
{
|
||||||
starttimer();
|
|
||||||
loaddefinitionsfile(m, false);
|
loaddefinitionsfile(m, false);
|
||||||
printtimer(m);
|
|
||||||
}
|
}
|
||||||
userConfig.AddDefs.reset();
|
userConfig.AddDefs.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameStartupInfo.def.IsNotEmpty())
|
if (GameStartupInfo.def.IsNotEmpty())
|
||||||
{
|
{
|
||||||
starttimer();
|
|
||||||
loaddefinitionsfile(GameStartupInfo.def); // Stuff from gameinfo.
|
loaddefinitionsfile(GameStartupInfo.def); // Stuff from gameinfo.
|
||||||
printtimer(GameStartupInfo.def);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// load the widescreen replacements last. This ensures that mods still get the correct CRCs for their own tile replacements.
|
// load the widescreen replacements last. This ensures that mods still get the correct CRCs for their own tile replacements.
|
||||||
if (fileSystem.FindFile("engine/widescreen.def") >= 0 && !Args->CheckParm("-nowidescreen"))
|
if (fileSystem.FindFile("engine/widescreen.def") >= 0 && !Args->CheckParm("-nowidescreen"))
|
||||||
{
|
{
|
||||||
starttimer();
|
|
||||||
loaddefinitionsfile("engine/widescreen.def");
|
loaddefinitionsfile("engine/widescreen.def");
|
||||||
printtimer("engine/widescreen.def");
|
|
||||||
}
|
}
|
||||||
fileSystem.InitHashChains(); // make sure that any resources that got added can be found again.
|
fileSystem.InitHashChains(); // make sure that any resources that got added can be found again.
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue