mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-15 08:41:59 +00:00
- 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
|
@ -1,4 +1,10 @@
|
|||
December 6, 2007
|
||||
- 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.
|
||||
- Fixed: The FLAC/makefile.mgw should use md5.o as an OBJ, not md5.c.
|
||||
- Fixed: The Linux makefile probably shouldn't be using the bundled zlib headers,
|
||||
either.
|
||||
|
|
|
@ -1629,6 +1629,26 @@ static EIWADType IdentifyVersion (const char *zdoom_wad)
|
|||
}
|
||||
}
|
||||
}
|
||||
#ifdef _WIN32
|
||||
FString steam_path = I_GetSteamPath();
|
||||
if (steam_path.IsNotEmpty())
|
||||
{
|
||||
static const char *const steam_dirs[] =
|
||||
{
|
||||
"doom 2/base",
|
||||
"final doom/base",
|
||||
"heretic shadow of the serpent riders/base",
|
||||
"hexen/base",
|
||||
"hexen deathkings of the dark citadel/base",
|
||||
"ultimate doom/base"
|
||||
};
|
||||
steam_path += "/SteamApps/common/";
|
||||
for (i = 0; i < countof(steam_dirs); ++i)
|
||||
{
|
||||
CheckIWAD (steam_path + steam_dirs[i], wads);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (iwadparm != NULL && !wads[0].Path.IsEmpty())
|
||||
|
@ -1636,7 +1656,7 @@ static EIWADType IdentifyVersion (const char *zdoom_wad)
|
|||
iwadparmfound = true;
|
||||
}
|
||||
|
||||
for (i = numwads = 0; i < sizeof(IWADNames)/sizeof(char *); i++)
|
||||
for (i = numwads = 0; i < countof(IWADNames); i++)
|
||||
{
|
||||
if (!wads[i].Path.IsEmpty())
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -207,6 +207,10 @@ extern const IWADInfo *DoomStartupInfo;
|
|||
// [RH] Used by the display code to set the normal window procedure
|
||||
void I_SetWndProc();
|
||||
|
||||
// [RH] Checks the registry for Steam's install path, so we can scan its
|
||||
// directories for IWADs if the user purchased any through Steam.
|
||||
FString I_GetSteamPath();
|
||||
|
||||
// Damn Microsoft for doing Get/SetWindowLongPtr half-assed. Instead of
|
||||
// giving them proper prototypes under Win32, they are just macros for
|
||||
// Get/SetWindowLong, meaning they take LONGs and not LONG_PTRs.
|
||||
|
|
|
@ -156,6 +156,15 @@ FString::~FString ()
|
|||
Data()->Release();
|
||||
}
|
||||
|
||||
char *FString::LockNewBuffer(size_t len)
|
||||
{
|
||||
Data()->Release();
|
||||
AllocBuffer(len);
|
||||
assert(Data()->RefCount == 1);
|
||||
Data()->RefCount = -1;
|
||||
return Chars;
|
||||
}
|
||||
|
||||
char *FString::LockBuffer()
|
||||
{
|
||||
if (Data()->RefCount == 1)
|
||||
|
|
|
@ -130,6 +130,9 @@ public:
|
|||
|
||||
~FString ();
|
||||
|
||||
// Discard string's contents, create a new buffer, and lock it.
|
||||
char *LockNewBuffer(size_t len);
|
||||
|
||||
char *LockBuffer(); // Obtain write access to the character buffer
|
||||
void UnlockBuffer(); // Allow shared access to the character buffer
|
||||
|
||||
|
@ -232,6 +235,7 @@ public:
|
|||
|
||||
size_t Len() const { return Data()->Len; }
|
||||
bool IsEmpty() const { return Len() == 0; }
|
||||
bool IsNotEmpty() const { return Len() != 0; }
|
||||
|
||||
void Truncate (long newlen);
|
||||
|
||||
|
|
Loading…
Reference in a new issue