mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-26 02:54:20 +01:00
Add null extras detection when opening button mapping window
This commit is contained in:
parent
ac4017fea2
commit
5ad4e83b58
@ -716,7 +716,7 @@ namespace DS4Windows
|
|||||||
static int[] oldmouse = new int[4] { -1, -1, -1, -1 };
|
static int[] oldmouse = new int[4] { -1, -1, -1, -1 };
|
||||||
public static void MapCustom(int device, DS4State cState, DS4State MappedState, DS4StateExposed eState, Mouse tp, ControlService ctrl)
|
public static void MapCustom(int device, DS4State cState, DS4State MappedState, DS4StateExposed eState, Mouse tp, ControlService ctrl)
|
||||||
{
|
{
|
||||||
|
/* TODO: This method is slow sauce. Find ways to speed up action execution */
|
||||||
MappedState.LX = 127;
|
MappedState.LX = 127;
|
||||||
MappedState.LY = 127;
|
MappedState.LY = 127;
|
||||||
MappedState.RX = 127;
|
MappedState.RX = 127;
|
||||||
|
@ -509,55 +509,65 @@ namespace DS4Windows
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string[] extras = Global.GetDS4Extra(device, button.Name, rBShiftModifer.Checked).Split(',');
|
string dcExtras = Global.GetDS4Extra(device, button.Name, rBShiftModifer.Checked);
|
||||||
int b;
|
string[] extras = null;
|
||||||
try
|
if (!string.IsNullOrEmpty(dcExtras))
|
||||||
{
|
{
|
||||||
if (int.TryParse(extras[0], out b)) nUDHeavy.Value = b;
|
extras = dcExtras.Split(',');
|
||||||
if (int.TryParse(extras[1], out b)) nUDLight.Value = b;
|
|
||||||
if (int.TryParse(extras[2], out b))
|
|
||||||
if (b == 1)
|
|
||||||
{
|
|
||||||
cBLightbar.Checked = true;
|
|
||||||
if (int.TryParse(extras[3], out b)) tBRedBar.Value = b;
|
|
||||||
if (int.TryParse(extras[4], out b)) tBGreenBar.Value = b;
|
|
||||||
if (int.TryParse(extras[5], out b)) tBBlueBar.Value = b;
|
|
||||||
if (int.TryParse(extras[6], out b)) nUDLightFlash.Value = b;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
tBRedBar.Value = 255;
|
|
||||||
tBGreenBar.Value = 255;
|
|
||||||
tBBlueBar.Value = 255;
|
|
||||||
nUDLightFlash.Value = 0;
|
|
||||||
cBLightbar.Checked = false;
|
|
||||||
}
|
|
||||||
if (int.TryParse(extras[7], out b))
|
|
||||||
if (b == 1)
|
|
||||||
{
|
|
||||||
cBMouse.Checked = true;
|
|
||||||
if (int.TryParse(extras[8], out b)) nUDMouse.Value = b;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nUDMouse.Value = 25;
|
|
||||||
cBMouse.Checked = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch
|
|
||||||
|
if (extras != null)
|
||||||
{
|
{
|
||||||
nUDHeavy.Value = 0;
|
int b;
|
||||||
nUDLight.Value = 0;
|
try
|
||||||
tBRedBar.Value = 255;
|
{
|
||||||
tBGreenBar.Value = 255;
|
if (int.TryParse(extras[0], out b)) nUDHeavy.Value = b;
|
||||||
tBBlueBar.Value = 255;
|
if (int.TryParse(extras[1], out b)) nUDLight.Value = b;
|
||||||
nUDLightFlash.Value = 0;
|
if (int.TryParse(extras[2], out b))
|
||||||
cBLightbar.Checked = false;
|
if (b == 1)
|
||||||
nUDMouse.Value = 25;
|
{
|
||||||
cBMouse.Checked = false;
|
cBLightbar.Checked = true;
|
||||||
|
if (int.TryParse(extras[3], out b)) tBRedBar.Value = b;
|
||||||
|
if (int.TryParse(extras[4], out b)) tBGreenBar.Value = b;
|
||||||
|
if (int.TryParse(extras[5], out b)) tBBlueBar.Value = b;
|
||||||
|
if (int.TryParse(extras[6], out b)) nUDLightFlash.Value = b;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
tBRedBar.Value = 255;
|
||||||
|
tBGreenBar.Value = 255;
|
||||||
|
tBBlueBar.Value = 255;
|
||||||
|
nUDLightFlash.Value = 0;
|
||||||
|
cBLightbar.Checked = false;
|
||||||
|
}
|
||||||
|
if (int.TryParse(extras[7], out b))
|
||||||
|
if (b == 1)
|
||||||
|
{
|
||||||
|
cBMouse.Checked = true;
|
||||||
|
if (int.TryParse(extras[8], out b)) nUDMouse.Value = b;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nUDMouse.Value = 25;
|
||||||
|
cBMouse.Checked = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
nUDHeavy.Value = 0;
|
||||||
|
nUDLight.Value = 0;
|
||||||
|
tBRedBar.Value = 255;
|
||||||
|
tBGreenBar.Value = 255;
|
||||||
|
tBBlueBar.Value = 255;
|
||||||
|
nUDLightFlash.Value = 0;
|
||||||
|
cBLightbar.Checked = false;
|
||||||
|
nUDMouse.Value = 25;
|
||||||
|
cBMouse.Checked = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extraChanged = false;
|
extraChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user