set Jukebox as the default jukebox path, for Mac OS 9 look for dxx.ini outside the app bundle

This commit is contained in:
kreatordxx 2008-05-18 07:13:07 +00:00
parent 3aa8f5ece7
commit fa16bbc0f2
3 changed files with 19 additions and 14 deletions

View file

@ -1,5 +1,9 @@
D1X-Rebirth Changelog
20080518
--------
include/physfsx.h, main/config.c: set "Jukebox" as the default jukebox path, for Mac OS 9 look for d1x.ini outside the app bundle
20080516
--------
main/multi.c, main/multibot.c, main/netpkt.c, main/network.c: fix remaining endian bugs in network code, now it works on the Mac

View file

@ -46,13 +46,23 @@ static inline void PHYSFSX_init(int argc, char *argv[])
#if defined(__unix__)
char *path = NULL;
char fullPath[PATH_MAX + 5];
#endif
#ifdef macintosh // Mac OS 9
char base_dir[PATH_MAX];
strcpy(base_dir, PHYSFS_getBaseDir());
if (strstr(base_dir, ".app:Contents:MacOSClassic:")) // the Mac OS 9 program is still in the .app bundle
strncat(base_dir, ":::", PATH_MAX - 1 - strlen(base_dir)); // go outside the .app bundle (the lazy way)
PHYSFS_setWriteDir(base_dir);
#else
#define base_dir PHYSFS_getBaseDir()
#endif
PHYSFS_init(argv[0]);
PHYSFS_permitSymbolicLinks(1);
#if defined(__APPLE__) && defined(__MACH__) // others?
chdir(PHYSFS_getBaseDir()); // make sure relative hogdir and userdir paths work
#if (defined(__APPLE__) && defined(__MACH__)) || defined(macintosh) // others?
chdir(base_dir); // make sure relative hogdir and userdir paths work
#endif
#if defined(__unix__)
@ -106,22 +116,13 @@ static inline void PHYSFSX_init(int argc, char *argv[])
PHYSFS_addToSearchPath(PHYSFS_getWriteDir(), 1);
#endif
PHYSFS_addToSearchPath(PHYSFS_getBaseDir(), 1);
PHYSFS_addToSearchPath(base_dir, 1);
InitArgs( argc,argv );
PHYSFS_removeFromSearchPath(PHYSFS_getBaseDir());
PHYSFS_removeFromSearchPath(base_dir);
if (!PHYSFS_getWriteDir())
{
#ifdef macintosh // Mac OS 9
char base_dir[PATH_MAX];
strcpy(base_dir, PHYSFS_getBaseDir());
if (strstr(base_dir, ".app:Contents:MacOSClassic:")) // the Mac OS 9 program is still in the .app bundle
strncat(base_dir, ":::", PATH_MAX - 1 - strlen(base_dir)); // go outside the .app bundle (the lazy way)
PHYSFS_setWriteDir(base_dir);
#else
PHYSFS_setWriteDir(PHYSFS_getBaseDir());
#endif
if (!PHYSFS_getWriteDir())
Error("can't set write dir\n");
else

View file

@ -79,7 +79,7 @@ int ReadConfigFile()
GameCfg.VSync = 0;
GameCfg.Multisample = 0;
GameCfg.JukeboxOn = 0;
memset(GameCfg.JukeboxPath,0,PATH_MAX+1);
strncpy(GameCfg.JukeboxPath, "Jukebox", PATH_MAX+1); // maybe include this directory with the binary
memset(GameCfg.MplIpHostAddr, 0, 128);
infile = PHYSFSX_openReadBuffered("descent.cfg");