From efa00794748acf80a4dc41d55f7ef756064b734c Mon Sep 17 00:00:00 2001 From: helixhorned Date: Mon, 28 May 2012 18:15:26 +0000 Subject: [PATCH] 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 --- polymer/eduke32/source/gamedef.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index b8d2e9dff..f4e71a183 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -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);