Exemple #1
0
        public bool SaveMacroAs(MovieZone macro)
        {
            using var dialog = new SaveFileDialog
                  {
                      InitialDirectory = SuggestedFolder(),
                      FileName         = macro.Name,
                      Filter           = "Movie Macros (*.bk2m)|*.bk2m|All Files|*.*"
                  };

            // Create directory?
            bool create = false;

            if (!Directory.Exists(SuggestedFolder()))
            {
                Directory.CreateDirectory(SuggestedFolder());
                create = true;
            }

            DialogResult result = dialog.ShowHawkDialog();

            if (result != DialogResult.OK)
            {
                if (create)
                {
                    Directory.Delete(dialog.InitialDirectory);
                }

                return(false);
            }

            macro.Save(dialog.FileName);
            Config.RecentMacros.Add(dialog.FileName);

            return(true);
        }
Exemple #2
0
        private void DummyLoadMacro(string path)
        {
            MovieZone loadZone = new MovieZone(path, Emulator, Tools);

            _zones.Add(loadZone);
            ZonesList.Items.Add($"{loadZone.Name} - length: {loadZone.Length}");
        }
Exemple #3
0
        private void MacroInputTool_Load(object sender, EventArgs e)
        {
            // Movie recording must be active (check TAStudio because opening a project re-loads the ROM,
            // which resets tools before the movie session becomes active)
            if (!CurrentMovie.IsActive() && !Tools.IsLoaded <TAStudio>())
            {
                MessageBox.Show("In order to use this tool you must be recording a movie.");
                Close();
                DialogResult = DialogResult.Cancel;
                return;
            }

            ReplaceBox.Enabled = CurrentMovie is TasMovie;
            OverlayBox.Enabled = CurrentMovie is TasMovie;
            PlaceNum.Enabled   = CurrentMovie is TasMovie;

            var main = new MovieZone(CurrentMovie, Emulator, Tools, 0, CurrentMovie.InputLogLength)
            {
                Name = "Entire Movie"
            };

            _zones.Add(main);
            ZonesList.Items.Add($"{main.Name} - length: {main.Length}");
            ZonesList.Items[0] += " [Zones don't change!]";

            SetUpButtonBoxes();

            _initializing = false;
        }
        private void MacroInputTool_Load(object sender, EventArgs e)
        {
            // Movie recording must be active (check TAStudio because opening a project re-loads the ROM,
            // which resets tools before the movie session becomes active)
            if (!Global.MovieSession.Movie.IsActive && !GlobalWin.Tools.IsLoaded <TAStudio>())
            {
                MessageBox.Show("In order to use this tool you must be recording a movie.");
                this.Close();
                this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                return;
            }

            ReplaceBox.Enabled = CurrentMovie is TasMovie;
            OverlayBox.Enabled = CurrentMovie is TasMovie;
            PlaceNum.Enabled   = CurrentMovie is TasMovie;

            MovieZone main = new MovieZone(CurrentMovie, 0, CurrentMovie.InputLogLength);

            main.Name = "Entire Movie";

            zones.Add(main);
            ZonesList.Items.Add(main.Name + " - length: " + main.Length);
            ZonesList.Items[0] += " [Zones don't change!]";

            SetUpButtonBoxes();

            _initializing = false;
        }
Exemple #5
0
        private bool SaveMacroAs(MovieZone macro)
        {
            string suggestedFolder = SuggestedFolder(Config, Game);

            using var dialog = new SaveFileDialog
                  {
                      InitialDirectory = suggestedFolder,
                      FileName         = macro.Name,
                      Filter           = MacrosFSFilterSet.ToString()
                  };

            // Create directory?
            bool create = false;

            if (!Directory.Exists(suggestedFolder))
            {
                Directory.CreateDirectory(suggestedFolder);
                create = true;
            }

            if (this.ShowDialogWithTempMute(dialog) != DialogResult.OK)
            {
                if (create)
                {
                    Directory.Delete(dialog.InitialDirectory);
                }

                return(false);
            }

            macro.Save(dialog.FileName);
            Config.RecentMacros.Add(dialog.FileName);

            return(true);
        }
        private void DummyLoadMacro(string path)
        {
            MovieZone loadZone = new MovieZone(path);

            zones.Add(loadZone);
            ZonesList.Items.Add(loadZone.Name + " - length: " + loadZone.Length);
        }
