2014-10-17 22:39:40 +00:00
|
|
|
|
using System;
|
2014-10-18 01:01:45 +00:00
|
|
|
|
using System.ComponentModel;
|
2014-10-17 22:39:40 +00:00
|
|
|
|
using System.Text;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
2014-10-18 01:01:45 +00:00
|
|
|
|
|
2014-10-17 22:39:40 +00:00
|
|
|
|
namespace BizHawk.Client.Common
|
|
|
|
|
{
|
|
|
|
|
public class TasStateManagerSettings
|
|
|
|
|
{
|
|
|
|
|
public TasStateManagerSettings()
|
|
|
|
|
{
|
|
|
|
|
SaveGreenzone = true;
|
|
|
|
|
Capacitymb = 512;
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-17 22:47:30 +00:00
|
|
|
|
public TasStateManagerSettings(TasStateManagerSettings settings)
|
|
|
|
|
{
|
|
|
|
|
SaveGreenzone = settings.SaveGreenzone;
|
|
|
|
|
Capacitymb = settings.Capacitymb;
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-17 22:39:40 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether or not to save greenzone information to disk
|
|
|
|
|
/// </summary>
|
2014-10-18 01:01:45 +00:00
|
|
|
|
[DisplayName("Save History")]
|
|
|
|
|
[Description("Whether or not to use savestate history")]
|
2014-10-17 22:39:40 +00:00
|
|
|
|
public bool SaveGreenzone { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The total amount of memory to devote to greenzone in megabytes
|
|
|
|
|
/// </summary>
|
2014-10-18 01:01:45 +00:00
|
|
|
|
[DisplayName("Capacity (in megabytes))")]
|
|
|
|
|
[Description("The size limit of the state history buffer. When this limit is reached it will start removing previous savestates")]
|
2014-10-17 22:39:40 +00:00
|
|
|
|
public int Capacitymb { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonIgnore]
|
2014-10-18 01:01:45 +00:00
|
|
|
|
[Browsable(false)]
|
2014-10-17 22:39:40 +00:00
|
|
|
|
public int Cap
|
|
|
|
|
{
|
|
|
|
|
get { return Capacitymb * 1024 * 1024; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
sb.AppendLine(SaveGreenzone.ToString());
|
|
|
|
|
sb.AppendLine(Capacitymb.ToString());
|
|
|
|
|
|
|
|
|
|
return sb.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void PopulateFromString(string settings)
|
|
|
|
|
{
|
2014-11-20 00:14:33 +00:00
|
|
|
|
if (!string.IsNullOrWhiteSpace(settings))
|
|
|
|
|
{
|
|
|
|
|
var lines = settings.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
|
|
|
|
|
SaveGreenzone = bool.Parse(lines[0]);
|
|
|
|
|
Capacitymb = int.Parse(lines[1]);
|
|
|
|
|
}
|
2014-10-17 22:39:40 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|