fix keylog not being respected (#3274)

resolves #2843
This commit is contained in:
Moritz Bender 2022-07-10 16:47:58 +02:00 committed by GitHub
parent 1948721991
commit e4fafa6cb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 5 deletions

View File

@ -21,6 +21,7 @@ namespace BizHawk.Client.Common
string newFilename = ConvertFileNameToTasMovie(old.Filename);
var tas = (ITasMovie)old.Session.Get(newFilename);
tas.CopyLog(old.GetLogEntries());
tas.LogKey = old.LogKey;
old.Truncate(0); // Trying to minimize ram usage
@ -56,6 +57,7 @@ namespace BizHawk.Client.Common
{
var bk2 = old.Session.Get(old.Filename.Replace(old.PreferredExtension, Bk2Movie.Extension));
bk2.CopyLog(old.GetLogEntries());
bk2.LogKey = old.LogKey;
bk2.HeaderEntries.Clear();
foreach (var (k, v) in old.HeaderEntries) bk2.HeaderEntries[k] = v;
@ -95,6 +97,7 @@ namespace BizHawk.Client.Common
var entries = old.GetLogEntries();
tas.CopyLog(entries.Skip(frame));
tas.LogKey = old.LogKey;
tas.CopyVerificationLog(old.VerificationLog);
tas.CopyVerificationLog(entries.Take(frame));

View File

@ -1,6 +1,5 @@
using System.Collections.Generic;
using System.IO;
using BizHawk.Common;
namespace BizHawk.Client.Common
@ -8,14 +7,20 @@ namespace BizHawk.Client.Common
public partial class Bk2Movie
{
protected IStringLog Log { get; set; } = StringLogUtil.MakeStringLog();
protected string LogKey { get; set; } = "";
public string LogKey { get; set; }
public void WriteInputLog(TextWriter writer)
{
writer.WriteLine("[Input]");
var lg = LogGeneratorInstance(Session.MovieController);
writer.WriteLine(lg.GenerateLogKey());
if (string.IsNullOrEmpty(LogKey))
{
var lg = LogGeneratorInstance(Session.MovieController);
writer.WriteLine(lg.GenerateLogKey());
}
else
{
writer.WriteLine($"LogKey:{LogKey}");
}
foreach (var record in Log)
{

View File

@ -100,6 +100,7 @@ namespace BizHawk.Client.Common
string OriginalEmulatorVersion { get; set; }
string FirmwareHash { get; set; }
string BoardName { get; set; }
string LogKey { get; set; }
/// <summary>
/// Loads from the HawkFile the minimal amount of information needed to determine Header info and Movie length.