Skip to content

Commit 87b8ee9

Browse files
committed
physenv: try to fix it crashing on 64x
1 parent b88c8bf commit 87b8ee9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

source/modules/physenv.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,7 @@ void hook_CPhysicsEnvironment_DestroyObject(GMODSDK::CPhysicsEnvironment* pEnvir
843843
return;
844844
}
845845

846+
#if ARCHITECTURE_X86
846847
pEnv->m_objects.FastRemove(foundIndex);
847848

848849
UnregisterPhysicsObject(pLuaEnvironment, pObject);
@@ -866,6 +867,11 @@ void hook_CPhysicsEnvironment_DestroyObject(GMODSDK::CPhysicsEnvironment* pEnvir
866867
pEnv->m_pSleepEvents->DeleteObject(pPhysics);
867868
delete pObject;
868869
}
870+
#else // Required since 64x uses a different vphysics build and we don't want to corrupt member variables of the CPhysicsEnvironment
871+
detour_CPhysicsEnvironment_DestroyObject.GetTrampoline<Symbols::CPhysicsEnvironment_DestroyObject>()(pEnv, pObject);
872+
873+
UnregisterPhysicsObject(pLuaEnvironment, pObject);
874+
#endif
869875
}
870876

871877
static Detouring::Hook detour_CPhysicsEnvironment_Restore;

0 commit comments

Comments
 (0)