Example #1
0
 public ButtplugGameVibrationRouterPayload(
     RemoteHooking.IContext aInContext,
     String aInChannelName)
 {
     _interface = RemoteHooking.IpcConnectClient <ButtplugGameVibrationRouterInterface>(aInChannelName);
     _instance  = this;
 }
Example #2
0
        private static uint XInputSetStateHookFunc(int aGamePadIndex, ref Vibration aVibrationRef)
        {
            try
            {
                // Always send to the controller first, then do what we need to.
                XInputSetStateShim(aGamePadIndex, aVibrationRef);

                ButtplugGameVibrationRouterPayload This = _instance;
                // No reason to send duplicate packets.
                if (This._lastMessage.LeftMotorSpeed == aVibrationRef.LeftMotorSpeed &&
                    This._lastMessage.RightMotorSpeed == aVibrationRef.RightMotorSpeed)
                {
                    return(0);
                }
                This._lastMessage = new Vibration {
                    LeftMotorSpeed  = aVibrationRef.LeftMotorSpeed,
                    RightMotorSpeed = aVibrationRef.RightMotorSpeed
                };

                lock (This._messageQueue)
                {
                    This._messageQueue.Enqueue(This._lastMessage);
                }
            }
            catch (Exception e)
            {
                _ex = e;
            }

            return(0);
        }