2022-03-18 03:14:07 +01:00
|
|
|
#pragma once
|
|
|
|
#include "thirdparty/recast/detour/include/detourstatus.h"
|
|
|
|
#include "thirdparty/recast/detour/include/detournavmesh.h"
|
|
|
|
|
2022-04-09 02:18:57 +02:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
// RUNTIME: DETOUR
|
|
|
|
//-------------------------------------------------------------------------
|
2022-04-18 03:35:08 +02:00
|
|
|
inline CMemory p_dtNavMesh__Init;
|
2022-06-12 13:24:30 +02:00
|
|
|
inline auto v_dtNavMesh__Init = p_dtNavMesh__Init.RCast<dtStatus(*)(dtNavMesh* thisptr, unsigned char* data, int flags)>();
|
2022-03-18 03:14:07 +01:00
|
|
|
|
2022-04-18 03:35:08 +02:00
|
|
|
inline CMemory p_dtNavMesh__addTile;
|
2022-06-12 13:24:30 +02:00
|
|
|
inline auto v_dtNavMesh__addTile = p_dtNavMesh__addTile.RCast<dtStatus(*)(dtNavMesh* thisptr, unsigned char* data, dtMeshHeader* header, int dataSize, int flags, dtTileRef lastRef)>();
|
2022-03-18 03:14:07 +01:00
|
|
|
|
2022-04-18 03:35:08 +02:00
|
|
|
inline CMemory p_dtNavMesh__isPolyReachable;
|
2022-06-12 13:24:30 +02:00
|
|
|
inline auto v_dtNavMesh__isPolyReachable = p_dtNavMesh__isPolyReachable.RCast<bool(*)(dtNavMesh* thisptr, dtPolyRef poly_1, dtPolyRef poly_2, int hull_type)>();
|
2022-07-13 11:42:07 +02:00
|
|
|
|
|
|
|
const string SHULL_SIZE[5] =
|
|
|
|
{
|
|
|
|
"small",
|
|
|
|
"med_short",
|
|
|
|
"medium",
|
|
|
|
"large",
|
|
|
|
"extra_large"
|
|
|
|
};
|
|
|
|
|
|
|
|
enum EHULL_SIZE
|
|
|
|
{
|
|
|
|
SMALL = 0,
|
|
|
|
MED_SHORT,
|
|
|
|
MEDIUM,
|
|
|
|
LARGE,
|
|
|
|
EXTRA_LARGE
|
|
|
|
};
|
|
|
|
|
|
|
|
inline dtNavMesh** g_pNavMesh = nullptr;
|
2022-07-13 11:44:38 +02:00
|
|
|
dtNavMesh* GetNavMeshForHull(int hull);
|
2022-03-18 03:14:07 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2022-05-13 14:53:25 +02:00
|
|
|
class VRecast : public IDetour
|
2022-03-18 03:14:07 +01:00
|
|
|
{
|
2022-04-11 01:44:30 +02:00
|
|
|
virtual void GetAdr(void) const
|
2022-03-18 03:14:07 +01:00
|
|
|
{
|
2022-05-13 14:53:25 +02:00
|
|
|
spdlog::debug("| FUN: dtNavMesh::Init : {:#18x} |\n", p_dtNavMesh__Init.GetPtr());
|
|
|
|
spdlog::debug("| FUN: dtNavMesh::addTile : {:#18x} |\n", p_dtNavMesh__addTile.GetPtr());
|
|
|
|
spdlog::debug("| FUN: dtNavMesh::isPolyReachable : {:#18x} |\n", p_dtNavMesh__isPolyReachable.GetPtr());
|
2022-07-13 11:42:07 +02:00
|
|
|
spdlog::debug("| VAR: g_pNavMesh[5] : {:#18x} |\n", reinterpret_cast<uintptr_t>(g_pNavMesh));
|
2022-05-13 14:53:25 +02:00
|
|
|
spdlog::debug("+----------------------------------------------------------------+\n");
|
2022-03-18 03:14:07 +01:00
|
|
|
}
|
2022-04-18 03:35:08 +02:00
|
|
|
virtual void GetFun(void) const
|
|
|
|
{
|
|
|
|
p_dtNavMesh__Init = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x4C\x89\x44\x24\x00\x53\x41\x56\x48\x81\xEC\x00\x00\x00\x00\x0F\x10\x11"), "xxxx?xxxxxx????xxx");
|
|
|
|
p_dtNavMesh__addTile = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x44\x89\x4C\x24\x00\x41\x55"), "xxxx?xx");
|
|
|
|
p_dtNavMesh__isPolyReachable = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x89\x6C\x24\x00\x48\x89\x74\x24\x00\x48\x89\x7C\x24\x00\x41\x56\x49\x63\xF1"), "xxxx?xxxx?xxxx?xxxxx");
|
|
|
|
|
2022-07-13 11:42:07 +02:00
|
|
|
v_dtNavMesh__Init = p_dtNavMesh__Init.RCast<dtStatus(*)(dtNavMesh*, unsigned char*, int)>(); /*4C 89 44 24 ?? 53 41 56 48 81 EC ?? ?? ?? ?? 0F 10 11*/
|
|
|
|
v_dtNavMesh__addTile = p_dtNavMesh__addTile.RCast<dtStatus(*)(dtNavMesh*, unsigned char*, dtMeshHeader*, int, int, dtTileRef)>(); /*44 89 4C 24 ?? 41 55*/
|
|
|
|
v_dtNavMesh__isPolyReachable = p_dtNavMesh__isPolyReachable.RCast<bool(*)(dtNavMesh*, dtPolyRef, dtPolyRef, int)>(); /*48 89 6C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 41 56 49 63 F1*/
|
|
|
|
}
|
|
|
|
virtual void GetVar(void) const
|
|
|
|
{
|
|
|
|
g_pNavMesh = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x89\x54\x24\x00\x48\x89\x4C\x24\x00\x55\x53\x56\x57\x41\x54\x41\x55\x41\x56\x41\x57\x48\x8D\x6C\x24\x00\x48\x81\xEC\x00\x00\x00\x00\x48\x8B\x02"), "xxxx?xxxx?xxxxxxxxxxxxxxxx?xxx????xxx")
|
|
|
|
.FindPatternSelf("48 8D 3D").ResolveRelativeAddressSelf(0x3, 0x7).RCast<dtNavMesh**>();
|
2022-04-18 03:35:08 +02:00
|
|
|
}
|
2022-04-11 01:44:30 +02:00
|
|
|
virtual void GetCon(void) const { }
|
|
|
|
virtual void Attach(void) const { }
|
|
|
|
virtual void Detach(void) const { }
|
2022-03-18 03:14:07 +01:00
|
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2022-05-13 14:53:25 +02:00
|
|
|
REGISTER(VRecast);
|