[Branding]: Update (#953)
This commit is contained in:
parent
8d63b23cd9
commit
1c29eaf229
@ -160,6 +160,7 @@ newaction {
|
||||
versionHeader:write("\n")
|
||||
versionHeader:write("// New revision definition. Will be used from now on\n")
|
||||
versionHeader:write("#define REVISION " .. revNumber .. "\n")
|
||||
versionHeader:write("#define REVISION_STR \"r" .. revNumber .. "\"\n")
|
||||
versionHeader:write("\n")
|
||||
versionHeader:write("// Alias definitions\n")
|
||||
versionHeader:write("#define VERSION GIT_DESCRIBE\n")
|
||||
|
@ -40,34 +40,34 @@ namespace Components
|
||||
{
|
||||
Utils::Hook::Call<void(int)>(0x4EFF80)(localClientNum);
|
||||
|
||||
if (Branding::CGDrawVersion.get<bool>())
|
||||
if (CGDrawVersion.get<bool>())
|
||||
{
|
||||
Branding::CG_DrawVersion();
|
||||
CG_DrawVersion();
|
||||
}
|
||||
}
|
||||
|
||||
const char* Branding::GetBuildNumber()
|
||||
{
|
||||
return VERSION " latest " __DATE__ " " __TIME__;
|
||||
return REVISION_STR " latest " __DATE__ " " __TIME__;
|
||||
}
|
||||
|
||||
const char* Branding::GetVersionString()
|
||||
{
|
||||
// IW4x is technically a beta
|
||||
return Utils::String::VA("%s %s build %s %s",
|
||||
BUILD_TYPE, "(Beta)", Branding::GetBuildNumber(), reinterpret_cast<const char*>(0x7170A0));
|
||||
BUILD_TYPE, "(Beta)", GetBuildNumber(), reinterpret_cast<const char*>(0x7170A0));
|
||||
}
|
||||
|
||||
void Branding::Dvar_SetVersionString(const Game::dvar_t* dvar, [[maybe_unused]] const char* value)
|
||||
{
|
||||
const auto* result = Branding::GetVersionString();
|
||||
const auto* result = GetVersionString();
|
||||
Utils::Hook::Call<void(const Game::dvar_t*, const char*)>(0x4A9580)(dvar, result);
|
||||
}
|
||||
|
||||
// Branding this might be a good idea in case this LSP logging ever gets turned on for some reason
|
||||
void Branding::MSG_WriteVersionStringHeader(Game::msg_t* msg, [[maybe_unused]] const char* string)
|
||||
{
|
||||
const auto* result = Branding::GetVersionString();
|
||||
const auto* result = GetVersionString();
|
||||
Utils::Hook::Call<void(Game::msg_t*, const char*)>(0x463820)(msg, result);
|
||||
}
|
||||
|
||||
@ -95,50 +95,50 @@ namespace Components
|
||||
|
||||
Branding::Branding()
|
||||
{
|
||||
Branding::RegisterBrandingDvars();
|
||||
RegisterBrandingDvars();
|
||||
|
||||
// UI version string
|
||||
Utils::Hook::Set<const char*>(0x43F73B, "IW4x - " GIT_TAG);
|
||||
Utils::Hook::Set<const char*>(0x43F73B, "IW4x - " REVISION_STR);
|
||||
|
||||
// Short version dvar
|
||||
Utils::Hook::Set<const char*>(0x60BD91, GIT_TAG);
|
||||
Utils::Hook::Set<const char*>(0x60BD91, REVISION_STR);
|
||||
|
||||
// Com_Init_Try_Block_Function
|
||||
Utils::Hook::Set<const char*>(0x60BAF4, BUILD_TYPE);
|
||||
Utils::Hook::Set<const char*>(0x60BAEf, GIT_TAG);
|
||||
Utils::Hook::Set<const char*>(0x60BAEf, REVISION_STR);
|
||||
Utils::Hook::Set<const char*>(0x60BAE5, __DATE__);
|
||||
|
||||
// G_InitGame
|
||||
Utils::Hook::Set<const char*>(0x48EBA1, __DATE__);
|
||||
|
||||
Utils::Hook(0x4B12B0, Branding::GetBuildNumber, HOOK_JUMP).install()->quick();
|
||||
Utils::Hook(0x4B12B0, GetBuildNumber, HOOK_JUMP).install()->quick();
|
||||
|
||||
// Version string color
|
||||
static Game::vec4_t buildLocColor = {1.0f, 1.0f, 1.0f, 0.8f};
|
||||
Utils::Hook::Set<float*>(0x43F710, buildLocColor);
|
||||
|
||||
// Place ui version string to bottom right corner (ui_buildlocation)
|
||||
Utils::Hook(0x6310A0, Branding::Dvar_RegisterUIBuildLocation, HOOK_CALL).install()->quick(); // Dvar_RegisterVec2
|
||||
Utils::Hook(0x6310A0, Dvar_RegisterUIBuildLocation, HOOK_CALL).install()->quick(); // Dvar_RegisterVec2
|
||||
|
||||
Utils::Hook(0x60BD81, Branding::Dvar_SetVersionString, HOOK_CALL).install()->quick();
|
||||
Utils::Hook(0x60BD81, Dvar_SetVersionString, HOOK_CALL).install()->quick();
|
||||
|
||||
Utils::Hook(0x4DA842, Branding::MSG_WriteVersionStringHeader, HOOK_CALL).install()->quick();
|
||||
Utils::Hook(0x4DA842, MSG_WriteVersionStringHeader, HOOK_CALL).install()->quick();
|
||||
|
||||
// Hook CG_DrawFullScreenDebugOverlays so we may render the version when it's appropriate
|
||||
Utils::Hook(0x5AC975, Branding::CG_DrawVersion_Hk, HOOK_CALL).install()->quick();
|
||||
Utils::Hook(0x5AC975, CG_DrawVersion_Hk, HOOK_CALL).install()->quick();
|
||||
|
||||
// Console title
|
||||
if (ZoneBuilder::IsEnabled())
|
||||
{
|
||||
Utils::Hook::Set<const char*>(0x4289E8, "IW4x (" GIT_TAG "): ZoneBuilder");
|
||||
Utils::Hook::Set<const char*>(0x4289E8, "IW4x (" REVISION_STR "): ZoneBuilder");
|
||||
}
|
||||
else if (Dedicated::IsEnabled())
|
||||
{
|
||||
Utils::Hook::Set<const char*>(0x4289E8, "IW4x (" GIT_TAG "): Dedicated");
|
||||
Utils::Hook::Set<const char*>(0x4289E8, "IW4x (" REVISION_STR "): Dedicated");
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils::Hook::Set<const char*>(0x4289E8, "IW4x (" GIT_TAG "): Console");
|
||||
Utils::Hook::Set<const char*>(0x4289E8, "IW4x (" REVISION_STR "): Console");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -96,14 +96,14 @@ namespace Components
|
||||
}
|
||||
else if (IsWindow(GetWindow()) != FALSE)
|
||||
{
|
||||
SetWindowTextA(GetWindow(), Utils::String::VA("IW4x(" GIT_TAG ") : %s", hostname.data()));
|
||||
SetWindowTextA(GetWindow(), Utils::String::VA("IW4x(" REVISION_STR ") : %s", hostname.data()));
|
||||
}
|
||||
}
|
||||
|
||||
void Console::ShowPrompt()
|
||||
{
|
||||
wattron(InputWindow, COLOR_PAIR(10) | A_BOLD);
|
||||
wprintw(InputWindow, "%s> ", GIT_TAG);
|
||||
wprintw(InputWindow, "%s> ", REVISION_STR);
|
||||
}
|
||||
|
||||
void Console::RefreshOutput()
|
||||
@ -427,38 +427,15 @@ namespace Components
|
||||
RefreshOutput();
|
||||
}
|
||||
|
||||
HFONT CALLBACK Console::ReplaceFont(
|
||||
[[maybe_unused]] int cHeight,
|
||||
int cWidth,
|
||||
int cEscapement,
|
||||
int cOrientation,
|
||||
[[maybe_unused]] int cWeight,
|
||||
DWORD bItalic,
|
||||
DWORD bUnderline,
|
||||
DWORD bStrikeOut,
|
||||
DWORD iCharSet,
|
||||
[[maybe_unused]] DWORD iOutPrecision,
|
||||
DWORD iClipPrecision,
|
||||
[[maybe_unused]] DWORD iQuality,
|
||||
[[maybe_unused]] DWORD iPitchAndFamily,
|
||||
[[maybe_unused]] LPCSTR pszFaceName)
|
||||
HFONT CALLBACK Console::ReplaceFont([[maybe_unused]] int cHeight, int cWidth, int cEscapement, int cOrientation, [[maybe_unused]] int cWeight, DWORD bItalic, DWORD bUnderline,
|
||||
DWORD bStrikeOut, DWORD iCharSet, [[maybe_unused]] DWORD iOutPrecision, DWORD iClipPrecision, [[maybe_unused]] DWORD iQuality,
|
||||
[[maybe_unused]] DWORD iPitchAndFamily, [[maybe_unused]] LPCSTR pszFaceName)
|
||||
{
|
||||
HFONT font = CreateFontA(
|
||||
12,
|
||||
cWidth,
|
||||
cEscapement,
|
||||
cOrientation,
|
||||
700,
|
||||
bItalic,
|
||||
bUnderline,
|
||||
bStrikeOut,
|
||||
iCharSet,
|
||||
OUT_RASTER_PRECIS,
|
||||
iClipPrecision,
|
||||
NONANTIALIASED_QUALITY,
|
||||
0x31,
|
||||
"Terminus (TTF)"
|
||||
); // Terminus (TTF)
|
||||
HFONT font = CreateFontA(12, cWidth, cEscapement, cOrientation, 700, bItalic,
|
||||
bUnderline, bStrikeOut, iCharSet, OUT_RASTER_PRECIS,
|
||||
iClipPrecision, NONANTIALIASED_QUALITY, 0x31,
|
||||
"Terminus (TTF)"
|
||||
);
|
||||
|
||||
return font;
|
||||
}
|
||||
@ -860,7 +837,7 @@ namespace Components
|
||||
AssertOffset(Game::clientUIActive_t, keyCatchers, 0x9B0);
|
||||
|
||||
// Console '%s: %s> ' string
|
||||
Utils::Hook::Set<const char*>(0x5A44B4, "IW4x_MP: " GIT_TAG "> ");
|
||||
Utils::Hook::Set<const char*>(0x5A44B4, "IW4x MP: " REVISION_STR "> ");
|
||||
|
||||
// Patch console color
|
||||
static float consoleColor[] = { 0.70f, 1.00f, 0.00f, 1.00f };
|
||||
|
@ -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("version", GIT_TAG);
|
||||
info.set("version", REVISION_STR);
|
||||
info.set("checksum", std::to_string(Game::Sys_Milliseconds()));
|
||||
info.set("mapname", Dvar::Var("mapname").get<std::string>());
|
||||
info.set("isPrivate", *password ? "1" : "0");
|
||||
|
@ -58,7 +58,7 @@ namespace Components
|
||||
{
|
||||
Dvar::Var("uiSi_ServerName").set(serverInfo->hostname);
|
||||
Dvar::Var("uiSi_MaxClients").set(serverInfo->clients);
|
||||
Dvar::Var("uiSi_Version").set(serverInfo->shortversion);
|
||||
Dvar::Var("uiSi_Version").set(serverInfo->version);
|
||||
Dvar::Var("uiSi_SecurityLevel").set(serverInfo->securityLevel);
|
||||
Dvar::Var("uiSi_isPrivate").set(serverInfo->password ? "@MENU_YES" : "@MENU_NO");
|
||||
Dvar::Var("uiSi_Hardcore").set(serverInfo->hardcore ? "@MENU_ENABLED" : "@MENU_DISABLED");
|
||||
@ -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("version", GIT_TAG);
|
||||
info.set("version", REVISION_STR);
|
||||
info.set("version", (*Game::version)->current.string);
|
||||
info.set("mapname", (*Game::sv_mapname)->current.string);
|
||||
info.set("isPrivate", *password ? "1" : "0");
|
||||
@ -261,7 +261,7 @@ namespace Components
|
||||
|
||||
Dvar::Var("uiSi_ServerName").set(info.get("sv_hostname"));
|
||||
Dvar::Var("uiSi_MaxClients").set(info.get("sv_maxclients"));
|
||||
Dvar::Var("uiSi_Version").set(info.get("shortversion"));
|
||||
Dvar::Var("uiSi_Version").set(info.get("version"));
|
||||
Dvar::Var("uiSi_SecurityLevel").set(info.get("sv_securityLevel"));
|
||||
Dvar::Var("uiSi_isPrivate").set(info.get("isPrivate") == "0" ? "@MENU_NO" : "@MENU_YES");
|
||||
Dvar::Var("uiSi_Hardcore").set(info.get("g_hardcore") == "0" ? "@MENU_DISABLED" : "@MENU_ENABLED");
|
||||
|
@ -522,7 +522,7 @@ namespace Components
|
||||
server.hostname = info.get("hostname");
|
||||
server.mapname = info.get("mapname");
|
||||
server.gametype = info.get("gametype");
|
||||
server.shortversion = info.get("shortversion");
|
||||
server.version = info.get("version");
|
||||
server.mod = info.get("fs_game");
|
||||
server.matchType = std::strtol(info.get("matchtype").data(), nullptr, 10);
|
||||
server.clients = std::strtol(info.get("clients").data(), nullptr, 10);
|
||||
|
@ -17,7 +17,7 @@ namespace Components
|
||||
std::string mapname;
|
||||
std::string gametype;
|
||||
std::string mod;
|
||||
std::string shortversion;
|
||||
std::string version;
|
||||
std::size_t hash;
|
||||
int clients;
|
||||
int bots;
|
||||
|
@ -978,7 +978,7 @@ namespace Components
|
||||
}
|
||||
|
||||
Logger::Print(" --------------------------------------------------------------------------------\n");
|
||||
Logger::Print(" IW4x ZoneBuilder - {}\n", VERSION);
|
||||
Logger::Print(" IW4x ZoneBuilder - {}\n", REVISION_STR);
|
||||
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");
|
||||
|
@ -69,12 +69,12 @@ BEGIN
|
||||
#else
|
||||
VALUE "FileDescription", "IW4 client modification"
|
||||
#endif
|
||||
VALUE "FileVersion", GIT_TAG
|
||||
VALUE "FileVersion", REVISION_STR
|
||||
VALUE "InternalName", "iw4x"
|
||||
VALUE "LegalCopyright", "Copyright 2023 The XLabsProject Team. All rights reserved."
|
||||
VALUE "OriginalFilename", "iw4x.dll"
|
||||
VALUE "ProductName", "IW4x"
|
||||
VALUE "ProductVersion", GIT_TAG
|
||||
VALUE "ProductVersion", REVISION_STR
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
Loading…
Reference in New Issue
Block a user