diff --git a/docs/cvars.md b/docs/cvars.md index 09b93ae9..166281c8 100644 --- a/docs/cvars.md +++ b/docs/cvars.md @@ -321,6 +321,7 @@ |sar_list_ents|cmd|sar_list_ents - lists entities| |sar_list_server_classes|cmd|sar_list_server_classes - lists all server classes| |sar_load_delay|0|Delay for this number of milliseconds at the end of a load.| +|sar_loads_coop_dots|0|Toggles the loading screen dots during map transitions in coop.| |sar_loads_norender|0|Temporarily set mat_norendering to 1 during loads| |sar_loads_uncap|0|Temporarily set fps_max to 0 during loads| |sar_lphud|0|Enables or disables the portals display on screen.| diff --git a/src/Cheats.cpp b/src/Cheats.cpp index 85a5fb86..994394a1 100644 --- a/src/Cheats.cpp +++ b/src/Cheats.cpp @@ -51,6 +51,7 @@ Variable sar_prevent_ehm("sar_prevent_ehm", "0", 0, 1, "Prevents Entity Handle M Variable sar_disable_weapon_sway("sar_disable_weapon_sway", "0", 0, 1, "Disables the viewmodel lagging behind.\n"); Variable sar_disable_viewmodel_shadows("sar_disable_viewmodel_shadows", "0", 0, 1, "Disables the shadows on the viewmodel.\n"); Variable sar_floor_reportals("sar_floor_reportals", "0", "Toggles floor reportals. Requires cheats.\n", FCVAR_CHEAT); +Variable sar_loads_coop_dots("sar_loads_coop_dots", "0", "Toggles the loading screen dots during map transitions in coop.\n"); Variable sv_laser_cube_autoaim; Variable ui_loadingscreen_transition_time; @@ -321,6 +322,7 @@ CON_COMMAND_F(sar_challenge_autosubmit_reload_api_key, "sar_challenge_autosubmit } Memory::Patch *g_floorReportalPatch; +Memory::Patch *g_coopLoadingDotsPatch; void Cheats::Init() { sv_laser_cube_autoaim = Variable("sv_laser_cube_autoaim"); @@ -369,6 +371,14 @@ void Cheats::Init() { g_floorReportalPatch->Restore(); } + g_coopLoadingDotsPatch = new Memory::Patch(); + auto coopLoadingDotsBool = Memory::Scan(MODULE("client"), Offsets::LoadingProgress__SetupControlStatesInstruction, Offsets::LoadingProgress__SetupControlStatesBoolOffset); + if (coopLoadingDotsBool) { + unsigned char coopLoadingDotsBoolByte = 0x1; + g_coopLoadingDotsPatch->Execute(coopLoadingDotsBool, &coopLoadingDotsBoolByte, 1); + g_coopLoadingDotsPatch->Restore(); + } + Variable::RegisterAll(); Command::RegisterAll(); } @@ -386,6 +396,8 @@ void Cheats::Shutdown() { g_floorReportalPatch->Restore(); SAFE_DELETE(g_floorReportalPatch); + g_coopLoadingDotsPatch->Restore(); + SAFE_DELETE(g_coopLoadingDotsPatch); } @@ -504,3 +516,21 @@ void Cheats::CheckFloorReportals() { g_floorReportalPatch->Restore(); } } + +void Cheats::CheckUICoopDots() { + bool enabled = sar_loads_coop_dots.GetBool(); + if (enabled && (!g_coopLoadingDotsPatch || !g_coopLoadingDotsPatch->IsInit())) { + console->Print("sar_loads_coop_dots is not available.\n"); + sar_loads_coop_dots.SetValue(0); + return; + } + if (enabled == g_coopLoadingDotsPatch->IsPatched()) { + return; + } + + if (enabled) { + g_coopLoadingDotsPatch->Execute(); + } else { + g_coopLoadingDotsPatch->Restore(); + } +} diff --git a/src/Cheats.hpp b/src/Cheats.hpp index 23b40355..c2db46c3 100644 --- a/src/Cheats.hpp +++ b/src/Cheats.hpp @@ -11,6 +11,7 @@ class Cheats { static void AutoStrafe(int slot, void *player, CUserCmd *cmd); static void EnsureSlopeBoost(const CHLMoveData *move, void *player, CGameTrace **tr); static void CheckFloorReportals(); + static void CheckUICoopDots(); }; extern Variable sar_autorecord; @@ -32,6 +33,8 @@ extern Variable sar_patch_cfg; extern Variable sar_prevent_ehm; extern Variable sar_disable_weapon_sway; extern Variable sar_disable_viewmodel_shadows; +extern Variable sar_floor_reportals; +extern Variable sar_loads_coop_dots; extern Variable sv_laser_cube_autoaim; extern Variable ui_loadingscreen_transition_time; diff --git a/src/Modules/Server.cpp b/src/Modules/Server.cpp index e6276c4f..ec9afe2f 100644 --- a/src/Modules/Server.cpp +++ b/src/Modules/Server.cpp @@ -285,6 +285,7 @@ DETOUR(Server::PlayerRunCommand, CUserCmd *cmd, void *moveHelper) { Cheats::AutoStrafe(slot, thisptr, cmd); Cheats::CheckFloorReportals(); + Cheats::CheckUICoopDots(); inputHud.SetInputInfo(slot, cmd->buttons, {cmd->sidemove, cmd->forwardmove, cmd->upmove}); diff --git a/src/Offsets/Portal 2 9568.hpp b/src/Offsets/Portal 2 9568.hpp index e8f19a7c..f8cbbac9 100644 --- a/src/Offsets/Portal 2 9568.hpp +++ b/src/Offsets/Portal 2 9568.hpp @@ -432,6 +432,8 @@ SIGSCAN_EMPTY(FindElementSig) SIGSCAN_DEFAULT(GetChapterProgress, "56 8B 35 ? ? ? ? 57 8B F9 FF D6 8B 10 8B C8", "55 89 E5 57 56 53 83 EC 0C E8 ? ? ? ? 83 EC 08 8B 10") +SIGSCAN_DEFAULT(LoadingProgress__SetupControlStatesInstruction, "66 C7 86 ? ? ? ? ? ? EB", "66 89 83 ? ? ? ? E9 ? ? ? ? ? ? ? ? ? ? ? 85 F6") // "vgui/loading_screens/loadingscreen_coop" xref -> LoadingProgress::SetupControlStates -> m_bDrawProgress set to 0 +OFFSET_DEFAULT(LoadingProgress__SetupControlStatesBoolOffset, 7, 5) // Engine SIGSCAN_DEFAULT(ParseSmoothingInfoSig, "55 8B EC 0F 57 C0 81 EC ? ? ? ? B9 ? ? ? ? 8D 85 ? ? ? ? EB", ""); // "cl_demosmootherpanel.cpp" xref -> CDemoSmootherPanel::ParseSmoothingInfo