Skip to content

Commit cdd8d64

Browse files
committed
[GEN][ZH] Unify all code of WWDownload (#785)
1 parent f9bdaa8 commit cdd8d64

File tree

7 files changed

+46
-3
lines changed

7 files changed

+46
-3
lines changed

Generals/Code/Libraries/Source/WWVegas/WWDownload/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ target_sources(g_wwdownload PRIVATE ${WWDOWNLOAD_SRC})
2121

2222
target_link_libraries(g_wwdownload PRIVATE
2323
g_wwcommon
24+
gi_always
2425
gi_gameengine_include
2526
)

Generals/Code/Libraries/Source/WWVegas/WWDownload/registry.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ bool setUnsignedIntInRegistry( HKEY root, std::string path, std::string key, uns
113113

114114
bool GetStringFromRegistry(std::string path, std::string key, std::string& val)
115115
{
116+
#if RTS_GENERALS
116117
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals";
118+
#elif RTS_ZEROHOUR
119+
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour";
120+
#endif
117121

118122
fullPath.append(path);
119123
if (getStringFromRegistry(HKEY_LOCAL_MACHINE, fullPath.c_str(), key.c_str(), val))
@@ -126,7 +130,11 @@ bool GetStringFromRegistry(std::string path, std::string key, std::string& val)
126130

127131
bool GetUnsignedIntFromRegistry(std::string path, std::string key, unsigned int& val)
128132
{
133+
#if RTS_GENERALS
129134
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals";
135+
#elif RTS_ZEROHOUR
136+
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour";
137+
#endif
130138

131139
fullPath.append(path);
132140
if (getUnsignedIntFromRegistry(HKEY_LOCAL_MACHINE, fullPath.c_str(), key.c_str(), val))
@@ -139,7 +147,11 @@ bool GetUnsignedIntFromRegistry(std::string path, std::string key, unsigned int&
139147

140148
bool SetStringInRegistry( std::string path, std::string key, std::string val)
141149
{
150+
#if RTS_GENERALS
142151
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals";
152+
#elif RTS_ZEROHOUR
153+
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour";
154+
#endif
143155
fullPath.append(path);
144156

145157
if (setStringInRegistry( HKEY_LOCAL_MACHINE, fullPath, key, val))
@@ -150,7 +162,11 @@ bool SetStringInRegistry( std::string path, std::string key, std::string val)
150162

151163
bool SetUnsignedIntInRegistry( std::string path, std::string key, unsigned int val)
152164
{
165+
#if RTS_GENERALS
153166
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals";
167+
#elif RTS_ZEROHOUR
168+
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour";
169+
#endif
154170
fullPath.append(path);
155171

156172
if (setUnsignedIntInRegistry( HKEY_LOCAL_MACHINE, fullPath, key, val))

Generals/Code/Libraries/Source/WWVegas/WWDownload/urlBuilder.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323
void FormatURLFromRegistry( std::string& gamePatchURL, std::string& mapPatchURL,
2424
std::string& configURL, std::string& motdURL )
2525
{
26+
#if RTS_GENERALS
2627
std::string sku = "generals";
28+
#elif RTS_ZEROHOUR
29+
std::string sku = "GeneralsZH";
30+
#endif
2731
std::string language = "english";
2832
unsigned int version = 0; // invalid version - can't get on with a corrupt reg.
2933
unsigned int mapVersion = 0; // invalid version - can't get on with a corrupt reg.

GeneralsMD/Code/Libraries/Source/WWVegas/WWDownload/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ target_sources(z_wwdownload PRIVATE ${WWDOWNLOAD_SRC})
2121

2222
target_link_libraries(z_wwdownload PRIVATE
2323
z_wwcommon
24+
zi_always
2425
zi_gameengine_include
2526
)

GeneralsMD/Code/Libraries/Source/WWVegas/WWDownload/FTP.CPP

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@
4040

4141
#include "DownloadDebug.h"
4242

43-
#ifndef RTS_DEBUG
44-
#define RTS_DEBUG
45-
#endif
43+
// umm... what?? BGC 3/27/03
44+
//#ifndef RTS_DEBUG
45+
//#define RTS_DEBUG
46+
//#endif
4647

4748
/*************************************************************************/
4849
/*_$ External References */

GeneralsMD/Code/Libraries/Source/WWVegas/WWDownload/registry.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ bool setUnsignedIntInRegistry( HKEY root, std::string path, std::string key, uns
113113

114114
bool GetStringFromRegistry(std::string path, std::string key, std::string& val)
115115
{
116+
#if RTS_GENERALS
117+
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals";
118+
#elif RTS_ZEROHOUR
116119
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour";
120+
#endif
117121

118122
fullPath.append(path);
119123
if (getStringFromRegistry(HKEY_LOCAL_MACHINE, fullPath.c_str(), key.c_str(), val))
@@ -126,7 +130,11 @@ bool GetStringFromRegistry(std::string path, std::string key, std::string& val)
126130

127131
bool GetUnsignedIntFromRegistry(std::string path, std::string key, unsigned int& val)
128132
{
133+
#if RTS_GENERALS
134+
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals";
135+
#elif RTS_ZEROHOUR
129136
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour";
137+
#endif
130138

131139
fullPath.append(path);
132140
if (getUnsignedIntFromRegistry(HKEY_LOCAL_MACHINE, fullPath.c_str(), key.c_str(), val))
@@ -139,7 +147,11 @@ bool GetUnsignedIntFromRegistry(std::string path, std::string key, unsigned int&
139147

140148
bool SetStringInRegistry( std::string path, std::string key, std::string val)
141149
{
150+
#if RTS_GENERALS
151+
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals";
152+
#elif RTS_ZEROHOUR
142153
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour";
154+
#endif
143155
fullPath.append(path);
144156

145157
if (setStringInRegistry( HKEY_LOCAL_MACHINE, fullPath, key, val))
@@ -150,7 +162,11 @@ bool SetStringInRegistry( std::string path, std::string key, std::string val)
150162

151163
bool SetUnsignedIntInRegistry( std::string path, std::string key, unsigned int val)
152164
{
165+
#if RTS_GENERALS
166+
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals";
167+
#elif RTS_ZEROHOUR
153168
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour";
169+
#endif
154170
fullPath.append(path);
155171

156172
if (setUnsignedIntInRegistry( HKEY_LOCAL_MACHINE, fullPath, key, val))

GeneralsMD/Code/Libraries/Source/WWVegas/WWDownload/urlBuilder.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323
void FormatURLFromRegistry( std::string& gamePatchURL, std::string& mapPatchURL,
2424
std::string& configURL, std::string& motdURL )
2525
{
26+
#if RTS_GENERALS
27+
std::string sku = "generals";
28+
#elif RTS_ZEROHOUR
2629
std::string sku = "GeneralsZH";
30+
#endif
2731
std::string language = "english";
2832
unsigned int version = 0; // invalid version - can't get on with a corrupt reg.
2933
unsigned int mapVersion = 0; // invalid version - can't get on with a corrupt reg.

0 commit comments

Comments
 (0)