some progress on prediction redesignment

This commit is contained in:
explorer 2024-10-21 06:13:28 +03:00
parent cd2b23d069
commit 924e32b297
10 changed files with 84 additions and 78 deletions

View File

@ -39,6 +39,8 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
Extended_Command->Extra_Commands = 0;
Extended_Command->Sequence_Shift = 0;
Global_Variables_Structure* Global_Variables = *(Global_Variables_Structure**)((unsigned __int32)Client_Module + 7096744);
void* Local_Player = *(void**)((unsigned __int32)Client_Module + 7498712);
@ -57,8 +59,6 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
}
}
*(__int32*)((unsigned __int32)Local_Player + 20) = 0;
if (*(__int8*)((unsigned __int32)Local_Player + 327) == 0)
{
float Move_Angles[3] =
@ -177,19 +177,24 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
auto Sequence_Shift = [&](__int32 Reserve)
{
if (Extra_Commands < 1)
if (Extra_Commands < 1) //td: should work on it
{
__int32 Sequence_Shift = (*(__int32*)((unsigned __int32)Local_Player + 5324) + ~-150) / 150 * 150 + (Reserve * 150);
if (Sequence_Shift > 0)
{
*(__int32*)((unsigned __int32)Network_Channel + 8) += Sequence_Shift;
}
}
*(__int32*)((unsigned __int32)Local_Player + 20) = 1 + (Reserve > 0);
Extended_Command->Sequence_Shift = Sequence_Shift;
}
}
};
if (GetKeyState(VK_INSERT) < 0)
{
Sequence_Shift(2);
}
if (*(__int32*)((unsigned __int32)Local_Player + 228) == 3)
{
if (*(__int8*)((unsigned __int32)Local_Player + 7322) == 1)
@ -203,7 +208,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
{
if (*(void**)((unsigned __int32)Local_Player + 10008) != INVALID_HANDLE_VALUE)
{
Sequence_Shift(150);
Sequence_Shift(2);
}
}
}
@ -211,11 +216,14 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
{
if ((*(float*)((unsigned __int32)Local_Player + 4604) + 800 * Global_Variables->Interval_Per_Tick >= 560) + *(__int8*)((unsigned __int32)Local_Player + 8068) + *(__int8*)((unsigned __int32)Local_Player + 9708) != 0)
{
Command->Buttons &= ~10241;
Sequence_Shift(150);
Sequence_Shift(2);
}
else
{
//will be used later for reprediction
auto Predict = [&]() -> void
{
Run_Prediction();
{
void* Prediction = (void*)((unsigned __int32)Client_Module + 8072728);
@ -232,6 +240,10 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
Set_Host_Type((unsigned __int32)Client_Module + 1331184)((void*)((unsigned __int32)Client_Module + 7174888), nullptr);
*(__int8*)((unsigned __int32)Prediction + 8) = 0;
}
};
Predict();
__int32 Block_Buttons = 2049;
@ -358,7 +370,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
__int8 Reloading = *(__int8*)((unsigned __int32)Weapon + 2493);
__int8 Healing = *(__int32*)((unsigned __int32)Local_Player + 7080) == 1;
__int32 Action = *(__int32*)((unsigned __int32)Local_Player + 7080);
__int8 Reviving = *(void**)((unsigned __int32)Local_Player + 8076) != INVALID_HANDLE_VALUE;
@ -384,7 +396,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
__int8 Forced = 0;
if ((Is_Melee + Reloading) * (Healing + Reviving ^ 1) != 0)
if ((Is_Melee + Reloading) * (Action + Reviving ^ 1) != 0)
{
if ((Target->Identifier ^ 72) % 348 >= 72)
{
@ -410,9 +422,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
{
using Perform_Shove_Trace = __int8(__thiscall*)(void* Weapon, float* Direction);
using Get_Center_Type = float*(__thiscall*)(void* Entity);
float* Target_Origin = Get_Center_Type((unsigned __int32)Client_Module + 114400)(Target->Self);
float* Target_Origin = Get_Center(Target->Self);
float Direction[3] =
{
@ -439,7 +449,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
if (Perform_Trace_Damage == 1)
{
if (Healing == 0)
if (Action == 0)
{
Command->Tick_Number = Target->Tick_Number;

View File

@ -291,6 +291,9 @@ __int32 __stdcall DllMain(HMODULE This_Module, unsigned __int32 Call_Reason, voi
Byte_Manager::Set_Bytes(1, (void*)((unsigned __int32)Client_Module + 2655546), 1, 216);
*(void**)((unsigned __int32)Client_Module + 8115120) = (void*)((unsigned __int32)Client_Module + 955708);
//rem: there is annoying "power bounce" effect (extremely noticeable with broken lerp)
//actually it's m_duckUntilOnGround
}
_putws(L"[ + ] Paint");

View File

@ -62,7 +62,7 @@ void Implement_Extended_Interface()
Create_Console_Interface(Pointer_Name(Interface_Aim_Intersection), (char*)"1", nullptr);
Create_Console_Interface(Pointer_Name(Interface_Penetration_Damage), (char*)"20", nullptr);
Create_Console_Interface(Pointer_Name(Interface_Penetration_Damage), (char*)"12", nullptr);
Create_Console_Interface(Pointer_Name(Interface_Equipment_Distance), (char*)"2048", nullptr);

View File

@ -2,7 +2,7 @@ void* Original_Item_Post_Frame_Caller;
void __thiscall Redirected_Item_Post_Frame(void* Player)
{
if (*(void**)((unsigned __int32)__builtin_frame_address(0) + 60) == (void*)((unsigned __int32)Client_Module + 423107))
if (*(void**)((unsigned __int32)__builtin_frame_address(0) + 88) == (void*)((unsigned __int32)Client_Module + 423107))
{
(decltype(&Redirected_Item_Post_Frame)(Original_Item_Post_Frame_Caller))(Player);
}

View File

@ -1,16 +1,21 @@
void* Original_Move_Caller;
__int32 Extra_Commands;
void Redirected_Move(float Unknown_Parameter, __int8 Final)
void Run_Prediction()
{
using Run_Prediction_Type = void(__cdecl*)();
Run_Prediction_Type((unsigned __int32)Engine_Module + 527776)();
}
__int32 Extra_Commands;
void* Original_Move_Caller;
void Redirected_Move(float Unknown_Parameter, __int8 Final)
{
if (*(void**)((unsigned __int32)Client_Module + 7498712) != nullptr)
{
Redirected_Read_Packets(Final);
Run_Prediction_Type((unsigned __int32)Engine_Module + 527776)();
Run_Prediction();
using Update_Animations_Type = void(__cdecl*)();
@ -35,7 +40,7 @@ void Redirected_Move(float Unknown_Parameter, __int8 Final)
{
(decltype(&Redirected_Move)(Original_Move_Caller))(Unknown_Parameter, Final);
Run_Prediction_Type((unsigned __int32)Engine_Module + 527776)();
Run_Prediction();
if (Extra_Commands > 0)
{

View File

@ -1,5 +1,14 @@
void* Perform_Trace_Target;
float* Get_Center(void* Entity)
{
using Get_Center_Type = float*(__thiscall*)(void* Entity);
return Get_Center_Type((unsigned __int32)Client_Module + 114400)(Entity);
}
float Perform_Trace_Damage;
float Vector_Normalize(float* Vector)
{
using Vector_Normalize_Type = float(__thiscall*)(float* Vector);
@ -14,8 +23,6 @@ void Angle_Vectors(float* Angles, float* Forward, float* Right, float* Up)
Angle_Vectors_Type((unsigned __int32)Client_Module + 3539376)(Angles, Forward, Right, Up);
};
float Perform_Trace_Damage;
void __thiscall Perform_Trace(void* Stack)
{
void* Entity = *(void**)((unsigned __int32)Stack + 312);
@ -119,13 +126,11 @@ void __thiscall Perform_Trace(void* Stack)
{
using Get_Bounds_Type = void(__thiscall*)(void* Collision, float* Start, float* Bounds);
using Get_Center_Type = float* (__thiscall*)(void* Entity);
void* Local_Player = *(void**)Trace_Information;
float Bounds[3];
Get_Bounds_Type((unsigned __int32)Client_Module + 878528)((void*)((unsigned __int32)Entity + 540), Get_Center_Type((unsigned __int32)Client_Module + 114400)(Local_Player), Bounds);
Get_Bounds_Type((unsigned __int32)Client_Module + 878528)((void*)((unsigned __int32)Entity + 540), Get_Center(Local_Player), Bounds);
using Calculate_Distance_Type = float(__thiscall*)(void* Collision, float* Bounds);
@ -284,9 +289,7 @@ void __thiscall Perform_Trace(void* Stack)
{
float Inflictor_Direction[3];
using Get_Center_Type = float*(__thiscall*)(void* Entity);
float* Start = Get_Center_Type((unsigned __int32)Client_Module + 114400)(*(void**)Trace_Information);
float* Start = Get_Center(*(void**)Trace_Information);
Inflictor_Direction[0] = End[0] - Start[0];

View File

@ -41,26 +41,15 @@ Prediction_Copy_Structure Predicton_Copy;
void Predicton_Copy_Compare(void* Unknown_Parameter_1, void* Unknown_Parameter_2, void* Unknown_Parameter_3, void* Unknown_Parameter_4, void* Unknown_Parameter_5, void* Unknown_Parameter_6, __int8 Within_Tolerance, void* Unknown_Parameter_7)
{
Prediction_Field_Structure* Field = *(Prediction_Field_Structure**)((unsigned __int32)__builtin_frame_address(0) + 60);
if (Field->Flat_Offset[0] == 5324)
{
if (*(__int32*)((unsigned __int32)Predicton_Copy.Destination + 20) != 0)
{
goto Copy_Label;
}
}
if (Within_Tolerance == 1)
{
Prediction_Field_Structure* Field = *(Prediction_Field_Structure**)((unsigned __int32)__builtin_frame_address(0) + 60);
if ((256 - Field->Flat_Offset[0] ^ Field->Flat_Offset[0] - 244) != 12)
{
Copy_Label:
{
Byte_Manager::Copy_Bytes(0, (void*)((unsigned __int32)Predicton_Copy.Destination + Field->Flat_Offset[0]), Field->Bytes, (void*)((unsigned __int32)Predicton_Copy.Source + Field->Flat_Offset[1]));
}
}
}
}
struct Prediction_Descriptor_Structure
@ -91,6 +80,8 @@ void __thiscall Redirected_Post_Network_Data_Received(void* Unknown_Parameter, _
using Transfer_Data_Type = __int32(__thiscall*)(Prediction_Copy_Structure* Prediction_Copy, void* Unknown_Parameter, __int32 Entity_Number, Prediction_Descriptor_Structure* Descriptor);
Transfer_Data_Type((unsigned __int32)Client_Module + 1573744)(&Predicton_Copy, nullptr, -1, (Prediction_Descriptor_Structure*)((unsigned __int32)Client_Module + 7236480));
*(__int32*)((unsigned __int32)Local_Player + 5324) += Commands_Acknowledged - Commands_Acknowledged % 150;
}
(decltype(&Redirected_Post_Network_Data_Received)(Original_Post_Network_Data_Received_Caller))(Unknown_Parameter, Commands_Acknowledged);

View File

@ -2,31 +2,14 @@ void* Original_Process_Movement_Caller;
void __thiscall Redirected_Process_Movement(void* Unknown_Parameter, void* Player, void* Move_Data)
{
__int32 Stunned = *(__int32*)((unsigned __int32)Player + 20);
if (Stunned == 2)
if (*(__int32*)((unsigned __int32)Player + 5324) < 0)
{
Global_Variables_Structure* Global_Variables = *(Global_Variables_Structure**)((unsigned __int32)Client_Module + 7096744);
Global_Variables->Current_Time *= -1;
*(__int32*)((unsigned __int32)Move_Data + 36) &= ~1564;
if (*(__int8*)((unsigned __int32)Player + 4636) == 1)
{
*(__int32*)((unsigned __int32)Move_Data + 36) |= 4;
*(__int32*)((unsigned __int32)Move_Data + 36) |= 4 * *(__int8*)((unsigned __int32)Player + 4636);
*(double*)((unsigned __int32)Move_Data + 44) = 0;
}
*(float*)((unsigned __int32)Move_Data + 44) = 0;
*(float*)((unsigned __int32)Move_Data + 48) = 0;
(decltype(&Redirected_Process_Movement)(Original_Process_Movement_Caller))(Unknown_Parameter, Player, Move_Data);
Global_Variables->Current_Time *= -1;
}
else
{
(decltype(&Redirected_Process_Movement)(Original_Process_Movement_Caller))(Unknown_Parameter, Player, Move_Data);
}
}

View File

@ -22,6 +22,8 @@ struct Command_Structure
struct Extended_Command_Structure
{
__int32 Extra_Commands;
__int32 Sequence_Shift;
};
Extended_Command_Structure Extended_Commands[150];
@ -32,7 +34,16 @@ void __thiscall Redirected_Run_Command(void* Prediction, void* Player, Command_S
{
Extended_Command_Structure* Extended_Command = &Extended_Commands[Command->Frame_Number];
*(__int32*)((unsigned __int32)Player + 5324) -= Extended_Command->Extra_Commands;
*(__int32*)((unsigned __int32)Player + 5324) -= Extended_Command->Extra_Commands + Extended_Command->Sequence_Shift;
(decltype(&Redirected_Run_Command)(Original_Run_Command_Caller))(Prediction, Player, Command, Unknown_Parameter);
if (__builtin_return_address(0) == (void*)((unsigned __int32)Client_Module + 423107))
{
*(__int32*)((unsigned __int32)Player + 5324) += Extended_Command->Sequence_Shift;
Global_Variables_Structure* Global_Variables = *(Global_Variables_Structure**)((unsigned __int32)Client_Module + 7096744);
Global_Variables->Current_Time = (*(__int32*)((unsigned __int32)Player + 5324) - 1) * Global_Variables->Interval_Per_Tick;
}
}

View File

@ -62,7 +62,7 @@ void Redirected_Send_Move()
void* Network_Channel = *(void**)(*(unsigned __int32*)((unsigned __int32)Engine_Module + 4352236) + 24);
*(__int32*)((unsigned __int32)Network_Channel + 28) -= Extra_Commands_Queue;
*(__int32*)((unsigned __int32)Network_Channel + 28) -= Extra_Commands_Queue; //td: should do same thing i'm doing in v34 instead
using Send_Network_Message_Type = void(__thiscall**)(void* Network_Channel, void* Message, void* Unknown_Parameter_1, void* Unknown_Parameter_2);