public void OnReadFile(string filename, ref byte[] inputReport)
        {
            try
            {
                Log.Verbose("InjectionInterface.OnReadFile filename " + filename);

                //if((printFrequency++)%30 == 0)
                //  PrintAnalogSticksAsDegrees(inputReport.Skip(1).Take(4).ToArray());

                // Expect inputReport to be modified
                if (Injector.Callback != null)
                {
                    Log.Verbose("InjectionInterface.OnReadFile Injector.Callback " + Injector.Callback.ToString());
                    // Parse the state
                    DualShockState state = DualShockState.ParseFromDualshockRaw(inputReport);

                    // Skip if state is invalid
                    if (state == null)
                    {
                        return;
                    }

                    // Expect it to be modified
                    Injector.Callback(ref state);

                    // Convert it back
                    state.ConvertToDualshockRaw(ref inputReport);
                }
            }
            catch (Exception ex)
            {
                ExceptionLogger.LogException("InjectionInterface.OnReadFile error", ex);
            }
        }
示例#2
0
        public void OnReadFile(string filename, ref byte[] inputReport)
        {
            try
            {
                //Console.WriteLine("OnReadFile {0}", filename);
                //if((printFrequency++)%30 == 0)
                //  PrintAnalogSticksAsDegrees(inputReport.Skip(1).Take(4).ToArray());
                // Expect inputReport to be modified
                if (Injector.Callback != null)
                {
                    // Parse the state
                    var state = DualShockState.ParseFromDualshockRaw(inputReport);

                    // Skip if state is invalid
                    if (state == null)
                    {
                        return;
                    }

                    // Expect it to be modified
                    Injector.Callback(ref state);

                    // Convert it back
                    state.ConvertToDualshockRaw(ref inputReport);
                }
            }
            catch (Exception ex)
            {
                Log.Logger.Error("Problem in OnReadFile: " + ex.Message);
            }
        }
示例#3
0
        public void OnReadFile(string filename, ref byte[] inputReport)
        {
            try
            {
                //Console.WriteLine("OnReadFile {0}", filename);

                // Expect inputReport to be modified
                if (Interceptor.Callback != null)
                {
                    // Parse the state
                    var state = DualShockState.ParseFromDualshockRaw(inputReport);

                    // Skip if state is invalid
                    if (state == null)
                    {
                        return;
                    }

                    // Expect it to be modified
                    Interceptor.Callback(ref state);

                    // Convert it back
                    state.ConvertToDualshockRaw(ref inputReport);
                }
            }
            catch (Exception) { }
        }