From f82e38ef4ebbcf5a97e8bd73466bc64840fbe91a Mon Sep 17 00:00:00 2001 From: Jesse <69196954+ThisAMJ@users.noreply.github.com> Date: Thu, 29 Jun 2023 23:30:28 +1000 Subject: [PATCH 1/9] fix: add hover for 0th trace tick Fixes #184 --- src/Features/PlayerTrace.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Features/PlayerTrace.cpp b/src/Features/PlayerTrace.cpp index e9e9a78bb..16d9bd927 100644 --- a/src/Features/PlayerTrace.cpp +++ b/src/Features/PlayerTrace.cpp @@ -255,7 +255,7 @@ void PlayerTrace::DrawInWorld() const { float speed = trace.velocities[slot][0].Length2D(); unsigned groundframes = trace.grounded[slot][0]; - for (size_t i = 1; i < trace.positions[slot].size(); i++) { + for (size_t i = 0; i < trace.positions[slot].size(); i++) { Vector new_pos = trace.positions[slot][i]; speed = trace.velocities[slot][i].Length2D(); From bb16397056fce0541b5bc1a41ba615b67d33f300 Mon Sep 17 00:00:00 2001 From: Jesse <69196954+ThisAMJ@users.noreply.github.com> Date: Fri, 30 Jun 2023 00:06:14 +1000 Subject: [PATCH 2/9] fix: TAS trace tick off-by-one Fixes #185 --- src/Features/PlayerTrace.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Features/PlayerTrace.cpp b/src/Features/PlayerTrace.cpp index 16d9bd927..3c115ebf6 100644 --- a/src/Features/PlayerTrace.cpp +++ b/src/Features/PlayerTrace.cpp @@ -133,7 +133,7 @@ void PlayerTrace::AddPoint(std::string trace_name, void *player, int slot, bool // update this bad boy every tick because it doesn't like being tinkered with at the // very beginning of the level. fussy guy, lemme tell ya if (tasPlayer->IsRunning()) { - int ticksSinceStartup = (int)trace.positions[0].size() + 1; // include point we're about to add + int ticksSinceStartup = (int)trace.positions[0].size() + (int)(tasPlayer->GetTick() == 0); // include point we're about to add traces[trace_name].startTasTick = tasPlayer->GetTick() - ticksSinceStartup; } From 9611410c94f6ea01380e072bad386e46df47cbb8 Mon Sep 17 00:00:00 2001 From: Jesse <69196954+ThisAMJ@users.noreply.github.com> Date: Fri, 30 Jun 2023 00:39:16 +1000 Subject: [PATCH 3/9] fix: watermark positioning on higher resolutions, it appears the header becomes longer than the subtext, pushing the watermark closer to the edge than it should be. --- src/Features/Hud/Watermark.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Features/Hud/Watermark.cpp b/src/Features/Hud/Watermark.cpp index 01f08aa53..accae5d98 100644 --- a/src/Features/Hud/Watermark.cpp +++ b/src/Features/Hud/Watermark.cpp @@ -33,7 +33,7 @@ class WatermarkHud : public Hud { int fontSize = surface->GetFontHeight(headerFont); - int xPos = screenWidth - surface->GetFontLength(subTextFont, "%s", WATERMARK_MSG_HELPTEXT) - fontSize * 2; + int xPos = screenWidth - std::max(surface->GetFontLength(headerFont, "%s", WATERMARK_MSG_HEADER), surface->GetFontLength(subTextFont, "%s", WATERMARK_MSG_HELPTEXT)) - fontSize * 2; surface->DrawTxt(headerFont, xPos, screenHeight - fontSize * 3, Color{255, 255, 255, 100}, "%s", WATERMARK_MSG_HEADER); surface->DrawTxt(subTextFont, xPos, screenHeight - fontSize * 2, Color{255, 255, 255, 100}, "%s", WATERMARK_MSG_HELPTEXT); From 1e57b610e32a81da6487097ad7e5f0268d04865b Mon Sep 17 00:00:00 2001 From: Jesse <69196954+ThisAMJ@users.noreply.github.com> Date: Sun, 15 Jan 2023 13:16:46 +1100 Subject: [PATCH 4/9] fix: various help strings --- src/Features/Demo/NetworkGhostPlayer.cpp | 4 ++-- src/Features/Hud/Hud.cpp | 4 ++-- src/Features/SegmentedTools.cpp | 2 +- src/Features/Speedrun/Categories.cpp | 2 +- src/Modules/Server.cpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Features/Demo/NetworkGhostPlayer.cpp b/src/Features/Demo/NetworkGhostPlayer.cpp index 18841c9bd..1c5312c73 100644 --- a/src/Features/Demo/NetworkGhostPlayer.cpp +++ b/src/Features/Demo/NetworkGhostPlayer.cpp @@ -272,8 +272,8 @@ sf::Packet &operator<<(sf::Packet &packet, const Color &col) { return packet << col.r << col.g << col.b; } -Variable ghost_TCP_only("ghost_TCP_only", "0", "Lathil's special command :).\n"); -Variable ghost_update_rate("ghost_update_rate", "50", 1, "Adjust the update rate. For people with lathil's internet.\n"); +Variable ghost_TCP_only("ghost_TCP_only", "0", "Uses only TCP for ghost servers. For people with unreliable internet.\n"); +Variable ghost_update_rate("ghost_update_rate", "50", 1, "Milliseconds between ghost updates. For people with slow/metered internet.\n"); Variable ghost_net_dump("ghost_net_dump", "0", "Dump all ghost network activity to a file for debugging.\n"); static FILE *g_dumpFile; diff --git a/src/Features/Hud/Hud.cpp b/src/Features/Hud/Hud.cpp index 59e1d270b..957c1dd8b 100644 --- a/src/Features/Hud/Hud.cpp +++ b/src/Features/Hud/Hud.cpp @@ -309,7 +309,7 @@ DECL_AUTO_COMMAND_COMPLETION(sar_hud_order_bottom, (elementOrder)) CON_COMMAND_F_COMPLETION(sar_hud_order_top, "sar_hud_order_top - orders hud element to top\n", FCVAR_DONTRECORD, AUTOCOMPLETION_FUNCTION(sar_hud_order_top)) { if (args.ArgC() != 2) { - return console->Print("Orders hud element to top: sar_hud_order_top \n"); + return console->Print(sar_hud_order_top.ThisPtr()->m_pszHelpString); } auto elements = &vgui->elements; @@ -335,7 +335,7 @@ CON_COMMAND_F_COMPLETION(sar_hud_order_top, "sar_hud_order_top - orders h } CON_COMMAND_F_COMPLETION(sar_hud_order_bottom, "sar_hud_order_bottom - orders hud element to bottom\n", FCVAR_DONTRECORD, AUTOCOMPLETION_FUNCTION(sar_hud_order_bottom)) { if (args.ArgC() != 2) { - return console->Print("Set!\n"); + return console->Print(sar_hud_order_bottom.ThisPtr()->m_pszHelpString); } auto elements = &vgui->elements; diff --git a/src/Features/SegmentedTools.cpp b/src/Features/SegmentedTools.cpp index 66ed6d281..b54e17a33 100644 --- a/src/Features/SegmentedTools.cpp +++ b/src/Features/SegmentedTools.cpp @@ -83,7 +83,7 @@ ON_EVENT(PRE_TICK) { CON_COMMAND_F(hwait, "hwait [args...] - run a command after the given number of host ticks\n", FCVAR_DONTRECORD) { if (args.ArgC() < 3) { - return console->Print(waitCmd.ThisPtr()->m_pszHelpString); + return console->Print(hwait.ThisPtr()->m_pszHelpString); } int ticks = std::atoi(args[1]); diff --git a/src/Features/Speedrun/Categories.cpp b/src/Features/Speedrun/Categories.cpp index 09da630e4..47e8b3c7e 100644 --- a/src/Features/Speedrun/Categories.cpp +++ b/src/Features/Speedrun/Categories.cpp @@ -465,7 +465,7 @@ static int _sar_speedrun_category_remove_rule_completion(const char *partial, ch CON_COMMAND_F_COMPLETION(sar_speedrun_category_remove_rule, "sar_speedrun_category_remove_rule - remove a rule from a speedrun category\n", 0, &_sar_speedrun_category_remove_rule_completion) { if (args.ArgC() != 3) { - return console->Print(sar_speedrun_category_add_rule.ThisPtr()->m_pszHelpString); + return console->Print(sar_speedrun_category_remove_rule.ThisPtr()->m_pszHelpString); } auto cat = lookupMap(g_categories, args[1]); diff --git a/src/Modules/Server.cpp b/src/Modules/Server.cpp index c02ab7a2c..5af602351 100644 --- a/src/Modules/Server.cpp +++ b/src/Modules/Server.cpp @@ -923,7 +923,7 @@ CON_COMMAND(sar_give_fly, "sar_give_fly [n] - gives the player in slot n (0 by d } } CON_COMMAND(sar_give_betsrighter, "sar_give_betsrighter [n] - gives the player in slot n (0 by default) betsrighter.\n") { - if (args.ArgC() > 2) return console->Print(sar_give_fly.ThisPtr()->m_pszHelpString); + if (args.ArgC() > 2) return console->Print(sar_give_betsrighter.ThisPtr()->m_pszHelpString); if (!sv_cheats.GetBool()) return console->Print("sar_give_betsrighter requires sv_cheats.\n"); int slot = args.ArgC() == 2 ? atoi(args[1]) : 0; ServerEnt *player = server->GetPlayer(slot + 1); From 6b3fc750f435523cae5cf64574c63ca58a2798d4 Mon Sep 17 00:00:00 2001 From: Krzyhau Date: Thu, 6 Jul 2023 10:22:28 +0200 Subject: [PATCH 5/9] fix: correct pp hud behavior when portal-peeking --- src/Features/Hud/PortalPlacement.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Features/Hud/PortalPlacement.cpp b/src/Features/Hud/PortalPlacement.cpp index 797e25466..b215c61d4 100644 --- a/src/Features/Hud/PortalPlacement.cpp +++ b/src/Features/Hud/PortalPlacement.cpp @@ -3,6 +3,7 @@ #include "Command.hpp" #include "Variable.hpp" #include "Event.hpp" +#include "Features/Camera.hpp" #include "Features/OverlayRender.hpp" #include "Features/Session.hpp" #include "Modules/Client.hpp" @@ -101,8 +102,9 @@ ON_EVENT(PRE_TICK) { if (player == nullptr || (int)player == -1) return; - Vector camPos = server->GetAbsOrigin(player) + server->GetViewOffset(player); - QAngle angle = engine->GetAngles(GET_SLOT()); + Vector camPos; + QAngle angle; + camera->GetEyePos(GET_SLOT(), camPos, angle); float X = DEG2RAD(angle.x), Y = DEG2RAD(angle.y); auto cosX = std::cos(X), cosY = std::cos(Y); From 64137af4e480dd95519c89a3f03a7704ae47bda3 Mon Sep 17 00:00:00 2001 From: Krzyhau Date: Thu, 6 Jul 2023 10:46:33 +0200 Subject: [PATCH 6/9] fix: add tas vector param count validation --- src/Features/Tas/TasParser.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Features/Tas/TasParser.cpp b/src/Features/Tas/TasParser.cpp index 5a65c684d..65bb6a381 100644 --- a/src/Features/Tas/TasParser.cpp +++ b/src/Features/Tas/TasParser.cpp @@ -384,6 +384,19 @@ static Vector parseVector(const Line &line, size_t idx) { else if (t1.type == TasToken::FLOAT) vec.y = t1.f; else throw TasParserException(Utils::ssprintf("expected vector B %d '%s'", (int)t1.type, t1.tok.c_str())); + if (idx + 2 < line.tokens.size()) { + auto &t3 = line.tokens[idx + 2]; + switch (t3.type) { + case TasToken::PIPE: + break; + case TasToken::INTEGER: + case TasToken::FLOAT: + throw TasParserException("invalid vector param count"); + default: + throw TasParserException(Utils::ssprintf("expected end of vector, found '%s'", t3.tok.c_str())); + } + } + return vec; } From ab5d038c0dae9a86ad6e6b6727cfbefdc7bef868 Mon Sep 17 00:00:00 2001 From: Jesse <69196954+ThisAMJ@users.noreply.github.com> Date: Thu, 20 Jul 2023 17:16:30 +1000 Subject: [PATCH 7/9] docs: more descriptive plugin description --- src/Plugin.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Plugin.hpp b/src/Plugin.hpp index 89e823fe9..6ff793f15 100644 --- a/src/Plugin.hpp +++ b/src/Plugin.hpp @@ -1,8 +1,7 @@ #pragma once #include "Utils.hpp" -#define SAR_PLUGIN_SIGNATURE \ - new char[26] { 65, 114, 101, 32, 121, 111, 117, 32, 104, 97, 112, 112, 121, 32, 110, 111, 119, 44, 32, 74, 97, 109, 101, 114, 63, 00 } +#define SAR_PLUGIN_SIGNATURE "SourceAutoRecord v" SAR_VERSION // CServerPlugin #define CServerPlugin_m_Size 16 From b7f2c993a373311d0fae6f73f4d5a4a1af551e4f Mon Sep 17 00:00:00 2001 From: NeKz Date: Sat, 16 Sep 2023 01:45:33 +0100 Subject: [PATCH 8/9] fix: clean up of VEH --- src/CrashHandler.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/CrashHandler.cpp b/src/CrashHandler.cpp index b73c0c059..f57b13c67 100644 --- a/src/CrashHandler.cpp +++ b/src/CrashHandler.cpp @@ -172,10 +172,11 @@ static void handler(int signal, siginfo_t *info, void *ucontext) } #ifdef _WIN32 +static PVOID g_handle = nullptr; void CrashHandler::Init() { g_isMainThread = true; - AddVectoredExceptionHandler(1, &handler); + g_handle = AddVectoredExceptionHandler(1, &handler); HANDLE process = GetCurrentProcess(); SymInitialize(process, 0, true); @@ -189,7 +190,7 @@ void CrashHandler::Cleanup() { HANDLE process = GetCurrentProcess(); SymGetModuleInfo(process, (DWORD)&Utils::GetSARPath, &info); SymUnloadModule(process, info.BaseOfImage); - RemoveVectoredExceptionHandler(&handler); + RemoveVectoredExceptionHandler(g_handle); SymCleanup(GetCurrentProcess()); } From b762a4720089f4f9d23cdf6ea90e9f5543a6b83c Mon Sep 17 00:00:00 2001 From: Jesse <69196954+ThisAMJ@users.noreply.github.com> Date: Sat, 21 Oct 2023 14:45:12 +1100 Subject: [PATCH 9/9] feat: ignore this, this is not a commit These are not the features you are looking for... --- src/Features/Demo/GhostRenderer.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Features/Demo/GhostRenderer.cpp b/src/Features/Demo/GhostRenderer.cpp index 74a54ff95..330ba3485 100644 --- a/src/Features/Demo/GhostRenderer.cpp +++ b/src/Features/Demo/GhostRenderer.cpp @@ -116,6 +116,9 @@ void GhostRenderer::UpdateAnimatedVerts() { localPos.x * yawSin + localPos.y * yawCos, localPos.z }; + if (ghost->name == "Dinnerbone") { + localPos.z = 72 - localPos.z; + } // transform it to global coordinates Vector globalPos = ghost->data.position + localPos;