mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-02-19 17:32:41 +01:00
Altered controller readings to better represent mapped state
Related to issue #587.
This commit is contained in:
parent
72802bb5c6
commit
ef01b4d3b3
@ -1352,6 +1352,11 @@ namespace DS4Windows
|
|||||||
public DS4State getDS4StateMapped(int ind)
|
public DS4State getDS4StateMapped(int ind)
|
||||||
{
|
{
|
||||||
return MappedState[ind];
|
return MappedState[ind];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DS4State getDS4StateTemp(int ind)
|
||||||
|
{
|
||||||
|
return TempState[ind];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -954,6 +954,7 @@ namespace DS4Windows
|
|||||||
|
|
||||||
DS4StateExposed exposeState = Program.rootHub.ExposedState[tempDeviceNum];
|
DS4StateExposed exposeState = Program.rootHub.ExposedState[tempDeviceNum];
|
||||||
DS4State baseState = Program.rootHub.getDS4State(tempDeviceNum);
|
DS4State baseState = Program.rootHub.getDS4State(tempDeviceNum);
|
||||||
|
DS4State interState = Program.rootHub.getDS4StateTemp(tempDeviceNum);
|
||||||
|
|
||||||
SetDynamicTrackBarValue(tBsixaxisGyroX, (exposeState.getGyroYaw() + tBsixaxisGyroX.Value * 2) / 3);
|
SetDynamicTrackBarValue(tBsixaxisGyroX, (exposeState.getGyroYaw() + tBsixaxisGyroX.Value * 2) / 3);
|
||||||
SetDynamicTrackBarValue(tBsixaxisGyroY, (exposeState.getGyroPitch() + tBsixaxisGyroY.Value * 2) / 3);
|
SetDynamicTrackBarValue(tBsixaxisGyroY, (exposeState.getGyroPitch() + tBsixaxisGyroY.Value * 2) / 3);
|
||||||
@ -965,137 +966,75 @@ namespace DS4Windows
|
|||||||
int x = baseState.LX;
|
int x = baseState.LX;
|
||||||
int y = baseState.LY;
|
int y = baseState.LY;
|
||||||
|
|
||||||
double tempLSS = (double)nUDLSS.Value;
|
btnLSTrack.Location = new Point((int)(dpix * x / 2.09),
|
||||||
btnLSTrackS.Visible = tempLSS != 1;
|
(int)(dpiy * y / 2.09));
|
||||||
double tempLSCurve = (double)nUDLSCurve.Value;
|
bool mappedLS = interState.LX != x || interState.LY != y;
|
||||||
if (tempLSCurve > 0.0)
|
btnLSTrackS.Visible = mappedLS;
|
||||||
{
|
|
||||||
float max = x + y;
|
|
||||||
double curvex;
|
|
||||||
double curvey;
|
|
||||||
double multimax = TValue(382.5, max, tempLSCurve);
|
|
||||||
double multimin = TValue(127.5, max, tempLSCurve);
|
|
||||||
if ((x > 127.5f && y > 127.5f) || (x < 127.5f && y < 127.5f))
|
|
||||||
{
|
|
||||||
curvex = (x > 127.5f ? Math.Min(x, (x / max) * multimax) : Math.Max(x, (x / max) * multimin));
|
|
||||||
curvey = (y > 127.5f ? Math.Min(y, (y / max) * multimax) : Math.Max(y, (y / max) * multimin));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (x < 127.5f)
|
|
||||||
{
|
|
||||||
curvex = Math.Min(x, (x / max) * multimax);
|
|
||||||
curvey = Math.Min(y, (-(y / max) * multimax + 510));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
curvex = Math.Min(x, (-(x / max) * multimax + 510));
|
|
||||||
curvey = Math.Min(y, (y / max) * multimax);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
btnLSTrack.Location = new Point((int)(dpix * curvex / 2.09), (int)(dpiy * curvey / 2.09));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
btnLSTrack.Location = new Point((int)(dpix * x / 2.09), (int)(dpiy * y / 2.09));
|
|
||||||
btnLSTrackS.Visible = tempLSS != 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tempLSS != 1)
|
if (mappedLS)
|
||||||
{
|
{
|
||||||
btnLSTrackS.Location = new Point((int)(tempLSS * (btnLSTrack.Location.X - pnlLSTrack.Size.Width / 2f) + pnlLSTrack.Size.Width / 2f),
|
btnLSTrackS.Location = new Point((int)(dpix * interState.LX / 2.09), (int)(dpiy * interState.LY / 2.09));
|
||||||
(int)(tempLSS * (btnLSTrack.Location.Y - pnlLSTrack.Size.Height / 2f) + pnlLSTrack.Size.Height / 2f));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
x = baseState.RX;
|
x = baseState.RX;
|
||||||
y = baseState.RY;
|
y = baseState.RY;
|
||||||
|
|
||||||
double tempRSS = (double)nUDRSS.Value;
|
bool mappedRS = interState.RX != x || interState.RY != y;
|
||||||
btnRSTrackS.Visible = tempRSS != 1;
|
btnRSTrackS.Visible = mappedRS;
|
||||||
double tempRSCurve = (double)nUDRSCurve.Value;
|
|
||||||
if (tempRSCurve > 0.0)
|
btnRSTrack.Location = new Point((int)(dpix * x / 2.09), (int)(dpiy * y / 2.09));
|
||||||
|
|
||||||
|
if (mappedRS)
|
||||||
{
|
{
|
||||||
float max = x + y;
|
btnRSTrackS.Location = new Point((int)(dpix * interState.RX / 2.09), (int)(dpiy * interState.RY / 2.09));
|
||||||
double curvex;
|
|
||||||
double curvey;
|
|
||||||
double multimax = TValue(382.5, max, tempRSCurve);
|
|
||||||
double multimin = TValue(127.5, max, tempRSCurve);
|
|
||||||
if ((x > 127.5f && y > 127.5f) || (x < 127.5f && y < 127.5f))
|
|
||||||
{
|
|
||||||
curvex = (x > 127.5f ? Math.Min(x, (x / max) * multimax) : Math.Max(x, (x / max) * multimin));
|
|
||||||
curvey = (y > 127.5f ? Math.Min(y, (y / max) * multimax) : Math.Max(y, (y / max) * multimin));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (x < 127.5f)
|
|
||||||
{
|
|
||||||
curvex = Math.Min(x, (x / max) * multimax);
|
|
||||||
curvey = Math.Min(y, (-(y / max) * multimax + 510));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
curvex = Math.Min(x, (-(x / max) * multimax + 510));
|
|
||||||
curvey = Math.Min(y, (y / max) * multimax);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
btnRSTrack.Location = new Point((int)(dpix * curvex / 2.09), (int)(dpiy * curvey / 2.09));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
btnRSTrack.Location = new Point((int)(dpix * x / 2.09), (int)(dpiy * y / 2.09));
|
|
||||||
btnRSTrackS.Visible = tempRSS != 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tempRSS != 1)
|
|
||||||
{
|
|
||||||
btnRSTrackS.Location = new Point((int)(tempRSS * (btnRSTrack.Location.X - pnlRSTrack.Size.Width / 2f) + pnlRSTrack.Size.Width / 2f),
|
|
||||||
(int)(tempRSS * (btnRSTrack.Location.Y - pnlRSTrack.Size.Height / 2f) + pnlRSTrack.Size.Height / 2f));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
x = exposeState.getAccelX() + 127;
|
x = exposeState.getAccelX() + 127;
|
||||||
y = exposeState.getAccelZ() + 127;
|
y = exposeState.getAccelZ() + 127;
|
||||||
btnSATrack.Location = new Point((int)(dpix * Global.Clamp(0, x / 2.09, pnlSATrack.Size.Width)), (int)(dpiy * Global.Clamp(0, y / 2.09, pnlSATrack.Size.Height)));
|
btnSATrack.Location = new Point((int)(dpix * Global.Clamp(0, x / 2.09, pnlSATrack.Size.Width)),
|
||||||
|
(int)(dpiy * Global.Clamp(0, y / 2.09, pnlSATrack.Size.Height)));
|
||||||
|
|
||||||
double tempSXS = (double)nUDSXS.Value;
|
bool mappedSix = interState.Motion.accelX != 0 || interState.Motion.accelZ != 0;
|
||||||
double tempSZS = (double)nUDSZS.Value;
|
btnSATrackS.Visible = mappedSix;
|
||||||
btnSATrackS.Visible = tempSXS != 1 || tempSZS != 1;
|
if (mappedSix)
|
||||||
if (tempSXS != 1 || tempSZS != 1)
|
|
||||||
{
|
{
|
||||||
btnSATrackS.Location = new Point((int)(tempSXS * (btnSATrack.Location.X - pnlSATrack.Size.Width / 2f) + pnlSATrack.Size.Width / 2f),
|
btnSATrackS.Location = new Point((int)(dpix * Global.Clamp(0, (interState.Motion.accelX + 127) / 2.09, pnlSATrack.Size.Width)),
|
||||||
(int)(tempSZS * (btnSATrack.Location.Y - pnlSATrack.Size.Height / 2f) + pnlSATrack.Size.Height / 2f));
|
(int)(dpiy * Global.Clamp(0, (interState.Motion.accelZ + 127) / 2.09, pnlSATrack.Size.Height)));
|
||||||
}
|
}
|
||||||
|
|
||||||
double tempL2 = (double)nUDL2.Value;
|
|
||||||
double tempL2S = (double)nUDL2S.Value;
|
|
||||||
tBL2.Value = baseState.L2;
|
tBL2.Value = baseState.L2;
|
||||||
lbL2Track.Location = new Point(tBL2.Location.X - (int)(dpix * 25),
|
lbL2Track.Location = new Point(tBL2.Location.X - (int)(dpix * 25),
|
||||||
Math.Max((int)(((tBL2.Location.Y + tBL2.Size.Height) - (tBL2.Value * tempL2S) / (tBL2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20),
|
(int)(tBL2.Location.Y + tBL2.Size.Height - interState.L2 / (tBL2.Size.Height * .0209f / Math.Pow(dpix, 2.0)) - (dpix * 20)));
|
||||||
(int)(1 * ((tBL2.Location.Y + tBL2.Size.Height) - 255 / (tBL2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20)));
|
|
||||||
|
|
||||||
if (tBL2.Value * tempL2S >= 255)
|
//lbL2Track.Location = new Point(tBL2.Location.X - (int)(dpix * 25),
|
||||||
|
// Math.Max((int)(((tBL2.Location.Y + tBL2.Size.Height) - (tBL2.Value * tempL2S) / (tBL2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20),
|
||||||
|
// (int)(1 * ((tBL2.Location.Y + tBL2.Size.Height) - 255 / (tBL2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20)));
|
||||||
|
|
||||||
|
if (interState.L2 >= 255)
|
||||||
lbL2Track.ForeColor = Color.Green;
|
lbL2Track.ForeColor = Color.Green;
|
||||||
else if (tBL2.Value * tempL2S < tempL2 * 255)
|
else if (interState.L2 == 0)
|
||||||
lbL2Track.ForeColor = Color.Red;
|
lbL2Track.ForeColor = Color.Red;
|
||||||
else
|
else
|
||||||
lbL2Track.ForeColor = Color.Black;
|
lbL2Track.ForeColor = Color.Black;
|
||||||
|
|
||||||
double tempR2 = (double)nUDR2.Value;
|
|
||||||
double tempR2S = (double)nUDR2S.Value;
|
|
||||||
tBR2.Value = baseState.R2;
|
tBR2.Value = baseState.R2;
|
||||||
lbR2Track.Location = new Point(tBR2.Location.X + (int)(dpix * 25),
|
lbR2Track.Location = new Point(tBR2.Location.X + (int)(dpix * 25),
|
||||||
Math.Max((int)(1 * ((tBR2.Location.Y + tBR2.Size.Height) - (tBR2.Value * tempR2S) / (tBR2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20),
|
(int)(tBR2.Location.Y + tBR2.Size.Height - interState.R2 / (tBR2.Size.Height * .0209f / Math.Pow(dpix, 2.0)) - (dpix * 20)));
|
||||||
(int)(1 * ((tBR2.Location.Y + tBR2.Size.Height) - 255 / (tBR2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20)));
|
//lbR2Track.Location = new Point(tBR2.Location.X + (int)(dpix * 25),
|
||||||
|
// Math.Max((int)(1 * ((tBR2.Location.Y + tBR2.Size.Height) - (tBR2.Value * tempR2S) / (tBR2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20),
|
||||||
|
// (int)(1 * ((tBR2.Location.Y + tBR2.Size.Height) - 255 / (tBR2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20)));
|
||||||
|
|
||||||
if (tBR2.Value * tempR2S >= 255)
|
if (interState.R2 >= 255)
|
||||||
lbR2Track.ForeColor = Color.Green;
|
lbR2Track.ForeColor = Color.Green;
|
||||||
else if (tBR2.Value * tempR2S < tempR2 * 255)
|
else if (interState.R2 == 0)
|
||||||
lbR2Track.ForeColor = Color.Red;
|
lbR2Track.ForeColor = Color.Red;
|
||||||
else
|
else
|
||||||
lbR2Track.ForeColor = Color.Black;
|
lbR2Track.ForeColor = Color.Black;
|
||||||
|
|
||||||
double latency = ds.Latency;
|
double latency = ds.Latency;
|
||||||
int warnInterval = ds.getWarnInterval();
|
int warnInterval = ds.getWarnInterval();
|
||||||
lbInputDelay.Text = Properties.Resources.InputDelay.Replace("*number*", latency.ToString());
|
lbInputDelay.Text = Properties.Resources.InputDelay.Replace("*number*",
|
||||||
|
latency.ToString());
|
||||||
if (latency > warnInterval)
|
if (latency > warnInterval)
|
||||||
{
|
{
|
||||||
lbInputDelay.BackColor = Color.Red;
|
lbInputDelay.BackColor = Color.Red;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user