ref: ae1aeffdfe96a0ee9ea8f8b11914a79e1a0e0b15
parent: 1821d8bdd335307de1455ad4342c58ad4841b123
author: Mike Swanson <mikeonthecomputer@gmail.com>
date: Fri Aug 28 20:58:10 EDT 2015
Search GOG.com installation directories for IWADs The game is sold on GOG.com now for the Windows platform. This should add support for finding the IWADs installed through it. I've repurposed the Collector's Edition functions for this, the basic principle for finding the directories is the same between the two, and it keeps the code duplication low. resolves #600
--- a/src/d_iwad.c
+++ b/src/d_iwad.c
@@ -142,22 +142,53 @@
},
};
-// Value installed by the Collector's Edition when it is installed
+// Values installed by the GOG.com and Collector's Edition versions
-static registry_value_t collectors_edition_value =
+static registry_value_t gogcom_collectors_edition_values[] =
{
- HKEY_LOCAL_MACHINE,
- SOFTWARE_KEY "\\Activision\\DOOM Collector's Edition\\v1.0",
- "INSTALLPATH",
+ // Doom Collector's Edition
+
+ {
+ HKEY_LOCAL_MACHINE,
+ SOFTWARE_KEY "\\Activision\\DOOM Collector's Edition\\v1.0",
+ "INSTALLPATH",
+ },
+
+ // Ultimate Doom
+
+ {
+ HKEY_LOCAL_MACHINE,
+ SOFTWARE_KEY "\\GOG.com\\Games\\1435827232",
+ "PATH",
+ },
+
+ // Doom II
+
+ {
+ HKEY_LOCAL_MACHINE,
+ SOFTWARE_KEY "\\GOG.com\\Games\\1435848814",
+ "PATH",
+ },
+
+ // Final Doom
+
+ {
+ HKEY_LOCAL_MACHINE,
+ SOFTWARE_KEY "\\GOG.com\\Games\\1435848742",
+ "PATH",
+ },
};
// Subdirectories of the above install path, where IWADs are installed.
-static char *collectors_edition_subdirs[] =
+static char *gogcom_collectors_edition_subdirs[] =
{
+ ".",
"Doom2",
"Final Doom",
"Ultimate Doom",
+ "TNT",
+ "Plutonia",
};
// Location where Steam is installed
@@ -268,30 +299,34 @@
}
}
-// Check for Doom: Collector's Edition
+// Check for GOG.com and Doom: Collector's Edition
-static void CheckCollectorsEdition(void)
+static void CheckGOGcomCollectorsEdition(void)
{
- char *install_path;
- char *subpath;
unsigned int i;
- install_path = GetRegistryString(&collectors_edition_value);
-
- if (install_path == NULL)
+ for (i=0; i<arrlen(gogcom_collectors_edition_values); ++i)
{
- return;
- }
+ char *install_path;
+ char *subpath;
+ unsigned int j;
- for (i=0; i<arrlen(collectors_edition_subdirs); ++i)
- {
- subpath = M_StringJoin(install_path, DIR_SEPARATOR_S,
- collectors_edition_subdirs[i], NULL);
+ install_path = GetRegistryString(&gogcom_collectors_edition_values[i]);
- AddIWADDir(subpath);
- }
+ if (install_path == NULL)
+ {
+ continue;
+ }
- free(install_path);
+ for (j=0; j<arrlen(gogcom_collectors_edition_subdirs); ++j)
+ {
+ subpath = M_StringJoin(install_path, DIR_SEPARATOR_S,
+ gogcom_collectors_edition_subdirs[j], NULL);
+ AddIWADDir(subpath);
+ }
+
+ free(install_path);
+ }
}
@@ -635,7 +670,7 @@
// Search the registry and find where IWADs have been installed.
CheckUninstallStrings();
- CheckCollectorsEdition();
+ CheckGOGcomCollectorsEdition();
CheckSteamEdition();
CheckDOSDefaults();