This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
YimMenu/src/hooks/protections/serialize_parachute_task.cpp
Andreas Maerten ca1e7e6b41
Give optimisation hints to compiler (#2929)
feat(invoker): add compiler hints
chore(get network event data): added translation TODO
feat(native hooks): add compiler hint to crashes
feat(render): add likely compiler hint to on_present
feat(thread pool): add compiler hints
Added hook likely/unlikely switches to debug/crash scenarios.
Added HEX_TO_UPPER call on the AC verifier offsets.
Added more fuzzer unlikely attributes.
Replaced some hard coded numbers with their unhashed _J variants.
Added more unlikely attributes to singleton initializer checks.
Added more likely/unlikely attributes to certain scenarios.
2024-04-22 19:48:22 +02:00

30 lines
769 B
C++

#include "hooking/hooking.hpp"
#include "util/notify.hpp"
#include <entities/CDynamicEntity.hpp>
namespace big
{
#pragma pack(push, 8)
struct TaskObject
{
uint16_t m_net_id;
rage::CDynamicEntity* m_entity;
};
#pragma pack(pop)
void hooks::serialize_parachute_task(__int64 info, rage::CSyncDataBase* serializer)
{
auto object = reinterpret_cast<TaskObject*>(info + 0x30);
g_hooking->get_original<hooks::serialize_parachute_task>()(info, serializer);
if (object->m_entity && object->m_entity->m_entity_type != 5) [[unlikely]]
{
g_pointers->m_gta.m_remove_reference(object->m_entity, &object->m_entity);
notify::crash_blocked(g.m_syncing_player, "invalid parachute object type");
object->m_entity = nullptr;
object->m_net_id = 0;
}
}
}