- New: On Windows, the game now checks the registry to see if you have Steam
installed. If so, it checks your SteamApps directory for any IWADs you may have purchased through Steam and adds any it finds to the list of available IWADs you can play. This means that if you bought your id games through Steam, you can just extract ZDoom anywhere you like and run it without doing any additional setup. SVN r581 (trunk)
This commit is contained in:
parent
1eca84d644
commit
1dede60c5c
6 changed files with 86 additions and 1 deletions
|
|
@ -793,3 +793,45 @@ int I_FindClose (void *handle)
|
|||
{
|
||||
return FindClose ((HANDLE)handle);
|
||||
}
|
||||
|
||||
static bool QueryPathKey(HKEY key, const char *keypath, const char *valname, FString &value)
|
||||
{
|
||||
HKEY steamkey;
|
||||
DWORD pathtype;
|
||||
DWORD pathlen;
|
||||
LONG res;
|
||||
|
||||
if(ERROR_SUCCESS == RegOpenKeyEx(key, keypath, 0, KEY_QUERY_VALUE, &steamkey))
|
||||
{
|
||||
if (ERROR_SUCCESS == RegQueryValueEx(steamkey, valname, 0, &pathtype, NULL, &pathlen) &&
|
||||
pathtype == REG_SZ && pathlen != 0)
|
||||
{
|
||||
// Don't include terminating null in count
|
||||
char *chars = value.LockNewBuffer(pathlen - 1);
|
||||
res = RegQueryValueEx(steamkey, valname, 0, NULL, (LPBYTE)chars, &pathlen);
|
||||
value.UnlockBuffer();
|
||||
if (res != ERROR_SUCCESS)
|
||||
{
|
||||
value = "";
|
||||
}
|
||||
}
|
||||
RegCloseKey(steamkey);
|
||||
}
|
||||
return value.IsNotEmpty();
|
||||
}
|
||||
|
||||
FString I_GetSteamPath()
|
||||
{
|
||||
FString path;
|
||||
|
||||
if (QueryPathKey(HKEY_CURRENT_USER, "Software\\Valve\\Steam", "SteamPath", path))
|
||||
{
|
||||
return path;
|
||||
}
|
||||
if (QueryPathKey(HKEY_LOCAL_MACHINE, "Software\\Valve\\Steam", "InstallPath", path))
|
||||
{
|
||||
return path;
|
||||
}
|
||||
path = "";
|
||||
return path;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue