Example #1
0
        public Bk2Movie()
        {
            Subtitles = new SubtitleList();
            Comments  = new List <string>();

            Filename            = string.Empty;
            IsCountingRerecords = true;
            _mode      = Moviemode.Inactive;
            MakeBackup = true;

            Header[HeaderKeys.MOVIEVERSION] = "BizHawk v2.0.0";

            _log = StringLogUtil.MakeStringLog();
        }
Example #2
0
        public Bk2Movie(string filename = null)
        {
            Subtitles = new SubtitleList();
            Comments  = new List <string>();

            Filename            = filename ?? string.Empty;
            IsCountingRerecords = true;
            if (filename != null)
            {
                Rerecords = 0;
            }
            Mode       = MovieMode.Inactive;
            MakeBackup = true;

            Header[HeaderKeys.MovieVersion] = "BizHawk v2.0.0";

            Log = StringLogUtil.MakeStringLog();
        }
Example #3
0
        public void Load(BinaryStateLoader bl, TasMovie movie)
        {
            var nheader          = new IndexedStateLump(BinaryStateLump.BranchHeader);
            var ncore            = new IndexedStateLump(BinaryStateLump.BranchCoreData);
            var ninput           = new IndexedStateLump(BinaryStateLump.BranchInputLog);
            var nframebuffer     = new IndexedStateLump(BinaryStateLump.BranchFrameBuffer);
            var ncoreframebuffer = new IndexedStateLump(BinaryStateLump.BranchCoreFrameBuffer);
            var nmarkers         = new IndexedStateLump(BinaryStateLump.BranchMarkers);
            var nusertext        = new IndexedStateLump(BinaryStateLump.BranchUserText);

            Clear();

            while (true)
            {
                var b = new TasBranch();

                if (!bl.GetLump(nheader, false, delegate(TextReader tr)
                {
                    var header = (dynamic)JsonConvert.DeserializeObject(tr.ReadLine());
                    b.Frame = (int)header.Frame;

                    var timestamp = header.TimeStamp;

                    if (timestamp != null)
                    {
                        b.TimeStamp = (DateTime)timestamp;
                    }
                    else
                    {
                        b.TimeStamp = DateTime.Now;
                    }

                    var identifier = header.UniqueIdentifier;
                    if (identifier != null)
                    {
                        b.UniqueIdentifier = (Guid)identifier;
                    }
                    else
                    {
                        b.UniqueIdentifier = Guid.NewGuid();
                    }
                }))
                {
                    return;
                }

                bl.GetLump(ncore, true, delegate(Stream s, long length)
                {
                    b.CoreData = new byte[length];
                    s.Read(b.CoreData, 0, b.CoreData.Length);
                });

                bl.GetLump(ninput, true, delegate(TextReader tr)
                {
                    b.InputLog = StringLogUtil.MakeStringLog();
                    string line;
                    while ((line = tr.ReadLine()) != null)
                    {
                        b.InputLog.Add(line);
                    }
                });

                bl.GetLump(nframebuffer, true, delegate(Stream s, long length)
                {
                    var vp = new QuickBmpFile.LoadedBMP();
                    QuickBmpFile.Load(vp, s);
                    b.OSDFrameBuffer = new BitmapBuffer(vp.BufferWidth, vp.BufferHeight, vp.VideoBuffer);
                });

                bl.GetLump(ncoreframebuffer, false, delegate(Stream s, long length)
                {
                    var vp = new QuickBmpFile.LoadedBMP();
                    QuickBmpFile.Load(vp, s);
                    b.CoreFrameBuffer = new BitmapBuffer(vp.BufferWidth, vp.BufferHeight, vp.VideoBuffer);
                });

                b.Markers = new TasMovieMarkerList(movie);
                bl.GetLump(nmarkers, false, delegate(TextReader tr)
                {
                    string line;
                    while ((line = tr.ReadLine()) != null)
                    {
                        if (!string.IsNullOrWhiteSpace(line))
                        {
                            b.Markers.Add(new TasMovieMarker(line));
                        }
                    }
                });

                bl.GetLump(nusertext, false, delegate(TextReader tr)
                {
                    string line;
                    if ((line = tr.ReadLine()) != null)
                    {
                        if (!string.IsNullOrWhiteSpace(line))
                        {
                            b.UserText = line;
                        }
                    }
                });

                Add(b);

                nheader.Increment();
                ncore.Increment();
                ninput.Increment();
                nframebuffer.Increment();
                ncoreframebuffer.Increment();
                nmarkers.Increment();
                nusertext.Increment();
            }
        }