Skip to content

[GEN][ZH] Add TheSuperHackers version to options screen #1171

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
1 change: 1 addition & 0 deletions Generals/Code/GameEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,7 @@ target_include_directories(g_gameengine PUBLIC

target_include_directories(g_gameengine PRIVATE
Include/Precompiled
${CMAKE_BINARY_DIR}/Generals/Code/Main
)

target_link_libraries(g_gameengine PRIVATE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "Common/GameLOD.h"
#include "Common/Registry.h"
#include "Common/version.h"
#include "GeneratedVersion.h"

#include "GameClient/ClientInstance.h"
#include "GameClient/GameClient.h"
Expand Down Expand Up @@ -1440,7 +1441,9 @@ void OptionsMenuInit( WindowLayout *layout, void *userData )
}
else
{
GadgetStaticTextSetText( labelVersion, versionString );
UnicodeString fullVersion;
fullVersion.format(L"%s - TheSuperHackers %s", versionString.str(), SUPERHACKERS_VERSION_WIDE);
GadgetStaticTextSetText(labelVersion, fullVersion);
}


Expand Down
40 changes: 31 additions & 9 deletions Generals/Code/Main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,33 @@ target_link_libraries(g_generals PRIVATE
winmm
)

if(EXISTS "${CMAKE_SOURCE_DIR}/next_tag.txt")
file(READ "${CMAKE_SOURCE_DIR}/next_tag.txt" GAME_VERSION)
string(STRIP "${GAME_VERSION}" GAME_VERSION)
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)" _ "${GAME_VERSION}")
set(VERSION_MAJOR "${CMAKE_MATCH_1}")
set(VERSION_MINOR "${CMAKE_MATCH_2}")
set(VERSION_BUILDNUM "${CMAKE_MATCH_3}")
else()
set(GAME_VERSION "")
if (IS_VS6_BUILD)
set(VERSION_MAJOR "1")
set(VERSION_MINOR "7")
set(VERSION_BUILDNUM "601")
else()
set(VERSION_MAJOR "1")
set(VERSION_MINOR "8")
set(VERSION_BUILDNUM "601")
endif()
endif()

# TODO Originally referred to build host and user, replace with git info perhaps?
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/GeneratedVersion.h
"#pragma once

#define VERSION_LOCALBUILDNUM 0
#define VERSION_BUILDUSER \"Someone\"
#define VERSION_BUILDLOC \"Someplace\"
#define VERSION_BUILDUSER \"TheSuperHackers\"
#define VERSION_BUILDLOC \"GitHub\"
#define SUPERHACKERS_VERSION_WIDE L\"${GAME_VERSION}\"
"
)

Expand All @@ -39,18 +59,20 @@ if (IS_VS6_BUILD)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/BuildVersion.h
"#pragma once

#define VERSION_MAJOR 1
#define VERSION_MINOR 7
#define VERSION_BUILDNUM 601
#define VERSION_MAJOR ${VERSION_MAJOR}
#define VERSION_MINOR ${VERSION_MINOR}
#define VERSION_BUILDNUM ${VERSION_BUILDNUM}
#define VERSION_LOCALBUILDNUM 9001 // it's over 9000!
"
)
else()
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/BuildVersion.h
"#pragma once

#define VERSION_MAJOR 1
#define VERSION_MINOR 8
#define VERSION_BUILDNUM 601
#define VERSION_MAJOR ${VERSION_MAJOR}
#define VERSION_MINOR ${VERSION_MINOR}
#define VERSION_BUILDNUM ${VERSION_BUILDNUM}
#define VERSION_LOCALBUILDNUM 602
"
)
endif()
Expand Down
1 change: 1 addition & 0 deletions GeneralsMD/Code/GameEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,7 @@ target_include_directories(z_gameengine PUBLIC

target_include_directories(z_gameengine PRIVATE
Include/Precompiled
${CMAKE_BINARY_DIR}/GeneralsMD/Code/Main
)

target_link_libraries(z_gameengine PRIVATE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "Common/GameLOD.h"
#include "Common/Registry.h"
#include "Common/version.h"
#include "GeneratedVersion.h"

#include "GameClient/ClientInstance.h"
#include "GameClient/GameClient.h"
Expand Down Expand Up @@ -1506,7 +1507,9 @@ void OptionsMenuInit( WindowLayout *layout, void *userData )
}
else
{
GadgetStaticTextSetText( labelVersion, versionString );
UnicodeString fullVersion;
fullVersion.format(L"%s - TheSuperHackers %s", versionString.str(), SUPERHACKERS_VERSION_WIDE);
GadgetStaticTextSetText(labelVersion, fullVersion);
}


Expand Down
27 changes: 21 additions & 6 deletions GeneralsMD/Code/Main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,38 @@ target_link_libraries(z_generals PRIVATE
zi_always
)

if(EXISTS "${CMAKE_SOURCE_DIR}/next_tag.txt")
file(READ "${CMAKE_SOURCE_DIR}/next_tag.txt" GAME_VERSION)
string(STRIP "${GAME_VERSION}" GAME_VERSION)
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)" _ "${GAME_VERSION}")
set(VERSION_MAJOR "${CMAKE_MATCH_1}")
set(VERSION_MINOR "${CMAKE_MATCH_2}")
set(VERSION_BUILDNUM "${CMAKE_MATCH_3}")
else()
set(GAME_VERSION "")
set(VERSION_MAJOR "1")
set(VERSION_MINOR "4")
set(VERSION_BUILDNUM "601")
endif()

# TODO Originally referred to build host and user, replace with git info perhaps?
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/GeneratedVersion.h
"#pragma once

#define VERSION_LOCALBUILDNUM 0
#define VERSION_BUILDUSER \"Someone\"
#define VERSION_BUILDLOC \"Someplace\"
#define VERSION_BUILDUSER \"TheSuperHackers\"
#define VERSION_BUILDLOC \"GitHub\"
#define SUPERHACKERS_VERSION_WIDE L\"${GAME_VERSION}\"
"
)

# Based on original binary values for these variables.
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/BuildVersion.h
"#pragma once

#define VERSION_MAJOR 1
#define VERSION_MINOR 4
#define VERSION_BUILDNUM 601
#define VERSION_MAJOR ${VERSION_MAJOR}
#define VERSION_MINOR ${VERSION_MINOR}
#define VERSION_BUILDNUM ${VERSION_BUILDNUM}
#define VERSION_LOCALBUILDNUM 9001 // it's over 9000!
"
)

Expand Down