Allow longer hostnames

This commit is contained in:
Federico Cecchetto
2022-03-09 22:27:12 +01:00
parent 6bcc45f227
commit 9e3cd77c6c
3 changed files with 119 additions and 121 deletions

View File

@ -258,20 +258,6 @@ namespace server_list
return true;
}
void resize_host_name(std::string& name)
{
name = utils::string::split(name, '\n').front();
game::Font_s* font = game::R_RegisterFont("fonts/default.otf", 18);
auto text_size = game::UI_TextWidth(name.data(), 32, font, 1.0f);
while (text_size > 450)
{
text_size = game::UI_TextWidth(name.data(), 32, font, 1.0f);
name.pop_back();
}
}
utils::hook::detour lui_open_menu_hook;
void lui_open_menu_stub(int controllerIndex, const char* menu, int a3, int a4, unsigned int a5)
@ -364,8 +350,6 @@ namespace server_list
server.in_game = 1;
resize_host_name(server.host_name);
insert_server(std::move(server));
}