Exemple #7
0
		private void MacroInputTool_Load(object sender, EventArgs e)
		{
			// Movie recording must be active (check TAStudio because opening a project re-loads the ROM,
			// which resets tools before the movie session becomes active)
			if (!Global.MovieSession.Movie.IsActive && !GlobalWin.Tools.IsLoaded<TAStudio>())
			{
				MessageBox.Show("In order to use this tool you must be recording a movie.");
				this.Close();
				this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
				return;
			}

			ReplaceBox.Enabled = CurrentMovie is TasMovie;
			OverlayBox.Enabled = CurrentMovie is TasMovie;
			PlaceNum.Enabled = CurrentMovie is TasMovie;

			MovieZone main = new MovieZone(CurrentMovie, 0, CurrentMovie.InputLogLength);
			main.Name = "Entire Movie";

			zones.Add(main);
			ZonesList.Items.Add(main.Name + " - length: " + main.Length);
			ZonesList.Items[0] += " [Zones don't change!]";

			SetUpButtonBoxes();

			_initializing = false;
		}
Exemple #8
0
		private void DummyLoadMacro(string path)
		{
			if (!TasView.AnyRowsSelected)
			{
				return;
			}

			MovieZone loadZone = new MovieZone(path)
			{
				Start = TasView.FirstSelectedIndex.Value
			};
			loadZone.PlaceZone(CurrentTasMovie);
		}
Exemple #9
0
		private void DummyLoadMacro(string path)
		{
			if (!TasView.AnyRowsSelected)
			{
				return;
			}

			var loadZone = new MovieZone(path, Emulator, Tools)
			{
				Start = TasView.FirstSelectedIndex ?? 0
			};
			loadZone.PlaceZone(CurrentTasMovie);
		}
Exemple #10
0
        private void DummyLoadMacro(string path)
        {
            if (!TasView.AnyRowsSelected)
            {
                return;
            }

            var loadZone = new MovieZone(path, MainForm, Emulator, MovieSession, Tools)
            {
                Start = TasView.FirstSelectedIndex.Value
            };

            loadZone.PlaceZone(CurrentTasMovie, Config);
        }
Exemple #11
0
        private void DummyLoadMacro(string path)
        {
            if (!TasView.SelectedRows.Any())
            {
                return;
            }

            MovieZone loadZone = new MovieZone(path);

            if (loadZone != null)
            {
                loadZone.Start = TasView.FirstSelectedIndex.Value;
                loadZone.PlaceZone(CurrentTasMovie);
            }
        }
        private void placeMacroAtSelectionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!TasView.AnyRowsSelected)
            {
                return;
            }

            MovieZone macro = MacroInputTool.LoadMacro();

            if (macro != null)
            {
                macro.Start = TasView.FirstSelectedIndex.Value;
                macro.PlaceZone(CurrentTasMovie);
            }
        }
        private void SetZoneButton_Click(object sender, EventArgs e)
        {
            if (StartNum.Value >= CurrentMovie.InputLogLength || EndNum.Value >= CurrentMovie.InputLogLength)
            {
                MessageBox.Show("Start and end frames must be inside the movie.");
                return;
            }

            MovieZone newZone = new MovieZone(CurrentMovie, (int)StartNum.Value, (int)(EndNum.Value - StartNum.Value + 1));

            newZone.Name = "Zone " + zones.Count;
            zones.Add(newZone);
            ZonesList.Items.Add(newZone.Name + " - length: " + newZone.Length);

            unsavedZones.Add(ZonesList.Items.Count - 1);
        }
Exemple #14
0
        public static MovieZone LoadMacro()
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.InitialDirectory = SuggestedFolder();
            dialog.Filter = "Movie Macros (*.bk2m)|*.bk2m|All Files|*.*";

            DialogResult result = dialog.ShowHawkDialog();
            if (result != DialogResult.OK)
                return null;

            MovieZone ret = new MovieZone(dialog.FileName);
            if (ret != null)
                Global.Config.RecentMacros.Add(dialog.FileName);

            return ret;
        }
        private void saveSelectionToMacroToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (TasView.LastSelectedIndex == CurrentTasMovie.InputLogLength)
            {
                TasView.SelectRow(CurrentTasMovie.InputLogLength, false);
            }

            if (!TasView.AnyRowsSelected)
            {
                return;
            }

            MovieZone macro = new MovieZone(CurrentTasMovie, TasView.FirstSelectedIndex.Value,
                                            TasView.LastSelectedIndex.Value - TasView.FirstSelectedIndex.Value + 1);

            MacroInputTool.SaveMacroAs(macro);
        }
