Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Generals/Code/GameEngine/Include/Common/Registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@

#include <Common/AsciiString.h>

#if RTS_ZEROHOUR
/**
* Get a string from the original Generals Registry
*/
Bool GetStringFromGeneralsRegistry(AsciiString path, AsciiString key, AsciiString& val);
#endif
/**
* Get a string from the registry
*/
Expand Down
25 changes: 25 additions & 0 deletions Generals/Code/GameEngine/Source/Common/System/registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,29 @@ Bool setUnsignedIntInRegistry( HKEY root, AsciiString path, AsciiString key, Uns
return (returnValue == ERROR_SUCCESS);
}

#if RTS_ZEROHOUR
Bool GetStringFromGeneralsRegistry(AsciiString path, AsciiString key, AsciiString& val)
{
AsciiString fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals";

fullPath.concat(path);
DEBUG_LOG(("GetStringFromRegistry - looking in %s for key %s", fullPath.str(), key.str()));
if (getStringFromRegistry(HKEY_LOCAL_MACHINE, fullPath.str(), key.str(), val))
{
return TRUE;
}

return getStringFromRegistry(HKEY_CURRENT_USER, fullPath.str(), key.str(), val);
}
#endif

Bool GetStringFromRegistry(AsciiString path, AsciiString key, AsciiString& val)
{
#if RTS_GENERALS
AsciiString fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals";
#elif RTS_ZEROHOUR
AsciiString fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour";
#endif

fullPath.concat(path);
DEBUG_LOG(("GetStringFromRegistry - looking in %s for key %s", fullPath.str(), key.str()));
Expand All @@ -131,7 +151,11 @@ Bool GetStringFromRegistry(AsciiString path, AsciiString key, AsciiString& val)

Bool GetUnsignedIntFromRegistry(AsciiString path, AsciiString key, UnsignedInt& val)
{
#if RTS_GENERALS
AsciiString fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals";
#elif RTS_ZEROHOUR
AsciiString fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour";
#endif

fullPath.concat(path);
DEBUG_LOG(("GetUnsignedIntFromRegistry - looking in %s for key %s", fullPath.str(), key.str()));
Expand All @@ -146,6 +170,7 @@ Bool GetUnsignedIntFromRegistry(AsciiString path, AsciiString key, UnsignedInt&
AsciiString GetRegistryLanguage(void)
{
static Bool cached = FALSE;
// NOTE: static causes a memory leak, but we have to keep it because the value is cached.
static AsciiString val = "english";
if (cached) {
return val;
Expand Down
2 changes: 2 additions & 0 deletions GeneralsMD/Code/GameEngine/Include/Common/Registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@

#include <Common/AsciiString.h>

#if RTS_ZEROHOUR
/**
* Get a string from the original Generals Registry
*/
Bool GetStringFromGeneralsRegistry(AsciiString path, AsciiString key, AsciiString& val);
#endif
/**
* Get a string from the registry
*/
Expand Down
10 changes: 10 additions & 0 deletions GeneralsMD/Code/GameEngine/Source/Common/System/registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ Bool setUnsignedIntInRegistry( HKEY root, AsciiString path, AsciiString key, Uns
return (returnValue == ERROR_SUCCESS);
}

#if RTS_ZEROHOUR
Bool GetStringFromGeneralsRegistry(AsciiString path, AsciiString key, AsciiString& val)
{
AsciiString fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals";
Expand All @@ -128,10 +129,15 @@ Bool GetStringFromGeneralsRegistry(AsciiString path, AsciiString key, AsciiStrin

return getStringFromRegistry(HKEY_CURRENT_USER, fullPath.str(), key.str(), val);
}
#endif

Bool GetStringFromRegistry(AsciiString path, AsciiString key, AsciiString& val)
{
#if RTS_GENERALS
AsciiString fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals";
#elif RTS_ZEROHOUR
AsciiString fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour";
#endif

fullPath.concat(path);
DEBUG_LOG(("GetStringFromRegistry - looking in %s for key %s", fullPath.str(), key.str()));
Expand All @@ -145,7 +151,11 @@ Bool GetStringFromRegistry(AsciiString path, AsciiString key, AsciiString& val)

Bool GetUnsignedIntFromRegistry(AsciiString path, AsciiString key, UnsignedInt& val)
{
#if RTS_GENERALS
AsciiString fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals";
#elif RTS_ZEROHOUR
AsciiString fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour";
#endif

fullPath.concat(path);
DEBUG_LOG(("GetUnsignedIntFromRegistry - looking in %s for key %s", fullPath.str(), key.str()));
Expand Down
Loading