private static void STEP_CORRUPT(bool _isRewinding, bool _isFastForwarding)         //errors trapped by CPU_STEP
        {
            if (disableRTC)
            {
                return;
            }

            if (!_isRewinding)
            {
                StepActions.Execute();
            }

            if (_isRewinding || _isFastForwarding)
            {
                return;
            }

            CPU_STEP_Count++;

            bool autoCorrupt = CorruptCore.AutoCorrupt;
            long errorDelay  = CorruptCore.ErrorDelay;

            if (autoCorrupt && CPU_STEP_Count >= errorDelay)
            {
                CPU_STEP_Count = 0;
                BlastLayer bl = CorruptCore.GenerateBlastLayer((string[])RTCV.NetCore.AllSpec.UISpec["SELECTEDDOMAINS"]);
                if (bl != null)
                {
                    bl.Apply(false, true);
                }
            }
        }
Exemplo n.º 2
0
		private static void STEP_REWIND() //errors trapped by CPU_STEP
		{
			if (disableRTC) return;

			if (StepActions.ClearStepActionsOnRewind)
				StepActions.ClearStepBlastUnits();
		}
Exemplo n.º 3
0
    public List <StepAction> GetStepAction()
    {
        // Read the data
        string      path         = Application.streamingAssetsPath + "/" + actFileName;
        string      jsonString   = File.ReadAllText(path);
        StepActions _stepActions = JsonUtility.FromJson <StepActions>(jsonString);

        return(_stepActions.data);
    }
Exemplo n.º 4
0
		public static void LOAD_GAME_BEGIN()
		{
			try
			{
				if (disableRTC) return;

				isNormalAdvance = false;

				StepActions.ClearStepBlastUnits();
				RtcClock.ResetCount();
			}
			catch (Exception ex)
			{
				if (VanguardCore.ShowErrorDialog(ex) == DialogResult.Abort)
					throw new AbortEverythingException();
			}
		}
        public static void CPU_STEP(bool isRewinding, bool isFastForwarding, bool isBeforeStep = false)
        {
            try
            {
                if (disableRTC)
                {
                    return;
                }

                //Return out if it's being called from before the step and we're not on frame 0. If we're on frame 0, then we go as normal
                //If we can't get runbefore, just assume we don't want to run before
                if (isBeforeStep && CPU_STEP_Count != 0 && ((bool)(RTCV.NetCore.AllSpec.CorruptCoreSpec?[RTCSPEC.STEP_RUNBEFORE.ToString()] ?? false)) == false)
                {
                    return;
                }

                isNormalAdvance = !(isRewinding || isFastForwarding);

                // Unique step hooks
                if (!isRewinding && !isFastForwarding)
                {
                    STEP_FORWARD();
                }
                else if (isRewinding)
                {
                    STEP_REWIND();
                }
                else if (isFastForwarding)
                {
                    STEP_FASTFORWARD();
                }

                //Any step hook for corruption
                STEP_CORRUPT(isRewinding, isFastForwarding);
            }
            catch (Exception ex)
            {
                if (VanguardCore.ShowErrorDialog(ex, true) == DialogResult.Abort)
                {
                    throw new RTCV.NetCore.AbortEverythingException();
                }
                MessageBox.Show("Clearing all step blastunits due to an exception within Core_Step().");
                StepActions.ClearStepBlastUnits();
            }
        }
