From a8dde12c1f47d93839f6092b5fb48a8ae4aee04b Mon Sep 17 00:00:00 2001 From: feos Date: Sat, 19 Nov 2016 19:31:04 +0300 Subject: [PATCH] tastudio: - set Float type to analog control columns - set their size taking into account their MaxDigits - stop displaying neutral analog values input OSD: - obtain real neutral analog value the given core uses and hide it, instead of hiding hardcoded zero --- .../movie/bk2/Bk2LogEntryGenerator.cs | 3 ++- .../tools/TAStudio/TAStudio.ListView.cs | 10 +++++++++ .../tools/TAStudio/TAStudio.cs | 21 ++++++++++++++++--- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/BizHawk.Client.Common/movie/bk2/Bk2LogEntryGenerator.cs b/BizHawk.Client.Common/movie/bk2/Bk2LogEntryGenerator.cs index c45595b290..106ae3f75b 100644 --- a/BizHawk.Client.Common/movie/bk2/Bk2LogEntryGenerator.cs +++ b/BizHawk.Client.Common/movie/bk2/Bk2LogEntryGenerator.cs @@ -42,10 +42,11 @@ namespace BizHawk.Client.Common return string.Empty; } + string neutral = _source.Type.FloatRanges[0].Mid.ToString().PadLeft(5, ' ') + ','; return le .Replace(".", " ") .Replace("|", "") - .Replace(" 0,", " "); //zero 04-aug-2015 - changed from a 2-dimensional type string to support emptying out the one-dimensional PSX disc select control + .Replace(neutral, " "); //zero 04-aug-2015 - changed from a 2-dimensional type string to support emptying out the one-dimensional PSX disc select control } public bool IsEmpty diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs index c99a8a9738..7b1f7d5487 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs @@ -292,7 +292,17 @@ namespace BizHawk.Client.EmuHawk if (index == _floatEditRow && columnName == _floatEditColumn) text = _floatTypedValue; else if (index < CurrentTasMovie.InputLogLength) + { text = CurrentTasMovie.DisplayValue(index, columnName); + if (column.Type == InputRoll.RollColumn.InputType.Float) + { + // feos: this could be cashed, but I don't notice any slowdown this way either + Emulation.Common.ControllerDefinition.FloatRange range = Global.MovieSession.MovieControllerAdapter.Type.FloatRanges + [Global.MovieSession.MovieControllerAdapter.Type.FloatControls.IndexOf(columnName)]; + if (text == range.Mid.ToString()) + text = ""; + } + } } } catch (Exception ex) diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index 212d19c3a0..c8d285a047 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -422,9 +422,23 @@ namespace BizHawk.Client.EmuHawk AddColumn(FrameColumnName, "Frame#", 68); var columnNames = GenerateColumnNames(); + InputRoll.RollColumn.InputType type; + int digits = 1; foreach (var kvp in columnNames) { - AddColumn(kvp.Key, kvp.Value, (kvp.Value.Length * 6) + 14); + if (Global.MovieSession.MovieControllerAdapter.Type.FloatControls.Contains(kvp.Key)) + { + Emulation.Common.ControllerDefinition.FloatRange range = Global.MovieSession.MovieControllerAdapter.Type.FloatRanges + [Global.MovieSession.MovieControllerAdapter.Type.FloatControls.IndexOf(kvp.Key)]; + type = InputRoll.RollColumn.InputType.Float; + digits = Math.Max(kvp.Value.Length, range.MaxDigits()); + } + else + { + type = InputRoll.RollColumn.InputType.Boolean; + digits = kvp.Value.Length; + } + AddColumn(kvp.Key, kvp.Value, (digits * 6) + 14, type); } var columnsToHide = TasView.AllColumns @@ -478,7 +492,7 @@ namespace BizHawk.Client.EmuHawk SetUpToolStripColumns(); } - public void AddColumn(string columnName, string columnText, int columnWidth) + public void AddColumn(string columnName, string columnText, int columnWidth, InputRoll.RollColumn.InputType columnType = InputRoll.RollColumn.InputType.Boolean) { if (TasView.AllColumns[columnName] == null) { @@ -486,7 +500,8 @@ namespace BizHawk.Client.EmuHawk { Name = columnName, Text = columnText, - Width = columnWidth + Width = columnWidth, + Type = columnType }; TasView.AllColumns.Add(column);