tastudio: put branch states to a separate greenzone file.

default scroll speed to 3.
This commit is contained in:
feos 2015-10-24 12:42:22 +03:00
parent 817f4360d3
commit 3f1a3907b5
4 changed files with 35 additions and 22 deletions

View File

@ -64,6 +64,8 @@ namespace BizHawk.Client.Common
public static BinaryStateLump BranchHeader { get; private set; }
[Name("Branches\\Markers", "txt")]
public static BinaryStateLump BranchMarkers { get; private set; }
[Name("Branches\\GreenZone")]
public static BinaryStateLump BranchStateHistory { get; private set; }
[AttributeUsage(AttributeTargets.Property)]
private class NameAttribute : Attribute

View File

@ -99,6 +99,7 @@ namespace BizHawk.Client.Common
if (Branches.Any())
{
Branches.Save(bs);
bs.PutLump(BinaryStateLump.BranchStateHistory, (BinaryWriter bw) => StateManager.SaveBranchStates(bw));
}
ReportProgress(PROGRESS_STEP);
@ -288,6 +289,10 @@ namespace BizHawk.Client.Common
}
Branches.Load(bl, this);
bl.GetLump(BinaryStateLump.BranchStateHistory, false, delegate(BinaryReader br, long length)
{
StateManager.LoadBranchStates(br);
});
}
Changes = false;

View File

@ -562,23 +562,6 @@ namespace BizHawk.Client.Common
bw.Write(kvp.Value.Length);
bw.Write(kvp.Value.State);
}
bw.Write(currentBranch);
if (Settings.BranchStatesInTasproj)
{
bw.Write(BranchStates.Count);
foreach (var s in BranchStates)
{
bw.Write(s.Key);
bw.Write(s.Value.Count);
foreach (var t in s.Value)
{
bw.Write(t.Key);
t.Value.Write(bw);
}
}
}
}
public void Load(BinaryReader br)
@ -599,11 +582,33 @@ namespace BizHawk.Client.Common
//Used += len;
}
//}
}
try
public void SaveBranchStates(BinaryWriter bw)
{
bw.Write(currentBranch);
if (Settings.BranchStatesInTasproj)
{
currentBranch = br.ReadInt32();
if (Settings.BranchStatesInTasproj)
bw.Write(BranchStates.Count);
foreach (var s in BranchStates)
{
bw.Write(s.Key);
bw.Write(s.Value.Count);
foreach (var t in s.Value)
{
bw.Write(t.Key);
t.Value.Write(bw);
}
}
}
}
public void LoadBranchStates(BinaryReader br)
{
currentBranch = br.ReadInt32();
if (Settings.BranchStatesInTasproj)
{
try
{
int c = br.ReadInt32();
BranchStates = new SortedList<int, SortedList<int, StateManagerState>>(c);
@ -623,10 +628,11 @@ namespace BizHawk.Client.Common
c--;
}
}
catch (EndOfStreamException) { }
}
catch (EndOfStreamException) { }
}
public KeyValuePair<int, byte[]> GetStateClosestToFrame(int frame)
{
var s = States.LastOrDefault(state => state.Key < frame);

View File

@ -58,7 +58,7 @@ namespace BizHawk.Client.EmuHawk
DrawInput = true;
AutoPause = true;
FollowCursor = true;
ScrollSpeed = 1;
ScrollSpeed = 3;
FollowCursorAlwaysScroll = false;
FollowCursorScrollMethod = "near";
// default to taseditor fashion