Ejemplo n.º 1
0
        /// <summary>
        /// Populate an FCE Ultra movie file's header information
        /// </summary>
        public static void FCM(ref TreeView tv, ref TASMovie fcm)
        {
            FCEU movie = (FCEU)fcm;
            tv.Nodes.Clear();

            tv.Nodes.Add("Header");
            tv.Nodes[0].Nodes.Add("Signature:        " + movie.Header.Signature);
            tv.Nodes[0].Nodes.Add("Version:          " + movie.Header.Version.ToString());
            tv.Nodes[0].Nodes.Add("Frame Count:      " + String.Format("{0:0,0}", movie.Header.FrameCount));
            tv.Nodes[0].Nodes.Add("Rerecord Count:   " + String.Format("{0:0,0}", movie.Header.RerecordCount));
            tv.Nodes[0].Nodes.Add("Emulator Version: " + movie.Header.EmulatorID);
            tv.Nodes[0].Nodes.Add("Movie Start:      " + movie.Options.MovieStart);
            tv.Nodes[0].Nodes.Add("Movie Timing:     " + movie.Options.MovieTiming);

            tv.Nodes.Add("Metadata");
            tv.Nodes[1].Nodes.Add("Author: " + movie.Extra.Author);

            tv.Nodes.Add("ROM Information");
            tv.Nodes[2].Nodes.Add("ROM Title: " + movie.Extra.ROM);
            tv.Nodes[2].Nodes.Add("ROM CRC:   " + movie.Extra.CRC);

            tv.Nodes.Add("Controllers");
            tv.Nodes[3].Nodes.Add("Controller 1: " + movie.Input.Controllers[0].ToString());
            tv.Nodes[3].Nodes.Add("Controller 2: " + movie.Input.Controllers[1].ToString());
            tv.Nodes[3].Nodes.Add("Controller 3: " + movie.Input.Controllers[2].ToString());
            tv.Nodes[3].Nodes.Add("Controller 4: " + movie.Input.Controllers[3].ToString());

            movie = null; tv.ExpandAll(); tv.Nodes[0].EnsureVisible();
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Populate a Famtasia movie file's header information
        /// </summary>
        public static void FMV(ref TreeView tv, ref TASMovie fmv)
        {
            Famtasia movie = (Famtasia)fmv;
            tv.Nodes.Clear();

            tv.Nodes.Add("Header");
            tv.Nodes[0].Nodes.Add("Signature:      " + movie.Header.Signature);
            tv.Nodes[0].Nodes.Add("Movie Title:    " + movie.Extra.Description);
            tv.Nodes[0].Nodes.Add("Frame Count:    " + String.Format("{0:0,0}", movie.Header.FrameCount));
            tv.Nodes[0].Nodes.Add("Rerecord Count: " + String.Format("{0:0,0}", movie.Header.RerecordCount));
            tv.Nodes[0].Nodes.Add("Emulator ID:    " + movie.Header.EmulatorID);
            tv.Nodes[0].Nodes.Add("Movie Start:    " + movie.Options.MovieStart);

            tv.Nodes.Add("Controllers");
            tv.Nodes[1].Nodes.Add("Controller 1: " + movie.Input.Controllers[0].ToString());
            tv.Nodes[1].Nodes.Add("Controller 2: " + movie.Input.Controllers[1].ToString());

            movie = null; tv.ExpandAll(); tv.Nodes[0].EnsureVisible();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Populate a VisualBoyAdvance movie file's header information
        /// </summary>
        public static void VBM(ref TreeView tv, ref TASMovie vbm)
        {
            VisualBoyAdvance movie = (VisualBoyAdvance)vbm;
            tv.Nodes.Clear();

            tv.Nodes.Add("Header");
            tv.Nodes[0].Nodes.Add("Signature:      " + movie.Header.Signature);
            tv.Nodes[0].Nodes.Add("Version:        " + movie.Header.Version.ToString() + "." + movie.VBMSpecific.MinorVersion.ToString());
            tv.Nodes[0].Nodes.Add("UID:            " + movie.Header.UID);
            tv.Nodes[0].Nodes.Add("Frame Count:    " + String.Format("{0:0,0}", movie.Header.FrameCount));
            tv.Nodes[0].Nodes.Add("Rerecord Count: " + String.Format("{0:0,0}", movie.Header.RerecordCount));

            tv.Nodes.Add("Options");
            tv.Nodes[1].Nodes.Add("Movie Start: " + movie.Options.MovieStart);
            tv.Nodes[1].Nodes.Add("System Type");
            tv.Nodes[1].Nodes[1].Nodes.Add("Game Boy Advance: " + movie.VBMSpecific.SystemType[0].ToString());
            tv.Nodes[1].Nodes[1].Nodes.Add("Game Boy Colour:  " + movie.VBMSpecific.SystemType[1].ToString());
            tv.Nodes[1].Nodes[1].Nodes.Add("Super Game Boy:   " + movie.VBMSpecific.SystemType[2].ToString());
            tv.Nodes[1].Nodes[1].Nodes.Add("Game Boy:         " + movie.VBMSpecific.SystemType[3].ToString());
            tv.Nodes[1].Nodes.Add("BIOS Flags");
            tv.Nodes[1].Nodes[2].Nodes.Add("useBiosFile:  " + movie.VBMSpecific.BIOSFlags[0].ToString());
            tv.Nodes[1].Nodes[2].Nodes.Add("skipBiosFile: " + movie.VBMSpecific.BIOSFlags[1].ToString());
            tv.Nodes[1].Nodes.Add("Emulation Flags");
            tv.Nodes[1].Nodes[3].Nodes.Add("rtcEnable:    " + movie.VBMSpecific.BIOSFlags[2].ToString());
            tv.Nodes[1].Nodes[3].Nodes.Add("lagReduction: " + movie.VBMSpecific.BIOSFlags[4].ToString());
            tv.Nodes[1].Nodes[3].Nodes.Add("gbcHdma5Fix:  " + movie.VBMSpecific.BIOSFlags[5].ToString());
            tv.Nodes[1].Nodes[3].Nodes.Add("echoRAMFix:   " + movie.VBMSpecific.BIOSFlags[6].ToString());

            tv.Nodes.Add("Metadata");
            tv.Nodes[2].Nodes.Add("Author:      " + movie.Extra.Author);
            tv.Nodes[2].Nodes.Add("Description: " + movie.Extra.Description);

            tv.Nodes.Add("ROM Information");
            tv.Nodes[3].Nodes.Add("ROM Name: " + movie.Extra.ROM);
            tv.Nodes[3].Nodes.Add("ROM CRC:  " + movie.Extra.CRC);
            //tv.Nodes[3].Nodes.Add("Check:    " + movie.RomInfo.Checksum.ToString());

            tv.Nodes.Add("Controllers");
            tv.Nodes[4].Nodes.Add("Controller 1 Present: " + movie.Input.Controllers[0].ToString());
            tv.Nodes[4].Nodes.Add("Controller 2 Present: " + movie.Input.Controllers[1].ToString());
            tv.Nodes[4].Nodes.Add("Controller 3 Present: " + movie.Input.Controllers[2].ToString());
            tv.Nodes[4].Nodes.Add("Controller 4 Present: " + movie.Input.Controllers[3].ToString());

            movie = null; tv.ExpandAll(); tv.Nodes[0].EnsureVisible();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Populate an SNES9x movie file's header information
        /// </summary>
        public static void SMV(ref TreeView tv, ref TASMovie smv)
        {
            SNES9x movie = (SNES9x)smv;
            tv.Nodes.Clear();

            tv.Nodes.Add("Header");
            tv.Nodes[0].Nodes.Add("Signature:      " + movie.Header.Signature);
            tv.Nodes[0].Nodes.Add("Version:        " + movie.Header.Version.ToString());
            tv.Nodes[0].Nodes.Add("UID:            " + movie.Header.UID);
            tv.Nodes[0].Nodes.Add("Frame Count:    " + String.Format("{0:0,0}", movie.Header.FrameCount));
            tv.Nodes[0].Nodes.Add("Rerecord Count: " + String.Format("{0:0,0}", movie.Header.RerecordCount));

            tv.Nodes.Add("Options");
            tv.Nodes[1].Nodes.Add("Movie Start:  " + movie.Options.MovieStart);
            tv.Nodes[1].Nodes.Add("Movie Timing: " + movie.Options.MovieTiming);

            tv.Nodes[1].Nodes.Add("Sync Options");
            tv.Nodes[1].Nodes[2].Nodes.Add("FAKEMUTE:   " + movie.SMVSpecific.FAKEMUTE.ToString());
            tv.Nodes[1].Nodes[2].Nodes.Add("LEFTRIGHT:  " + movie.SMVSpecific.LEFTRIGHT.ToString());
            tv.Nodes[1].Nodes[2].Nodes.Add("SYNCSOUND:  " + movie.SMVSpecific.SYNCSOUND.ToString());
            tv.Nodes[1].Nodes[2].Nodes.Add("VOLUMEENVX: " + movie.SMVSpecific.VOLUMEENVX.ToString());
            tv.Nodes[1].Nodes[2].Nodes.Add("WIP1TIMING: " + movie.SMVSpecific.WIP1TIMING.ToString());
            tv.Nodes[1].Nodes[2].Nodes.Add("SPEEDHACKS: " + (!movie.SMVSpecific.NOCPUSHUTDOWN).ToString());

            tv.Nodes.Add("Metadata");
            tv.Nodes[2].Nodes.Add("Author: " + movie.Extra.Author);

            tv.Nodes.Add("ROM Information");
            tv.Nodes[3].Nodes.Add("ROM Title: " + movie.Extra.ROM);
            tv.Nodes[3].Nodes.Add("ROM CRC:   " + movie.Extra.CRC);

            tv.Nodes.Add("Controllers");
            tv.Nodes[4].Nodes.Add("Controller 1 Present: " + movie.Input.Controllers[0].ToString());
            tv.Nodes[4].Nodes.Add("Controller 2 Present: " + movie.Input.Controllers[1].ToString());
            tv.Nodes[4].Nodes.Add("Controller 3 Present: " + movie.Input.Controllers[2].ToString());
            tv.Nodes[4].Nodes.Add("Controller 4 Present: " + movie.Input.Controllers[3].ToString());
            tv.Nodes[4].Nodes.Add("Controller 5 Present: " + movie.Input.Controllers[4].ToString());

            movie = null; tv.ExpandAll(); tv.Nodes[0].EnsureVisible();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Populate a PCSX movie file's header information
        /// </summary>
        public static void PXM(ref TreeView tv, ref TASMovie mmv)
        {
            PCSX movie = (PCSX)mmv;
            tv.Nodes.Clear();

            tv.Nodes.Add("Header");
            tv.Nodes[0].Nodes.Add("Signature:        " + movie.Header.Signature);
            tv.Nodes[0].Nodes.Add("Movie Version:    " + movie.Header.Version.ToString());
            tv.Nodes[0].Nodes.Add("Emulator Version: " + movie.PXMSpecific.EmulatorVersion.ToString());
            tv.Nodes[0].Nodes.Add("Frame Count:      " + String.Format("{0:0,0}", movie.Header.FrameCount));
            tv.Nodes[0].Nodes.Add("Rerecord Count:   " + String.Format("{0:0,0}", movie.Header.RerecordCount));

            tv.Nodes.Add("Options");
            tv.Nodes[1].Nodes.Add("Movie Start:  " + movie.Options.MovieStart);
            tv.Nodes[1].Nodes.Add("Movie Timing: " + movie.Options.MovieTiming);
            tv.Nodes[1].Nodes.Add("Uses Hacks:   " + movie.PXMSpecific.UsesHacks.ToString());
            tv.Nodes[1].Nodes.Add("Contains Embedded Memory Cards: " + movie.PXMSpecific.HasEmbeddedMemoryCards.ToString());
            tv.Nodes[1].Nodes.Add("Contains Embedded Cheat List:   " + movie.PXMSpecific.HasEmbeddedCheatList.ToString());
            tv.Nodes[1].Nodes.Add("Uses analog hack:               " + movie.PXMSpecific.EnabledAnalogHack.ToString());
            tv.Nodes[1].Nodes.Add("Uses Parasite Eve/Vandal Hearts fix: " + movie.PXMSpecific.EnabledParasiteEveFix.ToString());
            tv.Nodes.Add("Metadata");
            tv.Nodes[2].Nodes.Add("Author: " + movie.Extra.Author);

            tv.Nodes.Add("CD-ROM Information");
            tv.Nodes[3].Nodes.Add("CD-ROM Count: " + movie.PXMSpecific.CDRomCount);
            for (int i = 0; i < movie.PXMSpecific.CDRomCount; i++)
            {
                tv.Nodes[3].Nodes.Add("CD-ROM ID " + (i + 1) + ":  " + movie.Extra.ROM.Substring(i * 9, 9));
            }

            tv.Nodes.Add("Controllers");
            tv.Nodes[4].Nodes.Add("Controller 1 Type: " + movie.PXMSpecific.GetControllerTypeString(0));
            tv.Nodes[4].Nodes.Add("Controller 2 Type: " + movie.PXMSpecific.GetControllerTypeString(1));
            tv.Nodes[4].Nodes.Add("P1 Multitap On:    " + movie.PXMSpecific.P1MultitapToggle.ToString());
            tv.Nodes[4].Nodes.Add("P2 Multitap On:    " + movie.PXMSpecific.P2MultitapToggle.ToString());

            movie = null; tv.ExpandAll(); tv.Nodes[0].EnsureVisible();
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Populate a Dega movie file's header information
        /// </summary>
        public static void MMV(ref TreeView tv, ref TASMovie mmv)
        {
            Dega movie = (Dega)mmv;
            tv.Nodes.Clear();

            tv.Nodes.Add("Header");
            tv.Nodes[0].Nodes.Add("Signature:      " + movie.Header.Signature);
            tv.Nodes[0].Nodes.Add("Version:        " + movie.Header.Version.ToString());
            tv.Nodes[0].Nodes.Add("Frame Count:    " + String.Format("{0:0,0}", movie.Header.FrameCount));
            tv.Nodes[0].Nodes.Add("Rerecord Count: " + String.Format("{0:0,0}", movie.Header.RerecordCount));

            tv.Nodes.Add("Options");
            tv.Nodes[1].Nodes.Add("Movie Start:  " + movie.Options.MovieStart);
            tv.Nodes[1].Nodes.Add("Movie Timing: " + movie.Options.MovieTiming);
            tv.Nodes[1].Nodes.Add("System Type");
            tv.Nodes[1].Nodes[2].Nodes.Add("Japan:     " + movie.MMVSpecific.Japan.ToString());
            tv.Nodes[1].Nodes[2].Nodes.Add("Game Gear: " + movie.MMVSpecific.GameGear.ToString());

            tv.Nodes.Add("Metadata");
            tv.Nodes[2].Nodes.Add("Author: " + movie.Extra.Author);

            tv.Nodes.Add("ROM Information");
            tv.Nodes[3].Nodes.Add("ROM Name: " + movie.Extra.ROM);
            tv.Nodes[3].Nodes.Add("ROM MD5:  " + movie.Extra.CRC);

            tv.Nodes.Add("Controllers");
            tv.Nodes[4].Nodes.Add("Controller 1 Present: " + movie.Input.Controllers[0].ToString());
            tv.Nodes[4].Nodes.Add("Controller 2 Present: " + movie.Input.Controllers[1].ToString());

            movie = null; tv.ExpandAll(); tv.Nodes[0].EnsureVisible();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Populate a Mupen64 movie file's header information
        /// </summary>
        public static void M64(ref TreeView tv, ref TASMovie m64)
        {
            Mupen64 movie = (Mupen64)m64;
            tv.Nodes.Clear();

            tv.Nodes.Add("Header");
            tv.Nodes[0].Nodes.Add("Signature:      " + movie.Header.Signature);
            tv.Nodes[0].Nodes.Add("Version:        " + movie.Header.Version.ToString());
            tv.Nodes[0].Nodes.Add("UID:            " + movie.Header.UID);
            tv.Nodes[0].Nodes.Add("Frame Count:    " + String.Format("{0:0,0}", movie.Header.FrameCount));
            tv.Nodes[0].Nodes.Add("Rerecord Count: " + String.Format("{0:0,0}", movie.Header.RerecordCount));

            tv.Nodes.Add("Options");
            tv.Nodes[1].Nodes.Add("FPS:         " + movie.Options.FPS);
            tv.Nodes[1].Nodes.Add("Movie Start: " + movie.Options.MovieStart);

            tv.Nodes.Add("ROM Information");
            tv.Nodes[2].Nodes.Add("Name:    " + movie.Extra.ROM);
            tv.Nodes[2].Nodes.Add("CRC:     " + movie.Extra.CRC);
            tv.Nodes[2].Nodes.Add("Country: " + movie.Extra.Country);

            tv.Nodes.Add("Extra Information");
            tv.Nodes[3].Nodes.Add("Author:       " + movie.Extra.Author);
            tv.Nodes[3].Nodes.Add("Description:  " + movie.Extra.Description);
            tv.Nodes[3].Nodes.Add("Video Plugin: " + movie.M64Specific.VideoPlugin);
            tv.Nodes[3].Nodes.Add("Audio Plugin: " + movie.M64Specific.AudioPlugin);
            tv.Nodes[3].Nodes.Add("Input Plugin: " + movie.M64Specific.InputPlugin);
            tv.Nodes[3].Nodes.Add("RSP Plugin:   " + movie.M64Specific.RSPPlugin);

            tv.Nodes.Add("Controller Information");
            for (int i = 0; i < 4; i++)
            {
                tv.Nodes[4].Nodes.Add("Controller " + (i + 1));
                tv.Nodes[4].Nodes[i].Nodes.Add("Controller Present: " + movie.M64Specific.Controller[i].Option[0]);
                tv.Nodes[4].Nodes[i].Nodes.Add("Mempak Present:     " + movie.M64Specific.Controller[i].Option[1]);
                tv.Nodes[4].Nodes[i].Nodes.Add("Rumblepak Present:  " + movie.M64Specific.Controller[i].Option[2]);
            }

            movie = null; tv.ExpandAll(); tv.Nodes[0].EnsureVisible();
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Populate a Gens movie file's header information
        /// </summary>
        public static void GMV(ref TreeView tv, ref TASMovie gmv)
        {
            Gens movie = (Gens)gmv;
            tv.Nodes.Clear();

            tv.Nodes.Add("Header");
            tv.Nodes[0].Nodes.Add("Signature:      " + movie.Header.Signature);
            tv.Nodes[0].Nodes.Add("Version:        " + movie.Header.Version.ToString());
            tv.Nodes[0].Nodes.Add("Movie Name:     " + movie.Extra.Description);
            tv.Nodes[0].Nodes.Add("Frame Count:    " + String.Format("{0:0,0}", movie.Header.FrameCount));
            tv.Nodes[0].Nodes.Add("Rerecord Count: " + String.Format("{0:0,0}", movie.Header.RerecordCount));

            if (movie.Header.Version > 0x09)
            {
                tv.Nodes[0].Nodes.Add("FPS:            " + movie.Options.FPS);
                tv.Nodes[0].Nodes.Add("Movie Start:    " + movie.Options.MovieStart);
            }

            tv.Nodes.Add("Controllers");
            tv.Nodes[1].Nodes.Add("Controller 1: true");
            tv.Nodes[1].Nodes[0].Nodes.Add("Config: " + movie.GMVSpecific.Player1Config + " button");
            tv.Nodes[1].Nodes.Add("Controller 2: true");
            tv.Nodes[1].Nodes[1].Nodes.Add("Config: " + movie.GMVSpecific.Player2Config + " button");
            tv.Nodes[1].Nodes.Add("Controller 3: false");

            if (movie.Header.Version > 0x09)
                if (movie.Input.ControllerCount == 3)
                    tv.Nodes[1].Nodes[2].Text = "Controller 3: true";

            movie = null; tv.ExpandAll(); tv.Nodes[0].EnsureVisible();
        }
Ejemplo n.º 10
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;
        }
Ejemplo n.º 11
0
        public void InitData()
        {
            movie = null;

            heldinput_max = 7;
            maxcombinations_persave = 25000;

            frameinsert_do = false;
            frameinsert_min = 0;
            frameinsert_max = 0;
            frameinsert_onframes = new int[0];
            frameinsert_onframes_original = "";
            frameinsert_framestart = 0;
            frameinsert_frameend = -1;
            frameinsert_inputs = null;
            frameinsert_inputs_original = "";
            frameinsert_combineinputs = true;
            frameinsert_pushframelist_oninsert = true;
            frameinsert_pushframelist_onremove = true;

            inputreplace_do = false;
            inputreplace_onframes = new int[0];
            inputreplace_onframes_original = "";
            inputreplace_framestart = 0;
            inputreplace_frameend = -1;
            inputreplace_includeidleframes_onsearch = false;
            inputreplace_inputs = null;
            inputreplace_inputs_original = "";
            inputreplace_combineinputs = true;
            inputreplace_pushframelist_oninsert = true;
            inputreplace_pushframelist_onremove = true;

            frameremove_do = false;
            frameremove_min = 0;
            frameremove_max = 0;
            frameremove_onframes = new int[0];
            frameremove_onframes_original = "";
            frameremove_framestart = 0;
            frameremove_frameend = -1;
            frameremove_inputs = null;
            frameremove_inputs_original = "";
            frameremove_combineinputs = true;
            frameremove_pushframelist_oninsert = true;
            frameremove_pushframelist_onremove = true;

            frameinsert_current = -1;
            frameremove_current = -1;
            frameinsert_iteration = -1;
            frameremove_iteration = -1;
            frameinsert_totalframesinsertedsofar = 0;
            frameremove_totalframesremovedsofar = 0;
            addonemoreinsertsub = false;
            addonemorereplace = false;

            insertCombinations = null;
            removeCombinations = null;
            replaceCombinations = null;
            insertSubCombinations = null;
            insert_combinations_restore = "";
            remove_combinations_restore = "";
            replace_combinations_restore = "";
            insert_subcombinations_restore = "";

            finishrunning = false;

            movieheader_endindex = 0;

            lastmoviesaved_index = 0;
            numbermoviessavedthissession = 0;
            restored_fromsave = false;
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Loads a TAS into the editor
        /// </summary>
        private void loadMovie(string filename, bool fromRecent)
        {
            resetApplication();

            // initialize the editor
            Editor = new frmEditing();
            mnuEditing.Enabled = true;

            // copy the clean frame data to the undo buffer as the first item
            mnuUndoChange.Enabled = true;

            // make sure the file isn't locked before we do anything else
            System.IO.FileStream fs = null;
            try
            {
                fs = System.IO.File.OpenRead(filename);
            }
            catch
            {
                MessageBox.Show(this,
                    filename + " cannot be accessed at the moment.\nEither the file is locked or it doesn't exist.",
                    "File Access Error",
                    MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
                return;
            }
            finally
            {
                if (fs != null) fs.Close();
            }

            try
            {
                FrameData.Format = IsValid(filename);
                ResourceManager rm = new ResourceManager("MovieSplicer.Properties.Resources", GetType().Assembly);

                // load the movie object up with the correct format and display a thumbnail
                switch (FrameData.Format)
                {
                    case MovieType.SMV:
                        Movie = new SNES9x(filename);
                        Methods.PopulateMovieInfo.SMV(ref tvInfo, ref Movie);
                        pbFormat.Image = ((System.Drawing.Icon)(rm.GetObject("icon_smv"))).ToBitmap();
                        break;
                    case MovieType.FCM:
                        Movie = new FCEU(filename);
                        Methods.PopulateMovieInfo.FCM(ref tvInfo, ref Movie);
                        pbFormat.Image = ((System.Drawing.Icon)(rm.GetObject("icon_fcm"))).ToBitmap();
                        break;
                    case MovieType.GMV:
                        Movie = new Gens(filename);
                        Methods.PopulateMovieInfo.GMV(ref tvInfo, ref Movie);
                        pbFormat.Image = ((System.Drawing.Icon)(rm.GetObject("icon_gmv"))).ToBitmap();
                        break;
                    case MovieType.FMV:
                        Movie = new Famtasia(filename);
                        Methods.PopulateMovieInfo.FMV(ref tvInfo, ref Movie);
                        pbFormat.Image = ((System.Drawing.Icon)(rm.GetObject("icon_fmv"))).ToBitmap();
                        break;
                    case MovieType.VBM:
                        Movie = new VisualBoyAdvance(filename);
                        Methods.PopulateMovieInfo.VBM(ref tvInfo, ref Movie);
                        pbFormat.Image = ((System.Drawing.Icon)(rm.GetObject("icon_vbm"))).ToBitmap();
                        break;
                    case MovieType.M64:
                        Movie = new Mupen64(filename);
                        Methods.PopulateMovieInfo.M64(ref tvInfo, ref Movie);
                        pbFormat.Image = ((System.Drawing.Icon)(rm.GetObject("icon_m64"))).ToBitmap();
                        break;
                    case MovieType.MMV:
                        Movie = new Dega(filename);
                        Methods.PopulateMovieInfo.MMV(ref tvInfo, ref Movie);
                        pbFormat.Image = ((System.Drawing.Icon)(rm.GetObject("icon_mmv"))).ToBitmap();
                        break;
                    case MovieType.PJM:
                        Movie = new PCSX(filename);   // shares with PXM
                        Methods.PopulateMovieInfo.PXM(ref tvInfo, ref Movie);   // shares with PXM
                        pbFormat.Image = ((System.Drawing.Icon)(rm.GetObject("icon_pjm"))).ToBitmap();
                        //pbFormat.Click += new EventHandler(PCSX.PCSXHelp);
                        break;
                    case MovieType.PXM:
                        Movie = new PCSX(filename);   // shares with PJM
                        Methods.PopulateMovieInfo.PXM(ref tvInfo, ref Movie);   // shares with PJM
                        pbFormat.Image = ((System.Drawing.Icon)(rm.GetObject("icon_pxm"))).ToBitmap();
                        //pbFormat.Click += new EventHandler(PCSX.PCSXHelp);
                        break;
                    case MovieType.None:
                        resetApplication();
                        return;
                }

                // destroy the resource manager instance
                rm = null;

                // assign the shared input collection to the current movie's
                FrameData.Input = Movie.Input.FrameData;
                FrameData.Controllers = Movie.Input.ControllerCount;

                // initialize editing fields
                bool[] activeControllers = { false, false, false, false, false };
                int[]  activeSubItems = new int[Movie.Input.ControllerCount];
                int j = 0;
                for (int i = 0; i < Movie.Input.Controllers.Length; i++)
                    if (Movie.Input.Controllers[i])
                    {
                        activeControllers[i] = true;
                        activeSubItems[j++]    = i;
                    }
                Editor.ToggleInputBoxes(activeControllers);

                // trim the filename and throw it into a text field
                txtMovieFilename.Text = FilenameFromPath(filename);

                // enable grayed menu options
                mnuSave.Enabled = true;
                mnuSaveAs.Enabled = true;
                mnuClose.Enabled = true;

                // populate the virtual listview
                lvInput.ClearVirtualCache();
                lvInput.VirtualSubItemsActive = activeControllers;
                lvInput.VirtualActiveSubItems = activeSubItems;
                lvInput.VirtualSubItemNames   = Movie.ControllerNames;
                lvInput.VirtualListSource     = FrameData.Input;
                lvInput.VirtualListSize       = FrameData.Input.Length;

                // set the number of controller columns
                lvInput.SetColumns(Movie.Input.ControllerCount);
                lvInput.VirtualMovieType = FrameData.Format;

                // add frame count to statusbar
                sbarFrameCount.Text = FrameData.Input.Length.ToString();
                frd.GotoFrameNumberLabel = getFrameNumberRange();

                Editor.LoadSharedObjects(ref lvInput, ref FrameData.Input, ref UndoHistory, ref Msg);
                Msg.AddMsg("Successfully loaded " + FilenameFromPath(filename));

                // show subtitle export option
                mnuExportSRT.Enabled = true;

                Methods.AppSettings.Save(filename);
                populateRecentFiles();

                runMovieGeneratorToolStripMenuItem.Enabled = true;
            }
            catch
            {
                MessageBox.Show(this,
                    filename + "An unknown error occurred.",
                    "Unknown Error",
                    MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
                return;
            }
            finally
            {
                if (fs != null) fs.Close();
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Reset all objects and controls to their default state
        /// </summary>
        private void resetApplication()
        {
            // disable menu commands that require a movie to be loaded in order to operate
            mnuSave.Enabled   = false;
            mnuSaveAs.Enabled = false;
            mnuClose.Enabled  = false;
            mnuExportSRT.Enabled = true;

            // reset the input list
            lvInput.SetColumns(0);
            lvInput.VirtualListSize = 0;

            // clear the movie treeview
            tvInfo.Nodes.Clear();

            // nullify the input data reference
            FrameData.Input  = null;
            FrameData.Format = MovieType.None;

            // reset the editor
            if (Editor != null)
                Editor.Close();
            Editor = null;
            mnuEditing.Enabled = false;

            // clear the undo history
            UndoHistory.Changes = new TASMovieInput[0][];
            mnuUndoChange.Enabled = false;

            Movie = null;

            // clear the icon
            pbFormat.Image = null;

            runMovieGeneratorToolStripMenuItem.Enabled = false;

            // reset filename
            txtMovieFilename.Text = "";
            sbarFrameCount.Text = "0";
            frd.GotoFrameNumberLabel = getFrameNumberRange();
        }