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"
This commit is contained in:
explorer 2024-12-06 03:11:27 +03:00
parent bd318c5576
commit 485ff54642
9 changed files with 53 additions and 57 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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");

View File

@ -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");

View File

@ -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)
{

View File

@ -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);