private void InitQuestCacheCallback() { _questCacheCallbackDelegate = QuestCacheCallbackHookFunc; var addrToDetour = Marshal.GetFunctionPointerForDelegate(_questCacheCallbackDelegate); string[] asmCode = { //"pushfd", //"pushad", //"push ecx", "call " + (uint)addrToDetour, //"popad", //"popfd", "retn 0x8" }; QuestCallbackPtr = Memory.InjectAsm(asmCode, "QuestCacheCallbackDetour"); Console.WriteLine(QuestCallbackPtr.ToString("X")); }
private void InitItemCacheCallback() { // Pointer the delegate to our c# function _itemCacheCallbackDelegate = ItemCacheCallbackHookFunc; // get PTR for our c# function var addrToDetour = Marshal.GetFunctionPointerForDelegate(_itemCacheCallbackDelegate); // Alloc space for the ASM part of our detour string[] asmCode = { //"pushfd", //"pushad", "call " + (uint)addrToDetour, //"popad", //"popfd", //"call 0x4FB0F0", "retn 0x8" }; // Inject the asm code which calls our c# function ItemCallbackPtr = Memory.InjectAsm(asmCode, "ItemCacheCallbackDetour"); }