roflmuffin / CounterStrikeSharp

CounterStrikeSharp allows you to write server plugins in C# for Counter-Strike 2/Source2/CS2
https://docs.cssharp.dev
Other
806 stars 128 forks source link

DynamicHook Questions #567

Open Nianmou opened 2 months ago

Nianmou commented 2 months ago

I'm trying to use DynamicHook, however, I'm finding that no matter how I hook it, it doesn't trigger any messages

    private MemoryFunctionVoid<nint, float , float, float> CCSBot_Blind;
    public override void Load(bool hotReload)
    {
        RegisterListener<Listeners.OnEntitySpawned>(OnEntitySpawnedHandler);
        CCSBot_Blind = new("55 48 8D 35 48 CA C9 00", Addresses.ServerPath);
        CCSBot_Blind.Hook(hk_CCSBot_Blind, HookMode.Pre);

    }
    private HookResult hk_CCSBot_Blind(DynamicHook arg)
    {
        Server.PrintToChatAll("CCSBot_Blind Go");
        Console.WriteLine("CCSBot_Blind Go");
        Console.WriteLine("CCSBot_Blind Go");
        Console.WriteLine("CCSBot_Blind Go");
        return HookResult.Continue;
    }
Nianmou commented 2 months ago

So, is it DynamicHook's problem or mine now?

roflmuffin commented 2 months ago

I would probably confirm that this is actually a hot code path using the appropriate tooling (debugger etc.)