Ejemplo n.º 1
0
		private static void STEP_CORRUPT(bool _isRewinding, bool _isFastForwarding) //errors trapped by CPU_STEP
		{
			if (disableRTC) return;

			bool executeActions = !_isRewinding; //keep active unit executing when forwarding and fast forwarding
			bool performStep = (!_isRewinding && !_isFastForwarding); //don't corrupt when altering time

			RtcClock.StepCorrupt(executeActions, performStep);

		}
Ejemplo n.º 2
0
        private static void CorruptTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            lock (CorruptLock)
            {
                if (!VanguardCore.vanguardConnected || AllSpec.CorruptCoreSpec == null || (p?.HasExited ?? true))
                {
                    AutoCorruptTimer.Start();
                    return;
                }

                try
                {
                    if (!DontChangeMemoryProtection)
                    {
                        foreach (var m in MemoryDomains.MemoryInterfaces?.Values ?? Enumerable.Empty <MemoryDomainProxy>())
                        {
                            if (m.MD is ProcessMemoryDomain pmd)
                            {
                                pmd.SetMemoryProtection(ProcessExtensions.MemoryProtection.ExecuteReadWrite);
                                if (p?.HasExited ?? false)
                                {
                                    Console.WriteLine($"Bad! {pmd.Name}");
                                }
                            }
                        }
                    }

                    try
                    {
                        RtcClock.StepCorrupt(true, true);

                        if (p?.HasExited ?? false)
                        {
                            Console.WriteLine($"Bad2!");
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine($"STEP_CORRUPT Error!\n{ex.Message}\n{ex.StackTrace}");
                    }
                }
                finally
                {
                    if (!DontChangeMemoryProtection)
                    {
                        foreach (var m in MemoryDomains.MemoryInterfaces?.Values ?? Enumerable.Empty <MemoryDomainProxy>())
                        {
                            if (m.MD is ProcessMemoryDomain pmd)
                            {
                                pmd.ResetMemoryProtection();
                                pmd.FlushInstructionCache();
                            }

                            if (p?.HasExited ?? false)
                            {
                                Console.WriteLine($"Bad3!");
                            }
                        }
                    }
                }
            }

            if (p.HasExited)
            {
                Console.WriteLine($"Bad4!");
            }
            AutoCorruptTimer.Start();
        }