diff --git a/src/client/component/patches.cpp b/src/client/component/patches.cpp index 3a92bad1..ac948f43 100644 --- a/src/client/component/patches.cpp +++ b/src/client/component/patches.cpp @@ -50,27 +50,6 @@ namespace patches dvars::register_float("jump_height", 39, 0, 1000, game::DVAR_FLAG_REPLICATED); dvars::register_float("g_gravity", 800, 1, 1000, game::DVAR_FLAG_REPLICATED); dvars::register_int("g_speed", 190, 0, 1000, game::DVAR_FLAG_REPLICATED); - - dvars::register_bool("sf_use_martyr_mode", false, game::DVAR_FLAG_NONE); - dvars::register_bool("sf_use_precision_mode", false, game::DVAR_FLAG_NONE); - dvars::register_bool("sf_use_greenberet_mode", false, game::DVAR_FLAG_NONE); - dvars::register_bool("sf_use_slowmo", false, game::DVAR_FLAG_NONE); - dvars::register_bool("sf_use_fortitude_mode", false, game::DVAR_FLAG_NONE); - dvars::register_bool("sf_use_desperation_mode", false, game::DVAR_FLAG_NONE); - dvars::register_bool("sf_use_polterghost_mode", false, game::DVAR_FLAG_NONE); - dvars::register_bool("sf_use_wolf_mode", false, game::DVAR_FLAG_NONE); - dvars::register_bool("sf_use_attraction_mode", false, game::DVAR_FLAG_NONE); - dvars::register_bool("sf_use_starvation_mode", false, game::DVAR_FLAG_NONE); - dvars::register_bool("sf_use_ignoreammo", false, game::DVAR_FLAG_NONE); - dvars::register_bool("sf_use_pineapple_mode", false, game::DVAR_FLAG_NONE); - dvars::register_bool("sf_use_football_mode", false, game::DVAR_FLAG_NONE); - dvars::register_bool("sf_use_tire_explosion", false, game::DVAR_FLAG_NONE); - dvars::register_bool("sf_use_clustergrenade", false, game::DVAR_FLAG_NONE); - dvars::register_bool("sf_use_pomegrenade_mode", false, game::DVAR_FLAG_NONE); - dvars::register_bool("sf_use_pinata_mode", false, game::DVAR_FLAG_NONE); - dvars::register_bool("sf_use_chaplin", false, game::DVAR_FLAG_NONE); - dvars::register_bool("sf_use_edge_mode", false, game::DVAR_FLAG_NONE); - dvars::register_bool("sf_use_bw", false, game::DVAR_FLAG_NONE); } }; } diff --git a/src/client/component/thread_names.cpp b/src/client/component/thread_names.cpp new file mode 100644 index 00000000..84b5fa70 --- /dev/null +++ b/src/client/component/thread_names.cpp @@ -0,0 +1,60 @@ +#include +#include "loader/component_loader.hpp" + +#include "scheduler.hpp" + +#include "game/game.hpp" + +#include + +namespace thread_names +{ + namespace + { + void set_thread_names() + { + static std::unordered_map thread_names = + { + {game::THREAD_CONTEXT_MAIN, "Main"}, + {game::THREAD_CONTEXT_BACKEND, "Backend"}, // Renderer + {game::THREAD_CONTEXT_WORKER0, "Worker0"}, + {game::THREAD_CONTEXT_WORKER1, "Worker1"}, + {game::THREAD_CONTEXT_WORKER2, "Worker2"}, + {game::THREAD_CONTEXT_WORKER3, "Worker3"}, + {game::THREAD_CONTEXT_WORKER4, "Worker4"}, + {game::THREAD_CONTEXT_WORKER5, "Worker5"}, + {game::THREAD_CONTEXT_WORKER6, "Worker6"}, + {game::THREAD_CONTEXT_WORKER7, "Worker7"}, + {game::THREAD_CONTEXT_SERVER, "Server"}, + {game::THREAD_CONTEXT_CINEMATIC, "Cinematic"}, + {game::THREAD_CONTEXT_DATABASE, "Database"}, + {game::THREAD_CONTEXT_STREAM, "Stream"}, + {game::THREAD_CONTEXT_SNDSTREAMPACKETCALLBACK, "Snd stream packet callback"}, + {game::THREAD_CONTEXT_STATS_WRITE, "Stats write"}, + }; + + for (const auto& thread_name : thread_names) + { + const auto id = game::threadIds[thread_name.first]; + if (id) + { + utils::thread::set_name(id, thread_name.second); + } + } + } + } + + class component final : public component_interface + { + public: + void post_unpack() override + { + set_thread_names(); + scheduler::once(set_thread_names, scheduler::pipeline::main); + scheduler::once(set_thread_names, scheduler::pipeline::renderer); + scheduler::once(set_thread_names, scheduler::pipeline::server); + } + }; +} + +REGISTER_COMPONENT(thread_names::component) diff --git a/src/client/game/ui_scripting/element.cpp b/src/client/game/ui_scripting/element.cpp index 31747ca4..aca81b3f 100644 --- a/src/client/game/ui_scripting/element.cpp +++ b/src/client/game/ui_scripting/element.cpp @@ -119,11 +119,14 @@ namespace ui_scripting int style, float* color, float* second_color, float* glow_color) { const auto result = (uint64_t)game::R_AddCmdDrawText(text, 0x7FFFFFFF, font, x, y, x_scale, y_scale, rotation, color, style); - *reinterpret_cast(result + 188) = glow_color[0]; - *reinterpret_cast(result + 192) = glow_color[1]; - *reinterpret_cast(result + 196) = glow_color[2]; - *reinterpret_cast(result + 200) = glow_color[3]; - *reinterpret_cast(result + 228) = float_to_rgba(second_color); + if (result) + { + *reinterpret_cast(result + 188) = glow_color[0]; + *reinterpret_cast(result + 192) = glow_color[1]; + *reinterpret_cast(result + 196) = glow_color[2]; + *reinterpret_cast(result + 200) = glow_color[3]; + *reinterpret_cast(result + 228) = float_to_rgba(second_color); + } } }