TAStudio: Fixed displayed maximum state capacity.
Clear states to stay within the new limit when settings are changed.
This commit is contained in:
parent
3cbea04448
commit
d6e3553449
|
@ -68,8 +68,8 @@ namespace BizHawk.Client.Common
|
||||||
if (!IsOnDisk)
|
if (!IsOnDisk)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var key = ID.ToString();
|
string key = ID.ToString();
|
||||||
var ret = _manager.ndbdatabase.FetchAll(key);
|
_state = _manager.ndbdatabase.FetchAll(key);
|
||||||
_manager.ndbdatabase.Release(key);
|
_manager.ndbdatabase.Release(key);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
@ -144,7 +144,7 @@ namespace BizHawk.Client.Common
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string statePath
|
private string statePath
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
@ -313,6 +313,9 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
if (Used > Settings.Cap)
|
if (Used > Settings.Cap)
|
||||||
{
|
{
|
||||||
|
if (DiskUsed > (ulong)Settings.DiskCapacitymb * 1024uL * 1024uL)
|
||||||
|
MaybeRemoveState();
|
||||||
|
|
||||||
int lastMemState = -1;
|
int lastMemState = -1;
|
||||||
do { lastMemState++; } while (States[accessed[lastMemState]] == null);
|
do { lastMemState++; } while (States[accessed[lastMemState]] == null);
|
||||||
MoveStateToDisk(accessed[lastMemState]);
|
MoveStateToDisk(accessed[lastMemState]);
|
||||||
|
@ -528,6 +531,16 @@ namespace BizHawk.Client.Common
|
||||||
ndbdatabase.Clear();
|
ndbdatabase.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes/moves states to follow the state storage size limits.
|
||||||
|
/// Used after changing the settings.
|
||||||
|
/// </summary>
|
||||||
|
public void LimitStateCount()
|
||||||
|
{
|
||||||
|
while (Used + DiskUsed > Settings.CapTotal)
|
||||||
|
MaybeRemoveState();
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: save/load BranchStates
|
// TODO: save/load BranchStates
|
||||||
public void Save(BinaryWriter bw)
|
public void Save(BinaryWriter bw)
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,7 +48,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private int MaxStatesInCapacity
|
private int MaxStatesInCapacity
|
||||||
{
|
{
|
||||||
get { return (int)Math.Floor((MemCapacityNumeric.Value + DiskCapacityNumeric.Value) / _stateSizeMb); }
|
get { return (int)Math.Floor(MemCapacityNumeric.Value / _stateSizeMb)
|
||||||
|
+ (int)Math.Floor(DiskCapacityNumeric.Value / _stateSizeMb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OkBtn_Click(object sender, EventArgs e)
|
private void OkBtn_Click(object sender, EventArgs e)
|
||||||
|
|
|
@ -748,6 +748,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Location = this.ChildPointToScreen(TasView),
|
Location = this.ChildPointToScreen(TasView),
|
||||||
Statable = this.StatableEmulator
|
Statable = this.StatableEmulator
|
||||||
}.Show();
|
}.Show();
|
||||||
|
CurrentTasMovie.TasStateManager.
|
||||||
UpdateChangesIndicator();
|
UpdateChangesIndicator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue