Duke3D/Startup: Autodetect the installation path of the World War II GI release on Steam. Windows and Linux only for now, as there appears to be no OS X support.

git-svn-id: https://svn.eduke32.com/eduke32@5454 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2015-11-25 12:08:37 +00:00
parent 0433d97a54
commit ff12dd11f4
2 changed files with 20 additions and 0 deletions

View file

@ -572,6 +572,10 @@ static void G_AddSteamPaths(const char *basepath)
Bsnprintf(buf, sizeof(buf), "%s/steamapps/common/Nam/NAM", basepath);
#endif
addsearchpath_user(buf, SEARCHPATH_NAM);
// WWII GI (Steam)
Bsnprintf(buf, sizeof(buf), "%s/steamapps/common/World War II GI/WW2GI", basepath);
addsearchpath_user(buf, SEARCHPATH_WW2GI);
}
// A bare-bones "parser" for Valve's KeyValues VDF format.
@ -863,6 +867,17 @@ void G_AddSearchPaths(void)
Bstrncpy(suffix, "/NAM", remaining);
addsearchpath_user(buf, SEARCHPATH_NAM);
}
// WWII GI (Steam)
bufsize = sizeof(buf);
if (G_ReadRegistryValue("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Steam App 376750", "InstallLocation", buf, &bufsize))
{
char * const suffix = buf + bufsize - 1;
DWORD const remaining = sizeof(buf) - bufsize;
Bstrncpy(suffix, "/WW2GI", remaining);
addsearchpath_user(buf, SEARCHPATH_WW2GI);
}
#endif
}
@ -872,6 +887,9 @@ void G_CleanupSearchPaths(void)
if (!NAM)
removesearchpaths_withuser(SEARCHPATH_NAM);
if (!WW2GI)
removesearchpaths_withuser(SEARCHPATH_WW2GI);
}
//////////

View file

@ -53,12 +53,14 @@ enum instpath_t {
INSTPATH_3DR_DUKE3D,
INSTPATH_3DR_ANTH,
INSTPATH_STEAM_NAM,
INSTPATH_STEAM_WW2GI,
NUMINSTPATHS
};
enum searchpathtypes_t {
SEARCHPATH_REMOVE = 1<<0,
SEARCHPATH_NAM = 1<<1,
SEARCHPATH_WW2GI = 1<<2,
};
typedef enum basepal_ {