Remove BkmLog.cs

This commit is contained in:
adelikat 2014-06-15 02:23:28 +00:00
parent f5f832180d
commit 9ac32a688a
6 changed files with 53 additions and 56 deletions

View File

@ -140,7 +140,6 @@
<Compile Include="movie\bk2\Bk2Movie.IO.cs" />
<Compile Include="movie\bk2\Bk2Movie.ModeApi.cs" />
<Compile Include="movie\bkm\BkmHeader.cs" />
<Compile Include="movie\bkm\BkmLog.cs" />
<Compile Include="movie\bkm\BkmLogEntryGenerator.cs" />
<Compile Include="movie\bkm\BkmMnemonicConstants.cs" />
<Compile Include="movie\bkm\BkmMovie.cs" />

View File

@ -9,7 +9,7 @@ namespace BizHawk.Client.Common
{
public partial class Bk2Movie : IMovie
{
private readonly BkmLog _log = new BkmLog();
private readonly List<string> _log = new List<string>();
public string GetInputLog()
{
@ -136,7 +136,7 @@ namespace BizHawk.Client.Common
}
else if (line.StartsWith("|"))
{
_log.SetFrameAt(i, line);
SetFrameAt(i, line);
i++;
}
}
@ -153,14 +153,14 @@ namespace BizHawk.Client.Common
{
if (!Global.Config.VBAStyleMovieLoadState)
{
_log.Truncate(stateFramei);
Truncate(stateFramei);
}
}
else if (stateFramei > _log.Count) // Post movie savestate
{
if (!Global.Config.VBAStyleMovieLoadState)
{
_log.Truncate(_log.Count);
Truncate(_log.Count);
}
_mode = Moviemode.Finished;
@ -178,7 +178,7 @@ namespace BizHawk.Client.Common
{
// This function will compare the movie data to the savestate movie data to see if they match
errorMessage = string.Empty;
var newLog = new BkmLog();
var newLog = new List<string>();
var stateFrame = 0;
while (true)
{

View File

@ -106,21 +106,24 @@ namespace BizHawk.Client.Common
{
if (Global.Emulator.Frame < _log.Count)
{
_log.Truncate(Global.Emulator.Frame);
Truncate(Global.Emulator.Frame);
}
}
var lg = LogGeneratorInstance();
lg.SetSource(source);
_log.SetFrameAt(frame, lg.GenerateLogEntry());
SetFrameAt(frame, lg.GenerateLogEntry());
Changes = true;
}
public void Truncate(int frame)
{
_log.Truncate(frame);
Changes = true;
if (frame < _log.Count)
{
_log.RemoveRange(frame, _log.Count - frame);
Changes = true;
}
}
public string GetInput(int frame)
@ -160,7 +163,7 @@ namespace BizHawk.Client.Common
public void ClearFrame(int frame)
{
_log.SetFrameAt(frame, LogGeneratorInstance().EmptyEntry);
SetFrameAt(frame, LogGeneratorInstance().EmptyEntry);
}
#endregion
@ -176,5 +179,17 @@ namespace BizHawk.Client.Common
return frames / Fps;
}
private void SetFrameAt(int frameNum, string frame)
{
if (_log.Count > frameNum)
{
_log[frameNum] = frame;
}
else
{
_log.Add(frame);
}
}
}
}

View File

@ -1,33 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace BizHawk.Client.Common
{
/// <summary>
/// Represents the controller key presses of a movie
/// </summary>
public class BkmLog : List<string>
{
public void SetFrameAt(int frameNum, string frame)
{
if (this.Count > frameNum)
{
this[frameNum] = frame;
}
else
{
this.Add(frame);
}
}
public void Truncate(int frame)
{
if (frame < this.Count)
{
this.RemoveRange(frame, this.Count - frame);
}
}
}
}

View File

@ -1,4 +1,5 @@
using System.Globalization;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
@ -7,7 +8,7 @@ namespace BizHawk.Client.Common
{
public partial class BkmMovie : IMovie
{
private readonly BkmLog _log = new BkmLog();
private readonly List<string> _log = new List<string>();
public string GetInputLog()
{
@ -139,7 +140,7 @@ namespace BizHawk.Client.Common
}
else if (line.StartsWith("|"))
{
_log.SetFrameAt(i, line);
SetFrameAt(i, line);
i++;
}
}
@ -156,14 +157,14 @@ namespace BizHawk.Client.Common
{
if (!Global.Config.VBAStyleMovieLoadState)
{
_log.Truncate(stateFramei);
Truncate(stateFramei);
}
}
else if (stateFramei > _log.Count) // Post movie savestate
{
if (!Global.Config.VBAStyleMovieLoadState)
{
_log.Truncate(_log.Count);
Truncate(_log.Count);
}
_mode = Moviemode.Finished;
@ -181,7 +182,7 @@ namespace BizHawk.Client.Common
{
// This function will compare the movie data to the savestate movie data to see if they match
errorMessage = string.Empty;
var log = new BkmLog();
var log = new List<string>();
var stateFrame = 0;
while (true)
{

View File

@ -134,7 +134,7 @@ namespace BizHawk.Client.Common
public void ClearFrame(int frame)
{
var lg = LogGeneratorInstance();
_log.SetFrameAt(frame, lg.EmptyEntry);
SetFrameAt(frame, lg.EmptyEntry);
_changes = true;
}
@ -148,8 +148,11 @@ namespace BizHawk.Client.Common
public void Truncate(int frame)
{
_log.Truncate(frame);
_changes = true;
if (frame < _log.Count)
{
_log.RemoveRange(frame, _log.Count - frame);
_changes = true;
}
}
public void PokeFrame(int frame, IController source)
@ -158,7 +161,7 @@ namespace BizHawk.Client.Common
lg.SetSource(source);
_changes = true;
_log.SetFrameAt(frame, lg.GenerateLogEntry());
SetFrameAt(frame, lg.GenerateLogEntry());
}
public void RecordFrame(int frame, IController source)
@ -170,13 +173,13 @@ namespace BizHawk.Client.Common
{
if (Global.Emulator.Frame < _log.Count)
{
_log.Truncate(Global.Emulator.Frame);
Truncate(Global.Emulator.Frame);
}
}
var lg = LogGeneratorInstance();
lg.SetSource(source);
_log.SetFrameAt(frame, lg.GenerateLogEntry());
SetFrameAt(frame, lg.GenerateLogEntry());
_changes = true;
}
@ -194,5 +197,17 @@ namespace BizHawk.Client.Common
return frames / Fps;
}
private void SetFrameAt(int frameNum, string frame)
{
if (_log.Count > frameNum)
{
_log[frameNum] = frame;
}
else
{
_log.Add(frame);
}
}
}
}