From ff12dd11f474ef6f356b169ac69af4cf5f70647f Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Wed, 25 Nov 2015 12:08:37 +0000 Subject: [PATCH] Duke3D/Startup: Autodetect the installation path of the World War II GI release on Steam. Windows and Linux only for now, as there appears to be no OS X support. git-svn-id: https://svn.eduke32.com/eduke32@5454 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/common.c | 18 ++++++++++++++++++ polymer/eduke32/source/common_game.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/polymer/eduke32/source/common.c b/polymer/eduke32/source/common.c index c81669976..bee6c1bfb 100644 --- a/polymer/eduke32/source/common.c +++ b/polymer/eduke32/source/common.c @@ -572,6 +572,10 @@ static void G_AddSteamPaths(const char *basepath) Bsnprintf(buf, sizeof(buf), "%s/steamapps/common/Nam/NAM", basepath); #endif addsearchpath_user(buf, SEARCHPATH_NAM); + + // WWII GI (Steam) + Bsnprintf(buf, sizeof(buf), "%s/steamapps/common/World War II GI/WW2GI", basepath); + addsearchpath_user(buf, SEARCHPATH_WW2GI); } // A bare-bones "parser" for Valve's KeyValues VDF format. @@ -863,6 +867,17 @@ void G_AddSearchPaths(void) Bstrncpy(suffix, "/NAM", remaining); addsearchpath_user(buf, SEARCHPATH_NAM); } + + // WWII GI (Steam) + bufsize = sizeof(buf); + if (G_ReadRegistryValue("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Steam App 376750", "InstallLocation", buf, &bufsize)) + { + char * const suffix = buf + bufsize - 1; + DWORD const remaining = sizeof(buf) - bufsize; + + Bstrncpy(suffix, "/WW2GI", remaining); + addsearchpath_user(buf, SEARCHPATH_WW2GI); + } #endif } @@ -872,6 +887,9 @@ void G_CleanupSearchPaths(void) if (!NAM) removesearchpaths_withuser(SEARCHPATH_NAM); + + if (!WW2GI) + removesearchpaths_withuser(SEARCHPATH_WW2GI); } ////////// diff --git a/polymer/eduke32/source/common_game.h b/polymer/eduke32/source/common_game.h index 9989b1389..ecf23b526 100644 --- a/polymer/eduke32/source/common_game.h +++ b/polymer/eduke32/source/common_game.h @@ -53,12 +53,14 @@ enum instpath_t { INSTPATH_3DR_DUKE3D, INSTPATH_3DR_ANTH, INSTPATH_STEAM_NAM, + INSTPATH_STEAM_WW2GI, NUMINSTPATHS }; enum searchpathtypes_t { SEARCHPATH_REMOVE = 1<<0, SEARCHPATH_NAM = 1<<1, + SEARCHPATH_WW2GI = 1<<2, }; typedef enum basepal_ {