From 309a199f761549c53219e88a1040948a1b9a71f9 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Tue, 7 Aug 2007 01:19:49 +0000 Subject: Autodetect IWADs installed by Steam. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 945 --- src/d_iwad.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/src/d_iwad.c b/src/d_iwad.c index 320ee835..8f2078c9 100644 --- a/src/d_iwad.c +++ b/src/d_iwad.c @@ -140,6 +140,24 @@ static char *collectors_edition_subdirs[] = "Ultimate Doom", }; +// Location where Steam is installed + +static registry_value_t steam_install_location = +{ + HKEY_LOCAL_MACHINE, + "Software\\Valve\\Steam", + "InstallPath", +}; + +// Subdirs of the steam install directory where IWADs are found + +static char *steam_install_subdirs[] = +{ + "steamapps\\common\\doom 2", + "steamapps\\common\\ultimate doom", + "steamapps\\common\\final doom\\base", +}; + static char *GetRegistryString(registry_value_t *reg_val) { HKEY key; @@ -251,6 +269,41 @@ static void CheckCollectorsEdition(void) free(install_path); } + +// Check for Doom downloaded via Steam + +static void CheckSteamEdition(void) +{ + char *install_path; + char *subpath; + int i; + + install_path = GetRegistryString(&steam_install_location); + + if (install_path == NULL) + { + return; + } + + for (i=0; i