Windows: Add the default installation paths for the GOG.com release of Duke Nukem 3D: Atomic Edition and the Steam release of Duke Nukem 3D: Megaton Edition (if they exist) to EDuke32's search path.

git-svn-id: https://svn.eduke32.com/eduke32@3581 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2013-03-21 09:48:21 +00:00
parent b46d4460bc
commit bdc4f7cd68
6 changed files with 49 additions and 18 deletions

View file

@ -26,3 +26,5 @@ extern void win_close(void);
extern void ShowErrorBox(const char *m);
extern LPTSTR GetWindowsErrorMsg(DWORD code);
extern int32_t addsearchpath_ProgramFiles(const char *p);

View file

@ -6,6 +6,7 @@
#include "build.h"
#include "baselayer.h"
#include "osd.h"
#include "cache1d.h"
#include "winbits.h"
#ifndef DEBUGGINGAIDS
@ -274,4 +275,22 @@ LPTSTR GetWindowsErrorMsg(DWORD code)
return lpMsgBuf;
}
int32_t addsearchpath_ProgramFiles(const char *p)
{
int32_t returncode = -1, i;
const char *ProgramFiles[2] = { Bgetenv("ProgramFiles"), Bgetenv("ProgramFiles(x86)") };
for (i = 0; i < 2; ++i)
{
if (ProgramFiles[i])
{
char *buffer = (char*)Bmalloc((strlen(ProgramFiles[i])+1+strlen(p)+1)*sizeof(char));
Bsprintf(buffer,"%s/%s",ProgramFiles[i],p);
if (addsearchpath(buffer) == 0) // if any work, return success
returncode = 0;
Bfree(buffer);
}
}
return returncode;
}

View file

@ -10244,15 +10244,7 @@ int32_t ExtInit(void)
int32_t i;
char cwd[BMAX_PATH];
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
addsearchpath("/usr/share/games/jfduke3d");
addsearchpath("/usr/local/share/games/jfduke3d");
addsearchpath("/usr/share/games/eduke32");
addsearchpath("/usr/local/share/games/eduke32");
#elif defined(__APPLE__)
addsearchpath("/Library/Application Support/JFDuke3D");
addsearchpath("/Library/Application Support/EDuke32");
#endif
G_AddSearchPaths();
if (getcwd(cwd,BMAX_PATH))
{

View file

@ -10,6 +10,10 @@
#include "baselayer.h"
#include "names.h"
#ifdef _WIN32
# include "winbits.h"
#endif
#include "common.h"
#include "common_game.h"
@ -195,6 +199,24 @@ void G_MultiPskyInit(void)
//////////
void G_AddSearchPaths(void)
{
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
addsearchpath("/usr/share/games/jfduke3d");
addsearchpath("/usr/local/share/games/jfduke3d");
addsearchpath("/usr/share/games/eduke32");
addsearchpath("/usr/local/share/games/eduke32");
#elif defined(__APPLE__)
addsearchpath("/Library/Application Support/JFDuke3D");
addsearchpath("/Library/Application Support/EDuke32");
#elif defined (_WIN32)
addsearchpath_ProgramFiles("GOG.com/Duke Nukem 3D");
addsearchpath_ProgramFiles("Steam/SteamApps/common/Duke Nukem 3D/gameroot");
#endif
}
//////////
struct strllist *CommandPaths, *CommandGrps;
void G_AddGroup(const char *buffer)

View file

@ -49,4 +49,8 @@ extern void clearScriptNamePtr(void);
extern void G_MultiPskyInit(void);
//////////
extern void G_AddSearchPaths(void);
#endif

View file

@ -10174,15 +10174,7 @@ int32_t app_main(int32_t argc, const char **argv)
);
initprintf("Compiled %s\n", __DATE__" "__TIME__);
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
addsearchpath("/usr/share/games/jfduke3d");
addsearchpath("/usr/local/share/games/jfduke3d");
addsearchpath("/usr/share/games/eduke32");
addsearchpath("/usr/local/share/games/eduke32");
#elif defined(__APPLE__)
addsearchpath("/Library/Application Support/JFDuke3D");
addsearchpath("/Library/Application Support/EDuke32");
#endif
G_AddSearchPaths();
g_numSkills = 4;
ud.multimode = 1;