From 485ff54642127d420f5e70ecbc29c9910eb057b0 Mon Sep 17 00:00:00 2001 From: explorer Date: Fri, 6 Dec 2024 03:11:27 +0300 Subject: [PATCH] extend interpolation history; events ordering intentionally was kept until "something" along with watermark inside of datamap lol jitters in certain scenarios due to interpolation history not being filled which doesn't bothers anyone (probably) so i've removed "fading" --- Copy_Command.hpp | 37 ++++++++++++++++++++++--------------- Entry_Point.cpp | 21 +++++++-------------- Extended_Interface.hpp | 2 +- Interpolate.hpp | 21 ++------------------- Move.hpp | 8 ++++---- Perform_Shove_Trace.hpp | 2 +- Perform_Trace.hpp | 2 +- Set_Move_Type.hpp | 2 +- Update_Animations.hpp | 15 ++++++++++++++- 9 files changed, 53 insertions(+), 57 deletions(-) diff --git a/Copy_Command.hpp b/Copy_Command.hpp index 3b93f9f..48741d4 100644 --- a/Copy_Command.hpp +++ b/Copy_Command.hpp @@ -45,21 +45,30 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu if (Extra_Commands == -1) { + *(float*)((unsigned __int32)Local_Player + 16) = Global_Variables->Interval_Per_Tick; + *(__int32*)((unsigned __int32)Local_Player + 20) = Command->Command_Number; - void* Prediction_Frame = *(void**)((unsigned __int32)Local_Player + 1500); - - if (Prediction_Frame != nullptr) + if ((Command->Buttons & 524288) == 524288) { - if ((Command->Buttons & 524288) == 524288) - { - Extended_Command->Extra_Commands = max(0, Extra_Commands = std::clamp(Interface_Extra_Commands.Integer, (__int32)(0.06f / Global_Variables->Interval_Per_Tick + 0.5f), 14)); + Extended_Command->Extra_Commands = max(0, Extra_Commands = std::clamp(Interface_Extra_Commands.Integer, (__int32)(0.06f / Global_Variables->Interval_Per_Tick + 0.5f), 14)); - *(__int32*)Prediction_Frame = min(*(__int32*)Prediction_Frame + 1, Extended_Command->Extra_Commands * Interface_Interpolate_Extra_Commands.Integer); - } - else + *(float*)((unsigned __int32)Local_Player + 16) *= 1.f + Extended_Command->Extra_Commands; + } + + __int32 Variable_Number = 0; + + Traverse_Variables_Label: + { + void* Variable = *(void**)(*(unsigned __int32*)((unsigned __int32)Local_Player + 24) + Variable_Number * 12 + 8); + + *(float*)((unsigned __int32)Variable + 36) = *(float*)((unsigned __int32)Local_Player + 16); + + Variable_Number += 1; + + if (Variable_Number != *(__int32*)((unsigned __int32)Local_Player + 36)) { - *(__int32*)Prediction_Frame = max(0, *(__int32*)Prediction_Frame - 1); + goto Traverse_Variables_Label; } } } @@ -79,7 +88,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu { Command->Move[0] = 0; - if (*(__int32*)((unsigned __int32)Local_Player + 316) == -1) + if (*(void**)((unsigned __int32)Local_Player + 316) == INVALID_HANDLE_VALUE) { Command->Buttons &= ~2; } @@ -533,7 +542,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu { if (Weapon_Identifier == 153) { - if (*(float*)((unsigned __int32)Weapon + 3392) + *(float*)((unsigned __int32)Weapon + 3396) != 0) + if (*(double*)((unsigned __int32)Weapon + 3392) != 0.) { Compensate_Burst = 1; @@ -685,9 +694,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu { __builtin_atan2f(-Direction[2], __builtin_hypotf(Direction[0], Direction[1])) * 180.f / 3.1415927f, - __builtin_atan2f(Direction[1], Direction[0]) * 180.f / 3.1415927f, - - 0 + __builtin_atan2f(Direction[1], Direction[0]) * 180.f / 3.1415927f }; if (Perform_Trace(Angles) == 1) diff --git a/Entry_Point.cpp b/Entry_Point.cpp index f90eab3..6f4d8e9 100755 --- a/Entry_Point.cpp +++ b/Entry_Point.cpp @@ -209,26 +209,19 @@ __int32 __stdcall DllMain(HMODULE This_Module, unsigned __int32 Call_Reason, voi _putws(L"[ + ] Prediction"); { - auto Add_Prediction_Fields = [](Prediction_Descriptor_Structure* Descriptor, Prediction_Field_Structure* Fields, __int32 Size) -> void - { - Prediction_Descriptor_Structure* Original_Descriptor = (Prediction_Descriptor_Structure*)malloc(sizeof(Prediction_Descriptor_Structure)); + static Prediction_Descriptor_Structure Original_Prediction_Descriptor; - Byte_Manager::Copy_Bytes(1, Original_Descriptor, sizeof(Prediction_Descriptor_Structure), Descriptor); + Prediction_Descriptor_Structure* Prediction_Descriptor = (Prediction_Descriptor_Structure*)((unsigned __int32)Client_Module + 7290836); - Descriptor->Fields = Fields; + Byte_Manager::Copy_Bytes(0, &Original_Prediction_Descriptor, sizeof(Prediction_Descriptor_Structure), Prediction_Descriptor); - Descriptor->Size = Size; + static Prediction_Field_Structure Prediction_Fields = { 1, (char*)"m_fMaxSpread", 3340, 1, { }, sizeof(float) }; - Descriptor->Parent = Original_Descriptor; - }; + Prediction_Descriptor->Fields = &Prediction_Fields; - static Prediction_Field_Structure Player_Fields = { 5, (char*)(*(unsigned __int32*)((unsigned __int32)GetModuleHandleW(L"vphysics.dll") + 1701868) + 2226), 16, 1, { }, sizeof(__int32) }; + Prediction_Descriptor->Size = sizeof(Prediction_Fields) / sizeof(Prediction_Field_Structure); - Add_Prediction_Fields((Prediction_Descriptor_Structure*)((unsigned __int32)Client_Module + 7236480), &Player_Fields, sizeof(Player_Fields) / sizeof(Prediction_Field_Structure)); - - static Prediction_Field_Structure Weapon_Fields = { 1, (char*)"m_fMaxSpread", 3340, 1, { }, sizeof(float) }; - - Add_Prediction_Fields((Prediction_Descriptor_Structure*)((unsigned __int32)Client_Module + 7290836), &Weapon_Fields, sizeof(Weapon_Fields) / sizeof(Prediction_Field_Structure)); + Prediction_Descriptor->Parent = &Original_Prediction_Descriptor; Original_Spawn_Grenade_Caller = Redirection_Manager::Redirect_Function(2, (void*)((unsigned __int32)Client_Module + 2227424), (void*)Redirected_Spawn_Grenade); diff --git a/Extended_Interface.hpp b/Extended_Interface.hpp index b58c584..52bdf25 100755 --- a/Extended_Interface.hpp +++ b/Extended_Interface.hpp @@ -50,7 +50,7 @@ void Implement_Extended_Interface() #define Pointer_Name(Interface) &Interface, (char*)#Interface + 10 - Create_Interface(Pointer_Name(Interface_Extra_Commands), (char*)"4", nullptr); + Create_Interface(Pointer_Name(Interface_Extra_Commands), (char*)"5", nullptr); Create_Interface(Pointer_Name(Interface_Interpolate_Extra_Commands), (char*)"1", nullptr); diff --git a/Interpolate.hpp b/Interpolate.hpp index 99074f1..71e5235 100755 --- a/Interpolate.hpp +++ b/Interpolate.hpp @@ -1,27 +1,10 @@ -struct Global_Variables_Structure -{ - __int8 Additional_Bytes_1[12]; - - float Current_Time; - - float Frame_Time; - - __int8 Additional_Bytes_2[8]; - - float Interval_Per_Tick; -}; - void* Original_Interpolate_Caller; -__int8 __thiscall Redirected_Interpolate(void* Entity, float Time) +__int8 __thiscall Redirected_Interpolate(void* Entity, void* Unknown_Parameter) { if (Entity == *(void**)((unsigned __int32)Client_Module + 7498712)) { - Time = (*(Global_Variables_Structure**)((unsigned __int32)Client_Module + 7096744))->Current_Time; - - *(__int32*)((unsigned __int32)Entity + 5328) -= *(__int32*)((unsigned __int32)Entity + 16); - - return (decltype(&Redirected_Interpolate)(Original_Interpolate_Caller))(Entity, Time); + return (decltype(&Redirected_Interpolate)(Original_Interpolate_Caller))(Entity, Unknown_Parameter); } return 1; diff --git a/Move.hpp b/Move.hpp index 232531f..3dac581 100644 --- a/Move.hpp +++ b/Move.hpp @@ -16,6 +16,10 @@ void Redirected_Move(float Unknown_Parameter, __int8 Final) Update_Animations_Type((unsigned __int32)Client_Module + 205296)(); + using Fire_Events_Type = void(__cdecl*)(); + + Fire_Events_Type((unsigned __int32)Engine_Module + 521648)(); + Update_Animation_Time = (*(Global_Variables_Structure**)((unsigned __int32)Client_Module + 7096744))->Current_Time; Update_Animation_Type = 1; @@ -23,10 +27,6 @@ void Redirected_Move(float Unknown_Parameter, __int8 Final) Update_Animations_Type((unsigned __int32)Client_Module + 205296)(); Update_Animation_Type = 0; - - using Fire_Events_Type = void(__cdecl*)(); - - Fire_Events_Type((unsigned __int32)Engine_Module + 521648)(); } Extra_Commands = -1; diff --git a/Perform_Shove_Trace.hpp b/Perform_Shove_Trace.hpp index 85c79f6..3127317 100755 --- a/Perform_Shove_Trace.hpp +++ b/Perform_Shove_Trace.hpp @@ -10,7 +10,7 @@ void __thiscall Perform_Shove_Trace(void* Stack) void* Original_Perform_Shove_Trace_Caller; -void __declspec(naked) Redirected_Perform_Shove_Trace() +__attribute__((naked)) void Redirected_Perform_Shove_Trace() { asm("leal -304(%ebp), %eax"); asm("pushl %eax"); diff --git a/Perform_Trace.hpp b/Perform_Trace.hpp index 28477b7..a12ab62 100755 --- a/Perform_Trace.hpp +++ b/Perform_Trace.hpp @@ -329,7 +329,7 @@ void __thiscall Perform_Trace(void* Stack) void* Original_Perform_Trace_Caller; -void __declspec(naked) Redirected_Perform_Trace() +__attribute__((naked)) void Redirected_Perform_Trace() { asm("pushal"); asm("movl %esp, %ecx"); diff --git a/Set_Move_Type.hpp b/Set_Move_Type.hpp index 66df9cf..0a5a512 100644 --- a/Set_Move_Type.hpp +++ b/Set_Move_Type.hpp @@ -1,4 +1,4 @@ -void __cdecl Redirected_Set_Move_Type(void* Input, void* Output) +void Redirected_Set_Move_Type(void* Input, void* Output) { if (*(__int8*)((unsigned __int32)Output + 324) == 0) { diff --git a/Update_Animations.hpp b/Update_Animations.hpp index bab7783..32f3fe4 100644 --- a/Update_Animations.hpp +++ b/Update_Animations.hpp @@ -1,8 +1,21 @@ +struct Global_Variables_Structure +{ + __int8 Additional_Bytes_1[12]; + + float Current_Time; + + float Frame_Time; + + __int8 Additional_Bytes_2[8]; + + float Interval_Per_Tick; +}; + float Update_Animation_Time; __int8 Update_Animation_Type; -void __cdecl Redirected_Update_Animations() +void Redirected_Update_Animations() { Global_Variables_Structure* Global_Variables = *(Global_Variables_Structure**)((unsigned __int32)Client_Module + 7096744);