ensure CPredictionCopy contains correct value for given frame

water? maybe. +20 is to be removed anyway
This commit is contained in:
explorer 2024-10-19 03:42:23 +03:00
parent 83ad090b63
commit cd2b23d069
3 changed files with 31 additions and 15 deletions

View File

@ -203,17 +203,17 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
{ {
if (*(void**)((unsigned __int32)Local_Player + 10008) != INVALID_HANDLE_VALUE) if (*(void**)((unsigned __int32)Local_Player + 10008) != INVALID_HANDLE_VALUE)
{ {
Sequence_Shift(2); Sequence_Shift(150);
} }
} }
} }
else else
{ {
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) 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; Command->Buttons &= ~10241;
Sequence_Shift(2); Sequence_Shift(150);
} }
else else
{ {
@ -759,4 +759,11 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
Command->Buttons &= ~524288; Command->Buttons &= ~524288;
(decltype(&Redirected_Copy_Command)(Original_Copy_Command_Caller))(Unknown_Parameter, Command); (decltype(&Redirected_Copy_Command)(Original_Copy_Command_Caller))(Unknown_Parameter, Command);
void* Prediction_Frame = *(void**)((unsigned __int32)Local_Player + 1500);
if (Prediction_Frame != nullptr)
{
*(__int32*)Prediction_Frame = *(__int32*)((unsigned __int32)Local_Player + 16);
}
} }

View File

@ -210,19 +210,26 @@ __int32 __stdcall DllMain(HMODULE This_Module, unsigned __int32 Call_Reason, voi
_putws(L"[ + ] Prediction"); _putws(L"[ + ] Prediction");
{ {
static Prediction_Descriptor_Structure Original_Prediction_Descriptor; 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));
Prediction_Descriptor_Structure* Prediction_Descriptor = (Prediction_Descriptor_Structure*)((unsigned __int32)Client_Module + 7290836); Byte_Manager::Copy_Bytes(0, Original_Descriptor, sizeof(Prediction_Descriptor_Structure), Descriptor);
Byte_Manager::Copy_Bytes(0, &Original_Prediction_Descriptor, sizeof(Prediction_Descriptor_Structure), Prediction_Descriptor); Descriptor->Fields = Fields;
static Prediction_Field_Structure Prediction_Fields = { 1, (char*)"m_fMaxSpread", 3340, 1, { }, sizeof(float) }; Descriptor->Size = Size;
Prediction_Descriptor->Fields = &Prediction_Fields; Descriptor->Parent = Original_Descriptor;
};
Prediction_Descriptor->Size = sizeof(Prediction_Fields) / sizeof(Prediction_Field_Structure); static Prediction_Field_Structure Player_Fields = { 5, (char*)(*(unsigned __int32*)((unsigned __int32)GetModuleHandleW(L"vphysics.dll") + 1701868) + 2226), 16, 1, { }, sizeof(__int32) };
Prediction_Descriptor->Parent = &Original_Prediction_Descriptor; 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));
Redirection_Manager::Redirect_Function(Original_Spawn_Grenade_Caller, 2, (void*)((unsigned __int32)Client_Module + 2227424), 1, (void*)Redirected_Spawn_Grenade); Redirection_Manager::Redirect_Function(Original_Spawn_Grenade_Caller, 2, (void*)((unsigned __int32)Client_Module + 2227424), 1, (void*)Redirected_Spawn_Grenade);

View File

@ -15,6 +15,8 @@ struct Prediction_Field_Structure
__int8 Additionals_Bytes_2[12]; __int8 Additionals_Bytes_2[12];
__int32 Flat_Offset[2]; __int32 Flat_Offset[2];
__int8 Additionals_Bytes_3[2];
}; };
struct Prediction_Copy_Structure struct Prediction_Copy_Structure
@ -71,7 +73,7 @@ struct Prediction_Descriptor_Structure
Prediction_Descriptor_Structure* Parent; Prediction_Descriptor_Structure* Parent;
__int8 Additional_Bytes_2[6]; __int8 Additional_Bytes_2[8];
}; };
void* Original_Post_Network_Data_Received_Caller; void* Original_Post_Network_Data_Received_Caller;
@ -80,11 +82,11 @@ void __thiscall Redirected_Post_Network_Data_Received(void* Unknown_Parameter, _
{ {
void* Local_Player = *(void**)((unsigned __int32)Client_Module + 7498712); void* Local_Player = *(void**)((unsigned __int32)Client_Module + 7498712);
void* Result = *(void**)((unsigned __int32)Local_Player + 900 + (150 - ((Commands_Acknowledged - 1) % 150 + 1) * 150 % -~150) * 4); void* Prediction_Frame = *(void**)((unsigned __int32)Local_Player + 900 + (150 - ((Commands_Acknowledged - 1) % 150 + 1) * 150 % -~150) * 4);
if (Result != nullptr) if (Prediction_Frame != nullptr)
{ {
Predicton_Copy.Construct(Local_Player, Result, (void*)Predicton_Copy_Compare); Predicton_Copy.Construct(Local_Player, Prediction_Frame, (void*)Predicton_Copy_Compare);
using Transfer_Data_Type = __int32(__thiscall*)(Prediction_Copy_Structure* Prediction_Copy, void* Unknown_Parameter, __int32 Entity_Number, Prediction_Descriptor_Structure* Descriptor); using Transfer_Data_Type = __int32(__thiscall*)(Prediction_Copy_Structure* Prediction_Copy, void* Unknown_Parameter, __int32 Entity_Number, Prediction_Descriptor_Structure* Descriptor);