Exemplo n.º 1
0
 private void UpdateControlFromDInput()
 {
     lock (updateFromDirectInputLock)
     {
         var ud           = CurrentUserDevice;
         var instanceGuid = Guid.Empty;
         var enable       = ud != null;
         if (enable)
         {
             instanceGuid = ud.InstanceGuid;
         }
         ControlsHelper.SetEnabled(GeneralPanel.RemapAllButton, enable && ud.DiState != null);
         PadItemPanel.SetEnabled(enable);
         // If device instance changed then...
         if (!Equals(instanceGuid, _InstanceGuid))
         {
             _InstanceGuid = instanceGuid;
             GeneralPanel.ResetDiMenuStrip(enable ? ud : null);
         }
         // Update direct input form and return actions (pressed Buttons/DPads, turned Axis/Sliders).
         UpdateDirectInputTabPage(ud);
         DInputPanel.UpdateFrom(ud);
         if (enable && _Imager.Recorder.Recording)
         {
             // Stop recording if DInput value captured.
             var stopped = _Imager.Recorder.StopRecording(ud.DiState);
             // If value was found and recording stopped then...
             if (stopped)
             {
                 // Device not initialized yet.
                 if (ud.DiState == null)
                 {
                     RecordAllMaps.Clear();
                 }
                 if (RecordAllMaps.Count == 0)
                 {
                     if (ud.DiState != null)
                     {
                         XboxImage.SetHelpText(XboxImage.MappingDone);
                     }
                     else
                     {
                         XboxImage.HelpTextLabel.Content = "";
                     }
                     GeneralPanel.RemapAllButton.Content = RemapName;
                     return;
                 }
                 else
                 {
                     XboxImage.HelpTextLabel.Content = "";
                 }
                 // Try to record next available control from the list.
                 ControlsHelper.BeginInvoke(() => StartRecording(), 1000);
             }
         }
     }
 }
Exemplo n.º 2
0
        public void InitPadControl()
        {
            var dv = new System.Data.DataView();

            // Show disabled images by default.
            _Imager.SetImages(false);
            // Add player index to combo boxes
            var playerOptions = new List <KeyValuePair>();
            var playerTypes   = (UserIndex[])Enum.GetValues(typeof(UserIndex));

            foreach (var item in playerTypes)
            {
                playerOptions.Add(new KeyValuePair(item.ToString(), ((int)item).ToString()));
            }
            PadListPanel.UpdateFromCurrentGame();
            // Update emulation type.
            var game         = SettingsManager.CurrentGame;
            var showAdvanced = game != null && game.EmulationType == (int)EmulationType.Library;

            PadItemPanel.ShowTab(showAdvanced, PadItemPanel.AdvancedTabPage);
        }
Exemplo n.º 3
0
 public void ShowAdvancedTab(bool show)
 => PadItemPanel.ShowTab(show, PadItemPanel.AdvancedTabPage);