예제 #1
0
        public CorruptCloudGameData(StashKey key)
        {
            PathEntry pathEntry = Global.Config.PathEntries[Global.Game.System, "Savestates"] ??
                                  Global.Config.PathEntries[Global.Game.System, "Base"];

            fileHash = Global.Game.Hash;

            originalFileName = GlobalWin.MainForm.CurrentlyOpenRom;

            if (originalFileName.IndexOf("\\") != -1)
            {
                originalFileName = originalFileName.Substring(originalFileName.LastIndexOf("\\") + 1);
            }

            originalGameName   = PathManager.FilesystemSafeName(Global.Game);
            originalGameSystem = RTC_Core.EmuFolderCheck(pathEntry.SystemDisplayName);

            if (key.ParentKey == null)
            {
                originalKey = key.Key;
            }
            else
            {
                originalKey = key.ParentKey;
            }


            string originalSavestateFilename = key.GameName + "." + key.ParentKey + ".timejump.State"; // get savestate name

            originalSavestate = File.ReadAllBytes(RTC_Core.bizhawkDir + "\\" + key.GameSystem + "\\State\\" + originalSavestateFilename);

            originalKey = RTC_Core.GetRandomKey();
        }
예제 #2
0
        public static void RenameVMD(string vmdName)
        {
            if (!RTC_MemoryDomains.VmdPool.ContainsKey(vmdName))
            {
                return;
            }

            RTC_Core.StopSound();
            string Name  = "";
            string value = "";

            if (RTC_Extensions.getInputBox("BlastLayer to VMD", "Enter the new VMD name:", ref value) == DialogResult.OK)
            {
                Name = value.Trim();
                RTC_Core.StartSound();
            }
            else
            {
                RTC_Core.StartSound();
                return;
            }

            if (string.IsNullOrWhiteSpace(Name))
            {
                Name = RTC_Core.GetRandomKey();
            }

            VirtualMemoryDomain VMD = (VirtualMemoryDomain)RTC_MemoryDomains.VmdPool[vmdName];

            RemoveVMD(VMD);
            VMD.name          = Name;
            VMD.proto.VmdName = Name;
            AddVMD(VMD);
        }
예제 #3
0
        public void StartRender()
        {
            if (!rbRenderNone.Checked) // Render Output
            {
                string Key = "RENDER_";

                if (cbRenderAtLoad.Checked && RTC_Core.currentStashkey != null)
                {
                    Key += RTC_Core.currentStashkey.Alias;
                }
                else
                {
                    Key += RTC_Core.GetRandomKey();
                }


                if (rbRenderWAV.Checked)
                {
                    GlobalWin.MainForm._RecordAv("wave", RTC_Core.rtcDir + "\\RENDEROUTPUT\\" + Key + ".wav", true);
                }

                if (rbRenderAVI.Checked)
                {
                    GlobalWin.MainForm._RecordAv("vfwavi", RTC_Core.rtcDir + "\\RENDEROUTPUT\\" + Key + ".avi", true);
                }

                if (rbRenderMPEG.Checked)
                {
                    GlobalWin.MainForm._RecordAv("ffmpeg", RTC_Core.rtcDir + "\\RENDEROUTPUT/" + Key + ".mpg", true);
                }

                btnStopRender.Visible  = true;
                btnStartRender.Visible = false;
            }
        }
        public static void AddDump()
        {
            MemoryStream ms = new MemoryStream();


            if (ActiveTableDumps == null)
            {
                return;
            }

            List <byte> newDump = new List <byte>();

            for (long i = 0; i < RTC_Core.hexeditor._domain.Size; i++)
            {
                newDump.Add(RTC_Core.hexeditor._domain.PeekByte(i));
            }

            string key = RTC_Core.GetRandomKey();

            File.WriteAllBytes(RTC_Core.rtcDir + "\\MEMORYDUMPS\\" + key + ".dmp", newDump.ToArray());
            ActiveTableDumps.Add(key);

            RTC_Core.coreForm.lbFreezeEngineNbDumps.Text = "Memory dumps collected: " + ActiveTableDumps.Count.ToString();

            GC.Collect();
            GC.WaitForPendingFinalizers();
        }
        public static BlastCheat GenerateUnit(string _domain, long _address)
        {
            try
            {
                BizHawk.Client.Common.DisplayType _displaytype = BizHawk.Client.Common.DisplayType.Unsigned;
                bool _bigEndian = false;
                int  _value     = 0;
                long Address    = 0;

                if (RTC_Core.coreForm.cbFreezeEngineActive.Checked && ActiveTableReady)
                {
                    Address = GetAdressFromActiveTable();
                }
                else
                {
                    Address = RTC_Core.LongRandom(RTC_Core.hexeditor._domain.Size);
                }

                return(new BlastCheat(_domain, Address, _displaytype, _bigEndian, _value, true, true));
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something went wrong in the RTC Freeze Engine. \n" +
                                "This is not a BizHawk error so you should probably send a screenshot of this to the devs\n\n" +
                                ex.ToString());
                return(null);
            }
        }
