From 3a1421acfbdc09177ea933ca9332b5e5d1f021c1 Mon Sep 17 00:00:00 2001 From: mjkzy Date: Sat, 28 May 2022 12:51:26 -0500 Subject: [PATCH] document some functions [skip ci] --- src/client/component/dedicated.cpp | 8 ++++---- src/client/component/network.cpp | 18 +++++++++--------- src/client/component/party.cpp | 13 +++++-------- src/client/component/patches.cpp | 11 ++++------- src/client/component/server_list.cpp | 8 ++++---- 5 files changed, 26 insertions(+), 32 deletions(-) diff --git a/src/client/component/dedicated.cpp b/src/client/component/dedicated.cpp index 98cb477b..bf0e361e 100644 --- a/src/client/component/dedicated.cpp +++ b/src/client/component/dedicated.cpp @@ -162,20 +162,20 @@ namespace dedicated } 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; - if (done && (a2 == 6 || a2 == 7)) + if (done && (menu == 6 || menu == 7)) { return; } - if (a2 == 6 || a2 == 7) + if (menu == 6 || menu == 7) { done = true; } - ui_set_active_menu_hook.invoke(a1, a2); + ui_set_active_menu_hook.invoke(localClientNum, menu); } } diff --git a/src/client/component/network.cpp b/src/client/component/network.cpp index e398af20..336de37f 100644 --- a/src/client/component/network.cpp +++ b/src/client/component/network.cpp @@ -67,18 +67,18 @@ namespace network 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_LOOPBACK: - return a1->port == a2->port; + return a->port == b->port; 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: return true; default: @@ -89,9 +89,9 @@ namespace network 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*, @@ -138,10 +138,10 @@ namespace network 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 = {}; - game::NetadrToSockadr(a3, &s); + game::NetadrToSockadr(to, &s); return sendto(*game::query_socket, src, size, 0, &s, 16) >= 0; } diff --git a/src/client/component/party.cpp b/src/client/component/party.cpp index 320aaa79..da192a27 100644 --- a/src/client/component/party.cpp +++ b/src/client/component/party.cpp @@ -111,16 +111,13 @@ namespace party 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()) { - return utils::hook::invoke(0x5A0AC0_b, a1, a2, a3); - } - else - { - return utils::string::va("%s", party::sv_motd.data()); + return utils::hook::invoke(0x5A0AC0_b, table, row, column); } + return utils::string::va("%s", party::sv_motd.data()); } void disconnect() @@ -141,10 +138,10 @@ namespace party utils::hook::detour cl_disconnect_hook; - void cl_disconnect_stub(int a1) + void cl_disconnect_stub(int showMainMenu) // possibly bool { party::clear_sv_motd(); - cl_disconnect_hook.invoke(a1); + cl_disconnect_hook.invoke(showMainMenu); } void menu_error(const std::string& error) diff --git a/src/client/component/patches.cpp b/src/client/component/patches.cpp index d4c4d457..276841bf 100644 --- a/src/client/component/patches.cpp +++ b/src/client/component/patches.cpp @@ -57,9 +57,6 @@ namespace patches { // Make name save 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(); @@ -67,14 +64,14 @@ namespace patches 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) { return; } - set_client_dvar_from_server_hook.invoke(0x11AA90_b, a1, a2, dvar, value); + set_client_dvar_from_server_hook.invoke(0x11AA90_b, clientNum, cgameGlob, dvar, value); } const char* db_read_raw_file_stub(const char* filename, char* buf, const int size) @@ -148,14 +145,14 @@ namespace patches utils::hook::invoke(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) { return; } - game::AimAssist_AddToTargetList(a1, a2); + game::AimAssist_AddToTargetList(aaGlob, screenTarget); } } diff --git a/src/client/component/server_list.cpp b/src/client/component/server_list.cpp index 81ebbd92..54354f7f 100644 --- a/src/client/component/server_list.cpp +++ b/src/client/component/server_list.cpp @@ -259,18 +259,18 @@ namespace server_list 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 - console::info("[LUI] %s\n", menu); + console::info("[LUI] %s\n", menuName); #endif - if (!strcmp(menu, "menu_systemlink_join")) + if (!strcmp(menuName, "menu_systemlink_join")) { refresh_server_list(); } - lui_open_menu_hook.invoke(controllerIndex, menu, a3, a4, a5); + lui_open_menu_hook.invoke(controllerIndex, menuName, isPopup, isModal, isExclusive); } }