From 84acda3bbc8e3b8767b24cfc3fe44679d97dd546 Mon Sep 17 00:00:00 2001 From: SuuperW Date: Mon, 16 Mar 2015 17:04:10 +0000 Subject: [PATCH] A couple bugfixes for float editing autorestore --- .../tools/TAStudio/TAStudio.ListView.cs | 17 ++++++++++++++--- .../tools/TAStudio/TAStudio.cs | 1 - 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs index 057bbe0cf6..3d59f2d847 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs @@ -361,7 +361,6 @@ namespace BizHawk.Client.EmuHawk RefreshDialog(); } - _triggerAutoRestore = true; _triggerAutoRestoreFromFrame = TasView.CurrentCell.RowIndex.Value; _floatPaintState = CurrentTasMovie.GetFloatState(frame, buttonName); @@ -721,6 +720,9 @@ namespace BizHawk.Client.EmuHawk if (_floatEditRow != -1) { float value = CurrentTasMovie.GetFloatState(_floatEditRow, _floatEditColumn); + float prev = value; + string prevTyped = _floatTypedValue; + Emulation.Common.ControllerDefinition.FloatRange range = Global.MovieSession.MovieControllerAdapter.Type.FloatRanges [Global.MovieSession.MovieControllerAdapter.Type.FloatControls.IndexOf(_floatEditColumn)]; // Range for N64 Y axis has max -128 and min 127. That should probably be fixed ControllerDefinition.cs, but I'll put a quick fix here anyway. @@ -785,8 +787,11 @@ namespace BizHawk.Client.EmuHawk { if (_floatTypedValue == "") { - value = 0f; - CurrentTasMovie.SetFloatState(_floatEditRow, _floatEditColumn, value); + if (prevTyped != "") + { + value = 0f; + CurrentTasMovie.SetFloatState(_floatEditRow, _floatEditColumn, value); + } } else { @@ -797,6 +802,12 @@ namespace BizHawk.Client.EmuHawk value = rMin; CurrentTasMovie.SetFloatState(_floatEditRow, _floatEditColumn, value); } + if (value != prev) // Auto-restore + { + _triggerAutoRestore = true; + _triggerAutoRestoreFromFrame = _floatEditRow; + DoTriggeredAutoRestoreIfNeeded(); + } } } diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index c8372176e7..c7861cc4e1 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -565,7 +565,6 @@ namespace BizHawk.Client.EmuHawk _triggerAutoRestore = false; _triggerAutoRestoreFromFrame = null; - } }