public static void Invert(OutAxis outputAxis) { for (int v = 0; v < SuperVJoy.MAX_RANGE; v++) { SuperVJoy.outputCurves[outputAxis.ToString()][v] = SuperVJoy.MAX_RANGE - SuperVJoy.outputCurves[outputAxis.ToString()][v]; } }
private void comboBoxSimulateOutput_SelectedIndexChanged(object sender, EventArgs e) { simulationThread.Abort(); if (comboBoxSimulateOutput.SelectedIndex > 0) { SuperVJoy.disable = true; OutAxis axisidx = (OutAxis)comboBoxSimulateOutput.SelectedIndex; int idx = comboBoxSimulateOutput.SelectedIndex; simulationThread = new Thread(() => { try { SimulateJoyOutputAxis(axisidx); } catch { vjoy.setAxisPerc(50, idx); vjoy.applyValues(); Console.WriteLine("End!!!"); } }); simulationThread.Start(); } else { SuperVJoy.disable = false; } }
public static void SetSymetrical(OutAxis outputAxis) { for (int v = 0; v < SuperVJoy.MID_RANGE - 1; v++) { SuperVJoy.outputCurves[outputAxis.ToString()][v] = SuperVJoy.MAX_RANGE - 1 - SuperVJoy.outputCurves[outputAxis.ToString()][SuperVJoy.MAX_RANGE - 1 - v]; } }
public static void SetValue(OutAxis outputAxis, double percX1, double percX2, double value) { for (int v = ValOfPerc(percX1); v < ValOfPerc(percX2); v++) { SuperVJoy.outputCurves[outputAxis.ToString()][v] = ValOfPerc(value); } }
public static void SetLinears(OutAxis outputAxis, double[] percsX, double[] percsY) { for (int i = 0; i < percsX.Length - 1; ++i) { SetLinear(outputAxis, percsX[i], percsY[i], percsX[i + 1], percsY[i + 1]); } }
public static void JiggleOutput(OutAxis axis, int withValue) { if (jiggleIndex > 1000) { SetOutputValue(axis, withValue); } }
public static void JiggleOutput(OutAxis axis) { if (jiggleIndex > 1000) { SetOutputValue(axis, MID_RANGE); } }
public static void SetOutputValue(OutAxis axis, string hardwareInputCode) { hardwareInputCode = UnaliasCode(hardwareInputCode); int value = SuperVJoy.GetInputValue(hardwareInputCode); SetOutputValue(axis, value); }
public static void SetOutputValueOnHardwareInputChange(OutAxis axis, string hardwareInputCode) { hardwareInputCode = UnaliasCode(hardwareInputCode); if (SuperVJoy.inputValueUpdate.ContainsKey(hardwareInputCode)) { SetOutputValue(axis, hardwareInputCode); } }
public static void SetLinear(OutAxis outputAxis, double percX1, double percY1, double percX2, double percY2) { double coef = (percY2 - percY1) / (percX2 - percX1); for (int v = ValOfPerc(percX1); v < ValOfPerc(percX2); v++) { SuperVJoy.outputCurves[outputAxis.ToString()][v] = (int)(ValOfPerc(percY1) + coef * (v - ValOfPerc(percX1))); } }
// Config tools public static void SimulateJoyOutputAxis(OutAxis axis) { Console.WriteLine("SimulateJoyOutputAxis " + axis.ToString()); while (true) { vjoy.setAxisPerc(98, (int)axis); vjoy.applyValues(); Thread.Sleep(45); vjoy.setAxisPerc(95, (int)axis); vjoy.applyValues(); Thread.Sleep(250); } }
// unused public static Bitmap generateBitmapCurve(OutAxis axis) { Bitmap img = new Bitmap(SuperVJoy.MAX_RANGE / curveScale, SuperVJoy.MAX_RANGE / curveScale); Graphics g = Graphics.FromImage(img); // paint it black g.FillRectangle(new SolidBrush(Color.Black), new Rectangle(0, 0, img.Width, img.Height)); for (int i = 0; i < SuperVJoy.MAX_RANGE / curveScale; ++i) { int value = (int)(SuperVJoy.outputCurves[axis.ToString()][i * curveScale]); g.DrawRectangle(new Pen(Color.Red), new Rectangle(i, img.Height - value / curveScale, 3, 3)); } return(img); }
public static int ApplyCurve(OutAxis axis, int value) { if (value > MAX_RANGE - 1) { value = MAX_RANGE - 1; } if (value < 0) { value = 0; } if (plzOutputToDebugFrm) { debugFrmCurvedAxis[axis.ToString()] = (int)(100.0 * value / MAX_RANGE); // this is shitty } return(outputCurves[axis.ToString()][value]); }
// Setter public static void SetOutputValue(OutAxis axis, int value) { if (value > MAX_RANGE - 1) { value = MAX_RANGE - 1; } if (value < 0) { value = 0; } if (plzOutputToDebugFrm) { debugFrmCurvedAxis[axis.ToString()] = (int)(100.0 * value / MAX_RANGE); } value = SuperVJoy.ApplyCurve(axis, value); vjoy.setAxisPerc(100.0 * value / MAX_RANGE, (int)axis); }
/// wip private static void SetBezier(OutAxis outputAxis, double percX1, double percY1, double percX2, double percY2, double coefStart, double mouStart, double coefEnd, double mouEnd) { double t = 0.0, x0, y0, x1, y1, dt = 0.00001; // x1 = bezierX(t, percX1, percX2, ) }