예제 #1
0
 private void importToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (var ofd = new OpenFileDialog())
     {
         ofd.Title  = "Import Preset";
         ofd.Filter = "ETGUI Pad Settings Preset File|*.etguipp|Data Files|*.dat|All Files|*.*";
         if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             using (var fs = new FileStream(ofd.FileName, FileMode.Open, FileAccess.Read))
             {
                 try
                 {
                     PadSettings ps = new PadSettings();
                     ps.Load(fs);
                     load(ps, false);
                     MessageBox.Show("Loaded Preset", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 catch (Exception ex)
                 {
                     MessageBox.Show("Could not load preset: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
         }
     }
 }
예제 #2
0
        bool?savePreset(int i)
        {
            if (!Directory.Exists(presetDir))
            {
                Directory.CreateDirectory(presetDir);
            }
            if (checkBox1.Checked)
            {
                int sz;
                if (int.TryParse(textBox1.Text, out sz) || checkBox2.Checked)
                {
                    PadSettings o = new PadSettings();
                    o.size     = (checkBox2.Checked ? (int?)null : sz);
                    o.type     = (checkBox3.Checked ? (PadType?)null : (PadType)comboBox1.SelectedIndex);
                    o.location = (checkBox4.Checked ? (PadLocation?)null : (PadLocation)comboBox2.SelectedIndex);

                    if (!checkBox3.Checked && comboBox1.SelectedIndex == (int)PadType.FixedC && f_c.HasValue)
                    {
                        o._t_fc_char = f_c.Value;
                    }
                    if (!checkBox3.Checked && comboBox1.SelectedIndex == (int)PadType.FixedS && (f_s != null))
                    {
                        o._t_fc_seq = f_s;
                    }

                    Settings = o;
                }
                else
                {
                    MessageBox.Show("Invalid Size Specified", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(null);
                }
            }
            else
            {
                Settings = null;
            }
            if (Settings == null)
            {
                if (File.Exists(presetDir + "\\" + i))
                {
                    File.Delete(presetDir + "\\" + i);
                }
                return(false);
            }
            else
            {
                using (var fs = new FileStream(presetDir + "\\" + i, FileMode.Create))
                {
                    Settings.Value.Save(fs);
                    return(true);
                }
            }
        }
예제 #3
0
 /// <summary>
 /// Insert missing pad settings and clean-up the list.
 /// </summary>
 /// <param name="list"></param>
 public void UpsertPadSettings(params PadSetting[] list)
 {
     foreach (var item in list)
     {
         // If pad setting was not found then...
         if (!PadSettings.Items.Any(x => x.PadSettingChecksum == item.PadSettingChecksum))
         {
             // Add pad setting.
             PadSettings.Add(item);
         }
     }
 }
예제 #4
0
 /// <summary>
 /// Insert missing pad settings and cleanup the list.
 /// </summary>
 /// <param name="list"></param>
 public void UpsertPadSettings(params PadSetting[] list)
 {
     foreach (var item in list)
     {
         var old = PadSettings.Items.FirstOrDefault(x => x.PadSettingChecksum == item.PadSettingChecksum);
         if (old == null)
         {
             PadSettings.Add(item);
         }
     }
     CleanupPadSettings();
 }
예제 #5
0
        /// <summary>
        /// Remove PAD settings, not attached to any device.
        /// </summary>
        void CleanupPadSettings()
        {
            // Get all settings used by PADs.
            var usedPadSettings = Settings.Items.Select(x => x.PadSettingChecksum).Distinct().ToArray();
            // Get all stored padSettings.
            var allPadSettings = PadSettings.Items.Select(x => x.PadSettingChecksum).Distinct().ToArray();
            // Wipe all pad settings not attached to devices.
            var notUsed = allPadSettings.Except(usedPadSettings);

            foreach (var nu in notUsed)
            {
                var notUsedItems = PadSettings.Items.Where(x => x.PadSettingChecksum == nu).ToArray();
                PadSettings.Remove(notUsedItems);
            }
        }
예제 #6
0
        private void exportToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (checkBox1.Checked)
            {
                int sz;
                if (int.TryParse(textBox1.Text, out sz) || checkBox2.Checked)
                {
                    PadSettings o = new PadSettings();
                    o.size     = (checkBox2.Checked ? (int?)null : sz);
                    o.type     = (checkBox3.Checked ? (PadType?)null : (PadType)comboBox1.SelectedIndex);
                    o.location = (checkBox4.Checked ? (PadLocation?)null : (PadLocation)comboBox2.SelectedIndex);

                    if (!checkBox3.Checked && comboBox1.SelectedIndex == (int)PadType.FixedC && f_c.HasValue)
                    {
                        o._t_fc_char = f_c.Value;
                    }
                    if (!checkBox3.Checked && comboBox1.SelectedIndex == (int)PadType.FixedS && (f_s != null))
                    {
                        o._t_fc_seq = f_s;
                    }

                    Settings = o;
                }
                else
                {
                    MessageBox.Show("Invalid Size Specified", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                Settings = null;
                return;
            }
            using (var sfd = new SaveFileDialog())
            {
                sfd.Title  = "Export Preset";
                sfd.Filter = "ETGUI Pad Settings Preset File|*.etguipp|Data Files|*.dat|All Files|*.*";
                if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    using (var fs = new FileStream(sfd.FileName, FileMode.Create))
                    {
                        Settings.Value.Save(fs);
                    }
                    MessageBox.Show("Saved Preset", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
예제 #7
0
 /// <summary>
 /// This method will be called during manual saving and automatically when form is closing.
 /// </summary>
 public static void SaveAll()
 {
     Properties.Settings.Default.Save();
     OptionsData.Save();
     UserSettings.Save();
     Summaries.Save();
     Programs.Save();
     UserGames.Save();
     Presets.Save();
     Layouts.Save();
     UserDevices.Save();
     UserMacros.Save();
     PadSettings.Save();
     UserInstances.Save();
     XInputMaskScanner.FileInfoCache.Save();
 }
예제 #8
0
        public void SetupVjoy(bool[] parSelectedPads, PadSettings config)
        {
            VJoyConf VJC = new VJoyConf();

            //Clear out old configs
            VJC.DeleteHidReportDescFromReg(0); //TODO, Respect DevManagement levels
            //create needed pads
            byte dpads = 0;

            if (config.dpad)
            {
                dpads = 1;
            }
            for (uint dsID = 1; dsID <= SCPConstants.MAX_XINPUT_DEVICES; dsID++)
            {
                if (parSelectedPads[dsID - 1])
                {
                    uint id = GetvjFromDS(dsID); //
                    //byte[] PadConfig = VJC.CreateHidReportDesc(config.nButtons, config.enabledAxis, dpads, 0,(byte)id,
                    //    false, new bool [] {false,false,false,false,false,false,false,false,false,false,false});
                    byte[] PadConfig = VJC.CreateHidReportDesc(config.nButtons, config.enabledAxis, dpads, 0, (byte)id,
                                                               config.ffb, //enable vibration
                                                               new bool[] {
                        true,                                              //Const
                        true,                                              //Ramp
                        true,                                              //Square Wave
                        true,                                              //Sine Wave
                        true,                                              //Tri Wave
                        true,                                              //SawUp Wave
                        true,                                              //SawDown wave
                        false,                                             //Spring
                        false,                                             //Damper
                        false,                                             //Inertia
                        false                                              //Friction
                    });
                    VJC.WriteHidReportDescToReg((int)id, PadConfig);
                }
            }
        }
예제 #9
0
        /// <summary>
        /// Remove PAD settings, not attached to any device.
        /// </summary>
        public void CleanupPadSettings()
        {
            // Get all records used by Settings.
            var usedPadSettings = UserSettings.Items.Select(x => x.PadSettingChecksum).Distinct().ToList();
            // Get all records used by Summaries.
            var usedPadSettings2 = Summaries.Items.Select(x => x.PadSettingChecksum).Distinct().ToList();
            // Get all records used by Presets.
            var usedPadSettings3 = Presets.Items.Select(x => x.PadSettingChecksum).Distinct().ToList();

            // Combine all pad settings.
            usedPadSettings.AddRange(usedPadSettings2);
            usedPadSettings.AddRange(usedPadSettings3);
            // Get all stored padSettings.
            var allPadSettings = PadSettings.Items.Select(x => x.PadSettingChecksum).Distinct().ToArray();
            // Wipe all not used pad settings.
            var notUsed = allPadSettings.Except(usedPadSettings);

            foreach (var nu in notUsed)
            {
                var notUsedItems = PadSettings.Items.Where(x => x.PadSettingChecksum == nu).ToArray();
                PadSettings.Remove(notUsedItems);
            }
        }
예제 #10
0
 void loadPreset(int i)
 {
     if (!File.Exists(presetDir + "\\" + i))
     {
         load(null, false);
     }
     else
     {
         try
         {
             using (var fs = new FileStream(presetDir + "\\" + i, FileMode.Open))
             {
                 PadSettings ps = new PadSettings();
                 ps.Load(fs);
                 load(ps, false);
             }
         }
         catch
         {
             load(null, false);
         }
     }
 }
예제 #11
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (checkBox1.Checked)
            {
                int sz;
                if (int.TryParse(textBox1.Text, out sz) || checkBox2.Checked)
                {
                    PadSettings o = new PadSettings();
                    o.size     = (checkBox2.Checked ? (int?)null : sz);
                    o.type     = (checkBox3.Checked ? (PadType?)null : (PadType)comboBox1.SelectedIndex);
                    o.location = (checkBox4.Checked ? (PadLocation?)null : (PadLocation)comboBox2.SelectedIndex);

                    if (!checkBox3.Checked && comboBox1.SelectedIndex == (int)PadType.FixedC && f_c.HasValue)
                    {
                        o._t_fc_char = f_c.Value;
                    }
                    if (!checkBox3.Checked && comboBox1.SelectedIndex == (int)PadType.FixedS && (f_s != null))
                    {
                        o._t_fc_seq = f_s;
                    }

                    Settings          = o;
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Invalid Size Specified", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                Settings          = null;
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Close();
            }
        }
예제 #12
0
        public bool Start(bool[] parSelectedPads, PadSettings config, DeviceManagement devManLevel)
        {
            //Setup vJoy
            //Perform device enable/disable based on dll version
            //EnableVJoy needs to know which version of vJoy we are running
            joystick = new vJoy();
            UInt32 DllVer = 0, DrvVer = 0;

            joystick.DriverMatch(ref DllVer, ref DrvVer);
            //MIN Version Check 1
            vJoyVersion = DllVer;
            if (vJoyVersion < vJoyConstants.MIN_VER)
            {
                Trace.WriteLine("vJoy version less than required: Aborting\n");
                Stop(parSelectedPads, devManLevel);
                return(false);
            }

            if ((devManLevel & DeviceManagement.vJoy_Config) == DeviceManagement.vJoy_Config)
            {
                EnableVJoy(false);
                SetupVjoy(parSelectedPads, config);
                vJoyInstall.RefreshvJoy(); //do it like vJConfig does (needed in 2.1.6)
                EnableVJoy(true);
            }
            else if ((devManLevel & DeviceManagement.vJoy_Device) == DeviceManagement.vJoy_Device)
            {
                EnableVJoy(true);
            }

            if (!joystick.vJoyEnabled())
            {
                Trace.WriteLine("vJoy driver not enabled: Failed Getting vJoy attributes.\n");
                return(false);
            }
            else
            {
                Trace.WriteLine(string.Format("Vendor : {0}\nProduct: {1}\nVersion: {2}\n",
                                              joystick.GetvJoyManufacturerString(),
                                              joystick.GetvJoyProductString(),
                                              joystick.GetvJoySerialNumberString()));

                // Test if DLL matches the driver
                bool match = joystick.DriverMatch(ref DllVer, ref DrvVer);
                if (match)
                {
                    Trace.WriteLine(string.Format("Version of Driver Matches DLL Version ({0:X})", DllVer));
                    Trace.WriteLine(string.Format("Version of vJoyInterfaceWrap.dll is ({0})",
                                                  typeof(vJoy).Assembly.GetName().Version));
                    Trace.WriteLine(string.Format("Version of ScpControl.dll is ({0})\n",
                                                  typeof(ScpControl.ScpProxy).Assembly.GetName().Version));
                }
                else
                {
                    Trace.WriteLine(string.Format("Version of Driver ({0:X}) does NOT match DLL Version ({1:X})\n", DrvVer, DllVer));
                    Stop(parSelectedPads, devManLevel);
                    return(false);
                }
                //MinVersion Check
                vJoyVersion = DrvVer;
                if (vJoyVersion < vJoyConstants.MIN_VER)
                {
                    Trace.WriteLine("vJoy version less than required: Aborting\n");
                    Stop(parSelectedPads, devManLevel);
                    return(false);
                }
            }

            for (uint dsID = 1; dsID <= SCPConstants.MAX_XINPUT_DEVICES; dsID++)
            {
                if (parSelectedPads[dsID - 1])
                {
                    uint id = GetvjFromDS(dsID);

                    // Acquire the target
                    VjdStat status = joystick.GetVJDStatus(id);
                    if ((status == VjdStat.VJD_STAT_OWN) || ((status == VjdStat.VJD_STAT_FREE) && (!joystick.AcquireVJD(id))))
                    {
                        Trace.WriteLine(string.Format("Failed to acquire vJoy device number {0}.", id));
                        Stop(parSelectedPads, devManLevel);
                        return(false);
                    }
                    else
                    {
                        Trace.WriteLine(string.Format("Acquired vJoy device number {0}.", id));
                    }
                    Trace.WriteLine(string.Format("Buttons : {0}.", joystick.GetVJDButtonNumber(id)));
                    Trace.WriteLine(string.Format("DiscPov : {0}.", joystick.GetVJDDiscPovNumber(id)));
                    Trace.WriteLine(string.Format("ContPov : {0}.", joystick.GetVJDContPovNumber(id)));
                    //FFB
                    if (config.ffb)
                    {
                        vibrationCore = new vJoyVibrate(joystick);
                        vibrationCore.FfbInterface(dsID);
                        vibrationCore.VibrationCommand += VibEventProxy;
                    }
                    // Reset this device to default values
                    joystick.ResetVJD(id);
                    //Set Axis to mid value
                    joyReport[dsID - 1].AxisX    = vJoyConstants.HALF_AXIS_VALUE;
                    joyReport[dsID - 1].AxisY    = vJoyConstants.HALF_AXIS_VALUE;
                    joyReport[dsID - 1].AxisZ    = vJoyConstants.HALF_AXIS_VALUE;
                    joyReport[dsID - 1].AxisXRot = vJoyConstants.HALF_AXIS_VALUE;
                    joyReport[dsID - 1].AxisYRot = vJoyConstants.HALF_AXIS_VALUE;
                    joyReport[dsID - 1].AxisZRot = vJoyConstants.HALF_AXIS_VALUE;
                    joyReport[dsID - 1].Slider   = vJoyConstants.HALF_AXIS_VALUE;
                    joyReport[dsID - 1].Dial     = vJoyConstants.HALF_AXIS_VALUE;
                }
            }
            return(true);
        }
예제 #13
0
        void VMInit()
        {
            //Field's
            string openTitle    = "Open File";
            string filter       = "All Fiels(.)|*.*";
            string settingsfile = StringFlieName("settings.json", Directory.GetCurrentDirectory());

            VM.VMTab       = tab;
            VM.VMStatusBar = statusBar;

            //Set the StartPad
            startPad = new StartNote(tab);



            //Load Settings
            if (File.Exists(settingsfile))
            {
                string      json2      = ReadAllText(settingsfile);
                PadSettings mysettings = Deserialize <PadSettings>(json2);

                //Deconstruct into variables
                (WindowState winState, string startnote, string ytScript, string ytInfo, string ytTags, VMList <string> notes, VMList <PadColor> usedColors, VMList <PadDrawSize> drawSize) = mysettings;

                //Set your Settings
                WindowState             = winState;
                startPad.txtCode.Text   = startnote;
                startPad.txtScript.Text = ytScript;
                startPad.txtInfo.Text   = ytInfo;
                startPad.txtTags.Text   = ytTags;


                // Fill your Lists out
                VM.Notes      = notes;
                VM.UsedColors = usedColors;
                VM.DrawSizes  = drawSize;

                //Load Listbox's
                //startPad.notesTaken.lstNotesTaken.ItemsSource = VM.Notes;
                //startPad.artBoards.lstArtBoard.ItemsSource = VM.DrawSizes;
                //startPad.usedColors.lstColor.ItemsSource = VM.UsedColors;
            }

            //New Command
            AddCommand(ApplicationCommands.New, (sender, e) =>
            {
                tab.SelectedIndex           = 0;
                startPad.gridNew.Visibility = Visibility.Visible;
            });
            //Open Command
            AddCommand(ApplicationCommands.Open, (sender, e) =>
            {
                OpenDialogTask(openTitle, filter, (o, i) =>
                {
                    string extension = i.Extension;
                    //foreach method
                    void forEachFile(Action <FileInfo> _method)
                    {
                        foreach (var myfile in o.FileNames)
                        {
                            //Get the file info
                            var info = new FileInfo(myfile);
                            try
                            {
                                //Do the method
                                _method?.Invoke(info);
                            }
                            catch
                            {
                                _method?.Invoke(info);
                            }
                        }
                    }

                    switch (extension)
                    {
                    default:
                        forEachFile((i) =>
                        {
                            var note = new NoteView(VM.VMTab, i);
                        });
                        break;

                    case ".abart":

                        forEachFile((i) =>
                        {
                            var artbaord = new DrawView(VM.VMTab, i);
                        });

                        break;

                    case ".abtxt":
                        forEachFile((i) =>
                        {
                            var abnote = new NoteView(VM.VMTab, i);
                        });
                        break;

                    case ".mp4":
                        forEachFile((i) =>
                        {
                            var player = new MediaPlayerView(VM.VMTab, i);
                        });
                        break;

                    case ".png":


                        var png = new ImageView(VM.VMTab, i);



                        break;

                    case ".jpeg":

                        var jpeg = new ImageView(VM.VMTab, i);



                        break;

                    case ".jpg":


                        var jpg = new ImageView(VM.VMTab, i);


                        break;

                    case ".tfff":
                        forEachFile((i) =>
                        {
                            var tiff = new ImageView(VM.VMTab, i);
                        });
                        break;
                    }
                });
            });

            //StartView
            AddCommand(DesktopCommands.StartView, (sender, e) =>
            {
                //Notes Taken
                NotesTakenView notes = new NotesTakenView(VM.VMTab);
            });;
            // About COmmand
            AddCommand(DesktopCommands.About, (sender, e) =>
            {
                //Help
                HelpView about = new HelpView(VM.VMTab);
            });

            AddCommand(DesktopCommands.LogInfo, (sender, e) =>
            {
                LogView log = new LogView(VM.VMTab);
            });


            //Quick Message Method
            void On_Message(string _str)
            {
                tbStatus.Text = _str;
                MediaCv.NotifyHide(tbStatus, 10);
            }

            //On Closed Method
            Closed += (sender, e) =>
            {
                //Grab the Settings
                PadSettings settings = new PadSettings
                {
                    StartNote          = startPad.txtCode.Text,
                    YoutubeScript      = startPad.txtScript.Text,
                    YoutubeInformation = startPad.txtInfo.Text,
                    YoutubeTags        = startPad.txtTags.Text,
                    Notes       = VM.Notes,
                    UsedColors  = VM.UsedColors,
                    DrawSizes   = VM.DrawSizes,
                    WindowState = WindowState
                };
                //Convert to Json
                string json = Serialize(settings);

                //Save File
                WriteAllText(settingsfile, json);
            };


            //Link ON_Message
            VM.OnMessage += On_Message;
            VM.Message("Welcome to ABNotePad 1.0", true);
        }
예제 #14
0
        public bool Start(bool[] parSelectedPads, PadSettings config, DeviceManagement devManLevel)
        {
            //Setup vJoy
            //Perform device enable/disable based on dll version
            //EnableVJoy needs to know which version of vJoy we are running
            joystick = new vJoy();
            UInt32 DllVer = 0, DrvVer = 0;
            joystick.DriverMatch(ref DllVer, ref DrvVer);
            //MIN Version Check 1
            vJoyVersion = DllVer;
            if (vJoyVersion < vJoyConstants.MIN_VER)
            {
                Trace.WriteLine("vJoy version less than required: Aborting\n");
                Stop(parSelectedPads, devManLevel);
                return false;
            }

            if ((devManLevel & DeviceManagement.vJoy_Config) == DeviceManagement.vJoy_Config)
            {
                EnableVJoy(false);
                SetupVjoy(parSelectedPads, config);
                vJoyInstall.RefreshvJoy(); //do it like vJConfig does (needed in 2.1.6)
                EnableVJoy(true);
            }
            else if ((devManLevel & DeviceManagement.vJoy_Device) == DeviceManagement.vJoy_Device)
            {
                EnableVJoy(true);
            }

            if (!joystick.vJoyEnabled())
            {
                Trace.WriteLine("vJoy driver not enabled: Failed Getting vJoy attributes.\n");
                return false;
            }
            else
            {
                Trace.WriteLine(string.Format("Vendor : {0}\nProduct: {1}\nVersion: {2}\n",
                joystick.GetvJoyManufacturerString(),
                joystick.GetvJoyProductString(),
                joystick.GetvJoySerialNumberString()));

                // Test if DLL matches the driver
                bool match = joystick.DriverMatch(ref DllVer, ref DrvVer);
                if (match)
                {
                    Trace.WriteLine(string.Format("Version of Driver Matches DLL Version ({0:X})", DllVer));
                    Trace.WriteLine(string.Format("Version of vJoyInterfaceWrap.dll is ({0})",
                        typeof(vJoy).Assembly.GetName().Version));
                    Trace.WriteLine(string.Format("Version of ScpControl.dll is ({0})\n",
                        typeof(ScpControl.ScpProxy).Assembly.GetName().Version));
                }
                else
                {
                    Trace.WriteLine(string.Format("Version of Driver ({0:X}) does NOT match DLL Version ({1:X})\n", DrvVer, DllVer));
                    Stop(parSelectedPads, devManLevel);
                    return false;
                }
                //MinVersion Check
                vJoyVersion = DrvVer;
                if (vJoyVersion < vJoyConstants.MIN_VER)
                {
                    Trace.WriteLine("vJoy version less than required: Aborting\n");
                    Stop(parSelectedPads, devManLevel);
                    return false;
                }
            }

            for (uint dsID = 1; dsID <= SCPConstants.MAX_XINPUT_DEVICES; dsID++)
            {
                if (parSelectedPads[dsID - 1])
                {
                    uint id = GetvjFromDS(dsID);

                    // Acquire the target
                    VjdStat status = joystick.GetVJDStatus(id);
                    if ((status == VjdStat.VJD_STAT_OWN) || ((status == VjdStat.VJD_STAT_FREE) && (!joystick.AcquireVJD(id))))
                    {
                        Trace.WriteLine(string.Format("Failed to acquire vJoy device number {0}.", id));
                        Stop(parSelectedPads, devManLevel);
                        return false;
                    }
                    else
                    {
                        Trace.WriteLine(string.Format("Acquired vJoy device number {0}.", id));
                    }
                    Trace.WriteLine(string.Format("Buttons : {0}.", joystick.GetVJDButtonNumber(id)));
                    Trace.WriteLine(string.Format("DiscPov : {0}.", joystick.GetVJDDiscPovNumber(id)));
                    Trace.WriteLine(string.Format("ContPov : {0}.", joystick.GetVJDContPovNumber(id)));
                    //FFB
                    if (config.ffb)
                    {
                        vibrationCore = new vJoyVibrate(joystick);
                        vibrationCore.FfbInterface(dsID);
                        vibrationCore.VibrationCommand += VibEventProxy;
                    }
                    // Reset this device to default values
                    joystick.ResetVJD(id);
                    //Set Axis to mid value
                    joyReport[dsID - 1].AxisX = vJoyConstants.HALF_AXIS_VALUE;
                    joyReport[dsID - 1].AxisY = vJoyConstants.HALF_AXIS_VALUE;
                    joyReport[dsID - 1].AxisZ = vJoyConstants.HALF_AXIS_VALUE;
                    joyReport[dsID - 1].AxisXRot = vJoyConstants.HALF_AXIS_VALUE;
                    joyReport[dsID - 1].AxisYRot = vJoyConstants.HALF_AXIS_VALUE;
                    joyReport[dsID - 1].AxisZRot = vJoyConstants.HALF_AXIS_VALUE;
                    joyReport[dsID - 1].Slider = vJoyConstants.HALF_AXIS_VALUE;
                    joyReport[dsID - 1].Dial = vJoyConstants.HALF_AXIS_VALUE;
                }
            }
            return true;
        }
예제 #15
0
 public void SetupVjoy(bool[] parSelectedPads, PadSettings config)
 {
     VJoyConf VJC = new VJoyConf();
     //Clear out old configs
     VJC.DeleteHidReportDescFromReg(0); //TODO, Respect DevManagement levels
     //create needed pads
     byte dpads = 0;
     if (config.dpad) { dpads = 1; }
     for (uint dsID = 1; dsID <= SCPConstants.MAX_XINPUT_DEVICES; dsID++)
     {
         if (parSelectedPads[dsID - 1])
         {
             uint id = GetvjFromDS(dsID); //
             //byte[] PadConfig = VJC.CreateHidReportDesc(config.nButtons, config.enabledAxis, dpads, 0,(byte)id,
             //    false, new bool [] {false,false,false,false,false,false,false,false,false,false,false});
             byte[] PadConfig = VJC.CreateHidReportDesc(config.nButtons, config.enabledAxis, dpads, 0, (byte)id,
                 config.ffb, //enable vibration
                 new bool[] {
                     true, //Const
                     true, //Ramp
                     true, //Square Wave
                     true, //Sine Wave
                     true, //Tri Wave
                     true, //SawUp Wave
                     true, //SawDown wave
                     false, //Spring
                     false, //Damper
                     false, //Inertia
                     false  //Friction
                 });
             VJC.WriteHidReportDescToReg((int)id, PadConfig);
         }
     }
 }