예제 #6
0
        private void RTC_Form_Load(object sender, EventArgs e)
        {
            btnLogo.Text = "    Version " + RTC_Core.RtcVersion;


            if (!RTC_Params.IsParamSet("DISCLAIMER_READ"))
            {
                MessageBox.Show(File.ReadAllText(RTC_Core.rtcDir + "\\LICENSES\\DISCLAIMER.TXT").Replace("[ver]", RTC_Core.RtcVersion), "RTC", MessageBoxButtons.OK, MessageBoxIcon.Information);
                RTC_Params.SetParam("DISCLAIMER_READ");
            }

            RTC_Core.CheckForProblematicProcesses();

            if (RTC_Core.isStandalone)
            {
                GhostBoxInvisible(btnEasyMode);
                GhostBoxInvisible(btnEngineConfig);
                GhostBoxInvisible(btnGlitchHarvester);
                GhostBoxInvisible(btnStockpilePlayer);
                GhostBoxInvisible(btnRTCMultiplayer);
                GhostBoxInvisible(btnManualBlast);
                GhostBoxInvisible(btnAutoCorrupt);
                GhostBoxInvisible(pnCrashProtection);
            }
            else
            {
                btnEngineConfig_Click(sender, e);
                pnCrashProtectionUnavailable.Visible = true;
            }
        }
예제 #7
0
        private void RTC_Form_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!RTC_Core.isStandalone && e.CloseReason != CloseReason.FormOwnerClosing)
            {
                e.Cancel = true;
                this.Hide();
                return;
            }
            else if (RTC_Core.isStandalone)
            {
                if (RTC_StockpileManager.unsavedEdits && !RTC_Core.isClosing && MessageBox.Show("You have unsaved edits in the Glitch Harvester Stockpile. \n\n Are you sure you want to close RTC without saving?", "Unsaved edits in Stockpile", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    e.Cancel = true;
                    return;
                }

                if (RTC_Core.RemoteRTC_SupposedToBeConnected)
                {
                    RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.REMOTE_EVENT_CLOSEBIZHAWK));
                    Thread.Sleep(1000);
                }

                RTC_Core.CloseAllRtcForms();
            }
        }
예제 #8
0
        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);
        }
예제 #9
0
        private void cbBlastRadius_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (cbBlastRadius.SelectedItem.ToString())
            {
            case "SPREAD":
                RTC_Core.Radius = BlastRadius.SPREAD;
                break;

            case "CHUNK":
                RTC_Core.Radius = BlastRadius.CHUNK;
                break;

            case "BURST":
                RTC_Core.Radius = BlastRadius.BURST;
                break;

            case "NORMALIZED":
                RTC_Core.Radius = BlastRadius.NORMALIZED;
                break;

            case "PROPORTIONAL":
                RTC_Core.Radius = BlastRadius.PROPORTIONAL;
                break;

            case "EVEN":
                RTC_Core.Radius = BlastRadius.EVEN;
                break;
            }

            RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.REMOTE_SET_BLASTRADIUS)
            {
                objectValue = RTC_Core.Radius
            });
        }
예제 #10
0
 public static void ClearPipes(bool sync = false)
 {
     if (!LockPipes)
     {
         RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.REMOTE_SET_PIPE_CLEARPIPES), sync);
     }
 }
예제 #11
0
        public static void LoadDefaultRom()
        {
            //Loads a NES-based title screen.
            //Can be overriden by putting a file named "overridedefault.nes" in the ASSETS folder

            int newNumber = lastLoaderRom;

            while (newNumber == lastLoaderRom)
            {
                newNumber = RTC_Core.RND.Next(1, 17);

                if (newNumber != lastLoaderRom)
                {
                    if (File.Exists(RTC_Core.rtcDir + "\\ASSETS\\" + "overridedefault.nes"))
                    {
                        RTC_Core.LoadRom(RTC_Core.rtcDir + "\\ASSETS\\" + "overridedefault.nes");
                    }
                    else
                    {
                        RTC_Core.LoadRom(RTC_Core.rtcDir + "\\ASSETS\\" + newNumber.ToString() + "default.nes");
                    }

                    lastLoaderRom = newNumber;
                    break;
                }
            }
        }
