Storm/Post_Network_Data_Received.hpp

88 lines
2.9 KiB
C++
Raw Normal View History

2024-04-04 03:17:09 +08:00
struct Prediction_Field_Structure
{
__int32 Type;
char* Name;
__int32 Offset;
unsigned __int16 Size;
__int8 Additionals_Bytes_1[18];
__int32 Bytes;
__int8 Additionals_Bytes_2[12];
__int32 Flat_Offset[2];
__int8 Additionals_Bytes_3[2];
2024-04-04 03:17:09 +08:00
};
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);
2024-10-07 03:45:39 +08:00
Construct_Type((unsigned __int32)Client_Module + 1564512)(this, nullptr, 2, Destination, 1, Source, 0, 3, Handler);
2024-04-04 03:17:09 +08:00
}
};
Prediction_Copy_Structure Predicton_Copy;
2024-10-07 03:45:39 +08:00
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)
2024-04-04 03:17:09 +08:00
{
2024-10-07 03:45:39 +08:00
if (Within_Tolerance == 1)
{
Prediction_Field_Structure* Field = *(Prediction_Field_Structure**)((unsigned __int32)__builtin_frame_address(0) + 60);
2024-10-14 09:52:51 +08:00
if ((256 - Field->Flat_Offset[0] ^ Field->Flat_Offset[0] - 244) != 12)
2024-10-07 03:45:39 +08:00
{
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]));
2024-10-07 03:45:39 +08:00
}
2024-04-04 03:17:09 +08:00
}
}
struct Prediction_Descriptor_Structure
{
Prediction_Field_Structure* Fields;
__int32 Size;
__int8 Additional_Bytes_1[4];
Prediction_Descriptor_Structure* Parent;
__int8 Additional_Bytes_2[8];
2024-04-04 03:17:09 +08:00
};
void* Original_Post_Network_Data_Received_Caller;
void __thiscall Redirected_Post_Network_Data_Received(void* Unknown_Parameter, __int32 Commands_Acknowledged)
{
void* Local_Player = *(void**)((unsigned __int32)Client_Module + 7498712);
2024-04-04 03:17:09 +08:00
void* Prediction_Frame = *(void**)((unsigned __int32)Local_Player + 900 + (150 - ((Commands_Acknowledged - 1) % 150 + 1) * 150 % -~150) * 4);
2024-04-04 03:17:09 +08:00
if (Prediction_Frame != nullptr)
{
Predicton_Copy.Construct(Local_Player, Prediction_Frame, (void*)Predicton_Copy_Compare);
2024-04-04 03:17:09 +08:00
using Transfer_Data_Type = __int32(__thiscall*)(Prediction_Copy_Structure* Prediction_Copy, void* Unknown_Parameter, __int32 Entity_Number, Prediction_Descriptor_Structure* Descriptor);
2024-04-04 03:17:09 +08:00
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;
2024-04-04 03:17:09 +08:00
}
(decltype(&Redirected_Post_Network_Data_Received)(Original_Post_Network_Data_Received_Caller))(Unknown_Parameter, Commands_Acknowledged);
}