Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/cvars.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.|
Expand Down
30 changes: 30 additions & 0 deletions src/Cheats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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();
}
Expand All @@ -386,6 +396,8 @@ void Cheats::Shutdown() {

g_floorReportalPatch->Restore();
SAFE_DELETE(g_floorReportalPatch);
g_coopLoadingDotsPatch->Restore();
SAFE_DELETE(g_coopLoadingDotsPatch);
}


Expand Down Expand Up @@ -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();
}
}
3 changes: 3 additions & 0 deletions src/Cheats.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/Modules/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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});

Expand Down
2 changes: 2 additions & 0 deletions src/Offsets/Portal 2 9568.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading