From fa16bbc0f28e3d5ebc522759d384a8e563357d04 Mon Sep 17 00:00:00 2001 From: kreatordxx <> Date: Sun, 18 May 2008 07:13:07 +0000 Subject: [PATCH] set Jukebox as the default jukebox path, for Mac OS 9 look for dxx.ini outside the app bundle --- CHANGELOG.txt | 4 ++++ include/physfsx.h | 27 ++++++++++++++------------- main/config.c | 2 +- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 76ae6d8f2..0a367f91b 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 diff --git a/include/physfsx.h b/include/physfsx.h index a41d1a672..ee424b80f 100644 --- a/include/physfsx.h +++ b/include/physfsx.h @@ -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 diff --git a/main/config.c b/main/config.c index 824ee1d16..5795d5984 100644 --- a/main/config.c +++ b/main/config.c @@ -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");