From 8674225fe0d473555905a2534990c6c8908102ba Mon Sep 17 00:00:00 2001 From: Unreal Karaulov Date: Sun, 26 May 2024 17:42:42 +0300 Subject: [PATCH] Update plugin test, and some scanner updates --- PLUGIN/plugin.sma | 26 ++--- UnrealDemoScanner/UnrealDemoScanner.cs | 99 ++++++++++++------- .../UnrealDemoScannerNET48.csproj | 12 +-- 3 files changed, 82 insertions(+), 55 deletions(-) diff --git a/PLUGIN/plugin.sma b/PLUGIN/plugin.sma index 2f78257..8efc094 100644 --- a/PLUGIN/plugin.sma +++ b/PLUGIN/plugin.sma @@ -9,12 +9,12 @@ #define PLUGIN "Unreal Demo Plugin" #define AUTHOR "karaulov" -#define VERSION "1.55" +#define VERSION "1.56" new g_iDemoHelperInitStage[33] = {0,...}; new g_iFrameNum[33] = {0,...}; -new g_iPbEventCount[33] = {0,...}; +new Float:g_flLastEventTime[33] = {0.0,...}; public plugin_init() { @@ -32,7 +32,7 @@ public plugin_init() public client_disconnected(id) { - g_iPbEventCount[id] = 0; + g_flLastEventTime[id] = 0.0; g_iFrameNum[id] = 0; g_iDemoHelperInitStage[id] = 0; @@ -42,9 +42,13 @@ public client_disconnected(id) /*Server not processed angles. Always empty.*/ public fw_PlaybackEvent( iFlags, id, eventIndex ) { - if(id > 0 && id < 33 && g_iDemoHelperInitStage[id] == -1) + if(id > 0 && id < 33 && g_iDemoHelperInitStage[id] == -1 && iFlags == 1) { - g_iPbEventCount[id]++; + if (floatabs(get_gametime() - g_flLastEventTime[id]) > 1.0) + { + g_flLastEventTime[id] = get_gametime(); + WriteDemoInfo(id, "UDS/EVENT/%i", eventIndex); + } } return FMRES_IGNORED; @@ -97,22 +101,18 @@ public PM_Move(const id) { new button = get_entvar(id, var_button) new oldbuttons = get_entvar(id, var_oldbuttons) - if (g_iDemoHelperInitStage[id] == -1 && !(button & IN_ATTACK) && (oldbuttons & IN_ATTACK)) + if (g_iDemoHelperInitStage[id] == -1 && (button & IN_ATTACK) && !(oldbuttons & IN_ATTACK)) { new cmdx = get_pmove( pm_cmd ); - - g_iFrameNum[id]++; WriteDemoInfo(id, "UDS/XCMD/%i/%i/%i", get_ucmd(cmdx, ucmd_lerp_msec), get_ucmd(cmdx, ucmd_msec),g_iFrameNum[id]); - if (g_iPbEventCount[id] > 0) - WriteDemoInfo(id, "UDS/EVENTS/%i",g_iPbEventCount[id]); - g_iPbEventCount[id] = 0; + g_iFrameNum[id]++; } return HC_CONTINUE; } public UnrealDemoHelpInitialize(id) { - g_iPbEventCount[id] = 0; + g_flLastEventTime[id] = 0.0; g_iFrameNum[id] = 0; g_iDemoHelperInitStage[id] = 0; if (is_user_connected(id)) @@ -155,7 +155,7 @@ public DemoHelperInitializeTask(id) WriteDemoInfo(id,"UDS/MINUR/%i",get_cvar_num("sv_minupdaterate")); WriteDemoInfo(id,"UDS/MAXUR/%i",get_cvar_num("sv_maxupdaterate")); - g_iPbEventCount[id] = 0; + g_flLastEventTime[id] = 0.0; g_iDemoHelperInitStage[id] = -1; } } diff --git a/UnrealDemoScanner/UnrealDemoScanner.cs b/UnrealDemoScanner/UnrealDemoScanner.cs index d287bd8..230b69c 100644 --- a/UnrealDemoScanner/UnrealDemoScanner.cs +++ b/UnrealDemoScanner/UnrealDemoScanner.cs @@ -159,7 +159,6 @@ public MyTreeNode(string text) public static int LocalPlayerId = -1; public static int LocalPlayerUserId = -1; public static int LocalPlayerUserId2 = -1; - public static int LocalPlayerEntity = -1; public static int TmpPlayerNum = -1; public static int TmpPlayerEnt = -1; public static bool FirstEventShift; @@ -3608,13 +3607,20 @@ следующий кадр изменение и 5 кадров нет движ var eframe = (GoldSource.EventFrame)frame.Value; + //bool found = false; + //foreach (var res in DownloadedResources) //{ // if (res.res_index == eframe.Index && res.res_type == 5) // { + // found = true; // Console.WriteLine("Event:" + res.res_path + " at " + CurrentTimeString); // } //} + + //if (!found) + // Console.WriteLine("Event:" + "[UNKNOWN]" + " at " + CurrentTimeString); + LastEventId = eframe.Index; if (abs(LastEventDetectTime) > EPSILON && abs(LastAttackPressed - LastEventDetectTime) > 0.25) @@ -3853,7 +3859,8 @@ следующий кадр изменение и 5 кадров нет движ FirstJump = false; FirstAttack = false; SearchJumpBug = false; - + TmpPlayerEnt = -1; + TmpPlayerNum = -1; LocalPlayerId = -1; fullPlayerList.AddRange(playerList); playerList.Clear(); @@ -4146,6 +4153,18 @@ следующий кадр изменение и 5 кадров нет движ FrameDuplicates++; } + TmpPlayerNum = nf.RParms.Playernum; + TmpPlayerEnt = nf.RParms.Viewentity; + + if (abs(CurrentTime) > EPSILON && CurrentFrameDuplicated <= 1) + { + if (LocalPlayerId < 0) + { + LocalPlayerId = TmpPlayerNum; + //if (DUMP_ALL_FRAMES) subnode.Text += "[HERE PLAYER FOUND]"; + //Console.WriteLine(LocalPlayerId.ToString()); + } + } var voice_time = abs(CurrentTime - PreviousTime); if (voice_time > 1.0f) @@ -4191,14 +4210,14 @@ следующий кадр изменение и 5 кадров нет движ } if (abs(LastEventDetectTime) > EPSILON && abs(LastAttackPressed - LastEventDetectTime) > 0.25) { - DemoScanner_AddWarn("[BETA] [TRIGGER TYPE 3 " + CurrentWeapon + "] at (" + CurrentTime + ") " + + DemoScanner_AddWarn("[BETA] [TRIGGER TYPE 3." + (LastEventId < 0 ? 2 : 1) + " " + CurrentWeapon + "] at (" + CurrentTime + ") " + CurrentTimeString, false); TriggerAimAttackCount++; LastTriggerAttack = CurrentTime; foreach (var res in DownloadedResources) { - if (res.res_index == LastEventId && res.res_type == 5) + if (res.res_index == Math.Abs(LastEventId) && res.res_type == 5) { Console.WriteLine("[Debug] event:" + res.res_path + " at " + CurrentTimeString); } @@ -5987,14 +6006,6 @@ следующий кадр изменение и 5 кадров нет движ subnode.Text += "RParms.Playernum = " + nf.RParms.Playernum + "\n"; } - TmpPlayerNum = nf.RParms.Playernum; - TmpPlayerEnt = nf.RParms.Viewentity; - - if (LocalPlayerId == -1 && TmpPlayerNum == TmpPlayerEnt - 1) - { - LocalPlayerId = TmpPlayerNum; - } - ViewModel = nf.Viewmodel; if (!UserAlive && ViewEntity == nf.RParms.Viewentity) @@ -8342,7 +8353,7 @@ public static void ProcessPluginMessage(string cmd) PluginVersion = cmdList[1] == "UCMD" ? "< 1.5" : cmdList[2]; DemoScanner_AddWarn("[INFO] Found module version " + PluginVersion, true, false, true, true); - if (cmdList[1] == "UCMD" || PluginVersion != "1.55") + if (cmdList[1] == "UCMD" || PluginVersion != "1.56") { if (IsRussia) { @@ -8384,7 +8395,7 @@ public static void ProcessPluginMessage(string cmd) var ms = Convert.ToByte(int.Parse(cmdList[3])); var incomingframenum = int.Parse(cmdList[4]); - if (!IsPlayerBtnAttackedPressed() && abs(CurrentTime - LastLostAttackTime2) < 1.0f && + if (!IsPlayerBtnAttackedPressed() && /*abs(CurrentTime - LastLostAttackTime2) < 1.0f &&*/ FirstAttack && IsUserAlive() && !DisableJump5AndAim16) { DemoScanner_AddWarn( @@ -8488,32 +8499,45 @@ public static void ProcessPluginMessage(string cmd) } else if (cmdList[1] == "EVENT" && !DisableJump5AndAim16) { - var events = 1; if (DUMP_ALL_FRAMES) OutDumpString += "\n{ EVENT PLUGIN }\n"; - if (PluginEvents == -1) + var tmpEvent = 0; + if (cmdList.Length > 1) + int.TryParse(cmdList[2], out tmpEvent); + LastEventId = -tmpEvent; + + if (abs(LastEventDetectTime) > EPSILON && abs(LastAttackPressed - LastEventDetectTime) > 0.5) { - CurrentEvents = 0; - PluginEvents = 0; + } - else if (CurrentEvents > 0) + else { - if (CurrentEvents - PluginEvents > 4) - { - if (PluginEvents != 0) - DemoScanner_AddWarn( - "[EXPERIMENTAL][CMD HACK TYPE 8] at (" + CurrentTime + "):" + - CurrentTimeString, false, true, false, true); - else - BadEvents += 8; - - CurrentEvents = 0; - PluginEvents = 0; - FirstEventShift = true; - } - - PluginEvents += events; + LastEventDetectTime = 0.0f; } + + //if (PluginEvents == -1) + //{ + // CurrentEvents = 0; + // PluginEvents = 0; + //} + //else if (CurrentEvents > 0) + //{ + // if (CurrentEvents - PluginEvents > 4) + // { + // if (PluginEvents != 0) + // DemoScanner_AddWarn( + // "[EXPERIMENTAL][CMD HACK TYPE 8] at (" + CurrentTime + "):" + + // CurrentTimeString, false, true, false, true); + // else + // BadEvents += 8; + + // CurrentEvents = 0; + // PluginEvents = 0; + // FirstEventShift = true; + // } + + // PluginEvents += events; + //} } else if (cmdList[1] == "MINR" || cmdList[1] == "MINUR" || cmdList[1] == "MAXR" || cmdList[1] == "MAXUR") @@ -9670,7 +9694,6 @@ public void MessageUpdateUserInfo() var tmpconsolecolor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; for (var i = 0; i < 64; i++) Console.Write(" "); - Console.CursorLeft = UserNameAndSteamIDField2; Console.Write(player.UserName.TrimBad().Trim()); Console.ForegroundColor = ConsoleColor.Cyan; @@ -10425,6 +10448,11 @@ private void MessageResourceList() DownloadedResources = CleanDownloadedResources; + //foreach (var res in DownloadedResources) + //{ + // Console.WriteLine(res.ToString() + " at " + CurrentTimeString); + //} + // consistency list // indices of resources to force consistency upon? if (BitBuffer.ReadBoolean()) @@ -10530,7 +10558,6 @@ private void MessageHltv() LocalPlayerId = 0; LocalPlayerUserId = 0; LocalPlayerUserId2 = 0; - LocalPlayerEntity = 0; AlternativeTimeCounter = 1; DEMOSCANNER_HLTV = true; var backcolor = Console.ForegroundColor; diff --git a/UnrealDemoScannerNET48/UnrealDemoScannerNET48.csproj b/UnrealDemoScannerNET48/UnrealDemoScannerNET48.csproj index 339729d..227e147 100644 --- a/UnrealDemoScannerNET48/UnrealDemoScannerNET48.csproj +++ b/UnrealDemoScannerNET48/UnrealDemoScannerNET48.csproj @@ -125,24 +125,24 @@ Other\Resources.Designer.cs - Properties\AssemblyInfo.cs + Properties\AssemblyInfo.cs - Parser\BinaryReaderExtension.cs + Parser\BinaryReaderExtension.cs - Parser\CrossDemoParser.cs + Parser\CrossDemoParser.cs - Parser\DemoInfo + Parser\DemoInfo - Parser\GoldSourceParser.cs + Parser\GoldSourceParser.cs - Parser\Point3D + Parser\Point3D EntitiesPreviewWindow.cs