// Update Pointers public SniperPatrol UpdatePointers(SniperPatrol patrol, IntPtr PosPtr, IntPtr DelayPtr) { SniperPatrol newPatrol = new SniperPatrol(); // Copy deep pointers newPatrol.DP_Pos = patrol.DP_Pos; newPatrol.DP_Delay = patrol.DP_Delay; // asign updated int pointers newPatrol.PosPtr = PosPtr; newPatrol.DelayPtr = DelayPtr; // copy values newPatrol.Pos = patrol.Pos; newPatrol.Delay = patrol.Delay; return(newPatrol); }
protected override void DerefPointer(Process game) { base.DerefPointer(game); // Deref patrol pointers for (int i = 0; i < patrolPoints.Count; i++) { IntPtr posPtr, delayPtr; patrolPoints[i].DP_Pos.DerefOffsets(game, out posPtr); patrolPoints[i].DP_Delay.DerefOffsets(game, out delayPtr); // update struct patrolPoints[i] = new SniperPatrol().UpdatePointers(patrolPoints[i], posPtr, delayPtr); } // Deref focus pointers for (int i = 0; i < focusPoints.Count; i++) { IntPtr posPtr, delayPtr; focusPoints[i].DP_Pos.DerefOffsets(game, out posPtr); focusPoints[i].DP_Delay.DerefOffsets(game, out delayPtr); // update struct focusPoints[i] = new SniperPatrol().UpdatePointers(focusPoints[i], posPtr, delayPtr); } }