On Windows, check file name case with 'sound' and 'music' CON commands.

This is done by kopen4loadfrommod'ing and immediately closing the file
(since the checker is still run from there when not ingame).
On my system, times were like 0.12 ms, 0.2 ms and 0.5 ms for each
openfrompath/findfrompath, openfrompath/Bopen and SHGetFileInfo
respectively, so it shouldn't have a too noticable impact on initial
loading times.

git-svn-id: https://svn.eduke32.com/eduke32@2704 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-05-28 18:15:26 +00:00
parent c081f3ab2e
commit efa0079474
1 changed files with 17 additions and 0 deletions

View File

@ -2009,6 +2009,17 @@ static void C_Include(const char *confile)
Bfree(mptr);
}
#ifdef _WIN32
static void check_filename_case(const char *fn)
{
int32_t fp;
if ((fp = kopen4loadfrommod(fn, g_loadFromGroupOnly)) >= 0)
kclose(fp);
}
#else
static void check_filename_case(const char *fn) { UNREFERENCED_PARAMETER(fn); }
#endif
static int32_t C_ParseCommand(int32_t loop)
{
int32_t i, j=0, k=0, tw, otw;
@ -2468,6 +2479,8 @@ static int32_t C_ParseCommand(int32_t loop)
Bstrcpy(MapInfo[(k*MAXLEVELS)+i].musicfn,tempbuf);
check_filename_case(tempbuf);
textptr += j;
if (i > MAXLEVELS-1) break;
i++;
@ -2488,6 +2501,8 @@ static int32_t C_ParseCommand(int32_t loop)
}
EnvMusicFilename[i][j] = '\0';
check_filename_case(EnvMusicFilename[i]);
textptr += j;
if (i > MAXVOLUMES-1) break;
i++;
@ -5409,6 +5424,8 @@ repeatcase:
}
g_sounds[k].filename[i] = '\0';
check_filename_case(g_sounds[k].filename);
C_GetNextValue(LABEL_DEFINE);
g_sounds[k].ps = *(g_scriptPtr-1);
C_GetNextValue(LABEL_DEFINE);