Exemple #16
0
        private void LoadMacroToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MovieZone loadZone = LoadMacro();

            if (loadZone != null)
            {
                _zones.Add(loadZone);
                ZonesList.Items.Add($"{loadZone.Name} - length: {loadZone.Length}");

                // Options only for TasMovie
                if (!(CurrentMovie is TasMovie))
                {
                    loadZone.Replace = false;
                    loadZone.Overlay = false;
                }
            }
        }
Exemple #17
0
        private void SetZoneButton_Click(object sender, EventArgs e)
        {
            if (StartNum.Value >= CurrentMovie.InputLogLength || EndNum.Value >= CurrentMovie.InputLogLength)
            {
                MessageBox.Show("Start and end frames must be inside the movie.");
                return;
            }

            var newZone = new MovieZone(CurrentMovie, Emulator, Tools, (int)StartNum.Value, (int)(EndNum.Value - StartNum.Value + 1))
            {
                Name = $"Zone {_zones.Count}"
            };

            _zones.Add(newZone);
            ZonesList.Items.Add($"{newZone.Name} - length: {newZone.Length}");

            _unsavedZones.Add(ZonesList.Items.Count - 1);
        }
        public static MovieZone LoadMacro()
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.InitialDirectory = SuggestedFolder();
            dialog.Filter           = "Movie Macros (*.bk2m)|*.bk2m|All Files|*.*";

            DialogResult result = dialog.ShowHawkDialog();

            if (result != DialogResult.OK)
            {
                return(null);
            }

            MovieZone ret = new MovieZone(dialog.FileName);

            if (ret != null)
            {
                Global.Config.RecentMacros.Add(dialog.FileName);
            }

            return(ret);
        }
Exemple #19
0
        private void SetZoneButton_Click(object sender, EventArgs e)
        {
            if (StartNum.Value >= CurrentMovie.InputLogLength || EndNum.Value >= CurrentMovie.InputLogLength)
            {
                MessageBox.Show("Start and end frames must be inside the movie.");
                return;
            }

            MovieZone newZone = new MovieZone(CurrentMovie, (int)StartNum.Value, (int)(EndNum.Value - StartNum.Value + 1));
            newZone.Name = "Zone " + zones.Count;
            zones.Add(newZone);
            ZonesList.Items.Add(newZone.Name + " - length: " + newZone.Length);

            unsavedZones.Add(ZonesList.Items.Count - 1);
        }
Exemple #20
0
		private void DummyLoadMacro(string path)
		{
			if (!TasView.AnyRowsSelected)
				return;

			MovieZone loadZone = new MovieZone(path);
			if (loadZone != null)
			{
				loadZone.Start = TasView.FirstSelectedIndex.Value;
				loadZone.PlaceZone(CurrentTasMovie);
			}
		}
		private void saveSelectionToMacroToolStripMenuItem_Click(object sender, EventArgs e)
		{
			if (TasView.LastSelectedIndex == CurrentTasMovie.InputLogLength)
				TasView.SelectRow(CurrentTasMovie.InputLogLength, false);

			if (!TasView.AnyRowsSelected)
				return;

			MovieZone macro = new MovieZone(CurrentTasMovie, TasView.FirstSelectedIndex.Value,
				TasView.LastSelectedIndex.Value - TasView.FirstSelectedIndex.Value + 1);
			MacroInputTool.SaveMacroAs(macro);
		}
Exemple #22
0
 private void DummyLoadMacro(string path)
 {
     MovieZone loadZone = new MovieZone(path);
     zones.Add(loadZone);
     ZonesList.Items.Add(loadZone.Name + " - length: " + loadZone.Length);
 }
Exemple #23
0
        public static bool SaveMacroAs(MovieZone macro)
        {
            SaveFileDialog dialog = new SaveFileDialog();
            // Create directory?
            bool create = false;
            if (!Directory.Exists(SuggestedFolder()))
            {
                Directory.CreateDirectory(SuggestedFolder());
                create = true;
            }
            dialog.InitialDirectory = SuggestedFolder();
            dialog.FileName = macro.Name;
            dialog.Filter = "Movie Macros (*.bk2m)|*.bk2m|All Files|*.*";

            DialogResult result = dialog.ShowHawkDialog();
            if (result != DialogResult.OK)
            {
                if (create)
                    Directory.Delete(dialog.InitialDirectory);
                return false;
            }

            macro.Save(dialog.FileName);
            Global.Config.RecentMacros.Add(dialog.FileName);

            return true;
        }