Skip to content

Commit 1f10651

Browse files
committed
fix: sar_disable_autograb for orange
`Server::PlayerRunCommand` is only ran on the server, so the client wouldn't recognize a change to the cvar and execute the patch. also linux support. Fixes #335
1 parent 4191c61 commit 1f10651

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

docs/cvars.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@
165165
|sar_demo_portal_interp_fix|1|Fix eye interpolation through portals in demo playback.|
166166
|sar_demo_remove_broken|1|Whether to remove broken frames from demo playback|
167167
|sar_demo_replay|cmd|sar_demo_replay - play the last recorded or played demo|
168+
|sar_disable_autograb|0|Disables the auto-grab in coop. Requires host to enable it for everyone that also enables it.|
168169
|<i title="Portal 2">sar_disable_challenge_stats_hud</i>|0|Disables opening the challenge mode stats HUD. Greater than 1 specifies a custom amount of ticks to leave leaderboard open. -1 closes instantly.|
169170
|<i title="Portal 2">sar_disable_challenge_stats_hud_partner</i>|1|Closes the challenge mode stats HUD after your coop partner does.|
170171
|sar_disable_coop_score_hud|0|Disables the coop score HUD which appears in demo playback.|

src/Cheats.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ ON_EVENT(RENDER) {
255255
}
256256
}
257257

258+
ON_EVENT(PRE_TICK) {
259+
Cheats::CheckUICoopDots();
260+
Cheats::CheckAutoGrab();
261+
}
262+
258263
CON_COMMAND(sar_getpos, "sar_getpos [slot] [server|client] - get the absolute origin and angles of a particular player from either the server or client. Defaults to slot 0 and server.\n") {
259264
if (args.ArgC() > 3) {
260265
return console->Print(sar_getpos.ThisPtr()->m_pszHelpString);

src/Modules/Server.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,6 @@ DETOUR(Server::PlayerRunCommand, CUserCmd *cmd, void *moveHelper) {
285285

286286
Cheats::AutoStrafe(slot, thisptr, cmd);
287287
Cheats::CheckFloorReportals();
288-
Cheats::CheckUICoopDots();
289-
Cheats::CheckAutoGrab();
290288

291289
inputHud.SetInputInfo(slot, cmd->buttons, {cmd->sidemove, cmd->forwardmove, cmd->upmove});
292290

src/Offsets/Portal 2 9568.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,8 @@ OFFSET_DEFAULT(aircontrol_fling_speedOff, 3, 3)
513513
SIGSCAN_DEFAULT(FloorReportalBranch, "75 7D 8B 8E C0 04 00 00",
514514
"75 ? 8B 85 ? ? ? ? 8B 0D") // "Portal.open_red" xref(nothing after if) -> CProp_Portal::NewLocation -> first function call CPortal_Base2D::NewLocation -> 4x func call followed by test, [jnz]
515515

516-
// TODO: Linux Support
517516
SIGSCAN_DEFAULT(CPortal_Player__PollForUseEntity_CheckMP, "74 ? ? ? 8B 82 ? ? ? ? FF D0 84 C0 74 ? 8B CE",
518-
"") // CPortal_Player vtable -> Add offset 0x6D8 -> CPortal_Player::PlayerUse -> Second function call from disassembly -> CPortal_Player::PollForUseEntity -> jz instruction
517+
"74 ? 8B 10 83 EC 0C 50 FF 92 88 00 00 00 83 C4 10 84 C0 ? ? ? ? ? ? ? ? ? ? ? ? ? 00 00") // "OnJump" xref -> CPortal_Player:PreThink -> CBasePlayer::PreThink -> CBasePlayer::ItemPreFrame -> CBasePlayer::PlayerUse -> CPortal_Player vtable offset -> CPortal_Player::PlayerUse -> Second function call from disassembly -> CPortal_Player::PollForUseEntity -> jz instruction
519518

520519
// VPhysics
521520
OFFSET_EMPTY(DestroyEnvironment)

0 commit comments

Comments
 (0)