diff --git a/CMakeLists.txt b/CMakeLists.txt index 92ddfef5..8b574091 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,8 @@ file(GLOB_RECURSE SRC_FILES "${SRC_DIR}/**.cpp" ) set(DEPS_DIR "${PROJECT_SOURCE_DIR}/deps") +#compile faster +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") add_library(${PROJECT_NAME} MODULE ${SRC_FILES}) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 23) diff --git a/src/core/frontend/manager/Category.cpp b/src/core/frontend/manager/Category.cpp index 4492fe23..f55faa22 100644 --- a/src/core/frontend/manager/Category.cpp +++ b/src/core/frontend/manager/Category.cpp @@ -13,7 +13,7 @@ namespace YimMenu if (m_Length.has_value()) return m_Length.value(); - m_Length = std::max(ImGui::CalcTextSize(m_Name.c_str()).x + 25.0f, 75.0f); + m_Length = static_cast(std::max(ImGui::CalcTextSize(m_Name.c_str()).x + 25.0f, 75.0f)); return m_Length.value(); } } \ No newline at end of file diff --git a/src/core/hooking/Hooking.cpp b/src/core/hooking/Hooking.cpp index c29bc790..a8df990f 100644 --- a/src/core/hooking/Hooking.cpp +++ b/src/core/hooking/Hooking.cpp @@ -58,6 +58,7 @@ namespace YimMenu BaseHook::Add(new DetourHook("HandleCloneSync", Pointers.HandleCloneSync, Hooks::Protections::HandleCloneSync)); BaseHook::Add(new DetourHook("GetCloneCreateResponse", Pointers.GetCloneCreateResponse, Hooks::Protections::GetCloneCreateResponse)); BaseHook::Add(new DetourHook("CanApplyData", Pointers.CanApplyData, Hooks::Protections::CanApplyData)); + BaseHook::Add(new DetourHook("PhysicCrash", Pointers.PhysicCrash, Hooks::Protections::PhysicCrash)); BaseHook::Add(new DetourHook("ResetSyncNodes", Pointers.ResetSyncNodes, Hooks::Protections::ResetSyncNodes)); BaseHook::Add(new DetourHook("HandleScriptedGameEvent", Pointers.HandleScriptedGameEvent, Hooks::Protections::HandleScriptedGameEvent)); BaseHook::Add(new DetourHook("AddObjectToCreationQueue", Pointers.AddObjectToCreationQueue, Hooks::Protections::AddObjectToCreationQueue)); diff --git a/src/game/frontend/items/ListCommandItem.cpp b/src/game/frontend/items/ListCommandItem.cpp index 21c7a2ad..58192dc7 100644 --- a/src/game/frontend/items/ListCommandItem.cpp +++ b/src/game/frontend/items/ListCommandItem.cpp @@ -46,7 +46,7 @@ namespace YimMenu m_SelectedItem = ""; auto size = ImGui::CalcTextSize(largest_string); - m_ItemWidth = size.x + 25.0f; + m_ItemWidth = static_cast(size.x + 25.0f); } ImGui::SetNextItemWidth(m_ItemWidth.value()); diff --git a/src/game/frontend/submenus/Network.cpp b/src/game/frontend/submenus/Network.cpp index e97791a3..988d5745 100644 --- a/src/game/frontend/submenus/Network.cpp +++ b/src/game/frontend/submenus/Network.cpp @@ -227,7 +227,13 @@ namespace YimMenu::Submenus static const char* iconBuf = ""; infoSpoofingGroup->AddItem(std::make_shared([=] { static std::map colors = {{"", "None"}, {"~e~", "Red"}, {"~f~", "Off White"}, {"~p~", "White"}, {"~o~", "Yellow"}, {"~q~", "Pure White"}, {"~d~", "Orange"}, {"~m~", "Light Grey"}, {"~t~", "Grey"}, {"~v~", "Black"}, {"~pa~", "Blue"}, {"~t1~", "Purple"}, {"~t2~", "Orange"}, {"~t3~", "Teal"}, {"~t4~", "Light Yellow"}, {"~t5~", "Pink"}, {"~t6~", "Green"}, {"~t7~", "Dark Blue"}}; - static std::map icons = {{"", "None"}, {"\u2211", "Rockstar Icon"}}; + + #pragma warning(push) + #pragma warning(disable : 4566) + static std::map icons = {{"", "None"}, {"∑", "Rockstar Icon"}}; + #pragma warning(pop) + + ImGui::Text("Spoofed data will not appear locally, and will only be visible when joining a new session,\n or when a player joins you"); ImGui::Text("Name"); diff --git a/src/game/hooks/Hooks.hpp b/src/game/hooks/Hooks.hpp index 9941ea4b..dab34959 100644 --- a/src/game/hooks/Hooks.hpp +++ b/src/game/hooks/Hooks.hpp @@ -111,6 +111,9 @@ namespace YimMenu::Hooks extern bool ReceiveArrayUpdate(void* array, CNetGamePlayer* sender, rage::datBitBuffer* buffer, int size, int16_t cycle); extern void* CreatePoolItem(rage::fwBasePool* pool, int size); extern int HandleCloneRemove(void* mgr, CNetGamePlayer* sender, CNetGamePlayer* target, uint16_t objectId, int ownershipToken, bool unk); + + extern int64_t PhysicCrash(int64_t a1, unsigned int a2, int* a3); + extern void SetTreeErrored(rage::netSyncTree* tree, bool errored); extern void PhysicsHandleLassoAttachment(void* inst, void* attachment); extern void DecideConnectionMethod(void* _this, void* a2); diff --git a/src/game/hooks/Protections/PhysicCrash.cpp b/src/game/hooks/Protections/PhysicCrash.cpp new file mode 100644 index 00000000..e65373a1 --- /dev/null +++ b/src/game/hooks/Protections/PhysicCrash.cpp @@ -0,0 +1,25 @@ +#include "core/hooking/DetourHook.hpp" +#include "game/hooks/Hooks.hpp" +#include "game/pointers/Pointers.hpp" + + +namespace YimMenu::Hooks +{ + int64_t Protections::PhysicCrash(int64_t a1, unsigned int a2, int* a3) + { + unsigned int v11; // esi + int64_t v9; // rbx + + v9 = *(uint64_t*)(a1 + 40) + 80i64 * a2; + if (v9) + { + v11 = *(uint16_t*)(v9 + 72); + if (v11 > 1000) + { + return 0; + } + } + + return BaseHook::Get>()->Original()(a1, a2, a3); + } +} \ No newline at end of file diff --git a/src/game/hooks/Protections/ShouldBlockSync.cpp b/src/game/hooks/Protections/ShouldBlockSync.cpp index b1b73327..c3141389 100644 --- a/src/game/hooks/Protections/ShouldBlockSync.cpp +++ b/src/game/hooks/Protections/ShouldBlockSync.cpp @@ -61,7 +61,8 @@ namespace { using namespace YimMenu; - static const std::unordered_set g_CrashObjects = {0xD1641E60, 0x6927D266}; + static const std::unordered_set g_CrashObjects = {"s_chuckwagonawning01b"_J}; + static const std::unordered_set g_FishModels = { "A_C_Crawfish_01"_J, "A_C_FishBluegil_01_ms"_J, @@ -210,6 +211,7 @@ namespace case "CPedCreationNode"_J: { auto& data = node->GetData(); + if (data.m_ModelHash && !STREAMING::IS_MODEL_A_PED(data.m_ModelHash)) { LOGF(SYNC, WARNING, "Blocking invalid ped creation model 0x{:X} from {}", data.m_ModelHash, Protections::GetSyncingPlayer().GetName()); diff --git a/src/game/pointers/Pointers.cpp b/src/game/pointers/Pointers.cpp index c483ee79..cc479b52 100644 --- a/src/game/pointers/Pointers.cpp +++ b/src/game/pointers/Pointers.cpp @@ -465,11 +465,19 @@ namespace YimMenu PackCloneCreate = ptr.Sub(0x34).As(); }); + + constexpr auto physicCrashPtrn = Pattern<"E8 ?? ?? ?? ?? EB 67 48 8B 41 20">("PhysicCrash"); + scanner.Add(physicCrashPtrn, [this](PointerCalculator ptr) { + PhysicCrash = ptr.Add(1).Rip().As(); + }); + + constexpr auto writeSyncTreePtrn = Pattern<"0F 84 A4 00 00 00 48 8B 07 45 8B C4">("WriteSyncTree"); scanner.Add(writeSyncTreePtrn, [this](PointerCalculator ptr) { WriteSyncTree = ptr.Sub(0x79).As(); }); + constexpr auto shouldUseNodeCachePtrn = Pattern<"83 FA 20 75 03">("ShouldUseNodeCache"); scanner.Add(shouldUseNodeCachePtrn, [this](PointerCalculator ptr) { ShouldUseNodeCache = ptr.As(); diff --git a/src/game/pointers/Pointers.hpp b/src/game/pointers/Pointers.hpp index a9193eb1..44cd65c6 100644 --- a/src/game/pointers/Pointers.hpp +++ b/src/game/pointers/Pointers.hpp @@ -171,6 +171,7 @@ namespace YimMenu PVOID SerializeServerRPC; PVOID ReceiveArrayUpdate; PVOID CreatePoolItem; + PVOID PhysicCrash; // Player Stuff