public static ChPedalsController Create( EliteSharedState sharedState, vJoyInterfaceWrap.vJoy vjoy, EliteVirtualJoysticks virtualJoysticks, vJoyMapper vJoyMapper) { return(new ChPedalsController() { Controller = Faz.SideWinderSC.Logic.CHPedalsController.RetrieveAll()?.First(), SharedState = sharedState, //vJoy = vjoy, VirtualJoysticks = virtualJoysticks, vJoyMapper = vJoyMapper, }); }
public static ChPedalsController Create(EliteSharedState sharedState, vJoyInterfaceWrap.vJoy vjoy, vJoyMapper vJoyMapper) { return(new ChPedalsController() { Controller = Faz.SideWinderSC.Logic.CHPedalsController.RetrieveAll()?.First(), SharedState = sharedState, vJoy = vjoy, vJoyMapper = vJoyMapper, VisualState = new VisualState { Name = Name } }); }
public Joystick() { m_Interface = new vJoyInterfaceWrap.vJoy(); try { if (m_Interface.AcquireVJD(1)) { } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
protected virtual void Dispose(bool disposing) { if (disposed) { return; } if (disposing) { for (uint devId = 0; devId < 16; devId++) { _vJoyDevices[devId].Dispose(); } _vJoyDevices = null; vJ = null; } disposed = true; Log("Provider {0} was Disposed", ProviderName); }
public Vcontroller(uint vJoyNumber, int updateRate = 20) { _vJoyNumber = vJoyNumber; Vjoy = new vJoyInterfaceWrap.vJoy(); JoystickState = new vJoyInterfaceWrap.vJoy.JoystickState(); VjdStat status = Vjoy.GetVJDStatus(_vJoyNumber); if (status == VjdStat.VJD_STAT_OWN || status == VjdStat.VJD_STAT_FREE) { Vjoy.AcquireVJD(_vJoyNumber); } else { throw (new Exception("Could not acquire Vjoy")); } Vjoy.ResetVJD(_vJoyNumber); _buttonCount = Vjoy.GetVJDButtonNumber(_vJoyNumber); _initButtons(); _initDiscPovs(); _initAxes(); _initJoystickState(); UpdateRate = updateRate; }
private void PFPanel_Load(object sender, EventArgs e) { AppSettings.Instance.Reload( ); // Assign Size property - check if on screen, else use defaults if (IsOnScreen(new Rectangle(AppSettings.Instance.FormLocation, this.Size))) { this.Location = AppSettings.Instance.FormLocation; } string version = Application.ProductVersion; // get the version information // BETA VERSION; TODO - comment out if not longer //lblTitle.Text += " - V " + version.Substring( 0, version.IndexOf( ".", version.IndexOf( "." ) + 1 ) ); // PRODUCTION lblVersion.Text = "Version: " + version + " beta"; // BETA string s = AppSettings.Instance.ConfigFile; if (!string.IsNullOrEmpty(s) && File.Exists(s)) { txConfigFile.Text = s; } btStopService.Enabled = false; // vJoy DLL cbxJoystick.Items.Clear( ); lblVJoy.Text = "not available"; if (vJoyInterfaceWrap.vJoy.isDllLoaded) { var tvJoy = new vJoyInterfaceWrap.vJoy( ); for (uint i = 1; i <= 16; i++) { if (tvJoy.isVJDExists(i)) { cbxJoystick.Items.Add($"Joystick#{i}"); } } if (cbxJoystick.Items.Count > 0) { cbxJoystick.SelectedIndex = 0; // select the one in AppSettings string[] js = AppSettings.Instance.JoystickUsed.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); // a list for (int i = 0; i < js.Length; i++) { var idx = cbxJoystick.Items.IndexOf(js[i]); if (idx >= 0) { cbxJoystick.SetItemChecked(idx, true); } } } lblVJoy.Text = $"loaded - {cbxJoystick.Items.Count:#} device(s)"; tvJoy = null; } // Kbd DLL if (SCdxKeyboard.isDllLoaded) { lblSCdx.Text = "loaded"; cbxKBon.Enabled = true; cbxKBon.Checked = AppSettings.Instance.UseKeyboard; } else { lblSCdx.Text = "not available"; cbxKBon.Checked = false; cbxKBon.Enabled = false; } }
public MainForm() { InitializeComponent(); base.Disposed += OnDisposed; try { m_Interface = new vJoyInterfaceWrap.vJoy(); // Get the driver attributes (Vendor ID, Product ID, Version Number) if (!m_Interface.vJoyEnabled()) { Console.WriteLine("vJoy driver not enabled: Failed Getting vJoy attributes.\n"); return; } else { Console.WriteLine("v{0}\nVendor: {1}\nProduct :{2}\nVersion Number:{3}\n", m_Interface.GetvJoyVersion(), m_Interface.GetvJoyManufacturerString(), m_Interface.GetvJoyProductString(), m_Interface.GetvJoySerialNumberString()); } // Check which axes are supported bool AxisX = m_Interface.GetVJDAxisExist(m_Id, HID_USAGES.HID_USAGE_X); bool AxisY = m_Interface.GetVJDAxisExist(m_Id, HID_USAGES.HID_USAGE_Y); bool AxisZ = m_Interface.GetVJDAxisExist(m_Id, HID_USAGES.HID_USAGE_Z); bool AxisRX = m_Interface.GetVJDAxisExist(m_Id, HID_USAGES.HID_USAGE_RX); bool AxisRZ = m_Interface.GetVJDAxisExist(m_Id, HID_USAGES.HID_USAGE_RZ); // Get the number of buttons and POV Hat switchessupported by this vJoy device int nButtons = m_Interface.GetVJDButtonNumber(m_Id); int ContPovNumber = m_Interface.GetVJDContPovNumber(m_Id); int DiscPovNumber = m_Interface.GetVJDDiscPovNumber(m_Id); // Spit out the details Console.WriteLine(string.Format("Device[{0}]: Buttons={1}; DiscPOVs:{2}; ContPOVs:{3}", m_Id, nButtons, ContPovNumber, DiscPovNumber)); // Write access to vJoy Device - Basic VjdStat status = m_Interface.GetVJDStatus(m_Id); // Acquire the target if ((status == VjdStat.VJD_STAT_OWN) || ((status == VjdStat.VJD_STAT_FREE) && (!m_Interface.AcquireVJD(m_Id)))) { Console.WriteLine(string.Format("Failed to acquire vJoy device number {0}.", m_Id)); } else { Console.WriteLine(string.Format("Acquired: vJoy device number {0}.", m_Id)); m_Interface.ResetAll(); } } catch (Exception ex) { Console.WriteLine(ex.Message); } m_Timer.Tick += OnTick; m_Timer.Interval = 2000; m_Timer.Start(); }
public ButtonBase(SDConnection connection, InitialPayload payload) : base(connection, payload) { joystick = new vJoyInterfaceWrap.vJoy(); axisValues = new Dictionary <HID_USAGES, int>(); }