diff --git a/src/game/features/self/Aimbot.cpp b/src/game/features/self/Aimbot.cpp new file mode 100644 index 0000000..42375cb --- /dev/null +++ b/src/game/features/self/Aimbot.cpp @@ -0,0 +1,24 @@ +#include "core/commands/BoolCommand.hpp" +#include "game/pointers/Pointers.hpp" + +namespace YimMenu::Features +{ + class Aimbot : public BoolCommand + { + using BoolCommand::BoolCommand; + + virtual void OnEnable() override + { + Pointers.ShouldNotTargetEntityPatch->Apply(); + Pointers.GetAssistedAimTypePatch->Apply(); + } + + virtual void OnDisable() override + { + Pointers.ShouldNotTargetEntityPatch->Restore(); + Pointers.GetAssistedAimTypePatch->Restore(); + } + }; + + static Aimbot _Aimbot{"aimbot", "Aimbot", "Locks on to enemies and other players"}; +} \ No newline at end of file diff --git a/src/game/frontend/submenus/Self.cpp b/src/game/frontend/submenus/Self.cpp index 33e1b13..266270e 100644 --- a/src/game/frontend/submenus/Self.cpp +++ b/src/game/frontend/submenus/Self.cpp @@ -62,6 +62,7 @@ namespace YimMenu::Submenus weaponsGlobalsGroup->AddItem(std::make_shared("infiniteammo"_J)); weaponsGlobalsGroup->AddItem(std::make_shared("infiniteclip"_J)); weaponsGlobalsGroup->AddItem(std::make_shared("rapidfire"_J)); + weaponsGlobalsGroup->AddItem(std::make_shared("aimbot"_J)); weaponsGlobalsGroup->AddItem(std::make_shared("infiniteparachutes"_J)); weaponsGlobalsGroup->AddItem(std::make_shared("giveallweapons"_J)); diff --git a/src/game/hooks/Network/HandleScriptedGameEvent.cpp b/src/game/hooks/Network/HandleScriptedGameEvent.cpp index acb9b92..4ba2623 100644 --- a/src/game/hooks/Network/HandleScriptedGameEvent.cpp +++ b/src/game/hooks/Network/HandleScriptedGameEvent.cpp @@ -3,6 +3,7 @@ #include "game/pointers/Pointers.hpp" #include "types/network/netGameEvent.hpp" #include "types/script/globals/GPBD_FM_3.hpp" +#include "types/script/globals/GlobalPlayerBD.hpp" #include "types/script/ScriptEvent.hpp" namespace YimMenu::Hooks @@ -48,7 +49,7 @@ namespace YimMenu::Hooks { SCRIPT_EVENT_SEND_TO_INTERIOR* interior_control = static_cast(script_event); - if (interior_control->Interior < 0 || interior_control->Interior > 175) // the upper bound will change after an update + if (interior_control->Interior < 0 || interior_control->Interior >= static_cast(eSimpleInteriorIndex::SIMPLE_INTERIOR_MAX)) // the upper bound will change after an update { // null function kick return false; diff --git a/src/game/pointers/Pointers.cpp b/src/game/pointers/Pointers.cpp index 1bf98ce..e1b793f 100644 --- a/src/game/pointers/Pointers.cpp +++ b/src/game/pointers/Pointers.cpp @@ -323,6 +323,17 @@ namespace YimMenu FormatIntCaller2 = ptr.Sub(0x11).As(); }); + constexpr auto shouldTargetEntityPatchPtrn = Pattern<"F6 80 A9 14 00 00 01">("ShouldNotTargetEntityPatch"); + scanner.Add(shouldTargetEntityPatchPtrn, [this](PointerCalculator ptr) { + ShouldNotTargetEntityPatch = BytePatches::Add(ptr.Sub(0x53).As(), std::vector{0xB0, 0x00, 0xC3}); + }); + + // TODO: this has been inlined a lot in Enhanced + constexpr auto getAssistedAimTypePatchPtrn = Pattern<"48 85 C0 74 15 8B 80 ? ? ? ? BE 03">("GetAssistedAimTypePatch"); + scanner.Add(getAssistedAimTypePatchPtrn, [this](PointerCalculator ptr) { + GetAssistedAimTypePatch = BytePatches::Add(ptr.Sub(0xE).As(), std::vector{0xB0, 0x01, 0xC3}); + }); + if (!scanner.Scan()) { LOG(FATAL) << "Some patterns could not be found, unloading."; @@ -372,7 +383,7 @@ namespace YimMenu BytePatches::Add(ptr.As(), std::vector{0xB0, 0x01})->Apply(); }); - constexpr auto getAvatarsPtrn = Pattern<"89 4B 7C 48 8B CB E8 ? ? ? ? 84 C0">("GetAvatars"); + constexpr auto getAvatarsPtrn = Pattern<"89 4E 7C 48 8B CE E8 ? ? ? ? 84 C0">("GetAvatars"); scanner.Add(getAvatarsPtrn, [this](PointerCalculator ptr) { GetAvatars = ptr.Add(6).Add(1).Rip().As(); }); diff --git a/src/game/pointers/Pointers.hpp b/src/game/pointers/Pointers.hpp index 51e98c1..8a5a878 100644 --- a/src/game/pointers/Pointers.hpp +++ b/src/game/pointers/Pointers.hpp @@ -138,6 +138,8 @@ namespace YimMenu std::uint32_t* GameTimer; PVOID FormatIntCaller1; PVOID FormatIntCaller2; + BytePatch ShouldNotTargetEntityPatch; + BytePatch GetAssistedAimTypePatch; }; struct Pointers : PointerData