diff --git a/sc2/ChangeLog b/sc2/ChangeLog index fe3e6e6a0..e79403461 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,5 @@ 0.2: +- Saving user data in "%APPDATA%/Application Data" on windows - SvdB - Melnorme comm fix, from TD. - Planet scan font character fixes (micro.fon), from fOSSiL - Temporary files are deleted on exit. - SvdB diff --git a/sc2/src/getopt/getopt.c b/sc2/src/getopt/getopt.c index b38c76d01..08d13d4aa 100644 --- a/sc2/src/getopt/getopt.c +++ b/sc2/src/getopt/getopt.c @@ -27,9 +27,7 @@ # define _NO_PROTO #endif -#ifdef HAVE_CONFIG_H -# include -#endif +#include #ifndef HAVE_GETOPT_H #if !defined __STDC__ || !__STDC__ diff --git a/sc2/src/getopt/getopt1.c b/sc2/src/getopt/getopt1.c index 6a3db824b..57eee0821 100644 --- a/sc2/src/getopt/getopt1.c +++ b/sc2/src/getopt/getopt1.c @@ -18,9 +18,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#ifdef HAVE_CONFIG_H #include -#endif #ifndef HAVE_GETOPT_H #include "getopt.h" diff --git a/sc2/src/msvc++/UrQuanMasters.dsp b/sc2/src/msvc++/UrQuanMasters.dsp index 41e34b39d..e29fb55df 100644 --- a/sc2/src/msvc++/UrQuanMasters.dsp +++ b/sc2/src/msvc++/UrQuanMasters.dsp @@ -42,7 +42,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\sc2code" /I "..\sc2code\libs" /I "..\sc2code\ships" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D _VW=320 /D _VH=240 /D "HAVE_CONFIG_H" /D "HAVE_OPENGL" /D "GFXMODULE_SDL" /D "SOUNDMODULE_OPENAL" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\sc2code" /I "..\sc2code\libs" /I "..\sc2code\ships" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D _VW=320 /D _VH=240 /D "HAVE_OPENGL" /D "GFXMODULE_SDL" /D "SOUNDMODULE_OPENAL" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -66,7 +66,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I ".." /I "..\sc2code" /I "..\sc2code\libs" /I "..\sc2code\ships" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D _VW=320 /D _VH=240 /D "HAVE_CONFIG_H" /D "HAVE_OPENGL" /D "GFXMODULE_SDL" /D "SOUNDMODULE_OPENAL" /FR /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I ".." /I "..\sc2code" /I "..\sc2code\libs" /I "..\sc2code\ships" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D _VW=320 /D _VH=240 /D "HAVE_OPENGL" /D "GFXMODULE_SDL" /D "SOUNDMODULE_OPENAL" /FR /YX /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe diff --git a/sc2/src/msvc++/config.h b/sc2/src/msvc++/config.h index 1f8b93f92..8ed3a3342 100644 --- a/sc2/src/msvc++/config.h +++ b/sc2/src/msvc++/config.h @@ -12,7 +12,8 @@ #define CONTENTDIR "../content" /* Directory where game data will be stored */ -#define USERDIR "../userdata/" +//#define USERDIR "../userdata/" +#define USERDIR "%APPDATA%/uqm/" /* Directory where supermelee teams will be stored */ #define MELEEDIR USERDIR "teams/" diff --git a/sc2/src/options.c b/sc2/src/options.c index 300c2f0ff..4c355776f 100644 --- a/sc2/src/options.c +++ b/sc2/src/options.c @@ -26,21 +26,12 @@ #include "compiler.h" #include "options.h" #include "file.h" +#include "config.h" int optWhichMusic = MUSIC_3DO; char *configDir, *saveDir, *meleeDir; BOOLEAN optSubtitles = TRUE; -BOOLEAN FileExists (const char *filename) -{ - FILE *fp; - if ((fp = fopen (filename, "rb")) == NULL) - return FALSE; - - fclose (fp); - return TRUE; -} - void prepareConfigDir (void) { configDir = malloc (PATH_MAX - 13); diff --git a/sc2/src/options.h b/sc2/src/options.h index e82fef0fc..ebd2f1adb 100644 --- a/sc2/src/options.h +++ b/sc2/src/options.h @@ -35,8 +35,6 @@ extern int optWhichMusic; extern BOOLEAN optSubtitles; -BOOLEAN FileExists (const char *filename); - extern char *configDir; extern char *meleeDir; extern char *saveDir; diff --git a/sc2/src/sc2code/libs/compiler.h b/sc2/src/sc2code/libs/compiler.h index f450ffc49..a00ba5bab 100644 --- a/sc2/src/sc2code/libs/compiler.h +++ b/sc2/src/sc2code/libs/compiler.h @@ -19,10 +19,6 @@ #ifndef _COMPILER_H #define _COMPILER_H -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - typedef unsigned char BYTE; typedef BYTE *PBYTE; typedef unsigned char UBYTE; diff --git a/sc2/src/sc2code/libs/file.h b/sc2/src/sc2code/libs/file.h index 996bab270..82f43b69d 100644 --- a/sc2/src/sc2code/libs/file.h +++ b/sc2/src/sc2code/libs/file.h @@ -38,13 +38,18 @@ # include #endif +// for BOOLEAN +#include "compiler.h" + void initTempDir (void); void unInitTempDir (void); char *tempFilePath (const char *filename); int mkdirhier (const char *path); const char *getHomeDir (void); -int createDirectory(const char *dir, int mode); -int expandPath(char *dest, size_t len, const char *src); +int createDirectory (const char *dir, int mode); +int expandPath (char *dest, size_t len, const char *src); +BOOLEAN fileExists (const char *name); +int getUserDataDir (char *dir, size_t len); #endif /* _FILE_H */ diff --git a/sc2/src/sc2code/libs/file/dirs.c b/sc2/src/sc2code/libs/file/dirs.c index c2dccbc4c..6de962f25 100644 --- a/sc2/src/sc2code/libs/file/dirs.c +++ b/sc2/src/sc2code/libs/file/dirs.c @@ -21,15 +21,33 @@ #include #include #include -#ifdef WIN32 -#include -#endif #include "port.h" #include "config.h" #include "filintrn.h" +#include "compiler.h" + +#ifdef WIN32 +# include + +// this would lead to conflicts +//# include +typedef void *HWND; +typedef void *HANDLE; +typedef char *LPTSTR; +typedef long HRESULT; +#define SUCCEEDED(Status) ((HRESULT) (Status) >= 0) +HRESULT __stdcall SHGetFolderPathA (HWND hwndOwner, int nFolder, + HANDLE hToken, DWORD dwFlags, LPTSTR pszPath); +#define SHGetFolderPath SHGetFolderPathA +#define CSIDL_APPDATA 0x001a // \Application Data +#define CSIDL_FLAG_CREATE 0x8000 + // combine with CSIDL_ value to force folder creation in + // SHGetFolderPath() +#endif int -createDirectory(const char *dir, int mode) { +createDirectory(const char *dir, int mode) +{ #ifdef WIN32 return mkdir (dir); #else @@ -41,7 +59,8 @@ createDirectory(const char *dir, int mode) { // returns 0 on success, -1 on failure. // on failure, some parts may still have been created. int -mkdirhier (const char *path) { +mkdirhier (const char *path) +{ char *buf; // buffer char *ptr; // end of the string in buf const char *pathstart; // start of a component of path @@ -67,7 +86,8 @@ mkdirhier (const char *path) { } // walk through the path as long as the components exist - while (1) { + while (1) + { pathend = strchr (pathstart, '/'); if (pathend == NULL) pathend = path + len; @@ -75,8 +95,10 @@ mkdirhier (const char *path) { ptr += pathend - pathstart; *ptr = '\0'; - if (stat (buf, &statbuf) == -1) { - if (errno != ENOENT) { + if (stat (buf, &statbuf) == -1) + { + if (errno != ENOENT) + { fprintf (stderr, "Can't stat %s: %s\n", buf, strerror (errno)); return -1; @@ -99,8 +121,10 @@ mkdirhier (const char *path) { } // create all components left - while (1) { - if (createDirectory (buf, 0777) == -1) { + while (1) + { + if (createDirectory (buf, 0777) == -1) + { fprintf (stderr, "Error: Can't create %s: %s\n", buf, strerror (errno)); return -1; @@ -133,15 +157,28 @@ mkdirhier (const char *path) { // Get the user's home dir // returns a pointer to a static buffer const char * -getHomeDir(void) { +getHomeDir (void) +{ return getenv ("HOME"); } +// Expand ~/ in a path, and replaces \ by / on Windows. +// Environment variable parsing could be added here if we need it. int -expandPath(char *dest, size_t len, const char *src) { - size_t srclen; +expandPath (char *dest, size_t len, const char *src) +{ + const char *destend; - srclen = strlen (src); +#define CHECKLEN(n) \ + if (dest + (n) > destend) \ + { \ + errno = ENAMETOOLONG; \ + return -1; \ + } \ + else \ + (void) 0 + + destend = dest + len; if (src[0] == '~') { const char *home; @@ -161,39 +198,132 @@ expandPath(char *dest, size_t len, const char *src) { } homelen = strlen (home); - if (homelen + srclen > len) - { - errno = ENAMETOOLONG; - return -1; - } - memcpy(dest, home, homelen); + CHECKLEN (homelen); + memcpy (dest, home, homelen); dest += homelen; src++; /* skip the ~ */ - } else { - if (strlen (src) >= len) - { - errno = ENAMETOOLONG; - return -1; - } } -#ifdef WIN32 - /* Replaces backslashes in path by slashes. */ while (*src != '\0') { - if (*src == '\\') + switch (*src) { - *(dest++) = '/'; - src++; +#ifdef WIN32 + case '\\': + /* Replaces backslashes in path by slashes in Windows. */ + CHECKLEN(1); + *(dest++) = '/'; + src++; + break; +#endif +#ifdef WIN32 + case '%': + { + /* Environment variable substitution in Windows */ + const char *end; // end of env var name in src + const char *envVar; + char *envName; + size_t envNameLen, envVarLen; + + src++; + end = strchr (src, '%'); + if (end == NULL) + { + errno = EINVAL; + return -1; + } + + envNameLen = end - src; + envName = malloc (envNameLen + 1); + memcpy (envName, src, envNameLen + 1); + envName[envNameLen] = '\0'; + envVar = getenv (envName); + free (envName); + + if (envVar == NULL) + { +#if 1 + if (strncmp (src, "APPDATA", envNameLen) == 0) + { + // fallback for when the APPDATA env var is not set + if (getUserDataDir (dest, destend - dest) == -1) + return -1; + dest += strlen (dest); + src = end + 1; + break; + } +#endif + // Substitute an empty string + src = end + 1; + break; + } + + envVarLen = strlen (envVar); + CHECKLEN (envVarLen); + strcpy (dest, envVar); + dest += envVarLen; + src = end + 1; + break; + } +#endif +#if 0 + case '$': + /* Environment variable substitution for Unix */ + // not implemented + break; +#endif + default: + CHECKLEN(1); + *(dest++) = *(src++); + break; } - else - *(dest++) = *(src++); } *dest = '\0'; -#else - strcpy(dest, src); -#endif return 0; } +// returns 0 on success, and fills dir with the path to the dir where there +// user data is stored. +// return -1 on error, and sets errno. +int +getUserDataDir (char *dir, size_t len) +{ +#ifdef WIN32 + char buf[PATH_MAX]; + + if (!SUCCEEDED (SHGetFolderPath(NULL, + CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, buf))) + { + errno = ENOENT; + return -1; + } + + if (strlen (buf) >= len) + { + errno = ENAMETOOLONG; + return -1; + } + + strcpy (dir, buf); + return 0; +#else + const char *homeDir; + homeDir = getHomeDir(); + + if (strlen (homeDir) >= len) + { + errno = ENAMETOOLONG; + return -1; + } + + strcpy (dir, homeDir); + return 0; +#endif +} + +BOOLEAN +fileExists (const char *name) +{ + return access (name, F_OK) == 0; +} diff --git a/sc2/src/sc2code/libs/file/filintrn.h b/sc2/src/sc2code/libs/file/filintrn.h index 4db0048a3..2c6512a5f 100644 --- a/sc2/src/sc2code/libs/file/filintrn.h +++ b/sc2/src/sc2code/libs/file/filintrn.h @@ -20,8 +20,5 @@ #include "../file.h" -void CreateDirectory (const char *dir, int mode); -void RemoveTempDir (void); - #endif /* _FILEINTRN_H */ diff --git a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/drv_nos.c b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/drv_nos.c index 8215f3ece..033e968e7 100644 --- a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/drv_nos.c +++ b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/drv_nos.c @@ -34,10 +34,6 @@ #ifdef SOUNDMODULE_OPENAL -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #ifdef HAVE_UNISTD_H #include #endif diff --git a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/load_mod.c b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/load_mod.c index 54d145484..7e16599f5 100644 --- a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/load_mod.c +++ b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/load_mod.c @@ -28,10 +28,6 @@ #ifdef SOUNDMODULE_OPENAL -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #ifdef HAVE_UNISTD_H #include #endif diff --git a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mdreg.c b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mdreg.c index 43fef03ba..a7f0fabeb 100644 --- a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mdreg.c +++ b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mdreg.c @@ -28,10 +28,6 @@ #ifdef SOUNDMODULE_OPENAL -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "mikmod_internals.h" MIKMODAPI extern struct MDRIVER drv_openal; diff --git a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mdriver.c b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mdriver.c index 42c4390e3..bdba9e953 100644 --- a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mdriver.c +++ b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mdriver.c @@ -28,10 +28,6 @@ #ifdef SOUNDMODULE_OPENAL -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #ifdef HAVE_UNISTD_H #include #endif diff --git a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mloader.c b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mloader.c index bd41804ce..55c7f1d14 100644 --- a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mloader.c +++ b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mloader.c @@ -28,10 +28,6 @@ #ifdef SOUNDMODULE_OPENAL -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #ifdef HAVE_MEMORY_H #include #endif diff --git a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mlreg.c b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mlreg.c index fdaa0154f..36799bad6 100644 --- a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mlreg.c +++ b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mlreg.c @@ -28,10 +28,6 @@ #ifdef SOUNDMODULE_OPENAL -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "mikmod_internals.h" void MikMod_RegisterAllLoaders_internal(void) diff --git a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mlutil.c b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mlutil.c index 14aa35350..0bcf92d36 100644 --- a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mlutil.c +++ b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mlutil.c @@ -28,10 +28,6 @@ #ifdef SOUNDMODULE_OPENAL -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #ifdef HAVE_MEMORY_H #include #endif diff --git a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mmalloc.c b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mmalloc.c index 21e7092be..379ee04b5 100644 --- a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mmalloc.c +++ b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mmalloc.c @@ -28,10 +28,6 @@ #ifdef SOUNDMODULE_OPENAL -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "mikmod_internals.h" /* Same as malloc, but sets error variable _mm_error when fails */ diff --git a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mmerror.c b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mmerror.c index da7f0ff6e..a3d604174 100644 --- a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mmerror.c +++ b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mmerror.c @@ -36,10 +36,6 @@ #ifdef SOUNDMODULE_OPENAL -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "mikmod_internals.h" CHAR *_mm_errmsg[MMERR_MAX+1] = diff --git a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mmio.c b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mmio.c index 914f43830..9b77f7543 100644 --- a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mmio.c +++ b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mmio.c @@ -54,10 +54,6 @@ #ifdef SOUNDMODULE_OPENAL -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include diff --git a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mplayer.c b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mplayer.c index d6261e15d..3f9a12563 100644 --- a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mplayer.c +++ b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mplayer.c @@ -30,10 +30,6 @@ #ifdef SOUNDMODULE_OPENAL -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #ifdef SUNOS diff --git a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/munitrk.c b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/munitrk.c index 46465c6f0..8973b28e7 100644 --- a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/munitrk.c +++ b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/munitrk.c @@ -28,10 +28,6 @@ #ifdef SOUNDMODULE_OPENAL -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include "mikmod_internals.h" diff --git a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mwav.c b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mwav.c index bb75f92c9..c9843842f 100644 --- a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mwav.c +++ b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/mwav.c @@ -32,10 +32,6 @@ #ifdef SOUNDMODULE_OPENAL -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include "mikmod_internals.h" diff --git a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/npertab.c b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/npertab.c index e945e39d5..a38a1e812 100644 --- a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/npertab.c +++ b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/npertab.c @@ -28,10 +28,6 @@ #ifdef SOUNDMODULE_OPENAL -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "mikmod_internals.h" UWORD npertab[7*OCTAVE]={ diff --git a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/sloader.c b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/sloader.c index 6f5283434..2c61cd9e9 100644 --- a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/sloader.c +++ b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/sloader.c @@ -29,10 +29,6 @@ #ifdef SOUNDMODULE_OPENAL -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "mikmod_internals.h" static int sl_rlength; diff --git a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/virtch.c b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/virtch.c index bf8e00256..10ca608aa 100644 --- a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/virtch.c +++ b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/virtch.c @@ -36,10 +36,6 @@ #ifdef SOUNDMODULE_OPENAL -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include diff --git a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/virtch2.c b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/virtch2.c index f03834d9c..6838a3697 100644 --- a/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/virtch2.c +++ b/sc2/src/sc2code/libs/sound/openal/decoders/mikmod/virtch2.c @@ -37,10 +37,6 @@ #ifdef SOUNDMODULE_OPENAL -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include diff --git a/sc2/src/sc2code/libs/sound/openal/music.c b/sc2/src/sc2code/libs/sound/openal/music.c index 34d13a577..8b5b6f72e 100644 --- a/sc2/src/sc2code/libs/sound/openal/music.c +++ b/sc2/src/sc2code/libs/sound/openal/music.c @@ -143,7 +143,7 @@ _GetMusicData (FILE *fp, DWORD length) strcpy (threedoname, filename); strcpy (&threedoname[strlen (threedoname)-3], "ogg"); - if (FileExists (threedoname)) + if (fileExists (threedoname)) { strcpy (filename, threedoname); } diff --git a/sc2/src/sc2code/libs/sound/sdl/modfuncs.c b/sc2/src/sc2code/libs/sound/sdl/modfuncs.c index b15ebd0bd..3fae5adfa 100644 --- a/sc2/src/sc2code/libs/sound/sdl/modfuncs.c +++ b/sc2/src/sc2code/libs/sound/sdl/modfuncs.c @@ -178,7 +178,7 @@ _GetMusicData (FILE *fp, DWORD length) strcpy (threedoname, filename); strcpy (&threedoname[strlen (threedoname)-3], "ogg"); - if (FileExists (threedoname)) + if (fileExists (threedoname)) { strcpy (filename, threedoname); } diff --git a/sc2/src/sc2code/starcon.h b/sc2/src/sc2code/starcon.h index 3436cf7e5..894109cca 100644 --- a/sc2/src/sc2code/starcon.h +++ b/sc2/src/sc2code/starcon.h @@ -41,9 +41,7 @@ extern int ScreenHeight; #define SIS_SCREEN_WIDTH (SPACE_WIDTH - 14) #define SIS_SCREEN_HEIGHT (SPACE_HEIGHT - 13) -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif +#include "config.h" #include "../port.h" #include #include diff --git a/sc2/src/starcon2.c b/sc2/src/starcon2.c index 70179f531..b25fe7fee 100644 --- a/sc2/src/starcon2.c +++ b/sc2/src/starcon2.c @@ -22,9 +22,6 @@ #ifdef WIN32 # include #endif -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif #ifdef HAVE_GETOPT_H #include @@ -50,11 +47,11 @@ CDToContentDir (char *contentdir) { const char *testfile = "starcon.txt"; - if (!FileExists (testfile)) + if (!fileExists (testfile)) { - if ((chdir (contentdir) || !FileExists (testfile)) && - (chdir ("content") || !FileExists (testfile)) && - (chdir ("../../content") || !FileExists (testfile))) { + if ((chdir (contentdir) || !fileExists (testfile)) && + (chdir ("content") || !fileExists (testfile)) && + (chdir ("../../content") || !fileExists (testfile))) { fprintf(stderr, "Fatal error: content not available, running from wrong dir?\n"); exit(EXIT_FAILURE); }