tastudio: load projects without branch state info.

fix some other crashes, kill selection when loading a file.
This commit is contained in:
feos 2015-10-05 19:08:21 +03:00
parent 87dd32eeac
commit 31e476a3cd
4 changed files with 37 additions and 14 deletions

View File

@ -82,8 +82,21 @@ namespace BizHawk.Client.Common
public bool BindMarkersToInput { get; set; }
public bool UseInputCache { get; set; }
public int BranchCount { get { return Branches.Count; } }
public TasBranch GetBranch(int index) { return Branches[index]; }
public int BranchHashByIndex(int index) { return Branches[index].UniqueIdentifier.GetHashCode(); }
public TasBranch GetBranch(int index)
{
if (index >= Branches.Count)
return null; // are we allowed?
else
return Branches[index];
}
public int BranchHashByIndex(int index)
{
if (index >= Branches.Count)
return -1;
else
return Branches[index].UniqueIdentifier.GetHashCode();
}
public int BranchIndexByHash(int hash)
{

View File

@ -588,6 +588,9 @@ namespace BizHawk.Client.Common
}
//}
if (br.PeekChar() == -1) // at least don't crash when loading an old project
return;
currentBranch = br.ReadInt32();
int c = br.ReadInt32();
BranchStates = new SortedList<int, SortedList<int, StateManagerState>>(c);

View File

@ -98,19 +98,22 @@ namespace BizHawk.Client.EmuHawk
private void QueryItemBkColor(int index, InputRoll.RollColumn column, ref Color color)
{
var record = Tastudio.CurrentTasMovie[GetBranch(index).Frame];
if (index == CurrentBranch)
color = TAStudio.CurrentFrame_InputLog; // SystemColors.HotTrack;
else if (record.Lagged.HasValue)
TasBranch branch = GetBranch(index);
if (branch != null)
{
if (record.Lagged.Value)
var record = Tastudio.CurrentTasMovie[branch.Frame];
if (index == CurrentBranch)
color = TAStudio.CurrentFrame_InputLog; // SystemColors.HotTrack;
else if (record.Lagged.HasValue)
{
color = TAStudio.LagZone_InputLog;
}
else
{
color = TAStudio.GreenZone_InputLog;
if (record.Lagged.Value)
{
color = TAStudio.LagZone_InputLog;
}
else
{
color = TAStudio.GreenZone_InputLog;
}
}
}

View File

@ -432,8 +432,12 @@ namespace BizHawk.Client.EmuHawk
if (!HandleMovieLoadStuff(newMovie))
return false;
// clear all selections
TasView.DeselectAll();
BookMarkControl.Restart();
MarkerControl.Restart();
BookMarkControl.UpdateValues();
RefreshDialog();
return true;
}