document some functions [skip ci]

This commit is contained in:
mjkzy 2022-05-28 12:51:26 -05:00
parent 54f93df39e
commit b07910912b
5 changed files with 26 additions and 32 deletions

View File

@ -162,20 +162,20 @@ namespace dedicated
} }
utils::hook::detour ui_set_active_menu_hook; utils::hook::detour ui_set_active_menu_hook;
void ui_set_active_menu_stub(void* a1, int a2) void ui_set_active_menu_stub(void* localClientNum, int menu)
{ {
static auto done = false; static auto done = false;
if (done && (a2 == 6 || a2 == 7)) if (done && (menu == 6 || menu == 7))
{ {
return; return;
} }
if (a2 == 6 || a2 == 7) if (menu == 6 || menu == 7)
{ {
done = true; done = true;
} }
ui_set_active_menu_hook.invoke<void>(a1, a2); ui_set_active_menu_hook.invoke<void>(localClientNum, menu);
} }
} }

View File

@ -67,18 +67,18 @@ namespace network
a.jmp(0x12F3AC_b); a.jmp(0x12F3AC_b);
} }
int net_compare_base_address(const game::netadr_s* a1, const game::netadr_s* a2) int net_compare_base_address(const game::netadr_s* a, const game::netadr_s* b)
{ {
if (a1->type == a2->type) if (a->type == b->type)
{ {
switch (a1->type) switch (a->type)
{ {
case game::netadrtype_t::NA_BOT: case game::netadrtype_t::NA_BOT:
case game::netadrtype_t::NA_LOOPBACK: case game::netadrtype_t::NA_LOOPBACK:
return a1->port == a2->port; return a->port == b->port;
case game::netadrtype_t::NA_IP: case game::netadrtype_t::NA_IP:
return !memcmp(a1->ip, a2->ip, 4); return !memcmp(a->ip, b->ip, 4);
case game::netadrtype_t::NA_BROADCAST: case game::netadrtype_t::NA_BROADCAST:
return true; return true;
default: default:
@ -89,9 +89,9 @@ namespace network
return false; return false;
} }
int net_compare_address(const game::netadr_s* a1, const game::netadr_s* a2) int net_compare_address(const game::netadr_s* a, const game::netadr_s* b)
{ {
return net_compare_base_address(a1, a2) && a1->port == a2->port; return net_compare_base_address(a, b) && a->port == b->port;
} }
void reconnect_migratated_client(void*, game::netadr_s* from, const int, const int, const char*, void reconnect_migratated_client(void*, game::netadr_s* from, const int, const int, const char*,
@ -138,10 +138,10 @@ namespace network
get_callbacks()[utils::string::to_lower(command)] = callback; get_callbacks()[utils::string::to_lower(command)] = callback;
} }
int dw_send_to_stub(const int size, const char* src, game::netadr_s* a3) int dw_send_to_stub(const int size, const char* src, game::netadr_s* to)
{ {
sockaddr s = {}; sockaddr s = {};
game::NetadrToSockadr(a3, &s); game::NetadrToSockadr(to, &s);
return sendto(*game::query_socket, src, size, 0, &s, 16) >= 0; return sendto(*game::query_socket, src, size, 0, &s, 16) >= 0;
} }

View File

@ -111,17 +111,14 @@ namespace party
return false; return false;
} }
const char* get_didyouknow_stub(void* a1, int a2, int a3) const char* get_didyouknow_stub(void* table, int row, int column)
{ {
if (party::sv_motd.empty()) if (party::sv_motd.empty())
{ {
return utils::hook::invoke<const char*>(0x5A0AC0_b, a1, a2, a3); return utils::hook::invoke<const char*>(0x5A0AC0_b, table, row, column);
} }
else
{
return utils::string::va("%s", party::sv_motd.data()); return utils::string::va("%s", party::sv_motd.data());
} }
}
void disconnect() void disconnect()
{ {
@ -141,10 +138,10 @@ namespace party
utils::hook::detour cl_disconnect_hook; utils::hook::detour cl_disconnect_hook;
void cl_disconnect_stub(int a1) void cl_disconnect_stub(int showMainMenu) // possibly bool
{ {
party::clear_sv_motd(); party::clear_sv_motd();
cl_disconnect_hook.invoke<void>(a1); cl_disconnect_hook.invoke<void>(showMainMenu);
} }
void menu_error(const std::string& error) void menu_error(const std::string& error)

View File

@ -57,9 +57,6 @@ namespace patches
{ {
// Make name save // Make name save
dvars::register_string("name", get_login_username().data(), game::DVAR_FLAG_SAVED, "Player name."); dvars::register_string("name", get_login_username().data(), game::DVAR_FLAG_SAVED, "Player name.");
// Disable data validation error popup
dvars::register_int("data_validation_allow_drop", 0, 0, 0, game::DVAR_FLAG_NONE, "");
} }
return com_register_dvars_hook.invoke<void>(); return com_register_dvars_hook.invoke<void>();
@ -67,14 +64,14 @@ namespace patches
utils::hook::detour set_client_dvar_from_server_hook; utils::hook::detour set_client_dvar_from_server_hook;
void set_client_dvar_from_server_stub(void* a1, void* a2, const char* dvar, const char* value) void set_client_dvar_from_server_stub(void* clientNum, void* cgameGlob, const char* dvar, const char* value)
{ {
if (dvar == "cg_fov"s || dvar == "cg_fovMin"s) if (dvar == "cg_fov"s || dvar == "cg_fovMin"s)
{ {
return; return;
} }
set_client_dvar_from_server_hook.invoke<void>(0x11AA90_b, a1, a2, dvar, value); set_client_dvar_from_server_hook.invoke<void>(0x11AA90_b, clientNum, cgameGlob, dvar, value);
} }
const char* db_read_raw_file_stub(const char* filename, char* buf, const int size) const char* db_read_raw_file_stub(const char* filename, char* buf, const int size)
@ -148,14 +145,14 @@ namespace patches
utils::hook::invoke<void>(0x54EC50_b, client, msg); utils::hook::invoke<void>(0x54EC50_b, client, msg);
} }
void aim_assist_add_to_target_list(void* a1, void* a2) void aim_assist_add_to_target_list(void* aaGlob, void* screenTarget)
{ {
if (!dvars::aimassist_enabled->current.enabled) if (!dvars::aimassist_enabled->current.enabled)
{ {
return; return;
} }
game::AimAssist_AddToTargetList(a1, a2); game::AimAssist_AddToTargetList(aaGlob, screenTarget);
} }
} }

View File

@ -259,18 +259,18 @@ namespace server_list
utils::hook::detour lui_open_menu_hook; utils::hook::detour lui_open_menu_hook;
void lui_open_menu_stub(int controllerIndex, const char* menu, int a3, int a4, unsigned int a5) void lui_open_menu_stub(int controllerIndex, const char* menuName, int isPopup, int isModal, unsigned int isExclusive)
{ {
#ifdef DEBUG #ifdef DEBUG
console::info("[LUI] %s\n", menu); console::info("[LUI] %s\n", menuName);
#endif #endif
if (!strcmp(menu, "menu_systemlink_join")) if (!strcmp(menuName, "menu_systemlink_join"))
{ {
refresh_server_list(); refresh_server_list();
} }
lui_open_menu_hook.invoke<void>(controllerIndex, menu, a3, a4, a5); lui_open_menu_hook.invoke<void>(controllerIndex, menuName, isPopup, isModal, isExclusive);
} }
} }