Detect GOG install path
This commit is contained in:
parent
f5143405f1
commit
7ff610db35
5 changed files with 94 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue