private void RTC_TF_Form_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (e.CloseReason != CloseReason.FormOwnerClosing)
     {
         e.Cancel = true;
         RTC_TimeFlow.Stop();
     }
 }
Beispiel #2
0
        static void STEP_REWIND()
        {
            if (RTC_Core.ClearCheatsOnRewind)
            {
                RTC_HellgenieEngine.ClearCheats();
            }

            RTC_TimeFlow.RewindStep();
        }
        private void RTC_TF_Form_Load(object sender, EventArgs e)
        {
            pbFullMap.Image = imgLoadingTimeMap;

            t.Interval = 40;
            t.Tick    += new EventHandler(RefreshMap);
            t.Start();
            RTC_TimeFlow.Start();

            RecalculateCorruptFactor();
        }
Beispiel #4
0
 private void btnDashboard_Click(object sender, EventArgs e)
 {
     if (!RTC_TimeFlow.Running)
     {
         RTC_TimeFlow.Start();
         RTC_Restore.SaveRestore();
     }
     else
     {
         RTC_Core.tfForm.Focus();
     }
 }
Beispiel #5
0
        static void Tick(object Sender, EventArgs e)
        {
            if (Global.Emulator is NullEmulator)
            {
                return;
            }

            string key = RTC_Core.GetRandomKey();

            RTC_Core.SaveSave(key + ".timestack.timejump");
            ts.Push(key);

            RTC_TimeFlow.AddTimeJumpBar();
            RTC_Core.tfForm.RefreshJumpLabel();
        }
Beispiel #6
0
        public static void MAINFORM_CLOSING()
        {
            RTC_Core.lastOpenRom = null;

            RTC_Core.AutoCorrupt = false;
            RTC_Core.coreForm.cbUseTimeStack.Checked = false;
            RTC_TimeFlow.Stop();

            RTC_Restore.SaveRestore();
            RTC_RPC.SendToKillSwitch("CLOSE");

            ForceCloseTimer          = new Timer();
            ForceCloseTimer.Interval = 5000;
            ForceCloseTimer.Tick    += new EventHandler(ForceCloseTimer_Tick);
            ForceCloseTimer.Start();
        }
        public void RefreshMap(object sender, EventArgs e)
        {
            if (!RTC_TimeFlow.Running)
            {
                return;
            }

            int Xcamera = 0;

            if (RTC_TimeFlow.timeGame > (RTC_Core.tfForm.pbFullMap.Width / 2))
            {
                Xcamera = RTC_TimeFlow.timeGame - (RTC_Core.tfForm.pbFullMap.Width / 2);
            }

            pbFullMap.Image = RTC_TimeFlow.CropBitmap(RTC_TimeFlow.FullMap, Xcamera, 0, RTC_Core.tfForm.pbFullMap.Width, RTC_Core.tfForm.pbFullMap.Height);

            //base.OnPaint(null);
        }
        public static void LoadRestore()
        {
            try
            {
                #region Loading the Restore.dat File

                lock (restoreLock)
                {
                    FileStream      FS;
                    BinaryFormatter bformatter = new BinaryFormatter();
                    FS         = File.Open(RTC_Core.rtcDir + "\\SESSION\\Restore.dat", FileMode.OpenOrCreate);
                    RTC_Status = (RestoreFile)bformatter.Deserialize(FS);
                    FS.Close();
                }

                #endregion

                #region Replacing Form Values

                switch (RTC_Status.SelectedEngine)
                {
                case CorruptionEngine.NIGHTMARE:
                    RTC_Core.SetEngineByName("Nightmare Engine");
                    break;

                case CorruptionEngine.HELLGENIE:
                    RTC_Core.SetEngineByName("Hellgenie Engine");
                    break;

                case CorruptionEngine.DISTORTION:
                    RTC_Core.SetEngineByName("Distortion Engine");
                    break;

                case CorruptionEngine.NONE:
                    break;
                }

                RTC_Core.coreForm.nmIteratorSteps.Value = Convert.ToDecimal(RTC_Status.IteratorSteps);
                RTC_Core.coreForm.nmIntensity.Value     = Convert.ToDecimal(RTC_Status.Intensity);

                RTC_Core.coreForm.cbClearCheatsOnRewind.Checked = RTC_Status.ClearCheatsOnRewind;

                string cbBlastRadius = RTC_Status.Radius.ToString();
                for (int i = 0; i < RTC_Core.coreForm.cbBlastRadius.Items.Count; i++)
                {
                    if (RTC_Core.coreForm.cbBlastRadius.Items[i].ToString() == cbBlastRadius)
                    {
                        RTC_Core.coreForm.cbBlastRadius.SelectedIndex = i;
                    }
                }

                string cbBlastType = RTC_Status.Algo.ToString();
                for (int i = 0; i < RTC_Core.coreForm.cbBlastRadius.Items.Count; i++)
                {
                    if (RTC_Core.coreForm.cbBlastType.Items[i].ToString() == cbBlastType)
                    {
                        RTC_Core.coreForm.cbBlastType.SelectedIndex = i;
                    }
                }



                RTC_Core.coreForm.nmMaxCheats.Value       = Convert.ToDecimal(RTC_Status.MaxCheats);
                RTC_Core.coreForm.nmMaxFreezes.Value      = Convert.ToDecimal(RTC_Status.MaxFreezes);
                RTC_Core.coreForm.nmDistortionDelay.Value = Convert.ToDecimal(RTC_Status.MaxAge);

                if (RTC_Status.AutoCorrupt)
                {
                    RTC_Core.coreForm.btnAutoCorrupt.Text = "Stop Auto-Corrupt";
                }
                else
                {
                    RTC_Core.coreForm.btnAutoCorrupt.Text = "Start Auto-Corrupt";
                }

                //Set Up the Memory Domains Here

                #endregion

                #region RTC_NightmareEngine

                RTC_NightmareEngine.Algo = RTC_Status.Algo;

                #endregion

                #region RTC_HellgenieEngine

                RTC_HellgenieEngine.MaxCheats = RTC_Status.MaxCheats;

                #endregion

                #region RTC_HellgenieEngine

                RTC_FreezeEngine.MaxFreezes = RTC_Status.MaxFreezes;

                #endregion

                #region RTC_DistortionEngine

                RTC_DistortionEngine.MaxAge             = RTC_Status.MaxAge;
                RTC_DistortionEngine.CurrentAge         = RTC_Status.CurrentAge;
                RTC_DistortionEngine.AllDistortionBytes = RTC_Status.AllDistortionBytes;

                #endregion

                #region RTC_ExternalRomPlugin
                RTC_ExternalRomPlugin.SelectedPlugin = RTC_Status.SelectedPlugin;

                for (int i = 0; i < RTC_Core.coreForm.cbExternalSelectedPlugin.Items.Count; i++)
                {
                    if (RTC_ExternalRomPlugin.SelectedPlugin == RTC_Core.coreForm.cbExternalSelectedPlugin.Items[i].ToString())
                    {
                        RTC_Core.coreForm.cbExternalSelectedPlugin.SelectedIndex = i;
                        break;
                    }
                }


                #endregion

                #region RTC_coreForm

                switch (RTC_Status.SelectedEngine)
                {
                case CorruptionEngine.NIGHTMARE:
                    RTC_Core.SetEngineByName("Nightmare Engine");
                    break;

                case CorruptionEngine.HELLGENIE:
                    RTC_Core.SetEngineByName("Hellgenie Engine");
                    break;

                case CorruptionEngine.DISTORTION:
                    RTC_Core.SetEngineByName("Distortion Engine");
                    break;

                case CorruptionEngine.FREEZE:
                    RTC_Core.SetEngineByName("Freeze Engine");
                    break;

                case CorruptionEngine.EXTERNALROM:
                    RTC_Core.SetEngineByName("External ROM Plugin");
                    break;
                }

                #endregion

                #region RTC_GH_Form

                RTC_Core.ghForm.currentSelectedState = RTC_Status.currentSelectedState;

                switch (RTC_Core.ghForm.currentSelectedState)
                {
                case "01":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate01, new EventArgs());
                    break;

                case "02":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate02, new EventArgs());
                    break;

                case "03":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate03, new EventArgs());
                    break;

                case "04":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate04, new EventArgs());
                    break;

                case "05":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate05, new EventArgs());
                    break;

                case "06":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate06, new EventArgs());
                    break;

                case "07":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate07, new EventArgs());
                    break;

                case "08":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate08, new EventArgs());
                    break;

                case "09":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate09, new EventArgs());
                    break;

                case "10":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate10, new EventArgs());
                    break;

                case "11":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate11, new EventArgs());
                    break;

                case "12":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate12, new EventArgs());
                    break;

                case "13":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate13, new EventArgs());
                    break;

                case "14":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate14, new EventArgs());
                    break;

                case "15":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate15, new EventArgs());
                    break;

                case "16":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate16, new EventArgs());
                    break;

                case "17":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate17, new EventArgs());
                    break;

                case "18":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate18, new EventArgs());
                    break;

                case "19":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate19, new EventArgs());
                    break;

                case "20":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate20, new EventArgs());
                    break;
                }


                RTC_Core.ghForm.btnParentKeys  = RTC_Status.btnParentKeys;
                RTC_Core.ghForm.btnAttachedRom = RTC_Status.btnAttachedRom;

                RTC_Core.ghForm.DontLoadSelectedStash     = RTC_Status.DontLoadSelectedStash;
                RTC_Core.ghForm.DontLoadSelectedStockpile = RTC_Status.DontLoadSelectedStockpile;


                if (RTC_Status.ghMode == "CORRUPT")
                {
                    RTC_Core.ghForm.rbCorrupt.Checked = true;
                }
                else if (RTC_Status.ghMode == "INJECT")
                {
                    RTC_Core.ghForm.rbInject.Checked = true;
                }
                else
                {
                    RTC_Core.ghForm.rbOriginal.Checked = true;
                }


                RTC_Core.ghForm.cbAutoLoadState.Checked        = RTC_Status.AutoLoadState;
                RTC_Core.ghForm.cbLoadOnSelect.Checked         = RTC_Status.LoadOnSelect;
                RTC_Core.ghForm.cbStashCorrupted.Checked       = RTC_Status.StashCorrupted;
                RTC_Core.ghForm.cbStashInjected.Checked        = RTC_Status.StashInjected;
                RTC_Core.ghForm.cbRenderAtLoad.Checked         = RTC_Status.RenderAtLoad;
                RTC_Core.ghForm.cbRenderAtCorrupt.Checked      = RTC_Status.RenderAtCorrupt;
                RTC_Core.ghForm.cbSavestateLoadOnClick.Checked = RTC_Status.SavestateLoadOnClick;

                if (RTC_Status.ExportFormat == "NONE")
                {
                    RTC_Core.ghForm.rbRenderNone.Checked = true;
                }
                else if (RTC_Status.ExportFormat == "MPEG")
                {
                    RTC_Core.ghForm.rbRenderMPEG.Checked = true;
                }
                else if (RTC_Status.ExportFormat == "WAV")
                {
                    RTC_Core.ghForm.rbRenderWAV.Checked = true;
                }
                else if (RTC_Status.ExportFormat == "AVI")
                {
                    RTC_Core.ghForm.rbRenderAVI.Checked = true;
                }

                RTC_Core.ghForm.lbStockpile.Items.AddRange(RTC_Status.StockpileListboxItems.ToArray());

                RTC_Core.ghForm.cbBackupHistory.Checked = RTC_Status.BackupHistory;

                if (RTC_Status.BackupHistory)
                {
                    RTC_Core.ghForm.lbStashHistory.Items.AddRange(RTC_Status.StashHistoryListboxItems.ToArray());
                }


                #endregion

                #region RTC_Core

                //Default Values
                RTC_Core.SelectedEngine      = RTC_Status.SelectedEngine;
                RTC_Core.IteratorSteps       = RTC_Status.IteratorSteps;
                RTC_Core.Radius              = RTC_Status.Radius;
                RTC_Core.Intensity           = RTC_Status.Intensity;
                RTC_Core.ClearCheatsOnRewind = RTC_Status.ClearCheatsOnRewind;

                //Flags
                RTC_Core.AutoCorrupt       = RTC_Status.AutoCorrupt;
                RTC_Core.ExtractBlastLayer = RTC_Status.ExtractBlastLayer;

                RTC_Core.lastOpenRom = RTC_Status.lastOpenRom;

                if (RTC_Core.lastOpenRom != null)
                {
                    RTC_Core.LoadRom(RTC_Core.lastOpenRom);
                    RTC_MemoryZones.pendingSelectedDomains = RTC_Status.SelectedDomains;
                }
                else
                {
                    RTC_Core.AutoCorrupt = false;
                    RTC_Core.LoadDefaultRom();
                }

                //General Values

                //Memory object references
                RTC_Core.currentStockpile = RTC_Status.currentStockpile;

                if (RTC_Core.currentStockpile != null && RTC_Core.currentStockpile.Filename != null)
                {
                    RTC_Core.ghForm.btnSaveStockpile.Enabled   = true;
                    RTC_Core.ghForm.btnSaveStockpile.BackColor = Color.Tomato;
                }

                #endregion

                #region RTC_TimeStack & RTC_TimeFlow

                RTC_Core.coreForm.cbUseTimeStack.Checked = RTC_Status.TimeStack;
                RTC_Core.coreForm.nmTimeStackDelay.Value = Convert.ToDecimal(RTC_Status.TimeStackDelay);

                if (RTC_Status.TimeStack)
                {
                    RTC_TimeStack.LoadTimeStack();
                }

                if (RTC_Status.TimeMap)
                {
                    RTC_TimeFlow.Start();
                }

                #endregion

                GlobalWin.MainForm.Activate();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something wrong happenned in RTC_Restore -> LoadRestore() \n\n" + ex.ToString());
            }
        }
