fix GetAvatars pattern

This commit is contained in:
maybegreat48
2025-04-28 16:21:02 -04:00
parent aef3fba660
commit ff4164ed26
5 changed files with 41 additions and 2 deletions
+24
View File
@@ -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"};
}
+1
View File
@@ -62,6 +62,7 @@ namespace YimMenu::Submenus
weaponsGlobalsGroup->AddItem(std::make_shared<BoolCommandItem>("infiniteammo"_J));
weaponsGlobalsGroup->AddItem(std::make_shared<BoolCommandItem>("infiniteclip"_J));
weaponsGlobalsGroup->AddItem(std::make_shared<BoolCommandItem>("rapidfire"_J));
weaponsGlobalsGroup->AddItem(std::make_shared<BoolCommandItem>("aimbot"_J));
weaponsGlobalsGroup->AddItem(std::make_shared<BoolCommandItem>("infiniteparachutes"_J));
weaponsGlobalsGroup->AddItem(std::make_shared<CommandItem>("giveallweapons"_J));
@@ -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_SEND_TO_INTERIOR*>(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<int>(eSimpleInteriorIndex::SIMPLE_INTERIOR_MAX)) // the upper bound will change after an update
{
// null function kick
return false;
+12 -1
View File
@@ -323,6 +323,17 @@ namespace YimMenu
FormatIntCaller2 = ptr.Sub(0x11).As<PVOID>();
});
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<void*>(), std::vector<std::uint8_t>{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<void*>(), std::vector<std::uint8_t>{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<void*>(), std::vector<std::uint8_t>{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<Functions::GetAvatars>();
});
+2
View File
@@ -138,6 +138,8 @@ namespace YimMenu
std::uint32_t* GameTimer;
PVOID FormatIntCaller1;
PVOID FormatIntCaller2;
BytePatch ShouldNotTargetEntityPatch;
BytePatch GetAssistedAimTypePatch;
};
struct Pointers : PointerData