mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Read GOG.com and Steam Duke3D install paths from the registry instead of hard-coding the default paths.
git-svn-id: https://svn.eduke32.com/eduke32@3615 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
f96788866c
commit
7e22c6d81c
4 changed files with 40 additions and 9 deletions
|
@ -58,7 +58,7 @@ CFLAGS= /MT /J /nologo $(flags_cl) \
|
||||||
/W2 $(ENGINEOPTS) \
|
/W2 $(ENGINEOPTS) \
|
||||||
/I$(VORBISSDK)\include /DRENDERTYPEWIN=1
|
/I$(VORBISSDK)\include /DRENDERTYPEWIN=1
|
||||||
|
|
||||||
LIBS=user32.lib gdi32.lib shell32.lib winmm.lib ws2_32.lib comctl32.lib \
|
LIBS=user32.lib gdi32.lib shell32.lib winmm.lib ws2_32.lib comctl32.lib shlwapi.lib \
|
||||||
vorbisfile_static.lib vorbis_static.lib ogg_static.lib dsound.lib advapi32.lib
|
vorbisfile_static.lib vorbis_static.lib ogg_static.lib dsound.lib advapi32.lib
|
||||||
|
|
||||||
LIBS=/NODEFAULTLIB:glu32.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.lib /NODEFAULTLIB:libcmt.lib \
|
LIBS=/NODEFAULTLIB:glu32.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.lib /NODEFAULTLIB:libcmt.lib \
|
||||||
|
|
|
@ -106,7 +106,7 @@ ifeq ($(PLATFORM),WINDOWS)
|
||||||
SDL_FRAMEWORK=1
|
SDL_FRAMEWORK=1
|
||||||
BUILDCOMMONFLAGS+= -DHAVE_INTTYPES
|
BUILDCOMMONFLAGS+= -DHAVE_INTTYPES
|
||||||
EXESUFFIX=.exe
|
EXESUFFIX=.exe
|
||||||
BUILDLIBS+= -Wl,--enable-auto-import -mwindows -lmingwex -lcomctl32 -lwinmm $(L_SSP) -lwsock32 -lws2_32
|
BUILDLIBS+= -Wl,--enable-auto-import -mwindows -lmingwex -lcomctl32 -lwinmm $(L_SSP) -lwsock32 -lws2_32 -lshlwapi
|
||||||
#-lshfolder
|
#-lshfolder
|
||||||
#BUILDLIBDIRS+= -L$(ENETROOT)
|
#BUILDLIBDIRS+= -L$(ENETROOT)
|
||||||
#STDCPPLIB:=-lstdc++
|
#STDCPPLIB:=-lstdc++
|
||||||
|
|
|
@ -318,27 +318,41 @@ int32_t addsearchpath(const char *p)
|
||||||
struct Bstat st;
|
struct Bstat st;
|
||||||
char *s;
|
char *s;
|
||||||
searchpath_t *srch;
|
searchpath_t *srch;
|
||||||
|
char *path = Bstrdup(p);
|
||||||
|
|
||||||
if (Bstat(p, &st) < 0)
|
if (path[Bstrlen(path)-1] == '\\')
|
||||||
|
path[Bstrlen(path)-1] = 0; // hack for stat() returning ENOENT on paths ending in \
|
||||||
|
|
||||||
|
if (Bstat(path, &st) < 0)
|
||||||
{
|
{
|
||||||
|
Bfree(path);
|
||||||
if (errno == ENOENT) return -2;
|
if (errno == ENOENT) return -2;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!(st.st_mode & BS_IFDIR)) return -1;
|
if (!(st.st_mode & BS_IFDIR))
|
||||||
|
{
|
||||||
|
Bfree(path);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
srch = (searchpath_t *)Bmalloc(sizeof(searchpath_t));
|
srch = (searchpath_t *)Bmalloc(sizeof(searchpath_t));
|
||||||
if (!srch) return -1;
|
if (!srch)
|
||||||
|
{
|
||||||
|
Bfree(path);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
srch->next = searchpathhead;
|
srch->next = searchpathhead;
|
||||||
srch->pathlen = Bstrlen(p)+1;
|
srch->pathlen = Bstrlen(path)+1;
|
||||||
srch->path = (char *)Bmalloc(srch->pathlen + 1);
|
srch->path = (char *)Bmalloc(srch->pathlen + 1);
|
||||||
if (!srch->path)
|
if (!srch->path)
|
||||||
{
|
{
|
||||||
|
Bfree(path);
|
||||||
Bfree(srch);
|
Bfree(srch);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bstrcpy(srch->path, p);
|
Bstrcpy(srch->path, path);
|
||||||
for (s=srch->path; *s; s++)
|
for (s=srch->path; *s; s++)
|
||||||
{
|
{
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
|
@ -355,6 +369,7 @@ int32_t addsearchpath(const char *p)
|
||||||
|
|
||||||
initprintf("Using %s for game data\n", srch->path);
|
initprintf("Using %s for game data\n", srch->path);
|
||||||
|
|
||||||
|
Bfree(path);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# include "winbits.h"
|
# include "winbits.h"
|
||||||
|
#include <shlwapi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
@ -227,8 +228,23 @@ void G_AddSearchPaths(void)
|
||||||
addsearchpath("/Library/Application Support/JFDuke3D");
|
addsearchpath("/Library/Application Support/JFDuke3D");
|
||||||
addsearchpath("/Library/Application Support/EDuke32");
|
addsearchpath("/Library/Application Support/EDuke32");
|
||||||
#elif defined (_WIN32)
|
#elif defined (_WIN32)
|
||||||
addsearchpath_ProgramFiles("GOG.com/Duke Nukem 3D");
|
// detect Steam and GOG versions of Duke3D
|
||||||
addsearchpath_ProgramFiles("Steam/SteamApps/common/Duke Nukem 3D/gameroot");
|
char buf[BMAX_PATH];
|
||||||
|
int32_t siz = BMAX_PATH, ret;
|
||||||
|
|
||||||
|
ret = SHGetValueA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Steam App 225140", "InstallLocation", NULL, buf, (LPDWORD)&siz);
|
||||||
|
|
||||||
|
if (ret == ERROR_SUCCESS)
|
||||||
|
Bstrcat(buf, "/gameroot");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
siz = BMAX_PATH;
|
||||||
|
ret = SHGetValueA(HKEY_LOCAL_MACHINE, "SOFTWARE\\GOG.com\\GOGDUKE3D", "PATH", NULL, buf, (LPDWORD)&siz);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret == ERROR_SUCCESS)
|
||||||
|
addsearchpath(buf);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue