From a7d3df22e852058bf45417d4051b86295e2ecb0d Mon Sep 17 00:00:00 2001 From: momo5502 Date: Fri, 16 Sep 2022 20:55:36 +0200 Subject: [PATCH] Add branding --- src/client/component/branding.cpp | 46 +++++++++++++++++++++++++++++++ src/client/game/symbols.hpp | 9 +++++- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/client/component/branding.cpp diff --git a/src/client/component/branding.cpp b/src/client/component/branding.cpp new file mode 100644 index 00000000..6dfe19a1 --- /dev/null +++ b/src/client/component/branding.cpp @@ -0,0 +1,46 @@ +#include +#include "loader/component_loader.hpp" +#include "game/game.hpp" + +#include + +namespace branding +{ + namespace + { + utils::hook::detour r_end_frame_hook; + + void draw_branding() + { + constexpr auto x = 4; + constexpr auto y = -6; + constexpr auto scale = 1.0f; + //float color[4] = {0.666f, 0.666f, 0.666f, 0.666f}; + float color[4] = {236 / 255.0f, 113 / 255.0f, 10 / 255.0f, 1.0f}; + + auto* font = reinterpret_cast(0x141CAC8E0_g)(); + if (!font) return; + + game::R_AddCmdDrawText("BOIII", 0x7FFFFFFF, font, static_cast(x), + y + static_cast(font[2]) * scale, + scale, scale, 0.0f, color, 0); + } + + void r_end_frame_stub() + { + draw_branding(); + r_end_frame_hook.invoke(); + } + } + + class component final : public component_interface + { + public: + void post_unpack() override + { + r_end_frame_hook.create(0x142273560_g, r_end_frame_stub); + } + }; +} + +REGISTER_COMPONENT(branding::component) diff --git a/src/client/game/symbols.hpp b/src/client/game/symbols.hpp index 7aa24cdd..6d62398f 100644 --- a/src/client/game/symbols.hpp +++ b/src/client/game/symbols.hpp @@ -9,7 +9,9 @@ namespace game WEAK symbol Com_Error_{0x1420F8BD0_g}; WEAK symbol Cbuf_AddText{0x1420EC8B0_g}; - WEAK symbol Cmd_AddCommandInternal{0x1420ED530_g}; + WEAK symbol Cmd_AddCommandInternal{ + 0x1420ED530_g + }; WEAK symbol Con_GetTextCopy{0x14133A7D0_g}; // Sys @@ -27,6 +29,11 @@ namespace game WEAK symbol cmd_functions{0x15689FF58_g}; WEAK symbol sv_cmd_args{0x15689CE30_g}; + // Rendering + WEAK symbol R_AddCmdDrawText{ + 0x141CD98D0_g + }; + namespace s_wcd { WEAK symbol codLogo{0x157E77A50_g};