Exemplo n.º 6
0
		public static void CPU_STEP(bool isRewinding, bool isFastForwarding, bool isBeforeStep = false)
		{
			try
			{
				if (disableRTC || Global.Emulator is NullEmulator)
					return;

				bool runBefore = (bool)(AllSpec.CorruptCoreSpec?[RTCSPEC.STEP_RUNBEFORE.ToString()] ?? false);

				//Return out if it's being called from before the step and we're not on frame 0. If we're on frame 0, then we go as normal
				//If we can't get runbefore, just assume we don't want to run before
				if (isBeforeStep && runBefore == false)
					return;
				if (runBefore)
				{
					AllSpec.CorruptCoreSpec.Update(RTCSPEC.STEP_RUNBEFORE.ToString(), false);
				}

				isNormalAdvance = !(isRewinding || isFastForwarding);

				bool isForward = (!isRewinding && !isFastForwarding);

				// Unique step hooks
				if (isForward)
					STEP_FORWARD();
				else if (isRewinding)
					STEP_REWIND();
				else if (isFastForwarding)
					STEP_FASTFORWARD();

				//Any step hook for corruption
				STEP_CORRUPT(isRewinding, isFastForwarding);
				VanguardCore.RTE_API.ON_STEP(isForward, isRewinding, isFastForwarding);
			}
			catch (Exception ex)
			{
				if (VanguardCore.ShowErrorDialog(ex, true) == DialogResult.Abort)
					throw new AbortEverythingException();
				MessageBox.Show("Clearing all step blastunits due to an exception within Core_Step().");
				LocalNetCoreRouter.Route(Endpoints.UI, Basic.ErrorDisableAutoCorrupt, false);
				StepActions.ClearStepBlastUnits();
			}
		}
        public static void CLOSE_GAME(bool loadDefault = false)
        {
            try
            {
                if (disableRTC)
                {
                    return;
                }

                if (CLOSE_GAME_loop_flag == true)
                {
                    return;
                }

                CLOSE_GAME_loop_flag = true;

                //RTC_Core.AutoCorrupt = false;

                StepActions.ClearStepBlastUnits();

                MemoryDomains.Clear();

                VanguardCore.OpenRomFilename = null;

                if (loadDefault)
                {
                    VanguardCore.LoadDefaultRom();
                }

                //RTC_RPC.SendToKillSwitch("UNFREEZE");

                CLOSE_GAME_loop_flag = false;
            }
            catch (Exception ex)
            {
                if (VanguardCore.ShowErrorDialog(ex) == DialogResult.Abort)
                {
                    throw new RTCV.NetCore.AbortEverythingException();
                }
            }
        }
        public static void LOAD_GAME_BEGIN()
        {
            try
            {
                if (disableRTC)
                {
                    return;
                }

                isNormalAdvance = false;

                StepActions.ClearStepBlastUnits();
                CPU_STEP_Count = 0;
            }
            catch (Exception ex)
            {
                if (VanguardCore.ShowErrorDialog(ex) == DialogResult.Abort)
                {
                    throw new RTCV.NetCore.AbortEverythingException();
                }
            }
        }
Exemplo n.º 9
0
        public static void STEP_CORRUPT(bool executeActions, bool performStep)
        {
            if (executeActions)
            {
                StepActions.Execute();
            }

            if (performStep)
            {
                CPU_STEP_Count++;

                bool autoCorrupt = RtcCore.AutoCorrupt;
                long errorDelay  = RtcCore.ErrorDelay;
                if (autoCorrupt && CPU_STEP_Count >= errorDelay)
                {
                    CPU_STEP_Count = 0;
                    BlastLayer bl = RtcCore.GenerateBlastLayer((string[])AllSpec.UISpec["SELECTEDDOMAINS"]);
                    if (bl != null)
                    {
                        bl.Apply(false, false);
                    }
                }
            }
        }
Exemplo n.º 10
0
		public static void CLOSE_GAME(bool loadDefault = false)
		{
			try
			{
				if (disableRTC) return;

				if (CLOSE_GAME_loop_flag)
					return;

				CLOSE_GAME_loop_flag = true;

				//RTC_Core.AutoCorrupt = false;

				StepActions.ClearStepBlastUnits();

				MemoryDomains.Clear();

				VanguardCore.OpenRomFilename = null;

				if (loadDefault)
					VanguardCore.LoadDefaultRom();

				//RTC_RPC.SendToKillSwitch("UNFREEZE");

				CLOSE_GAME_loop_flag = false;

				RtcCore.InvokeGameClosed();
				VanguardCore.RTE_API.GAME_CLOSED();

			}
			catch (Exception ex)
			{
				if (VanguardCore.ShowErrorDialog(ex) == DialogResult.Abort)
					throw new AbortEverythingException();
			}
		}
