TAStudio - column names for float values

This commit is contained in:
adelikat 2014-07-07 16:03:22 +00:00
parent 46d6279f1b
commit f875792c74
6 changed files with 75 additions and 6 deletions

View File

@ -138,6 +138,7 @@
<Compile Include="movie\bk2\Bk2ControllerAdapter.cs" />
<Compile Include="movie\bk2\Bk2Header.cs" />
<Compile Include="movie\bk2\Bk2LogEntryGenerator.cs" />
<Compile Include="movie\bk2\Bk2FloatConstants.cs" />
<Compile Include="movie\bk2\Bk2MnemonicConstants.cs" />
<Compile Include="movie\bk2\Bk2Movie.cs" />
<Compile Include="movie\bk2\Bk2Movie.HeaderApi.cs" />

View File

@ -0,0 +1,58 @@
using System.Collections.Generic;
namespace BizHawk.Client.Common
{
public class Bk2FloatConstants
{
public string this[string button]
{
get
{
var key = button
.Replace("P1 ", "")
.Replace("P2 ", "")
.Replace("P3 ", "")
.Replace("P4 ", "")
.Replace("Key ", "");
if (SystemOverrides.ContainsKey(Global.Emulator.SystemId) && SystemOverrides[Global.Emulator.SystemId].ContainsKey(key))
{
return SystemOverrides[Global.Emulator.SystemId][key];
}
if (BaseMnemonicLookupTable.ContainsKey(key))
{
return BaseMnemonicLookupTable[key];
}
return button;
}
}
private readonly Dictionary<string, string> BaseMnemonicLookupTable = new Dictionary<string, string>
{
{ "Zapper X", "zapX" },
{ "Zapper Y", "zapY" },
{ "Paddle", "Pad" },
{ "Pen", "Pen" },
{ "Mouse X", "mX" },
{ "Mouse Y", "mY" },
{ "Lightgun X", "lX" },
{ "Lightgun Y", "lY" },
{ "X Axis", "aX" },
{ "Y Axis", "aY" }
};
private readonly Dictionary<string, Dictionary<string, string>> SystemOverrides = new Dictionary<string, Dictionary<string, string>>
{
{
"A78",
new Dictionary<string, string>
{
{ "VPos", "X" },
{ "HPos", "Y" }
}
},
};
}
}

View File

@ -9,6 +9,8 @@ namespace BizHawk.Client.Common
public class Bk2LogEntryGenerator : ILogEntryGenerator
{
private readonly Bk2MnemonicConstants Mnemonics = new Bk2MnemonicConstants();
private readonly Bk2FloatConstants FloatLookup = new Bk2FloatConstants();
private IController _source;
private readonly string _logKey = string.Empty;
@ -95,7 +97,14 @@ namespace BizHawk.Client.Common
{
foreach (var button in group)
{
dict.Add(button, Mnemonics[button].ToString()); // TODO: floats should be a float lookup that returns a string, floats by convention should always be more than one character to distinguish from boolean input
if (_source.Type.BoolButtons.Contains(button))
{
dict.Add(button, Mnemonics[button].ToString());
}
else if (_source.Type.FloatControls.Contains(button))
{
dict.Add(button, FloatLookup[button]);
}
}
}

View File

@ -44,8 +44,6 @@ namespace BizHawk.Client.EmuHawk
return _map;
}
}
#region API
public TAStudio()
{
@ -75,6 +73,8 @@ namespace BizHawk.Client.EmuHawk
TasView.PointedCellChanged += TasView_PointedCellChanged;
}
#region IToolForm implementation
public bool AskSave()
{
if (_tas.Changes)
@ -244,7 +244,7 @@ namespace BizHawk.Client.EmuHawk
foreach (var kvp in ColumnNames)
{
AddColumn(kvp.Key, kvp.Value, 20);
AddColumn(kvp.Key, kvp.Value, 20 * kvp.Value.Length);
}
}

View File

@ -331,6 +331,7 @@ namespace BizHawk.Client.EmuHawk
}
};
}
public static PadSchema Activator(int controller)
{
return new PadSchema
@ -409,6 +410,7 @@ namespace BizHawk.Client.EmuHawk
}
};
}
public static PadSchema XE1AP(int controller)
{
return new PadSchema
@ -476,6 +478,5 @@ namespace BizHawk.Client.EmuHawk
}
};
}
}
}

View File

@ -510,7 +510,7 @@ namespace BizHawk.Client.EmuHawk
{
return new PadSchema
{
DisplayName = "Zapper",
DisplayName = "Tablet",
IsConsole = false,
DefaultSize = new Size(356, 260),
MaxSize = new Size(356, 260),