revert to old approach

i've got problem with imagination regarding reliable method of relative correction on networking errors so old approach is preferable for moment

currently focusing on gmod-x64 fork of segregation so probably won't update l4d2 for period of time

[^\S\r\n]+(?=\r?$)
This commit is contained in:
explorer 2024-11-05 18:11:13 +03:00
parent 2dc81b9839
commit e462dff4f5
5 changed files with 50 additions and 40 deletions

View File

@ -96,7 +96,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
float* Velocity = (float*)((unsigned __int32)Local_Player + 256); float* Velocity = (float*)((unsigned __int32)Local_Player + 256);
if (__builtin_fabsf(Difference) < __builtin_atan2f(30, __builtin_hypotf(Velocity[0], Velocity[1])) * 180.f / 3.1415927f) if (__builtin_fabsf(Difference) < __builtin_atan2f(30.f, __builtin_hypotf(Velocity[0], Velocity[1])) * 180.f / 3.1415927f)
{ {
float Strafe_Angle = __builtin_remainderf(Move_Angles[1] - __builtin_atan2f(Velocity[1], Velocity[0]) * 180.f / 3.1415927f, 360.f); float Strafe_Angle = __builtin_remainderf(Move_Angles[1] - __builtin_atan2f(Velocity[1], Velocity[0]) * 180.f / 3.1415927f, 360.f);
@ -739,7 +739,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
float Maximum_Spread = *(float*)((unsigned __int32)Weapon + 3340); float Maximum_Spread = *(float*)((unsigned __int32)Weapon + 3340);
float* Recoil = (float*)((unsigned __int32)Local_Player + 4612); float* Recoil = (float*)((unsigned __int32)Local_Player + 4612);
Command->Angles[0] -= Random_Type((unsigned __int32)Client_Module + 1756592)((char*)"CTerrorGun::FireBullet HorizSpread", -Maximum_Spread, Maximum_Spread, nullptr) + Recoil[0]; Command->Angles[0] -= Random_Type((unsigned __int32)Client_Module + 1756592)((char*)"CTerrorGun::FireBullet HorizSpread", -Maximum_Spread, Maximum_Spread, nullptr) + Recoil[0];
Command->Angles[1] -= Random_Type((unsigned __int32)Client_Module + 1756592)((char*)"CTerrorGun::FireBullet VertSpread", -Maximum_Spread, Maximum_Spread, nullptr) + Recoil[1]; Command->Angles[1] -= Random_Type((unsigned __int32)Client_Module + 1756592)((char*)"CTerrorGun::FireBullet VertSpread", -Maximum_Spread, Maximum_Spread, nullptr) + Recoil[1];

View File

@ -106,21 +106,21 @@ void __thiscall Redirected_Paint(void* Panel)
Initialize_Vertices_Label: Initialize_Vertices_Label:
{ {
Hitbox_Vertices[0][Axis_Number] = Bones[*(__int32*)Hitbox][Axis_Number][0] * Hitbox_Minimum[0] + Bones[*(__int32*)Hitbox][Axis_Number][1] * Hitbox_Minimum[1] + Bones[*(__int32*)Hitbox][Axis_Number][2] * Hitbox_Minimum[2] + Bones[*(__int32*)Hitbox][Axis_Number][3]; Hitbox_Vertices[0][Axis_Number] = Bones[*(__int32*)Hitbox][Axis_Number][0] * Hitbox_Minimum[0] + Bones[*(__int32*)Hitbox][Axis_Number][1] * Hitbox_Minimum[1] + Bones[*(__int32*)Hitbox][Axis_Number][2] * Hitbox_Minimum[2] + Bones[*(__int32*)Hitbox][Axis_Number][3];
Hitbox_Vertices[1][Axis_Number] = Bones[*(__int32*)Hitbox][Axis_Number][0] * Hitbox_Maximum[0] + Bones[*(__int32*)Hitbox][Axis_Number][1] * Hitbox_Minimum[1] + Bones[*(__int32*)Hitbox][Axis_Number][2] * Hitbox_Minimum[2] + Bones[*(__int32*)Hitbox][Axis_Number][3]; Hitbox_Vertices[1][Axis_Number] = Bones[*(__int32*)Hitbox][Axis_Number][0] * Hitbox_Maximum[0] + Bones[*(__int32*)Hitbox][Axis_Number][1] * Hitbox_Minimum[1] + Bones[*(__int32*)Hitbox][Axis_Number][2] * Hitbox_Minimum[2] + Bones[*(__int32*)Hitbox][Axis_Number][3];
Hitbox_Vertices[2][Axis_Number] = Bones[*(__int32*)Hitbox][Axis_Number][0] * Hitbox_Minimum[0] + Bones[*(__int32*)Hitbox][Axis_Number][1] * Hitbox_Maximum[1] + Bones[*(__int32*)Hitbox][Axis_Number][2] * Hitbox_Minimum[2] + Bones[*(__int32*)Hitbox][Axis_Number][3]; Hitbox_Vertices[2][Axis_Number] = Bones[*(__int32*)Hitbox][Axis_Number][0] * Hitbox_Minimum[0] + Bones[*(__int32*)Hitbox][Axis_Number][1] * Hitbox_Maximum[1] + Bones[*(__int32*)Hitbox][Axis_Number][2] * Hitbox_Minimum[2] + Bones[*(__int32*)Hitbox][Axis_Number][3];
Hitbox_Vertices[3][Axis_Number] = Bones[*(__int32*)Hitbox][Axis_Number][0] * Hitbox_Minimum[0] + Bones[*(__int32*)Hitbox][Axis_Number][1] * Hitbox_Minimum[1] + Bones[*(__int32*)Hitbox][Axis_Number][2] * Hitbox_Maximum[2] + Bones[*(__int32*)Hitbox][Axis_Number][3]; Hitbox_Vertices[3][Axis_Number] = Bones[*(__int32*)Hitbox][Axis_Number][0] * Hitbox_Minimum[0] + Bones[*(__int32*)Hitbox][Axis_Number][1] * Hitbox_Minimum[1] + Bones[*(__int32*)Hitbox][Axis_Number][2] * Hitbox_Maximum[2] + Bones[*(__int32*)Hitbox][Axis_Number][3];
Hitbox_Vertices[4][Axis_Number] = Bones[*(__int32*)Hitbox][Axis_Number][0] * Hitbox_Maximum[0] + Bones[*(__int32*)Hitbox][Axis_Number][1] * Hitbox_Maximum[1] + Bones[*(__int32*)Hitbox][Axis_Number][2] * Hitbox_Minimum[2] + Bones[*(__int32*)Hitbox][Axis_Number][3]; Hitbox_Vertices[4][Axis_Number] = Bones[*(__int32*)Hitbox][Axis_Number][0] * Hitbox_Maximum[0] + Bones[*(__int32*)Hitbox][Axis_Number][1] * Hitbox_Maximum[1] + Bones[*(__int32*)Hitbox][Axis_Number][2] * Hitbox_Minimum[2] + Bones[*(__int32*)Hitbox][Axis_Number][3];
Hitbox_Vertices[5][Axis_Number] = Bones[*(__int32*)Hitbox][Axis_Number][0] * Hitbox_Maximum[0] + Bones[*(__int32*)Hitbox][Axis_Number][1] * Hitbox_Minimum[1] + Bones[*(__int32*)Hitbox][Axis_Number][2] * Hitbox_Maximum[2] + Bones[*(__int32*)Hitbox][Axis_Number][3]; Hitbox_Vertices[5][Axis_Number] = Bones[*(__int32*)Hitbox][Axis_Number][0] * Hitbox_Maximum[0] + Bones[*(__int32*)Hitbox][Axis_Number][1] * Hitbox_Minimum[1] + Bones[*(__int32*)Hitbox][Axis_Number][2] * Hitbox_Maximum[2] + Bones[*(__int32*)Hitbox][Axis_Number][3];
Hitbox_Vertices[6][Axis_Number] = Bones[*(__int32*)Hitbox][Axis_Number][0] * Hitbox_Minimum[0] + Bones[*(__int32*)Hitbox][Axis_Number][1] * Hitbox_Maximum[1] + Bones[*(__int32*)Hitbox][Axis_Number][2] * Hitbox_Maximum[2] + Bones[*(__int32*)Hitbox][Axis_Number][3]; Hitbox_Vertices[6][Axis_Number] = Bones[*(__int32*)Hitbox][Axis_Number][0] * Hitbox_Minimum[0] + Bones[*(__int32*)Hitbox][Axis_Number][1] * Hitbox_Maximum[1] + Bones[*(__int32*)Hitbox][Axis_Number][2] * Hitbox_Maximum[2] + Bones[*(__int32*)Hitbox][Axis_Number][3];
Hitbox_Vertices[7][Axis_Number] = Bones[*(__int32*)Hitbox][Axis_Number][0] * Hitbox_Maximum[0] + Bones[*(__int32*)Hitbox][Axis_Number][1] * Hitbox_Maximum[1] + Bones[*(__int32*)Hitbox][Axis_Number][2] * Hitbox_Maximum[2] + Bones[*(__int32*)Hitbox][Axis_Number][3]; Hitbox_Vertices[7][Axis_Number] = Bones[*(__int32*)Hitbox][Axis_Number][0] * Hitbox_Maximum[0] + Bones[*(__int32*)Hitbox][Axis_Number][1] * Hitbox_Maximum[1] + Bones[*(__int32*)Hitbox][Axis_Number][2] * Hitbox_Maximum[2] + Bones[*(__int32*)Hitbox][Axis_Number][3];
if (Axis_Number != 2) if (Axis_Number != 2)
{ {
Axis_Number += 1; Axis_Number += 1;

View File

@ -243,7 +243,7 @@ void __thiscall Perform_Trace(void* Stack)
{ {
static float Multipliers[8] = { 1.f, 4.f, 1.f, 1.25f, 1.f, 1.f, 0.75f, 0.75f }; static float Multipliers[8] = { 1.f, 4.f, 1.f, 1.25f, 1.f, 1.f, 0.75f, 0.75f };
Damage *= min(4.f - 2.75f * Is_Shotgun, Multipliers[Group]); Damage *= min(Multipliers[Group], 4.f - 2.75f * Is_Shotgun);
} }
if (Get_Identifier(Entity, 1, 0) == 99) if (Get_Identifier(Entity, 1, 0) == 99)
@ -306,7 +306,7 @@ void __thiscall Perform_Trace(void* Stack)
using Get_Attachment_Type = void(__thiscall*)(void* Entity, char* Attachment, float* Origin, float* Angle); using Get_Attachment_Type = void(__thiscall*)(void* Entity, char* Attachment, float* Origin, float* Angle);
float Origin[3]; float Origin[3];
float Angle[3]; float Angle[3];
Get_Attachment_Type((unsigned __int32)Client_Module + 178656)(Entity, (char*)"chest", Origin, Angle); Get_Attachment_Type((unsigned __int32)Client_Module + 178656)(Entity, (char*)"chest", Origin, Angle);

View File

@ -1,3 +1,23 @@
struct Prediction_Copy_Structure
{
__int8 Additionals_Bytes_1[8];
void* Destination;
void* Source;
__int8 Additional_Bytes_2[48];
void Construct(void* Destination, void* Source, void* Handler)
{
using Construct_Type = void(__fastcall*)(void* Prediction_Copy, void* Unknown_Parameter, __int32 Type, void* Destination, __int8 Destination_Packed, void* Source, __int8 Source_Packed, __int32 Operation_Type, void* Handler);
Construct_Type((unsigned __int32)Client_Module + 1564512)(this, nullptr, 2, Destination, 1, Source, 0, 3, Handler);
}
};
Prediction_Copy_Structure Predicton_Copy;
struct Prediction_Field_Structure struct Prediction_Field_Structure
{ {
__int32 Type; __int32 Type;
@ -19,35 +39,25 @@ struct Prediction_Field_Structure
__int8 Additionals_Bytes_3[2]; __int8 Additionals_Bytes_3[2];
}; };
struct Prediction_Copy_Structure __int8 Consistent_Time;
{
__int8 Additionals_Bytes_1[8];
void* Destination;
void* Source;
__int8 Additional_Bytes_2[48];
void Construct(void* Destination, void* Source, void* Handler)
{
using Construct_Type = void(__fastcall*)(void* Prediction_Copy, void* Unknown_Parameter, __int32 Type, void* Destination, __int8 Destination_Packed, void* Source, __int8 Source_Packed, __int32 Operation_Type, void* Handler);
Construct_Type((unsigned __int32)Client_Module + 1564512)(this, nullptr, 2, Destination, 1, Source, 0, 3, Handler);
}
};
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) 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] * Consistent_Time == 5324)
{
goto Copy_Label;
}
if (Within_Tolerance == 1) 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) if ((256 - Field->Flat_Offset[0] ^ Field->Flat_Offset[0] - 244) != 12)
{ {
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])); 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]));
}
} }
} }
} }
@ -72,16 +82,16 @@ 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* Prediction_Frame = *(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 (Prediction_Frame != nullptr) if (Prediction_Frame != nullptr)
{ {
Predicton_Copy.Construct(Local_Player, Prediction_Frame, (void*)Predicton_Copy_Compare); Predicton_Copy.Construct(Local_Player, Prediction_Frame, (void*)Predicton_Copy_Compare);
Consistent_Time = Commands_Acknowledged > 150;
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);
Transfer_Data_Type((unsigned __int32)Client_Module + 1573744)(&Predicton_Copy, nullptr, -1, (Prediction_Descriptor_Structure*)((unsigned __int32)Client_Module + 7236480)); 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); (decltype(&Redirected_Post_Network_Data_Received)(Original_Post_Network_Data_Received_Caller))(Unknown_Parameter, Commands_Acknowledged);

View File

@ -7,14 +7,14 @@ void __thiscall Redirected_Spawn_Grenade(void* Entity)
float Minimum[3] = float Minimum[3] =
{ {
-16.f, -16.f,
-16.f, -16.f,
-16.f -16.f
}; };
float Maximum[3] = float Maximum[3] =
{ {
16.f, 16.f,
16.f, 16.f,