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,8 +98,10 @@ namespace BizHawk.Client.EmuHawk
private void QueryItemBkColor(int index, InputRoll.RollColumn column, ref Color color)
{
var record = Tastudio.CurrentTasMovie[GetBranch(index).Frame];
TasBranch branch = GetBranch(index);
if (branch != null)
{
var record = Tastudio.CurrentTasMovie[branch.Frame];
if (index == CurrentBranch)
color = TAStudio.CurrentFrame_InputLog; // SystemColors.HotTrack;
else if (record.Lagged.HasValue)
@ -113,6 +115,7 @@ namespace BizHawk.Client.EmuHawk
color = TAStudio.GreenZone_InputLog;
}
}
}
// Highlight the branch cell a little, if hovering over it
if (BranchView.CurrentCellIsDataCell &&

View File

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