private void Listen()
        {
            Log.Information("VigemInternals.Listen");
            SleepTimer.Start();
            RequestsPerSecondTimer.Start();

            GamepadProcessor gp = new GamepadProcessor();

            Task.Factory.StartNew(() =>
            {
                controller.ResetReport();

                while (true)
                {
                    try
                    {
                        PS4RemotePlayInterceptor.DualShockState x = gp.GetState();
                        if (x != null)
                        {
                            //Log.Information("ds" + gp.DualShockStateToString(ref x));
                            GamepadConverter.ConvertandSendReport(controller, x);
                        }
                    }
                    catch (Exception ex)
                    {
                        ExceptionLogger.LogException("VigemInternals.Listen L57", ex);
                    }

                    Sleep();
                }
            });
        }
Exemplo n.º 2
0
        public static string SerializeInterceptorState(PS4RemotePlayInterceptor.DualShockState state)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(PS4RemotePlayInterceptor.DualShockState));
            var           sb         = new StringBuilder();

            using (StringWriter writer = new StringWriter(sb))
            {
                serializer.Serialize(writer, state);
                return(sb.ToString());
            }
        }
Exemplo n.º 3
0
        public void OnReceiveData(ref PS4RemotePlayInterceptor.DualShockState state)
        {
            if (MacroPlayer.IsPlaying)
            {
                MacroPlayer.OnReceiveData(ref state);
            }
            else if (Script.CurrentState != null)
            {
                state = ScriptHostUtility.ConvertAPIToInterceptorState(Script.CurrentState);
                state.ReportTimeStamp = DateTime.Now;

                // Replace battery status
                state.Battery    = 100;
                state.IsCharging = true;
            }
        }
Exemplo n.º 4
0
        public static PS4MacroAPI.DualShockState ConvertInterceptorToAPIState(PS4RemotePlayInterceptor.DualShockState state)
        {
            var serialized = SerializeInterceptorState(state);

            return(DeserializeAPIState(serialized));
        }