From a868cd5f5cae93b914407499c744fa11f80e9474 Mon Sep 17 00:00:00 2001 From: SuuperW Date: Mon, 27 Jul 2020 10:43:20 -0500 Subject: [PATCH] fix TAStudio state gap --- .../movie/tasproj/TasStateManager.cs | 2 +- .../movie/tasproj/TasStateManagerSettings.cs | 8 ++++---- .../tools/TAStudio/GreenzoneSettings.cs | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/BizHawk.Client.Common/movie/tasproj/TasStateManager.cs b/src/BizHawk.Client.Common/movie/tasproj/TasStateManager.cs index 6aa441231f..7726483026 100644 --- a/src/BizHawk.Client.Common/movie/tasproj/TasStateManager.cs +++ b/src/BizHawk.Client.Common/movie/tasproj/TasStateManager.cs @@ -113,7 +113,7 @@ namespace BizHawk.Client.Common public void UpdateStateFrequency() { - _stateFrequency = ((int)_expectedStateSizeInMb / Settings.MemStateGapDivider / 1024) + _stateFrequency = ((int)(_expectedStateSizeInMb * 1024 / Settings.MemStateGapDividerKB)) .Clamp(MinFrequency, MaxFrequency); _decay.UpdateSettings(MaxStates, _stateFrequency, 4); diff --git a/src/BizHawk.Client.Common/movie/tasproj/TasStateManagerSettings.cs b/src/BizHawk.Client.Common/movie/tasproj/TasStateManagerSettings.cs index 31e0b0fbf4..2832673c30 100644 --- a/src/BizHawk.Client.Common/movie/tasproj/TasStateManagerSettings.cs +++ b/src/BizHawk.Client.Common/movie/tasproj/TasStateManagerSettings.cs @@ -9,7 +9,7 @@ namespace BizHawk.Client.Common DiskSaveCapacityMb = 512; CapacityMb = 512; DiskCapacityMb = 1; // not working yet - MemStateGapDivider = 64; + MemStateGapDividerKB = 64; FileStateGap = 4; } @@ -18,7 +18,7 @@ namespace BizHawk.Client.Common DiskSaveCapacityMb = settings.DiskSaveCapacityMb; CapacityMb = settings.CapacityMb; DiskCapacityMb = settings.DiskCapacityMb; - MemStateGapDivider = settings.MemStateGapDivider; + MemStateGapDividerKB = settings.MemStateGapDividerKB; FileStateGap = settings.FileStateGap; } @@ -54,8 +54,8 @@ namespace BizHawk.Client.Common /// Gets or sets the divider that determines memory state gap /// [DisplayName("Divider for memory state interval")] - [Description("The actual state gap in frames is calculated as ExpectedStateSize / div / 1024")] - public int MemStateGapDivider { get; set; } + [Description("The actual state gap in frames is calculated as ExpectedStateSizeMB * 1024 / div")] + public int MemStateGapDividerKB { get; set; } /// /// Gets or sets the amount of states to skip during project saving diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/GreenzoneSettings.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/GreenzoneSettings.cs index 7cd88d2bfd..3d678d7846 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/GreenzoneSettings.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/GreenzoneSettings.cs @@ -35,7 +35,7 @@ namespace BizHawk.Client.EmuHawk MemCapacityNumeric.Value = NumberExtensions.Clamp(_settings.CapacityMb, MemCapacityNumeric.Minimum, MemCapacityNumeric.Maximum); DiskCapacityNumeric.Value = NumberExtensions.Clamp(_settings.DiskCapacityMb, MemCapacityNumeric.Minimum, MemCapacityNumeric.Maximum); FileCapacityNumeric.Value = NumberExtensions.Clamp(_settings.DiskSaveCapacityMb, MemCapacityNumeric.Minimum, MemCapacityNumeric.Maximum); - MemStateGapDividerNumeric.Value = NumberExtensions.Clamp(_settings.MemStateGapDivider, MemStateGapDividerNumeric.Minimum, MemStateGapDividerNumeric.Maximum); + MemStateGapDividerNumeric.Value = NumberExtensions.Clamp(_settings.MemStateGapDividerKB, MemStateGapDividerNumeric.Minimum, MemStateGapDividerNumeric.Maximum); FileStateGapNumeric.Value = _settings.FileStateGap; SavestateSizeLabel.Text = $"{Math.Round(_stateSizeMb, 2)} MB"; @@ -51,7 +51,7 @@ namespace BizHawk.Client.EmuHawk _settings.CapacityMb = (int)MemCapacityNumeric.Value; _settings.DiskCapacityMb = (int)DiskCapacityNumeric.Value; _settings.DiskSaveCapacityMb = (int)FileCapacityNumeric.Value; - _settings.MemStateGapDivider = (int)MemStateGapDividerNumeric.Value; + _settings.MemStateGapDividerKB = (int)MemStateGapDividerNumeric.Value; _settings.FileStateGap = (int)FileStateGapNumeric.Value; DialogResult = DialogResult.OK; Close(); @@ -84,7 +84,7 @@ namespace BizHawk.Client.EmuHawk private void MemStateGapDivider_ValueChanged(object sender, EventArgs e) { - int val = (int)(Statable.CloneSavestate().Length / MemStateGapDividerNumeric.Value / 1024); + int val = (int)(_stateSizeMb * 1024 / MemStateGapDividerNumeric.Value); if (val <= 1) MemStateGapDividerNumeric.Maximum = MemStateGapDividerNumeric.Value;