Ejemplo n.º 1
0
 private bool EffectDispose(VirtualFFBPacket Packet, VirtualFFBEffect Effect)
 {
     if (Packet.BlockIndex == Effect.Index)
     {
         Effect.Dispose();
         Effect.Packet = Packet;
         return(true);
     }
     return(false);
 }
Ejemplo n.º 2
0
        private bool EffectPlayback(VirtualFFBPacket Packet, VirtualFFBEffect Effect)
        {
            if (Packet._FFBPType == FFBPType.PT_EFOPREP &&
                (int)Packet.FFB_EFF_OP.EffectBlockIndex == Effect.Index &&
                Effect.Status != EffectStatus.None &&
                Effect.Parameters.TriggerButton == -1)
            {
                Effect.UpdateStatus();
                switch (Packet.FFB_EFF_OP.EffectOp)
                {
                case FFBOP.EFF_START:
                    if (Effect.Status != EffectStatus.Playing)
                    {
                        Effect.LoopCount = (int)Packet.FFB_EFF_OP.LoopCount;
                        Effect.Solo      = false;
                        this.StartEffect(Effect);
                        Effect.Packet  = Packet;
                        Packet.Handled = true;
                        return(true);
                    }
                    break;

                case FFBOP.EFF_SOLO:
                    if (Effect.Status != EffectStatus.Playing)
                    {
                        for (int i = 0; i < this.Effects.Count; i++)
                        {
                            if (this.Effects[i] != Effect)
                            {
                                this.StopEffect(this.Effects[i]);
                                this.Effects[i].Packet = Packet;
                            }
                        }
                        Effect.LoopCount = (int)Packet.FFB_EFF_OP.LoopCount;
                        Effect.Solo      = true;
                        this.StartEffect(Effect);
                        Effect.Packet  = Packet;
                        Packet.Handled = true;
                        return(true);
                    }
                    break;

                case FFBOP.EFF_STOP:
                    if (Effect.Status == EffectStatus.Playing)
                    {
                        this.StopEffect(Effect);
                        Effect.Packet  = Packet;
                        Packet.Handled = true;
                        return(true);
                    }
                    break;
                }
            }
            return(false);
        }
Ejemplo n.º 3
0
 private static int EffectComparison_UpdateDateTime(VirtualFFBEffect A, VirtualFFBEffect B)
 {
     if (A.UpdateTime > B.UpdateTime)
     {
         return(1);
     }
     if (A.UpdateTime < B.UpdateTime)
     {
         return(-1);
     }
     return(0);
 }
Ejemplo n.º 4
0
        private bool CreateBaseParams(VirtualFFBPacket Packet)
        {
            if (Packet._FFBPType != FFBPType.PT_EFFREP)
            {
                return(false);
            }
            if (this.DevicePause)
            {
                return(false);
            }
            EffectParametersEx baseEffectParameters = GetBaseEffectParameters(Packet.FFB_EFF_REPORT);
            VirtualFFBEffect   vJoyFFBEffect        = new VirtualFFBEffect();

            vJoyFFBEffect.Parameters = baseEffectParameters;
            vJoyFFBEffect.Index      = Packet.BlockIndex;
            int num = 0;

            for (int i = this.Packets.Count - 1; i >= 0; i--)
            {
                TimeSpan timeSpan = vJoyFFBEffect.CreationTime - this.Packets[i].CreationTime;
                if (this.Packets[i]._FFBPType == FFBPType.PT_EFFREP || timeSpan.TotalSeconds > 5.0)
                {
                    num = i;
                    break;
                }
            }
            bool flag = false;

            //for (int j = num; j < this.Packets.Count; j++) {
            //this.UpdateEnvelopeParams(this.Packets[j], vJoyFFBEffect);
            //if (this.UpdateTypeSpecificParams(this.Packets[j], vJoyFFBEffect)) {
            //    flag = true;
            //}
            //}
            if (flag)
            {
                vJoyFFBEffect.Status = EffectStatus.Idle;
            }
            vJoyFFBEffect.Packet = Packet;
            this.Effects.Add(vJoyFFBEffect);
            Packet.Handled = true;
            return(true);
        }
Ejemplo n.º 5
0
 private void StartEffect(VirtualFFBEffect Effect)
 {
     Effect.Status     = EffectStatus.Playing;
     Effect.StartTime  = DateTime.Now;
     Effect.UpdateTime = DateTime.Now;
 }
Ejemplo n.º 6
0
 private void StopEffect(VirtualFFBEffect Effect)
 {
     Effect.Status     = EffectStatus.Stopped;
     Effect.StopTime   = DateTime.Now;
     Effect.UpdateTime = DateTime.Now;
 }