Add branding

This commit is contained in:
momo5502 2022-09-16 20:55:36 +02:00
parent 9e7d923028
commit a7d3df22e8
2 changed files with 54 additions and 1 deletions

View File

@ -0,0 +1,46 @@
#include <std_include.hpp>
#include "loader/component_loader.hpp"
#include "game/game.hpp"
#include <utils/hook.hpp>
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<uint32_t*(*)()>(0x141CAC8E0_g)();
if (!font) return;
game::R_AddCmdDrawText("BOIII", 0x7FFFFFFF, font, static_cast<float>(x),
y + static_cast<float>(font[2]) * scale,
scale, scale, 0.0f, color, 0);
}
void r_end_frame_stub()
{
draw_branding();
r_end_frame_hook.invoke<void>();
}
}
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)

View File

@ -9,7 +9,9 @@ namespace game
WEAK symbol<void(const char* file, int line, int code, const char* fmt, ...)> Com_Error_{0x1420F8BD0_g};
WEAK symbol<void(int localClientNum, const char* text)> Cbuf_AddText{0x1420EC8B0_g};
WEAK symbol<void(const char* cmdName, xcommand_t function, cmd_function_s* allocedCmd)> Cmd_AddCommandInternal{0x1420ED530_g};
WEAK symbol<void(const char* cmdName, xcommand_t function, cmd_function_s* allocedCmd)> Cmd_AddCommandInternal{
0x1420ED530_g
};
WEAK symbol<void(char* text, int maxSize)> Con_GetTextCopy{0x14133A7D0_g};
// Sys
@ -27,6 +29,11 @@ namespace game
WEAK symbol<cmd_function_s> cmd_functions{0x15689FF58_g};
WEAK symbol<CmdArgs> sv_cmd_args{0x15689CE30_g};
// Rendering
WEAK symbol<void(const char*, int, void*, float, float, float, float, float, float*, int)> R_AddCmdDrawText{
0x141CD98D0_g
};
namespace s_wcd
{
WEAK symbol<HWND> codLogo{0x157E77A50_g};