diff --git a/Calculate_View.hpp b/Calculate_View.hpp new file mode 100755 index 0000000..c8b2e5f --- /dev/null +++ b/Calculate_View.hpp @@ -0,0 +1,10 @@ +void* Original_Calculate_View_Caller; + +void __thiscall Redirected_Calculate_View(void* Player, void* Unknown_Parameter_1, float* Angles, void* Unknown_Parameter_2) +{ + (decltype(&Redirected_Calculate_View)(Original_Calculate_View_Caller))(Player, Unknown_Parameter_1, Angles, Unknown_Parameter_2); + + using Get_Eye_Angles_Type = float*(__thiscall*)(void* Entity); + + Byte_Manager::Copy_Bytes(0, Angles, sizeof(float[3]), Get_Eye_Angles_Type((unsigned __int32)Client_Module + 2236960)(Player)); +} \ No newline at end of file diff --git a/Draw_Crosshair.hpp b/Draw_Crosshair.hpp new file mode 100755 index 0000000..f4e7a50 --- /dev/null +++ b/Draw_Crosshair.hpp @@ -0,0 +1,64 @@ +void Redirected_Draw_Crosshair() +{ + if ((*(__int32*)(*(unsigned __int32*)((unsigned __int32)Client_Module + 7490392) + 5008) | 55) == 55) + { + static float Rotation_Angle; + + auto Draw_Storm = [&](__int32 X, __int32 Y, __int32 Additional_Rotation_Angle) + { + using Set_Color_Type = void(__thiscall**)(void* Surface, unsigned __int8 Red, unsigned __int8 Green, unsigned __int8 Blue, unsigned __int8 Alpha); + + void* Surface = *(void**)((unsigned __int32)Client_Module + 8951284); + + (*Set_Color_Type(*(unsigned __int32*)Surface + 44))(Surface, 0, 0, 0, 255); + + using Draw_Circle_Type = void(__thiscall**)(void* Surface, __int32 X, __int32 Y, __int32 Radius, __int32 Segments); + + X += Interface_Storm_Rotation_Radius.Integer * __builtin_cosf(__builtin_remainderf(Rotation_Angle + Additional_Rotation_Angle, 360) * 3.1415927f / 180); + + Y += Interface_Storm_Rotation_Radius.Integer * __builtin_sinf(__builtin_remainderf(Rotation_Angle + Additional_Rotation_Angle, 360) * 3.1415927f / 180); + + (*Draw_Circle_Type(*(unsigned __int32*)Surface + 384))(Surface, X - 1, Y, Interface_Storm_Radius.Integer, Interface_Storm_Segments.Integer); + + (*Draw_Circle_Type(*(unsigned __int32*)Surface + 384))(Surface, X, Y - 1, Interface_Storm_Radius.Integer, Interface_Storm_Segments.Integer); + + (*Draw_Circle_Type(*(unsigned __int32*)Surface + 384))(Surface, X + 1, Y, Interface_Storm_Radius.Integer, Interface_Storm_Segments.Integer); + + (*Draw_Circle_Type(*(unsigned __int32*)Surface + 384))(Surface, X, Y + 1, Interface_Storm_Radius.Integer, Interface_Storm_Segments.Integer); + + (*Draw_Circle_Type(*(unsigned __int32*)Surface + 384))(Surface, X - 1, Y - 1, Interface_Storm_Radius.Integer, Interface_Storm_Segments.Integer); + + (*Draw_Circle_Type(*(unsigned __int32*)Surface + 384))(Surface, X + 1, Y - 1, Interface_Storm_Radius.Integer, Interface_Storm_Segments.Integer); + + (*Draw_Circle_Type(*(unsigned __int32*)Surface + 384))(Surface, X - 1, Y + 1, Interface_Storm_Radius.Integer, Interface_Storm_Segments.Integer); + + (*Draw_Circle_Type(*(unsigned __int32*)Surface + 384))(Surface, X + 1, Y + 1, Interface_Storm_Radius.Integer, Interface_Storm_Segments.Integer); + + (*Set_Color_Type(*(unsigned __int32*)Surface + 44))(Surface, 0, 128, 255, 255); + + (*Draw_Circle_Type(*(unsigned __int32*)Surface + 384))(Surface, X, Y, Interface_Storm_Radius.Integer, Interface_Storm_Segments.Integer); + }; + + __int32 Storm_Number = 0; + + using Get_Screen_Size_Type = __int32(__cdecl*)(); + + __int32 Screen_Width = Get_Screen_Size_Type((unsigned __int32)Client_Module + 738528)() / 2; + + __int32 Screen_Height = Get_Screen_Size_Type((unsigned __int32)Client_Module + 738496)() / 2; + + Draw_Storm_Label: + { + if (Storm_Number < Interface_Storm_Iterations.Integer) + { + Draw_Storm(Screen_Width, Screen_Height, Storm_Number * 360 / Interface_Storm_Iterations.Integer); + + Storm_Number += 1; + + goto Draw_Storm_Label; + } + } + + Rotation_Angle = __builtin_remainderf(Rotation_Angle + (*(Global_Variables_Structure**)((unsigned __int32)Client_Module + 7088552))->Frame_Time * Interface_Storm_Speed.Integer, 360); + } +} \ No newline at end of file diff --git a/Draw_Effect.hpp b/Draw_Effect.hpp new file mode 100755 index 0000000..1cd0f35 --- /dev/null +++ b/Draw_Effect.hpp @@ -0,0 +1,15 @@ +void* Original_Draw_Effect_Caller; + +__int8 __thiscall Redirected_Draw_Effect(void* Effect, void* Unknown_Parameter_1, void* Unknown_Parameter_2) +{ + using Get_Effect_Name_Type = char*(__thiscall*)(void* a1); + + char* Effect_Name = Get_Effect_Name_Type((unsigned __int32)Client_Module + 1423008)((void*)((unsigned __int32)Effect - 8)); + + if (__builtin_strstr(Effect_Name, "ecloud_") == nullptr) + { + return (decltype(&Redirected_Draw_Effect)(Original_Draw_Effect_Caller))(Effect, Unknown_Parameter_1, Unknown_Parameter_2); + } + + return 0; +} \ No newline at end of file diff --git a/Entry_Point.cpp b/Entry_Point.cpp new file mode 100755 index 0000000..88ca15d --- /dev/null +++ b/Entry_Point.cpp @@ -0,0 +1,307 @@ +#include + +#include + +#include + +#define Bits_32 + +#include "Byte_Manager/Byte_Manager.hpp" + +#include "Redirection_Manager/Redirection_Manager.hpp" + +void* Engine_Module; + +#include "Extended_Interface.hpp" + +void* Client_Module; + +#include "Post_Network_Data_Received.hpp" + +#include "Interpolate.hpp" + +#include + +#include "Estimate_Velocity.hpp" + +#include "Spawn_Grenade.hpp" + +#include "Run_Prediction.hpp" + +#include "Run_Command.hpp" + +#include "Play_Footstep_Sound.hpp" + +#include + +#include "Finish_Move.hpp" + +#include "Item_Post_Frame.hpp" + +#include "Perform_Trace.hpp" + +#include "Perform_Shove_Trace.hpp" + +#include "Read_Packets.hpp" + +#include "Move.hpp" + +#include + +#include + +#include "Copy_Command.hpp" + +#include "Calculate_View.hpp" + +#include "Draw_Effect.hpp" + +#include "Write_Texture.hpp" + +#include "Paint.hpp" + +#include "Get_Glow_Color.hpp" + +#include "Draw_Crosshair.hpp" + +__int32 __stdcall DllMain(HMODULE This_Module, unsigned __int32 Call_Reason, void* Reserved) +{ + if (Call_Reason == DLL_PROCESS_DETACH) + { + __fastfail(EXIT_SUCCESS); + } + else + { + if (Call_Reason == DLL_PROCESS_ATTACH) + { + if (GetModuleHandleW(L"left4dead2.exe") == nullptr) + { + void* Snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + + PROCESSENTRY32W Snapshot_Entry; + + Snapshot_Entry.dwSize = sizeof(Snapshot_Entry); + + Traverse_Snapshot_Label: + { + if (Process32NextW(Snapshot, &Snapshot_Entry) == 0) + { + return 1; + } + + if (wcscmp(Snapshot_Entry.szExeFile, L"left4dead2.exe") != 0) + { + goto Traverse_Snapshot_Label; + } + } + + void* Process = OpenProcess(PROCESS_ALL_ACCESS, 0, Snapshot_Entry.th32ProcessID); + + void* Remote_Path = VirtualAllocEx(Process, nullptr, 1, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + + wchar_t Local_Path[MAX_PATH]; + + GetModuleFileNameW(This_Module, Local_Path, sizeof(Local_Path)); + + WriteProcessMemory(Process, Remote_Path, Local_Path, sizeof(Local_Path), nullptr); + + WaitForSingleObject(CreateRemoteThread(Process, nullptr, 0, (LPTHREAD_START_ROUTINE)LoadLibraryW, Remote_Path, 0, nullptr), INFINITE); + + VirtualFreeEx(Process, Remote_Path, 0, MEM_RELEASE); + } + else + { + Byte_Manager::Set_Bytes(1, (void*)((unsigned __int32)LoadLibraryW(L"vaudio_speex.dll") + 9440), 1, 195); + + AllocConsole(); + + SetConsoleTitleW(L"Storm"); + + _wfreopen(L"CONOUT$", L"w", stdout); + + SetConsoleOutputCP(65001); + + HANDLE Standard_Output_Handle = GetStdHandle(STD_OUTPUT_HANDLE); + + CONSOLE_FONT_INFOEX Console_Font_Information; + + Console_Font_Information.cbSize = sizeof(CONSOLE_FONT_INFOEX); + + Console_Font_Information.nFont = 0; + + Console_Font_Information.dwFontSize.X = 0; + + Console_Font_Information.dwFontSize.Y = 12; + + Console_Font_Information.FontFamily = FF_DONTCARE; + + Console_Font_Information.FontWeight = FW_NORMAL; + + wcscpy(Console_Font_Information.FaceName, L"Terminal"); + + SetCurrentConsoleFontEx(Standard_Output_Handle, 0, &Console_Font_Information); + + CONSOLE_CURSOR_INFO Console_Cursor_Information; + + Console_Cursor_Information.bVisible = 0; + + Console_Cursor_Information.dwSize = sizeof(Console_Cursor_Information); + + SetConsoleTextAttribute(Standard_Output_Handle, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY | BACKGROUND_BLUE); + + SetConsoleCursorInfo(Standard_Output_Handle, &Console_Cursor_Information); + + CONSOLE_SCREEN_BUFFER_INFO Console_Screen_Buffer_Information; + + GetConsoleScreenBufferInfo(Standard_Output_Handle, &Console_Screen_Buffer_Information); + + COORD Top_Left = + { + 0, + + 0 + }; + + DWORD Characters_Written_Count; + + FillConsoleOutputAttribute(Standard_Output_Handle, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY | BACKGROUND_BLUE, Console_Screen_Buffer_Information.dwSize.X * Console_Screen_Buffer_Information.dwSize.Y, Top_Left, &Characters_Written_Count); + + Engine_Module = GetModuleHandleW(L"engine.dll"); + + _putws(L"[ + ] Extend Interface"); + { + Implement_Extended_Interface(); + } + + Client_Module = GetModuleHandleW(L"client.dll"); + + //DEBUG + { + *(__int32*)((unsigned __int32)Client_Module + 0x7B0528 + 0x14) &= ~0xA; + *(__int32*)((unsigned __int32)Client_Module + 0x7807B8 + 0x14) &= ~0xA; + *(__int32*)((unsigned __int32)Client_Module + 0x77E358 + 0x14) &= ~0xA; + } + + _putws(L"[ + ] Events"); + { + Redirection_Manager::Redirect_Function(Original_Post_Network_Data_Received_Caller, 0, (void*)((unsigned __int32)Client_Module + 1555088), 1, (void*)Redirected_Post_Network_Data_Received); + + Byte_Manager::Set_Bytes(1, (void*)((unsigned __int32)Client_Module + 316816), 1, 195); + + Byte_Manager::Set_Bytes(1, (void*)((unsigned __int32)Engine_Module + 521549), 1, 235); + } + + _putws(L"[ + ] Interpolation"); + { + Redirection_Manager::Redirect_Function(Original_Interpolate_Caller, 0, (void*)((unsigned __int32)Client_Module + 214256), 1, (void*)Redirected_Interpolate); + } + + _putws(L"[ + ] Animations"); + { + Redirection_Manager::Redirect_Function(Original_Estimate_Velocity_Caller, 0, (void*)((unsigned __int32)Client_Module + 311856), 1, (void*)Redirected_Estimate_Velocity); + + unsigned __int8 Maintain_Sequence_Transitions_Bytes[3] = { 194, 24, 0 }; + + Byte_Manager::Copy_Bytes(1, (void*)((unsigned __int32)Client_Module + 245232), sizeof(Maintain_Sequence_Transitions_Bytes), Maintain_Sequence_Transitions_Bytes); + + Byte_Manager::Set_Bytes(1, (void*)((unsigned __int32)Client_Module + 3236851), 1, 15); + + Byte_Manager::Set_Bytes(1, (void*)((unsigned __int32)Client_Module + 3237030), 1, 15); + } + + _putws(L"[ + ] Prediction"); + { + static Prediction_Descriptor_Structure Original_Prediction_Descriptor; + + Prediction_Descriptor_Structure* Prediction_Descriptor = (Prediction_Descriptor_Structure*)((unsigned __int32)Client_Module + 7282444); + + Byte_Manager::Copy_Bytes(0, &Original_Prediction_Descriptor, sizeof(Prediction_Descriptor_Structure), Prediction_Descriptor); + + static Prediction_Field_Structure Prediction_Fields = { 1, (char*)"m_fMaxSpread", 3340, 1, { }, sizeof(float) }; + + Prediction_Descriptor->Fields = &Prediction_Fields; + + Prediction_Descriptor->Size = sizeof(Prediction_Fields) / sizeof(Prediction_Field_Structure); + + Prediction_Descriptor->Parent = &Original_Prediction_Descriptor; + + Redirection_Manager::Redirect_Function(Original_Spawn_Grenade_Caller, 2, (void*)((unsigned __int32)Client_Module + 2227120), 1, (void*)Redirected_Spawn_Grenade); + + Redirection_Manager::Redirect_Function(Original_Run_Prediction_Caller, 0, (void*)((unsigned __int32)Engine_Module + 527584), 1, (void*)Redirected_Run_Prediction); + + Byte_Manager::Set_Bytes(1, (void*)((unsigned __int32)Client_Module + 1557600), 1, 235); + + Byte_Manager::Set_Bytes(1, (void*)((unsigned __int32)Client_Module + 1557511), 8, 144); + + Byte_Manager::Set_Bytes(1, (void*)((unsigned __int32)Client_Module + 2465971), 5, 144); + + Redirection_Manager::Redirect_Function(Original_Run_Command_Caller, 0, (void*)((unsigned __int32)Client_Module + 1553328), 1, (void*)Redirected_Run_Command); + + Redirection_Manager::Redirect_Function(Original_Play_Footstep_Sound_Caller, 0, (void*)((unsigned __int32)Client_Module + 978336), 1, (void*)Redirected_Play_Footstep_Sound); + + Redirection_Manager::Redirect_Function(Original_Finish_Move_Caller, 2, (void*)((unsigned __int32)Client_Module + 1553088), 1, (void*)Redirected_Finish_Move); + + Redirection_Manager::Redirect_Function(Original_Item_Post_Frame_Caller, 3, (void*)((unsigned __int32)Client_Module + 2535760), 1, (void*)Redirected_Item_Post_Frame); + + *(__int32*)((unsigned __int32)Original_Item_Post_Frame_Caller + 5) = (__int32)((unsigned __int32)Client_Module + 2438103) - (__int32)Original_Item_Post_Frame_Caller; + + Redirection_Manager::Redirect_Function(Original_Perform_Trace_Caller, 0, (void*)((unsigned __int32)Client_Module + 3086496), 1, (void*)Redirected_Perform_Trace); + + Original_Perform_Shove_Trace_Caller = (void*)((unsigned __int32)Client_Module + 3213879); + + Redirection_Manager::Redirect_Function(1, (void*)((unsigned __int32)Client_Module + 3213870), (void*)Redirected_Perform_Shove_Trace); + } + + _putws(L"[ + ] Network"); + { + Redirection_Manager::Redirect_Function(Original_Read_Packets_Caller, 0, (void*)((unsigned __int32)Engine_Module + 499120), 1, (void*)Redirected_Read_Packets); + + Redirection_Manager::Redirect_Function(Original_Move_Caller, 3, (void*)((unsigned __int32)Engine_Module + 512096), 1, (void*)Redirected_Move); + } + + _putws(L"[ + ] Input"); + { + Byte_Manager::Set_Bytes(1, (void*)((unsigned __int32)Client_Module + 1250469), 3, 144); + + Byte_Manager::Set_Bytes(1, (void*)((unsigned __int32)Client_Module + 417204), 1, 235); + + Redirection_Manager::Redirect_Function(Original_Copy_Command_Caller, 0, (void*)((unsigned __int32)Client_Module + 1094448), 1, (void*)Redirected_Copy_Command); + } + + _putws(L"[ + ] Effects"); + { + Redirection_Manager::Redirect_Function(Original_Calculate_View_Caller, 0, (void*)((unsigned __int32)Client_Module + 132944), 1, (void*)Redirected_Calculate_View); + + Byte_Manager::Set_Bytes(1, (void*)((unsigned __int32)Client_Module + 133424), 1, 235); + + Byte_Manager::Set_Bytes(1, (void*)((unsigned __int32)Client_Module + 2874334), 1, 246); + + Redirection_Manager::Redirect_Function(Original_Draw_Effect_Caller, 0, (void*)((unsigned __int32)Client_Module + 1425744), 1, (void*)Redirected_Draw_Effect); + + Byte_Manager::Set_Bytes(1, (void*)((unsigned __int32)Client_Module + 1868093), 1, 52); + + Byte_Manager::Set_Bytes(1, (void*)((unsigned __int32)Client_Module + 2648346), 1, 216); + + *(void**)((unsigned __int32)Client_Module + 8106800) = (void*)((unsigned __int32)Client_Module + 955612); + } + + _putws(L"[ + ] Paint"); + { + Redirection_Manager::Redirect_Function(Original_Write_Texture_Caller, 0, (void*)((unsigned __int32)GetModuleHandleW(L"vguimatsurface.dll") + 100560), 1, (void*)Redirected_Write_Texture); + + Redirection_Manager::Redirect_Function(1, (void*)((unsigned __int32)Client_Module + 2906288), (void*)Redirected_Paint); + + Redirection_Manager::Redirect_Function(1, (void*)((unsigned __int32)Client_Module + 2455120), (void*)Redirected_Get_Glow_Color); + + Redirection_Manager::Redirect_Function(1, (void*)((unsigned __int32)Client_Module + 2300832), (void*)Redirected_Draw_Crosshair); + + Byte_Manager::Set_Bytes(1, (void*)((unsigned __int32)Client_Module + 2923737), 1, 235); + + Redirection_Manager::Redirect_Function(1, (void*)((unsigned __int32)Client_Module + 3111488), (void*)Redirected_Draw_Crosshair); + } + } + } + } + + return 1; +} \ No newline at end of file diff --git a/Estimate_Velocity.hpp b/Estimate_Velocity.hpp new file mode 100755 index 0000000..da32945 --- /dev/null +++ b/Estimate_Velocity.hpp @@ -0,0 +1,28 @@ +void* Original_Estimate_Velocity_Caller; + +void __thiscall Redirected_Estimate_Velocity(void* Entity, float* Velocity) +{ + static std::unordered_set Invalids = + { + (void*)((unsigned __int32)Client_Module + 6329708), + + (void*)((unsigned __int32)Client_Module + 6332260) + }; + + if (Invalids.contains(*(void**)Entity) == 1) + { + (decltype(&Redirected_Estimate_Velocity)(Original_Estimate_Velocity_Caller))(Entity, Velocity); + } + else + { + using Calculate_Velocity_Type = void(__thiscall*)(void* Entity); + + Calculate_Velocity_Type((unsigned __int32)Client_Module + 290704)(Entity); + + Velocity[0] = *(float*)((unsigned __int32)Entity + 136); + + Velocity[1] = *(float*)((unsigned __int32)Entity + 140); + + Velocity[2] = *(float*)((unsigned __int32)Entity + 144); + } +} \ No newline at end of file diff --git a/Extended_Interface.hpp b/Extended_Interface.hpp new file mode 100755 index 0000000..ea0ad9b --- /dev/null +++ b/Extended_Interface.hpp @@ -0,0 +1,62 @@ +struct Interface_Structure +{ + __int8 Additional_Bytes_1[36]; + + char* String; + + __int8 Additional_Bytes_2[4]; + + float Floating_Point; + + __int32 Integer; + + __int8 Additional_Bytes_3[20]; +}; + +Interface_Structure Interface_Extra_Commands; + +Interface_Structure Interface_Storm_Rotation_Radius; + +Interface_Structure Interface_Storm_Radius; + +Interface_Structure Interface_Storm_Segments; + +Interface_Structure Interface_Storm_Iterations; + +Interface_Structure Interface_Storm_Speed; + +Interface_Structure Interface_Test; +Interface_Structure Interface_Test2; +Interface_Structure Interface_Test3; + +void Implement_Extended_Interface() +{ + auto Create_Console_Interface = [](Interface_Structure* Interface, char* Name, char* Value, void* Handler) + { + using Create_Console_Variable_Type = void(__thiscall*)(Interface_Structure* Interface, char* Name, char* Value, void* Unknown_Parameter_1, void* Unknown_Parameter_2, void* Handler); + + Create_Console_Variable_Type((unsigned __int32)Engine_Module + 2635296)(Interface, Name, Value, nullptr, nullptr, Handler); + + *(__int32*)((unsigned __int32)Interface + 20) &= ~10; + + wprintf(L"[ + ] %hs -> %p\n", Name, Interface); + }; + + #define Pointer_Name(Interface) &Interface, (char*)#Interface + 10 + + Create_Console_Interface(Pointer_Name(Interface_Extra_Commands), (char*)"4", nullptr); + + Create_Console_Interface(Pointer_Name(Interface_Storm_Rotation_Radius), (char*)"24", nullptr); + + Create_Console_Interface(Pointer_Name(Interface_Storm_Radius), (char*)"8", nullptr); + + Create_Console_Interface(Pointer_Name(Interface_Storm_Segments), (char*)"12", nullptr); + + Create_Console_Interface(Pointer_Name(Interface_Storm_Iterations), (char*)"16", nullptr); + + Create_Console_Interface(Pointer_Name(Interface_Storm_Speed), (char*)"512", nullptr); + + Create_Console_Interface(Pointer_Name(Interface_Test), (char*)"0", nullptr); + Create_Console_Interface(Pointer_Name(Interface_Test2), (char*)"0", nullptr); + Create_Console_Interface(Pointer_Name(Interface_Test3), (char*)"0", nullptr); +} \ No newline at end of file diff --git a/Finish_Move.hpp b/Finish_Move.hpp new file mode 100755 index 0000000..1d832a1 --- /dev/null +++ b/Finish_Move.hpp @@ -0,0 +1,15 @@ +void* Original_Finish_Move_Caller; + +void __thiscall Redirected_Finish_Move(void* Unknown_Parameter_1, void* Player, void* Unknown_Parameter_2, void* Move_Data) +{ + float X = *(float*)((unsigned __int32)Move_Data + 76); + + if (X > 180) + { + X -= 360; + } + + *(float*)((unsigned __int32)Move_Data + 76) = std::clamp(X, -90.f, 90.f); + + (decltype(&Redirected_Finish_Move)(Original_Finish_Move_Caller))(Unknown_Parameter_1, Player, Unknown_Parameter_2, Move_Data); +} \ No newline at end of file diff --git a/Get_Glow_Color.hpp b/Get_Glow_Color.hpp new file mode 100755 index 0000000..22d8a4a --- /dev/null +++ b/Get_Glow_Color.hpp @@ -0,0 +1,4 @@ +void __thiscall Redirected_Get_Glow_Color(void* Entity, float* Red, float* Green, float* Blue, float* Alpha) +{ + *Alpha = 0; +} \ No newline at end of file diff --git a/Interpolate.hpp b/Interpolate.hpp new file mode 100755 index 0000000..8c212b9 --- /dev/null +++ b/Interpolate.hpp @@ -0,0 +1,11 @@ +void* Original_Interpolate_Caller; + +__int8 __thiscall Redirected_Interpolate(void* Entity, void* Unknown_Parameter) +{ + if (Entity == *(void**)((unsigned __int32)Client_Module + 7490392)) + { + return (decltype(&Redirected_Interpolate)(Original_Interpolate_Caller))(Entity, Unknown_Parameter); + } + + return 1; +} \ No newline at end of file diff --git a/Item_Post_Frame.hpp b/Item_Post_Frame.hpp new file mode 100755 index 0000000..61e2922 --- /dev/null +++ b/Item_Post_Frame.hpp @@ -0,0 +1,9 @@ +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)) + { + (decltype(&Redirected_Item_Post_Frame)(Original_Item_Post_Frame_Caller))(Player); + } +} \ No newline at end of file diff --git a/Paint.hpp b/Paint.hpp new file mode 100755 index 0000000..7a24c5d --- /dev/null +++ b/Paint.hpp @@ -0,0 +1,373 @@ +void __thiscall Redirected_Paint(void* Panel) +{ + using Set_Order_Type = void(__thiscall*)(void* Panel, __int32 Order); + + Set_Order_Type((unsigned __int32)Client_Module + 4074160)(Panel, -1); + + void* Local_Player = *(void**)((unsigned __int32)Client_Module + 7490392); + + __int32 Entity_Number = 1; + + Sorted_Target_List.clear(); + + Traverse_Entity_List_Label: + { + void* Entity = *(void**)((unsigned __int32)Client_Module + 7636212 + ((Entity_Number - 4097) << 4)); + + if (Entity != nullptr) + { + if (Entity != Local_Player) + { + __int32 Identifier = Get_Identifier(Entity); + + if (Identifier != -1) + { + float* Local_Player_Origin = (float*)((unsigned __int32)Local_Player + 292); + + float* Entity_Origin = (float*)((unsigned __int32)Entity + 292); + + Target_Structure Target = + { + Identifier, + + Entity, + + 0, + + __builtin_powf(Local_Player_Origin[0] - Entity_Origin[0], 2) + __builtin_powf(Local_Player_Origin[1] - Entity_Origin[1], 2) + __builtin_powf(Local_Player_Origin[2] - Entity_Origin[2], 2) + }; + + Sorted_Target_List.push_back(Target); + } + } + } + + if (Entity_Number != *(__int32*)((unsigned __int32)Client_Module + 7636248)) + { + Entity_Number += 1; + + goto Traverse_Entity_List_Label; + } + } + + auto Target_List_Sort = [](Target_Structure& X, Target_Structure& Y) -> __int8 + { + return X.Distance < Y.Distance; + }; + + std::sort(Sorted_Target_List.begin(), Sorted_Target_List.end(), Target_List_Sort); + + size_t Target_Number = Sorted_Target_List.size() - 1; + + Traverse_Sorted_Target_List_Label: + { + if (Target_Number != -1) + { + Target_Structure* Target = &Sorted_Target_List.at(Target_Number); + + float Bounds[4] = { FLT_MAX, FLT_MIN, FLT_MAX, FLT_MIN }; + + auto Get_Bounds = [&]() -> __int8 + { + float Bones[128][3][4]; + + void* Hitbox_Set = Get_Hitbox_Set(Target, Bones, (*(Global_Variables_Structure**)((unsigned __int32)Client_Module + 7088552))->Current_Time); + + if (Hitbox_Set != nullptr) + { + __int32 Hitbox_Number = 0; + + Get_Bounds_Label: + { + if (Hitbox_Number != *(__int32*)((unsigned __int32)Hitbox_Set + 4)) + { + void* Hitbox = (void*)((unsigned __int32)Hitbox_Set + 12 + Hitbox_Number * 68); + + float* Hitbox_Minimum = (float*)((unsigned __int32)Hitbox + 8); + + float* Hitbox_Maximum = (float*)((unsigned __int32)Hitbox + 20); + + float Hitbox_Vertices[8][3]; + + __int32 Axis_Number = 0; + + 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[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[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[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[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) + { + Axis_Number += 1; + + goto Initialize_Vertices_Label; + } + } + + __int32 Vertex_Number = 0; + + Transform_Vertices_Label: + { + using Screen_Transform_Type = __int8(__cdecl*)(float* World, float* Screen); + + float Screen[3]; + + if (Screen_Transform_Type((unsigned __int32)Client_Module + 1841488)(Hitbox_Vertices[Vertex_Number], Screen) == 0) + { + using Get_Screen_Size_Type = __int32(__cdecl*)(); + + __int32 Screen_Width = Get_Screen_Size_Type((unsigned __int32)Client_Module + 738528)(); + + __int32 Screen_Height = Get_Screen_Size_Type((unsigned __int32)Client_Module + 738496)(); + + Screen[0] = Screen[0] / 2 * Screen_Width + Screen_Width / 2; + + Screen[1] = -Screen[1] / 2 * Screen_Height + Screen_Height / 2; + + Bounds[0] = min(Bounds[0], Screen[0]); + + Bounds[1] = max(Bounds[1], Screen[0]); + + Bounds[2] = min(Bounds[2], Screen[1]); + + Bounds[3] = max(Bounds[3], Screen[1]); + } + else + { + return 0; + } + + if (Vertex_Number != 7) + { + Vertex_Number += 1; + + goto Transform_Vertices_Label; + } + } + + Hitbox_Number += 1; + + goto Get_Bounds_Label; + } + } + + Bounds[0] -= 2; + + Bounds[1] += 2; + + Bounds[2] -= 2; + + Bounds[3] += 2; + + return (Bounds[1] != 2) * (Bounds[3] != 2); + } + + return 0; + }; + + if (Get_Bounds() == 1) + { + void* Surface = *(void**)((unsigned __int32)Client_Module + 8951284); + + struct Paint_Data_Structure + { + unsigned __int8 Color[3]; + + unsigned __int8 Fill_Color[3]; + + wchar_t* Name; + }; + + static std::unordered_map<__int32, Paint_Data_Structure> Paint_Data_List = + { + { 0, { { 255, 128, 0 }, { 128, 64, 0 }, (wchar_t*)L"Boomer" } }, + + { 13, { { 0, 128, 255 }, { 0, 64, 128 }, (wchar_t*)L"Rock" } }, + + { 99, { { 255, 128, 0 }, { 128, 64, 0 }, (wchar_t*)L"Charger" } }, + + { 232, { { 0, 255, 0 }, { 0, 128, 0 }, (wchar_t*)L"Survivor" } }, + + { 263, { { 255, 128, 0 }, { 128, 64, 0 }, (wchar_t*)L"Hunter" } }, + + { 264, { { 255, 0, 0 }, { 128, 0, 0 }, (wchar_t*)L"Infected" } }, + + { 265, { { 255, 128, 0 }, { 128, 64, 0 }, (wchar_t*)L"Jockey" } }, + + { 270, { { 255, 128, 0 }, { 128, 64, 0 }, (wchar_t*)L"Smoker" } }, + + { 272, { { 255, 128, 0 }, { 128, 64, 0 }, (wchar_t*)L"Spitter" } }, + + { 275, { { 0, 255, 0 }, { 0, 128, 0 }, (wchar_t*)L"Survivor" } }, + + { 276, { { 0, 128, 255 }, { 0, 64, 128 }, (wchar_t*)L"Tank" } }, + + { 277, { { 0, 128, 255 }, { 0, 64, 128 }, (wchar_t*)L"Witch" } } + }; + + Paint_Data_Structure* Paint_Data = &Paint_Data_List[Target->Identifier]; + + __int8 Ghost = 0; + + if (*(__int32*)((unsigned __int32)Target->Self + 236) != 0) + { + Ghost = *(__int8*)((unsigned __int32)Target->Self + 7322); + } + + auto Draw_Box = [&](__int32 From_X, __int32 From_Y, __int32 To_X, __int32 To_Y) + { + using Set_Color_Type = void(__thiscall**)(void* Surface, unsigned __int8 Red, unsigned __int8 Green, unsigned __int8 Blue, unsigned __int8 Alpha); + + (*Set_Color_Type(*(unsigned __int32*)Surface + 44))(Surface, 0, 0, 0, 255); + + using Draw_Rect_Type = void(__thiscall**)(void* Surface, __int32 From_X, __int32 From_Y, __int32 To_X, __int32 To_Y); + + (*Draw_Rect_Type(*(unsigned __int32*)Surface + 56))(Surface, From_X - 1, From_Y - 1, To_X + 1, To_Y + 1); + + (*Draw_Rect_Type(*(unsigned __int32*)Surface + 56))(Surface, From_X + 1, From_Y + 1, To_X - 1, To_Y - 1); + + if (Ghost == 0) + { + (*Set_Color_Type(*(unsigned __int32*)Surface + 44))(Surface, Paint_Data->Color[0], Paint_Data->Color[1], Paint_Data->Color[2], 255); + } + else + { + (*Set_Color_Type(*(unsigned __int32*)Surface + 44))(Surface, 255, 255, 255, 255); + } + + (*Draw_Rect_Type(*(unsigned __int32*)Surface + 56))(Surface, From_X, From_Y, To_X, To_Y); + + if (Ghost == 0) + { + (*Set_Color_Type(*(unsigned __int32*)Surface + 44))(Surface, Paint_Data->Fill_Color[0], Paint_Data->Fill_Color[1], Paint_Data->Fill_Color[2], 128); + } + else + { + (*Set_Color_Type(*(unsigned __int32*)Surface + 44))(Surface, 128, 128, 128, 128); + } + + using Draw_Filled_Rect_Type = void(__thiscall**)(void* Surface, __int32 From_X, __int32 From_Y, __int32 To_X, __int32 To_Y); + + (*Draw_Filled_Rect_Type(*(unsigned __int32*)Surface + 48))(Surface, From_X + 2, From_Y + 2, To_X - 2, To_Y - 2); + }; + + Draw_Box(Bounds[0], Bounds[2], Bounds[1], Bounds[3]); + + using Draw_Text_Type = void(__cdecl*)(void* Font, __int32 X, __int32 Y, __int32 R, __int32 G, __int32 B, __int32 A, wchar_t* Text); + + auto Create_Font = [&]() -> void* + { + using Create_Font_Type = void*(__thiscall**)(void* Surface); + + void* Font = (*Create_Font_Type(*(unsigned __int32*)Surface + 252))(Surface); + + using Setup_Font_Type = __int8(__thiscall**)(void* Surface, void* Font, char* Name, void* Unknown_Parameter_1, void* Unknown_Parameter_2, void* Unknown_Parameter_3, void* Unknown_Parameter_4, __int32 Flags, void* Unknown_Parameter_5, void* Unknown_Parameter_6); + + (*Setup_Font_Type(*(unsigned __int32*)Surface + 256))(Surface, Font, (char*)"Fixedsys", nullptr, nullptr, nullptr, nullptr, 512, nullptr, nullptr); + + wchar_t Character = L' '; + + Calculate_Character_Bounds_Label: + { + wchar_t Text[2] = { Character }; + + Write_Character = Text[0]; + + Draw_Text_Type((unsigned __int32)Engine_Module + 2217776)(Font, 0, 0, 0, 0, 0, 0, Text); + + if (Character != L'~') + { + Character += L'\1'; + + goto Calculate_Character_Bounds_Label; + } + } + + return Font; + }; + + static void* Font = Create_Font(); + + size_t Character_Number = 0; + + unsigned __int32 Width = 0; + + unsigned __int32 Height = 0; + + __int32 Offset_Y = 0; + + size_t Characters_Count = wcslen(Paint_Data->Name); + + Calculate_Text_Bounds_Label: + { + unsigned __int32* Character_Bounds = Characters_Bounds[Paint_Data->Name[Character_Number]]; + + Width += Character_Bounds[1] + 1; + + Height = max(Height, Character_Bounds[3]); + + Offset_Y = max(Offset_Y, 3 - (__int32)Character_Bounds[2]); + + Character_Number += 1; + + if (Character_Number != Characters_Count) + { + goto Calculate_Text_Bounds_Label; + } + + Draw_Box(Bounds[1] + 3, Bounds[2], Bounds[1] + 8 + Width, Bounds[2] + Height + Offset_Y + 3); + + Character_Number = 0; + + __int32 Offset_X = 0; + + Draw_Character_Label: + { + Character_Bounds = Characters_Bounds[Paint_Data->Name[Character_Number]]; + + wchar_t Text[2] = { Paint_Data->Name[Character_Number] }; + + Write_Character = Text[0]; + + if (Ghost == 0) + { + Draw_Text_Type((unsigned __int32)Engine_Module + 2217776)(Font, Bounds[1] + 7 + Offset_X - Character_Bounds[0], Bounds[2] + Offset_Y, Paint_Data->Color[0], Paint_Data->Color[1], Paint_Data->Color[2], 255, Text); + } + else + { + Draw_Text_Type((unsigned __int32)Engine_Module + 2217776)(Font, Bounds[1] + 7 + Offset_X - Character_Bounds[0], Bounds[2] + Offset_Y, 255, 255, 255, 255, Text); + } + + Write_Character = 0; + + Offset_X += Character_Bounds[1] + 1; + + Character_Number += 1; + + if (Character_Number != Characters_Count) + { + goto Draw_Character_Label; + } + } + } + } + + Target_Number -= 1; + + goto Traverse_Sorted_Target_List_Label; + } + } +} \ No newline at end of file diff --git a/Perform_Shove_Trace.hpp b/Perform_Shove_Trace.hpp new file mode 100755 index 0000000..8799b75 --- /dev/null +++ b/Perform_Shove_Trace.hpp @@ -0,0 +1,23 @@ +void __thiscall Perform_Shove_Trace(void* Stack) +{ + void* Entity = *(void**)((unsigned __int32)Stack - 276); + + if (Entity == (void*)((unsigned __int32)Perform_Trace_Target ^ 1)) + { + Perform_Trace_Target = Entity; + } +} + +void* Original_Perform_Shove_Trace_Caller; + +void __declspec(naked) Redirected_Perform_Shove_Trace() +{ + asm("lea -304(%ebp), %eax"); + asm("push %eax"); + asm("call *%edx"); + asm("pusha"); + asm("mov %esp, %ecx"); + asm("call %0" : : "m"(Perform_Shove_Trace)); + asm("popa"); + asm("jmp *%0" : : "m"(Original_Perform_Shove_Trace_Caller)); +} \ No newline at end of file diff --git a/Perform_Trace.hpp b/Perform_Trace.hpp new file mode 100755 index 0000000..d88cf70 --- /dev/null +++ b/Perform_Trace.hpp @@ -0,0 +1,76 @@ +void* Perform_Trace_Target; + +float Vector_Normalize(float* Vector) +{ + using Vector_Normalize_Type = float(__thiscall*)(float* Vector); + + return Vector_Normalize_Type((unsigned __int32)Client_Module + 3528928)(Vector); +}; + +void Angle_Vectors(float* Angles, float* Forward, float* Right, float* Up) +{ + using Angle_Vectors_Type = void(__cdecl*)(float* Angles, float* Forward, float* Right, float* Up); + + Angle_Vectors_Type((unsigned __int32)Client_Module + 3532128)(Angles, Forward, Right, Up); +}; + +void __thiscall Perform_Trace(void* Stack) +{ + void* Entity = *(void**)((unsigned __int32)Stack + 312); + + if (Entity == (void*)((unsigned __int32)Perform_Trace_Target ^ 1)) + { + void* Trace_Information = *(void**)((unsigned __int32)Stack + 36); + + if ((*(__int32*)((unsigned int)Trace_Information + 36) & 255) + *(__int32*)((unsigned __int32)Entity + 52) == 17) + { + float Inflictor_Direction[3]; + + float* End = (float*)((unsigned __int32)Stack + 248); + + using Get_Center_Type = float*(__thiscall*)(void* Entity); + + float* Start = Get_Center_Type((unsigned __int32)Client_Module + 114400)(*(void**)Trace_Information); + + Inflictor_Direction[0] = End[0] - Start[0]; + + Inflictor_Direction[1] = End[1] - Start[1]; + + Inflictor_Direction[2] = End[2] - Start[2]; + + Vector_Normalize(Inflictor_Direction); + + using Get_Attachment_Type = void(__thiscall*)(void* Entity, char* Attachment, float* Origin, float* Angle); + + float Origin[3]; + + float Angle[3]; + + Get_Attachment_Type((unsigned __int32)Client_Module + 178656)(Entity, (char*)"chest", Origin, Angle); + + float Victim_Direction[3]; + + Angle_Vectors(Angle, Victim_Direction, nullptr, nullptr); + + if (Inflictor_Direction[0] * Victim_Direction[0] + Inflictor_Direction[1] * Victim_Direction[1] + Inflictor_Direction[2] * Victim_Direction[2] >= 0) + { + Perform_Trace_Target = Entity; + } + } + else + { + Perform_Trace_Target = Entity; + } + } +} + +void* Original_Perform_Trace_Caller; + +void __declspec(naked) Redirected_Perform_Trace() +{ + asm("pusha"); + asm("mov %esp, %ecx"); + asm("call %0" : : "m"(Perform_Trace)); + asm("popa"); + asm("jmp *%0" : : "m"(Original_Perform_Trace_Caller)); +} \ No newline at end of file diff --git a/Play_Footstep_Sound.hpp b/Play_Footstep_Sound.hpp new file mode 100755 index 0000000..eea4f67 --- /dev/null +++ b/Play_Footstep_Sound.hpp @@ -0,0 +1,16 @@ +void* Original_Play_Footstep_Sound_Caller; + +void __thiscall Redirected_Play_Footstep_Sound(void* Unknown_Parameter_1, void* Unknown_Parameter_2, void* Unknown_Parameter_3, void* Unknown_Parameter_4, void* Unknown_Parameter_5, void* Unknown_Parameter_6) +{ + void* Prediction = *(void**)((unsigned __int32)Engine_Module + 5171076); + + if (*(__int8*)((unsigned __int32)Prediction + 8) == 1) + { + if (*(__int8*)((unsigned __int32)Prediction + 24) == 0) + { + return; + } + } + + (decltype(&Redirected_Play_Footstep_Sound)(Original_Play_Footstep_Sound_Caller))(Unknown_Parameter_1, Unknown_Parameter_2, Unknown_Parameter_3, Unknown_Parameter_4, Unknown_Parameter_5, Unknown_Parameter_6); +} \ No newline at end of file diff --git a/Post_Network_Data_Received.hpp b/Post_Network_Data_Received.hpp new file mode 100755 index 0000000..709a523 --- /dev/null +++ b/Post_Network_Data_Received.hpp @@ -0,0 +1,81 @@ +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]; +}; + +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 + 1564336)(this, nullptr, 2, Destination, 1, Source, 0, 3, Handler); + } +}; + +Prediction_Copy_Structure Predicton_Copy; + +void Predicton_Copy_Compare(void* Unknown_Parameter_1, char* Name, void* Unknown_Parameter_3, void* Unknown_Parameter_4, void* Unknown_Parameter_5, void* Unknown_Parameter_6, __int8 Within_Tolerance, void* Unknown_Parameter_7) +{ + if (Within_Tolerance == 1) + { + Prediction_Field_Structure* Field = *(Prediction_Field_Structure**)((unsigned __int32)__builtin_frame_address(0) + 60); + + 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 +{ + Prediction_Field_Structure* Fields; + + __int32 Size; + + __int8 Additional_Bytes_1[4]; + + Prediction_Descriptor_Structure* Parent; + + __int8 Additional_Bytes_2[6]; +}; + +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 + 7490392); + + void* Result = *(void**)((unsigned __int32)Local_Player + 900 + (150 - Commands_Acknowledged * 150 % -~150) * 4); + + if (Result != nullptr) + { + Predicton_Copy.Construct(Local_Player, Result, (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); + + Transfer_Data_Type((unsigned __int32)Client_Module + 1573568)(&Predicton_Copy, nullptr, -1, (Prediction_Descriptor_Structure*)((unsigned __int32)Client_Module + 7228288)); + } + + (decltype(&Redirected_Post_Network_Data_Received)(Original_Post_Network_Data_Received_Caller))(Unknown_Parameter, Commands_Acknowledged); +} \ No newline at end of file diff --git a/README.md b/README.md index e2d866a..1aefc97 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ placeholder for l4d2 project (code is hidden until finished) +> [!NOTE] +> some parts of code are published for moment my hdd is dysfunctional diff --git a/Read_Packets.hpp b/Read_Packets.hpp new file mode 100755 index 0000000..7e940d9 --- /dev/null +++ b/Read_Packets.hpp @@ -0,0 +1,13 @@ +void* Original_Read_Packets_Caller; + +void Redirected_Read_Packets(__int8 Final) +{ + static __int8 Parsed_Packets; + + if (Parsed_Packets == 0) + { + (decltype(&Redirected_Read_Packets)(Original_Read_Packets_Caller))(Final); + } + + Parsed_Packets = __builtin_return_address(0) != (void*)((unsigned __int32)Engine_Module + 1631103); +} \ No newline at end of file diff --git a/Spawn_Grenade.hpp b/Spawn_Grenade.hpp new file mode 100755 index 0000000..8a41b0f --- /dev/null +++ b/Spawn_Grenade.hpp @@ -0,0 +1,28 @@ +void* Original_Spawn_Grenade_Caller; + +void __thiscall Redirected_Spawn_Grenade(void* Entity) +{ + using Set_Size_Type = void(__thiscall*)(void* Entity, float* Minimum, float* Maximum); + + float Minimum[3] = + { + -4, + + -4, + + -4 + }; + + float Maximum[3] = + { + 4, + + 4, + + 4 + }; + + Set_Size_Type((unsigned __int32)Client_Module + 281664)(Entity, Minimum, Maximum); + + (decltype(&Redirected_Spawn_Grenade)(Original_Spawn_Grenade_Caller))(Entity); +} \ No newline at end of file diff --git a/Write_Texture.hpp b/Write_Texture.hpp new file mode 100755 index 0000000..b30b142 --- /dev/null +++ b/Write_Texture.hpp @@ -0,0 +1,66 @@ +void* Original_Write_Texture_Caller; + +wchar_t Write_Character; + +std::unordered_map Characters_Bounds; + +void __thiscall Redirected_Write_Texture(void* Unknown_Parameter_1, void* Unknown_Parameter_2, unsigned __int32 Width, unsigned __int32 Height, void* Texture) +{ + (decltype(&Redirected_Write_Texture)(Original_Write_Texture_Caller))(Unknown_Parameter_1, Unknown_Parameter_2, Width, Height, Texture); + + if (Write_Character != 0) + { + unsigned __int32 X = 0; + + unsigned __int32 Offset_X = Width; + + unsigned __int32 Offset_Y = Height; + + unsigned __int32 Character_Width = 0; + + unsigned __int32 Character_Height = 0; + + Traverse_Horizontal_Label: + { + unsigned __int32 Y = 0; + + Traverse_Vertical_Label: + { + if (*(unsigned __int32*)((unsigned __int32)Texture + X * 4 + Y * 4 * Width) != 0) + { + Offset_X = min(Offset_X, X); + + Character_Width = max(Character_Width, X + 1); + + Offset_Y = min(Offset_Y, Y); + + Character_Height = max(Character_Height, Y + 1); + } + + Y += 1; + + if (Y != Height) + { + goto Traverse_Vertical_Label; + } + } + + X += 1; + + if (X != Width) + { + goto Traverse_Horizontal_Label; + } + } + + unsigned __int32* Character_Bounds = Characters_Bounds[Write_Character]; + + Character_Bounds[0] = Offset_X; + + Character_Bounds[1] = Character_Width - Offset_X; + + Character_Bounds[2] = Offset_Y; + + Character_Bounds[3] = Character_Height; + } +} \ No newline at end of file