Server list

This commit is contained in:
fed 2022-05-20 09:51:17 +02:00
parent b9ae2a1917
commit 99a23e453c
4 changed files with 64 additions and 13 deletions

View File

@ -33,7 +33,7 @@ namespace console
void dispatch_message(const int type, const std::string& message)
{
printf(message.data());
printf("%s", message.data());
game_console::print(type, message);
}

View File

@ -573,7 +573,7 @@ namespace party
network::on("infoResponse", [](const game::netadr_s& target, const std::string_view& data)
{
const utils::info_string info{data};
// server_list::handle_info_response(target, info);
server_list::handle_info_response(target, info);
if (connect_state.host != target)
{

View File

@ -118,8 +118,7 @@ namespace server_list
return diff > server_limit ? server_limit : static_cast<int>(diff);
}
const char* ui_feeder_item_text(int /*localClientNum*/, void* /*a2*/, void* /*a3*/, const int index,
const int column)
const char* ui_feeder_item_text(const int index, const int column)
{
std::lock_guard<std::mutex> _(mutex);
@ -366,13 +365,65 @@ namespace server_list
lui_open_menu_hook.create(game::LUI_OpenMenu, lui_open_menu_stub);
// replace UI_RunMenuScript call in LUI_CoD_LuaCall_RefreshServerList to our refresh_servers
utils::hook::call(0x28E049_b, &refresh_server_list);
utils::hook::call(0x28E55E_b, &join_server);
utils::hook::jump(0x28E049_b, utils::hook::assemble([](utils::hook::assembler& a)
{
a.pushad64();
a.call_aligned(refresh_server_list);
a.popad64();
a.xor_(eax, eax);
a.mov(rbx, qword_ptr(rsp, 0x38));
a.add(rsp, 0x20);
a.pop(rdi);
a.ret();
}), true);
utils::hook::jump(0x28E557_b, utils::hook::assemble([](utils::hook::assembler& a)
{
a.mov(r8d, edi);
a.mov(ecx, eax);
a.mov(ebx, eax);
a.pushad64();
a.call_aligned(join_server);
a.popad64();
a.jmp(0x28E563_b);
}), true);
utils::hook::nop(0x28E57D_b, 5);
// do feeder stuff
utils::hook::call(0x28E119_b, &ui_feeder_count);
utils::hook::call(0x28E331_b, &ui_feeder_item_text);
utils::hook::jump(0x28E117_b, utils::hook::assemble([](utils::hook::assembler& a)
{
a.mov(ecx, eax);
a.pushad64();
a.call_aligned(ui_feeder_count);
a.movd(xmm0, eax);
a.popad64();
a.mov(rax, qword_ptr(rbx, 0x48));
a.cvtdq2ps(xmm0, xmm0);
a.mov(rdi, 0x28E12B_b);
a.jmp(rdi);
}), true);
utils::hook::jump(0x28E331_b, utils::hook::assemble([](utils::hook::assembler& a)
{
a.push(rax);
a.pushad64();
a.mov(rcx, r9); // index
a.mov(rdx, qword_ptr(rsp, 0x88 + 0x20)); // column
a.call_aligned(ui_feeder_item_text);
a.mov(qword_ptr(rsp, 0x80), rax);
a.popad64();
a.pop(rax);
a.mov(rsi, qword_ptr(rsp, 0x90));
a.mov(rdi, rax);
a.jmp(0x28E341_b);
}), true);
scheduler::loop(do_frame_work, scheduler::pipeline::main);
@ -423,4 +474,4 @@ namespace server_list
};
}
//REGISTER_COMPONENT(server_list::component)
REGISTER_COMPONENT(server_list::component)

View File

@ -160,7 +160,7 @@ namespace game
WEAK symbol<void()> LUI_EnterCriticalSection{0x0, 0x2669B0};
WEAK symbol<void()> LUI_LeaveCriticalSection{0x0, 0x26BDC0};
WEAK symbol<bool(int clientNum, const char* menu)> Menu_IsMenuOpenAndVisible{0x0, 0x0};
WEAK symbol<bool(int clientNum, const char* menu)> Menu_IsMenuOpenAndVisible{0x0, 0x389F70};
WEAK symbol<scr_string_t(const char* str)> SL_FindString{0x0, 0x0};
WEAK symbol<scr_string_t(const char* str, unsigned int user)> SL_GetString{0x0, 0x5083A0};
@ -192,13 +192,13 @@ namespace game
WEAK symbol<void(const char* error, ...)> Sys_Error{0x0, 0x0};
WEAK symbol<void(char* path, int pathSize, Sys_Folder folder, const char* filename, const char* ext)>
Sys_BuildAbsPath{0x0, 0x0};
WEAK symbol<int()> Sys_Milliseconds{0x0, 0x0};
WEAK symbol<int()> Sys_Milliseconds{0x0, 0x5BDDF0};
WEAK symbol<bool()> Sys_IsDatabaseReady2{0x0, 0x4F79C0};
WEAK symbol<bool(int, void const*, const netadr_s*)> Sys_SendPacket{0x0, 0x5BDA90};
WEAK symbol<bool(const char* path)> Sys_FileExists{0x0, 0x0};
WEAK symbol<const char* (const char*)> UI_GetMapDisplayName{0x0, 0x0};
WEAK symbol<const char* (const char*)> UI_GetGameTypeDisplayName{0x0, 0x4DD8C0};
WEAK symbol<const char*(const char*)> UI_GetMapDisplayName{0x0, 0x4DDEE0};
WEAK symbol<const char*(const char*)> UI_GetGameTypeDisplayName{0x0, 0x4DD8C0};
WEAK symbol<void(unsigned int localClientNum, const char** args)> UI_RunMenuScript{0x0, 0x1E35B0};
WEAK symbol<int(const char* text, int maxChars, Font_s* font, float scale)> UI_TextWidth{0x0, 0x0};