Skip to content

Unify code of WWDownload library and move its files to Core #785

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 30, 2025
Merged
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
5 changes: 2 additions & 3 deletions Core/Libraries/Source/WWVegas/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ add_subdirectory(WWMath)
add_subdirectory(WWSaveLoad)
add_subdirectory(WWStub)
# add_subdirectory(WW3D2)
# add_subdirectory(WWDownload)
add_subdirectory(WWDownload)
# add_subdirectory(wwshade)

# Helpful interface to bundle the ww modules together.
Expand All @@ -40,7 +40,7 @@ target_include_directories(core_wwvegas INTERFACE
.
#WW3D2
WWDebug
#WWDownload
WWDownload
WWLib
WWMath
WWSaveLoad
Expand All @@ -54,6 +54,5 @@ target_link_libraries(core_wwvegas INTERFACE
core_wwlib
core_wwmath
core_wwsaveload
# core_wwshade
# core_wwutil
)
21 changes: 21 additions & 0 deletions Core/Libraries/Source/WWVegas/WWDownload/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
set(WWDOWNLOAD_SRC
Download.cpp
Download.h
DownloadDebug.h
downloaddefs.h
FTP.CPP
ftp.h
ftpdefs.h
registry.cpp
Registry.h
urlBuilder.cpp
urlBuilder.h
)

add_library(corei_wwdownload INTERFACE)

target_sources(corei_wwdownload INTERFACE ${WWDOWNLOAD_SRC})

target_link_libraries(corei_wwdownload INTERFACE
core_wwcommon
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
** Command & Conquer Generals(tm)
** Command & Conquer Generals Zero Hour(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ bool setUnsignedIntInRegistry( HKEY root, std::string path, std::string key, uns

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

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

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

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

bool SetStringInRegistry( std::string path, std::string key, std::string val)
{
#if RTS_GENERALS
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals";
#elif RTS_ZEROHOUR
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour";
#endif
fullPath.append(path);

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

bool SetUnsignedIntInRegistry( std::string path, std::string key, unsigned int val)
{
#if RTS_GENERALS
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals";
#elif RTS_ZEROHOUR
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour";
#endif
fullPath.append(path);

if (setUnsignedIntInRegistry( HKEY_LOCAL_MACHINE, fullPath, key, val))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
void FormatURLFromRegistry( std::string& gamePatchURL, std::string& mapPatchURL,
std::string& configURL, std::string& motdURL )
{
#if RTS_GENERALS
std::string sku = "generals";
#elif RTS_ZEROHOUR
std::string sku = "GeneralsZH";
#endif
std::string language = "english";
unsigned int version = 0; // invalid version - can't get on with a corrupt reg.
unsigned int mapVersion = 0; // invalid version - can't get on with a corrupt reg.
Expand Down
21 changes: 2 additions & 19 deletions Generals/Code/Libraries/Source/WWVegas/WWDownload/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
# Set source files
set(WWDOWNLOAD_SRC
Download.cpp
Download.h
DownloadDebug.h
downloaddefs.h
FTP.CPP
ftp.h
ftpdefs.h
registry.cpp
Registry.h
urlBuilder.cpp
urlBuilder.h
)

# Targets to build.
add_library(g_wwdownload STATIC)
set_target_properties(g_wwdownload PROPERTIES OUTPUT_NAME wwdownload)

target_sources(g_wwdownload PRIVATE ${WWDOWNLOAD_SRC})

target_link_libraries(g_wwdownload PRIVATE
g_wwcommon
corei_wwdownload
gi_always
gi_gameengine_include
)
Loading
Loading