Exemplo n.º 11
0
        private static void RenameVMD(string vmdName)
        {
            if (!MemoryDomains.VmdPool.ContainsKey(vmdName))
            {
                return;
            }

            string name  = "";
            string value = "";

            if (UI_Extensions.GetInputBox("BlastLayer to VMD", "Enter the new VMD name:", ref value) == DialogResult.OK)
            {
                name = value.Trim();
            }
            else
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                name = CorruptCore.RtcCore.GetRandomKey();
            }

            if (MemoryDomains.VmdPool.ContainsKey(name))
            {
                MessageBox.Show("There's already a VMD with this name. Aborting rename.");
                return;
            }

            VirtualMemoryDomain VMD = MemoryDomains.VmdPool[vmdName];

            MemoryDomains.RemoveVMD(VMD);
            VMD.Name          = name;
            VMD.Proto.VmdName = name;
            MemoryDomains.AddVMD(VMD);

            foreach (BlastUnit bu in StepActions.GetRawBlastLayer().Layer)
            {
                if (bu.Domain == vmdName)
                {
                    bu.Domain = "[V]" + name;
                }

                if (bu.SourceDomain == vmdName)
                {
                    bu.SourceDomain = "[V]" + name;
                }
            }
            //Go through the stash history and update any references
            foreach (StashKey sk in S.GET <RTC_StashHistory_Form>().lbStashHistory.Items)
            {
                foreach (var bu in sk.BlastLayer.Layer)
                {
                    if (bu.Domain == vmdName)
                    {
                        bu.Domain = "[V]" + name;
                    }

                    if (bu.SourceDomain == vmdName)
                    {
                        bu.SourceDomain = "[V]" + name;
                    }
                }
            }
            //CurrentStashKey can be separate
            if (StockpileManager_UISide.CurrentStashkey != null)
            {
                foreach (var bu in StockpileManager_UISide.CurrentStashkey.BlastLayer.Layer.Where(x => x.Domain == vmdName || x.SourceDomain == vmdName))
                {
                    if (bu.Domain == vmdName)
                    {
                        bu.Domain = "[V]" + name;
                    }

                    if (bu.SourceDomain == vmdName)
                    {
                        bu.SourceDomain = "[V]" + name;
                    }
                }
            }
        }
        private void ParseElementChildNodes(XmlElement parentElement)
        {
            foreach (var node in parentElement.ChildNodes)
            {
                var element = node as XmlElement;

                if (element == null)
                {
                    continue;
                }

                switch (element.Name)
                {
                case FRAMES:
                    hasFrameTags = !hasFrameTags;
                    if (!hasFrameTags)
                    {
                        throw new AAMLConfigurationException();
                    }

                    foreach (var frame in Regex.Split(element.InnerText, FRAME_SEPARATOR_REGEX))
                    {
                        StepActions.Add(new FrameAnimationStepAction(StateName + frame));
                    }
                    break;

                case STEP_ACTIONS:
                    hasFrameTags = !hasFrameTags;
                    if (!hasFrameTags)
                    {
                        throw new AAMLConfigurationException();
                    }
                    ParseElementChildNodes(element);
                    break;

                // Step Action Inner Tags
                case FRAME:
                    StepActions.Add(
                        new FrameAnimationStepAction(element.InnerText));
                    break;

                case WAIT:
                    int waitFrame = Convert.ToInt32(
                        Regex.Match(element.InnerText, INT_REGEX).Groups[1].Value);
                    StepActions.Add(new WaitAnimationStepAction(waitFrame));
                    break;

                case SOUND:
                    throw new NotImplementedException();
                // Not done

                /*
                 * if (element.InnerText.Contains(UriUtilities.URI_SEPARATOR))
                 * {
                 *  AssetLoader.Load<SoundEffect>(element.InnerText);
                 * }
                 * else
                 * {
                 *  AssetLoader.LoadUsingExtension(element.InnerText);
                 * }
                 */

                case CALL_FUNCTION:
                    throw new NotImplementedException();

                case REVERSE:
                    StepActions.Add(new ReverseAnimationStepAction());
                    break;

                case REPEAT:
                    ParseElementAttributes(element);

                    for (int i = repeatStart; i < repeatEnd + 1; i += repeatStep)
                    {
                        foreach (var repeatNode in element.ChildNodes)
                        {
                            var repeatElement = repeatNode as XmlElement;

                            if (repeatElement == null)
                            {
                                continue;
                            }

                            switch (repeatElement.Name)
                            {
                            case FRAME:
                                StepActions.Add(new FrameAnimationStepAction(StateName + i));
                                break;

                            case WAIT:
                                int repWaitFrame = Convert.ToInt32(Regex.Match(repeatElement.InnerText, INT_REGEX).Groups[1].Value);
                                StepActions.Add(new WaitAnimationStepAction(repWaitFrame));
                                break;

                            default:
                                break;
                            }
                        }
                    }
                    break;

                // Optional Inner Tags
                case FRAME_DURATION:
                    StepActions.Add(new WaitAnimationStepAction(Convert.ToInt32(Regex.Match(element.InnerText, POS_INT_REGEX))));
                    break;

                case LOOP_TYPE:
                    string type = element.InnerText.Trim().ToLower();

                    if (type.Equals("cycle"))
                    {
                        StepActions.Add(new FrameAnimationStepAction(StateName + "0"));
                    }
                    else if (type.Equals("reverse"))
                    {
                        StepActions.Add(new ReverseAnimationStepAction());
                    }

                    break;

                case LOOP_COUNT:
                    break;

                // Timing elements
                case WHEN_FINISHED:
                    ParseElementChildNodes(element);
                    break;

                case WHEN_AFTER:
                    // Check for time attribute then childNodes
                    break;

                // Inner timing elements
                case ENTER:
                    StepActions.Add(new EnterAnimationStepAction(element.InnerText.Trim()));
                    break;

                case JUMP_TO:
                    if (Regex.IsMatch(element.InnerText, POS_INT_REGEX))
                    {
                        StepActions.Add(new JumpToAnimationStepAction(Convert.ToInt32(Regex.Match(element.InnerText, POS_INT_REGEX).Groups[1])));
                    }
                    break;

                default:
                    break;
                }
            }
        }