diff --git a/CHANGELOG.txt b/CHANGELOG.txt index cca09d251..1f524aa9f 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,7 @@ D2X-Rebirth Changelog -------- main/endlevel.c, main/gameseq.c, main/mission.c, main/mission.h, main/titles.c, main/titles.h: In Endlevel sequence, re-align big explosion to draw in front of exit model, relative to viewer; Re-organized tex files for Briefings and Endings and created more general code to play them; Re-aligned Dravis' head main/automap.c, main/escort.c, main/gamecntl.c, main/kconfig.c, main/net_ipx.c, main/net_udp.c, main/newmenu.c, main/scores.c: Make all windows except game and editor use EVENT_KEY_COMMAND, returning 1 if handled; pass NULL instead of userdata for the PCX filename, for newmenu_do1 +include/cfile.h, include/physfsx.h, main/piggy.c: Ignore case-sensitivity for cfile_init/close/size and PHYSFSX_openReadBuffered; Give error message if default sound file cannot be opened so user knows what's going on 20100325 -------- diff --git a/include/cfile.h b/include/cfile.h index 7ccf6dab5..e12f2c5b5 100644 --- a/include/cfile.h +++ b/include/cfile.h @@ -54,16 +54,19 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. //Specify the name of the hogfile. Returns 1 if hogfile found & had files static inline int cfile_init(char *hogname, int add_to_end) { - char pathname[PATH_MAX]; + char hogname2[PATH_MAX], pathname[PATH_MAX]; - if (!PHYSFSX_getRealPath(hogname, pathname)) + snprintf(hogname2, strlen(hogname)+1, hogname); + PHYSFSEXT_locateCorrectCase(hogname2); + + if (!PHYSFSX_getRealPath(hogname2, pathname)) return 0; if (!PHYSFS_addToSearchPath(pathname, add_to_end)) { // try the 'Data' directory for old Mac Descent directories compatibility char std_path[PATH_MAX] = "Data/"; - strncat(std_path, hogname, PATH_MAX - 1 - strlen(std_path)); + strncat(std_path, hogname2, PATH_MAX - 1 - strlen(std_path)); std_path[PATH_MAX - 1] = 0; if (!PHYSFSX_getRealPath(std_path, pathname)) @@ -77,16 +80,19 @@ static inline int cfile_init(char *hogname, int add_to_end) static inline int cfile_close(char *hogname) { - char pathname[PATH_MAX]; + char hogname2[PATH_MAX], pathname[PATH_MAX]; - if (!PHYSFSX_getRealPath(hogname, pathname)) + snprintf(hogname2, strlen(hogname)+1, hogname); + PHYSFSEXT_locateCorrectCase(hogname2); + + if (!PHYSFSX_getRealPath(hogname2, pathname)) return 0; if (!PHYSFS_removeFromSearchPath(pathname)) { char std_path[PATH_MAX] = "Data/"; - strncat(std_path, hogname, PATH_MAX - 1 - strlen(std_path)); + strncat(std_path, hogname2, PATH_MAX - 1 - strlen(std_path)); std_path[PATH_MAX - 1] = 0; if (!PHYSFSX_getRealPath(std_path, pathname)) @@ -102,14 +108,18 @@ static inline int cfile_close(char *hogname) static inline int cfile_size(char *hogname) { PHYSFS_file *fp; + char hogname2[PATH_MAX]; int size; - fp = PHYSFS_openRead(hogname); + snprintf(hogname2, strlen(hogname)+1, hogname); + PHYSFSEXT_locateCorrectCase(hogname2); + + fp = PHYSFS_openRead(hogname2); if (fp == NULL) { char std_path[PATH_MAX] = "Data/"; - strncat(std_path, hogname, PATH_MAX - 1 - strlen(std_path)); + strncat(std_path, hogname2, PATH_MAX - 1 - strlen(std_path)); std_path[PATH_MAX - 1] = 0; if (!(fp = PHYSFS_openRead(std_path))) diff --git a/include/physfsx.h b/include/physfsx.h index dd4ce8e34..447edbca3 100644 --- a/include/physfsx.h +++ b/include/physfsx.h @@ -369,6 +369,7 @@ static inline PHYSFS_file *PHYSFSX_openReadBuffered(char *filename) { PHYSFS_file *fp; PHYSFS_uint64 bufSize; + char filename2[PATH_MAX]; if (filename[0] == '\x01') { @@ -376,9 +377,10 @@ static inline PHYSFS_file *PHYSFSX_openReadBuffered(char *filename) filename++; } - PHYSFSEXT_locateCorrectCase(filename); + snprintf(filename2, strlen(filename)+1, filename); + PHYSFSEXT_locateCorrectCase(filename2); - fp = PHYSFS_openRead(filename); + fp = PHYSFS_openRead(filename2); if (!fp) return NULL; diff --git a/main/piggy.c b/main/piggy.c index 7d365a279..5df67879c 100644 --- a/main/piggy.c +++ b/main/piggy.c @@ -949,7 +949,11 @@ int properties_init(void) snd_ok = ham_ok = read_hamfile(); if (Piggy_hamfile_version >= 3) + { snd_ok = read_sndfile(); + if (!snd_ok) + Error("Cannot open sound file: %s\n", DEFAULT_SNDFILE); + } return (ham_ok && snd_ok); //read ok }