- adjustments for last commit.

This commit is contained in:
Christoph Oelckers 2019-10-30 18:27:52 +01:00
parent 797c79d4a5
commit ea10e01cc3
3 changed files with 17 additions and 51 deletions

View file

@ -12,9 +12,6 @@ FString M_GetScreenshotsPath();
FString M_GetSavegamesPath();
FString M_GetDocumentsPath();
#ifdef _WIN32
int ReadRegistryValue(char const* const SubKey, char const* const Value, char* const Output, unsigned long* OutputSize);
#endif
#ifdef __APPLE__
FString M_GetMacAppSupportPath(const bool create = true);

View file

@ -34,6 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "sc_man.h"
#include "resourcefile.h"
#include "printf.h"
#include "common.h"
#include "gamecontrol.h"
@ -201,8 +202,8 @@ void G_AddExternalSearchPaths(TArray<FString> &searchpaths)
}
}
#elif defined (_WIN32)
#endif
#else
//-------------------------------------------------------------------------
//
//
@ -217,14 +218,14 @@ void G_AddExternalSearchPaths(TArray<FString> &searchpaths)
// Duke Nukem 3D: 20th Anniversary World Tour (Steam)
bufsize = sizeof(buf);
if (ReadRegistryValue(R"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 434050)", "InstallLocation", buf, &bufsize))
if (Paths_ReadRegistryValue(R"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 434050)", "InstallLocation", buf, &bufsize))
{
AddSearchPath(searchpaths, buf);
}
// Duke Nukem 3D: Megaton Edition (Steam)
bufsize = sizeof(buf);
if (ReadRegistryValue(R"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 225140)", "InstallLocation", buf, &bufsize))
if (Paths_ReadRegistryValue(R"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 225140)", "InstallLocation", buf, &bufsize))
{
char * const suffix = buf + bufsize - 1;
size_t const remaining = sizeof(buf) - bufsize;
@ -241,7 +242,7 @@ void G_AddExternalSearchPaths(TArray<FString> &searchpaths)
// Duke Nukem 3D (3D Realms Anthology (Steam) / Kill-A-Ton Collection 2015)
bufsize = sizeof(buf);
if (ReadRegistryValue(R"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 359850)", "InstallLocation", buf, &bufsize))
if (Paths_ReadRegistryValue(R"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 359850)", "InstallLocation", buf, &bufsize))
{
char * const suffix = buf + bufsize - 1;
size_t const remaining = sizeof(buf) - bufsize;
@ -252,14 +253,14 @@ void G_AddExternalSearchPaths(TArray<FString> &searchpaths)
// Duke Nukem 3D: Atomic Edition (GOG.com)
bufsize = sizeof(buf);
if (ReadRegistryValue("SOFTWARE\\GOG.com\\GOGDUKE3D", "PATH", buf, &bufsize))
if (Paths_ReadRegistryValue("SOFTWARE\\GOG.com\\GOGDUKE3D", "PATH", buf, &bufsize))
{
AddSearchPath(searchpaths, buf);
}
// Duke Nukem 3D (3D Realms Anthology)
bufsize = sizeof(buf);
if (ReadRegistryValue("SOFTWARE\\3DRealms\\Duke Nukem 3D", NULL, buf, &bufsize))
if (Paths_ReadRegistryValue("SOFTWARE\\3DRealms\\Duke Nukem 3D", NULL, buf, &bufsize))
{
char * const suffix = buf + bufsize - 1;
size_t const remaining = sizeof(buf) - bufsize;
@ -270,7 +271,7 @@ void G_AddExternalSearchPaths(TArray<FString> &searchpaths)
// 3D Realms Anthology
bufsize = sizeof(buf);
if (ReadRegistryValue("SOFTWARE\\3DRealms\\Anthology", NULL, buf, &bufsize))
if (Paths_ReadRegistryValue("SOFTWARE\\3DRealms\\Anthology", NULL, buf, &bufsize))
{
char * const suffix = buf + bufsize - 1;
size_t const remaining = sizeof(buf) - bufsize;
@ -281,7 +282,7 @@ void G_AddExternalSearchPaths(TArray<FString> &searchpaths)
// NAM (Steam)
bufsize = sizeof(buf);
if (ReadRegistryValue(R"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 329650)", "InstallLocation", buf, &bufsize))
if (Paths_ReadRegistryValue(R"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 329650)", "InstallLocation", buf, &bufsize))
{
char * const suffix = buf + bufsize - 1;
size_t const remaining = sizeof(buf) - bufsize;
@ -292,7 +293,7 @@ void G_AddExternalSearchPaths(TArray<FString> &searchpaths)
// WWII GI (Steam)
bufsize = sizeof(buf);
if (ReadRegistryValue(R"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 376750)", "InstallLocation", buf, &bufsize))
if (Paths_ReadRegistryValue(R"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 376750)", "InstallLocation", buf, &bufsize))
{
char * const suffix = buf + bufsize - 1;
size_t const remaining = sizeof(buf) - bufsize;
@ -303,35 +304,35 @@ void G_AddExternalSearchPaths(TArray<FString> &searchpaths)
// Redneck Rampage (GOG.com)
bufsize = sizeof(buf);
if (ReadRegistryValue("SOFTWARE\\GOG.com\\GOGREDNECKRAMPAGE", "PATH", buf, &bufsize))
if (Paths_ReadRegistryValue("SOFTWARE\\GOG.com\\GOGREDNECKRAMPAGE", "PATH", buf, &bufsize))
{
AddSearchPath(searchpaths, buf);
}
// Redneck Rampage Rides Again (GOG.com)
bufsize = sizeof(buf);
if (ReadRegistryValue("SOFTWARE\\GOG.com\\GOGCREDNECKRIDESAGAIN", "PATH", buf, &bufsize))
if (Paths_ReadRegistryValue("SOFTWARE\\GOG.com\\GOGCREDNECKRIDESAGAIN", "PATH", buf, &bufsize))
{
AddSearchPath(searchpaths, buf);
}
// Blood: One Unit Whole Blood (Steam)
bufsize = sizeof(buf);
if (ReadRegistryValue(R"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 299030)", "InstallLocation", buf, &bufsize))
if (Paths_ReadRegistryValue(R"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 299030)", "InstallLocation", buf, &bufsize))
{
AddSearchPath(searchpaths, buf);
}
// Blood: One Unit Whole Blood (GOG.com)
bufsize = sizeof(buf);
if (ReadRegistryValue("SOFTWARE\\GOG.com\\GOGONEUNITONEBLOOD", "PATH", buf, &bufsize))
if (Paths_ReadRegistryValue("SOFTWARE\\GOG.com\\GOGONEUNITONEBLOOD", "PATH", buf, &bufsize))
{
AddSearchPath(searchpaths, buf);
}
// Blood: Fresh Supply (Steam)
bufsize = sizeof(buf);
if (ReadRegistryValue(R"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 1010750)", "InstallLocation", buf, &bufsize))
if (Paths_ReadRegistryValue(R"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 1010750)", "InstallLocation", buf, &bufsize))
{
AddSearchPath(searchpaths, buf);
strncat(buf, R"(\addons\Cryptic Passage)", 23);
@ -340,7 +341,7 @@ void G_AddExternalSearchPaths(TArray<FString> &searchpaths)
// Blood: Fresh Supply (GOG.com)
bufsize = sizeof(buf);
if (ReadRegistryValue(R"(SOFTWARE\Wow6432Node\GOG.com\Games\1374469660)", "path", buf, &bufsize))
if (Paths_ReadRegistryValue(R"(SOFTWARE\Wow6432Node\GOG.com\Games\1374469660)", "path", buf, &bufsize))
{
AddSearchPath(searchpaths, buf);
strncat(buf, R"(\addons\Cryptic Passage)", 23);
@ -349,7 +350,6 @@ void G_AddExternalSearchPaths(TArray<FString> &searchpaths)
}
#endif
//==========================================================================
//
//

View file

@ -336,34 +336,3 @@ FString M_GetDocumentsPath()
return path;
}
//===========================================================================
//
// ReadRegistryValue Windows
//
// Reads a value from the registry
//
//===========================================================================
int ReadRegistryValue(char const* const SubKey, char const* const Value, char* const Output, unsigned long* OutputSize)
{
// KEY_WOW64_32KEY gets us around Wow6432Node on 64-bit builds
REGSAM const wow64keys[] = { KEY_WOW64_32KEY, KEY_WOW64_64KEY };
for (auto& wow64key : wow64keys)
{
HKEY hkey;
LONG keygood = RegOpenKeyExA(HKEY_LOCAL_MACHINE, NULL, 0, KEY_READ | wow64key, &hkey);
if (keygood != ERROR_SUCCESS)
continue;
LONG retval = SHGetValueA(hkey, SubKey, Value, NULL, Output, OutputSize);
RegCloseKey(hkey);
if (retval == ERROR_SUCCESS)
return 1;
}
return 0;
}