Detect GOG install path

This commit is contained in:
Max Crofts committed 2017-04-07 16:26:26 +10:00
1 parent f5143405f1
commit 7ff610db35
5 files changed
+94 -4

No files matched your search

+14
View File
@@ -47,6 +47,9 @@ static char homePath[ MAX_OSPATH ] = { 0 };
// Used to store the Steam Quake 3 installation path
static char steamPath[ MAX_OSPATH ] = { 0 };
// Used to store the GOG Quake 3 installation path
static char gogPath[ MAX_OSPATH ] = { 0 };
/*
==================
Sys_DefaultHomePath
@@ -106,6 +109,17 @@ char *Sys_SteamPath( void )
return steamPath;
}
/*
================
Sys_GogPath
================
*/
char *Sys_GogPath( void )
{
// GOG also doesn't let you install Quake 3 on Mac/Linux
return gogPath;
}
/*
================
Sys_Milliseconds
+35
View File
@@ -45,6 +45,9 @@ static char homePath[ MAX_OSPATH ] = { 0 };
// Used to store the Steam Quake 3 installation path
static char steamPath[ MAX_OSPATH ] = { 0 };
// Used to store the GOG Quake 3 installation path
static char gogPath[ MAX_OSPATH ] = { 0 };
#ifndef DEDICATED
static UINT timerResolution = 0;
#endif
@@ -183,6 +186,38 @@ char *Sys_SteamPath( void )
return steamPath;
}
/*
================
Sys_GogPath
================
*/
char *Sys_GogPath( void )
{
#ifdef GOGPATH_ID
HKEY gogRegKey;
DWORD pathLen = MAX_OSPATH;
if (!gogPath[0] && !RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\GOG.com\\Games\\" GOGPATH_ID, 0, KEY_QUERY_VALUE | KEY_WOW64_32KEY, &gogRegKey))
{
pathLen = MAX_OSPATH;
if (RegQueryValueEx(gogRegKey, "PATH", NULL, NULL, (LPBYTE)gogPath, &pathLen))
gogPath[0] = '\0';
RegCloseKey(gogRegKey);
}
if (gogPath[0])
{
if (pathLen == MAX_OSPATH)
pathLen--;
gogPath[pathLen] = '\0';
}
#endif
return gogPath;
}
/*
================
Sys_Milliseconds