示例#1
0
        /// <summary>
        /// Load the contents of an external file to the copy buffer
        /// Returns the column count
        /// </summary>
        public static void Load(string filename, ref TASMovieInputCollection buffer)
        {
            StreamReader reader = File.OpenText(filename);
            string header = reader.ReadLine();

            int controllers = 0;

            // TODO::This is a weak validation routine
            if (header.Length != 3)
            {
                MessageBox.Show(frmMain.frm, "Buffer file appears to be invalid", "Oops",
                    MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
                return;
            }

            string lineItem = null;
            while ((lineItem = reader.ReadLine()) != null)
            {
                TASMovieInput[] frame = new TASMovieInput[1];
                string[]        split  = lineItem.Split('|');
                for (int i = 0; i < split.Length; i++)
                    frame[0].Controller[i] = split[i];

                TASMovieInput.Insert(ref buffer.Input, ref frame, buffer.Input.Length);
                controllers = split.Length;
            }

            reader.Close(); reader.Dispose();

            buffer.Format      = (TASForm.MovieType)Enum.Parse(typeof(TASForm.MovieType), header);
            buffer.Controllers = controllers;
        }
示例#2
0
        /// <summary>
        /// Instantiate the SubtitleGenerator with an inputCollection and a filename
        /// </summary>        
        public SubtitleGenerator(ref TASMovieInputCollection movie, string filename)
        {
            Movie    = movie;
            Filename = filename;

            // set default values
            Offset   = 0;
            FPS      = 60;
        }
示例#3
0
        /// <summary>
        /// Create the frmBuffer form object and populate the listview based on the 
        /// arrayList of string[] content
        /// </summary>
        public frmBuffer(ref TASMovieInputCollection buffer)
        {
            InitializeComponent();

            if (buffer.Input != null)
            {
                bufferedInput = buffer;
                bindControllerDataToListview();
            }
        }
示例#4
0
        /// <summary>
        /// Create a new SaveAs for with a reference to a movie and its (updated) input
        /// </summary>
        public frmSaveAs(ref TASMovie movie, ref TASMovieInputCollection movieData, string newFilePrefix)
        {
            InitializeComponent();

            Movie     = movie;
            MovieData = movieData;

            txtFilename.Text    = DirectoryFromPath(Movie.Filename) + newFilePrefix + FilenameFromPath(Movie.Filename);
            txtAuthor.Text      = Movie.Extra.Author;
            txtDescription.Text = Movie.Extra.Description;

            txtAuthor.Focus();

            if (Movie.Extra.Author == null) txtAuthor.Enabled = false;
            if (movie.Extra.Description == null) txtDescription.Enabled = false;
        }
示例#5
0
        /// <summary>
        /// Save the contents of the copy buffer out to file
        /// </summary>
        public static void Save(string filename, ref TASMovieInputCollection buffer)
        {
            TextWriter writer = File.CreateText(filename);

            writer.WriteLine(buffer.Format);

            for (int i = 0; i < buffer.Input.Length; i++)
            {
                string lineItem = "";
                for (int j = 0; j < buffer.Controllers; j++)
                {
                    lineItem += buffer.Input[i].Controller[j] + "|";
                }
                lineItem = lineItem.Remove(lineItem.Length - 1); // trim last char
                writer.WriteLine(lineItem);
            }
            writer.Close(); writer.Dispose();
        }
示例#6
0
        /// <summary>
        /// Perform the splice
        /// </summary>        
        private void btnSplice_Click(object sender, EventArgs e)
        {
            // exit if not enough movies are opened
            if (Movies.Length < 2)
            {
                MessageBox.Show(frmMain.frm, "At least two (2) movies must be loaded for splicing to be performed", "Movie Count Too Low",
                    MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
                return;
            }

            // ensure all loaded movies are of the same type
            for (int i = 0; i < Movies.Length - 1; i++)
            {
                if (Movies[i].MovieType != Movies[i + 1].MovieType)
                {
                    MessageBox.Show(frmMain.frm, "Movies aren't all of the same type", "Type Mismatch",
                        MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
                    return;
                }
            }

            TASMovieInput[] spliced = new TASMovieInput[0];

            for (int i = 0; i < Movies.Length; i++)
            {
                // handle zeroes
                if (Movies[i].End == 0) Movies[i].End = Movies[i].Movie.Header.FrameCount;

                // NOTE::increase VBM by 1 frame since we enumerate from zero
                if (Movies[i].MovieType == MovieType.VBM) Movies[i].End++;

                spliced = TASMovieInput.Splice(ref spliced, ref Movies[i].Movie.Input.FrameData, 0, spliced.Length, Movies[i].Start, Movies[i].End);
            }

            TASMovieInputCollection temp = new TASMovieInputCollection();
            temp.Format = Movies[0].MovieType;
            temp.Input  = spliced;
            frmSaveAs frm = new frmSaveAs(ref Movies[0].Movie, ref temp, "spliced-");
            frm.ShowDialog(); frm.Dispose();
        }
示例#7
0
 /// <summary>
 /// Destroy the form object, but pass the buffer back
 /// </summary>
 public void Dispose(ref TASMovieInputCollection buffer)
 {
     buffer = bufferedInput;
     this.Dispose();
 }
示例#8
0
        /// <summary>
        /// Load the contents of an external file to the copy buffer
        /// </summary>
        private void btnLoad_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.Filter = "TAS Movie Editor Copy Buffer (*.tmb)|*.tmb";
            dlg.ShowDialog();
            if (dlg.FileName.Length > 0)
            {
                TASMovieInputCollection buffer = new TASMovieInputCollection(true);
                MovieBufferIO.Load(dlg.FileName, ref buffer);

                sbarMovieType.Text = Enum.GetName(typeof(MovieType), buffer.Format);

                if (buffer.Input.Length > 0)
                {
                    lvInputBuffer.Clear(); lvInputBuffer.Columns.Add("Frame");
                    bufferedInput = buffer;
                    bindControllerDataToListview();
                }
                else
                    clearBuffer();
            }
        }
示例#9
0
        /// <summary>
        /// Launch an OpenFileDialog an populate the TASMovieInputCollection object
        /// according to the type of movie file that's selected
        /// </summary>        
        private string loadMovie(ref TASMovieInputCollection location)
        {
            openDlg = new OpenFileDialog();
            openDlg.Filter = TAS_FILTER;
            openDlg.ShowDialog();
            string filename = openDlg.FileName;
            openDlg.Dispose();

            if (filename.Length == 0) return null;

            TASMovie movie = new TASMovie();
            location = new TASMovieInputCollection();
            location.Format = IsValid(filename);

            // load the movie object up with the correct format
            switch (location.Format)
            {
                case MovieType.SMV: movie = new SNES9x(filename); break;
                case MovieType.FCM: movie = new FCEU(filename); break;
                case MovieType.GMV: movie = new Gens(filename); break;
                case MovieType.FMV: movie = new Famtasia(filename); break;
                case MovieType.VBM: movie = new VisualBoyAdvance(filename); break;
                case MovieType.M64: movie = new Mupen64(filename); break;
                case MovieType.MMV: movie = new Dega(filename); break;
                case MovieType.PXM: movie = new PCSX(filename); break;  // shares with PJM
                case MovieType.PJM: movie = new PCSX(filename); break;  // shares with PXM
            }
            location.Input       = movie.Input.FrameData;
            location.Controllers = movie.Input.ControllerCount;

            return filename;
        }
示例#10
0
 public frmSubtitles(ref TASMovieInputCollection input)
 {
     InitializeComponent();
     Input = input;
 }