예제 #12
0
        static void STEP_CORRUPT(bool _isRewinding, bool _isFastForwarding, bool _isPaused)
        {
            if (DisableRTC)
            {
                return;
            }

            if (!_isRewinding && !_isPaused)
            {
                if (RTC_PipeEngine.ProcessOnStep)
                {
                    RTC_PipeEngine.ExecutePipes();
                }
            }

            if (_isRewinding || _isFastForwarding || _isPaused)
            {
                return;
            }


            CPU_STEP_Count++;

            if (RTC_Core.AutoCorrupt && CPU_STEP_Count >= RTC_Core.ErrorDelay)
            {
                CPU_STEP_Count = 0;
                BlastLayer bl = RTC_Core.Blast(null, RTC_MemoryDomains.SelectedDomains);
                if (bl != null)
                {
                    bl.Apply();
                }
            }
        }
예제 #13
0
        public static void StartRender_NET()
        {
            isRendering = true;
            if (lastType == RENDERTYPE.NONE)
            {
                return;
            }

            string Key = "RENDER_" + (RTC_Core.GetRandomKey());

            if (lastType == RENDERTYPE.WAV)
            {
                GlobalWin.MainForm.RecordAvBase("wave", RTC_Core.rtcDir + "\\RENDEROUTPUT\\" + Key + ".wav", true);
            }
            else if (lastType == RENDERTYPE.AVI)
            {
                try
                {
                    GlobalWin.MainForm.RecordAvBase("vfwavi", RTC_Core.rtcDir + "\\RENDEROUTPUT\\" + Key + ".avi", true);
                }
                catch (Exception ex)
                {
                    throw new Exception("Rendering AVI Failed. \nIf you haven't already, you need to set a codec in bizhawk before starting an AVI Render. \nThe menu for config is at: File -> AVI/WAV -> Config.\n\n" + ex.ToString());
                }
            }
            else if (lastType == RENDERTYPE.MPEG)
            {
                GlobalWin.MainForm.RecordAvBase("ffmpeg", RTC_Core.rtcDir + "\\RENDEROUTPUT\\" + Key + ".mpg", true);
            }

            RTC_Core.SendCommandToRTC(new RTC_Command(CommandType.REMOTE_RENDER_STARTED));
        }
예제 #14
0
        private void cbCustomPrecision_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cbCustomPrecision.SelectedIndex != -1)
            {
                cbUseCustomPrecision.Checked = true;

                switch (cbCustomPrecision.SelectedIndex)
                {
                case 0:
                    RTC_Core.CustomPrecision = 1;
                    break;

                case 1:
                    RTC_Core.CustomPrecision = 2;
                    break;

                case 2:
                    RTC_Core.CustomPrecision = 4;
                    break;
                }

                RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.REMOTE_SET_CUSTOMPRECISION)
                {
                    objectValue = RTC_Core.CustomPrecision
                });
            }
        }
예제 #15
0
        public static object GetValue(Guid WatchedGuid, CommandType type)
        {
            //await Task.Factory.StartNew(() => WaitForValue(WatchedGuid));
            Console.WriteLine("GetValue:Awaiting -> " + type.ToString());

            maxtries = 0;

            while (!SyncReturns.ContainsKey(WatchedGuid) && maxtries < RTC_NetCore.DefaultMaxRetries)
            {
                maxtries++;
                //WaitMiliseconds(2);

                if (maxtries % 100 == 0)
                {
                    RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.BOOP));
                    System.Windows.Forms.Application.DoEvents();
                }

                Thread.Sleep(2);
            }

            if (maxtries >= RTC_NetCore.DefaultMaxRetries)
            {
                //MessageBox.Show("An inter-thread synchronous method has timed before a response arrived. Aborting current procedure.");
                return(null);
            }

            object ret = SyncReturns[WatchedGuid];

            SyncReturns.Remove(WatchedGuid);

            Console.WriteLine("GetValue:Returned -> " + type.ToString());

            return(ret);
        }
예제 #16
0
 public static StashKey SaveState(bool SendToStashDico, StashKey _sk = null, bool sync = true)
 {
     return((StashKey)RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.REMOTE_SAVESTATE)
     {
         objectValue = new object[] { SendToStashDico, _sk }
     }, sync));
 }
예제 #17
0
 public static bool LoadState(StashKey sk, bool ReloadRom = true, bool applyBlastLayer = true)
 {
     return((bool)RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.REMOTE_LOADSTATE)
     {
         objectValue = new object[] { sk, ReloadRom, false, applyBlastLayer }
     }, true));
 }
예제 #18
0
        public static void LoadRom_NET(string RomFile)
        {
            // -> EmuHawk Process only
            //Loads a rom inside Bizhawk from a Filename.

            RTC_Core.StopSound();

            var args = new BizHawk.Client.EmuHawk.MainForm.LoadRomArgs();

            if (RomFile == null)
            {
                RomFile = GlobalWin.MainForm.CurrentlyOpenRom;
            }

            var lra = new BizHawk.Client.EmuHawk.MainForm.LoadRomArgs {
                OpenAdvanced = new OpenAdvanced_OpenRom {
                    Path = RomFile
                }
            };

            RTC_Hooks.AllowCaptureRewindState = false;
            GlobalWin.MainForm.LoadRom(RomFile, lra);
            RTC_Hooks.AllowCaptureRewindState = true;

            RTC_Core.StartSound();
        }
