Virtualpads - targeting pair - support ability to set a range to translate values to, and set genesis lightgun to 10000
This commit is contained in:
parent
70eb17ae8f
commit
49955a3447
|
@ -79,7 +79,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
XName = button.Name,
|
XName = button.Name,
|
||||||
YName = button.SecondaryNames[0],
|
YName = button.SecondaryNames[0],
|
||||||
FireButton = button.SecondaryNames[1],
|
FireButton = button.SecondaryNames[1],
|
||||||
Size = button.TargetSize
|
Size = button.TargetSize,
|
||||||
|
RangeX = button.MaxValue,
|
||||||
|
RangeY = button.MaxValue // TODO: ability to have a different Y than X
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case PadSchema.PadInputType.FloatSingle:
|
case PadSchema.PadInputType.FloatSingle:
|
||||||
|
|
|
@ -38,8 +38,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public void Set(IController controller)
|
public void Set(IController controller)
|
||||||
{
|
{
|
||||||
var newX = controller.GetFloat(XName);
|
var newX = controller.GetFloat(XName) / MultiplierX;
|
||||||
var newY = controller.GetFloat(YName);
|
var newY = controller.GetFloat(YName) / MultiplierY;
|
||||||
var changed = newX != X && newY != Y;
|
var changed = newX != X && newY != Y;
|
||||||
|
|
||||||
XNumeric.Value = (int)newX;
|
XNumeric.Value = (int)newX;
|
||||||
|
@ -76,6 +76,36 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
// These are the value that a maximum x or y actually represent, used to translate from control X,Y to values the core expects
|
||||||
|
public int RangeX { get; set; }
|
||||||
|
public int RangeY { get; set; }
|
||||||
|
|
||||||
|
public float MultiplierX
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (RangeX > 0)
|
||||||
|
{
|
||||||
|
return RangeX / (float)TargetPanel.Width;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public float MultiplierY
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (RangeY > 0)
|
||||||
|
{
|
||||||
|
return RangeY / (float)TargetPanel.Height;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Bump(int? x, int? y)
|
public void Bump(int? x, int? y)
|
||||||
{
|
{
|
||||||
if (x.HasValue)
|
if (x.HasValue)
|
||||||
|
@ -99,7 +129,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return (int)Global.StickyXORAdapter.GetFloat(XName);
|
return (int)(Global.StickyXORAdapter.GetFloat(XName) / MultiplierX);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
|
@ -118,14 +148,14 @@ namespace BizHawk.Client.EmuHawk
|
||||||
XNumeric.Value = XNumeric.Maximum;
|
XNumeric.Value = XNumeric.Maximum;
|
||||||
}
|
}
|
||||||
|
|
||||||
Global.StickyXORAdapter.SetFloat(XName, (int)XNumeric.Value);
|
Global.StickyXORAdapter.SetFloat(XName, (int)((float)XNumeric.Value * MultiplierX));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int Y
|
public int Y
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return (int)Global.StickyXORAdapter.GetFloat(YName);
|
return (int)(Global.StickyXORAdapter.GetFloat(YName) / MultiplierY);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
|
@ -143,7 +173,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
YNumeric.Value = YNumeric.Maximum;
|
YNumeric.Value = YNumeric.Maximum;
|
||||||
}
|
}
|
||||||
|
|
||||||
Global.StickyXORAdapter.SetFloat(YName, (int)YNumeric.Value);
|
Global.StickyXORAdapter.SetFloat(YName, (int)((float)YNumeric.Value * MultiplierY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,8 +267,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
_isDragging = false;
|
_isDragging = false;
|
||||||
_isProgrammicallyChangingNumerics = false;
|
_isProgrammicallyChangingNumerics = false;
|
||||||
Global.StickyXORAdapter.SetSticky(XName, false);
|
Global.StickyXORAdapter.Unset(XName);
|
||||||
Global.StickyXORAdapter.SetSticky(YName, false);
|
Global.StickyXORAdapter.Unset(YName);
|
||||||
TargetPanel.Refresh();
|
TargetPanel.Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,8 +219,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
DisplayName = "Light Gun",
|
DisplayName = "Light Gun",
|
||||||
IsConsole = false,
|
IsConsole = false,
|
||||||
DefaultSize = new Size(356, 260),
|
DefaultSize = new Size(356, 300),
|
||||||
MaxSize = new Size(356, 260),
|
|
||||||
Buttons = new[]
|
Buttons = new[]
|
||||||
{
|
{
|
||||||
new PadSchema.ButtonScema
|
new PadSchema.ButtonScema
|
||||||
|
@ -228,7 +227,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Name = "P" + controller + " Lightgun X",
|
Name = "P" + controller + " Lightgun X",
|
||||||
Location = new Point(14, 17),
|
Location = new Point(14, 17),
|
||||||
Type = PadSchema.PadInputType.TargetedPair,
|
Type = PadSchema.PadInputType.TargetedPair,
|
||||||
TargetSize = new Size(256, 240),
|
MaxValue = 10000,
|
||||||
|
TargetSize = new Size(320, 270),
|
||||||
SecondaryNames = new []
|
SecondaryNames = new []
|
||||||
{
|
{
|
||||||
"P" + controller + " Lightgun Y",
|
"P" + controller + " Lightgun Y",
|
||||||
|
|
Loading…
Reference in New Issue