mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Recast: add hook bodies for NavMesh functions
Used for debugging the Detour implementation of the engine.
This commit is contained in:
parent
c64f28be25
commit
f5c0b428cb
@ -74,6 +74,37 @@ bool Detour_IsGoalPolyReachable(dtNavMesh* const nav, const dtPolyRef fromRef,
|
||||
return nav->isGoalPolyReachable(fromRef, goalRef, !hasAnimType, traverseTableIndex);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: finds the nearest polygon to specified center point.
|
||||
// Input : *query -
|
||||
// *center -
|
||||
// *halfExtents -
|
||||
// *filter -
|
||||
// *nearestRef -
|
||||
// *nearestPt -
|
||||
// Output: The status flags for the query.
|
||||
//-----------------------------------------------------------------------------
|
||||
dtStatus Detour_FindNearestPoly(dtNavMeshQuery* query, const float* center, const float* halfExtents,
|
||||
const dtQueryFilter* filter, dtPolyRef* nearestRef, float* nearestPt)
|
||||
{
|
||||
return query->findNearestPoly(center, halfExtents, filter, nearestRef, nearestPt);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: adds a tile to the NavMesh.
|
||||
// Input : *nav -
|
||||
// *unused -
|
||||
// *data -
|
||||
// *dataSize -
|
||||
// *flags -
|
||||
// *lastRef -
|
||||
// Output: The status flags for the operation.
|
||||
//-----------------------------------------------------------------------------
|
||||
dtStatus Detour_AddTile(dtNavMesh* nav, void* unused, unsigned char* data, int dataSize, int flags, dtTileRef lastRef)
|
||||
{
|
||||
return nav->addTile(data, dataSize, flags, lastRef, nullptr);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: initialize NavMesh and Detour query singleton for level
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -213,4 +244,6 @@ void VRecast::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourSetup(&v_Detour_IsGoalPolyReachable, &Detour_IsGoalPolyReachable, bAttach);
|
||||
DetourSetup(&v_Detour_LevelInit, &Detour_LevelInit, bAttach);
|
||||
//DetourSetup(&dtNavMesh__addTile, &Detour_AddTile, bAttach);
|
||||
//DetourSetup(&dtNavMeshQuery__findNearestPoly, &Detour_FindNearestPoly, bAttach);
|
||||
}
|
||||
|
@ -11,7 +11,10 @@ inline void(*v_Detour_LevelInit)(void);
|
||||
inline void(*v_Detour_FreeNavMesh)(dtNavMesh* mesh);
|
||||
inline bool(*v_Detour_IsGoalPolyReachable)(dtNavMesh* const nav, const dtPolyRef fromPoly, const dtPolyRef goalPoly, const TraverseAnimType_e animType);
|
||||
inline dtStatus(*dtNavMesh__Init)(dtNavMesh* thisptr, unsigned char* data, int flags);
|
||||
inline dtStatus(*dtNavMesh__addTile)(dtNavMesh* thisptr, unsigned char* data, dtMeshHeader* header, int dataSize, int flags, dtTileRef lastRef);
|
||||
inline dtStatus(*dtNavMesh__addTile)(dtNavMesh* thisptr, void* unused, unsigned char* data, int dataSize, int flags, dtTileRef lastRef);
|
||||
inline dtStatus(*dtNavMeshQuery__findNearestPoly)(dtNavMeshQuery* query, const float* center, const float* halfExtents,
|
||||
const dtQueryFilter* filter,
|
||||
dtPolyRef* nearestRef, float* nearestPt);
|
||||
|
||||
|
||||
constexpr const char* NAVMESH_PATH = "maps/navmesh/";
|
||||
@ -36,6 +39,7 @@ class VRecast : public IDetour
|
||||
LogFunAdr("Detour_IsGoalPolyReachable", v_Detour_IsGoalPolyReachable);
|
||||
LogFunAdr("dtNavMesh::Init", dtNavMesh__Init);
|
||||
LogFunAdr("dtNavMesh::addTile", dtNavMesh__addTile);
|
||||
LogFunAdr("dtNavMeshQuery::findNearestPoly", dtNavMeshQuery__findNearestPoly);
|
||||
LogVarAdr("g_pNavMesh[ NavMeshType_e::NAVMESH_COUNT ]", g_pNavMesh);
|
||||
LogVarAdr("g_pNavMeshQuery", g_pNavMeshQuery);
|
||||
}
|
||||
@ -46,6 +50,7 @@ class VRecast : public IDetour
|
||||
g_GameDll.FindPatternSIMD("48 89 6C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 41 56 49 63 F1").GetPtr(v_Detour_IsGoalPolyReachable);
|
||||
g_GameDll.FindPatternSIMD("4C 89 44 24 ?? 53 41 56 48 81 EC ?? ?? ?? ?? 0F 10 11").GetPtr(dtNavMesh__Init);
|
||||
g_GameDll.FindPatternSIMD("44 89 4C 24 ?? 41 55").GetPtr(dtNavMesh__addTile);
|
||||
g_GameDll.FindPatternSIMD("4C 8B DC 49 89 4B ?? 41 54 41 57").GetPtr(dtNavMeshQuery__findNearestPoly);
|
||||
}
|
||||
virtual void GetVar(void) const
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user