Skip to content
This repository has been archived by the owner on Jan 1, 2024. It is now read-only.

Commit

Permalink
Simplify shift modifier key type saving
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryochan7 committed Jan 29, 2023
1 parent fcb8309 commit 5ce8da5
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions DS4Windows/DS4Control/DTOXml/ProfileDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1750,26 +1750,9 @@ public void MapFrom(BackingStore source)

if (dcs.shiftActionType != DS4ControlSettings.ActionType.Default && dcs.shiftTrigger > 0)
{
DS4KeyType[] tempArray = (DS4KeyType[])Enum.GetValues(typeof(DS4KeyType));
for (int i = 0; i < tempArray.Length; i++)
if (dcs.shiftKeyType != DS4KeyType.None)
{
DS4KeyType testFlag = tempArray[i];
if (testFlag != DS4KeyType.None && dcs.shiftKeyType.HasFlag(testFlag))
{
// Check for existing DS4KeyType flags for current control
if (shiftKeyTypeSerializer.CustomMapKeyTypes.ContainsKey(dcs.control))
{
DS4KeyType tempFlags = DS4KeyType.None;
tempFlags = shiftKeyTypeSerializer.CustomMapKeyTypes[dcs.control];
tempFlags |= testFlag;
shiftKeyTypeSerializer.CustomMapKeyTypes[dcs.control] = tempFlags;

}
else
{
shiftKeyTypeSerializer.CustomMapKeyTypes.Add(dcs.control, testFlag);
}
}
shiftKeyTypeSerializer.CustomMapKeyTypes.Add(dcs.control, dcs.shiftKeyType);
}

if (dcs.shiftActionType == DS4ControlSettings.ActionType.Button)
Expand Down

0 comments on commit 5ce8da5

Please sign in to comment.