Rename IController.Type to IController.Definition to more clearly describe the property
This commit is contained in:
parent
bd7bd831c7
commit
5ff33e7569
|
@ -340,7 +340,7 @@ namespace BizHawk.Client.ApiHawk
|
||||||
{
|
{
|
||||||
AutoFireStickyXorAdapter joypadAdaptor = Global.AutofireStickyXORAdapter;
|
AutoFireStickyXorAdapter joypadAdaptor = Global.AutofireStickyXORAdapter;
|
||||||
|
|
||||||
IEnumerable<string> pressedButtons = from button in joypadAdaptor.Type.BoolButtons
|
IEnumerable<string> pressedButtons = from button in joypadAdaptor.Definition.BoolButtons
|
||||||
where joypadAdaptor[button]
|
where joypadAdaptor[button]
|
||||||
select button;
|
select button;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControllerDefinition Type { get { return _type; } }
|
public ControllerDefinition Definition { get { return _type; } }
|
||||||
|
|
||||||
/// <summary>don't do this</summary>
|
/// <summary>don't do this</summary>
|
||||||
public void ForceType(ControllerDefinition newtype) { _type = newtype; }
|
public void ForceType(ControllerDefinition newtype) { _type = newtype; }
|
||||||
|
@ -165,9 +165,9 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
// change: or from each button that the other input controller has
|
// change: or from each button that the other input controller has
|
||||||
// foreach (string button in type.BoolButtons)
|
// foreach (string button in type.BoolButtons)
|
||||||
if (controller.Type != null)
|
if (controller.Definition != null)
|
||||||
{
|
{
|
||||||
foreach (var button in controller.Type.BoolButtons)
|
foreach (var button in controller.Definition.BoolButtons)
|
||||||
{
|
{
|
||||||
if (controller.IsPressed(button))
|
if (controller.IsPressed(button))
|
||||||
{
|
{
|
||||||
|
@ -259,7 +259,7 @@ namespace BizHawk.Client.Common
|
||||||
public int On { get; set; }
|
public int On { get; set; }
|
||||||
public int Off { get; set; }
|
public int Off { get; set; }
|
||||||
|
|
||||||
public ControllerDefinition Type { get { return _type; } }
|
public ControllerDefinition Definition { get { return _type; } }
|
||||||
public bool this[string button] { get { return IsPressed(button); } }
|
public bool this[string button] { get { return IsPressed(button); } }
|
||||||
public bool IsPressed(string button)
|
public bool IsPressed(string button)
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public IController Source { get; set; }
|
public IController Source { get; set; }
|
||||||
public IController SourceAnd { get; set; }
|
public IController SourceAnd { get; set; }
|
||||||
public ControllerDefinition Type { get { return Source.Type; } set { throw new InvalidOperationException(); } }
|
public ControllerDefinition Definition { get { return Source.Definition; } set { throw new InvalidOperationException(); } }
|
||||||
|
|
||||||
public bool this[string button]
|
public bool this[string button]
|
||||||
{
|
{
|
||||||
|
@ -52,9 +52,9 @@ namespace BizHawk.Client.Common
|
||||||
public IController Source { get; set; }
|
public IController Source { get; set; }
|
||||||
public IController SourceOr { get; set; }
|
public IController SourceOr { get; set; }
|
||||||
|
|
||||||
public ControllerDefinition Type
|
public ControllerDefinition Definition
|
||||||
{
|
{
|
||||||
get { return Source.Type; }
|
get { return Source.Definition; }
|
||||||
set { throw new InvalidOperationException(); }
|
set { throw new InvalidOperationException(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace BizHawk.Client.Common
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ClickyVirtualPadController : IController
|
public class ClickyVirtualPadController : IController
|
||||||
{
|
{
|
||||||
public ControllerDefinition Type { get; set; }
|
public ControllerDefinition Definition { get; set; }
|
||||||
|
|
||||||
public bool this[string button]
|
public bool this[string button]
|
||||||
{
|
{
|
||||||
|
@ -86,9 +86,9 @@ namespace BizHawk.Client.Common
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UD_LR_ControllerAdapter : IController
|
public class UD_LR_ControllerAdapter : IController
|
||||||
{
|
{
|
||||||
public ControllerDefinition Type
|
public ControllerDefinition Definition
|
||||||
{
|
{
|
||||||
get { return Source.Type; }
|
get { return Source.Definition; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool this[string button]
|
public bool this[string button]
|
||||||
|
@ -185,7 +185,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public class SimpleController : IController
|
public class SimpleController : IController
|
||||||
{
|
{
|
||||||
public ControllerDefinition Type { get; set; }
|
public ControllerDefinition Definition { get; set; }
|
||||||
|
|
||||||
protected WorkingDictionary<string, bool> Buttons = new WorkingDictionary<string, bool>();
|
protected WorkingDictionary<string, bool> Buttons = new WorkingDictionary<string, bool>();
|
||||||
protected WorkingDictionary<string, float> Floats = new WorkingDictionary<string, float>();
|
protected WorkingDictionary<string, float> Floats = new WorkingDictionary<string, float>();
|
||||||
|
@ -219,7 +219,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public virtual void LatchFrom(IController source)
|
public virtual void LatchFrom(IController source)
|
||||||
{
|
{
|
||||||
foreach (var button in source.Type.BoolButtons)
|
foreach (var button in source.Definition.BoolButtons)
|
||||||
{
|
{
|
||||||
Buttons[button] = source[button];
|
Buttons[button] = source[button];
|
||||||
}
|
}
|
||||||
|
@ -246,13 +246,13 @@ namespace BizHawk.Client.Common
|
||||||
// this works in the code because SourceOr is the autofire controller
|
// this works in the code because SourceOr is the autofire controller
|
||||||
public float GetFloat(string name)
|
public float GetFloat(string name)
|
||||||
{
|
{
|
||||||
int i = Source.Type.FloatControls.IndexOf(name);
|
int i = Source.Definition.FloatControls.IndexOf(name);
|
||||||
return Source.Type.FloatRanges[i].Mid; // Floats don't make sense in sticky land
|
return Source.Definition.FloatRanges[i].Mid; // Floats don't make sense in sticky land
|
||||||
}
|
}
|
||||||
|
|
||||||
public ISticky Source { get; set; }
|
public ISticky Source { get; set; }
|
||||||
public ISticky SourceStickyOr { get; set; }
|
public ISticky SourceStickyOr { get; set; }
|
||||||
public ControllerDefinition Type { get { return Source.Type; } set { throw new InvalidOperationException(); } }
|
public ControllerDefinition Definition { get { return Source.Definition; } set { throw new InvalidOperationException(); } }
|
||||||
|
|
||||||
public bool this[string button]
|
public bool this[string button]
|
||||||
{
|
{
|
||||||
|
@ -280,9 +280,9 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public IController Source { get; set; }
|
public IController Source { get; set; }
|
||||||
|
|
||||||
public ControllerDefinition Type
|
public ControllerDefinition Definition
|
||||||
{
|
{
|
||||||
get { return Source.Type; }
|
get { return Source.Definition; }
|
||||||
set { throw new InvalidOperationException(); }
|
set { throw new InvalidOperationException(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,9 +440,9 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public IController Source { get; set; }
|
public IController Source { get; set; }
|
||||||
|
|
||||||
public ControllerDefinition Type
|
public ControllerDefinition Definition
|
||||||
{
|
{
|
||||||
get { return Source.Type; }
|
get { return Source.Definition; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Locked { get; set; } // Pretty much a hack,
|
public bool Locked { get; set; } // Pretty much a hack,
|
||||||
|
@ -598,9 +598,9 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControllerDefinition Type
|
public ControllerDefinition Definition
|
||||||
{
|
{
|
||||||
get { return Curr.Type; }
|
get { return Curr.Definition; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool this[string button]
|
public bool this[string button]
|
||||||
|
@ -654,7 +654,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControllerDefinition Type { get; set; }
|
public ControllerDefinition Definition { get; set; }
|
||||||
|
|
||||||
public IEnumerable<string> Overrides
|
public IEnumerable<string> Overrides
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace BizHawk.Client.Common
|
||||||
public static void RewireInputChain()
|
public static void RewireInputChain()
|
||||||
{
|
{
|
||||||
Global.ControllerInputCoalescer.Clear();
|
Global.ControllerInputCoalescer.Clear();
|
||||||
Global.ControllerInputCoalescer.Type = Global.ActiveController.Type;
|
Global.ControllerInputCoalescer.Definition = Global.ActiveController.Definition;
|
||||||
|
|
||||||
Global.UD_LR_ControllerAdapter.Source = Global.ActiveController.Or(Global.AutoFireController);
|
Global.UD_LR_ControllerAdapter.Source = Global.ActiveController.Or(Global.AutoFireController);
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ namespace BizHawk.Client.Common
|
||||||
Global.ControllerOutput.Source = Global.MovieOutputHardpoint;
|
Global.ControllerOutput.Source = Global.MovieOutputHardpoint;
|
||||||
|
|
||||||
Global.Emulator.Controller = Global.ControllerOutput;
|
Global.Emulator.Controller = Global.ControllerOutput;
|
||||||
Global.MovieSession.MovieControllerAdapter.Type = Global.MovieInputSourceAdapter.Type;
|
Global.MovieSession.MovieControllerAdapter.Definition = Global.MovieInputSourceAdapter.Definition;
|
||||||
|
|
||||||
// connect the movie session before MovieOutputHardpoint if it is doing anything
|
// connect the movie session before MovieOutputHardpoint if it is doing anything
|
||||||
// otherwise connect the MovieInputSourceAdapter to it, effectively bypassing the movie session
|
// otherwise connect the MovieInputSourceAdapter to it, effectively bypassing the movie session
|
||||||
|
@ -45,7 +45,7 @@ namespace BizHawk.Client.Common
|
||||||
// allow propogating controls that are in the current controller definition but not in the prebaked one
|
// allow propogating controls that are in the current controller definition but not in the prebaked one
|
||||||
// these two lines shouldn't be required anymore under the new system?
|
// these two lines shouldn't be required anymore under the new system?
|
||||||
Global.ActiveController.ForceType(new ControllerDefinition(def));
|
Global.ActiveController.ForceType(new ControllerDefinition(def));
|
||||||
Global.ClickyVirtualPadController.Type = new ControllerDefinition(def);
|
Global.ClickyVirtualPadController.Definition = new ControllerDefinition(def);
|
||||||
RewireInputChain();
|
RewireInputChain();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
var buttons = Lua.NewTable();
|
var buttons = Lua.NewTable();
|
||||||
var adaptor = Global.AutofireStickyXORAdapter;
|
var adaptor = Global.AutofireStickyXORAdapter;
|
||||||
foreach (var button in adaptor.Source.Type.BoolButtons)
|
foreach (var button in adaptor.Source.Definition.BoolButtons)
|
||||||
{
|
{
|
||||||
if (!controller.HasValue)
|
if (!controller.HasValue)
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var button in adaptor.Source.Type.FloatControls)
|
foreach (var button in adaptor.Source.Definition.FloatControls)
|
||||||
{
|
{
|
||||||
if (controller == null)
|
if (controller == null)
|
||||||
{
|
{
|
||||||
|
@ -59,7 +59,7 @@ namespace BizHawk.Client.Common
|
||||||
public LuaTable GetImmediate()
|
public LuaTable GetImmediate()
|
||||||
{
|
{
|
||||||
var buttons = Lua.NewTable();
|
var buttons = Lua.NewTable();
|
||||||
foreach (var button in Global.ActiveController.Type.BoolButtons)
|
foreach (var button in Global.ActiveController.Definition.BoolButtons)
|
||||||
{
|
{
|
||||||
buttons[button] = Global.ActiveController[button];
|
buttons[button] = Global.ActiveController[button];
|
||||||
}
|
}
|
||||||
|
@ -78,12 +78,12 @@ namespace BizHawk.Client.Common
|
||||||
var lg = Global.MovieSession.MovieControllerInstance();
|
var lg = Global.MovieSession.MovieControllerInstance();
|
||||||
lg.SetControllersAsMnemonic(inputLogEntry);
|
lg.SetControllersAsMnemonic(inputLogEntry);
|
||||||
|
|
||||||
foreach (var button in lg.Type.BoolButtons)
|
foreach (var button in lg.Definition.BoolButtons)
|
||||||
{
|
{
|
||||||
Global.LuaAndAdaptor.SetButton(button, lg.IsPressed(button));
|
Global.LuaAndAdaptor.SetButton(button, lg.IsPressed(button));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var floatButton in lg.Type.FloatControls)
|
foreach (var floatButton in lg.Definition.FloatControls)
|
||||||
{
|
{
|
||||||
Global.LuaAndAdaptor.SetFloat(floatButton, lg.GetFloat(floatButton));
|
Global.LuaAndAdaptor.SetFloat(floatButton, lg.GetFloat(floatButton));
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,12 +63,12 @@ namespace BizHawk.Client.Common
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var button in adapter.Type.BoolButtons)
|
foreach (var button in adapter.Definition.BoolButtons)
|
||||||
{
|
{
|
||||||
input[button] = adapter[button];
|
input[button] = adapter[button];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var button in adapter.Type.FloatControls)
|
foreach (var button in adapter.Definition.FloatControls)
|
||||||
{
|
{
|
||||||
input[button] = adapter[button];
|
input[button] = adapter[button];
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ namespace BizHawk.Client.Common
|
||||||
public IMovieController MovieControllerInstance()
|
public IMovieController MovieControllerInstance()
|
||||||
{
|
{
|
||||||
var adapter = Movie.LogGeneratorInstance().MovieControllerAdapter;
|
var adapter = Movie.LogGeneratorInstance().MovieControllerAdapter;
|
||||||
adapter.Type = MovieControllerAdapter.Type;
|
adapter.Definition = MovieControllerAdapter.Definition;
|
||||||
return adapter;
|
return adapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ namespace BizHawk.Client.Common
|
||||||
public int PlayerSource { get; set; }
|
public int PlayerSource { get; set; }
|
||||||
public int PlayerTargetMask { get; set; }
|
public int PlayerTargetMask { get; set; }
|
||||||
|
|
||||||
public ControllerDefinition Type { get { return Source.Type; } }
|
public ControllerDefinition Definition { get { return Source.Definition; } }
|
||||||
|
|
||||||
public bool this[string button]
|
public bool this[string button]
|
||||||
{
|
{
|
||||||
|
|
|
@ -71,7 +71,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
private Bk2ControllerDefinition _type = new Bk2ControllerDefinition();
|
private Bk2ControllerDefinition _type = new Bk2ControllerDefinition();
|
||||||
|
|
||||||
public ControllerDefinition Type
|
public ControllerDefinition Definition
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
@ -90,7 +90,7 @@ namespace BizHawk.Client.Common
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void LatchPlayerFromSource(IController playerSource, int playerNum)
|
public void LatchPlayerFromSource(IController playerSource, int playerNum)
|
||||||
{
|
{
|
||||||
foreach (var button in playerSource.Type.BoolButtons)
|
foreach (var button in playerSource.Definition.BoolButtons)
|
||||||
{
|
{
|
||||||
var bnp = ButtonNameParser.Parse(button);
|
var bnp = ButtonNameParser.Parse(button);
|
||||||
if (bnp == null)
|
if (bnp == null)
|
||||||
|
@ -107,7 +107,7 @@ namespace BizHawk.Client.Common
|
||||||
MyBoolButtons[button] = val;
|
MyBoolButtons[button] = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var button in Type.FloatControls)
|
foreach (var button in Definition.FloatControls)
|
||||||
{
|
{
|
||||||
var bnp = ButtonNameParser.Parse(button);
|
var bnp = ButtonNameParser.Parse(button);
|
||||||
if (bnp == null)
|
if (bnp == null)
|
||||||
|
@ -131,12 +131,12 @@ namespace BizHawk.Client.Common
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void LatchFromSource(IController source)
|
public void LatchFromSource(IController source)
|
||||||
{
|
{
|
||||||
foreach (var button in Type.BoolButtons)
|
foreach (var button in Definition.BoolButtons)
|
||||||
{
|
{
|
||||||
MyBoolButtons[button] = source.IsPressed(button);
|
MyBoolButtons[button] = source.IsPressed(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var name in Type.FloatControls)
|
foreach (var name in Definition.FloatControls)
|
||||||
{
|
{
|
||||||
MyFloatControls[name] = source.GetFloat(name);
|
MyFloatControls[name] = source.GetFloat(name);
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
var def = Global.Emulator.ControllerDefinition;
|
var def = Global.Emulator.ControllerDefinition;
|
||||||
var trimmed = mnemonic.Replace("|", "");
|
var trimmed = mnemonic.Replace("|", "");
|
||||||
var buttons = Type.ControlsOrdered.SelectMany(x => x).ToList();
|
var buttons = Definition.ControlsOrdered.SelectMany(x => x).ToList();
|
||||||
var iterator = 0;
|
var iterator = 0;
|
||||||
|
|
||||||
foreach (var key in buttons)
|
foreach (var key in buttons)
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace BizHawk.Client.Common
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.Append("LogKey:");
|
sb.Append("LogKey:");
|
||||||
|
|
||||||
foreach (var group in _source.Type.ControlsOrdered.Where(c => c.Any()))
|
foreach (var group in _source.Definition.ControlsOrdered.Where(c => c.Any()))
|
||||||
{
|
{
|
||||||
sb.Append("#");
|
sb.Append("#");
|
||||||
foreach (var button in group)
|
foreach (var button in group)
|
||||||
|
@ -84,15 +84,15 @@ namespace BizHawk.Client.Common
|
||||||
public Dictionary<string, string> Map()
|
public Dictionary<string, string> Map()
|
||||||
{
|
{
|
||||||
var dict = new Dictionary<string, string>();
|
var dict = new Dictionary<string, string>();
|
||||||
foreach (var group in _source.Type.ControlsOrdered.Where(c => c.Any()))
|
foreach (var group in _source.Definition.ControlsOrdered.Where(c => c.Any()))
|
||||||
{
|
{
|
||||||
foreach (var button in group)
|
foreach (var button in group)
|
||||||
{
|
{
|
||||||
if (_source.Type.BoolButtons.Contains(button))
|
if (_source.Definition.BoolButtons.Contains(button))
|
||||||
{
|
{
|
||||||
dict.Add(button, Mnemonics[button].ToString());
|
dict.Add(button, Mnemonics[button].ToString());
|
||||||
}
|
}
|
||||||
else if (_source.Type.FloatControls.Contains(button))
|
else if (_source.Definition.FloatControls.Contains(button))
|
||||||
{
|
{
|
||||||
dict.Add(button, FloatLookup[button]);
|
dict.Add(button, FloatLookup[button]);
|
||||||
}
|
}
|
||||||
|
@ -109,17 +109,17 @@ namespace BizHawk.Client.Common
|
||||||
if (!forInputDisplay)
|
if (!forInputDisplay)
|
||||||
sb.Append('|');
|
sb.Append('|');
|
||||||
|
|
||||||
foreach (var group in _source.Type.ControlsOrdered)
|
foreach (var group in _source.Definition.ControlsOrdered)
|
||||||
{
|
{
|
||||||
if (group.Any())
|
if (group.Any())
|
||||||
{
|
{
|
||||||
foreach (var button in group)
|
foreach (var button in group)
|
||||||
{
|
{
|
||||||
if (_source.Type.FloatControls.Contains(button))
|
if (_source.Definition.FloatControls.Contains(button))
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
int i = _source.Type.FloatControls.IndexOf(button);
|
int i = _source.Definition.FloatControls.IndexOf(button);
|
||||||
int mid = (int)_source.Type.FloatRanges[i].Mid;
|
int mid = (int)_source.Definition.FloatRanges[i].Mid;
|
||||||
|
|
||||||
if (createEmpty)
|
if (createEmpty)
|
||||||
{
|
{
|
||||||
|
@ -135,7 +135,7 @@ namespace BizHawk.Client.Common
|
||||||
else
|
else
|
||||||
sb.Append(val.ToString().PadLeft(5, ' ')).Append(',');
|
sb.Append(val.ToString().PadLeft(5, ' ')).Append(',');
|
||||||
}
|
}
|
||||||
else if (_source.Type.BoolButtons.Contains(button))
|
else if (_source.Definition.BoolButtons.Contains(button))
|
||||||
{
|
{
|
||||||
if (createEmpty)
|
if (createEmpty)
|
||||||
{
|
{
|
||||||
|
|
|
@ -321,7 +321,7 @@ namespace BizHawk.Client.Common
|
||||||
private string ConvertLogEntryFromFile(string line, string logKey)
|
private string ConvertLogEntryFromFile(string line, string logKey)
|
||||||
{
|
{
|
||||||
var adapter = new Bk2LogEntryGenerator(logKey).MovieControllerAdapter;
|
var adapter = new Bk2LogEntryGenerator(logKey).MovieControllerAdapter;
|
||||||
adapter.Type = Global.MovieSession.MovieControllerAdapter.Type;
|
adapter.Definition = Global.MovieSession.MovieControllerAdapter.Definition;
|
||||||
adapter.SetControllersAsMnemonic(line);
|
adapter.SetControllersAsMnemonic(line);
|
||||||
|
|
||||||
var lg = LogGeneratorInstance();
|
var lg = LogGeneratorInstance();
|
||||||
|
|
|
@ -143,7 +143,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
var adapter = new Bk2ControllerAdapter
|
var adapter = new Bk2ControllerAdapter
|
||||||
{
|
{
|
||||||
Type = Global.MovieSession.MovieControllerAdapter.Type
|
Definition = Global.MovieSession.MovieControllerAdapter.Definition
|
||||||
};
|
};
|
||||||
|
|
||||||
adapter.SetControllersAsMnemonic(_log[getframe]);
|
adapter.SetControllersAsMnemonic(_log[getframe]);
|
||||||
|
|
|
@ -28,14 +28,14 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
#region IMovieController Implementation
|
#region IMovieController Implementation
|
||||||
|
|
||||||
public ControllerDefinition Type { get; set; }
|
public ControllerDefinition Definition { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// latches one player from the source
|
/// latches one player from the source
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void LatchPlayerFromSource(IController playerSource, int playerNum)
|
public void LatchPlayerFromSource(IController playerSource, int playerNum)
|
||||||
{
|
{
|
||||||
foreach (var button in playerSource.Type.BoolButtons)
|
foreach (var button in playerSource.Definition.BoolButtons)
|
||||||
{
|
{
|
||||||
var bnp = ButtonNameParser.Parse(button);
|
var bnp = ButtonNameParser.Parse(button);
|
||||||
if (bnp == null)
|
if (bnp == null)
|
||||||
|
@ -58,12 +58,12 @@ namespace BizHawk.Client.Common
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void LatchFromSource(IController source)
|
public void LatchFromSource(IController source)
|
||||||
{
|
{
|
||||||
foreach (var button in Type.BoolButtons)
|
foreach (var button in Definition.BoolButtons)
|
||||||
{
|
{
|
||||||
MyBoolButtons[button] = source[button];
|
MyBoolButtons[button] = source[button];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var name in Type.FloatControls)
|
foreach (var name in Definition.FloatControls)
|
||||||
{
|
{
|
||||||
MyFloatControls[name] = source.GetFloat(name);
|
MyFloatControls[name] = source.GetFloat(name);
|
||||||
}
|
}
|
||||||
|
@ -258,7 +258,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
private bool IsGenesis6Button()
|
private bool IsGenesis6Button()
|
||||||
{
|
{
|
||||||
return this.Type.BoolButtons.Contains("P1 X");
|
return this.Definition.BoolButtons.Contains("P1 X");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Force(string button, bool state)
|
private void Force(string button, bool state)
|
||||||
|
@ -271,7 +271,7 @@ namespace BizHawk.Client.Common
|
||||||
MyFloatControls[name] = state;
|
MyFloatControls[name] = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ControlType { get { return Type.Name; } }
|
private string ControlType { get { return Definition.Name; } }
|
||||||
|
|
||||||
private void SetGBAControllersAsMnemonic(string mnemonic)
|
private void SetGBAControllersAsMnemonic(string mnemonic)
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace BizHawk.Client.Common
|
||||||
public void SetSource(IController source)
|
public void SetSource(IController source)
|
||||||
{
|
{
|
||||||
_source = source;
|
_source = source;
|
||||||
_controlType = source.Type.Name;
|
_controlType = source.Definition.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GenerateLogEntry()
|
public string GenerateLogEntry()
|
||||||
|
|
|
@ -100,7 +100,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
var adapter = new BkmControllerAdapter
|
var adapter = new BkmControllerAdapter
|
||||||
{
|
{
|
||||||
Type = Global.MovieSession.MovieControllerAdapter.Type
|
Definition = Global.MovieSession.MovieControllerAdapter.Definition
|
||||||
};
|
};
|
||||||
adapter.SetControllersAsMnemonic(_log[getframe]);
|
adapter.SetControllersAsMnemonic(_log[getframe]);
|
||||||
return adapter;
|
return adapter;
|
||||||
|
|
|
@ -241,7 +241,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
private static IController EmptyLmsvFrame(string line)
|
private static IController EmptyLmsvFrame(string line)
|
||||||
{
|
{
|
||||||
var emptyController = new SimpleController { Type = new ControllerDefinition { Name = "SNES Controller" } };
|
var emptyController = new SimpleController { Definition = new ControllerDefinition { Name = "SNES Controller" } };
|
||||||
emptyController["Reset"] = false;
|
emptyController["Reset"] = false;
|
||||||
emptyController["Power"] = false;
|
emptyController["Power"] = false;
|
||||||
|
|
||||||
|
@ -294,7 +294,7 @@ namespace BizHawk.Client.Common
|
||||||
controller = "Saturn Controller";
|
controller = "Saturn Controller";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
var controllers = new SimpleController { Type = new ControllerDefinition { Name = controller } };
|
var controllers = new SimpleController { Definition = new ControllerDefinition { Name = controller } };
|
||||||
// Split up the sections of the frame.
|
// Split up the sections of the frame.
|
||||||
string[] sections = line.Split('|');
|
string[] sections = line.Split('|');
|
||||||
if (ext == ".FM2" && sections.Length >= 2 && sections[1].Length != 0)
|
if (ext == ".FM2" && sections.Length >= 2 && sections[1].Length != 0)
|
||||||
|
@ -373,14 +373,14 @@ namespace BizHawk.Client.Common
|
||||||
int player = section + player_offset;
|
int player = section + player_offset;
|
||||||
string prefix = "P" + (player) + " ";
|
string prefix = "P" + (player) + " ";
|
||||||
// Gameboy doesn't currently have a prefix saying which player the input is for.
|
// Gameboy doesn't currently have a prefix saying which player the input is for.
|
||||||
if (controllers.Type.Name == "Gameboy Controller")
|
if (controllers.Definition.Name == "Gameboy Controller")
|
||||||
{
|
{
|
||||||
prefix = "";
|
prefix = "";
|
||||||
}
|
}
|
||||||
// Only count lines with that have the right number of buttons and are for valid players.
|
// Only count lines with that have the right number of buttons and are for valid players.
|
||||||
if (
|
if (
|
||||||
sections[section].Length == buttons.Length &&
|
sections[section].Length == buttons.Length &&
|
||||||
player <= BkmMnemonicConstants.PLAYERS[controllers.Type.Name]
|
player <= BkmMnemonicConstants.PLAYERS[controllers.Definition.Name]
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
for (int button = 0; button < buttons.Length; button++)
|
for (int button = 0; button < buttons.Length; button++)
|
||||||
|
@ -724,7 +724,7 @@ namespace BizHawk.Client.Common
|
||||||
m.Header[HeaderKeys.AUTHOR] = author;
|
m.Header[HeaderKeys.AUTHOR] = author;
|
||||||
// Advance to first byte of input data.
|
// Advance to first byte of input data.
|
||||||
r.BaseStream.Position = firstFrameOffset;
|
r.BaseStream.Position = firstFrameOffset;
|
||||||
SimpleController controllers = new SimpleController { Type = new ControllerDefinition { Name = "NES Controller" } };
|
SimpleController controllers = new SimpleController { Definition = new ControllerDefinition { Name = "NES Controller" } };
|
||||||
string[] buttons = { "A", "B", "Select", "Start", "Up", "Down", "Left", "Right" };
|
string[] buttons = { "A", "B", "Select", "Start", "Up", "Down", "Left", "Right" };
|
||||||
bool fds = false;
|
bool fds = false;
|
||||||
bool fourscore = false;
|
bool fourscore = false;
|
||||||
|
@ -955,7 +955,7 @@ namespace BizHawk.Client.Common
|
||||||
*/
|
*/
|
||||||
m.Header[HeaderKeys.PAL] = "False";
|
m.Header[HeaderKeys.PAL] = "False";
|
||||||
// 090 frame data begins here
|
// 090 frame data begins here
|
||||||
SimpleController controllers = new SimpleController { Type = new ControllerDefinition { Name = "NES Controller" } };
|
SimpleController controllers = new SimpleController { Definition = new ControllerDefinition { Name = "NES Controller" } };
|
||||||
/*
|
/*
|
||||||
* 01 Right
|
* 01 Right
|
||||||
* 02 Left
|
* 02 Left
|
||||||
|
@ -1042,14 +1042,14 @@ namespace BizHawk.Client.Common
|
||||||
string player1Config = r.ReadStringFixedAscii(1);
|
string player1Config = r.ReadStringFixedAscii(1);
|
||||||
// 015 ASCII-encoded controller config for player 2. '3' or '6'.
|
// 015 ASCII-encoded controller config for player 2. '3' or '6'.
|
||||||
string player2Config = r.ReadStringFixedAscii(1);
|
string player2Config = r.ReadStringFixedAscii(1);
|
||||||
SimpleController controllers = new SimpleController { Type = new ControllerDefinition() };
|
SimpleController controllers = new SimpleController { Definition = new ControllerDefinition() };
|
||||||
if (player1Config == "6" || player2Config == "6")
|
if (player1Config == "6" || player2Config == "6")
|
||||||
{
|
{
|
||||||
controllers.Type.Name = "GPGX Genesis Controller";
|
controllers.Definition.Name = "GPGX Genesis Controller";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
controllers.Type.Name = "GPGX 3-Button Controller";
|
controllers.Definition.Name = "GPGX 3-Button Controller";
|
||||||
}
|
}
|
||||||
// 016 special flags (Version A and up only)
|
// 016 special flags (Version A and up only)
|
||||||
byte flags = r.ReadByte();
|
byte flags = r.ReadByte();
|
||||||
|
@ -1474,7 +1474,7 @@ namespace BizHawk.Client.Common
|
||||||
r.ReadBytes(103);
|
r.ReadBytes(103);
|
||||||
// TODO: Verify if NTSC/"PAL" mode used for the movie can be detected or not.
|
// TODO: Verify if NTSC/"PAL" mode used for the movie can be detected or not.
|
||||||
// 100 variable Input data
|
// 100 variable Input data
|
||||||
SimpleController controllers = new SimpleController { Type = new ControllerDefinition { Name = name + " Controller" } };
|
SimpleController controllers = new SimpleController { Definition = new ControllerDefinition { Name = name + " Controller" } };
|
||||||
int bytes = 256;
|
int bytes = 256;
|
||||||
// The input stream consists of 1 byte for power-on and reset, and then X bytes per each input port per frame.
|
// The input stream consists of 1 byte for power-on and reset, and then X bytes per each input port per frame.
|
||||||
if (platform == "nes")
|
if (platform == "nes")
|
||||||
|
@ -1595,7 +1595,7 @@ namespace BizHawk.Client.Common
|
||||||
// 00e4-00f3: binary: rom MD5 digest
|
// 00e4-00f3: binary: rom MD5 digest
|
||||||
byte[] md5 = r.ReadBytes(16);
|
byte[] md5 = r.ReadBytes(16);
|
||||||
m.Header[MD5] = string.Format("{0:x8}", md5.BytesToHexString().ToLower());
|
m.Header[MD5] = string.Format("{0:x8}", md5.BytesToHexString().ToLower());
|
||||||
var controllers = new SimpleController { Type = new ControllerDefinition { Name = "SMS Controller" } };
|
var controllers = new SimpleController { Definition = new ControllerDefinition { Name = "SMS Controller" } };
|
||||||
/*
|
/*
|
||||||
76543210
|
76543210
|
||||||
* bit 0 (0x01): up
|
* bit 0 (0x01): up
|
||||||
|
@ -1820,7 +1820,7 @@ namespace BizHawk.Client.Common
|
||||||
// ... 4-byte little-endian unsigned int: length of controller data in bytes
|
// ... 4-byte little-endian unsigned int: length of controller data in bytes
|
||||||
uint length = r.ReadUInt32();
|
uint length = r.ReadUInt32();
|
||||||
// ... (variable) controller data
|
// ... (variable) controller data
|
||||||
SimpleController controllers = new SimpleController { Type = new ControllerDefinition { Name = "NES Controller" } };
|
SimpleController controllers = new SimpleController { Definition = new ControllerDefinition { Name = "NES Controller" } };
|
||||||
/*
|
/*
|
||||||
Standard controllers store data in the following format:
|
Standard controllers store data in the following format:
|
||||||
* 01: A
|
* 01: A
|
||||||
|
@ -1923,7 +1923,7 @@ namespace BizHawk.Client.Common
|
||||||
* bit 4: controller 5 in use
|
* bit 4: controller 5 in use
|
||||||
* other: reserved, set to 0
|
* other: reserved, set to 0
|
||||||
*/
|
*/
|
||||||
SimpleController controllers = new SimpleController { Type = new ControllerDefinition { Name = "SNES Controller" } };
|
SimpleController controllers = new SimpleController { Definition = new ControllerDefinition { Name = "SNES Controller" } };
|
||||||
bool[] controllersUsed = new bool[5];
|
bool[] controllersUsed = new bool[5];
|
||||||
for (int controller = 1; controller <= controllersUsed.Length; controller++)
|
for (int controller = 1; controller <= controllersUsed.Length; controller++)
|
||||||
{
|
{
|
||||||
|
@ -2109,7 +2109,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ushort controllerState = (ushort)(((controllerState1 << 4) & 0x0F00) | controllerState2);
|
ushort controllerState = (ushort)(((controllerState1 << 4) & 0x0F00) | controllerState2);
|
||||||
if (player <= BkmMnemonicConstants.PLAYERS[controllers.Type.Name])
|
if (player <= BkmMnemonicConstants.PLAYERS[controllers.Definition.Name])
|
||||||
{
|
{
|
||||||
for (int button = 0; button < buttons.Length; button++)
|
for (int button = 0; button < buttons.Length; button++)
|
||||||
{
|
{
|
||||||
|
@ -2334,14 +2334,14 @@ namespace BizHawk.Client.Common
|
||||||
string movieDescription = NullTerminated(r.ReadStringFixedAscii(128));
|
string movieDescription = NullTerminated(r.ReadStringFixedAscii(128));
|
||||||
m.Comments.Add(COMMENT + " " + movieDescription);
|
m.Comments.Add(COMMENT + " " + movieDescription);
|
||||||
r.BaseStream.Position = firstFrameOffset;
|
r.BaseStream.Position = firstFrameOffset;
|
||||||
SimpleController controllers = new SimpleController { Type = new ControllerDefinition() };
|
SimpleController controllers = new SimpleController { Definition = new ControllerDefinition() };
|
||||||
if (platform != "GBA")
|
if (platform != "GBA")
|
||||||
{
|
{
|
||||||
controllers.Type.Name = "Gameboy Controller";
|
controllers.Definition.Name = "Gameboy Controller";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
controllers.Type.Name = "GBA Controller";
|
controllers.Definition.Name = "GBA Controller";
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* 01 00 A
|
* 01 00 A
|
||||||
|
@ -2512,7 +2512,7 @@ namespace BizHawk.Client.Common
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
r.BaseStream.Position = firstFrameOffset;
|
r.BaseStream.Position = firstFrameOffset;
|
||||||
SimpleController controllers = new SimpleController { Type = new ControllerDefinition { Name = "NES Controller" } };
|
SimpleController controllers = new SimpleController { Definition = new ControllerDefinition { Name = "NES Controller" } };
|
||||||
/*
|
/*
|
||||||
* 01 A
|
* 01 A
|
||||||
* 02 B
|
* 02 B
|
||||||
|
@ -2749,7 +2749,7 @@ namespace BizHawk.Client.Common
|
||||||
uint savestateSize = (uint)((r.ReadByte() | (r.ReadByte() << 8) | (r.ReadByte() << 16)) & 0x7FFFFF);
|
uint savestateSize = (uint)((r.ReadByte() | (r.ReadByte() << 8) | (r.ReadByte() << 16)) & 0x7FFFFF);
|
||||||
// Next follows a ZST format savestate.
|
// Next follows a ZST format savestate.
|
||||||
r.ReadBytes((int)savestateSize);
|
r.ReadBytes((int)savestateSize);
|
||||||
SimpleController controllers = new SimpleController { Type = new ControllerDefinition { Name = "SNES Controller" } };
|
SimpleController controllers = new SimpleController { Definition = new ControllerDefinition { Name = "SNES Controller" } };
|
||||||
/*
|
/*
|
||||||
* bit 11: A
|
* bit 11: A
|
||||||
* bit 10: X
|
* bit 10: X
|
||||||
|
@ -2903,7 +2903,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
leftOver = !leftOver;
|
leftOver = !leftOver;
|
||||||
if (player <= BkmMnemonicConstants.PLAYERS[controllers.Type.Name])
|
if (player <= BkmMnemonicConstants.PLAYERS[controllers.Definition.Name])
|
||||||
{
|
{
|
||||||
if (player != 2 || !superScope)
|
if (player != 2 || !superScope)
|
||||||
{
|
{
|
||||||
|
|
|
@ -183,7 +183,7 @@ namespace BizHawk.Client.Common
|
||||||
info.player2Type,
|
info.player2Type,
|
||||||
OctoshockDll.ePeripheralType.None,OctoshockDll.ePeripheralType.None,OctoshockDll.ePeripheralType.None
|
OctoshockDll.ePeripheralType.None,OctoshockDll.ePeripheralType.None,OctoshockDll.ePeripheralType.None
|
||||||
};
|
};
|
||||||
controllers.Type = Octoshock.CreateControllerDefinition(settings);
|
controllers.Definition = Octoshock.CreateControllerDefinition(settings);
|
||||||
|
|
||||||
string[] buttons = { "Select", "L3", "R3", "Start", "Up", "Right", "Down", "Left",
|
string[] buttons = { "Select", "L3", "R3", "Start", "Up", "Right", "Down", "Left",
|
||||||
"L2", "R2", "L1", "R1", "Triangle", "Circle", "Cross", "Square"};
|
"L2", "R2", "L1", "R1", "Triangle", "Circle", "Cross", "Square"};
|
||||||
|
@ -290,7 +290,7 @@ namespace BizHawk.Client.Common
|
||||||
info.player2Type,
|
info.player2Type,
|
||||||
OctoshockDll.ePeripheralType.None,OctoshockDll.ePeripheralType.None,OctoshockDll.ePeripheralType.None
|
OctoshockDll.ePeripheralType.None,OctoshockDll.ePeripheralType.None,OctoshockDll.ePeripheralType.None
|
||||||
};
|
};
|
||||||
controllers.Type = Octoshock.CreateControllerDefinition(settings);
|
controllers.Definition = Octoshock.CreateControllerDefinition(settings);
|
||||||
|
|
||||||
string[] buttons = { "Select", "L3", "R3", "Start", "Up", "Right", "Down", "Left",
|
string[] buttons = { "Select", "L3", "R3", "Start", "Up", "Right", "Down", "Left",
|
||||||
"L2", "R2", "L1", "R1", "Triangle", "Circle", "Cross", "Square"};
|
"L2", "R2", "L1", "R1", "Triangle", "Circle", "Cross", "Square"};
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
public interface IMovieController: IController
|
public interface IMovieController: IController
|
||||||
{
|
{
|
||||||
new ControllerDefinition Type { get; set; }
|
new ControllerDefinition Definition { get; set; }
|
||||||
|
|
||||||
void LatchPlayerFromSource(IController playerSource, int playerNum);
|
void LatchPlayerFromSource(IController playerSource, int playerNum);
|
||||||
|
|
||||||
|
|
|
@ -268,14 +268,14 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public string CreateDisplayValueForButton(IController adapter, string buttonName)
|
public string CreateDisplayValueForButton(IController adapter, string buttonName)
|
||||||
{
|
{
|
||||||
if (adapter.Type.BoolButtons.Contains(buttonName))
|
if (adapter.Definition.BoolButtons.Contains(buttonName))
|
||||||
{
|
{
|
||||||
return adapter.IsPressed(buttonName) ?
|
return adapter.IsPressed(buttonName) ?
|
||||||
Mnemonics[buttonName].ToString() :
|
Mnemonics[buttonName].ToString() :
|
||||||
string.Empty;
|
string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (adapter.Type.FloatControls.Contains(buttonName))
|
if (adapter.Definition.FloatControls.Contains(buttonName))
|
||||||
{
|
{
|
||||||
return adapter.GetFloat(buttonName).ToString();
|
return adapter.GetFloat(buttonName).ToString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -903,7 +903,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
var lg = Global.MovieSession.MovieControllerInstance();
|
var lg = Global.MovieSession.MovieControllerInstance();
|
||||||
lg.SetControllersAsMnemonic(logEntry);
|
lg.SetControllersAsMnemonic(logEntry);
|
||||||
|
|
||||||
foreach (var button in lg.Type.BoolButtons)
|
foreach (var button in lg.Definition.BoolButtons)
|
||||||
{
|
{
|
||||||
// TODO: make an input adapter specifically for the bot?
|
// TODO: make an input adapter specifically for the bot?
|
||||||
Global.LuaAndAdaptor.SetButton(button, lg.IsPressed(button));
|
Global.LuaAndAdaptor.SetButton(button, lg.IsPressed(button));
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
var lg = Global.MovieSession.LogGeneratorInstance() as Bk2LogEntryGenerator;
|
var lg = Global.MovieSession.LogGeneratorInstance() as Bk2LogEntryGenerator;
|
||||||
lg.SetSource(Global.MovieSession.MovieControllerAdapter);
|
lg.SetSource(Global.MovieSession.MovieControllerAdapter);
|
||||||
targetController = new Bk2ControllerAdapter();
|
targetController = new Bk2ControllerAdapter();
|
||||||
targetController.Type = Global.Emulator.ControllerDefinition;
|
targetController.Definition = Global.Emulator.ControllerDefinition;
|
||||||
targetController.LatchFromSource(targetController); // Reference and create all buttons
|
targetController.LatchFromSource(targetController); // Reference and create all buttons
|
||||||
|
|
||||||
if (key == "")
|
if (key == "")
|
||||||
|
@ -63,7 +63,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
controller = new Bk2ControllerAdapter { Type = d };
|
controller = new Bk2ControllerAdapter { Definition = d };
|
||||||
var logGenerator = new Bk2LogEntryGenerator("");
|
var logGenerator = new Bk2LogEntryGenerator("");
|
||||||
logGenerator.SetSource(controller);
|
logGenerator.SetSource(controller);
|
||||||
logGenerator.GenerateLogEntry(); // Reference and create all buttons.
|
logGenerator.GenerateLogEntry(); // Reference and create all buttons.
|
||||||
|
@ -104,7 +104,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var newController = new Bk2ControllerAdapter { Type = d };
|
var newController = new Bk2ControllerAdapter { Definition = d };
|
||||||
var logGenerator = new Bk2LogEntryGenerator("");
|
var logGenerator = new Bk2LogEntryGenerator("");
|
||||||
|
|
||||||
logGenerator.SetSource(newController);
|
logGenerator.SetSource(newController);
|
||||||
|
@ -252,7 +252,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
// Adapters
|
// Adapters
|
||||||
targetController = new Bk2ControllerAdapter();
|
targetController = new Bk2ControllerAdapter();
|
||||||
targetController.Type = Global.Emulator.ControllerDefinition;
|
targetController.Definition = Global.Emulator.ControllerDefinition;
|
||||||
targetController.LatchFromSource(targetController); // Reference and create all buttons
|
targetController.LatchFromSource(targetController); // Reference and create all buttons
|
||||||
string[] keys = _inputKey.Split('|');
|
string[] keys = _inputKey.Split('|');
|
||||||
ControllerDefinition d = new ControllerDefinition();
|
ControllerDefinition d = new ControllerDefinition();
|
||||||
|
@ -268,19 +268,19 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
controller = new Bk2ControllerAdapter { Type = d };
|
controller = new Bk2ControllerAdapter { Definition = d };
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Custom Latch
|
#region Custom Latch
|
||||||
|
|
||||||
private void LatchFromSourceButtons(Bk2ControllerAdapter latching, IController source)
|
private void LatchFromSourceButtons(Bk2ControllerAdapter latching, IController source)
|
||||||
{
|
{
|
||||||
foreach (string button in source.Type.BoolButtons)
|
foreach (string button in source.Definition.BoolButtons)
|
||||||
{
|
{
|
||||||
latching[button] = source.IsPressed(button);
|
latching[button] = source.IsPressed(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (string name in source.Type.FloatControls)
|
foreach (string name in source.Definition.FloatControls)
|
||||||
{
|
{
|
||||||
latching.SetFloat(name, source.GetFloat(name));
|
latching.SetFloat(name, source.GetFloat(name));
|
||||||
}
|
}
|
||||||
|
@ -288,16 +288,16 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void ORLatchFromSource(Bk2ControllerAdapter latching, IController source)
|
private void ORLatchFromSource(Bk2ControllerAdapter latching, IController source)
|
||||||
{
|
{
|
||||||
foreach (string button in latching.Type.BoolButtons)
|
foreach (string button in latching.Definition.BoolButtons)
|
||||||
{
|
{
|
||||||
latching[button] |= source.IsPressed(button);
|
latching[button] |= source.IsPressed(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (string name in latching.Type.FloatControls)
|
foreach (string name in latching.Definition.FloatControls)
|
||||||
{
|
{
|
||||||
float sFloat = source.GetFloat(name);
|
float sFloat = source.GetFloat(name);
|
||||||
int indexRange = source.Type.FloatControls.IndexOf(name);
|
int indexRange = source.Definition.FloatControls.IndexOf(name);
|
||||||
if (sFloat == source.Type.FloatRanges[indexRange].Mid)
|
if (sFloat == source.Definition.FloatRanges[indexRange].Mid)
|
||||||
{
|
{
|
||||||
latching.SetFloat(name, sFloat);
|
latching.SetFloat(name, sFloat);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
tastudio = owner;
|
tastudio = owner;
|
||||||
|
|
||||||
foreach (var button in Global.MovieSession.MovieControllerAdapter.Type.BoolButtons)
|
foreach (var button in Global.MovieSession.MovieControllerAdapter.Definition.BoolButtons)
|
||||||
ButtonBox.Items.Add(button);
|
ButtonBox.Items.Add(button);
|
||||||
foreach (var button in Global.MovieSession.MovieControllerAdapter.Type.FloatControls)
|
foreach (var button in Global.MovieSession.MovieControllerAdapter.Definition.FloatControls)
|
||||||
ButtonBox.Items.Add(button);
|
ButtonBox.Items.Add(button);
|
||||||
ButtonBox.Items.Add("Default bool Auto-Fire");
|
ButtonBox.Items.Add("Default bool Auto-Fire");
|
||||||
ButtonBox.Items.Add("Default float Auto-Fire");
|
ButtonBox.Items.Add("Default float Auto-Fire");
|
||||||
|
@ -37,7 +37,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
List<string> values = new List<string>();
|
List<string> values = new List<string>();
|
||||||
int loopAt;
|
int loopAt;
|
||||||
string selectedButton { get { return ButtonBox.Text; } }
|
string selectedButton { get { return ButtonBox.Text; } }
|
||||||
bool isBool { get { return selectedButton == "Default bool Auto-Fire" || Global.MovieSession.MovieControllerAdapter.Type.BoolButtons.Contains(selectedButton); } }
|
bool isBool { get { return selectedButton == "Default bool Auto-Fire" || Global.MovieSession.MovieControllerAdapter.Definition.BoolButtons.Contains(selectedButton); } }
|
||||||
|
|
||||||
private void ButtonBox_SelectedIndexChanged(object sender, EventArgs e)
|
private void ButtonBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -150,7 +150,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
if (PatternList.SelectedIndex != -1 && PatternList.SelectedIndex < values.Count)
|
if (PatternList.SelectedIndex != -1 && PatternList.SelectedIndex < values.Count)
|
||||||
{
|
{
|
||||||
index = Global.MovieSession.MovieControllerAdapter.Type.BoolButtons.IndexOf(selectedButton);
|
index = Global.MovieSession.MovieControllerAdapter.Definition.BoolButtons.IndexOf(selectedButton);
|
||||||
if (selectedButton == "Default bool Auto-Fire")
|
if (selectedButton == "Default bool Auto-Fire")
|
||||||
index = tastudio.BoolPatterns.Length + 1;
|
index = tastudio.BoolPatterns.Length + 1;
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
|
@ -164,7 +164,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
if (selectedButton == "Default float Auto-Fire")
|
if (selectedButton == "Default float Auto-Fire")
|
||||||
index = tastudio.FloatPatterns.Length + 1;
|
index = tastudio.FloatPatterns.Length + 1;
|
||||||
else
|
else
|
||||||
index = Global.MovieSession.MovieControllerAdapter.Type.FloatControls.IndexOf(selectedButton);
|
index = Global.MovieSession.MovieControllerAdapter.Definition.FloatControls.IndexOf(selectedButton);
|
||||||
|
|
||||||
LagBox.Checked = tastudio.FloatPatterns[index].SkipsLag;
|
LagBox.Checked = tastudio.FloatPatterns[index].SkipsLag;
|
||||||
ValueNum.Value = Convert.ToDecimal(values[PatternList.SelectedIndex]);
|
ValueNum.Value = Convert.ToDecimal(values[PatternList.SelectedIndex]);
|
||||||
|
@ -180,7 +180,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void UpdatePattern()
|
private void UpdatePattern()
|
||||||
{
|
{
|
||||||
int index = Global.MovieSession.MovieControllerAdapter.Type.BoolButtons.IndexOf(selectedButton);
|
int index = Global.MovieSession.MovieControllerAdapter.Definition.BoolButtons.IndexOf(selectedButton);
|
||||||
if (selectedButton == "Default bool Auto-Fire")
|
if (selectedButton == "Default bool Auto-Fire")
|
||||||
index = tastudio.BoolPatterns.Length + 1;
|
index = tastudio.BoolPatterns.Length + 1;
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
|
@ -198,7 +198,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
if (selectedButton == "Default float Auto-Fire")
|
if (selectedButton == "Default float Auto-Fire")
|
||||||
index = tastudio.FloatPatterns.Length + 1;
|
index = tastudio.FloatPatterns.Length + 1;
|
||||||
else
|
else
|
||||||
index = Global.MovieSession.MovieControllerAdapter.Type.FloatControls.IndexOf(selectedButton);
|
index = Global.MovieSession.MovieControllerAdapter.Definition.FloatControls.IndexOf(selectedButton);
|
||||||
List<float> p = new List<float>();
|
List<float> p = new List<float>();
|
||||||
for (int i = 0; i < counts.Count; i++)
|
for (int i = 0; i < counts.Count; i++)
|
||||||
{
|
{
|
||||||
|
@ -213,7 +213,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void GetPattern()
|
private void GetPattern()
|
||||||
{
|
{
|
||||||
int index = Global.MovieSession.MovieControllerAdapter.Type.BoolButtons.IndexOf(selectedButton);
|
int index = Global.MovieSession.MovieControllerAdapter.Definition.BoolButtons.IndexOf(selectedButton);
|
||||||
if (selectedButton == "Default bool Auto-Fire")
|
if (selectedButton == "Default bool Auto-Fire")
|
||||||
index = tastudio.BoolPatterns.Length + 1;
|
index = tastudio.BoolPatterns.Length + 1;
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
|
@ -242,7 +242,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
if (selectedButton == "Default float Auto-Fire")
|
if (selectedButton == "Default float Auto-Fire")
|
||||||
index = tastudio.FloatPatterns.Length + 1;
|
index = tastudio.FloatPatterns.Length + 1;
|
||||||
else
|
else
|
||||||
index = Global.MovieSession.MovieControllerAdapter.Type.FloatControls.IndexOf(selectedButton);
|
index = Global.MovieSession.MovieControllerAdapter.Definition.FloatControls.IndexOf(selectedButton);
|
||||||
float[] p = tastudio.FloatPatterns[index].Pattern;
|
float[] p = tastudio.FloatPatterns[index].Pattern;
|
||||||
float lastValue = p[0];
|
float lastValue = p[0];
|
||||||
counts.Clear();
|
counts.Clear();
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private bool _wasRecording = false;
|
private bool _wasRecording = false;
|
||||||
|
|
||||||
private Emulation.Common.ControllerDefinition controllerType
|
private Emulation.Common.ControllerDefinition controllerType
|
||||||
{ get { return Global.MovieSession.MovieControllerAdapter.Type; } }
|
{ get { return Global.MovieSession.MovieControllerAdapter.Definition; } }
|
||||||
|
|
||||||
public AutoPatternBool[] BoolPatterns;
|
public AutoPatternBool[] BoolPatterns;
|
||||||
public AutoPatternFloat[] FloatPatterns;
|
public AutoPatternFloat[] FloatPatterns;
|
||||||
|
@ -297,8 +297,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
if (column.Type == InputRoll.RollColumn.InputType.Float)
|
if (column.Type == InputRoll.RollColumn.InputType.Float)
|
||||||
{
|
{
|
||||||
// feos: this could be cashed, but I don't notice any slowdown this way either
|
// 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
|
Emulation.Common.ControllerDefinition.FloatRange range = Global.MovieSession.MovieControllerAdapter.Definition.FloatRanges
|
||||||
[Global.MovieSession.MovieControllerAdapter.Type.FloatControls.IndexOf(columnName)];
|
[Global.MovieSession.MovieControllerAdapter.Definition.FloatControls.IndexOf(columnName)];
|
||||||
if (text == range.Mid.ToString())
|
if (text == range.Mid.ToString())
|
||||||
text = "";
|
text = "";
|
||||||
}
|
}
|
||||||
|
@ -493,7 +493,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
bool wasPaused = Mainform.EmulatorPaused;
|
bool wasPaused = Mainform.EmulatorPaused;
|
||||||
|
|
||||||
if (Global.MovieSession.MovieControllerAdapter.Type.BoolButtons.Contains(buttonName))
|
if (Global.MovieSession.MovieControllerAdapter.Definition.BoolButtons.Contains(buttonName))
|
||||||
{
|
{
|
||||||
CurrentTasMovie.ChangeLog.BeginNewBatch("Paint Bool " + buttonName + " from frame " + frame);
|
CurrentTasMovie.ChangeLog.BeginNewBatch("Paint Bool " + buttonName + " from frame " + frame);
|
||||||
|
|
||||||
|
@ -952,8 +952,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float value = _floatPaintState + increment;
|
float value = _floatPaintState + increment;
|
||||||
Emulation.Common.ControllerDefinition.FloatRange range = Global.MovieSession.MovieControllerAdapter.Type.FloatRanges
|
Emulation.Common.ControllerDefinition.FloatRange range = Global.MovieSession.MovieControllerAdapter.Definition.FloatRanges
|
||||||
[Global.MovieSession.MovieControllerAdapter.Type.FloatControls.IndexOf(_floatEditColumn)];
|
[Global.MovieSession.MovieControllerAdapter.Definition.FloatControls.IndexOf(_floatEditColumn)];
|
||||||
// Range for N64 Y axis has max -128 and min 127. That should probably be fixed in ControllerDefinition.cs.
|
// Range for N64 Y axis has max -128 and min 127. That should probably be fixed in ControllerDefinition.cs.
|
||||||
// SuuperW: I really don't think changing it would break anything, but adelikat isn't so sure.
|
// SuuperW: I really don't think changing it would break anything, but adelikat isn't so sure.
|
||||||
float rMax = range.Max;
|
float rMax = range.Max;
|
||||||
|
@ -1027,8 +1027,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
float prev = value;
|
float prev = value;
|
||||||
string prevTyped = _floatTypedValue;
|
string prevTyped = _floatTypedValue;
|
||||||
|
|
||||||
Emulation.Common.ControllerDefinition.FloatRange range = Global.MovieSession.MovieControllerAdapter.Type.FloatRanges
|
Emulation.Common.ControllerDefinition.FloatRange range = Global.MovieSession.MovieControllerAdapter.Definition.FloatRanges
|
||||||
[Global.MovieSession.MovieControllerAdapter.Type.FloatControls.IndexOf(_floatEditColumn)];
|
[Global.MovieSession.MovieControllerAdapter.Definition.FloatControls.IndexOf(_floatEditColumn)];
|
||||||
|
|
||||||
float rMax = range.Max;
|
float rMax = range.Max;
|
||||||
float rMin = range.Min;
|
float rMin = range.Min;
|
||||||
|
|
|
@ -424,10 +424,10 @@ namespace BizHawk.Client.EmuHawk
|
||||||
int digits = 1;
|
int digits = 1;
|
||||||
foreach (var kvp in columnNames)
|
foreach (var kvp in columnNames)
|
||||||
{
|
{
|
||||||
if (Global.MovieSession.MovieControllerAdapter.Type.FloatControls.Contains(kvp.Key))
|
if (Global.MovieSession.MovieControllerAdapter.Definition.FloatControls.Contains(kvp.Key))
|
||||||
{
|
{
|
||||||
Emulation.Common.ControllerDefinition.FloatRange range = Global.MovieSession.MovieControllerAdapter.Type.FloatRanges
|
Emulation.Common.ControllerDefinition.FloatRange range = Global.MovieSession.MovieControllerAdapter.Definition.FloatRanges
|
||||||
[Global.MovieSession.MovieControllerAdapter.Type.FloatControls.IndexOf(kvp.Key)];
|
[Global.MovieSession.MovieControllerAdapter.Definition.FloatControls.IndexOf(kvp.Key)];
|
||||||
type = InputRoll.RollColumn.InputType.Float;
|
type = InputRoll.RollColumn.InputType.Float;
|
||||||
digits = Math.Max(kvp.Value.Length, range.MaxDigits());
|
digits = Math.Max(kvp.Value.Length, range.MaxDigits());
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,12 +27,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
var lg = Global.MovieSession.MovieControllerInstance();
|
var lg = Global.MovieSession.MovieControllerInstance();
|
||||||
lg.SetControllersAsMnemonic(inputLogEntry);
|
lg.SetControllersAsMnemonic(inputLogEntry);
|
||||||
|
|
||||||
foreach (var button in lg.Type.BoolButtons)
|
foreach (var button in lg.Definition.BoolButtons)
|
||||||
{
|
{
|
||||||
Global.LuaAndAdaptor.SetButton(button, lg.IsPressed(button));
|
Global.LuaAndAdaptor.SetButton(button, lg.IsPressed(button));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var floatButton in lg.Type.FloatControls)
|
foreach (var floatButton in lg.Definition.FloatControls)
|
||||||
{
|
{
|
||||||
Global.LuaAndAdaptor.SetFloat(floatButton, lg.GetFloat(floatButton));
|
Global.LuaAndAdaptor.SetFloat(floatButton, lg.GetFloat(floatButton));
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace BizHawk.Client.MultiHawk
|
||||||
public void RewireInputChain()
|
public void RewireInputChain()
|
||||||
{
|
{
|
||||||
Global.ControllerInputCoalescer.Clear();
|
Global.ControllerInputCoalescer.Clear();
|
||||||
Global.ControllerInputCoalescer.Type = Global.ActiveController.Type;
|
Global.ControllerInputCoalescer.Definition = Global.ActiveController.Definition;
|
||||||
|
|
||||||
// TODO?
|
// TODO?
|
||||||
//Global.UD_LR_ControllerAdapter.Source = Global.ActiveController.Or(Global.AutoFireController);
|
//Global.UD_LR_ControllerAdapter.Source = Global.ActiveController.Or(Global.AutoFireController);
|
||||||
|
@ -42,7 +42,7 @@ namespace BizHawk.Client.MultiHawk
|
||||||
window.Emulator.Controller = Global.ControllerOutput;
|
window.Emulator.Controller = Global.ControllerOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
Global.MovieSession.MovieControllerAdapter.Type = Global.MovieInputSourceAdapter.Type;
|
Global.MovieSession.MovieControllerAdapter.Definition = Global.MovieInputSourceAdapter.Definition;
|
||||||
|
|
||||||
// connect the movie session before MovieOutputHardpoint if it is doing anything
|
// connect the movie session before MovieOutputHardpoint if it is doing anything
|
||||||
// otherwise connect the MovieInputSourceAdapter to it, effectively bypassing the movie session
|
// otherwise connect the MovieInputSourceAdapter to it, effectively bypassing the movie session
|
||||||
|
@ -67,7 +67,7 @@ namespace BizHawk.Client.MultiHawk
|
||||||
// allow propogating controls that are in the current controller definition but not in the prebaked one
|
// allow propogating controls that are in the current controller definition but not in the prebaked one
|
||||||
// these two lines shouldn't be required anymore under the new system?
|
// these two lines shouldn't be required anymore under the new system?
|
||||||
Global.ActiveController.ForceType(new ControllerDefinition(def));
|
Global.ActiveController.ForceType(new ControllerDefinition(def));
|
||||||
Global.ClickyVirtualPadController.Type = new ControllerDefinition(def);
|
Global.ClickyVirtualPadController.Definition = new ControllerDefinition(def);
|
||||||
RewireInputChain();
|
RewireInputChain();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{
|
{
|
||||||
public class NullController : IController
|
public class NullController : IController
|
||||||
{
|
{
|
||||||
public ControllerDefinition Type { get { return null; } }
|
public ControllerDefinition Definition { get { return null; } }
|
||||||
public bool this[string button] { get { return false; } }
|
public bool this[string button] { get { return false; } }
|
||||||
public bool IsPressed(string button) { return false; }
|
public bool IsPressed(string button) { return false; }
|
||||||
public float GetFloat(string name) { return 0f; }
|
public float GetFloat(string name) { return 0f; }
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
{
|
{
|
||||||
public interface IController
|
public interface IController
|
||||||
{
|
{
|
||||||
ControllerDefinition Type { get; }
|
/// <summary>
|
||||||
|
/// Defines the controller schema, including all currently available buttons and their types
|
||||||
|
/// </summary>
|
||||||
|
ControllerDefinition Definition { get; }
|
||||||
|
|
||||||
// TODO - it is obnoxious for this to be here. must be removed.
|
// TODO - it is obnoxious for this to be here. must be removed.
|
||||||
bool this[string button] { get; }
|
bool this[string button] { get; }
|
||||||
|
|
|
@ -1156,7 +1156,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
this.remaps = remaps;
|
this.remaps = remaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControllerDefinition Type { get { throw new NotImplementedException(); } }
|
public ControllerDefinition Definition { get { throw new NotImplementedException(); } }
|
||||||
|
|
||||||
public bool this[string button] { get { return IsPressed(button); } }
|
public bool this[string button] { get { return IsPressed(button); } }
|
||||||
|
|
||||||
|
|
|
@ -862,7 +862,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// invalid until CopyFrom has been called
|
/// invalid until CopyFrom has been called
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ControllerDefinition Type
|
public ControllerDefinition Definition
|
||||||
{
|
{
|
||||||
get { return def; }
|
get { return def; }
|
||||||
}
|
}
|
||||||
|
@ -899,7 +899,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
||||||
/// <param name="source"></param>
|
/// <param name="source"></param>
|
||||||
public void CopyFrom(IController source)
|
public void CopyFrom(IController source)
|
||||||
{
|
{
|
||||||
this.def = source.Type;
|
this.def = source.Definition;
|
||||||
buttons.Clear();
|
buttons.Clear();
|
||||||
foreach (var k in def.BoolButtons)
|
foreach (var k in def.BoolButtons)
|
||||||
buttons.Add(k, source.IsPressed(k) ? 1.0f : 0);
|
buttons.Add(k, source.IsPressed(k) ? 1.0f : 0);
|
||||||
|
|
Loading…
Reference in New Issue