diff --git a/src/client/component/branding.cpp b/src/client/component/branding.cpp index 7097235e..8cdbdfd7 100644 --- a/src/client/component/branding.cpp +++ b/src/client/component/branding.cpp @@ -20,10 +20,11 @@ namespace branding { utils::hook::detour ui_get_formatted_build_number_hook; + float color[4] = {0.666f, 0.666f, 0.666f, 0.666f}; + const char* ui_get_formatted_build_number_stub() { const auto* const build_num = ui_get_formatted_build_number_hook.invoke(); - return utils::string::va("%s (%s)", VERSION, build_num); } } @@ -41,8 +42,8 @@ namespace branding if (game::environment::is_mp()) { - localized_strings::override("LUA_MENU_MULTIPLAYER_CAPS", "H1-Mod: MULTIPLAYER\n"); - localized_strings::override("MENU_MULTIPLAYER_CAPS", "H1-Mod: MULTIPLAYER"); + localized_strings::override("LUA_MENU_MULTIPLAYER_CAPS", "H1-MOD: MULTIPLAYER\n"); + localized_strings::override("MENU_MULTIPLAYER_CAPS", "H1-MOD: MULTIPLAYER"); } dvars::override::Dvar_SetString("version", utils::string::va("H1-Mod %s", VERSION)); @@ -52,22 +53,10 @@ namespace branding scheduler::loop([]() { + const auto font = game::R_RegisterFont("fonts/fira_mono_bold.ttf", 20); - const auto x = 4; - const auto y = 4; - const auto scale = 1.0f; - float color[4] = {0.666f, 0.666f, 0.666f, 0.666f}; - - const auto* text = "H1-Mod: " VERSION; - - auto* font = game::R_RegisterFont("fonts/fira_mono_bold.ttf", 20); - - if (!font) return; - - game::R_AddCmdDrawText(text, 0x7FFFFFFF, font, static_cast(x), - y + static_cast(font->pixelHeight) * scale, - scale, scale, 0.0f, color, 0); - + game::R_AddCmdDrawText("H1-Mod: " VERSION, 0x7FFFFFFF, font, 10.f, + 5.f + static_cast(font->pixelHeight), 1.f, 1.f, 0.0f, color, 0); }, scheduler::pipeline::renderer); } }; diff --git a/src/client/component/command.cpp b/src/client/component/command.cpp index a80c67f2..0dab242c 100644 --- a/src/client/component/command.cpp +++ b/src/client/component/command.cpp @@ -93,6 +93,42 @@ namespace command parse_command_line(); reinterpret_cast(0x1400D8210)(); // mwr: test } + + game::dvar_t* dvar_command_stub() + { + const params args; + + if (args.size() <= 0) + { + return 0; + } + + const auto dvar = game::Dvar_FindVar(args[0]); + + if (dvar) + { + if (args.size() == 1) + { + const auto current = game::Dvar_ValueToString(dvar, dvar->current); + const auto reset = game::Dvar_ValueToString(dvar, dvar->reset); + + console::info("\"%s\" is: \"%s\" default: \"%s\" hash: 0x%08lX", + args[0], current, reset, dvar->hash); + + console::info(" %s\n", dvars::dvar_get_domain(dvar->type, dvar->domain).data()); + } + else + { + char command[0x1000] = { 0 }; + game::Dvar_GetCombinedString(command, 1); + game::Dvar_SetCommand(dvar->hash, "", command); + } + + return dvar; + } + + return 0; + } } void read_startup_variable(const std::string& dvar) @@ -110,7 +146,7 @@ namespace command // only +set dvar value if (game::Cmd_Argc() >= 3 && game::Cmd_Argv(0) == "set"s && game::Cmd_Argv(1) == dvar) { - game::Dvar_SetCommand(game::Cmd_Argv(1), game::Cmd_Argv(2)); + game::Dvar_SetCommand(game::generateHashValue(game::Cmd_Argv(1)), "", game::Cmd_Argv(2)); } game::Cmd_EndTokenizeString(); @@ -258,6 +294,7 @@ namespace command else { utils::hook::call(0x1400D728F, &parse_commandline_stub); // MWR TEST + utils::hook::jump(0x14041D750, dvar_command_stub); add_commands_mp(); } @@ -268,7 +305,7 @@ namespace command private: static void add_commands_generic() { - add("quit", game::Com_Quit_f); + add("quit", game::Quit); //add("quit_hard", utils::nt::raise_hard_exception); /* this command delivers you to a windows blue screen, its quit hard from windows xD */ add("crash", []() { diff --git a/src/client/component/console.cpp b/src/client/component/console.cpp index 7534d83a..dd9b7e1e 100644 --- a/src/client/component/console.cpp +++ b/src/client/component/console.cpp @@ -30,7 +30,9 @@ namespace console if (process == GetCurrentProcessId() || IsDebuggerPresent()) { +#ifndef NATIVE_CONSOLE ShowWindow(con_window, SW_HIDE); +#endif } } @@ -66,12 +68,14 @@ namespace console { hide_console(); +#ifdef NATIVE_CONSOLE + setvbuf(stdout, nullptr, _IONBF, 0); + setvbuf(stderr, nullptr, _IONBF, 0); +#else (void)_pipe(this->handles_, 1024, _O_TEXT); (void)_dup2(this->handles_[1], 1); (void)_dup2(this->handles_[1], 2); - - //setvbuf(stdout, nullptr, _IONBF, 0); - //setvbuf(stderr, nullptr, _IONBF, 0); +#endif } void post_start() override @@ -79,9 +83,9 @@ namespace console this->terminate_runner_ = false; this->console_runner_ = utils::thread::create_named_thread("Console IO", [this] - { - this->runner(); - }); + { + this->runner(); + }); } void pre_destroy() override @@ -105,9 +109,9 @@ namespace console _close(this->handles_[1]); messages.access([&](message_queue& msgs) - { - msgs = {}; - }); + { + msgs = {}; + }); } void post_unpack() override @@ -133,7 +137,9 @@ namespace console { if (game::environment::is_dedi() || !utils::flags::has_flag("noconsole")) { +#ifndef NATIVE_CONSOLE game::Sys_ShowConsole(); +#endif } if (!game::environment::is_dedi()) @@ -181,10 +187,10 @@ namespace console { messages.access([&](message_queue& msgs) - { - message_queue_copy = std::move(msgs); - msgs = {}; - }); + { + message_queue_copy = std::move(msgs); + msgs = {}; + }); } while (!message_queue_copy.empty()) diff --git a/src/client/component/fps.cpp b/src/client/component/fps.cpp index 3e06f2e0..82d8f715 100644 --- a/src/client/component/fps.cpp +++ b/src/client/component/fps.cpp @@ -12,11 +12,12 @@ namespace fps { namespace { + game::dvar_t* cg_drawfps; + game::dvar_t* cg_drawping; + float fps_color_good[4] = {0.6f, 1.0f, 0.0f, 1.0f}; float fps_color_ok[4] = {1.0f, 0.7f, 0.3f, 1.0f}; float fps_color_bad[4] = {1.0f, 0.3f, 0.3f, 1.0f}; - - //float origin_color[4] = {1.0f, 0.67f, 0.13f, 1.0f}; float ping_color[4] = {1.0f, 1.0f, 1.0f, 0.65f}; struct cg_perf_data @@ -90,57 +91,46 @@ namespace fps void cg_draw_fps() { - const auto* draw_fps = game::Dvar_FindVar("cg_drawFPS"); - if (draw_fps && draw_fps->current.integer > 0 /*&& game::CL_IsCgameInitialized()*/) + if (cg_drawfps->current.integer > 0) { const auto fps = static_cast(static_cast(1000.0f / static_cast(cg_perf. average)) + 9.313225746154785e-10); - auto* font = game::R_RegisterFont("fonts/fira_mono_regular.ttf", 19); - if (!font) return; + const auto font = game::R_RegisterFont("fonts/fira_mono_regular.ttf", 25); + const auto fps_string = utils::string::va("%i", fps); - const auto* const fps_string = utils::string::va("%i", fps); - - const auto scale = 1.0f; - - const auto x = (game::ScrPlace_GetViewPlacement()->realViewportSize[0] - 10.0f) - game::R_TextWidth( - fps_string, 0x7FFFFFFF, font) * scale; - - const auto y = font->pixelHeight * 1.2f; + const auto x = (game::ScrPlace_GetViewPlacement()->realViewportSize[0] - 15.0f) - game::R_TextWidth( + fps_string, 0x7FFFFFFF, font); + const auto y = font->pixelHeight + 10.f; const auto fps_color = fps >= 60 ? fps_color_good : (fps >= 30 ? fps_color_ok : fps_color_bad); - game::R_AddCmdDrawText(fps_string, 0x7FFFFFFF, font, x, y, scale, scale, 0.0f, fps_color, 6); + game::R_AddCmdDrawText(fps_string, 0x7FFFFFFF, font, x, y, 1.f, 1.f, 0.0f, fps_color, 6); } } void cg_draw_ping() { - const auto* draw_ping = game::Dvar_FindVar("cg_drawPing"); - if (draw_ping && draw_ping->current.integer > 0 && game::CL_IsCgameInitialized()) + if (cg_drawping->current.integer > 0 && game::CL_IsCgameInitialized()) { - const auto ping = *reinterpret_cast(0x142D106F0); // H1MP(1.4) + const auto ping = *reinterpret_cast(0x142D106F0); - auto* font = game::R_RegisterFont("fonts/consolefont", 20); - if (!font) return; - - auto* const ping_string = utils::string::va("Ping: %i", ping); - - const auto scale = 1.0f; + const auto font = game::R_RegisterFont("fonts/consolefont", 20); + const auto ping_string = utils::string::va("Ping: %i", ping); const auto x = (game::ScrPlace_GetViewPlacement()->realViewportSize[0] - 375.0f) - game::R_TextWidth( - ping_string, 0x7FFFFFFF, font) * scale; + ping_string, 0x7FFFFFFF, font); - const auto y = font->pixelHeight * 1.2f; - - game::R_AddCmdDrawText(ping_string, 0x7FFFFFFF, font, x, y, scale, scale, 0.0f, ping_color, 6); + const auto y = font->pixelHeight + 15.f; + game::R_AddCmdDrawText(ping_string, 0x7FFFFFFF, font, x, y, 1.f, 1.f, 0.0f, ping_color, 6); } } - void cg_draw_fps_register_stub(const char* name, const char** _enum, const int value, unsigned int /*flags*/, + game::dvar_t* cg_draw_fps_register_stub(const char* name, const char** _enum, const int value, unsigned int /*flags*/, const char* desc) { - game::Dvar_RegisterEnum(name, _enum, value, game::DVAR_FLAG_SAVED); + cg_drawfps = dvars::register_int("cg_drawFps", 0, 0, 2, game::DVAR_FLAG_SAVED, false); + return cg_drawfps; } } @@ -156,18 +146,24 @@ namespace fps // fps setup cg_perf.perf_start = std::chrono::high_resolution_clock::now(); - utils::hook::call(SELECT_VALUE(0x14018D261, 0x14025B747), &perf_update); // H1(1.4) + utils::hook::call(SELECT_VALUE(0x14018D261, 0x14025B747), &perf_update); // change cg_drawfps flags to saved - utils::hook::call(SELECT_VALUE(0x140139F48, 0x1401A4B8E), &cg_draw_fps_register_stub); //h1sp + utils::hook::call(SELECT_VALUE(0x140139F48, 0x140222A46), &cg_draw_fps_register_stub); scheduler::loop(cg_draw_fps, scheduler::pipeline::renderer); + + if (game::environment::is_sp()) + { + cg_drawfps = dvars::register_int("cg_drawFps", 0, 0, 2, game::DVAR_FLAG_SAVED, false); + } + if (game::environment::is_mp()) { // fix ping value - utils::hook::nop(0x14025AC41, 2); // H1MP(1.4) + utils::hook::nop(0x14025AC41, 2); - dvars::register_int("cg_drawPing", 0, 0, 1, game::DVAR_FLAG_SAVED, true); + cg_drawping = dvars::register_int("cg_drawPing", 0, 0, 1, game::DVAR_FLAG_SAVED, true); scheduler::loop(cg_draw_ping, scheduler::pipeline::renderer); } diff --git a/src/client/component/game_console.hpp b/src/client/component/game_console.hpp index 82a7aabd..cdc001a7 100644 --- a/src/client/component/game_console.hpp +++ b/src/client/component/game_console.hpp @@ -4,7 +4,4 @@ namespace game_console { bool console_char_event(int local_client_num, int key); bool console_key_event(int local_client_num, int key, int down); - - bool match_compare(const std::string& input, const std::string& text, const bool exact); - void find_matches(std::string input, std::vector& suggestions, const bool exact); } \ No newline at end of file diff --git a/src/client/component/patches.cpp b/src/client/component/patches.cpp index 29045d23..539a9ac4 100644 --- a/src/client/component/patches.cpp +++ b/src/client/component/patches.cpp @@ -94,6 +94,8 @@ namespace patches // Disable data validation error popup dvars::register_int("data_validation_allow_drop", 0, 0, 0, game::DVAR_FLAG_NONE, true); + + dvars::register_int("com_maxfps", 0, 10, 1000, game::DVAR_FLAG_SAVED, false); } return com_register_dvars_hook.invoke(); @@ -157,7 +159,6 @@ namespace patches reinterpret_cast(0x14043AA90)(client, msg); } - } class component final : public component_interface diff --git a/src/client/component/renderer.cpp b/src/client/component/renderer.cpp new file mode 100644 index 00000000..adf50b0a --- /dev/null +++ b/src/client/component/renderer.cpp @@ -0,0 +1,75 @@ +#include +#include "loader/component_loader.hpp" +#include "game/game.hpp" +#include "game/dvars.hpp" + +#include + +namespace renderer +{ + namespace + { + utils::hook::detour r_init_draw_method_hook; + utils::hook::detour r_update_front_end_dvar_options_hook; + + int get_fullbright_technique() + { + return game::TECHNIQUE_UNLIT; + } + + void gfxdrawmethod() + { + game::gfxDrawMethod->drawScene = game::GFX_DRAW_SCENE_STANDARD; + + game::gfxDrawMethod->baseTechType = dvars::r_fullbright->current.enabled ? get_fullbright_technique() : game::TECHNIQUE_LIT; + game::gfxDrawMethod->emissiveTechType = dvars::r_fullbright->current.enabled ? get_fullbright_technique() : game::TECHNIQUE_EMISSIVE; + game::gfxDrawMethod->forceTechType = dvars::r_fullbright->current.enabled ? get_fullbright_technique() : 242; + } + + void r_init_draw_method_stub() + { + gfxdrawmethod(); + } + + bool r_update_front_end_dvar_options_stub() + { + if (dvars::r_fullbright->modified) + { + game::Dvar_ClearModified(dvars::r_fullbright); + game::R_SyncRenderThread(); + + gfxdrawmethod(); + } + + return r_update_front_end_dvar_options_hook.invoke(); + } + } + + class component final : public component_interface + { + public: + void post_unpack() override + { + if (game::environment::is_dedi()) + { + return; + } + + dvars::r_fullbright = dvars::register_int("r_fullbright", 0, 0, 3, game::DVAR_FLAG_SAVED); + + r_init_draw_method_hook.create(SELECT_VALUE(0x1404BD140, 0x1405C46E0), &r_init_draw_method_stub); + r_update_front_end_dvar_options_hook.create(SELECT_VALUE(0x1404F8870, 0x1405FF9E0), &r_update_front_end_dvar_options_stub); + + // use "saved" flags for "r_normalMap" + utils::hook::set(SELECT_VALUE(0x0, 0x1405D460E), game::DVAR_FLAG_SAVED); + + // use "saved" flags for "r_specularMap" + utils::hook::set(SELECT_VALUE(0x0, 0x1405D4639), game::DVAR_FLAG_SAVED); + + // use "saved" flags for "r_specOccMap" + utils::hook::set(SELECT_VALUE(0x0, 0x1405D4664), game::DVAR_FLAG_SAVED); + } + }; +} + +REGISTER_COMPONENT(renderer::component) \ No newline at end of file diff --git a/src/client/component/virtuallobby.cpp b/src/client/component/virtuallobby.cpp new file mode 100644 index 00000000..eb6295f7 --- /dev/null +++ b/src/client/component/virtuallobby.cpp @@ -0,0 +1,63 @@ +#include +#include "loader/component_loader.hpp" + +#include "game/game.hpp" +#include "game/dvars.hpp" + +#include + +namespace virtuallobby +{ + namespace + { + game::dvar_t* virtualLobby_fovscale; + + const auto get_fovscale_stub = utils::hook::assemble([](utils::hook::assembler& a) + { + const auto ret = a.newLabel(); + const auto original = a.newLabel(); + + a.pushad64(); + a.mov(rax, qword_ptr(0x1425F7210)); // virtualLobbyInFiringRange + a.cmp(byte_ptr(rax, 0x10), 1); + a.je(original); + a.call_aligned(game::VirtualLobby_Loaded); + a.cmp(al, 0); + a.je(original); + + // virtuallobby + a.popad64(); + a.mov(rax, ptr(reinterpret_cast(&virtualLobby_fovscale))); + a.jmp(ret); + + // original + a.bind(original); + a.popad64(); + a.mov(rax, qword_ptr(0x1413A8580)); + a.jmp(ret); + + a.bind(ret); + a.mov(rcx, 0x142935000); + a.jmp(0x1400B556A); + }); + } + + class component final : public component_interface + { + public: + void post_unpack() override + { + if (!game::environment::is_mp()) + { + return; + } + + virtualLobby_fovscale = dvars::register_float("virtualLobby_fovScale", 0.7f, 0.0f, 2.0f, game::DVAR_FLAG_SAVED); + + utils::hook::nop(0x1400B555C, 14); + utils::hook::jump(0x1400B555C, get_fovscale_stub, true); + } + }; +} + +REGISTER_COMPONENT(virtuallobby::component) diff --git a/src/client/game/dvars.cpp b/src/client/game/dvars.cpp index 778c8149..56050781 100644 --- a/src/client/game/dvars.cpp +++ b/src/client/game/dvars.cpp @@ -562,7 +562,6 @@ namespace dvars return game::Dvar_RegisterString(hash, "", value, flags); } - game::dvar_t* register_float(const std::string& name, float value, float min, float max, game::DvarFlags flags, bool add_to_list) { diff --git a/src/client/game/game.cpp b/src/client/game/game.cpp index d47c6bc2..9045761b 100644 --- a/src/client/game/game.cpp +++ b/src/client/game/game.cpp @@ -23,6 +23,11 @@ namespace game return sv_cmd_args->argv[sv_cmd_args->nesting][index]; } + bool VirtualLobby_Loaded() + { + return !game::environment::is_sp() && *mp::virtualLobby_loaded == 1; + } + namespace environment { launcher::mode mode = launcher::mode::none; diff --git a/src/client/game/symbols.hpp b/src/client/game/symbols.hpp index 8f5a754f..c47353aa 100644 --- a/src/client/game/symbols.hpp +++ b/src/client/game/symbols.hpp @@ -8,215 +8,181 @@ namespace game * Functions **************************************************************/ + WEAK symbol AddRefToValue{0, 0x1405C0EB0}; + WEAK symbol AddRefToObject{0, 0x1405C0EA0}; + WEAK symbol AllocThread{0, 0x1405C1200}; + WEAK symbol RemoveRefToValue{0, 0x1405C29B0}; + WEAK symbol RemoveRefToObject{0, 0x1405C28A0}; + WEAK symbol BG_GetWeaponNameComplete{0, 0x140165580}; - WEAK symbol Cbuf_AddText{0x140342EB0, 0x1404033B0}; // H1(1.4) - WEAK symbol Conbuf_AppendText{0x1403E3300, 0x140513FF0}; // H1(1.4) - WEAK symbol Cmd_ExecuteSingleCommand{0x140343980, 0x140343980}; // H1SP64[CODEX] - WEAK symbol Cmd_AddCommandInternal{0x1403433E0, 0x140403950}; // H1(1.4) - WEAK symbol Cmd_TokenizeString{0x140344110, 0x1404046F0}; // H1(1.4) - WEAK symbol Cmd_EndTokenizeString{0x140343630, 0x140403C20}; // H1(1.4) + WEAK symbol Cbuf_AddText{0x140342EB0, 0x1404033B0}; + WEAK symbol Conbuf_AppendText{0x1403E3300, 0x140513FF0}; + WEAK symbol Cmd_ExecuteSingleCommand{0x140343980, 0x140343980}; + WEAK symbol Cmd_AddCommandInternal{0x1403433E0, 0x140403950}; + WEAK symbol Cmd_TokenizeString{0x140344110, 0x1404046F0}; + WEAK symbol Cmd_EndTokenizeString{0x140343630, 0x140403C20}; - WEAK symbol Com_Frame_Try_Block_Function{0, 0x1400D8310}; //H1MP MWR TEST - WEAK symbol Com_GetCurrentCoDPlayMode{0, 0x1405039A0}; // H1(1.4) - WEAK symbol Com_SetSlowMotion{0, 0x1400DB790}; // H1(1.4) - WEAK symbol Com_Error{0x1403509C0, 0x1400D78A0}; // H1(1.4) - WEAK symbol Com_Quit_f{0x140352BE0, 0x1400DA830}; // H1(1.4) + WEAK symbol Com_Frame_Try_Block_Function{0, 0x1400D8310}; + WEAK symbol Com_GetCurrentCoDPlayMode{0, 0x1405039A0}; + WEAK symbol Com_SetSlowMotion{0, 0x1400DB790}; + WEAK symbol Com_Error{0x1403509C0, 0x1400D78A0}; + WEAK symbol Com_Quit_f{0x140352BE0, 0x1400DA830}; + WEAK symbol Quit{0x140352D90, 0x1400DA830}; - WEAK symbol Key_KeynumToString{0x140187CC0, 0x14024FE10}; // H1(1.4) + WEAK symbol CG_GameMessage{0x1401389A0, 0x140220CC0}; + WEAK symbol CG_GameMessageBold{0x140138750, 0x140220620}; - WEAK symbol CG_GameMessage{0x1401389A0, 0x140220CC0}; // H1(1.4) - WEAK symbol CG_GameMessageBold{0x140138750, 0x140220620}; // H1(1.4) + WEAK symbol CL_IsCgameInitialized{0x14017EE30, 0x140245650}; - WEAK symbol Dvar_SetCommand{0x1403C72B0, 0x1404FD0A0}; // H1(1.4) - WEAK symbol Dvar_FindVar{0x1403C5D50, 0x1404FBB00}; // H1(1.4) - WEAK symbol Dvar_GetCombinedString{0x140354DF0, 0x14041D830}; // H1(1.4) - //WEAK symbol Dvar_ValueToString{0x1403C8560,0x1404FE660}; // H1(1.4); different typedef from previous titles - WEAK symbol Dvar_ValueToString{0x1403C8560, 0x1404FE660}; // H1(1.4) - //WEAK symbol Dvar_SetCommand{0, 0x1404FD0A0}; // H1(1.4) + WEAK symbol Dvar_SetCommand{0x1403C72B0, 0x1404FD0A0}; + WEAK symbol Dvar_FindVar{0x1403C5D50, 0x1404FBB00}; + WEAK symbol Dvar_ClearModified{0x0, 0x1404FB930}; + WEAK symbol Dvar_GetCombinedString{0x140354DF0, 0x14041D830}; + WEAK symbol Dvar_ValueToString{0x1403C8560, 0x1404FE660}; + WEAK symbol Dvar_RegisterBool{0x1403C47E0, 0x1404FA540}; + WEAK symbol Dvar_RegisterInt{0x1403C4CC0, 0x1404FAA20}; + WEAK symbol Dvar_RegisterFloat{0x1403C4BB0, 0x1404FA910}; + WEAK symbol Dvar_RegisterString{0x1403C4DA0, 0x1404FAB00}; + WEAK symbol Dvar_RegisterVec4{0x1403C5220, 0x1404FAF40}; + WEAK symbol Dvar_RegisterEnum{0x1403C4AC0, 0x1404C0EC0}; - WEAK symbol Dvar_RegisterBool{0x1403C47E0,0x1404FA540}; // H1 - WEAK symbol Dvar_RegisterInt{0x1403C4CC0, 0x1404FAA20}; // H1 - WEAK symbol Dvar_RegisterFloat{0x1403C4BB0,0x1404FA910}; // H1(1.4) - WEAK symbol Dvar_RegisterString{0x1403C4DA0,0x1404FAB00}; // H1(1.4) - WEAK symbol Dvar_RegisterVec4{0x1403C5220, 0x1404FAF40}; // H1(1.4) - WEAK symbol Dvar_RegisterEnum{0x1403C4AC0, 0x1404C0EC0}; // H1(1.4) + WEAK symbol FS_ReadFile{0x1403B9020, 0x1404EE720}; + WEAK symbol FS_FreeFile{0x1403B9010, 0x1404EE710}; + WEAK symbol FS_Startup{0x1403B85D0, 0x1404EDD30}; + WEAK symbol FS_AddLocalizedGameDirectory{0x1403B6030, 0x1404EBE20}; - WEAK symbol Scr_GetFloat{0x140374D20, 0x140442D10}; // H1(1.4) - WEAK symbol Scr_GetNumParam{0x140374F30, 0x140442E70}; // H1(1.4) - - WEAK symbol FS_ReadFile{0x1403B9020, 0x1404EE720}; // H1(1.4) - WEAK symbol FS_FreeFile{0x1403B9010, 0x1404EE710}; // H1(1.4) - WEAK symbol FS_Startup{0x1403B85D0, 0x1404EDD30}; // H1(1.4) - WEAK symbol FS_AddLocalizedGameDirectory{0x1403B6030, 0x1404EBE20}; // H1(1.4) - - WEAK symbol generateHashValue{0x1400FE8A0, 0x1401B1010}; // H1(1.4) - - WEAK symbol CL_IsCgameInitialized{0x14017EE30, 0x140245650}; // H1(1.4) - WEAK symbol Live_SyncOnlineDataFlags{0, 0x14059A700}; // H1(1.4) - - WEAK symbol Sys_Milliseconds{0x1403E2B10, 0x140513710}; // H1(1.4) - WEAK symbol Sys_IsDatabaseReady2{0x1403580B0, 0x14042B090}; // H1(1.4) - - WEAK symbol SV_FastRestart{ 0, 0x14047E990 }; // H1(1.4) - WEAK symbol SV_GameSendServerCommand{ - 0x1403F3A70, 0x140484AD0 - }; // H1MP(1.4) - WEAK symbol SV_DirectConnect{0, 0x140480860}; // H1(1.4) - WEAK symbol SV_Cmd_TokenizeString{0x1402EF050, 0x140404D20}; // H1(1.4) - WEAK symbol SV_Cmd_EndTokenizedString{0x140344700, 0x140404CE0}; // H1(1.4) - - WEAK symbol SV_BotIsBot{ 0, 0x14046E6C0 }; // H1(1.4) - - WEAK symbol Sys_SendPacket{0x1403E2820, 0x1405133B0}; // H1(1.4) - - WEAK symbol NetadrToSockadr{0x1403C11C0, 0x1404F62F0}; // H1(1.4) - WEAK symbol NET_OutOfBandPrint{0x140357560, 0x1404255D0}; // H1(1.4) - WEAK symbol NET_SendLoopPacket{0, 0x140425790}; // H1(1.4) - - WEAK symbol NET_StringToAdr{ 0, 0x140425870 }; // H1(1.4) - - //WEAK symbol R_RegisterFont{ 0x140481F90, 0x1405D91E0 }; // H1MP(1.4) - - WEAK symbol I_CleanStr{0x1403CD230, 0}; // H1(1.4) - WEAK symbol ScrPlace_GetViewPlacement{0x1401981F0, 0x140288550}; // H1(1.4) - - WEAK symbol Material_RegisterHandle{0x1404E48B0, 0x1405EAB30}; // H1(1.4) - - WEAK symbol R_AddCmdDrawStretchPic{0x14017E5C0, 0x1402443A0}; // H1(1.4) - - WEAK symbol R_RegisterFont{0x1404D4100, 0x1405D91E0}; // H1(1.4) - WEAK symbol R_GetFontHeight{0x1405EA360, 0x1405D92C0}; // H1(1.4) - WEAK symbol JUST_DO_OUR_DIRTY_WORK{0x1404D37B0, 0x1405D8890}; // H1(1.4) - - WEAK symbol G_GetClientScore{0, 0x140342F90}; // H1(1.4) - WEAK symbol SV_GetGuid{0, 0x140484B90}; // H1(1.4) - WEAK symbol SV_GetClientPing{0, 0x140484B70}; // H1(1.4) - WEAK symbol SV_GetPlayerstateForClientNum{0x1404426D0, 0}; // H1SP(1.4) - - WEAK symbol H1_AddBaseDrawTextCmd{0x1404F3DC0,0x1405FB1F0}; // H1(1.4) - -#define R_AddCmdDrawText(TXT,MC,F,X,Y,XS,YS,R,C,S) H1_AddBaseDrawTextCmd(TXT,MC,F,game::R_GetFontHeight(F),X,Y,XS,YS,R,C,S,-1,0,game::JUST_DO_OUR_DIRTY_WORK(S)) - -#define R_AddCmdDrawTextWithCursor(TXT,MC,F,UNK,X,Y,XS,YS,R,C,S,CP,CC) H1_AddBaseDrawTextCmd(TXT,MC,F,game::R_GetFontHeight(F),X,Y,XS,YS,R,C,S,CP,CC,game::JUST_DO_OUR_DIRTY_WORK(S)) - - WEAK symbol R_TextWidth{0x1404D43B0, 0x1405D94A0}; // H1(1.4) - - WEAK symbol cmd_functions{0x14AD99AB8,0x14946BAC8}; // H1(1.4) - WEAK symbol keyCatchers{0x14243DAF0,0x142D0BA9C}; // H1(1.4) - WEAK symbol playerKeys{0x1422A873C,0x142C19AFC}; // H1(1.4) - WEAK symbol cmd_args{0x14AD99960, 0x14946B970}; // H1(1.4) - WEAK symbol query_socket{0, 0x14DDFBF98}; // H1(1.4) - - //########################################################################################################################################################################### - //########################################################################################################################################################################### - //########################################################################################################################################################################### - - WEAK symbol G_Glass_Update{0, 0x14033A640}; // H1(1.4) - - WEAK symbol AddRefToValue{0, 0x1405C0EB0}; - WEAK symbol AddRefToObject{0,0x1405C0EA0}; - WEAK symbol AllocThread{0,0x1405C1200}; - WEAK symbol RemoveRefToValue{0, 0x1405C29B0}; - WEAK symbol RemoveRefToObject{0,0x1405C28A0}; - - WEAK symbol - DB_EnumXAssets_Internal{0, 0x1404129F0}; - WEAK symbol DB_GetXAssetName{0,0x1403E4090}; - WEAK symbol DB_LoadXAssets{0,0x140414FF0}; - WEAK symbol DB_FindXAssetHeader{0, 0x140412F60}; - WEAK symbol DB_GetRawFileLen{0,0x140413D80}; - WEAK symbol DB_GetRawBuffer{0,0x140413C40}; - WEAK symbol DB_GetXAssetTypeSize{0x14019A3B0, 0x14028BE70}; // H1(1.4) - - WEAK symbol FindVariable{0,0x1405C1D50}; - WEAK symbol FindEntityId{0, 0x1405C1C50}; - WEAK symbol GetEntityFieldValue{0, 0x1405C6100}; - - WEAK symbol G_GetWeaponForName{0x1402C2A90, 0}; // H1SP(1.4) - //WEAK symbol - //G_GivePlayerWeapon{0, 0x14051B660}; - - WEAK symbol - G_GivePlayerWeapon{0x1402C2DF0, 0x14051B660}; // h1sp + WEAK symbol generateHashValue{0x1400FE8A0, 0x1401B1010}; + WEAK symbol G_Glass_Update{0, 0x14033A640}; + WEAK symbol G_GetClientScore{0, 0x140342F90}; + WEAK symbol G_GetWeaponForName{0x1402C2A90, 0}; + WEAK symbol G_GivePlayerWeapon{0x1402C2DF0, 0x14051B660}; WEAK symbol G_InitializeAmmo{0, 0x1404C4110}; - WEAK symbol G_SelectWeapon{0,0x14051C0D0}; - WEAK symbol G_TakePlayerWeapon{0x1402C3900, 0}; // H1SP(1.4) + WEAK symbol G_SelectWeapon{0, 0x14051C0D0}; + WEAK symbol G_TakePlayerWeapon{0x1402C3900, 0}; + + WEAK symbol I_CleanStr{0x1403CD230, 0}; WEAK symbol Image_Setup{0, 0x14074B2A0}; - WEAK symbol LUI_OpenMenu{0, 0x1404CD210}; // H1(1.4) + WEAK symbol Key_KeynumToString{0x140187CC0, 0x14024FE10}; + WEAK symbol Live_SyncOnlineDataFlags{0, 0x14059A700}; + + WEAK symbol Material_RegisterHandle{0x1404E48B0, 0x1405EAB30}; + + WEAK symbol NetadrToSockadr{0x1403C11C0, 0x1404F62F0}; + WEAK symbol NET_OutOfBandPrint{0x140357560, 0x1404255D0}; + WEAK symbol NET_SendLoopPacket{0, 0x140425790}; + WEAK symbol NET_StringToAdr{0, 0x140425870}; + + WEAK symbol R_AddCmdDrawStretchPic{0x14017E5C0, 0x1402443A0}; + WEAK symbol R_RegisterFont{0x1404D4100, 0x1405D91E0}; + WEAK symbol R_TextWidth{0x1404D43B0, 0x1405D94A0}; + WEAK symbol R_GetFontHeight{0x1405EA360, 0x1405D92C0}; + WEAK symbol R_DrawSomething{0x1404D37B0, 0x1405D8890}; + WEAK symbol R_SyncRenderThread{0,0x1405FF3A0}; + WEAK symbol R_AddDObjToScene{0, 0x140775C40}; + WEAK symbol H1_AddBaseDrawTextCmd{0x1404F3DC0, 0x1405FB1F0}; + +#define R_AddCmdDrawText(TXT, MC, F, X, Y, XS, YS, R, C, S) \ + H1_AddBaseDrawTextCmd(TXT, MC, F, game::R_GetFontHeight(F), X, Y, XS, YS, R, C, S,-1, 0, game::R_DrawSomething(S)) +#define R_AddCmdDrawTextWithCursor(TXT, MC, F, UNK, X, Y, XS, YS, R, C, S, CP, CC) \ + H1_AddBaseDrawTextCmd(TXT, MC, F, game::R_GetFontHeight(F), X, Y, XS, YS, R, C, S, CP, CC, game::R_DrawSomething(S)) + + WEAK symbol Scr_GetFloat{0x140374D20, 0x140442D10}; + WEAK symbol Scr_GetNumParam{0x140374F30, 0x140442E70}; + + WEAK symbol ScrPlace_GetViewPlacement{0x1401981F0, 0x140288550}; + + WEAK symbol + DB_EnumXAssets_Internal{0, 0x1404129F0}; + WEAK symbol DB_GetXAssetName{0, 0x1403E4090}; + WEAK symbol DB_LoadXAssets{0, 0x140414FF0}; + WEAK symbol DB_FindXAssetHeader{0, 0x140412F60}; + WEAK symbol DB_GetRawFileLen{0, 0x140413D80}; + WEAK symbol DB_GetRawBuffer{0, 0x140413C40}; + WEAK symbol DB_GetXAssetTypeSize{0x14019A3B0, 0x14028BE70}; + + WEAK symbol FindVariable{0, 0x1405C1D50}; + WEAK symbol FindEntityId{0, 0x1405C1C50}; + WEAK symbol GetEntityFieldValue{0, 0x1405C6100}; + + WEAK symbol LUI_OpenMenu{0, 0x1404CD210}; WEAK symbol Menu_IsMenuOpenAndVisible{0, 0x1405EE1A0}; WEAK symbol Scr_AllocVector{0, 0x1405C3220}; WEAK symbol Scr_ClearOutParams{0, 0x1405C6E50}; WEAK symbol Scr_GetEntityIdRef{0, 0x1405C56C0}; - WEAK symbol Scr_SetObjectField{0,0x140512190}; - WEAK symbol Scr_NotifyId{0,0x1405C8240}; - - WEAK symbol VM_Execute{0, 0x1405C8DB0}; - - WEAK symbol R_SyncRenderThread{0,0x14076E7D0}; - WEAK symbol R_AddDObjToScene{0, 0x140775C40}; + WEAK symbol Scr_SetObjectField{0, 0x140512190}; + WEAK symbol Scr_NotifyId{0, 0x1405C8240}; WEAK symbol SL_ConvertToString{0x14036D420, 0x1405BFBB0}; WEAK symbol SL_FindString{ 0x140314AF0, 0x14043B470 }; // H1(1.4) WEAK symbol SL_GetString{0x14036D9A0, 0x1405C0170}; - WEAK symbol SV_SetConfigstring{0, 0x140486720}; // H1(1.4) - - WEAK symbol SV_Loaded{0x140442F60, 0x1404864A0}; // H1(1.4) - - WEAK symbol SV_KickClientNum{ 0, 0x14047ED00 }; // H1(1.4) - - WEAK symbol SV_MapExists{0, 0x14047ED60}; // H1(1.4) - - WEAK symbol Sys_ShowConsole{0x1403E3B90, 0x140514910}; // H1(1.4) - - WEAK symbol UI_GetMapDisplayName{0, 0x140408CC0}; // H1(1.4) - - WEAK symbol UI_GetGameTypeDisplayName{0, 0x1404086A0}; // H1(1.4) - - WEAK symbol Sys_Error{0x1403E0C40, 0x140511520}; // H1(1.4) - - WEAK symbol UI_SafeTranslateString{0x140350430, 0x1405A2930}; // H1(1.4) - - WEAK symbol UI_RunMenuScript{0, 0x1404CFE60}; // H1(1.4) - - WEAK symbol longjmp{0x140648FD4, 0x14089EED0}; // H1(1.4) - WEAK symbol _setjmp{0x1406BFDD0, 0x1408EC2E0}; // H1(1.4) - - WEAK symbol UI_TextWidth{ 0, 0x1404D21A0 }; // H1(1.4) - + WEAK symbol SV_DirectConnect{0, 0x140480860}; + WEAK symbol SV_Cmd_TokenizeString{0x1402EF050, 0x140404D20}; + WEAK symbol SV_Cmd_EndTokenizedString{0x140344700, 0x140404CE0}; + WEAK symbol SV_BotIsBot{0, 0x14046E6C0}; + WEAK symbol SV_GetGuid{0, 0x140484B90}; + WEAK symbol SV_GetClientPing{0, 0x140484B70}; + WEAK symbol SV_GetPlayerstateForClientNum{0x1404426D0, 0}; + WEAK symbol SV_SetConfigstring{0, 0x140486720}; + WEAK symbol SV_Loaded{0x140442F60, 0x1404864A0}; + WEAK symbol SV_KickClientNum{0, 0x14047ED00}; + WEAK symbol SV_MapExists{0, 0x14047ED60}; WEAK symbol SV_Cmd_ArgvBuffer{0x1402EEFD0, 0x1403B05C0}; + WEAK symbol SV_FastRestart{0, 0x14047E990}; + WEAK symbol SV_GameSendServerCommand{ + 0x1403F3A70, 0x140484AD0 + }; + WEAK symbol Sys_ShowConsole{0x1403E3B90, 0x140514910}; + WEAK symbol Sys_Error{0x1403E0C40, 0x140511520}; WEAK symbol - Sys_BuildAbsPath{0x1403CFF90, 0x140507010}; // H1(1.4) + Sys_BuildAbsPath{0x1403CFF90, 0x140507010}; + WEAK symbol Sys_Milliseconds{0x1403E2B10, 0x140513710}; + WEAK symbol Sys_IsDatabaseReady2{0x1403580B0, 0x14042B090}; + WEAK symbol Sys_SendPacket{0x1403E2820, 0x1405133B0}; + WEAK symbol Sys_FileExists{0x1403E0CE0, 0x1405115E0}; - WEAK symbol Sys_FileExists{0x1403E0CE0, 0x1405115E0}; // H1(1.4) + WEAK symbol UI_GetMapDisplayName{0, 0x140408CC0}; + WEAK symbol UI_GetGameTypeDisplayName{0, 0x1404086A0}; + WEAK symbol UI_SafeTranslateString{0x140350430, 0x1405A2930}; + WEAK symbol UI_RunMenuScript{0, 0x1404CFE60}; + WEAK symbol UI_TextWidth{0, 0x1404D21A0}; - // Variables + WEAK symbol VM_Execute{0, 0x1405C8DB0}; - WEAK symbol sv_cmd_args{0, 0x14946BA20}; // H1(1.4) + WEAK symbol longjmp{0x140648FD4, 0x14089EED0}; + WEAK symbol _setjmp{0x1406BFDD0, 0x1408EC2E0}; - WEAK symbol command_whitelist{0x141079A60, 0x14120C360}; // H1(1.4) + /*************************************************************** + * Variables + **************************************************************/ + + WEAK symbol sv_cmd_args{0, 0x14946BA20}; + + WEAK symbol command_whitelist{0x141079A60, 0x14120C360}; + WEAK symbol cmd_functions{0x14AD99AB8, 0x14946BAC8}; + WEAK symbol cmd_args{0x14AD99960, 0x14946B970}; WEAK symbol g_assetNames{0, 0x140BEF280}; - WEAK symbol g_poolSize{0, 0x140FEADF0}; // H1(1.4) + WEAK symbol g_poolSize{0, 0x140FEADF0}; - WEAK symbol gfxDrawMethod{0, 0x14EDF9E00}; + WEAK symbol gfxDrawMethod{0, 0x14FD21180}; - WEAK symbol dvarCount{0, 0x14D064CF4}; //h1mp - WEAK symbol sortedDvars{0, 0x14D064D00}; //h1mp + WEAK symbol dvarCount{0, 0x14D064CF4}; + WEAK symbol sortedDvars{0, 0x14D064D00}; WEAK symbol levelEntityId{0, 0x14B5E0B30}; WEAK symbol g_script_error_level{0, 0x14BA9CC24}; @@ -226,19 +192,26 @@ namespace game WEAK symbol scr_VarGlob{0, 0x14B617C00}; WEAK symbol scr_VmPub{0, 0x14BA9EE40}; WEAK symbol scr_function_stack{0, 0x14BAA93C0}; - WEAK symbol DB_XAssetPool{0x140DE8C80, 0x140FEB5D0}; // H1(1.4) + WEAK symbol DB_XAssetPool{0x140DE8C80, 0x140FEB5D0}; - WEAK symbol threadIds{0x14B19B880, 0x149810E00}; // H1(1.4) + WEAK symbol keyCatchers{0x14243DAF0, 0x142D0BA9C}; + WEAK symbol playerKeys{0x1422A873C, 0x142C19AFC}; + + WEAK symbol query_socket{0, 0x14DDFBF98}; + + WEAK symbol threadIds{0x14B19B880, 0x149810E00}; namespace mp { - WEAK symbol g_entities{0, 0x14621E530}; // H1(1.4) - WEAK symbol svs_clients{0, 0x14B204A10}; // H1(1.4) - WEAK symbol gameTime{0, 0x14621BDBC}; // H1(1.4) + WEAK symbol g_entities{0, 0x14621E530}; + WEAK symbol svs_clients{0, 0x14B204A10}; + WEAK symbol gameTime{0, 0x14621BDBC}; + + WEAK symbol virtualLobby_loaded{ 0, 0x142D077FD }; } namespace sp { - WEAK symbol g_entities{0x14550DD90, 0}; // H1(1.4) + WEAK symbol g_entities{0x14550DD90, 0}; } } diff --git a/src/client/steam/interfaces/friends.cpp b/src/client/steam/interfaces/friends.cpp index 5f3d5ab5..26dfe18c 100644 --- a/src/client/steam/interfaces/friends.cpp +++ b/src/client/steam/interfaces/friends.cpp @@ -1,10 +1,18 @@ #include #include "../steam.hpp" +#include + namespace steam { const char* friends::GetPersonaName() { + static const auto* name = game::Dvar_FindVar("name"); + if (name) + { + return name->current.string; + } + return "1337"; }