Ejemplo n.º 1
0
        public int StartAndRegisterFFB(AFFBManager ffb)
        {
            // Start FFB
#if FFB
            if (Joystick.IsDeviceFfb(joyID))
            {
#if false // obsolete
                bool Ffbstarted = Joystick.FfbStart(joyID);
                if (!Ffbstarted)
                {
                    Console.WriteLine("Failed to start FFB on vJoy device number {0}.", joyID);
                    Console.ReadKey();
                    return(-3);
                }
                else
                {
                    Console.WriteLine("Started FFB on vJoy device number {0} - OK", joyID);
                }
#endif

                // Register Generic callback function
                // At this point you instruct the Receptor which callback function to call with every FFB packet it receives
                // It is the role of the designer to register the right FFB callback function

                // Note from me:
                // Warning: the callback is called in the context of a thread started by vJoyInterface.dll
                // when opening the joystick. This thread blocks upon a new system event from the driver.
                // It is perfectly ok to do some work in it, but do not overload it to avoid
                // loosing/desynchronizing FFB packets from the third party application.
                FFBReceiver.RegisterBaseCallback(Joystick, joyID, ffb);
            }
#endif // FFB
            return(0);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Register a FFB callback for current vJoy device ID
        /// </summary>
        /// <param name="ffb"></param>
        /// <returns></returns>
        public int StartAndRegisterFFB(FFBManager ffb)
        {
            // Start FFB
#if FFB
            if (Joystick.IsDeviceFfb(vJoyDevID))
            {
                // Register Generic callback function
                // At this point you instruct the Receptor which callback function to call with every FFB packet it receives
                // It is the role of the designer to register the right FFB callback function

                // Note from me:
                // Warning: the callback is called in the context of a thread started by vJoyInterface.dll
                // when opening the joystick. This thread blocks upon a new system event from the driver.
                // It is perfectly ok to do some work in it, but do not overload it to avoid
                // loosing/desynchronizing FFB packets from the third party application.
                FFBReceiver.RegisterBaseCallback(Joystick, vJoyDevID, ffb);
            }
#endif // FFB
            return(0);
        }