public bool QuadOutOfArea(Quad2 quad) { if (mode != LoadMode.NewGame && mode != LoadMode.LoadGame && mode != LoadMode.NewGameFromScenario) { return(false); } var result = CrossTheLine.IsCrossingLineProhibited(); if (result) { do { }while (!Monitor.TryEnter(_lock, SimulationManager.SYNCHRONIZE_TIMEOUT)); try { RedirectionHelper.RevertJumpTo(_originalPtr, _state); result = Singleton <GameAreaManager> .instance.QuadOutOfArea(quad); RedirectionHelper.PatchJumpTo(_originalPtr, _detourPtr); } finally { Monitor.Exit(_lock); } } return(result); }
private static void DeployBack() { if (_redirects == null) { return; } foreach (var redirect in _redirects) { RedirectionHelper.RevertJumpTo(redirect.Key.MethodHandle.GetFunctionPointer(), _tempState); break; } }
public static void Revert() { if (!_deployed) { return; } if (_originalPtr != IntPtr.Zero && _detourPtr != IntPtr.Zero) { RedirectionHelper.RevertJumpTo(_originalPtr, _state); } _deployed = false; }
private static void RevertTemp() { if (_redirects == null) { return; } foreach (var redirect in _redirects) { _tempState = RedirectionHelper.RevertJumpTo(redirect.Key.MethodHandle.GetFunctionPointer(), redirect.Value); break; } }