public SaveGameDetour GetSaveGameHook(Process game, IntPtr statusPtr) { if (SaveGameDetourT == null) { throw new Exception("No SaveGameDetour type defined"); } var originalPtr = Detour.FindExportedFunc(SaveGameDetourT, game); if (originalPtr != IntPtr.Zero) { return((SaveGameDetour)Activator.CreateInstance(SaveGameDetourT, statusPtr)); } else { return(null); } }
public LoadMapDetour GetLoadMapHook(Process game, IntPtr setMapPtr, IntPtr statusPtr) { if (LoadMapDetourT == null) { throw new Exception("No LoadMapDetour type defined"); } var originalPtr = Detour.FindExportedFunc(LoadMapDetourT, game); if (originalPtr != IntPtr.Zero) { return((LoadMapDetour)Activator.CreateInstance(LoadMapDetourT, setMapPtr, statusPtr)); } else { return(null); } }