mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 12:31:54 +00:00
Merge branch 'wadname-tidy' into 'master'
WADNAME Zone Builder temporary file detection made stricter See merge request KartKrew/Kart!1199
This commit is contained in:
commit
7554943f02
1 changed files with 16 additions and 4 deletions
20
src/w_wad.c
20
src/w_wad.c
|
|
@ -451,20 +451,30 @@ static lumpinfo_t* ResGetLumpsWad (FILE* handle, UINT16* nlmp, const char* filen
|
||||||
trimname = strrchr(filename, PATHSEP[0]);
|
trimname = strrchr(filename, PATHSEP[0]);
|
||||||
#if defined (_WIN32)
|
#if defined (_WIN32)
|
||||||
// For Zone Builder support, work around temporary filenames.
|
// For Zone Builder support, work around temporary filenames.
|
||||||
if (trimname != 0)
|
// They're annoyingly randomised, BUT they follow \Temp\8\8.3...
|
||||||
|
// AND they're always guaranteed to follow the map file, which
|
||||||
|
// should already have a WADNAME in it for us to piggyback off.
|
||||||
|
// EXAMPLE: // \Temp\gj3l7w7n\4f926789.wad
|
||||||
|
|
||||||
|
if (trimname != 0
|
||||||
|
&& wadnamelump != LUMPERROR
|
||||||
|
&& strlen(trimname+1) == 8+1+3)
|
||||||
{
|
{
|
||||||
const char *temp = trimname-1;
|
const char *temp = trimname-1;
|
||||||
while (temp >= filename+5 && *temp != PATHSEP[0])
|
while (temp >= filename+5 && *temp != PATHSEP[0])
|
||||||
temp--;
|
temp--;
|
||||||
|
|
||||||
if (temp-filename >= 5 && !strncmp(temp-5, PATHSEP"Temp", 5))
|
if (((trimname-1) - temp) == 8
|
||||||
|
&& temp >= filename+5
|
||||||
|
&& !strncmp(temp-5, PATHSEP"Temp", 5))
|
||||||
{
|
{
|
||||||
filename = wadfiles[numwadfiles-1]->filename;
|
filename = wadfiles[
|
||||||
|
((wadnamelump & ~UINT16_MAX) >> 16)
|
||||||
|
]->filename;
|
||||||
trimname = strrchr(filename, PATHSEP[0]);
|
trimname = strrchr(filename, PATHSEP[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Strip away file address
|
// Strip away file address
|
||||||
if (trimname != 0)
|
if (trimname != 0)
|
||||||
trimname++;
|
trimname++;
|
||||||
|
|
@ -482,6 +492,8 @@ static lumpinfo_t* ResGetLumpsWad (FILE* handle, UINT16* nlmp, const char* filen
|
||||||
strncpy(lump_p->longname, trimname, namelen);
|
strncpy(lump_p->longname, trimname, namelen);
|
||||||
lump_p->longname[namelen-1] = '\0';
|
lump_p->longname[namelen-1] = '\0';
|
||||||
|
|
||||||
|
CONS_Debug(DBG_SETUP, "WADNAME handling:\n -- path %s\n -- interpreted lumpname %s\n", filename, lump_p->longname);
|
||||||
|
|
||||||
// Grab the hash from the first part
|
// Grab the hash from the first part
|
||||||
lump_p->hash = quickncasehash(lump_p->longname, 8);
|
lump_p->hash = quickncasehash(lump_p->longname, 8);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue