Dont render console twice

This commit is contained in:
Federico Cecchetto 2022-05-20 20:57:27 +02:00
parent c3e61b5e6d
commit 949a0821f8
2 changed files with 17 additions and 14 deletions

View File

@ -27,11 +27,26 @@ namespace branding
const auto* const build_num = ui_get_formatted_build_number_hook.invoke<const char*>();
return utils::string::va("%s (%s)", VERSION, build_num);
}
void draw_branding()
{
const auto font = game::R_RegisterFont("fonts/fira_mono_bold.ttf", 20);
if (font)
{
game::R_AddCmdDrawText("H1-Mod: " VERSION, 0x7FFFFFFF, font, 10.f,
5.f + static_cast<float>(font->pixelHeight), 1.f, 1.f, 0.0f, color, 0);
}
}
}
class component final : public component_interface
{
public:
void post_start() override
{
scheduler::loop(draw_branding, scheduler::pipeline::renderer);
}
void post_unpack() override
{
if (game::environment::is_dedi())
@ -49,16 +64,6 @@ namespace branding
ui_get_formatted_build_number_hook.create(
SELECT_VALUE(0x0, 0x1DF300_b), ui_get_formatted_build_number_stub);
scheduler::loop([]()
{
const auto font = game::R_RegisterFont("fonts/fira_mono_bold.ttf", 20);
if (font)
{
game::R_AddCmdDrawText("H1-Mod: " VERSION, 0x7FFFFFFF, font, 10.f,
5.f + static_cast<float>(font->pixelHeight), 1.f, 1.f, 0.0f, color, 0);
}
}, scheduler::pipeline::renderer);
}
};
}

View File

@ -723,19 +723,17 @@ namespace game_console
{
return;
}
scheduler::loop(draw_console, scheduler::pipeline::renderer);
}
void post_unpack() override
{
scheduler::loop(draw_console, scheduler::pipeline::renderer);
if (game::environment::is_dedi())
{
return;
}
scheduler::loop(draw_console, scheduler::pipeline::renderer);
// initialize our structs
con.cursor = 0;
con.visible_line_count = 0;