State manager API cleanup

add some comments.  Remove two methods from the interface definition that aren't actually used in public API
This commit is contained in:
nattthebear 2020-06-17 07:31:00 -04:00
parent abca8e02f2
commit 4d3558d7e3
2 changed files with 25 additions and 12 deletions

View File

@ -42,32 +42,45 @@ namespace BizHawk.Client.Common
/// </summary>
bool Invalidate(int frame);
// Remove all states, but not the frame 0 state
void Clear();
void Save(BinaryWriter bw);
void Load(BinaryReader br);
/// <summary>
/// Get a nearby state. The returned frame must be less (but not equal to???) the passed frame.
/// This may not fail; the StateManager strongly holds a frame 0 state to ensure there's always a possible result.
/// </summary>
/// <param name="frame"></param>
/// <returns></returns>
KeyValuePair<int, byte[]> GetStateClosestToFrame(int frame);
/// <summary>
/// Returns true iff Count > 0
/// TODO: Surely this is always true because the frame 0 state is always retained?
/// </summary>
/// <returns></returns>
bool Any();
/// <summary>
/// Returns the total number of states currently held by the state manager
/// </summary>
/// <value></value>
int Count { get; }
/// <summary>
/// Returns the most recent frame number that the state manager possesses
/// </summary>
/// <value></value>
int Last { get; }
/// <summary>
/// Adjust internal state saving logic based on changes to Settings
/// </summary>
void UpdateStateFrequency();
/// <summary>
/// Returns index of the state right above the given frame
/// </summary>
int GetStateIndexByFrame(int frame);
/// <summary>
/// Returns frame of the state at the given index
/// </summary>
int GetStateFrameByIndex(int index);
/// <summary>
/// Directly remove a state from the given frame, if it exists
/// Should only be called by pruning operations

View File

@ -46,7 +46,7 @@ namespace BizHawk.Client.Common
internal class StateManagerDecay
{
private readonly ITasMovie _movie;
private readonly IStateManager _tsm;
private readonly TasStateManager _tsm;
private List<int> _zeros; // amount of least significant zeros in bitwise view (also max pattern step)
private int _bits; // size of _zeros is 2 raised to the power of _bits
@ -56,7 +56,7 @@ namespace BizHawk.Client.Common
private int _step; // initial memory state gap
private bool _align; // extra care about fine alignment. TODO: do we want it?
public StateManagerDecay(ITasMovie movie, IStateManager tsm)
public StateManagerDecay(ITasMovie movie, TasStateManager tsm)
{
_movie = movie;
_tsm = tsm;