Beispiel #1
0
 public void Disconnect()
 {
     if (this.Connected)
     {
         if (this.SupportedFFBEffects.Count > 0)
         {
             this.joystick.FfbRegisterGenCB(null, null);
             this.ffbPacketHandler = new VirtualFFBPacketHandler(this.joystick);
         }
         this.joystick.RelinquishVJD(this.ID);
         this.Connected = false;
     }
 }
Beispiel #2
0
        public MainForm()
        {
            InitializeComponent();
            PublicHandle = Handle;

            logger.Info($"Loading joymapper version: {Assembly.GetExecutingAssembly().GetName().Version.ToString()}");

            VirtualFFBPacketHandler.Init();
            this.loadControllers();

            this.dataGridView1.DataSource = data;
            this.dataGridView2.DataSource = data2;

            ControllerCache.vc.FFBDataReceived += this.callb_kek;

            //ControllerCache.vc.FFBDataReceived += this.callb1;
            //ControllerCache.vc2.FFBDataReceived += this.callb2;
        }
Beispiel #3
0
 private void DoWork(object data)
 {
     conrts = data as IEnumerable <IController>;
     try {
         logger.Info("Connecting to controllers");
         foreach (IController gc in conrts)
         {
             gc.Connect();
         }
         VirtualFFBPacketHandler.RunFFBThread();
         ControllerCache.vc.Connect();
         ControllerCache.vc2.Connect();
         logger.Info("Connecting to vjoy");
         //evt.WaitOne();
         State ins = new State(ControllerCache.vc, ControllerCache.vc.ButtonCount);
         while (true)
         {
             foreach (IController gc in conrts)
             {
                 gc.FillExternalInfo(ref ins);
             }
             ControllerCache.vc.UpdateInfo(ins);
             // ControllerCache.vc2.UpdateInfo(ins);
             Thread.Sleep(20);
         }
     } catch (ThreadAbortException) {
         logger.Info("Stopping thread on threadabord");
     } catch (Exception ex) {
         logger.Error($"SHIT SHIT {ex}");
     } finally {
         foreach (IController gc in conrts)
         {
             gc.Disconnect();
         }
         ControllerCache.vc.Disconnect();
         VirtualFFBPacketHandler.StopFFBThread();
         ControllerCache.vc2.Disconnect();
         logger.Info("Disconnected from controllers");
     }
 }