2014-07-11 15:43:47 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
using BizHawk.Client.Common;
|
|
|
|
|
|
|
|
|
|
namespace BizHawk.Client.EmuHawk
|
|
|
|
|
{
|
2014-10-14 13:31:14 +00:00
|
|
|
|
public partial class GreenzoneSettingsForm : Form
|
2014-07-11 15:43:47 +00:00
|
|
|
|
{
|
2014-10-17 22:39:40 +00:00
|
|
|
|
private readonly TasStateManagerSettings Settings;
|
2014-07-11 15:43:47 +00:00
|
|
|
|
private decimal _stateSizeMb;
|
2014-10-17 22:39:40 +00:00
|
|
|
|
public GreenzoneSettingsForm(TasStateManagerSettings settings)
|
2014-07-11 15:43:47 +00:00
|
|
|
|
{
|
|
|
|
|
Settings = settings;
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void GreenzoneSettings_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
_stateSizeMb = Global.Emulator.SaveStateBinary().Length / (decimal)1024 / (decimal)1024;
|
|
|
|
|
|
|
|
|
|
SaveGreenzoneCheckbox.Checked = Settings.SaveGreenzone;
|
|
|
|
|
CapacityNumeric.Value = Settings.Capacitymb == 0 ? 1 : Settings.Capacitymb < CapacityNumeric.Maximum ?
|
|
|
|
|
Settings.Capacitymb :
|
|
|
|
|
CapacityNumeric.Maximum;
|
|
|
|
|
|
|
|
|
|
SavestateSizeLabel.Text = Math.Round(_stateSizeMb, 2).ToString() + " mb";
|
2014-08-22 17:04:31 +00:00
|
|
|
|
CapacityNumeric_ValueChanged(null, null);
|
2014-07-11 15:43:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-22 17:04:31 +00:00
|
|
|
|
private ulong MaxStatesInCapacity
|
2014-07-11 15:43:47 +00:00
|
|
|
|
{
|
2014-08-22 17:04:31 +00:00
|
|
|
|
get { return (ulong)Math.Floor(CapacityNumeric.Value / _stateSizeMb); }
|
2014-07-11 15:43:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OkBtn_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Settings.SaveGreenzone = SaveGreenzoneCheckbox.Checked;
|
|
|
|
|
Settings.Capacitymb = (int)CapacityNumeric.Value;
|
|
|
|
|
DialogResult = DialogResult.OK;
|
|
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void CancelBtn_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
DialogResult = DialogResult.Cancel;
|
|
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void CapacityNumeric_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-08-22 17:04:31 +00:00
|
|
|
|
NumStatesLabel.Text = MaxStatesInCapacity.ToString();
|
2014-07-11 15:43:47 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|