Virtual Pad - some analog stick tweaks
This commit is contained in:
parent
7fa551708f
commit
7e8f0f74bc
|
@ -120,7 +120,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Global.MovieSession.Movie.IsPlaying && !Global.MovieSession.Movie.IsFinished)
|
if (Global.MovieSession.Movie.IsPlaying && !Global.MovieSession.Movie.IsFinished && Global.Emulator.Frame > 0)
|
||||||
{
|
{
|
||||||
Pads.ForEach(p => p.Set(Global.MovieSession.CurrentInput));
|
Pads.ForEach(p => p.Set(Global.MovieSession.CurrentInput));
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using BizHawk.Client.Common;
|
using BizHawk.Client.Common;
|
||||||
|
using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
namespace BizHawk.Client.EmuHawk
|
namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
|
@ -61,10 +62,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
SetStyle(ControlStyles.Opaque, true);
|
SetStyle(ControlStyles.Opaque, true);
|
||||||
BackColor = Color.Gray;
|
BackColor = Color.Gray;
|
||||||
Paint += AnalogControlPanel_Paint;
|
Paint += AnalogControlPanel_Paint;
|
||||||
new Pen(_whiteBrush);
|
|
||||||
_blackPen = new Pen(_blackBrush);
|
_blackPen = new Pen(_blackBrush);
|
||||||
new Pen(_grayBrush);
|
|
||||||
new Pen(_redBrush);
|
|
||||||
_bluePen = new Pen(_blueBrush);
|
_bluePen = new Pen(_blueBrush);
|
||||||
BorderStyle = BorderStyle.Fixed3D;
|
BorderStyle = BorderStyle.Fixed3D;
|
||||||
|
|
||||||
|
@ -133,9 +131,10 @@ namespace BizHawk.Client.EmuHawk
|
||||||
e.Graphics.DrawLine(_blackPen, 0, 63, 127, 63);
|
e.Graphics.DrawLine(_blackPen, 0, 63, 127, 63);
|
||||||
|
|
||||||
if (Global.MovieSession != null && Global.MovieSession.Movie != null && // For the desinger
|
if (Global.MovieSession != null && Global.MovieSession.Movie != null && // For the desinger
|
||||||
Global.MovieSession.Movie.IsPlaying && !Global.MovieSession.Movie.IsFinished)
|
Global.MovieSession.Movie.IsPlaying && !Global.MovieSession.Movie.IsFinished &&
|
||||||
|
Global.Emulator.Frame > 1)
|
||||||
{
|
{
|
||||||
var input = Global.MovieSession.Movie.GetInputState(Global.Emulator.Frame - 1);
|
var input = Global.MovieSession.Movie.GetInputState(Global.Emulator.Frame - 2);
|
||||||
|
|
||||||
var x = input.GetFloat(XName);
|
var x = input.GetFloat(XName);
|
||||||
var y = input.GetFloat(YName);
|
var y = input.GetFloat(YName);
|
||||||
|
@ -180,7 +179,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Capture = false;
|
Capture = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected override void WndProc(ref Message m)
|
protected override void WndProc(ref Message m)
|
||||||
{
|
{
|
||||||
if (m.Msg == 0x007B) //WM_CONTEXTMENU
|
if (m.Msg == 0x007B) //WM_CONTEXTMENU
|
||||||
|
@ -216,6 +214,17 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Set(IController controller)
|
||||||
|
{
|
||||||
|
var newX = (int)controller.GetFloat(XName);
|
||||||
|
var newY = (int)controller.GetFloat(YName);
|
||||||
|
var changed = newX != X || newY != Y;
|
||||||
|
if (changed)
|
||||||
|
{
|
||||||
|
SetPosition(newX, newY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void SetPosition(int xval, int yval)
|
public void SetPosition(int xval, int yval)
|
||||||
{
|
{
|
||||||
X = xval;
|
X = xval;
|
||||||
|
|
|
@ -23,13 +23,16 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private void VirtualPadAnalogStick_Load(object sender, EventArgs e)
|
private void VirtualPadAnalogStick_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
AnalogStick.Name = Name;
|
AnalogStick.Name = Name;
|
||||||
AnalogStick.Name = Name.Replace("X", "Y"); // TODO: allow schema to dictate this but this is a convenient default
|
AnalogStick.XName = Name;
|
||||||
|
AnalogStick.YName = Name.Replace("X", "Y"); // TODO: allow schema to dictate this but this is a convenient default
|
||||||
MaxXNumeric.Value = 127;
|
MaxXNumeric.Value = 127;
|
||||||
MaxYNumeric.Value = 127; // Note: these trigger change events that change the analog stick too
|
MaxYNumeric.Value = 127; // Note: these trigger change events that change the analog stick too
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Set(IController controller)
|
public void Set(IController controller)
|
||||||
{
|
{
|
||||||
|
AnalogStick.Set(controller);
|
||||||
|
SetNumericsFromAnalog();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
|
|
Loading…
Reference in New Issue