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); }
public static void LOAD_SAVESTATE_END() { if (DisableRTC) { return; } RTC_NetCore.HugeOperationEnd(); }
public static void LOAD_GAME_FAILED() { if (DisableRTC) { return; } RTC_NetCore.HugeOperationEnd(); }
public static void LOAD_GAME_DONE() { if (DisableRTC) { return; } //RTC_HellgenieEngine.ClearCheats(); //RTC_PipeEngine.ClearPipes(); //Glitch Harvester warning for archives string uppercaseFilename = GlobalWin.MainForm.CurrentlyOpenRom.ToUpper(); if (RTC_Core.ghForm.Visible && (uppercaseFilename.Contains(".ZIP") || uppercaseFilename.Contains(".7Z"))) { MessageBox.Show($"The rom {RTC_Extensions.getShortFilenameFromPath(uppercaseFilename)} is in an archive and can't be added to a Stockpile"); } //Load Game vars into RTC_Core PathEntry pathEntry = Global.Config.PathEntries[Global.Game.System, "Savestates"] ?? Global.Config.PathEntries[Global.Game.System, "Base"]; RTC_StockpileManager.currentGameSystem = RTC_Core.EmuFolderCheck(pathEntry.SystemDisplayName); RTC_StockpileManager.currentGameName = PathManager.FilesystemSafeName(Global.Game); RTC_Core.lastOpenRom = GlobalWin.MainForm.CurrentlyOpenRom; RTC_RPC.RefreshPlugin(); //prepare memory domains in advance on bizhawk side RTC_MemoryDomains.RefreshDomains(false); if (RTC_StockpileManager.currentGameName != lastGameName) { RTC_Core.SendCommandToRTC(new RTC_Command(CommandType.REMOTE_EVENT_LOADGAMEDONE_NEWGAME)); } else { RTC_Core.SendCommandToRTC(new RTC_Command(CommandType.REMOTE_EVENT_LOADGAMEDONE_SAMEGAME)); } lastGameName = RTC_StockpileManager.currentGameName; //RTC_Restore.SaveRestore(); RTC_NetCore.HugeOperationEnd(); }
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_MouseUp(object sender, MouseEventArgs e) { RTC_NetCore.HugeOperationEnd(); track_Intensity_Scroll(sender, e); }
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); }