mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-26 19:14:20 +01:00
Merge branch 'mika-n-jay' into jay
This commit is contained in:
commit
b21ba5ce62
@ -403,6 +403,9 @@ namespace DS4Windows
|
|||||||
device.SyncChange += this.On_SyncChange;
|
device.SyncChange += this.On_SyncChange;
|
||||||
device.SyncChange += DS4Devices.UpdateSerial;
|
device.SyncChange += DS4Devices.UpdateSerial;
|
||||||
device.SerialChange += this.On_SerialChange;
|
device.SerialChange += this.On_SerialChange;
|
||||||
|
|
||||||
|
touchPad[i] = new Mouse(i, device);
|
||||||
|
|
||||||
if (!useTempProfile[i])
|
if (!useTempProfile[i])
|
||||||
{
|
{
|
||||||
if (device.isValidSerial() && containsLinkedProfile(device.getMacAddress()))
|
if (device.isValidSerial() && containsLinkedProfile(device.getMacAddress()))
|
||||||
@ -417,7 +420,6 @@ namespace DS4Windows
|
|||||||
LoadProfile(i, false, this, false, false);
|
LoadProfile(i, false, this, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
touchPad[i] = new Mouse(i, device);
|
|
||||||
device.LightBarColor = getMainColor(i);
|
device.LightBarColor = getMainColor(i);
|
||||||
|
|
||||||
if (!getDInputOnly(i) && device.isSynced())
|
if (!getDInputOnly(i) && device.isSynced())
|
||||||
@ -641,6 +643,9 @@ namespace DS4Windows
|
|||||||
device.SyncChange += this.On_SyncChange;
|
device.SyncChange += this.On_SyncChange;
|
||||||
device.SyncChange += DS4Devices.UpdateSerial;
|
device.SyncChange += DS4Devices.UpdateSerial;
|
||||||
device.SerialChange += this.On_SerialChange;
|
device.SerialChange += this.On_SerialChange;
|
||||||
|
|
||||||
|
touchPad[Index] = new Mouse(Index, device);
|
||||||
|
|
||||||
if (!useTempProfile[Index])
|
if (!useTempProfile[Index])
|
||||||
{
|
{
|
||||||
if (device.isValidSerial() && containsLinkedProfile(device.getMacAddress()))
|
if (device.isValidSerial() && containsLinkedProfile(device.getMacAddress()))
|
||||||
@ -655,7 +660,6 @@ namespace DS4Windows
|
|||||||
LoadProfile(Index, false, this, false, false);
|
LoadProfile(Index, false, this, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
touchPad[Index] = new Mouse(Index, device);
|
|
||||||
device.LightBarColor = getMainColor(Index);
|
device.LightBarColor = getMainColor(Index);
|
||||||
|
|
||||||
int tempIdx = Index;
|
int tempIdx = Index;
|
||||||
|
@ -1899,11 +1899,14 @@ namespace DS4Windows
|
|||||||
if (!actionDone[index].dev[device] && (!useTempProfile[device] || untriggeraction[device] == null || untriggeraction[device].typeID != SpecialAction.ActionTypeId.Profile) )
|
if (!actionDone[index].dev[device] && (!useTempProfile[device] || untriggeraction[device] == null || untriggeraction[device].typeID != SpecialAction.ActionTypeId.Profile) )
|
||||||
{
|
{
|
||||||
actionDone[index].dev[device] = true;
|
actionDone[index].dev[device] = true;
|
||||||
// If Loadprofile special action doesn't have unload trigger then don't set untrigger status. This way the new loaded profile allows yet another loadProfile action key events)
|
// If Loadprofile special action doesn't have untrigger keys or automatic untrigger option is not set then don't set untrigger status. This way the new loaded profile allows yet another loadProfile action key event.
|
||||||
if (action.uTrigger.Count > 0)
|
if (action.uTrigger.Count > 0 || action.automaticUntrigger)
|
||||||
{
|
{
|
||||||
untriggeraction[device] = action;
|
untriggeraction[device] = action;
|
||||||
untriggerindex[device] = index;
|
untriggerindex[device] = index;
|
||||||
|
|
||||||
|
// If the existing profile is a temp profile then store its name, because automaticUntrigger needs to know where to go back (empty name goes back to default regular profile)
|
||||||
|
untriggeraction[device].prevProfileName = (useTempProfile[device] ? tempprofilename[device] : string.Empty);
|
||||||
}
|
}
|
||||||
//foreach (DS4Controls dc in action.trigger)
|
//foreach (DS4Controls dc in action.trigger)
|
||||||
for (int i = 0, arlen = action.trigger.Count; i < arlen; i++)
|
for (int i = 0, arlen = action.trigger.Count; i < arlen; i++)
|
||||||
@ -1926,6 +1929,22 @@ namespace DS4Windows
|
|||||||
string prolog = Properties.Resources.UsingProfile.Replace("*number*", (device + 1).ToString()).Replace("*Profile name*", action.details);
|
string prolog = Properties.Resources.UsingProfile.Replace("*number*", (device + 1).ToString()).Replace("*Profile name*", action.details);
|
||||||
AppLogger.LogToGui(prolog, false);
|
AppLogger.LogToGui(prolog, false);
|
||||||
LoadTempProfile(device, action.details, true, ctrl);
|
LoadTempProfile(device, action.details, true, ctrl);
|
||||||
|
|
||||||
|
if (action.uTrigger.Count == 0 && !action.automaticUntrigger)
|
||||||
|
{
|
||||||
|
// If the new profile has any actions with the same action key (controls) than this action (which doesn't have untrigger keys) then set status of those actions to wait for the release of the existing action key.
|
||||||
|
List<string> profileActionsNext = getProfileActions(device);
|
||||||
|
for (int actionIndexNext = 0, profileListLenNext = profileActionsNext.Count; actionIndexNext < profileListLenNext; actionIndexNext++)
|
||||||
|
{
|
||||||
|
string actionnameNext = profileActionsNext[actionIndexNext];
|
||||||
|
SpecialAction actionNext = GetProfileAction(device, actionnameNext);
|
||||||
|
int indexNext = GetProfileActionIndexOf(device, actionnameNext);
|
||||||
|
|
||||||
|
if (actionNext.controls == action.controls)
|
||||||
|
actionDone[indexNext].dev[device] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2273,7 +2292,13 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
SpecialAction action = untriggeraction[device];
|
SpecialAction action = untriggeraction[device];
|
||||||
int index = untriggerindex[device];
|
int index = untriggerindex[device];
|
||||||
bool utriggeractivated = true;
|
bool utriggeractivated;
|
||||||
|
|
||||||
|
if (!action.automaticUntrigger)
|
||||||
|
{
|
||||||
|
// Untrigger keys defined and auto-untrigger (=unload) profile option is NOT set. Unload a temporary profile only when specified untrigger keys have been triggered.
|
||||||
|
utriggeractivated = true;
|
||||||
|
|
||||||
//foreach (DS4Controls dc in action.uTrigger)
|
//foreach (DS4Controls dc in action.uTrigger)
|
||||||
for (int i = 0, uTrigLen = action.uTrigger.Count; i < uTrigLen; i++)
|
for (int i = 0, uTrigLen = action.uTrigger.Count; i < uTrigLen; i++)
|
||||||
{
|
{
|
||||||
@ -2284,6 +2309,22 @@ namespace DS4Windows
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Untrigger as soon any of the defined regular trigger keys have been released.
|
||||||
|
utriggeractivated = false;
|
||||||
|
|
||||||
|
for (int i = 0, trigLen = action.trigger.Count; i < trigLen; i++)
|
||||||
|
{
|
||||||
|
DS4Controls dc = action.trigger[i];
|
||||||
|
if (!getBoolSpecialActionMapping(device, dc, cState, eState, tp, fieldMapping))
|
||||||
|
{
|
||||||
|
utriggeractivated = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (utriggeractivated && action.typeID == SpecialAction.ActionTypeId.Profile)
|
if (utriggeractivated && action.typeID == SpecialAction.ActionTypeId.Profile)
|
||||||
{
|
{
|
||||||
@ -2311,10 +2352,16 @@ namespace DS4Windows
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
untriggeraction[device] = null;
|
string profileName = untriggeraction[device].prevProfileName;
|
||||||
string prolog = Properties.Resources.UsingProfile.Replace("*number*", (device + 1).ToString()).Replace("*Profile name*", ProfilePath[device]);
|
string prolog = Properties.Resources.UsingProfile.Replace("*number*", (device + 1).ToString()).Replace("*Profile name*", (profileName == string.Empty ? ProfilePath[device] : profileName));
|
||||||
AppLogger.LogToGui(prolog, false);
|
AppLogger.LogToGui(prolog, false);
|
||||||
LoadProfile(device, false, ctrl);
|
|
||||||
|
untriggeraction[device] = null;
|
||||||
|
|
||||||
|
if (profileName == string.Empty)
|
||||||
|
LoadProfile(device, false, ctrl); // Previous profile was a regular default profile of a controller
|
||||||
|
else
|
||||||
|
LoadTempProfile(device, profileName, true, ctrl); // Previous profile was a temporary profile, so re-load it as a temp profile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4092,6 +4092,8 @@ namespace DS4Windows
|
|||||||
public DateTime pastTime;
|
public DateTime pastTime;
|
||||||
public DateTime firstTap;
|
public DateTime firstTap;
|
||||||
public DateTime TimeofEnd;
|
public DateTime TimeofEnd;
|
||||||
|
public bool automaticUntrigger = false;
|
||||||
|
public string prevProfileName; // Name of the previous profile where automaticUntrigger would jump back to (could be regular or temporary profile. Empty name is the same as regular profile)
|
||||||
|
|
||||||
public SpecialAction(string name, string controls, string type, string details, double delay = 0, string extras = "")
|
public SpecialAction(string name, string controls, string type, string details, double delay = 0, string extras = "")
|
||||||
{
|
{
|
||||||
@ -4201,7 +4203,10 @@ namespace DS4Windows
|
|||||||
this.ucontrols = extras;
|
this.ucontrols = extras;
|
||||||
string[] uctrls = extras.Split('/');
|
string[] uctrls = extras.Split('/');
|
||||||
foreach (string s in uctrls)
|
foreach (string s in uctrls)
|
||||||
uTrigger.Add(getDS4ControlsByName(s));
|
{
|
||||||
|
if (s == "AutomaticUntrigger") this.automaticUntrigger = true;
|
||||||
|
else uTrigger.Add(getDS4ControlsByName(s));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
9
DS4Windows/DS4Forms/SpecActions.Designer.cs
generated
9
DS4Windows/DS4Forms/SpecActions.Designer.cs
generated
@ -86,6 +86,7 @@
|
|||||||
this.lbDTapDVR = new System.Windows.Forms.Label();
|
this.lbDTapDVR = new System.Windows.Forms.Label();
|
||||||
this.lbHoldDVR = new System.Windows.Forms.Label();
|
this.lbHoldDVR = new System.Windows.Forms.Label();
|
||||||
this.lbTapDVR = new System.Windows.Forms.Label();
|
this.lbTapDVR = new System.Windows.Forms.Label();
|
||||||
|
this.cbProfileAutoUntrigger = new System.Windows.Forms.CheckBox();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pBProgram)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.pBProgram)).BeginInit();
|
||||||
this.pnlProgram.SuspendLayout();
|
this.pnlProgram.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nUDProg)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.nUDProg)).BeginInit();
|
||||||
@ -383,6 +384,7 @@
|
|||||||
//
|
//
|
||||||
// pnlProfile
|
// pnlProfile
|
||||||
//
|
//
|
||||||
|
this.pnlProfile.Controls.Add(this.cbProfileAutoUntrigger);
|
||||||
this.pnlProfile.Controls.Add(this.lbUnloadTipProfile);
|
this.pnlProfile.Controls.Add(this.lbUnloadTipProfile);
|
||||||
this.pnlProfile.Controls.Add(this.cBProfiles);
|
this.pnlProfile.Controls.Add(this.cBProfiles);
|
||||||
this.pnlProfile.Controls.Add(this.btnSetUTriggerProfile);
|
this.pnlProfile.Controls.Add(this.btnSetUTriggerProfile);
|
||||||
@ -596,6 +598,12 @@
|
|||||||
resources.ApplyResources(this.lbTapDVR, "lbTapDVR");
|
resources.ApplyResources(this.lbTapDVR, "lbTapDVR");
|
||||||
this.lbTapDVR.Name = "lbTapDVR";
|
this.lbTapDVR.Name = "lbTapDVR";
|
||||||
//
|
//
|
||||||
|
// cbProfileAutoUntrigger
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.cbProfileAutoUntrigger, "cbProfileAutoUntrigger");
|
||||||
|
this.cbProfileAutoUntrigger.Name = "cbProfileAutoUntrigger";
|
||||||
|
this.cbProfileAutoUntrigger.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
// SpecActions
|
// SpecActions
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this, "$this");
|
resources.ApplyResources(this, "$this");
|
||||||
@ -698,5 +706,6 @@
|
|||||||
public System.Windows.Forms.Button btnDTapT;
|
public System.Windows.Forms.Button btnDTapT;
|
||||||
public System.Windows.Forms.Button btnHoldT;
|
public System.Windows.Forms.Button btnHoldT;
|
||||||
public System.Windows.Forms.Button btnSTapT;
|
public System.Windows.Forms.Button btnSTapT;
|
||||||
|
private System.Windows.Forms.CheckBox cbProfileAutoUntrigger;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -102,6 +102,7 @@ namespace DS4Windows
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cbProfileAutoUntrigger.Checked = act.automaticUntrigger;
|
||||||
break;
|
break;
|
||||||
case "Key":
|
case "Key":
|
||||||
cBActions.SelectedIndex = 4;
|
cBActions.SelectedIndex = 4;
|
||||||
@ -270,7 +271,7 @@ namespace DS4Windows
|
|||||||
actRe = true;
|
actRe = true;
|
||||||
if (!string.IsNullOrEmpty(oldprofilename) && oldprofilename != tBName.Text)
|
if (!string.IsNullOrEmpty(oldprofilename) && oldprofilename != tBName.Text)
|
||||||
Global.RemoveAction(oldprofilename);
|
Global.RemoveAction(oldprofilename);
|
||||||
Global.SaveAction(tBName.Text, String.Join("/", controls), cBActions.SelectedIndex, cBProfiles.Text, edit, String.Join("/", ucontrols));
|
Global.SaveAction(tBName.Text, String.Join("/", controls), cBActions.SelectedIndex, cBProfiles.Text, edit, String.Join("/", ucontrols) + (cbProfileAutoUntrigger.Checked ? (ucontrols.Count > 0 ? "/" : "") + "AutomaticUntrigger" : "") );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
btnSetUTriggerProfile.ForeColor = Color.Red;
|
btnSetUTriggerProfile.ForeColor = Color.Red;
|
||||||
|
@ -2116,7 +2116,7 @@
|
|||||||
<value>NoControl</value>
|
<value>NoControl</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="lbUnloadTipProfile.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="lbUnloadTipProfile.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>0, 55</value>
|
<value>0, 95</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="lbUnloadTipProfile.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="lbUnloadTipProfile.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>100, 23</value>
|
<value>100, 23</value>
|
||||||
@ -2140,7 +2140,7 @@
|
|||||||
<value>206, 58</value>
|
<value>206, 58</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="pnlProfile.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="pnlProfile.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>161, 94</value>
|
<value>161, 121</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="pnlProfile.TabIndex" type="System.Int32, mscorlib">
|
<data name="pnlProfile.TabIndex" type="System.Int32, mscorlib">
|
||||||
<value>262</value>
|
<value>262</value>
|
||||||
@ -2160,6 +2160,45 @@
|
|||||||
<data name=">>pnlProfile.ZOrder" xml:space="preserve">
|
<data name=">>pnlProfile.ZOrder" xml:space="preserve">
|
||||||
<value>11</value>
|
<value>11</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name=">>cbProfileAutoUntrigger.Name" xml:space="preserve">
|
||||||
|
<value>cbProfileAutoUntrigger</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>cbProfileAutoUntrigger.Type" xml:space="preserve">
|
||||||
|
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>cbProfileAutoUntrigger.Parent" xml:space="preserve">
|
||||||
|
<value>pnlProfile</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>cbProfileAutoUntrigger.ZOrder" xml:space="preserve">
|
||||||
|
<value>0</value>
|
||||||
|
</data>
|
||||||
|
<data name="cbProfileAutoUntrigger.AutoSize" type="System.Boolean, mscorlib">
|
||||||
|
<value>True</value>
|
||||||
|
</data>
|
||||||
|
<data name="cbProfileAutoUntrigger.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>0, 61</value>
|
||||||
|
</data>
|
||||||
|
<data name="cbProfileAutoUntrigger.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>144, 17</value>
|
||||||
|
</data>
|
||||||
|
<data name="cbProfileAutoUntrigger.TabIndex" type="System.Int32, mscorlib">
|
||||||
|
<value>260</value>
|
||||||
|
</data>
|
||||||
|
<data name="cbProfileAutoUntrigger.Text" xml:space="preserve">
|
||||||
|
<value>Unload on trigger release</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>cbProfileAutoUntrigger.Name" xml:space="preserve">
|
||||||
|
<value>cbProfileAutoUntrigger</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>cbProfileAutoUntrigger.Type" xml:space="preserve">
|
||||||
|
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>cbProfileAutoUntrigger.Parent" xml:space="preserve">
|
||||||
|
<value>pnlProfile</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>cbProfileAutoUntrigger.ZOrder" xml:space="preserve">
|
||||||
|
<value>0</value>
|
||||||
|
</data>
|
||||||
<data name="nUDDCBT.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="nUDDCBT.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>56, 3</value>
|
<value>56, 3</value>
|
||||||
</data>
|
</data>
|
||||||
|
Loading…
Reference in New Issue
Block a user