From d53a21fd63ec65756aebf8898d74d26fa7c429e1 Mon Sep 17 00:00:00 2001 From: SlynxCZ Date: Sat, 7 Feb 2026 15:27:37 +0400 Subject: [PATCH] Fix: update Bind() to use correct ABI offsets by whaliin --- public/Example.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/public/Example.cs b/public/Example.cs index c1578e5..5e72e2a 100644 --- a/public/Example.cs +++ b/public/Example.cs @@ -129,9 +129,20 @@ namespace RayTrace private static void Bind() { - _traceShape = VirtualFunction.Create(g_pRayTraceHandle, 2); - _traceEndShape = VirtualFunction.Create(g_pRayTraceHandle, 3); - _traceHullShape = VirtualFunction.Create(g_pRayTraceHandle, 4); + int traceShapeIndex = 2; + int traceEndShapeIndex = 3; + int traceHullShapeIndex = 4; + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + traceShapeIndex = 1; + traceEndShapeIndex = 2; + traceHullShapeIndex = 3; + } + + _traceShape = VirtualFunction.Create(g_pRayTraceHandle, traceShapeIndex); + _traceEndShape = VirtualFunction.Create(g_pRayTraceHandle, traceEndShapeIndex); + _traceHullShape = VirtualFunction.Create(g_pRayTraceHandle, traceHullShapeIndex); } public static unsafe bool TraceShape(Vector origin, QAngle angles, CBaseEntity? ignoreEntity, TraceOptions options, out TraceResult result)