public static bool ApplyStashkey(StashKey sk, bool _loadBeforeOperation = true)
        {
            PreApplyStashkey();

            var token = RTC_NetCore.HugeOperationStart("LAZY");

            if (loadBeforeOperation && _loadBeforeOperation)
            {
                if (!LoadStateAndBlastLayer(sk))
                {
                    RTC_NetCore.HugeOperationEnd(token);
                    return(isCorruptionApplied);
                }
            }
            else
            {
                RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.BLAST)
                {
                    blastlayer = sk.BlastLayer, isReplay = true
                });
            }


            RTC_NetCore.HugeOperationEnd(token);

            isCorruptionApplied = (sk.BlastLayer != null && sk.BlastLayer.Layer.Count > 0);

            PostApplyStashkey();
            return(isCorruptionApplied);
        }
Exemple #2
0
        public static void LOAD_SAVESTATE_BEGIN()
        {
            if (DisableRTC)
            {
                return;
            }

            RTC_NetCore.HugeOperationStart();
        }
Exemple #3
0
        public static void LOAD_GAME_BEGIN()
        {
            if (DisableRTC)
            {
                return;
            }

            isNormalAdvance = false;

            RTC_NetCore.HugeOperationStart();

            RTC_HellgenieEngine.ClearCheats(true);
            RTC_PipeEngine.ClearPipes(true);
        }
        public static void AddVMD(VirtualMemoryDomain VMD)
        {
            RTC_MemoryDomains.VmdPool[VMD.ToString()] = VMD;

            if (RTC_Core.isStandalone)
            {
                var token = RTC_NetCore.HugeOperationStart();

                RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.REMOTE_DOMAIN_VMD_ADD)
                {
                    objectValue = VMD.proto
                }, true);

                RTC_NetCore.HugeOperationEnd(token);
            }

            if (!RTC_Hooks.isRemoteRTC)
            {
                RTC_Core.ecForm.RefreshDomainsAndKeepSelected();
            }
        }
 private void track_Intensity_MouseDown(object sender, MouseEventArgs e)
 {
     RTC_NetCore.HugeOperationStart("LAZY");
 }
        public static bool MergeStashkeys(List <StashKey> sks, bool _stashAfterOperation = true)
        {
            PreApplyStashkey();

            if (sks != null && sks.Count > 1)
            {
                var token = RTC_NetCore.HugeOperationStart();


                StashKey master = sks[0];

                string masterSystemCore  = master.SystemCore;
                bool   allCoresIdentical = true;

                foreach (StashKey item in sks)
                {
                    if (item.SystemCore != master.SystemCore)
                    {
                        allCoresIdentical = false;
                        break;
                    }
                }

                if (!allCoresIdentical && !RTC_Core.AllowCrossCoreCorruption)
                {
                    MessageBox.Show("Merge attempt failed: Core mismatch\n\n" + string.Join("\n", sks.Select(it => $"{it.GameName} -> {it.SystemName} -> {it.SystemCore}")));
                    RTC_NetCore.HugeOperationEnd(token);

                    return(false);
                }

                BlastLayer bl = new BlastLayer();

                foreach (StashKey item in sks)
                {
                    bl.Layer.AddRange(item.BlastLayer.Layer);
                }



                currentStashkey             = new StashKey(RTC_Core.GetRandomKey(), master.ParentKey, bl);
                currentStashkey.RomFilename = master.RomFilename;
                currentStashkey.SystemName  = master.SystemName;
                currentStashkey.SystemCore  = master.SystemCore;
                currentStashkey.GameName    = master.GameName;

                //RTC_NetCore.HugeOperationEnd(token);
                token = RTC_NetCore.HugeOperationStart("LAZY");

                if (loadBeforeOperation)
                {
                    if (!LoadStateAndBlastLayer(currentStashkey))
                    {
                        RTC_NetCore.HugeOperationEnd(token);
                        return(isCorruptionApplied);
                    }
                }
                else
                {
                    RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.BLAST)
                    {
                        blastlayer = currentStashkey.BlastLayer
                    });
                }

                isCorruptionApplied = (currentStashkey.BlastLayer != null && currentStashkey.BlastLayer.Layer.Count > 0);

                if (stashAfterOperation && _stashAfterOperation)
                {
                    StashHistory.Add(currentStashkey);
                    RTC_Core.ghForm.RefreshStashHistory();
                }

                RTC_NetCore.HugeOperationEnd(token);

                PostApplyStashkey();
                return(true);
            }
            else
            {
                MessageBox.Show("You need 2 or more items for Merging");
                return(false);
            }
        }
        public static bool Corrupt(bool _loadBeforeOperation = true)
        {
            PreApplyStashkey();

            var token = RTC_NetCore.HugeOperationStart("LAZY");

            StashKey psk = RTC_StockpileManager.getCurrentSavestateStashkey();

            if (psk == null)
            {
                RTC_Core.StopSound();
                MessageBox.Show("The Glitch Harvester could not perform the CORRUPT action\n\nEither no Savestate Box was selected in the Savestate Manager\nor the Savetate Box itself is empty.");
                RTC_Core.StartSound();
                RTC_NetCore.HugeOperationEnd(token);
                return(false);
            }

            string currentGame = (string)RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.REMOTE_KEY_GETGAMENAME), true);

            if (psk.GameName != currentGame)
            {
                RTC_Core.LoadRom(psk.RomFilename, true);
                RTC_Core.ecForm.RefreshDomains();
                RTC_Core.ecForm.setMemoryDomainsAllButSelectedDomains(RTC_MemoryDomains.GetBlacklistedDomains());
            }



            BlastLayer bl = (BlastLayer)RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.BLAST)
            {
                objectValue = RTC_MemoryDomains.SelectedDomains
            }, true);

            currentStashkey             = new StashKey(RTC_Core.GetRandomKey(), psk.ParentKey, bl);
            currentStashkey.RomFilename = psk.RomFilename;
            currentStashkey.SystemName  = psk.SystemName;
            currentStashkey.SystemCore  = psk.SystemCore;
            currentStashkey.GameName    = psk.GameName;

            if (loadBeforeOperation && _loadBeforeOperation)
            {
                if (!LoadStateAndBlastLayer(currentStashkey))
                {
                    RTC_NetCore.HugeOperationEnd(token);
                    return(isCorruptionApplied);
                }
            }
            else
            {
                RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.BLAST)
                {
                    blastlayer = bl
                });
            }

            isCorruptionApplied = (bl != null);

            if (stashAfterOperation && bl != null)
            {
                StashHistory.Add(currentStashkey);
                RTC_Core.ghForm.RefreshStashHistory();
                RTC_Core.ghForm.dgvStockpile.ClearSelection();
                RTC_Core.ghForm.DontLoadSelectedStash        = true;
                RTC_Core.ghForm.lbStashHistory.SelectedIndex = RTC_Core.ghForm.lbStashHistory.Items.Count - 1;
            }

            RTC_NetCore.HugeOperationEnd(token);

            PostApplyStashkey();
            return(isCorruptionApplied);
        }