mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-13 07:58:04 +00:00
Windows: Detect installation paths of 3DR's Duke Nukem 3D package, the 3DR Anthology, and the NAM Steam release.
git-svn-id: https://svn.eduke32.com/eduke32@4790 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
47d3f07ccf
commit
80ed260c1a
2 changed files with 57 additions and 9 deletions
|
@ -518,7 +518,7 @@ void G_ExtPostStartupWindow(int32_t autoload)
|
||||||
const char * G_GetInstallPath(int32_t insttype)
|
const char * G_GetInstallPath(int32_t insttype)
|
||||||
{
|
{
|
||||||
static char spath[NUMINSTPATHS][BMAX_PATH];
|
static char spath[NUMINSTPATHS][BMAX_PATH];
|
||||||
static int32_t success[NUMINSTPATHS] = { -1, -1 };
|
static int32_t success[NUMINSTPATHS] = { -1, -1, -1, -1, -1 };
|
||||||
int32_t siz = BMAX_PATH;
|
int32_t siz = BMAX_PATH;
|
||||||
|
|
||||||
if (success[insttype] == -1)
|
if (success[insttype] == -1)
|
||||||
|
@ -531,12 +531,21 @@ const char * G_GetInstallPath(int32_t insttype)
|
||||||
{
|
{
|
||||||
switch (insttype)
|
switch (insttype)
|
||||||
{
|
{
|
||||||
case INSTPATH_STEAM:
|
case INSTPATH_STEAM_DUKE3D:
|
||||||
success[insttype] = SHGetValueA(HKLM32, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Steam App 225140", "InstallLocation", NULL, spath[insttype], (LPDWORD)&siz);
|
success[insttype] = SHGetValueA(HKLM32, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Steam App 225140", "InstallLocation", NULL, spath[insttype], (LPDWORD)&siz);
|
||||||
break;
|
break;
|
||||||
case INSTPATH_GOG:
|
case INSTPATH_GOG_DUKE3D:
|
||||||
success[insttype] = SHGetValueA(HKLM32, "SOFTWARE\\GOG.com\\GOGDUKE3D", "PATH", NULL, spath[insttype], (LPDWORD)&siz);
|
success[insttype] = SHGetValueA(HKLM32, "SOFTWARE\\GOG.com\\GOGDUKE3D", "PATH", NULL, spath[insttype], (LPDWORD)&siz);
|
||||||
break;
|
break;
|
||||||
|
case INSTPATH_3DR_DUKE3D:
|
||||||
|
success[insttype] = SHGetValueA(HKLM32, "SOFTWARE\\3DRealms\\Duke Nukem 3D", NULL, NULL, spath[insttype], (LPDWORD)&siz);
|
||||||
|
break;
|
||||||
|
case INSTPATH_3DR_ANTH:
|
||||||
|
success[insttype] = SHGetValueA(HKLM32, "SOFTWARE\\3DRealms\\Anthology", NULL, NULL, spath[insttype], (LPDWORD)&siz);
|
||||||
|
break;
|
||||||
|
case INSTPATH_STEAM_NAM:
|
||||||
|
success[insttype] = SHGetValueA(HKLM32, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Steam App 329650", "InstallLocation", NULL, spath[insttype], (LPDWORD)&siz);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
RegCloseKey(HKLM32);
|
RegCloseKey(HKLM32);
|
||||||
|
@ -611,7 +620,7 @@ void G_AddSearchPaths(void)
|
||||||
char buf[BMAX_PATH];
|
char buf[BMAX_PATH];
|
||||||
const char* instpath;
|
const char* instpath;
|
||||||
|
|
||||||
if ((instpath = G_GetInstallPath(INSTPATH_STEAM)))
|
if ((instpath = G_GetInstallPath(INSTPATH_STEAM_DUKE3D)))
|
||||||
{
|
{
|
||||||
Bsnprintf(buf, sizeof(buf), "%s/gameroot", instpath);
|
Bsnprintf(buf, sizeof(buf), "%s/gameroot", instpath);
|
||||||
addsearchpath(buf);
|
addsearchpath(buf);
|
||||||
|
@ -626,8 +635,26 @@ void G_AddSearchPaths(void)
|
||||||
addsearchpath(buf);
|
addsearchpath(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((instpath = G_GetInstallPath(INSTPATH_GOG)))
|
if ((instpath = G_GetInstallPath(INSTPATH_GOG_DUKE3D)))
|
||||||
addsearchpath(instpath);
|
addsearchpath(instpath);
|
||||||
|
|
||||||
|
if ((instpath = G_GetInstallPath(INSTPATH_3DR_DUKE3D)))
|
||||||
|
{
|
||||||
|
Bsnprintf(buf, sizeof(buf), "%s/Duke Nukem 3D", instpath);
|
||||||
|
addsearchpath(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((instpath = G_GetInstallPath(INSTPATH_3DR_ANTH)))
|
||||||
|
{
|
||||||
|
Bsnprintf(buf, sizeof(buf), "%s/Duke Nukem 3D", instpath);
|
||||||
|
addsearchpath(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((instpath = G_GetInstallPath(INSTPATH_STEAM_NAM)))
|
||||||
|
{
|
||||||
|
Bsnprintf(buf, sizeof(buf), "%s/NAM", instpath);
|
||||||
|
addsearchpath(buf);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -637,7 +664,7 @@ void G_CleanupSearchPaths(void)
|
||||||
char buf[BMAX_PATH];
|
char buf[BMAX_PATH];
|
||||||
const char* instpath;
|
const char* instpath;
|
||||||
|
|
||||||
if ((instpath = G_GetInstallPath(INSTPATH_STEAM)))
|
if ((instpath = G_GetInstallPath(INSTPATH_STEAM_DUKE3D)))
|
||||||
{
|
{
|
||||||
Bsnprintf(buf, sizeof(buf), "%s/gameroot", instpath);
|
Bsnprintf(buf, sizeof(buf), "%s/gameroot", instpath);
|
||||||
removesearchpath(buf);
|
removesearchpath(buf);
|
||||||
|
@ -652,8 +679,26 @@ void G_CleanupSearchPaths(void)
|
||||||
removesearchpath(buf);
|
removesearchpath(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((instpath = G_GetInstallPath(INSTPATH_GOG)))
|
if ((instpath = G_GetInstallPath(INSTPATH_GOG_DUKE3D)))
|
||||||
removesearchpath(instpath);
|
removesearchpath(instpath);
|
||||||
|
|
||||||
|
if ((instpath = G_GetInstallPath(INSTPATH_3DR_DUKE3D)))
|
||||||
|
{
|
||||||
|
Bsnprintf(buf, sizeof(buf), "%s/Duke Nukem 3D", instpath);
|
||||||
|
removesearchpath(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((instpath = G_GetInstallPath(INSTPATH_3DR_ANTH)))
|
||||||
|
{
|
||||||
|
Bsnprintf(buf, sizeof(buf), "%s/Duke Nukem 3D", instpath);
|
||||||
|
removesearchpath(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_gameType != GAMEFLAG_NAM && (instpath = G_GetInstallPath(INSTPATH_STEAM_NAM)))
|
||||||
|
{
|
||||||
|
Bsnprintf(buf, sizeof(buf), "%s/NAM", instpath);
|
||||||
|
removesearchpath(buf);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,8 +42,11 @@ enum Games_t {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum instpath_t {
|
enum instpath_t {
|
||||||
INSTPATH_STEAM,
|
INSTPATH_STEAM_DUKE3D,
|
||||||
INSTPATH_GOG,
|
INSTPATH_GOG_DUKE3D,
|
||||||
|
INSTPATH_3DR_DUKE3D,
|
||||||
|
INSTPATH_3DR_ANTH,
|
||||||
|
INSTPATH_STEAM_NAM,
|
||||||
NUMINSTPATHS
|
NUMINSTPATHS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue