tastudio: be able to load broken greenzone file.

This commit is contained in:
feos 2016-04-23 20:53:50 +03:00
parent 838e986847
commit f35938acdb
1 changed files with 14 additions and 13 deletions

View File

@ -578,21 +578,22 @@ namespace BizHawk.Client.Common
public void Load(BinaryReader br) public void Load(BinaryReader br)
{ {
States.Clear(); States.Clear();
//if (br.BaseStream.Length > 0) try
//{ BaseStream.Length does not return the expected value.
int nstates = br.ReadInt32();
for (int i = 0; i < nstates; i++)
{ {
int frame = br.ReadInt32(); int nstates = br.ReadInt32();
int len = br.ReadInt32(); for (int i = 0; i < nstates; i++)
byte[] data = br.ReadBytes(len); {
// whether we should allow state removal check here is an interesting question int frame = br.ReadInt32();
// nothing was edited yet, so it might make sense to show the project untouched first int len = br.ReadInt32();
SetState(frame, data); byte[] data = br.ReadBytes(len);
//States.Add(frame, data); // whether we should allow state removal check here is an interesting question
//Used += len; // nothing was edited yet, so it might make sense to show the project untouched first
SetState(frame, data);
//States.Add(frame, data);
//Used += len;
}
} }
//} catch (EndOfStreamException) { }
} }
public void SaveBranchStates(BinaryWriter bw) public void SaveBranchStates(BinaryWriter bw)