feat: release aim target when dead

This commit is contained in:
maybegreat48
2025-06-07 09:55:59 -04:00
parent 8aadf51311
commit 41bd70a5b6
7 changed files with 41 additions and 10 deletions
+2
View File
@@ -38,6 +38,8 @@ namespace YimMenu
BaseHook::Add<Hooks::Spoofing::WriteSyncTree>(new DetourHook("WriteSyncTree", Pointers.WriteSyncTree, Hooks::Spoofing::WriteSyncTree));
BaseHook::Add<Hooks::Network::GetPoolType>(new DetourHook("GetPoolType", Pointers.GetPoolType, Hooks::Network::GetPoolType));
BaseHook::Add<Hooks::Misc::AssistedAimShouldReleaseEntity>(new DetourHook("AssistedAimShouldReleaseEntity", Pointers.AssistedAimShouldReleaseEntity, Hooks::Misc::AssistedAimShouldReleaseEntity));
}
Hooking::~Hooking()
+8 -9
View File
@@ -23,10 +23,18 @@ namespace YimMenu
void Renderer::DestroyImpl()
{
// TODO: we aren't destroying resources properly
ImGui_ImplWin32_Shutdown();
WaitForLastFrame();
ImGui_ImplDX12_InvalidateDeviceObjects();
for (size_t i{}; i != GetInstance().m_SwapChainDesc.BufferCount; ++i)
{
REL(GetInstance().m_FrameContext[i].Resource);
}
ImGui_ImplDX12_Shutdown();
ImGui::DestroyContext();
@@ -195,15 +203,6 @@ namespace YimMenu
};
ImGui_ImplDX12_Init(&init_info);
#if 0
ImGui_ImplDX12_Init(m_Device.Get(),
m_SwapChainDesc.BufferCount,
DXGI_FORMAT_R8G8B8A8_UNORM,
m_DescriptorHeap.Get(),
m_DescriptorHeap->GetCPUDescriptorHandleForHeapStart(),
m_DescriptorHeap->GetGPUDescriptorHandleForHeapStart());
#endif
ImGui::StyleColorsDark();
LOG(INFO) << "DirectX 12 renderer has finished initializing.";
+1 -1
View File
@@ -129,7 +129,7 @@ namespace YimMenu
{
while (g_Running)
{
if (Features::_AutoUpdateEnabled.GetState() && m_LastPlayerInfoFetch + AUTO_REFRESH_TIME < std::chrono::system_clock::now() && Pointers.GetPresenceAttributes)
if (Features::_AutoUpdateEnabled.GetState() && std::chrono::system_clock::now() - m_LastPlayerInfoFetch > AUTO_REFRESH_TIME && Pointers.GetPresenceAttributes)
{
FetchPlayerInfo(true);
m_LastPlayerInfoFetch = std::chrono::system_clock::now();
+5
View File
@@ -78,4 +78,9 @@ namespace YimMenu::Hooks
{
extern LRESULT WndProc(HWND hwnd, UINT umsg, WPARAM wparam, LPARAM lparam);
}
namespace Misc
{
extern bool AssistedAimShouldReleaseEntity(__int64 a1);
}
}
@@ -0,0 +1,19 @@
#include "core/hooking/DetourHook.hpp"
#include "game/hooks/Hooks.hpp"
#include "types/entity/CDynamicEntity.hpp"
#include "game/gta/Ped.hpp"
namespace YimMenu::Hooks
{
bool Misc::AssistedAimShouldReleaseEntity(__int64 a1)
{
auto entity = *(CDynamicEntity**)(a1 + 0x38);
if (entity && entity->IsPed() && Ped(entity).IsDead())
{
return true;
}
return BaseHook::Get<Misc::AssistedAimShouldReleaseEntity, DetourHook<decltype(&Misc::AssistedAimShouldReleaseEntity)>>()->Original()(a1);
}
}
+5
View File
@@ -379,6 +379,11 @@ namespace YimMenu
BattlEyeServerProcessPlayerJoin = ptr.Sub(0x72).As<PVOID>();
});
constexpr auto assistedAimShouldReleaseEntityPtrn = Pattern<"80 7F 28 04 75 6A">("AssistedAimShouldReleaseEntity");
scanner.Add(assistedAimShouldReleaseEntityPtrn, [this](PointerCalculator ptr) {
AssistedAimShouldReleaseEntity = ptr.Sub(0xF).As<PVOID>();
});
if (!scanner.Scan())
{
LOG(FATAL) << "Some patterns could not be found, unloading.";
+1
View File
@@ -150,6 +150,7 @@ namespace YimMenu
CStatsMpCharacterMappingData* StatsMpCharacterMappingData;
int* HasGTAPlus;
PVOID BattlEyeServerProcessPlayerJoin;
PVOID AssistedAimShouldReleaseEntity;
};
struct Pointers : PointerData