Beispiel #9
0
 static void STEP_FASTFORWARD()
 {
     RTC_TimeFlow.FastForwardStep();
 }
Beispiel #10
0
 static void STEP_PAUSED()
 {
     RTC_TimeFlow.PausedStep();
 }
Beispiel #11
0
        public void StartEasyMode(bool useTemplate)
        {
            if (Global.Emulator is NullEmulator)
            {
                MessageBox.Show("Please load a game in BizHawk before using the RTC in Easy Mode");
                return;
            }

            if (useTemplate)
            {
                //Put Console templates HERE
                string thisSystem = Global.Game.System.ToString().ToUpper();

                switch (thisSystem)
                {
                case "NES":         //Nintendo Entertainment system
                    RTC_Core.SetEngineByName("Nightmare Engine");
                    RTC_Core.Intensity     = 2;
                    RTC_Core.IteratorSteps = 1;
                    break;


                case "GB":          //Gameboy
                case "GBC":         //Gameboy Color
                    RTC_Core.SetEngineByName("Nightmare Engine");
                    RTC_Core.Intensity     = 1;
                    RTC_Core.IteratorSteps = 4;
                    break;

                case "SNES":        //Super Nintendo
                    RTC_Core.SetEngineByName("Nightmare Engine");
                    RTC_Core.Intensity     = 4;
                    RTC_Core.IteratorSteps = 8;
                    break;


                case "GBA":         //Gameboy Advance
                    RTC_Core.SetEngineByName("Nightmare Engine");
                    RTC_Core.Intensity     = 1;
                    RTC_Core.IteratorSteps = 1;
                    break;

                case "N64":         //Nintendo 64
                    RTC_Core.SetEngineByName("Nightmare Engine");
                    RTC_Core.Intensity     = 70;
                    RTC_Core.IteratorSteps = 5;
                    break;

                case "SG":          //Sega SG-1000
                case "GG":          //Sega GameGear
                case "SMS":         //Sega Master System
                case "GEN":         //Sega Genesis and CD
                case "PCE":         //PC-Engine / Turbo Grafx
                case "PSX":         //Sony Playstation 1
                case "A26":         //Atari 2600
                case "A78":         //Atari 7800
                case "LYNX":        //Atari Lynx
                case "INTV":        //Intellivision
                case "PCECD":       //related to PC-Engine / Turbo Grafx
                case "SGX":         //related to PC-Engine / Turbo Grafx
                case "TI83":        //Ti-83 Calculator
                case "WSWAN":       //Wonderswan
                case "C64":         //Commodore 64
                case "Coleco":      //Colecovision
                case "SGB":         //Super Gameboy
                case "SAT":         //Sega Saturn
                case "DGB":
                    MessageBox.Show("WARNING: No Easy-Mode template was made for this system. Please configure it manually and use the current settings.");
                    break;

                    //TODO: Add more zones like gamegear, atari, turbo graphx
                }
            }

            RTC_Core.AutoCorrupt = true;

            RTC_TimeStack.Reset();
            cbUseTimeStack.Checked = true;
            RTC_TimeFlow.Start();
            GlobalWin.MainForm.Focus();
        }
