mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
Fix reading the GOG and Steam paths for Win64 builds.
git-svn-id: https://svn.eduke32.com/eduke32@3671 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
33ab42e7b4
commit
670ede9f60
1 changed files with 31 additions and 21 deletions
|
@ -12,7 +12,11 @@
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# include "winbits.h"
|
# include "winbits.h"
|
||||||
#include <shlwapi.h>
|
# include <shlwapi.h>
|
||||||
|
# include <winnt.h>
|
||||||
|
# ifndef KEY_WOW64_32KEY
|
||||||
|
# define KEY_WOW64_32KEY 0x0200
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
@ -226,18 +230,22 @@ const char * G_GetInstallPath(int32_t insttype)
|
||||||
static int32_t success[NUMINSTPATHS] = { -1, -1 };
|
static int32_t success[NUMINSTPATHS] = { -1, -1 };
|
||||||
int32_t siz = BMAX_PATH;
|
int32_t siz = BMAX_PATH;
|
||||||
|
|
||||||
// this still needs to be fixed for win64 builds
|
|
||||||
if (success[insttype] == -1)
|
if (success[insttype] == -1)
|
||||||
{
|
{
|
||||||
switch (insttype)
|
HKEY HKLM32;
|
||||||
{
|
LONG keygood = RegOpenKeyEx(HKEY_LOCAL_MACHINE, NULL, 0, KEY_READ | KEY_WOW64_32KEY, &HKLM32);
|
||||||
case INSTPATH_STEAM:
|
// KEY_WOW64_32KEY gets us around Wow6432Node on 64-bit builds
|
||||||
success[insttype] = SHGetValueA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Steam App 225140", "InstallLocation", NULL, spath[insttype], (LPDWORD)&siz);
|
|
||||||
break;
|
if (keygood == ERROR_SUCCESS)
|
||||||
case INSTPATH_GOG:
|
switch (insttype)
|
||||||
success[insttype] = SHGetValueA(HKEY_LOCAL_MACHINE, "SOFTWARE\\GOG.com\\GOGDUKE3D", "PATH", NULL, spath[insttype], (LPDWORD)&siz);
|
{
|
||||||
break;
|
case INSTPATH_STEAM:
|
||||||
}
|
success[insttype] = SHGetValueA(HKLM32, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Steam App 225140", "InstallLocation", NULL, spath[insttype], (LPDWORD)&siz);
|
||||||
|
break;
|
||||||
|
case INSTPATH_GOG:
|
||||||
|
success[insttype] = SHGetValueA(HKLM32, "SOFTWARE\\GOG.com\\GOGDUKE3D", "PATH", NULL, spath[insttype], (LPDWORD)&siz);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success[insttype] == ERROR_SUCCESS)
|
if (success[insttype] == ERROR_SUCCESS)
|
||||||
|
@ -260,18 +268,19 @@ void G_AddSearchPaths(void)
|
||||||
#elif defined (_WIN32)
|
#elif defined (_WIN32)
|
||||||
// detect Steam and GOG versions of Duke3D
|
// detect Steam and GOG versions of Duke3D
|
||||||
char buf[BMAX_PATH];
|
char buf[BMAX_PATH];
|
||||||
|
const char* instpath;
|
||||||
|
|
||||||
if (G_GetInstallPath(INSTPATH_STEAM))
|
if ((instpath = G_GetInstallPath(INSTPATH_STEAM)))
|
||||||
{
|
{
|
||||||
Bsprintf(buf, "%s/gameroot", G_GetInstallPath(INSTPATH_STEAM));
|
Bsprintf(buf, "%s/gameroot", instpath);
|
||||||
addsearchpath(buf);
|
addsearchpath(buf);
|
||||||
|
|
||||||
Bsprintf(buf, "%s/gameroot/addons", G_GetInstallPath(INSTPATH_STEAM));
|
Bsprintf(buf, "%s/gameroot/addons", instpath);
|
||||||
addsearchpath(buf);
|
addsearchpath(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (G_GetInstallPath(INSTPATH_GOG))
|
if ((instpath = G_GetInstallPath(INSTPATH_GOG)))
|
||||||
addsearchpath(G_GetInstallPath(INSTPATH_GOG));
|
addsearchpath(instpath);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,18 +288,19 @@ void G_CleanupSearchPaths(void)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
char buf[BMAX_PATH];
|
char buf[BMAX_PATH];
|
||||||
|
const char* instpath;
|
||||||
|
|
||||||
if (G_GetInstallPath(INSTPATH_STEAM))
|
if ((instpath = G_GetInstallPath(INSTPATH_STEAM)))
|
||||||
{
|
{
|
||||||
Bsprintf(buf, "%s/gameroot", G_GetInstallPath(INSTPATH_STEAM));
|
Bsprintf(buf, "%s/gameroot", instpath);
|
||||||
removesearchpath(buf);
|
removesearchpath(buf);
|
||||||
|
|
||||||
Bsprintf(buf, "%s/gameroot/addons", G_GetInstallPath(INSTPATH_STEAM));
|
Bsprintf(buf, "%s/gameroot/addons", instpath);
|
||||||
removesearchpath(buf);
|
removesearchpath(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (G_GetInstallPath(INSTPATH_GOG))
|
if ((instpath = G_GetInstallPath(INSTPATH_GOG)))
|
||||||
removesearchpath(G_GetInstallPath(INSTPATH_GOG));
|
removesearchpath(instpath);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue