From 6829e5f403ee920d8bab7876c24b9cc547818ed6 Mon Sep 17 00:00:00 2001 From: terminx Date: Sat, 23 Aug 2008 03:12:23 +0000 Subject: [PATCH] Mapster32 user_profiles_enabled fix git-svn-id: https://svn.eduke32.com/eduke32@1003 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/src/compat.c | 20 +++++++++++++++++++- polymer/eduke32/source/astub.c | 11 +++++++++-- polymer/eduke32/source/game.c | 4 ++-- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/polymer/build/src/compat.c b/polymer/build/src/compat.c index 24b42179f..0ac960d07 100644 --- a/polymer/build/src/compat.c +++ b/polymer/build/src/compat.c @@ -339,11 +339,29 @@ char *Bgethomedir(void) #ifdef _WIN32 FARPROC aSHGetSpecialFolderPathA; TCHAR appdata[MAX_PATH]; + int loaded = 0; + HMODULE hShell32 = GetModuleHandle("shell32.dll"); - aSHGetSpecialFolderPathA = GetProcAddress(GetModuleHandle("shell32.dll"), "SHGetSpecialFolderPathA"); + if (hShell32 == NULL) + { + hShell32 = LoadLibrary("shell32.dll"); + loaded = 1; + } + + if (hShell32 == NULL) + return NULL; + + aSHGetSpecialFolderPathA = GetProcAddress(hShell32, "SHGetSpecialFolderPathA"); if (aSHGetSpecialFolderPathA != NULL) if (SUCCEEDED(aSHGetSpecialFolderPathA(NULL, appdata, CSIDL_APPDATA, FALSE))) + { + if (loaded) + FreeLibrary(hShell32); return strdup(appdata); + } + + if (loaded) + FreeLibrary(hShell32); return NULL; #elif defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_3 FSRef ref; diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 9b539dab4..594722911 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -7427,7 +7427,15 @@ int ExtInit(void) addsearchpath("/Library/Application Support/EDuke32"); #endif - if (getcwd(cwd,BMAX_PATH)) addsearchpath(cwd); + if (getcwd(cwd,BMAX_PATH)) { + #if defined(__APPLE__) + /* Dirty hack on OS X to also look for gamedata inside the application bundle - rhoenie 08/08 */ + char seekinappcontainer[BMAX_PATH]; + Bsnprintf(seekinappcontainer,sizeof(seekinappcontainer),"%s/EDuke32.app/", cwd); + addsearchpath(seekinappcontainer); + #endif + addsearchpath(cwd); + } if (CommandPaths) { @@ -7449,7 +7457,6 @@ int ExtInit(void) if (usecwd == 0 && access("user_profiles_disabled", F_OK)) #endif { - char cwd[BMAX_PATH]; char *homedir; int asperr; diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index ad3689fd6..b12684f3c 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -50,7 +50,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include extern int getversionfromwebsite(char *buffer); -#define BUILDDATE 20080821 // this is checked against http://eduke32.com/VERSION +#define BUILDDATE 20080822 // this is checked against http://eduke32.com/VERSION #define UPDATEINTERVAL 604800 // 1w #else static int usecwd = 0; @@ -10643,7 +10643,7 @@ void app_main(int argc,const char **argv) if (Bmkdir(cwd,S_IRWXU) == 0) asperr = addsearchpath(cwd); else asperr = -1; } - if ((asperr == 0)) + if (asperr == 0) chdir(cwd); Bfree(homedir); }