Beispiel #12
0
        public static void Jump()
        {
            if (t == null)
            {
                return;
            }

            string key;

            if (ts.Count() > 0)
            {
                key = ts.Pop();
            }
            else
            {
                return;
            }

            RTC_TimeFlow.State = TimeState.Jump;

            if (key != null)
            {
                t.Stop();
                t.Start();

                ts_buffer.Enqueue(key);
                key = ts_buffer.Dequeue();

                //removed screenshot previewing to save ressources

                /*
                 * Bitmap bmp = MainForm.MakeScreenshotImage().ToSysdrawingBitmap();
                 *
                 * for(int y = 0; y<bmp.Size.Height;y++)
                 * for (int x = 0; x < bmp.Size.Width; x++)
                 * {
                 * Color pix = bmp.GetPixel(x,y);
                 * Color pix2 = Color.FromArgb(Convert.ToInt32(pix.R*0.2),Convert.ToInt32(pix.G*0.2),Convert.ToInt32(pix.B*0.2));
                 * bmp.SetPixel(x, y, pix2);
                 * }
                 *
                 * GlobalWin.MainForm.BackgroundImageLayout = ImageLayout.Center;
                 *
                 * double factor = Convert.ToDouble(GlobalWin.MainForm.PresentationPanel.Control.Size.Height) / Convert.ToDouble(bmp.Height);
                 *
                 * Size bmpsize = new Size(Convert.ToInt32(bmp.Width * factor), Convert.ToInt32(bmp.Height * factor));
                 *
                 * GlobalWin.MainForm.BackColor = Color.Black;
                 * GlobalWin.MainForm.BackgroundImage = new Bitmap(bmp, bmpsize);
                 *
                 * GlobalWin.MainForm.PresentationPanel.Control.Visible = false;
                 */

                if (ts_buffer.Count == 0)
                {
                    RTC_RPC.SendToKillSwitch("FREEZE");
                    RTC_Core.LoadStateCorruptorSafe(key + ".timestack.timejump", null);
                    RTC_RPC.SendToKillSwitch("UNFREEZE");

                    /*
                     * GlobalWin.MainForm.BackColor = System.Drawing.SystemColors.Control;
                     * GlobalWin.MainForm.BackgroundImage = null;
                     *
                     * GlobalWin.MainForm.PresentationPanel.Control.Visible = true;
                     * GlobalWin.MainForm.Activate();
                     * GlobalWin.MainForm.Focus();
                     */
                }

                RTC_TimeFlow.JumpStep();
                RTC_Core.tfForm.RefreshJumpLabel();
            }
        }