Originally Posted by
MaiN
Static classes is syntactic sugar by the C# compiler. It won't change anything.
Maybe your delegate signature/calling convention is wrong?
I agree, I made the entire library static since it made sense... but even after doing that it still has the issue.
As far as I can tell cleanCore is doing it the same way, the only difference now is that I am using an offset directly instead of finding the pattern.. maybe the offset is wrong?
Here's a little code, maybe something stands out to you. The EndScene is hooked properly and gets called and freezes the client when I put a breakpoint on it so I know it's being called from the main thread.
Thanks again!
Code:
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate uint EnumVisibleObjectsDelegate(IntPtr callback, int filter);
private static EnumVisibleObjectsDelegate WoWFunction_enumVisibleObjects;
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate int EnumVisibleObjectsCallBackDelegate(ulong guid, uint filter);
private static EnumVisibleObjectsCallBackDelegate _ourEnumVisibleObjectsCallBack;
private static IntPtr _ourEnumVisibleObjectsCallBackPtr;
// Initialize Object Manager Functions.
uint enumVisibleObjectsOffset = 0x4962F0;
WoWFunction_enumVisibleObjects = Memory.RegisterDelegate<EnumVisibleObjectsDelegate>((uint)Memory.MainModule.BaseAddress + enumVisibleObjectsOffset);
_ourEnumVisibleObjectsCallBack = EnumVisibleObjectsCallBack;
_ourEnumVisibleObjectsCallBackPtr = Marshal.GetFunctionPointerForDelegate(_ourEnumVisibleObjectsCallBack);
private static int EndSceneHook(IntPtr device)
{
lock (_frameLock)
{
WoWFunction_enumVisibleObjects(_ourEnumVisibleObjectsCallBackPtr, 0);
}
return (int)_endSceneHook.CallOriginal(device);
}
private static int EnumVisibleObjectsCallBack(ulong guid, uint filter)
{
return 1;
}