diff options
author | Mike Swanson | 2015-08-29 00:58:10 -0700 |
---|---|---|
committer | Mike Swanson | 2015-08-29 16:18:34 -0700 |
commit | dab45778b03b2d3a1b113c5d9116e2060d4d210a (patch) | |
tree | 8ff96452cda8b7438e75a67e416795d867057ebb | |
parent | 07a52d1c61ca6368fe32e9ee7eb06e6eea8d200b (diff) | |
download | chocolate-doom-dab45778b03b2d3a1b113c5d9116e2060d4d210a.tar.gz chocolate-doom-dab45778b03b2d3a1b113c5d9116e2060d4d210a.tar.bz2 chocolate-doom-dab45778b03b2d3a1b113c5d9116e2060d4d210a.zip |
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
-rw-r--r-- | src/d_iwad.c | 81 |
1 files changed, 58 insertions, 23 deletions
diff --git a/src/d_iwad.c b/src/d_iwad.c index 3777bab6..5f938c79 100644 --- a/src/d_iwad.c +++ b/src/d_iwad.c @@ -142,22 +142,53 @@ static registry_value_t uninstall_values[] = }, }; -// 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 @@ static void CheckUninstallStrings(void) } } -// 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 @@ static void BuildIWADDirList(void) // Search the registry and find where IWADs have been installed. CheckUninstallStrings(); - CheckCollectorsEdition(); + CheckGOGcomCollectorsEdition(); CheckSteamEdition(); CheckDOSDefaults(); |