mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-26 08:31:49 +01:00
Added "Revert to default profile on unknown process" option to auto-profile screen. If this is enabled then DS4Windows will revert back to default profile when an unknown process is the foreground app. If this option is unchecked then DS4Windows leaves the current profile as active on unknown foreground processes.
This commit is contained in:
parent
1d637005cb
commit
39f94ef8d3
@ -99,10 +99,18 @@ namespace DS4WinWPF
|
||||
{
|
||||
if (Global.useTempProfile[j])
|
||||
{
|
||||
if (autoProfileDebugLogLevel > 0)
|
||||
DS4Windows.AppLogger.LogToGui($"DEBUG: Auto-Profile. RestoreProfile Controller {j + 1}={Global.ProfilePath[j]} (default)", false);
|
||||
if (DS4Windows.Global.AutoProfileRevertDefaultProfile)
|
||||
{
|
||||
if (autoProfileDebugLogLevel > 0)
|
||||
DS4Windows.AppLogger.LogToGui($"DEBUG: Auto-Profile. Unknown process. Reverting to default profile. Controller {j + 1}={Global.ProfilePath[j]} (default)", false);
|
||||
|
||||
Global.LoadProfile(j, false, Program.rootHub);
|
||||
Global.LoadProfile(j, false, Program.rootHub);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (autoProfileDebugLogLevel > 0)
|
||||
DS4Windows.AppLogger.LogToGui($"DEBUG: Auto-Profile. Unknown process. Existing profile left as active. Controller {j + 1}={Global.tempprofilename[j]}", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -966,6 +966,12 @@ namespace DS4Windows
|
||||
get { return m_Config.customSteamFolder; }
|
||||
}
|
||||
|
||||
public static bool AutoProfileRevertDefaultProfile
|
||||
{
|
||||
set { m_Config.autoProfileRevertDefaultProfile = value; }
|
||||
get { return m_Config.autoProfileRevertDefaultProfile; }
|
||||
}
|
||||
|
||||
// controller/profile specfic values
|
||||
public static int[] ButtonMouseSensitivity => m_Config.buttonMouseSensitivity;
|
||||
|
||||
@ -2209,6 +2215,9 @@ namespace DS4Windows
|
||||
OutContType.X360, OutContType.X360,
|
||||
OutContType.X360, OutContType.X360 };
|
||||
|
||||
// TRUE=AutoProfile reverts to default profile if current foreground process is unknown, FALSE=Leave existing profile active when a foreground proces is unknown (ie. no matching auto-profile rule)
|
||||
public bool autoProfileRevertDefaultProfile = true;
|
||||
|
||||
bool tempBool = false;
|
||||
|
||||
public BackingStore()
|
||||
@ -3960,6 +3969,8 @@ namespace DS4Windows
|
||||
catch { missingSetting = true; }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/Profile/CustomSteamFolder"); customSteamFolder = Item.InnerText; }
|
||||
catch { missingSetting = true; }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/Profile/AutoProfileRevertDefaultProfile"); Boolean.TryParse(Item.InnerText, out autoProfileRevertDefaultProfile); }
|
||||
catch { missingSetting = true; }
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
@ -4032,6 +4043,7 @@ namespace DS4Windows
|
||||
XmlNode xmlUDPServListenAddress = m_Xdoc.CreateNode(XmlNodeType.Element, "UDPServerListenAddress", null); xmlUDPServListenAddress.InnerText = udpServListenAddress; Node.AppendChild(xmlUDPServListenAddress);
|
||||
XmlNode xmlUseCustomSteamFolder = m_Xdoc.CreateNode(XmlNodeType.Element, "UseCustomSteamFolder", null); xmlUseCustomSteamFolder.InnerText = useCustomSteamFolder.ToString(); Node.AppendChild(xmlUseCustomSteamFolder);
|
||||
XmlNode xmlCustomSteamFolder = m_Xdoc.CreateNode(XmlNodeType.Element, "CustomSteamFolder", null); xmlCustomSteamFolder.InnerText = customSteamFolder; Node.AppendChild(xmlCustomSteamFolder);
|
||||
XmlNode xmlAutoProfileRevertDefaultProfile = m_Xdoc.CreateNode(XmlNodeType.Element, "AutoProfileRevertDefaultProfile", null); xmlAutoProfileRevertDefaultProfile.InnerText = autoProfileRevertDefaultProfile.ToString(); Node.AppendChild(xmlAutoProfileRevertDefaultProfile);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
|
@ -120,6 +120,7 @@
|
||||
<TextBox Text="{Binding Title, UpdateSourceTrigger=LostFocus}" Margin="{StaticResource spaceMargin}" />
|
||||
<Border Height="4" Background="#FFDADADA" Margin="0,10,0,0" />
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="revertDefaultProfileOnUnknownCk" Content="Revert to default profile on unknown" Margin="0,10,0,0" IsChecked="{Binding RevertDefaultProfileOnUnknown}" />
|
||||
<CheckBox x:Name="showAutoDebugCk" Content="Show auto-profile debug messages" Margin="0,10,0,0" Click="ShowAutoDebugCk_Click" />
|
||||
</StackPanel>
|
||||
<DockPanel>
|
||||
|
@ -67,6 +67,8 @@ namespace DS4WinWPF.DS4Forms
|
||||
programListLV.DataContext = autoProfVM;
|
||||
programListLV.ItemsSource = autoProfVM.ProgramColl;
|
||||
|
||||
revertDefaultProfileOnUnknownCk.DataContext = autoProfVM;
|
||||
|
||||
autoProfVM.SearchFinished += AutoProfVM_SearchFinished;
|
||||
autoProfVM.CurrentItemChange += AutoProfVM_CurrentItemChange;
|
||||
|
||||
|
@ -45,7 +45,6 @@ namespace DS4WinWPF.DS4Forms
|
||||
private AutoProfileHolder autoProfileHolder;
|
||||
private NonFormTimer hotkeysTimer;
|
||||
private NonFormTimer autoProfilesTimer;
|
||||
private static int autoProfileDebugLogLevel = 0; // 0=Dont log debug messages about active process and window titles to GUI Log screen. 1=Show debug log messages
|
||||
private AutoProfileChecker autoprofileChecker;
|
||||
private ProfileEditor editor;
|
||||
private bool preserveSize = true;
|
||||
@ -346,8 +345,7 @@ Suspend support not enabled.", true);
|
||||
|
||||
private void AutoProfControl_AutoDebugChanged(object sender, EventArgs e)
|
||||
{
|
||||
autoprofileChecker.AutoProfileDebugLogLevel =
|
||||
autoProfileDebugLogLevel = autoProfControl.AutoDebug == true ? 1 : 0;
|
||||
autoprofileChecker.AutoProfileDebugLogLevel = autoProfControl.AutoDebug == true ? 1 : 0;
|
||||
}
|
||||
|
||||
private void PowerEventArrive(object sender, EventArrivedEventArgs e)
|
||||
|
@ -50,6 +50,12 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
public delegate void AutoProfileStateHandler(AutoProfilesViewModel sender, bool state);
|
||||
public event AutoProfileStateHandler AutoProfileSystemChange;
|
||||
|
||||
public bool RevertDefaultProfileOnUnknown
|
||||
{
|
||||
get => DS4Windows.Global.AutoProfileRevertDefaultProfile;
|
||||
set => DS4Windows.Global.AutoProfileRevertDefaultProfile = value;
|
||||
}
|
||||
|
||||
public AutoProfilesViewModel(AutoProfileHolder autoProfileHolder, ProfileList profileList)
|
||||
{
|
||||
programColl = new ObservableCollection<ProgramItem>();
|
||||
|
Loading…
Reference in New Issue
Block a user