예제 #19
0
        public static void CLOSE_GAME(bool loadDefault = false)
        {
            if (DisableRTC)
            {
                return;
            }

            if (CLOSE_GAME_loop_flag == true)
            {
                return;
            }

            CLOSE_GAME_loop_flag = true;

            //RTC_Core.AutoCorrupt = false;

            RTC_PipeEngine.ClearPipes();
            RTC_MemoryDomains.Clear();

            RTC_Core.lastOpenRom = null;

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

            //RTC_RPC.SendToKillSwitch("UNFREEZE");

            CLOSE_GAME_loop_flag = false;
        }
예제 #20
0
 private void nmMaxPipes_ValueChanged(object sender, EventArgs e)
 {
     RTC_PipeEngine.MaxPipes = Convert.ToInt32(nmMaxPipes.Value);
     RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.REMOTE_SET_PIPE_MAXPIPES)
     {
         objectValue = RTC_PipeEngine.MaxPipes
     });
 }
예제 #21
0
 private void cbGenerateChainedPipes_CheckedChanged(object sender, EventArgs e)
 {
     RTC_PipeEngine.ChainedPipes = cbGenerateChainedPipes.Checked;
     RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.REMOTE_SET_PIPE_CHAINEDPIPES)
     {
         objectValue = RTC_PipeEngine.ChainedPipes
     });
 }
예제 #22
0
 private void cbProcessOnStep_CheckedChanged(object sender, EventArgs e)
 {
     RTC_PipeEngine.ProcessOnStep = cbProcessOnStep.Checked;
     RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.REMOTE_SET_PIPE_PROCESSONSTEP)
     {
         objectValue = RTC_PipeEngine.ProcessOnStep
     });
 }
예제 #23
0
 private void nmDistortionDelay_ValueChanged(object sender, EventArgs e)
 {
     RTC_DistortionEngine.MaxAge = Convert.ToInt32(nmDistortionDelay.Value);
     RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.REMOTE_SET_DISTORTION_DELAY)
     {
         objectValue = RTC_DistortionEngine.MaxAge
     });
 }
예제 #24
0
 private void cbLockPipes_CheckedChanged(object sender, EventArgs e)
 {
     RTC_PipeEngine.LockPipes = cbLockPipes.Checked;
     RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.REMOTE_SET_PIPE_LOCKPIPES)
     {
         objectValue = RTC_PipeEngine.LockPipes
     });
 }
예제 #25
0
 private void nmTiltPipeValue_ValueChanged(object sender, EventArgs e)
 {
     RTC_PipeEngine.tiltValue = Convert.ToInt32(nmTiltPipeValue.Value);
     RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.REMOTE_SET_PIPE_TILTVALUE)
     {
         objectValue = RTC_PipeEngine.tiltValue
     });
 }
예제 #26
0
 private void cbClearPipesOnRewind_CheckedChanged(object sender, EventArgs e)
 {
     RTC_Core.ClearPipesOnRewind = cbClearPipesOnRewind.Checked;
     RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.REMOTE_SET_PIPE_CLEARPIPESREWIND)
     {
         objectValue = RTC_Core.ClearPipesOnRewind
     });
 }
예제 #27
0
        public static bool LoadStateAndBlastLayer(StashKey sk, bool ReloadRom = true)
        {
            object returnValue = RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.REMOTE_LOADSTATE)
            {
                objectValue = new object[] { sk, ReloadRom, (sk.BlastLayer != null && sk.BlastLayer.Layer.Count > 0) }
            }, true);

            return(returnValue != null ? (bool)returnValue : false);
        }
예제 #28
0
        public static void MAINFORM_CLOSING()
        {
            if (DisableRTC)
            {
                return;
            }

            RTC_Core.CloseAllRtcForms();
        }
예제 #29
0
        public void RunOriginal()
        {
            if (RTC_Core.currentGameSystem != RTC_Core.currentStashkey.GameSystem || RTC_Core.currentGameName != RTC_Core.currentStashkey.GameName)
            {
                RTC_Core.LoadRom(RTC_Core.currentStashkey.RomFile);
            }

            RTC_Core.ghForm.LoadState(ParentKey, RTC_Core.currentStashkey.GameSystem, RTC_Core.currentStashkey.GameName);
        }
예제 #30
0
        public static void BIZHAWK_SAVE_CONFIG()
        {
            if (DisableRTC)
            {
                return;
            }

            RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.REMOTE_EVENT_SAVEBIZHAWKCONFIG));
        }