Remove Rerecords from IMovie since it is a part of IHeader, therefore redundant and conceptually inappropriate. Also some low hanging fruit on implementing TasMovie.cs

This commit is contained in:
adelikat 2013-12-02 17:50:29 +00:00
parent db43c85715
commit 0e6473987b
6 changed files with 19 additions and 36 deletions

View File

@ -98,7 +98,7 @@ namespace BizHawk.Client.Common
public static string movie_rerecordcount() public static string movie_rerecordcount()
{ {
return Global.MovieSession.Movie.Rerecords.ToString(); return Global.MovieSession.Movie.Header.Rerecords.ToString();
} }
public static void movie_setreadonly(object lua_input) public static void movie_setreadonly(object lua_input)

View File

@ -28,9 +28,7 @@ namespace BizHawk.Client.Common
/// Actual length of the input log, should only be used by code that iterates or needs a real length /// Actual length of the input log, should only be used by code that iterates or needs a real length
/// </summary> /// </summary>
int InputLogLength { get; } int InputLogLength { get; }
ulong Rerecords { get; set; }
IMovieHeader Header { get; } IMovieHeader Header { get; }
#endregion #endregion

View File

@ -15,7 +15,7 @@ namespace BizHawk.Client.Common
public Movie(string filename, bool startsFromSavestate = false) public Movie(string filename, bool startsFromSavestate = false)
: this(startsFromSavestate) : this(startsFromSavestate)
{ {
Rerecords = 0; Header.Rerecords = 0;
Filename = filename; Filename = filename;
Loaded = !String.IsNullOrWhiteSpace(filename); Loaded = !String.IsNullOrWhiteSpace(filename);
} }
@ -46,12 +46,6 @@ namespace BizHawk.Client.Common
public bool Loaded { get; private set; } public bool Loaded { get; private set; }
public bool IsText { get; private set; } public bool IsText { get; private set; }
public ulong Rerecords
{
get { return Header.Rerecords; }
set { Header.Rerecords = value; }
}
public int InputLogLength public int InputLogLength
{ {
get { return Loaded ? _log.Length : _preloadFramecount; } get { return Loaded ? _log.Length : _preloadFramecount; }
@ -572,7 +566,7 @@ namespace BizHawk.Client.Common
if (IsCountingRerecords) if (IsCountingRerecords)
{ {
Rerecords++; Header.Rerecords++;
} }
} }

View File

@ -379,7 +379,7 @@ namespace BizHawk.Client.Common
{ {
rerecordCount = 0; rerecordCount = 0;
} }
m.Rerecords = (ulong)rerecordCount; m.Header.Rerecords = (ulong)rerecordCount;
} }
else if (line.ToLower().StartsWith("guid")) else if (line.ToLower().StartsWith("guid"))
{ {
@ -529,7 +529,7 @@ namespace BizHawk.Client.Common
uint frameCount = r.ReadUInt32(); uint frameCount = r.ReadUInt32();
// 010 4-byte little-endian unsigned int: rerecord count // 010 4-byte little-endian unsigned int: rerecord count
uint rerecordCount = r.ReadUInt32(); uint rerecordCount = r.ReadUInt32();
m.Rerecords = rerecordCount; m.Header.Rerecords = rerecordCount;
/* /*
018 4-byte little-endian unsigned int: offset to the savestate inside file 018 4-byte little-endian unsigned int: offset to the savestate inside file
The savestate offset is <header_size + length_of_metadata_in_bytes + padding>. The savestate offset should be The savestate offset is <header_size + length_of_metadata_in_bytes + padding>. The savestate offset should be
@ -779,7 +779,7 @@ namespace BizHawk.Client.Common
loaded, the number is 0. Famtasia however displays "1" in such case. It always adds 1 to the number found in loaded, the number is 0. Famtasia however displays "1" in such case. It always adds 1 to the number found in
the file. the file.
*/ */
m.Rerecords = rerecordCount + 1; m.Header.Rerecords = rerecordCount + 1;
// 00E 2-byte little-endian unsigned int: unknown, set to 0000 // 00E 2-byte little-endian unsigned int: unknown, set to 0000
r.ReadInt16(); r.ReadInt16();
// 010 64-byte zero-terminated emulator identifier string // 010 64-byte zero-terminated emulator identifier string
@ -886,7 +886,7 @@ namespace BizHawk.Client.Common
m.Header.Comments.Add(EMULATIONORIGIN + " Gens"); m.Header.Comments.Add(EMULATIONORIGIN + " Gens");
// 010 4-byte little-endian unsigned int: rerecord count // 010 4-byte little-endian unsigned int: rerecord count
uint rerecordCount = r.ReadUInt32(); uint rerecordCount = r.ReadUInt32();
m.Rerecords = rerecordCount; m.Header.Rerecords = rerecordCount;
// 014 ASCII-encoded controller config for player 1. '3' or '6'. // 014 ASCII-encoded controller config for player 1. '3' or '6'.
string player1Config = r.ReadStringFixedAscii(1); string player1Config = r.ReadStringFixedAscii(1);
// 015 ASCII-encoded controller config for player 2. '3' or '6'. // 015 ASCII-encoded controller config for player 2. '3' or '6'.
@ -1157,7 +1157,7 @@ namespace BizHawk.Client.Common
{ {
rerecordCount = 0; rerecordCount = 0;
} }
m.Rerecords = (ulong)rerecordCount; m.Header.Rerecords = (ulong)rerecordCount;
hf.Unbind(); hf.Unbind();
} }
else if (item.name.EndsWith(".sha256")) else if (item.name.EndsWith(".sha256"))
@ -1252,7 +1252,7 @@ namespace BizHawk.Client.Common
m.Header[HeaderKeys.GAMENAME] = gameName; m.Header[HeaderKeys.GAMENAME] = gameName;
// 070 uint32 Re-record Count // 070 uint32 Re-record Count
uint rerecordCount = r.ReadUInt32(); uint rerecordCount = r.ReadUInt32();
m.Rerecords = (ulong)rerecordCount; m.Header.Rerecords = (ulong)rerecordCount;
// 074 5-byte Console indicator (pce, ngp, pcfx, wswan) // 074 5-byte Console indicator (pce, ngp, pcfx, wswan)
string platform = NullTerminated(r.ReadStringFixedAscii(5)); string platform = NullTerminated(r.ReadStringFixedAscii(5));
Dictionary<string, Dictionary<string, object>> platforms = new Dictionary<string, Dictionary<string, object>> Dictionary<string, Dictionary<string, object>> platforms = new Dictionary<string, Dictionary<string, object>>
@ -1367,7 +1367,7 @@ namespace BizHawk.Client.Common
uint frameCount = r.ReadUInt32(); uint frameCount = r.ReadUInt32();
// 000c: 4-byte little endian unsigned int: rerecord count // 000c: 4-byte little endian unsigned int: rerecord count
uint rerecordCount = r.ReadUInt32(); uint rerecordCount = r.ReadUInt32();
m.Rerecords = rerecordCount; m.Header.Rerecords = rerecordCount;
// 0010: 4-byte little endian flag: begin from reset? // 0010: 4-byte little endian flag: begin from reset?
uint reset = r.ReadUInt32(); uint reset = r.ReadUInt32();
if (reset == 0) if (reset == 0)
@ -1632,7 +1632,7 @@ namespace BizHawk.Client.Common
m.Header[HeaderKeys.PAL] = pal.ToString(); m.Header[HeaderKeys.PAL] = pal.ToString();
// 004 4-byte little-endian unsigned int: rerecord count // 004 4-byte little-endian unsigned int: rerecord count
uint rerecordCount = r.ReadUInt32(); uint rerecordCount = r.ReadUInt32();
m.Rerecords = rerecordCount; m.Header.Rerecords = rerecordCount;
/* /*
008 4-byte little-endian unsigned int: length of movie description 008 4-byte little-endian unsigned int: length of movie description
00C (variable) null-terminated UTF-8 text, movie description (currently not implemented) 00C (variable) null-terminated UTF-8 text, movie description (currently not implemented)
@ -1734,7 +1734,7 @@ namespace BizHawk.Client.Common
uint uid = r.ReadUInt32(); uint uid = r.ReadUInt32();
m.Header[HeaderKeys.GUID] = String.Format("{0:X8}", uid) + "-0000-0000-0000-000000000000"; m.Header[HeaderKeys.GUID] = String.Format("{0:X8}", uid) + "-0000-0000-0000-000000000000";
// 00C 4-byte little-endian unsigned int: rerecord count // 00C 4-byte little-endian unsigned int: rerecord count
m.Rerecords = r.ReadUInt32(); m.Header.Rerecords = r.ReadUInt32();
// 010 4-byte little-endian unsigned int: number of frames // 010 4-byte little-endian unsigned int: number of frames
uint frameCount = r.ReadUInt32(); uint frameCount = r.ReadUInt32();
// 014 1-byte flags "controller mask" // 014 1-byte flags "controller mask"
@ -1996,7 +1996,7 @@ namespace BizHawk.Client.Common
uint frameCount = r.ReadUInt32(); uint frameCount = r.ReadUInt32();
// 010 4-byte little-endian unsigned int: rerecord count // 010 4-byte little-endian unsigned int: rerecord count
uint rerecordCount = r.ReadUInt32(); uint rerecordCount = r.ReadUInt32();
m.Rerecords = rerecordCount; m.Header.Rerecords = rerecordCount;
// 014 1-byte flags: (movie start flags) // 014 1-byte flags: (movie start flags)
byte flags = r.ReadByte(); byte flags = r.ReadByte();
// bit 0: if "1", movie starts from an embedded "quicksave" snapshot // bit 0: if "1", movie starts from an embedded "quicksave" snapshot
@ -2298,7 +2298,7 @@ namespace BizHawk.Client.Common
r.ReadBytes(2); r.ReadBytes(2);
// 01C 4-byte little-endian integer: rerecord count // 01C 4-byte little-endian integer: rerecord count
uint rerecordCount = r.ReadUInt32(); uint rerecordCount = r.ReadUInt32();
m.Rerecords = rerecordCount; m.Header.Rerecords = rerecordCount;
/* /*
020 BYTE RenderMethod 020 BYTE RenderMethod
0=POST_ALL,1=PRE_ALL 0=POST_ALL,1=PRE_ALL
@ -2481,7 +2481,7 @@ namespace BizHawk.Client.Common
uint frameCount = r.ReadUInt32(); uint frameCount = r.ReadUInt32();
// 00D 4-byte little-endian unsigned int: number of rerecords // 00D 4-byte little-endian unsigned int: number of rerecords
uint rerecordCount = r.ReadUInt32(); uint rerecordCount = r.ReadUInt32();
m.Rerecords = rerecordCount; m.Header.Rerecords = rerecordCount;
// 011 4-byte little-endian unsigned int: number of frames removed by rerecord // 011 4-byte little-endian unsigned int: number of frames removed by rerecord
r.ReadBytes(4); r.ReadBytes(4);
// 015 4-byte little-endian unsigned int: number of frames advanced step by step // 015 4-byte little-endian unsigned int: number of frames advanced step by step

View File

@ -26,6 +26,7 @@ namespace BizHawk.Client.Common
Header.StartsFromSavestate = startsFromSavestate; Header.StartsFromSavestate = startsFromSavestate;
_records = new MovieRecordList(); _records = new MovieRecordList();
_mode = Moviemode.Inactive; _mode = Moviemode.Inactive;
IsCountingRerecords = true;
} }
public string Filename { get; set; } public string Filename { get; set; }
@ -52,17 +53,7 @@ namespace BizHawk.Client.Common
get { return _mode == Moviemode.Finished; } get { return _mode == Moviemode.Finished; }
} }
public bool IsCountingRerecords public bool IsCountingRerecords { get; set; }
{
get
{
throw new NotImplementedException();
}
set
{
throw new NotImplementedException();
}
}
public bool Changes public bool Changes
{ {

View File

@ -492,7 +492,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (Global.MovieSession.Movie.IsActive) if (Global.MovieSession.Movie.IsActive)
{ {
return "Rerecord Count: " + Global.MovieSession.Movie.Rerecords; return "Rerecord Count: " + Global.MovieSession.Movie.Header.Rerecords;
} }
else else
{ {