Added unchecked region

This commit is contained in:
Travis Nickles 2019-02-15 21:58:00 -06:00
parent 5b19dc76cd
commit 50109282f4

View File

@ -1512,45 +1512,50 @@ namespace DS4Windows
if (controlType == DS4StateFieldMapping.ControlType.AxisDir) if (controlType == DS4StateFieldMapping.ControlType.AxisDir)
//if (dcs.control > DS4Controls.None && dcs.control < DS4Controls.L1) //if (dcs.control > DS4Controls.None && dcs.control < DS4Controls.L1)
{ {
//int current = (int)dcs.control;
//outputfieldMapping.axisdirs[current] = fieldMapping.axisdirs[current];
customMapQueue[device].Enqueue(new ControlToXInput(dcs.control, dcs.control)); customMapQueue[device].Enqueue(new ControlToXInput(dcs.control, dcs.control));
} }
} }
} }
Queue<ControlToXInput> tempControl = customMapQueue[device]; Queue<ControlToXInput> tempControl = customMapQueue[device];
for (int i = 0, len = tempControl.Count; i < len; i++) unchecked
//while(tempControl.Any())
{ {
ControlToXInput tempMap = tempControl.Dequeue(); for (int i = 0, len = tempControl.Count; i < len; i++)
int controlNum = (int)tempMap.ds4input; //while(tempControl.Any())
int tempOutControl = (int)tempMap.xoutput;
if (tempMap.xoutput >= DS4Controls.LXNeg && tempMap.xoutput <= DS4Controls.RYPos)
{ {
const byte axisDead = 128; ControlToXInput tempMap = tempControl.Dequeue();
DS4StateFieldMapping.ControlType controlType = DS4StateFieldMapping.mappedType[tempOutControl]; int controlNum = (int)tempMap.ds4input;
bool alt = controlType == DS4StateFieldMapping.ControlType.AxisDir && tempOutControl % 2 == 0 ? true : false; int tempOutControl = (int)tempMap.xoutput;
byte axisMapping = getXYAxisMapping2(device, tempMap.ds4input, cState, eState, tp, fieldMapping, alt); if (tempMap.xoutput >= DS4Controls.LXNeg && tempMap.xoutput <= DS4Controls.RYPos)
if (axisMapping != axisDead)
{ {
int controlRelation = tempOutControl % 2 == 0 ? tempOutControl - 1 : tempOutControl + 1; const byte axisDead = 128;
outputfieldMapping.axisdirs[tempOutControl] = axisMapping; DS4StateFieldMapping.ControlType controlType = DS4StateFieldMapping.mappedType[tempOutControl];
outputfieldMapping.axisdirs[controlRelation] = axisMapping; bool alt = controlType == DS4StateFieldMapping.ControlType.AxisDir && tempOutControl % 2 == 0 ? true : false;
} byte axisMapping = getXYAxisMapping2(device, tempMap.ds4input, cState, eState, tp, fieldMapping, alt);
} if (axisMapping != axisDead)
else {
{ int controlRelation = tempOutControl % 2 == 0 ? tempOutControl - 1 : tempOutControl + 1;
if (tempMap.xoutput == DS4Controls.L2 || tempMap.xoutput == DS4Controls.R2) outputfieldMapping.axisdirs[tempOutControl] = axisMapping;
{ outputfieldMapping.axisdirs[controlRelation] = axisMapping;
const byte axisZero = 0; }
byte axisMapping = getByteMapping2(device, tempMap.ds4input, cState, eState, tp, fieldMapping);
if (axisMapping != axisZero)
outputfieldMapping.triggers[tempOutControl] = axisMapping;
} }
else else
{ {
bool value = getBoolMapping2(device, tempMap.ds4input, cState, eState, tp, fieldMapping); if (tempMap.xoutput == DS4Controls.L2 || tempMap.xoutput == DS4Controls.R2)
if (value) {
outputfieldMapping.buttons[tempOutControl] = value; const byte axisZero = 0;
byte axisMapping = getByteMapping2(device, tempMap.ds4input, cState, eState, tp, fieldMapping);
if (axisMapping != axisZero)
outputfieldMapping.triggers[tempOutControl] = axisMapping;
}
else
{
bool value = getBoolMapping2(device, tempMap.ds4input, cState, eState, tp, fieldMapping);
if (value)
outputfieldMapping.buttons[tempOutControl] = value;
}
} }
} }
} }