Skip to content

Commit

Permalink
Autoload .deh/.bex files for .iwad and .pwad files
Browse files Browse the repository at this point in the history
  • Loading branch information
bradharding committed Oct 14, 2021
1 parent a57e48d commit f064473
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,14 @@ static char *FindDehPath(char *path, char *ext, char *pattern)
// Or NULL if no matching .deh file can be found.
// The pattern (not used in Windows) is the fnmatch pattern to search for.
#if defined(_WIN32)
char *dehpath = M_StringReplace(path, ".wad", ext);
char dehpath[MAX_PATH] = "";

if (M_StringEndsWith(path, ".wad"))
M_StringCopy(dehpath, M_StringReplace(path, ".wad", ext), sizeof(dehpath));
else if (M_StringEndsWith(path, ".iwad"))
M_StringCopy(dehpath, M_StringReplace(path, ".iwad", ext), sizeof(dehpath));
else if (M_StringEndsWith(path, ".pwad"))
M_StringCopy(dehpath, M_StringReplace(path, ".pwad", ext), sizeof(dehpath));

return (M_FileExists(dehpath) ? dehpath : NULL);
#else
Expand Down

0 comments on commit f064473

Please sign in to comment.