Use Windows uninstall path to find Steam Quake 3 install.

Thanks Pan- and Ensiform for pointing this out.
This commit is contained in:
SmileTheory 2015-09-25 04:55:41 -07:00
parent 3bd7a8d842
commit 2f77a98afe
2 changed files with 36 additions and 11 deletions

View file

@ -136,29 +136,52 @@ Sys_SteamPath
*/
char *Sys_SteamPath( void )
{
#ifdef STEAMPATH_NAME
#if defined(STEAMPATH_NAME) || defined(STEAMPATH_APPID)
HKEY steamRegKey;
DWORD pathLen = MAX_OSPATH;
qboolean finishPath = qfalse;
#endif
if (!RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Valve\\Steam", 0, KEY_QUERY_VALUE, &steamRegKey))
#ifdef STEAMPATH_APPID
if (!steamPath[0] && !RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Steam App " STEAMPATH_APPID, 0, KEY_QUERY_VALUE, &steamRegKey))
{
DWORD pathLen = MAX_OSPATH;
pathLen = MAX_OSPATH;
if (RegQueryValueEx(steamRegKey, "InstallLocation", NULL, NULL, (LPBYTE)steamPath, &pathLen))
steamPath[0] = '\0';
}
if (!steamPath[0] && !RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Steam App " STEAMPATH_APPID, 0, KEY_QUERY_VALUE, &steamRegKey))
{
pathLen = MAX_OSPATH;
if (RegQueryValueEx(steamRegKey, "InstallLocation", NULL, NULL, (LPBYTE)steamPath, &pathLen))
steamPath[0] = '\0';
}
#endif
#ifdef STEAMPATH_NAME
if (!steamPath[0] && !RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Valve\\Steam", 0, KEY_QUERY_VALUE, &steamRegKey))
{
pathLen = MAX_OSPATH;
if (RegQueryValueEx(steamRegKey, "SteamPath", NULL, NULL, (LPBYTE)steamPath, &pathLen))
if (RegQueryValueEx(steamRegKey, "InstallPath", NULL, NULL, (LPBYTE)steamPath, &pathLen))
steamPath[0] = '\0';
if (steamPath[0])
{
if (pathLen == MAX_OSPATH)
pathLen--;
steamPath[pathLen] = '\0';
Q_strcat(steamPath, MAX_OSPATH, "\\SteamApps\\common\\" STEAMPATH_NAME );
}
finishPath = qtrue;
}
#endif
if (steamPath[0])
{
if (pathLen == MAX_OSPATH)
pathLen--;
steamPath[pathLen] = '\0';
if (finishPath)
Q_strcat(steamPath, MAX_OSPATH, "\\SteamApps\\common\\" STEAMPATH_NAME );
}
return steamPath;
}