From a39febed668c0910ee1712009b8f0d142b3732df Mon Sep 17 00:00:00 2001 From: Edo Date: Wed, 19 Apr 2023 19:53:29 +0200 Subject: [PATCH] [General]: New versioning system (#944) --- CHANGELOG.md | 26 ++++++++++++++++++++++++++ premake5.lua | 6 +----- src/Components/Modules/Branding.cpp | 18 ++++++++---------- src/Components/Modules/Console.cpp | 6 +++--- src/Components/Modules/News.cpp | 2 -- src/Components/Modules/Party.cpp | 2 +- src/Components/Modules/ServerInfo.cpp | 2 +- src/Components/Modules/ServerList.cpp | 8 +------- src/Components/Modules/Singleton.cpp | 2 +- src/Components/Modules/ZoneBuilder.cpp | 2 +- src/Resource.rc | 16 ++++++++-------- 11 files changed, 51 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c35b7fb2..6944b407 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,14 +4,36 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog v0.3.0](http://keepachangelog.com/en/0.3.0/) and this project adheres to [Semantic Versioning](http://semver.org/). +## r4190 - 2023-04-19 + +### Added + +- Add `LogString` GSC function (#895) +- Add `LogString` GSC method (#895) +- Add `sv_replaceTestClients` Dvar (#930) + +### Changed + +- `sv_mapRotationCurrent` supports `exec` directive for executing cfg scripts from the `game_settings` folder + +### Fixed + +- `sv_privatePassword` will work as intended (#908) + +### Known issues + +- Sound issue fix is experimental as the bug is not fully understood. + ## [0.7.9] - 2023-03-31 ### Added + - Game scripts can be loaded from the `scripts/mp`, `scripts/mp/` and `scripts/mp/` folders (#859) - Add `ReadStream` GSC function (#862) - Add `IString` GSC function (#877) ### Changed + - Test Clients will no longer receive names from the Xlabs Patreon website. The old behaviour was restored (#852) - Enabled `OpenFile` GSC function (#862) - Enabled `CloseFile` GSC function (#862) @@ -20,6 +42,7 @@ The format is based on [Keep a Changelog v0.3.0](http://keepachangelog.com/en/0. - `CastFloat` GSC function was renamed to `Float` (#880) ### Fixed + - Fix bug where knife lounges would not work with a gamepad (#848) - Fix rare RCon crash (#861) - Fix bug where `sv_RandomBotNames` stopped working (#876) @@ -32,6 +55,7 @@ The format is based on [Keep a Changelog v0.3.0](http://keepachangelog.com/en/0. ## [0.7.8] - 2023-03-17 ### Added + - Clients can unprotect "saved" Dvars using the command line argument `-unprotect-dvars` (#694) - Clients can protect all Dvars from being modified by the server using the command line argument `-protect-dvars` (#823) - Add helpful information to script-related errors (#721) @@ -54,6 +78,7 @@ The format is based on [Keep a Changelog v0.3.0](http://keepachangelog.com/en/0. - Add new map porting utility tool that makes the map porting process between CoD8 to CoD6 easy ### Changed + - Servers can no longer modify client Dvars that are saved in the client's config (#694) - `banClient` and `muteClient` server commands do not apply to bots anymore (#730) - Remove `zb_prefer_disk_assets` Dvar (#772) @@ -61,6 +86,7 @@ The format is based on [Keep a Changelog v0.3.0](http://keepachangelog.com/en/0. - Test Clients will receive names from the Xlabs Patreon website in addition to the names from the bots.txt file (#771) ### Fixed + - Fix bug where`reloadmenus` command would not free resources used by custom menus (#740) - Fix bug where demo playback would stop when opening a laptop based killstreak (#699) - Fix bug where mod download speed was inexplicably slow (#707) diff --git a/premake5.lua b/premake5.lua index a311c929..f81f657a 100644 --- a/premake5.lua +++ b/premake5.lua @@ -158,15 +158,11 @@ newaction { versionHeader:write("#define GIT_DIRTY " .. revDirty .. "\n") versionHeader:write("#define GIT_TAG " .. cstrquote(tagName) .. "\n") versionHeader:write("\n") - versionHeader:write("// Legacy definitions (needed for update check)\n") + versionHeader:write("// New revision definition. Will be used from now on\n") versionHeader:write("#define REVISION " .. revNumber .. "\n") versionHeader:write("\n") - versionHeader:write("// Version transformed for RC files\n") - versionHeader:write("#define VERSION_RC " .. table.concat(vertonumarr(tagName, revNumber), ",") .. "\n") - versionHeader:write("\n") versionHeader:write("// Alias definitions\n") versionHeader:write("#define VERSION GIT_DESCRIBE\n") - versionHeader:write("#define SHORTVERSION " .. cstrquote(table.concat(vertonumarr(tagName, revNumber), ".")) .. "\n") versionHeader:close() local versionHeader = assert(io.open(wks.location .. "/src/version.hpp", "w")) versionHeader:write("/*\n") diff --git a/src/Components/Modules/Branding.cpp b/src/Components/Modules/Branding.cpp index 0c293357..e95e32bb 100644 --- a/src/Components/Modules/Branding.cpp +++ b/src/Components/Modules/Branding.cpp @@ -48,16 +48,14 @@ namespace Components const char* Branding::GetBuildNumber() { - return SHORTVERSION " latest " __DATE__ " " __TIME__; + return VERSION " latest " __DATE__ " " __TIME__; } const char* Branding::GetVersionString() { // IW4x is technically a beta - const auto* result = Utils::String::VA("%s %s build %s %s", + return Utils::String::VA("%s %s build %s %s", BUILD_TYPE, "(Beta)", Branding::GetBuildNumber(), reinterpret_cast(0x7170A0)); - - return result; } void Branding::Dvar_SetVersionString(const Game::dvar_t* dvar, [[maybe_unused]] const char* value) @@ -100,14 +98,14 @@ namespace Components Branding::RegisterBrandingDvars(); // UI version string - Utils::Hook::Set(0x43F73B, "IW4x: " VERSION); + Utils::Hook::Set(0x43F73B, "IW4x - " GIT_TAG); // Short version dvar - Utils::Hook::Set(0x60BD91, SHORTVERSION); + Utils::Hook::Set(0x60BD91, GIT_TAG); // Com_Init_Try_Block_Function Utils::Hook::Set(0x60BAF4, BUILD_TYPE); - Utils::Hook::Set(0x60BAEf, SHORTVERSION); + Utils::Hook::Set(0x60BAEf, GIT_TAG); Utils::Hook::Set(0x60BAE5, __DATE__); // G_InitGame @@ -132,15 +130,15 @@ namespace Components // Console title if (ZoneBuilder::IsEnabled()) { - Utils::Hook::Set(0x4289E8, "IW4x (" VERSION "): ZoneBuilder"); + Utils::Hook::Set(0x4289E8, "IW4x (" GIT_TAG "): ZoneBuilder"); } else if (Dedicated::IsEnabled()) { - Utils::Hook::Set(0x4289E8, "IW4x (" VERSION "): Dedicated"); + Utils::Hook::Set(0x4289E8, "IW4x (" GIT_TAG "): Dedicated"); } else { - Utils::Hook::Set(0x4289E8, "IW4x (" VERSION "): Console"); + Utils::Hook::Set(0x4289E8, "IW4x (" GIT_TAG "): Console"); } } } diff --git a/src/Components/Modules/Console.cpp b/src/Components/Modules/Console.cpp index 56acd131..0a91504d 100644 --- a/src/Components/Modules/Console.cpp +++ b/src/Components/Modules/Console.cpp @@ -96,14 +96,14 @@ namespace Components } else if (IsWindow(GetWindow()) != FALSE) { - SetWindowTextA(GetWindow(), Utils::String::VA("IW4x(" VERSION ") : %s", hostname.data())); + SetWindowTextA(GetWindow(), Utils::String::VA("IW4x(" GIT_TAG ") : %s", hostname.data())); } } void Console::ShowPrompt() { wattron(InputWindow, COLOR_PAIR(10) | A_BOLD); - wprintw(InputWindow, "%s> ", VERSION); + wprintw(InputWindow, "%s> ", GIT_TAG); } void Console::RefreshOutput() @@ -860,7 +860,7 @@ namespace Components AssertOffset(Game::clientUIActive_t, keyCatchers, 0x9B0); // Console '%s: %s> ' string - Utils::Hook::Set(0x5A44B4, "IW4x MP: " VERSION "> "); + Utils::Hook::Set(0x5A44B4, "IW4x_MP: " GIT_TAG "> "); // Patch console color static float consoleColor[] = { 0.70f, 1.00f, 0.00f, 1.00f }; diff --git a/src/Components/Modules/News.cpp b/src/Components/Modules/News.cpp index e79ead0d..39a4b4e6 100644 --- a/src/Components/Modules/News.cpp +++ b/src/Components/Modules/News.cpp @@ -2,8 +2,6 @@ #include "Changelog.hpp" #include "News.hpp" -#include - #define NEWS_MOTD_DEFAULT "Welcome to IW4x Multiplayer!" namespace Components diff --git a/src/Components/Modules/Party.cpp b/src/Components/Modules/Party.cpp index efe579e0..c70231ac 100644 --- a/src/Components/Modules/Party.cpp +++ b/src/Components/Modules/Party.cpp @@ -386,7 +386,7 @@ namespace Components info.set("bots", std::to_string(botCount)); info.set("sv_maxclients", std::to_string(maxClientCount)); info.set("protocol", std::to_string(PROTOCOL)); - info.set("shortversion", SHORTVERSION); + info.set("version", GIT_TAG); info.set("checksum", std::to_string(Game::Sys_Milliseconds())); info.set("mapname", Dvar::Var("mapname").get()); info.set("isPrivate", *password ? "1" : "0"); diff --git a/src/Components/Modules/ServerInfo.cpp b/src/Components/Modules/ServerInfo.cpp index dfae403b..b342a142 100644 --- a/src/Components/Modules/ServerInfo.cpp +++ b/src/Components/Modules/ServerInfo.cpp @@ -149,7 +149,7 @@ namespace Components info.set("gamename", "IW4"); info.set("sv_maxclients", std::to_string(maxClientCount)); info.set("protocol", std::to_string(PROTOCOL)); - info.set("shortversion", SHORTVERSION); + info.set("version", GIT_TAG); info.set("version", (*Game::version)->current.string); info.set("mapname", (*Game::sv_mapname)->current.string); info.set("isPrivate", *password ? "1" : "0"); diff --git a/src/Components/Modules/ServerList.cpp b/src/Components/Modules/ServerList.cpp index fa7b0e68..cca7be6e 100644 --- a/src/Components/Modules/ServerList.cpp +++ b/src/Components/Modules/ServerList.cpp @@ -9,8 +9,6 @@ #include "Toast.hpp" #include "UIFeeder.hpp" -#include - namespace Components { bool ServerList::SortAsc = true; @@ -587,11 +585,7 @@ namespace Components } } - if (info.get("gamename") == "IW4"s && server.matchType -#if !defined(DEBUG) && defined(VERSION_FILTER) - && CompareVersion(server.shortversion, SHORTVERSION) -#endif - ) + if (info.get("gamename") == "IW4"s && server.matchType) { auto* lList = GetList(); if (lList) diff --git a/src/Components/Modules/Singleton.cpp b/src/Components/Modules/Singleton.cpp index 218e6825..5b419c0e 100644 --- a/src/Components/Modules/Singleton.cpp +++ b/src/Components/Modules/Singleton.cpp @@ -18,7 +18,7 @@ namespace Components if (Flags::HasFlag("version")) { printf("%s", "IW4x " VERSION " (built " __DATE__ " " __TIME__ ")\n"); - printf("%d\n", REVISION); + printf("Revision: %i\n", REVISION); ExitProcess(EXIT_SUCCESS); } diff --git a/src/Components/Modules/ZoneBuilder.cpp b/src/Components/Modules/ZoneBuilder.cpp index c1b7a133..be5813b7 100644 --- a/src/Components/Modules/ZoneBuilder.cpp +++ b/src/Components/Modules/ZoneBuilder.cpp @@ -978,7 +978,7 @@ namespace Components } Logger::Print(" --------------------------------------------------------------------------------\n"); - Logger::Print(" IW4x ZoneBuilder ({})\n", VERSION); + Logger::Print(" IW4x ZoneBuilder - {}\n", VERSION); Logger::Print(" Commands:\n"); Logger::Print("\t-buildzone [zone]: builds a zone from a csv located in zone_source\n"); Logger::Print("\t-buildall: builds all zones in zone_source\n"); diff --git a/src/Resource.rc b/src/Resource.rc index cda9e955..9936e4b1 100644 --- a/src/Resource.rc +++ b/src/Resource.rc @@ -10,7 +10,7 @@ // // Generated from the TEXTINCLUDE 2 resource. // -#include "windows.h" +#include "Windows.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS @@ -29,7 +29,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 1 TEXTINCLUDE BEGIN - "#include ""windows.h""\r\n" + "#include ""Windows.h""\r\n" "\0" END @@ -47,8 +47,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION VERSION_RC - PRODUCTVERSION VERSION_RC + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -63,18 +63,18 @@ BEGIN BEGIN BLOCK "040904b0" BEGIN - VALUE "CompanyName", "IW4x" + VALUE "CompanyName", "XLabsProject" #ifdef _DEBUG VALUE "FileDescription", "IW4 client modification (DEBUG)" #else VALUE "FileDescription", "IW4 client modification" #endif - VALUE "FileVersion", SHORTVERSION + VALUE "FileVersion", GIT_TAG VALUE "InternalName", "iw4x" - VALUE "LegalCopyright", "Copyright 2022 The IW4x Team. All rights reserved." + VALUE "LegalCopyright", "Copyright 2023 The XLabsProject Team. All rights reserved." VALUE "OriginalFilename", "iw4x.dll" VALUE "ProductName", "IW4x" - VALUE "ProductVersion", SHORTVERSION + VALUE "ProductVersion", GIT_TAG END END BLOCK "VarFileInfo"