コード例 #1
0
        public static ITasMovie ConvertToSavestateAnchoredMovie(this ITasMovie old, int frame, byte[] savestate)
        {
            string newFilename = ConvertFileNameToTasMovie(old.Filename);

            var tas = (ITasMovie)old.Session.Get(newFilename);

            tas.BinarySavestate = savestate;
            tas.LagLog.Clear();

            var entries = old.GetLogEntries();

            tas.CopyLog(entries.Skip(frame));
            tas.CopyVerificationLog(old.VerificationLog);
            tas.CopyVerificationLog(entries.Take(frame));

            // States can't be easily moved over, because they contain the frame number.
            // TODO? I'm not sure how this would be done.
            old.TasStateManager.Clear();

            // Lag Log
            tas.LagLog.FromLagLog(old.LagLog);
            tas.LagLog.StartFromFrame(frame);

            tas.HeaderEntries.Clear();
            foreach (var kvp in old.HeaderEntries)
            {
                tas.HeaderEntries[kvp.Key] = kvp.Value;
            }

            tas.StartsFromSavestate = true;
            tas.SyncSettingsJson    = old.SyncSettingsJson;

            tas.Comments.Clear();
            foreach (string comment in old.Comments)
            {
                tas.Comments.Add(comment);
            }

            tas.Subtitles.Clear();
            foreach (Subtitle sub in old.Subtitles)
            {
                tas.Subtitles.Add(sub);
            }

            foreach (TasMovieMarker marker in old.Markers)
            {
                if (marker.Frame > frame)
                {
                    tas.Markers.Add(new TasMovieMarker(marker.Frame - frame, marker.Message));
                }
            }

            tas.TasStateManager.UpdateSettings(old.TasStateManager.Settings);

            tas.Save();
            return(tas);
        }
コード例 #2
0
        public static ITasMovie ConvertToSaveRamAnchoredMovie(this ITasMovie old, byte[] saveRam)
        {
            string newFilename = ConvertFileNameToTasMovie(old.Filename);

            var tas = (ITasMovie)old.Session.Get(newFilename);

            tas.SaveRam = saveRam;
            tas.TasStateManager.Clear();
            tas.LagLog.Clear();

            var entries = old.GetLogEntries();

            tas.CopyVerificationLog(old.VerificationLog);
            tas.CopyVerificationLog(entries);

            tas.HeaderEntries.Clear();
            foreach (var kvp in old.HeaderEntries)
            {
                tas.HeaderEntries[kvp.Key] = kvp.Value;
            }

            tas.StartsFromSaveRam = true;
            tas.SyncSettingsJson  = old.SyncSettingsJson;

            tas.Comments.Clear();
            foreach (string comment in old.Comments)
            {
                tas.Comments.Add(comment);
            }

            tas.Subtitles.Clear();
            foreach (Subtitle sub in old.Subtitles)
            {
                tas.Subtitles.Add(sub);
            }

            tas.TasStateManager.UpdateSettings(old.TasStateManager.Settings);

            tas.Save();
            return(tas);
        }
コード例 #3
0
        public static ITasMovie ConvertToSaveRamAnchoredMovie(this ITasMovie old, byte[] saveRam)
        {
            string newFilename = old.Filename;

            if (old.Filename.Contains("tasproj"))
            {
                newFilename = newFilename.Remove(newFilename.Length - 7, 7);
                newFilename = $"{newFilename}nfsr.{TasMovie.Extension}";
            }
            else
            {
                newFilename = $"{old.Filename}.{TasMovie.Extension}";
            }

            if (File.Exists(newFilename))
            {
                int  fileNum      = 1;
                bool fileConflict = true;
                while (fileConflict)
                {
                    if (File.Exists(newFilename))
                    {
                        newFilename = $"{old.Filename} ({fileNum}).{TasMovie.Extension}";
                        fileNum++;
                    }
                    else
                    {
                        fileConflict = false;
                    }
                }
            }

            var tas = (ITasMovie)MovieService.Get(newFilename, false);

            tas.SaveRam = saveRam;
            tas.TasStateManager.Clear();
            tas.LagLog.Clear();

            var entries = old.GetLogEntries();

            tas.CopyVerificationLog(old.VerificationLog);
            tas.CopyVerificationLog(entries);

            tas.HeaderEntries.Clear();
            foreach (var kvp in old.HeaderEntries)
            {
                tas.HeaderEntries[kvp.Key] = kvp.Value;
            }

            tas.StartsFromSaveRam = true;
            tas.SyncSettingsJson  = old.SyncSettingsJson;

            tas.Comments.Clear();
            foreach (string comment in old.Comments)
            {
                tas.Comments.Add(comment);
            }

            tas.Subtitles.Clear();
            foreach (Subtitle sub in old.Subtitles)
            {
                tas.Subtitles.Add(sub);
            }

            tas.TasStateManager.Settings = old.TasStateManager.Settings;

            tas.Save();
            return(tas);
        }
コード例 #4
0
        public static ITasMovie ConvertToSavestateAnchoredMovie(this ITasMovie old, int frame, byte[] savestate)
        {
            string newFilename = old.Filename;

            if (old.Filename.Contains("tasproj"))
            {
                newFilename = newFilename.Remove(newFilename.Length - 7, 7);
                newFilename = $"{newFilename}nfn.{TasMovie.Extension}";
            }
            else
            {
                newFilename = $"{old.Filename}.{TasMovie.Extension}";
            }

            if (File.Exists(newFilename))
            {
                int  fileNum      = 1;
                bool fileConflict = true;
                while (fileConflict)
                {
                    if (File.Exists(newFilename))
                    {
                        newFilename = $"{old.Filename} ({fileNum}).{TasMovie.Extension}";
                        fileNum++;
                    }
                    else
                    {
                        fileConflict = false;
                    }
                }
            }

            var tas = (ITasMovie)MovieService.Get(newFilename, true);

            tas.BinarySavestate = savestate;
            tas.LagLog.Clear();

            var entries = old.GetLogEntries();

            tas.CopyLog(entries.Skip(frame));
            tas.CopyVerificationLog(old.VerificationLog);
            tas.CopyVerificationLog(entries.Take(frame));

            // States can't be easily moved over, because they contain the frame number.
            // TODO? I'm not sure how this would be done.
            old.TasStateManager.Clear();

            // Lag Log
            tas.LagLog.FromLagLog(old.LagLog);
            tas.LagLog.StartFromFrame(frame);

            tas.HeaderEntries.Clear();
            foreach (var kvp in old.HeaderEntries)
            {
                tas.HeaderEntries[kvp.Key] = kvp.Value;
            }

            tas.StartsFromSavestate = true;
            tas.SyncSettingsJson    = old.SyncSettingsJson;

            tas.Comments.Clear();
            foreach (string comment in old.Comments)
            {
                tas.Comments.Add(comment);
            }

            tas.Subtitles.Clear();
            foreach (Subtitle sub in old.Subtitles)
            {
                tas.Subtitles.Add(sub);
            }

            foreach (TasMovieMarker marker in old.Markers)
            {
                if (marker.Frame > frame)
                {
                    tas.Markers.Add(new TasMovieMarker(marker.Frame - frame, marker.Message));
                }
            }

            tas.TasStateManager.Settings = old.TasStateManager.Settings;

            tas.Save();
            return(tas);
        }