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
This commit is contained in:
parent
574bc21e06
commit
539abbffb6
|
@ -4,6 +4,7 @@ D1X-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/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: Ignore case-sensitivity for cfile_init/close/size and PHYSFSX_openReadBuffered
|
||||
|
||||
20100324
|
||||
--------
|
||||
|
|
|
@ -53,16 +53,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))
|
||||
|
@ -76,16 +79,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))
|
||||
|
@ -97,18 +103,21 @@ static inline int cfile_close(char *hogname)
|
|||
return 1;
|
||||
}
|
||||
|
||||
|
||||
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)))
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue