Sixaxis tilts can now mapped, map them to the analog sticks, buttons, keyboards, and even macros

Better Support of multiple action being mapped to analog sticks
Fixed crash with an empty macro
UI Fixes
This commit is contained in:
jays2kings 2014-06-23 18:27:14 -04:00
parent edd7cf9403
commit 1a8fb309ee
9 changed files with 354 additions and 179 deletions

View File

@ -409,7 +409,7 @@ namespace DS4Control
if (Global.getHasCustomKeysorButtons(ind)) if (Global.getHasCustomKeysorButtons(ind))
{ {
Mapping.MapCustom(ind, cState, MappedState[ind]); Mapping.MapCustom(ind, cState, MappedState[ind], ExposedState[ind]);
cState = MappedState[ind]; cState = MappedState[ind];
} }
@ -441,38 +441,42 @@ namespace DS4Control
public string GetInputkeys(int ind) public string GetInputkeys(int ind)
{ {
DS4State cState = CurrentState[ind]; DS4State cState = CurrentState[ind];
DS4StateExposed eState = ExposedState[ind];
if (DS4Controllers[ind] != null) if (DS4Controllers[ind] != null)
if (Mapping.getBoolMapping(DS4Controls.Cross, cState)) return "Cross"; if (Mapping.getBoolMapping(DS4Controls.Cross, cState, eState)) return "Cross";
else if (Mapping.getBoolMapping(DS4Controls.Circle, cState)) return "Circle"; else if (Mapping.getBoolMapping(DS4Controls.Circle, cState, eState)) return "Circle";
else if (Mapping.getBoolMapping(DS4Controls.Triangle, cState)) return "Triangle"; else if (Mapping.getBoolMapping(DS4Controls.Triangle, cState, eState)) return "Triangle";
else if (Mapping.getBoolMapping(DS4Controls.Square, cState)) return "Square"; else if (Mapping.getBoolMapping(DS4Controls.Square, cState, eState)) return "Square";
else if (Mapping.getBoolMapping(DS4Controls.L1, cState)) return "L1"; else if (Mapping.getBoolMapping(DS4Controls.L1, cState, eState)) return "L1";
else if (Mapping.getBoolMapping(DS4Controls.R1, cState)) return "R1"; else if (Mapping.getBoolMapping(DS4Controls.R1, cState, eState)) return "R1";
else if (Mapping.getBoolMapping(DS4Controls.L2, cState)) return "L2"; else if (Mapping.getBoolMapping(DS4Controls.L2, cState, eState)) return "L2";
else if (Mapping.getBoolMapping(DS4Controls.R2, cState)) return "R2"; else if (Mapping.getBoolMapping(DS4Controls.R2, cState, eState)) return "R2";
else if (Mapping.getBoolMapping(DS4Controls.L3, cState)) return "L3"; else if (Mapping.getBoolMapping(DS4Controls.L3, cState, eState)) return "L3";
else if (Mapping.getBoolMapping(DS4Controls.R3, cState)) return "R3"; else if (Mapping.getBoolMapping(DS4Controls.R3, cState, eState)) return "R3";
else if (Mapping.getBoolMapping(DS4Controls.DpadUp, cState)) return "Up"; else if (Mapping.getBoolMapping(DS4Controls.DpadUp, cState, eState)) return "Up";
else if (Mapping.getBoolMapping(DS4Controls.DpadDown, cState)) return "Down"; else if (Mapping.getBoolMapping(DS4Controls.DpadDown, cState, eState)) return "Down";
else if (Mapping.getBoolMapping(DS4Controls.DpadLeft, cState)) return "Left"; else if (Mapping.getBoolMapping(DS4Controls.DpadLeft, cState, eState)) return "Left";
else if (Mapping.getBoolMapping(DS4Controls.DpadRight, cState)) return "Right"; else if (Mapping.getBoolMapping(DS4Controls.DpadRight, cState, eState)) return "Right";
else if (Mapping.getBoolMapping(DS4Controls.Share, cState)) return "Share"; else if (Mapping.getBoolMapping(DS4Controls.Share, cState, eState)) return "Share";
else if (Mapping.getBoolMapping(DS4Controls.Options, cState)) return "Options"; else if (Mapping.getBoolMapping(DS4Controls.Options, cState, eState)) return "Options";
else if (Mapping.getBoolMapping(DS4Controls.PS, cState)) return "PS"; else if (Mapping.getBoolMapping(DS4Controls.PS, cState, eState)) return "PS";
else if (Mapping.getBoolMapping(DS4Controls.LXPos, cState)) return "LS Right"; else if (Mapping.getBoolMapping(DS4Controls.LXPos, cState, eState)) return "LS Right";
else if (Mapping.getBoolMapping(DS4Controls.LXNeg, cState)) return "LS Left"; else if (Mapping.getBoolMapping(DS4Controls.LXNeg, cState, eState)) return "LS Left";
else if (Mapping.getBoolMapping(DS4Controls.LYPos, cState)) return "LS Down"; else if (Mapping.getBoolMapping(DS4Controls.LYPos, cState, eState)) return "LS Down";
else if (Mapping.getBoolMapping(DS4Controls.LYNeg, cState)) return "LS Up"; else if (Mapping.getBoolMapping(DS4Controls.LYNeg, cState, eState)) return "LS Up";
else if (Mapping.getBoolMapping(DS4Controls.RXPos, cState)) return "RS Right"; else if (Mapping.getBoolMapping(DS4Controls.RXPos, cState, eState)) return "RS Right";
else if (Mapping.getBoolMapping(DS4Controls.RXNeg, cState)) return "RS Left"; else if (Mapping.getBoolMapping(DS4Controls.RXNeg, cState, eState)) return "RS Left";
else if (Mapping.getBoolMapping(DS4Controls.RYPos, cState)) return "RS Down"; else if (Mapping.getBoolMapping(DS4Controls.RYPos, cState, eState)) return "RS Down";
else if (Mapping.getBoolMapping(DS4Controls.RYNeg, cState)) return "RS Up"; else if (Mapping.getBoolMapping(DS4Controls.RYNeg, cState, eState)) return "RS Up";
else if (Mapping.getBoolMapping(DS4Controls.TouchLeft, cState)) return "Touch Left"; else if (Mapping.getBoolMapping(DS4Controls.TouchLeft, cState, eState)) return "Touch Left";
else if (Mapping.getBoolMapping(DS4Controls.TouchRight, cState)) return "Touch Right"; else if (Mapping.getBoolMapping(DS4Controls.TouchRight, cState, eState)) return "Touch Right";
else if (Mapping.getBoolMapping(DS4Controls.TouchMulti, cState)) return "Touch Multi"; else if (Mapping.getBoolMapping(DS4Controls.TouchMulti, cState, eState)) return "Touch Multi";
else if (Mapping.getBoolMapping(DS4Controls.TouchUpper, cState)) return "Touch Upper"; else if (Mapping.getBoolMapping(DS4Controls.TouchUpper, cState, eState)) return "Touch Upper";
else return "nothing"; /*else if (Mapping.getBoolMapping(DS4Controls.GyroXPos, cState, eState)) return "GyroXP";
else return "nothing"; else if (Mapping.getBoolMapping(DS4Controls.GyroXNeg, cState, eState)) return "GyroXN";
else if (Mapping.getBoolMapping(DS4Controls.GyroZPos, cState, eState)) return "GyroZP";
else if (Mapping.getBoolMapping(DS4Controls.GyroZNeg, cState, eState)) return "GyroZN";*/
return "nothing";
} }
bool[] touchreleased = { true, true, true, true }, touchslid = { false, false, false, false }; bool[] touchreleased = { true, true, true, true }, touchslid = { false, false, false, false };

View File

@ -200,7 +200,6 @@ namespace DS4Control
{ {
oldnow = DateTime.UtcNow; oldnow = DateTime.UtcNow;
InputMethods.performKeyPress(kvp.Key); InputMethods.performKeyPress(kvp.Key);
Console.WriteLine(((System.Windows.Forms.Keys)kvp.Key).ToString());
pressagain = false; pressagain = false;
keyshelddown = kvp.Key; keyshelddown = kvp.Key;
} }
@ -463,14 +462,14 @@ namespace DS4Control
public static bool[] pressedonce = new bool[261], macrodone = new bool[30]; public static bool[] pressedonce = new bool[261], macrodone = new bool[30];
public static int test = 0; public static int test = 0;
/** Map DS4 Buttons/Axes to other DS4 Buttons/Axes (largely the same as Xinput ones) and to keyboard and mouse buttons. */ /** Map DS4 Buttons/Axes to other DS4 Buttons/Axes (largely the same as Xinput ones) and to keyboard and mouse buttons. */
public static async void MapCustom(int device, DS4State cState, DS4State MappedState) public static async void MapCustom(int device, DS4State cState, DS4State MappedState, DS4StateExposed eState)
{ {
cState.CopyTo(MappedState); cState.CopyTo(MappedState);
SyntheticState deviceState = Mapping.deviceState[device]; SyntheticState deviceState = Mapping.deviceState[device];
foreach (KeyValuePair<DS4Controls, string> customKey in Global.getCustomMacros(device)) //with delays foreach (KeyValuePair<DS4Controls, string> customKey in Global.getCustomMacros(device)) //with delays
{ {
DS4KeyType keyType = Global.getCustomKeyType(device, customKey.Key); DS4KeyType keyType = Global.getCustomKeyType(device, customKey.Key);
if (getBoolMapping(customKey.Key, cState)) if (getBoolMapping(customKey.Key, cState, eState))
{ {
resetToDefaultValue(customKey.Key, MappedState); resetToDefaultValue(customKey.Key, MappedState);
bool LXChanged = (Math.Abs(127 - MappedState.LX) < 5); bool LXChanged = (Math.Abs(127 - MappedState.LX) < 5);
@ -492,33 +491,33 @@ namespace DS4Control
for (int i = 0; i < keys.Length; i++) for (int i = 0; i < keys.Length; i++)
keys[i] = ushort.Parse(skeys[i]); keys[i] = ushort.Parse(skeys[i]);
bool[] keydown = new bool[261]; bool[] keydown = new bool[261];
if (keys[0] > 260 && keys[0] < 300) if (keys.Length > 0 && keys[0] > 260 && keys[0] < 300)
{ {
if (keys[0] == 261 && !MappedState.Cross) MappedState.Cross = getBoolMapping(customKey.Key, cState); if (keys[0] == 261 && !MappedState.Cross) MappedState.Cross = getBoolMapping(customKey.Key, cState, eState);
if (keys[0] == 262 && !MappedState.Circle) MappedState.Circle = getBoolMapping(customKey.Key, cState); if (keys[0] == 262 && !MappedState.Circle) MappedState.Circle = getBoolMapping(customKey.Key, cState, eState);
if (keys[0] == 263 && !MappedState.Square) MappedState.Square = getBoolMapping(customKey.Key, cState); if (keys[0] == 263 && !MappedState.Square) MappedState.Square = getBoolMapping(customKey.Key, cState, eState);
if (keys[0] == 264 && !MappedState.Triangle) MappedState.Triangle = getBoolMapping(customKey.Key, cState); if (keys[0] == 264 && !MappedState.Triangle) MappedState.Triangle = getBoolMapping(customKey.Key, cState, eState);
if (keys[0] == 265 && !MappedState.DpadUp) MappedState.DpadUp = getBoolMapping(customKey.Key, cState); if (keys[0] == 265 && !MappedState.DpadUp) MappedState.DpadUp = getBoolMapping(customKey.Key, cState, eState);
if (keys[0] == 266 && !MappedState.DpadDown) MappedState.DpadDown = getBoolMapping(customKey.Key, cState); if (keys[0] == 266 && !MappedState.DpadDown) MappedState.DpadDown = getBoolMapping(customKey.Key, cState, eState);
if (keys[0] == 267 && !MappedState.DpadLeft) MappedState.DpadLeft = getBoolMapping(customKey.Key, cState); if (keys[0] == 267 && !MappedState.DpadLeft) MappedState.DpadLeft = getBoolMapping(customKey.Key, cState, eState);
if (keys[0] == 268 && !MappedState.DpadRight) MappedState.DpadRight = getBoolMapping(customKey.Key, cState); if (keys[0] == 268 && !MappedState.DpadRight) MappedState.DpadRight = getBoolMapping(customKey.Key, cState, eState);
if (keys[0] == 269 && !MappedState.Options) MappedState.Options = getBoolMapping(customKey.Key, cState); if (keys[0] == 269 && !MappedState.Options) MappedState.Options = getBoolMapping(customKey.Key, cState, eState);
if (keys[0] == 270 && !MappedState.Share) MappedState.Share = getBoolMapping(customKey.Key, cState); if (keys[0] == 270 && !MappedState.Share) MappedState.Share = getBoolMapping(customKey.Key, cState, eState);
if (keys[0] == 271 && !MappedState.PS) MappedState.PS = getBoolMapping(customKey.Key, cState); if (keys[0] == 271 && !MappedState.PS) MappedState.PS = getBoolMapping(customKey.Key, cState, eState);
if (keys[0] == 272 && !MappedState.L1) MappedState.L1 = getBoolMapping(customKey.Key, cState); if (keys[0] == 272 && !MappedState.L1) MappedState.L1 = getBoolMapping(customKey.Key, cState, eState);
if (keys[0] == 273 && !MappedState.R1) MappedState.R1 = getBoolMapping(customKey.Key, cState); if (keys[0] == 273 && !MappedState.R1) MappedState.R1 = getBoolMapping(customKey.Key, cState, eState);
if (keys[0] == 274 && MappedState.L2 == 0) MappedState.L2 = getByteMapping(customKey.Key, cState); if (keys[0] == 274 && MappedState.L2 == 0) MappedState.L2 = getByteMapping(customKey.Key, cState, eState);
if (keys[0] == 275 && MappedState.R2 == 0) MappedState.R2 = getByteMapping(customKey.Key, cState); if (keys[0] == 275 && MappedState.R2 == 0) MappedState.R2 = getByteMapping(customKey.Key, cState, eState);
if (keys[0] == 276 && !MappedState.L3) MappedState.L3 = getBoolMapping(customKey.Key, cState); if (keys[0] == 276 && !MappedState.L3) MappedState.L3 = getBoolMapping(customKey.Key, cState, eState);
if (keys[0] == 277 && !MappedState.R3) MappedState.R3 = getBoolMapping(customKey.Key, cState); if (keys[0] == 277 && !MappedState.R3) MappedState.R3 = getBoolMapping(customKey.Key, cState, eState);
if (keys[0] == 278 && LYChanged) MappedState.LY = getXYAxisMapping(customKey.Key, cState); if (keys[0] == 278 && LYChanged) MappedState.LY = getXYAxisMapping(customKey.Key, cState, eState);
if (keys[0] == 279 && LYChanged) MappedState.LY = getXYAxisMapping(customKey.Key, cState, true); if (keys[0] == 279 && LYChanged) MappedState.LY = getXYAxisMapping(customKey.Key, cState, eState, true);
if (keys[0] == 280 && LXChanged) MappedState.LX = getXYAxisMapping(customKey.Key, cState); if (keys[0] == 280 && LXChanged) MappedState.LX = getXYAxisMapping(customKey.Key, cState, eState);
if (keys[0] == 281 && LXChanged) MappedState.LX = getXYAxisMapping(customKey.Key, cState, true); if (keys[0] == 281 && LXChanged) MappedState.LX = getXYAxisMapping(customKey.Key, cState, eState, true);
if (keys[0] == 282 && RYChanged) MappedState.RY = getXYAxisMapping(customKey.Key, cState); if (keys[0] == 282 && RYChanged) MappedState.RY = getXYAxisMapping(customKey.Key, cState, eState);
if (keys[0] == 283 && RYChanged) MappedState.RY = getXYAxisMapping(customKey.Key, cState, true); if (keys[0] == 283 && RYChanged) MappedState.RY = getXYAxisMapping(customKey.Key, cState, eState, true);
if (keys[0] == 284 && RXChanged) MappedState.RX = getXYAxisMapping(customKey.Key, cState); if (keys[0] == 284 && RXChanged) MappedState.RX = getXYAxisMapping(customKey.Key, cState, eState);
if (keys[0] == 285 && RXChanged) MappedState.RX = getXYAxisMapping(customKey.Key, cState, true); if (keys[0] == 285 && RXChanged) MappedState.RX = getXYAxisMapping(customKey.Key, cState, eState, true);
} }
if (!macrodone[DS4ControltoInt(customKey.Key)]) if (!macrodone[DS4ControltoInt(customKey.Key)])
{ {
@ -569,13 +568,13 @@ namespace DS4Control
} }
} }
} }
else if (!getBoolMapping(customKey.Key, cState)) else if (!getBoolMapping(customKey.Key, cState, eState))
macrodone[DS4ControltoInt(customKey.Key)] = false; macrodone[DS4ControltoInt(customKey.Key)] = false;
} }
foreach (KeyValuePair<DS4Controls, ushort> customKey in Global.getCustomKeys(device)) foreach (KeyValuePair<DS4Controls, ushort> customKey in Global.getCustomKeys(device))
{ {
DS4KeyType keyType = Global.getCustomKeyType(device, customKey.Key); DS4KeyType keyType = Global.getCustomKeyType(device, customKey.Key);
if (getBoolMapping(customKey.Key, cState)) if (getBoolMapping(customKey.Key, cState, eState))
{ {
resetToDefaultValue(customKey.Key, MappedState); resetToDefaultValue(customKey.Key, MappedState);
SyntheticState.KeyPresses kp; SyntheticState.KeyPresses kp;
@ -626,7 +625,7 @@ namespace DS4Control
} }
if (keyType.HasFlag(DS4KeyType.Toggle)) if (keyType.HasFlag(DS4KeyType.Toggle))
{ {
if (getBoolMapping(customButton.Key, cState)) if (getBoolMapping(customButton.Key, cState, eState))
{ {
resetToDefaultValue(customButton.Key, MappedState); resetToDefaultValue(customButton.Key, MappedState);
if (!pressedonce[keyvalue]) if (!pressedonce[keyvalue])
@ -642,213 +641,216 @@ namespace DS4Control
pressedonce[keyvalue] = false; pressedonce[keyvalue] = false;
} }
} }
bool LXChanged = (Math.Abs(127 - MappedState.LX) < 5); bool LXChanged = Math.Abs(127 - MappedState.LX) <= 5;
bool LYChanged = (Math.Abs(127 - MappedState.LY) < 5); bool LYChanged = Math.Abs(127 - MappedState.LY) <= 5;
bool RXChanged = (Math.Abs(127 - MappedState.RX) < 5); bool RXChanged = Math.Abs(127 - MappedState.RX) <= 5;
bool RYChanged = (Math.Abs(127 - MappedState.RY) < 5); bool RYChanged = Math.Abs(127 - MappedState.RY) <= 5;
//once++;
resetToDefaultValue(customButton.Key, MappedState); // erase default mappings for things that are remapped resetToDefaultValue(customButton.Key, MappedState); // erase default mappings for things that are remapped
switch (customButton.Value) switch (customButton.Value)
{ {
case X360Controls.A: case X360Controls.A:
if (!MappedState.Cross) if (!MappedState.Cross)
MappedState.Cross = getBoolMapping(customButton.Key, cState); MappedState.Cross = getBoolMapping(customButton.Key, cState, eState);
break; break;
case X360Controls.B: case X360Controls.B:
if (!MappedState.Circle) if (!MappedState.Circle)
MappedState.Circle = getBoolMapping(customButton.Key, cState); MappedState.Circle = getBoolMapping(customButton.Key, cState, eState);
break; break;
case X360Controls.X: case X360Controls.X:
if (!MappedState.Square) if (!MappedState.Square)
MappedState.Square = getBoolMapping(customButton.Key, cState); MappedState.Square = getBoolMapping(customButton.Key, cState, eState);
break; break;
case X360Controls.Y: case X360Controls.Y:
if (!MappedState.Triangle) if (!MappedState.Triangle)
MappedState.Triangle = getBoolMapping(customButton.Key, cState); MappedState.Triangle = getBoolMapping(customButton.Key, cState, eState);
break; break;
case X360Controls.LB: case X360Controls.LB:
if (!MappedState.L1) if (!MappedState.L1)
MappedState.L1 = getBoolMapping(customButton.Key, cState); MappedState.L1 = getBoolMapping(customButton.Key, cState, eState);
break; break;
case X360Controls.LS: case X360Controls.LS:
if (!MappedState.L3) if (!MappedState.L3)
MappedState.L3 = getBoolMapping(customButton.Key, cState); MappedState.L3 = getBoolMapping(customButton.Key, cState, eState);
break; break;
case X360Controls.RB: case X360Controls.RB:
if (!MappedState.R1) if (!MappedState.R1)
MappedState.R1 = getBoolMapping(customButton.Key, cState); MappedState.R1 = getBoolMapping(customButton.Key, cState, eState);
break; break;
case X360Controls.RS: case X360Controls.RS:
if (!MappedState.R3) if (!MappedState.R3)
MappedState.R3 = getBoolMapping(customButton.Key, cState); MappedState.R3 = getBoolMapping(customButton.Key, cState, eState);
break; break;
case X360Controls.DpadUp: case X360Controls.DpadUp:
if (!MappedState.DpadUp) if (!MappedState.DpadUp)
MappedState.DpadUp = getBoolMapping(customButton.Key, cState); MappedState.DpadUp = getBoolMapping(customButton.Key, cState, eState);
break; break;
case X360Controls.DpadDown: case X360Controls.DpadDown:
if (!MappedState.DpadDown) if (!MappedState.DpadDown)
MappedState.DpadDown = getBoolMapping(customButton.Key, cState); MappedState.DpadDown = getBoolMapping(customButton.Key, cState, eState);
break; break;
case X360Controls.DpadLeft: case X360Controls.DpadLeft:
if (!MappedState.DpadLeft) if (!MappedState.DpadLeft)
MappedState.DpadLeft = getBoolMapping(customButton.Key, cState); MappedState.DpadLeft = getBoolMapping(customButton.Key, cState, eState);
break; break;
case X360Controls.DpadRight: case X360Controls.DpadRight:
if (!MappedState.DpadRight) if (!MappedState.DpadRight)
MappedState.DpadRight = getBoolMapping(customButton.Key, cState); MappedState.DpadRight = getBoolMapping(customButton.Key, cState, eState);
break; break;
case X360Controls.Guide: case X360Controls.Guide:
if (!MappedState.PS) if (!MappedState.PS)
MappedState.PS = getBoolMapping(customButton.Key, cState); MappedState.PS = getBoolMapping(customButton.Key, cState, eState);
break; break;
case X360Controls.Back: case X360Controls.Back:
if (!MappedState.Share) if (!MappedState.Share)
MappedState.Share = getBoolMapping(customButton.Key, cState); MappedState.Share = getBoolMapping(customButton.Key, cState, eState);
break; break;
case X360Controls.Start: case X360Controls.Start:
if (!MappedState.Options) if (!MappedState.Options)
MappedState.Options = getBoolMapping(customButton.Key, cState); MappedState.Options = getBoolMapping(customButton.Key, cState, eState);
break; break;
case X360Controls.LXNeg: case X360Controls.LXNeg:
if (LXChanged) if (LXChanged)
{ {
MappedState.LX = getXYAxisMapping(customButton.Key, cState); MappedState.LX = getXYAxisMapping(customButton.Key, cState, eState);
LX = true; LX = true;
} }
break; break;
case X360Controls.LYNeg: case X360Controls.LYNeg:
if (LYChanged) if (LYChanged)
{ {
MappedState.LY = getXYAxisMapping(customButton.Key, cState); MappedState.LY = getXYAxisMapping(customButton.Key, cState, eState);
LY = true; LY = true;
} }
break; break;
case X360Controls.RXNeg: case X360Controls.RXNeg:
if (RXChanged) if (RXChanged)
{ {
MappedState.RX = getXYAxisMapping(customButton.Key, cState); MappedState.RX = getXYAxisMapping(customButton.Key, cState, eState);
RX = true; if (MappedState.RX != 127)
RX = true;
} }
break; break;
case X360Controls.RYNeg: case X360Controls.RYNeg:
if (RYChanged) if (RYChanged)
{ {
MappedState.RY = getXYAxisMapping(customButton.Key, cState); MappedState.RY = getXYAxisMapping(customButton.Key, cState, eState);
RY = true; RY = true;
} }
break; break;
case X360Controls.LXPos: case X360Controls.LXPos:
if (LXChanged) if (LXChanged)
{ {
MappedState.LX = getXYAxisMapping(customButton.Key, cState, true); MappedState.LX = getXYAxisMapping(customButton.Key, cState, eState, true);
LX = true; //Console.WriteLine(MappedState.LX + "");
LX = true;
} }
break; break;
case X360Controls.LYPos: case X360Controls.LYPos:
if (LYChanged) if (LYChanged)
{ {
MappedState.LY = getXYAxisMapping(customButton.Key, cState, true); MappedState.LY = getXYAxisMapping(customButton.Key, cState, eState, true);
LY = true; //Console.WriteLine(MappedState.LY + "");
LY = true;
} }
break; break;
case X360Controls.RXPos: case X360Controls.RXPos:
if (RXChanged) if (RXChanged)
{ {
MappedState.RX = getXYAxisMapping(customButton.Key, cState, true); MappedState.RX = getXYAxisMapping(customButton.Key, cState, eState, true);
RX = true; RX = true;
} }
break; break;
case X360Controls.RYPos: case X360Controls.RYPos:
if (RYChanged) if (RYChanged)
{ {
MappedState.RY = getXYAxisMapping(customButton.Key, cState, true); MappedState.RY = getXYAxisMapping(customButton.Key, cState, eState, true);
RY = true; RY = true;
} }
break; break;
case X360Controls.LT: case X360Controls.LT:
if (MappedState.L2 == 0) if (MappedState.L2 == 0)
MappedState.L2 = getByteMapping(customButton.Key, cState); MappedState.L2 = getByteMapping(customButton.Key, cState, eState);
break; break;
case X360Controls.RT: case X360Controls.RT:
if (MappedState.R2 == 0) if (MappedState.R2 == 0)
MappedState.R2 = getByteMapping(customButton.Key, cState); MappedState.R2 = getByteMapping(customButton.Key, cState, eState);
break; break;
case X360Controls.LeftMouse: case X360Controls.LeftMouse:
if (getBoolMapping(customButton.Key, cState)) if (getBoolMapping(customButton.Key, cState, eState))
deviceState.currentClicks.leftCount++; deviceState.currentClicks.leftCount++;
break; break;
case X360Controls.RightMouse: case X360Controls.RightMouse:
if (getBoolMapping(customButton.Key, cState)) if (getBoolMapping(customButton.Key, cState, eState))
deviceState.currentClicks.rightCount++; deviceState.currentClicks.rightCount++;
break; break;
case X360Controls.MiddleMouse: case X360Controls.MiddleMouse:
if (getBoolMapping(customButton.Key, cState)) if (getBoolMapping(customButton.Key, cState, eState))
deviceState.currentClicks.middleCount++; deviceState.currentClicks.middleCount++;
break; break;
case X360Controls.FourthMouse: case X360Controls.FourthMouse:
if (getBoolMapping(customButton.Key, cState)) if (getBoolMapping(customButton.Key, cState, eState))
deviceState.currentClicks.fourthCount++; deviceState.currentClicks.fourthCount++;
break; break;
case X360Controls.FifthMouse: case X360Controls.FifthMouse:
if (getBoolMapping(customButton.Key, cState)) if (getBoolMapping(customButton.Key, cState, eState))
deviceState.currentClicks.fifthCount++; deviceState.currentClicks.fifthCount++;
break; break;
case X360Controls.WUP: case X360Controls.WUP:
if (getBoolMapping(customButton.Key, cState)) if (getBoolMapping(customButton.Key, cState, eState))
deviceState.currentClicks.wUpCount++; deviceState.currentClicks.wUpCount++;
break; break;
case X360Controls.WDOWN: case X360Controls.WDOWN:
if (getBoolMapping(customButton.Key, cState)) if (getBoolMapping(customButton.Key, cState, eState))
deviceState.currentClicks.wDownCount++; deviceState.currentClicks.wDownCount++;
break; break;
case X360Controls.MouseUp: case X360Controls.MouseUp:
if (MouseDeltaY == 0) if (MouseDeltaY == 0)
{ {
MouseDeltaY = getMouseMapping(device, customButton.Key, cState, 0); MouseDeltaY = getMouseMapping(device, customButton.Key, cState, eState, 0);
MouseDeltaY = -Math.Abs((MouseDeltaY == -2147483648 ? 0 : MouseDeltaY)); MouseDeltaY = -Math.Abs((MouseDeltaY == -2147483648 ? 0 : MouseDeltaY));
} }
break; break;
case X360Controls.MouseDown: case X360Controls.MouseDown:
if (MouseDeltaY == 0) if (MouseDeltaY == 0)
{ {
MouseDeltaY = getMouseMapping(device, customButton.Key, cState, 1); MouseDeltaY = getMouseMapping(device, customButton.Key, cState, eState, 1);
MouseDeltaY = Math.Abs((MouseDeltaY == -2147483648 ? 0 : MouseDeltaY)); MouseDeltaY = Math.Abs((MouseDeltaY == -2147483648 ? 0 : MouseDeltaY));
} }
break; break;
case X360Controls.MouseLeft: case X360Controls.MouseLeft:
if (MouseDeltaX == 0) if (MouseDeltaX == 0)
{ {
MouseDeltaX = getMouseMapping(device, customButton.Key, cState, 2); MouseDeltaX = getMouseMapping(device, customButton.Key, cState, eState, 2);
MouseDeltaX = -Math.Abs((MouseDeltaX == -2147483648 ? 0 : MouseDeltaX)); MouseDeltaX = -Math.Abs((MouseDeltaX == -2147483648 ? 0 : MouseDeltaX));
} }
break; break;
case X360Controls.MouseRight: case X360Controls.MouseRight:
if (MouseDeltaX == 0) if (MouseDeltaX == 0)
{ {
MouseDeltaX = getMouseMapping(device, customButton.Key, cState, 3); MouseDeltaX = getMouseMapping(device, customButton.Key, cState, eState, 3);
MouseDeltaX = Math.Abs((MouseDeltaX == -2147483648 ? 0 : MouseDeltaX)); MouseDeltaX = Math.Abs((MouseDeltaX == -2147483648 ? 0 : MouseDeltaX));
} }
break; break;
} }
} }
//Console.WriteLine(MappedState.LY + " " + LY);
if (!LX) //if (!LX)
if (Math.Abs(127 - MappedState.LX) <= 5)// || (Math.Abs(127 - cState.LX) > 5))
MappedState.LX = cState.LX; MappedState.LX = cState.LX;
if (!LY) if (Math.Abs(127 - MappedState.LY) <= 5)
MappedState.LY = cState.LY; MappedState.LY = cState.LY;
if (!RX) if (Math.Abs(127 - MappedState.RX) <= 5)
MappedState.RX = cState.RX; MappedState.RX = cState.RX;
if (!RY) if (Math.Abs(127 - MappedState.RY) <= 5)
MappedState.RY = cState.RY; MappedState.RY = cState.RY;
/*if (!L2)
MappedState.L2 = cState.L2;
if (!R2)
MappedState.R2 = cState.R2;//*/
InputMethods.MoveCursorBy(MouseDeltaX, MouseDeltaY); InputMethods.MoveCursorBy(MouseDeltaX, MouseDeltaY);
} }
public static DateTime[] mousenow = { DateTime.UtcNow, DateTime.UtcNow, DateTime.UtcNow, DateTime.UtcNow }; public static DateTime[] mousenow = { DateTime.UtcNow, DateTime.UtcNow, DateTime.UtcNow, DateTime.UtcNow };
public static double mvalue = 0; public static double mvalue = 0;
private static int getMouseMapping(int device, DS4Controls control, DS4State cState, int mnum) private static int getMouseMapping(int device, DS4Controls control, DS4State cState, DS4StateExposed eState, int mnum)
{ {
int deadzone = 10; int deadzone = 10;
@ -909,9 +911,18 @@ namespace DS4Control
case DS4Controls.L2: value = Math.Pow(root + speed / divide, cState.L2 / 2d) - 1; break; case DS4Controls.L2: value = Math.Pow(root + speed / divide, cState.L2 / 2d) - 1; break;
case DS4Controls.R2: value = Math.Pow(root + speed / divide, cState.R2 / 2d) - 1; break; case DS4Controls.R2: value = Math.Pow(root + speed / divide, cState.R2 / 2d) - 1; break;
} }
//if (value != 0) if (eState != null)
//mvalue = value; switch (control)
{
case DS4Controls.GyroXPos: return (byte)(eState.GyroX > 1800 ?
Math.Pow(root + speed / divide, eState.GyroX / 48) : 0);
case DS4Controls.GyroXNeg: return (byte)(eState.GyroX < -1800 ?
Math.Pow(root + speed / divide, -eState.GyroX / 48) : 0);
case DS4Controls.GyroZPos: return (byte)(eState.GyroZ > 1800 ?
Math.Pow(root + speed / divide, eState.GyroZ / 48) : 0);
case DS4Controls.GyroZNeg: return (byte)(eState.GyroZ < -1800 ?
Math.Pow(root + speed / divide, -eState.GyroZ / 48) : 0);
}
bool LXChanged = (Math.Abs(127 - cState.LX) < deadzone); bool LXChanged = (Math.Abs(127 - cState.LX) < deadzone);
bool LYChanged = (Math.Abs(127 - cState.LY) < deadzone); bool LYChanged = (Math.Abs(127 - cState.LY) < deadzone);
bool RXChanged = (Math.Abs(127 - cState.RX) < deadzone); bool RXChanged = (Math.Abs(127 - cState.RX) < deadzone);
@ -943,7 +954,7 @@ namespace DS4Control
static bool[] touchArea = { true, true, true, true }; static bool[] touchArea = { true, true, true, true };
public static byte getByteMapping(DS4Controls control, DS4State cState) public static byte getByteMapping(DS4Controls control, DS4State cState, DS4StateExposed eState)
{ {
if (!cState.TouchButton) if (!cState.TouchButton)
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
@ -987,6 +998,14 @@ namespace DS4Control
case DS4Controls.L2: return (byte)cState.L2; case DS4Controls.L2: return (byte)cState.L2;
case DS4Controls.R2: return (byte)cState.R2; case DS4Controls.R2: return (byte)cState.R2;
} }
if (eState != null)
switch (control)
{
case DS4Controls.GyroXPos: return (byte)(eState.GyroX > 1800 ? Math.Min(255, eState.GyroX / 24) : 0);
case DS4Controls.GyroXNeg: return (byte)(eState.GyroX < -1800 ? Math.Min(255,-eState.GyroX / 24) : 0);
case DS4Controls.GyroZPos: return (byte)(eState.GyroZ > 1800 ? Math.Min(255, eState.GyroZ / 24) : 0);
case DS4Controls.GyroZNeg: return (byte)(eState.GyroZ < -1800 ? Math.Min(255, -eState.GyroZ / 24) : 0);
}
if (cState.TouchButton) if (cState.TouchButton)
{ {
if (control == DS4Controls.TouchMulti) if (control == DS4Controls.TouchMulti)
@ -1004,7 +1023,7 @@ namespace DS4Control
} }
return 0; return 0;
} }
public static bool getBoolMapping(DS4Controls control, DS4State cState) public static bool getBoolMapping(DS4Controls control, DS4State cState, DS4StateExposed eState)
{ {
if (!cState.TouchButton) if (!cState.TouchButton)
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
@ -1047,8 +1066,15 @@ namespace DS4Control
case DS4Controls.RYPos: return cState.RY > 127 + 55; case DS4Controls.RYPos: return cState.RY > 127 + 55;
case DS4Controls.L2: return cState.L2 > 100; case DS4Controls.L2: return cState.L2 > 100;
case DS4Controls.R2: return cState.R2 > 100; case DS4Controls.R2: return cState.R2 > 100;
} }
if (eState != null)
switch (control)
{
case DS4Controls.GyroXPos: return eState.GyroX > 5000;
case DS4Controls.GyroXNeg: return eState.GyroX < -5000;
case DS4Controls.GyroZPos: return eState.GyroZ > 5000;
case DS4Controls.GyroZNeg: return eState.GyroZ < -5000;
}
if (cState.TouchButton) if (cState.TouchButton)
{ {
if (control == DS4Controls.TouchMulti) if (control == DS4Controls.TouchMulti)
@ -1067,14 +1093,12 @@ namespace DS4Control
return false; return false;
} }
public static byte getXYAxisMapping(DS4Controls control, DS4State cState, bool alt = false) public static byte getXYAxisMapping(DS4Controls control, DS4State cState, DS4StateExposed eState, bool alt = false)
{ {
byte trueVal = 0; byte trueVal = 0;
byte falseVal = 127; byte falseVal = 127;
if (alt) if (alt)
{
trueVal = 255; trueVal = 255;
}
if (!cState.TouchButton) if (!cState.TouchButton)
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
touchArea[i] = false; touchArea[i] = false;
@ -1106,10 +1130,28 @@ namespace DS4Control
case DS4Controls.Square: return (byte)(cState.Square ? trueVal : falseVal); case DS4Controls.Square: return (byte)(cState.Square ? trueVal : falseVal);
case DS4Controls.Triangle: return (byte)(cState.Triangle ? trueVal : falseVal); case DS4Controls.Triangle: return (byte)(cState.Triangle ? trueVal : falseVal);
case DS4Controls.Circle: return (byte)(cState.Circle ? trueVal : falseVal); case DS4Controls.Circle: return (byte)(cState.Circle ? trueVal : falseVal);
case DS4Controls.L2: return (byte)(cState.L2 == 255 ? trueVal : falseVal); case DS4Controls.L2: if (alt) return (byte)(127 + cState.L2 / 2); else return (byte)(127 - cState.L2 / 2);
case DS4Controls.R2: return (byte)(cState.R2 == 255 ? trueVal : falseVal); case DS4Controls.R2: if (alt) return (byte)(127 + cState.R2 / 2); else return (byte)(127 - cState.R2 / 2);
}
if (eState != null)
{
switch (control)
{
case DS4Controls.GyroXPos: if (eState.GyroX > 1800)
if (alt) return (byte)Math.Min(255, 127 + eState.GyroX / 48); else return (byte)Math.Max(0, 127 - eState.GyroX / 48);
else return falseVal;
case DS4Controls.GyroXNeg: if (eState.GyroX < -1800)
if (alt) return (byte)Math.Min(255, 127 + -eState.GyroX / 48); else return (byte)Math.Max(0, 127 - -eState.GyroX / 48);
else return falseVal;
case DS4Controls.GyroZPos: if (eState.GyroZ > 1800)
if (alt) return (byte)Math.Min(255, 127 + eState.GyroZ / 48); else return (byte)Math.Max(0, 127 - eState.GyroZ / 48);
else return falseVal;
case DS4Controls.GyroZNeg: if (eState.GyroZ < -1800)
if (alt) return (byte)Math.Min(255, 127 + -eState.GyroZ / 48); else return (byte)Math.Max(0, 127 - -eState.GyroZ / 48);
else return falseVal;
}
//Console.Write(eState.GyroX.ToString());
} }
if (!alt) if (!alt)
{ {
switch (control) switch (control)

View File

@ -115,7 +115,7 @@ namespace DS4Control
private DS4State remapped = new DS4State(); private DS4State remapped = new DS4State();
private void synthesizeMouseButtons() private void synthesizeMouseButtons()
{ {
Mapping.MapCustom(deviceNum, s, remapped); Mapping.MapCustom(deviceNum, s, remapped, null);
if (leftDown) if (leftDown)
Mapping.MapTouchpadButton(deviceNum, DS4Controls.TouchLeft, Mapping.Click.Left, remapped); Mapping.MapTouchpadButton(deviceNum, DS4Controls.TouchLeft, Mapping.Click.Left, remapped);
if (upperDown) if (upperDown)

View File

@ -13,7 +13,7 @@ namespace DS4Control
[Flags] [Flags]
public enum DS4KeyType : byte { None = 0, ScanCode = 1, Toggle = 2, Unbound = 4, Macro = 8, HoldMacro = 16, RepeatMacro = 32 }; //Increment by exponents of 2*, starting at 2^0 public enum DS4KeyType : byte { None = 0, ScanCode = 1, Toggle = 2, Unbound = 4, Macro = 8, HoldMacro = 16, RepeatMacro = 32 }; //Increment by exponents of 2*, starting at 2^0
public enum Ds3PadId : byte { None = 0xFF, One = 0x00, Two = 0x01, Three = 0x02, Four = 0x03, All = 0x04 }; public enum Ds3PadId : byte { None = 0xFF, One = 0x00, Two = 0x01, Three = 0x02, Four = 0x03, All = 0x04 };
public enum DS4Controls : byte { None, LXNeg, LXPos, LYNeg, LYPos, RXNeg, RXPos, RYNeg, RYPos, L1, L2, L3, R1, R2, R3, Square, Triangle, Circle, Cross, DpadUp, DpadRight, DpadDown, DpadLeft, PS, TouchLeft, TouchUpper, TouchMulti, TouchRight, Share, Options }; public enum DS4Controls : byte { None, LXNeg, LXPos, LYNeg, LYPos, RXNeg, RXPos, RYNeg, RYPos, L1, L2, L3, R1, R2, R3, Square, Triangle, Circle, Cross, DpadUp, DpadRight, DpadDown, DpadLeft, PS, TouchLeft, TouchUpper, TouchMulti, TouchRight, Share, Options, GyroXPos, GyroXNeg, GyroZPos, GyroZNeg };
public enum X360Controls : byte { None, LXNeg, LXPos, LYNeg, LYPos, RXNeg, RXPos, RYNeg, RYPos, LB, LT, LS, RB, RT, RS, X, Y, B, A, DpadUp, DpadRight, DpadDown, DpadLeft, Guide, Back, Start, LeftMouse, RightMouse, MiddleMouse, FourthMouse, FifthMouse, WUP, WDOWN, MouseUp, MouseDown, MouseLeft, MouseRight, Unbound }; public enum X360Controls : byte { None, LXNeg, LXPos, LYNeg, LYPos, RXNeg, RXPos, RYNeg, RYPos, LB, LT, LS, RB, RT, RS, X, Y, B, A, DpadUp, DpadRight, DpadDown, DpadLeft, Guide, Back, Start, LeftMouse, RightMouse, MiddleMouse, FourthMouse, FifthMouse, WUP, WDOWN, MouseUp, MouseDown, MouseLeft, MouseRight, Unbound };
public class DebugEventArgs : EventArgs public class DebugEventArgs : EventArgs
@ -836,6 +836,10 @@ namespace DS4Control
case "bnTouchMulti": return DS4Controls.TouchMulti; case "bnTouchMulti": return DS4Controls.TouchMulti;
case "bnTouchUpper": return DS4Controls.TouchUpper; case "bnTouchUpper": return DS4Controls.TouchUpper;
case "bnTouchRight": return DS4Controls.TouchRight; case "bnTouchRight": return DS4Controls.TouchRight;
case "bnGyroXP": return DS4Controls.GyroXPos;
case "bnGyroXN": return DS4Controls.GyroXNeg;
case "bnGyroZP": return DS4Controls.GyroZPos;
case "bnGyroZN": return DS4Controls.GyroZNeg;
} }
return 0; return 0;
} }

View File

@ -67,6 +67,7 @@
this.label30 = new System.Windows.Forms.Label(); this.label30 = new System.Windows.Forms.Label();
this.label31 = new System.Windows.Forms.Label(); this.label31 = new System.Windows.Forms.Label();
this.lLChangelog = new System.Windows.Forms.LinkLabel(); this.lLChangelog = new System.Windows.Forms.LinkLabel();
this.linkDonate = new System.Windows.Forms.LinkLabel();
this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -153,7 +154,7 @@
// label23 // label23
// //
this.label23.AutoSize = true; this.label23.AutoSize = true;
this.label23.Location = new System.Drawing.Point(458, 9); this.label23.Location = new System.Drawing.Point(6, 333);
this.label23.Name = "label23"; this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(58, 13); this.label23.Size = new System.Drawing.Size(58, 13);
this.label23.TabIndex = 3; this.label23.TabIndex = 3;
@ -497,6 +498,17 @@
this.lLChangelog.Text = "Changelog"; this.lLChangelog.Text = "Changelog";
this.lLChangelog.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lLChangelog_LinkClicked); this.lLChangelog.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lLChangelog_LinkClicked);
// //
// linkDonate
//
this.linkDonate.AutoSize = true;
this.linkDonate.Location = new System.Drawing.Point(422, 9);
this.linkDonate.Name = "linkDonate";
this.linkDonate.Size = new System.Drawing.Size(94, 13);
this.linkDonate.TabIndex = 21;
this.linkDonate.TabStop = true;
this.linkDonate.Text = "Donate via Paypal";
this.linkDonate.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkDonate_LinkClicked);
//
// Hotkeys // Hotkeys
// //
this.AcceptButton = this.button1; this.AcceptButton = this.button1;
@ -504,6 +516,7 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.button1; this.CancelButton = this.button1;
this.ClientSize = new System.Drawing.Size(520, 413); this.ClientSize = new System.Drawing.Size(520, 413);
this.Controls.Add(this.linkDonate);
this.Controls.Add(this.lLChangelog); this.Controls.Add(this.lLChangelog);
this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.tableLayoutPanel1);
this.Controls.Add(this.linkJhebbel); this.Controls.Add(this.linkJhebbel);
@ -567,5 +580,6 @@
private System.Windows.Forms.Label label30; private System.Windows.Forms.Label label30;
private System.Windows.Forms.Label label31; private System.Windows.Forms.Label label31;
private System.Windows.Forms.LinkLabel lLChangelog; private System.Windows.Forms.LinkLabel lLChangelog;
private System.Windows.Forms.LinkLabel linkDonate;
} }
} }

View File

@ -44,7 +44,7 @@ namespace ScpServer
private void linkJhebbel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) private void linkJhebbel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{ {
System.Diagnostics.Process.Start("https://code.google.com/r/jhebbel-ds4tool/source/browse/"); System.Diagnostics.Process.Start("http://dsdcs.com/index.php/portfolio/software-development/4-ds4windows");
} }
private void lLChangelog_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) private void lLChangelog_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
@ -52,5 +52,10 @@ namespace ScpServer
System.Diagnostics.Process.Start("https://docs.google.com/document/d/1l4xcgVQkGUskc5CQ0p069yW22Cd5WAH_yE3Fz2hXo0E/edit?usp=sharing"); System.Diagnostics.Process.Start("https://docs.google.com/document/d/1l4xcgVQkGUskc5CQ0p069yW22Cd5WAH_yE3Fz2hXo0E/edit?usp=sharing");
} }
private void linkDonate_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=2FTZ9BZEHSQ8Q&lc=US&item_name=DS4Windows&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted");
}
} }
} }

View File

@ -120,6 +120,7 @@
this.FullPanel = new System.Windows.Forms.Panel(); this.FullPanel = new System.Windows.Forms.Panel();
this.lowBatteryPanel = new System.Windows.Forms.Panel(); this.lowBatteryPanel = new System.Windows.Forms.Panel();
this.SixaxisPanel = new System.Windows.Forms.Panel(); this.SixaxisPanel = new System.Windows.Forms.Panel();
this.bnGyroZP = new System.Windows.Forms.Button();
this.lBProfileTip = new System.Windows.Forms.Label(); this.lBProfileTip = new System.Windows.Forms.Label();
this.tBProfile = new System.Windows.Forms.TextBox(); this.tBProfile = new System.Windows.Forms.TextBox();
this.btnSaveProfile = new System.Windows.Forms.Button(); this.btnSaveProfile = new System.Windows.Forms.Button();
@ -147,6 +148,10 @@
this.gBRumble = new System.Windows.Forms.GroupBox(); this.gBRumble = new System.Windows.Forms.GroupBox();
this.gBDeadzone = new System.Windows.Forms.GroupBox(); this.gBDeadzone = new System.Windows.Forms.GroupBox();
this.btnCancel = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button();
this.bnGyroXP = new System.Windows.Forms.Button();
this.bnGyroXN = new System.Windows.Forms.Button();
this.bnGyroZN = new System.Windows.Forms.Button();
this.fLPTiltControls = new System.Windows.Forms.FlowLayoutPanel();
this.advColorDialog = new ScpServer.AdvancedColorDialog(); this.advColorDialog = new ScpServer.AdvancedColorDialog();
this.MainPanel.SuspendLayout(); this.MainPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pBController)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pBController)).BeginInit();
@ -188,6 +193,7 @@
((System.ComponentModel.ISupportInitialize)(this.nUDflashLED)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDflashLED)).BeginInit();
this.gBRumble.SuspendLayout(); this.gBRumble.SuspendLayout();
this.gBDeadzone.SuspendLayout(); this.gBDeadzone.SuspendLayout();
this.fLPTiltControls.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// bnTouchUpper // bnTouchUpper
@ -893,7 +899,7 @@
// lBControlTip // lBControlTip
// //
this.lBControlTip.AutoSize = true; this.lBControlTip.AutoSize = true;
this.lBControlTip.Location = new System.Drawing.Point(25, 9); this.lBControlTip.Location = new System.Drawing.Point(25, 3);
this.lBControlTip.Name = "lBControlTip"; this.lBControlTip.Name = "lBControlTip";
this.lBControlTip.Size = new System.Drawing.Size(219, 26); this.lBControlTip.Size = new System.Drawing.Size(219, 26);
this.lBControlTip.TabIndex = 181; this.lBControlTip.TabIndex = 181;
@ -933,7 +939,11 @@
"Right Stick Up :", "Right Stick Up :",
"Right Stick Down :", "Right Stick Down :",
"Right Stick Left :", "Right Stick Left :",
"Right Stick Right :"}); "Right Stick Right :",
"Sixaxis Up :",
"Sixaxis Down :",
"Sixaxis Left :",
"Sixaxis Right :"});
this.lBControls.Location = new System.Drawing.Point(258, 9); this.lBControls.Location = new System.Drawing.Point(258, 9);
this.lBControls.Name = "lBControls"; this.lBControls.Name = "lBControls";
this.lBControls.Size = new System.Drawing.Size(169, 173); this.lBControls.Size = new System.Drawing.Size(169, 173);
@ -1252,7 +1262,7 @@
// nUDIdleDisconnect // nUDIdleDisconnect
// //
this.nUDIdleDisconnect.DecimalPlaces = 1; this.nUDIdleDisconnect.DecimalPlaces = 1;
this.nUDIdleDisconnect.Location = new System.Drawing.Point(108, 46); this.nUDIdleDisconnect.Location = new System.Drawing.Point(109, 46);
this.nUDIdleDisconnect.Maximum = new decimal(new int[] { this.nUDIdleDisconnect.Maximum = new decimal(new int[] {
60, 60,
0, 0,
@ -1286,8 +1296,7 @@
// //
this.tBsixaxisAccelZ.AutoSize = false; this.tBsixaxisAccelZ.AutoSize = false;
this.tBsixaxisAccelZ.BackColor = System.Drawing.Color.White; this.tBsixaxisAccelZ.BackColor = System.Drawing.Color.White;
this.tBsixaxisAccelZ.Enabled = false; this.tBsixaxisAccelZ.Location = new System.Drawing.Point(315, 3);
this.tBsixaxisAccelZ.Location = new System.Drawing.Point(382, 6);
this.tBsixaxisAccelZ.Maximum = 32767; this.tBsixaxisAccelZ.Maximum = 32767;
this.tBsixaxisAccelZ.Minimum = -32768; this.tBsixaxisAccelZ.Minimum = -32768;
this.tBsixaxisAccelZ.Name = "tBsixaxisAccelZ"; this.tBsixaxisAccelZ.Name = "tBsixaxisAccelZ";
@ -1312,8 +1321,7 @@
// //
this.tBsixaxisAccelY.AutoSize = false; this.tBsixaxisAccelY.AutoSize = false;
this.tBsixaxisAccelY.BackColor = System.Drawing.Color.White; this.tBsixaxisAccelY.BackColor = System.Drawing.Color.White;
this.tBsixaxisAccelY.Enabled = false; this.tBsixaxisAccelY.Location = new System.Drawing.Point(268, 3);
this.tBsixaxisAccelY.Location = new System.Drawing.Point(335, 6);
this.tBsixaxisAccelY.Maximum = 32767; this.tBsixaxisAccelY.Maximum = 32767;
this.tBsixaxisAccelY.Minimum = -32768; this.tBsixaxisAccelY.Minimum = -32768;
this.tBsixaxisAccelY.Name = "tBsixaxisAccelY"; this.tBsixaxisAccelY.Name = "tBsixaxisAccelY";
@ -1334,8 +1342,7 @@
// //
this.tBsixaxisAccelX.AutoSize = false; this.tBsixaxisAccelX.AutoSize = false;
this.tBsixaxisAccelX.BackColor = System.Drawing.Color.White; this.tBsixaxisAccelX.BackColor = System.Drawing.Color.White;
this.tBsixaxisAccelX.Enabled = false; this.tBsixaxisAccelX.Location = new System.Drawing.Point(222, 3);
this.tBsixaxisAccelX.Location = new System.Drawing.Point(289, 6);
this.tBsixaxisAccelX.Maximum = 32767; this.tBsixaxisAccelX.Maximum = 32767;
this.tBsixaxisAccelX.Minimum = -32768; this.tBsixaxisAccelX.Minimum = -32768;
this.tBsixaxisAccelX.Name = "tBsixaxisAccelX"; this.tBsixaxisAccelX.Name = "tBsixaxisAccelX";
@ -1356,8 +1363,7 @@
// //
this.tBsixaxisGyroZ.AutoSize = false; this.tBsixaxisGyroZ.AutoSize = false;
this.tBsixaxisGyroZ.BackColor = System.Drawing.Color.White; this.tBsixaxisGyroZ.BackColor = System.Drawing.Color.White;
this.tBsixaxisGyroZ.Enabled = false; this.tBsixaxisGyroZ.Location = new System.Drawing.Point(96, 3);
this.tBsixaxisGyroZ.Location = new System.Drawing.Point(163, 6);
this.tBsixaxisGyroZ.Maximum = 32767; this.tBsixaxisGyroZ.Maximum = 32767;
this.tBsixaxisGyroZ.Minimum = -32768; this.tBsixaxisGyroZ.Minimum = -32768;
this.tBsixaxisGyroZ.Name = "tBsixaxisGyroZ"; this.tBsixaxisGyroZ.Name = "tBsixaxisGyroZ";
@ -1378,8 +1384,7 @@
// //
this.tBsixaxisGyroY.AutoSize = false; this.tBsixaxisGyroY.AutoSize = false;
this.tBsixaxisGyroY.BackColor = System.Drawing.Color.White; this.tBsixaxisGyroY.BackColor = System.Drawing.Color.White;
this.tBsixaxisGyroY.Enabled = false; this.tBsixaxisGyroY.Location = new System.Drawing.Point(49, 3);
this.tBsixaxisGyroY.Location = new System.Drawing.Point(116, 6);
this.tBsixaxisGyroY.Maximum = 32767; this.tBsixaxisGyroY.Maximum = 32767;
this.tBsixaxisGyroY.Minimum = -32768; this.tBsixaxisGyroY.Minimum = -32768;
this.tBsixaxisGyroY.Name = "tBsixaxisGyroY"; this.tBsixaxisGyroY.Name = "tBsixaxisGyroY";
@ -1391,8 +1396,7 @@
// //
this.tBsixaxisGyroX.AutoSize = false; this.tBsixaxisGyroX.AutoSize = false;
this.tBsixaxisGyroX.BackColor = System.Drawing.Color.White; this.tBsixaxisGyroX.BackColor = System.Drawing.Color.White;
this.tBsixaxisGyroX.Enabled = false; this.tBsixaxisGyroX.Location = new System.Drawing.Point(2, 3);
this.tBsixaxisGyroX.Location = new System.Drawing.Point(69, 6);
this.tBsixaxisGyroX.Maximum = 32767; this.tBsixaxisGyroX.Maximum = 32767;
this.tBsixaxisGyroX.Minimum = -32768; this.tBsixaxisGyroX.Minimum = -32768;
this.tBsixaxisGyroX.Name = "tBsixaxisGyroX"; this.tBsixaxisGyroX.Name = "tBsixaxisGyroX";
@ -1421,7 +1425,7 @@
// lB6Accel // lB6Accel
// //
this.lB6Accel.AutoSize = true; this.lB6Accel.AutoSize = true;
this.lB6Accel.Location = new System.Drawing.Point(220, 6); this.lB6Accel.Location = new System.Drawing.Point(153, 3);
this.lB6Accel.Name = "lB6Accel"; this.lB6Accel.Name = "lB6Accel";
this.lB6Accel.Size = new System.Drawing.Size(72, 13); this.lB6Accel.Size = new System.Drawing.Size(72, 13);
this.lB6Accel.TabIndex = 215; this.lB6Accel.TabIndex = 215;
@ -1443,11 +1447,12 @@
// lB6Gryo // lB6Gryo
// //
this.lB6Gryo.AutoSize = true; this.lB6Gryo.AutoSize = true;
this.lB6Gryo.Location = new System.Drawing.Point(5, 6); this.lB6Gryo.Location = new System.Drawing.Point(4, 197);
this.lB6Gryo.Name = "lB6Gryo"; this.lB6Gryo.Name = "lB6Gryo";
this.lB6Gryo.Size = new System.Drawing.Size(67, 13); this.lB6Gryo.Size = new System.Drawing.Size(67, 13);
this.lB6Gryo.TabIndex = 216; this.lB6Gryo.TabIndex = 216;
this.lB6Gryo.Text = "Sixaxis Gyro:"; this.lB6Gryo.Text = "Sixaxis Gyro:";
this.lB6Gryo.MouseClick += new System.Windows.Forms.MouseEventHandler(this.lB6Gryo_MouseClick);
// //
// nUDLightRumble // nUDLightRumble
// //
@ -1597,17 +1602,27 @@
// SixaxisPanel // SixaxisPanel
// //
this.SixaxisPanel.Controls.Add(this.tBsixaxisAccelX); this.SixaxisPanel.Controls.Add(this.tBsixaxisAccelX);
this.SixaxisPanel.Controls.Add(this.lB6Gryo);
this.SixaxisPanel.Controls.Add(this.lB6Accel); this.SixaxisPanel.Controls.Add(this.lB6Accel);
this.SixaxisPanel.Controls.Add(this.tBsixaxisGyroX); this.SixaxisPanel.Controls.Add(this.tBsixaxisGyroX);
this.SixaxisPanel.Controls.Add(this.tBsixaxisGyroY); this.SixaxisPanel.Controls.Add(this.tBsixaxisGyroY);
this.SixaxisPanel.Controls.Add(this.tBsixaxisGyroZ); this.SixaxisPanel.Controls.Add(this.tBsixaxisGyroZ);
this.SixaxisPanel.Controls.Add(this.tBsixaxisAccelY); this.SixaxisPanel.Controls.Add(this.tBsixaxisAccelY);
this.SixaxisPanel.Controls.Add(this.tBsixaxisAccelZ); this.SixaxisPanel.Controls.Add(this.tBsixaxisAccelZ);
this.SixaxisPanel.Location = new System.Drawing.Point(1, 193); this.SixaxisPanel.Location = new System.Drawing.Point(70, 195);
this.SixaxisPanel.Name = "SixaxisPanel"; this.SixaxisPanel.Name = "SixaxisPanel";
this.SixaxisPanel.Size = new System.Drawing.Size(435, 27); this.SixaxisPanel.Size = new System.Drawing.Size(371, 28);
this.SixaxisPanel.TabIndex = 236; this.SixaxisPanel.TabIndex = 236;
this.SixaxisPanel.Visible = false;
//
// bnGyroZP
//
this.bnGyroZP.Location = new System.Drawing.Point(89, 3);
this.bnGyroZP.Name = "bnGyroZP";
this.bnGyroZP.Size = new System.Drawing.Size(80, 23);
this.bnGyroZP.TabIndex = 250;
this.bnGyroZP.Text = "Tilt Down";
this.bnGyroZP.UseVisualStyleBackColor = true;
this.bnGyroZP.Click += new System.EventHandler(this.Show_ControlsBn);
// //
// lBProfileTip // lBProfileTip
// //
@ -1991,6 +2006,47 @@
this.btnCancel.Visible = false; this.btnCancel.Visible = false;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
// //
// bnGyroXP
//
this.bnGyroXP.Location = new System.Drawing.Point(175, 3);
this.bnGyroXP.Name = "bnGyroXP";
this.bnGyroXP.Size = new System.Drawing.Size(80, 23);
this.bnGyroXP.TabIndex = 250;
this.bnGyroXP.Text = "Tilt Left";
this.bnGyroXP.UseVisualStyleBackColor = true;
this.bnGyroXP.Click += new System.EventHandler(this.Show_ControlsBn);
//
// bnGyroXN
//
this.bnGyroXN.Location = new System.Drawing.Point(261, 3);
this.bnGyroXN.Name = "bnGyroXN";
this.bnGyroXN.Size = new System.Drawing.Size(80, 23);
this.bnGyroXN.TabIndex = 250;
this.bnGyroXN.Text = "Tilt Right";
this.bnGyroXN.UseVisualStyleBackColor = true;
this.bnGyroXN.Click += new System.EventHandler(this.Show_ControlsBn);
//
// bnGyroZN
//
this.bnGyroZN.Location = new System.Drawing.Point(3, 3);
this.bnGyroZN.Name = "bnGyroZN";
this.bnGyroZN.Size = new System.Drawing.Size(80, 23);
this.bnGyroZN.TabIndex = 250;
this.bnGyroZN.Text = "Tilt Up";
this.bnGyroZN.UseVisualStyleBackColor = true;
this.bnGyroZN.Click += new System.EventHandler(this.Show_ControlsBn);
//
// fLPTiltControls
//
this.fLPTiltControls.Controls.Add(this.bnGyroZN);
this.fLPTiltControls.Controls.Add(this.bnGyroZP);
this.fLPTiltControls.Controls.Add(this.bnGyroXP);
this.fLPTiltControls.Controls.Add(this.bnGyroXN);
this.fLPTiltControls.Location = new System.Drawing.Point(84, 190);
this.fLPTiltControls.Name = "fLPTiltControls";
this.fLPTiltControls.Size = new System.Drawing.Size(350, 31);
this.fLPTiltControls.TabIndex = 252;
//
// advColorDialog // advColorDialog
// //
this.advColorDialog.AnyColor = true; this.advColorDialog.AnyColor = true;
@ -2006,11 +2062,11 @@
this.CancelButton = this.btnCancel; this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(888, 295); this.ClientSize = new System.Drawing.Size(888, 295);
this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnCancel);
this.Controls.Add(this.lB6Gryo);
this.Controls.Add(this.gBDeadzone); this.Controls.Add(this.gBDeadzone);
this.Controls.Add(this.gBRumble); this.Controls.Add(this.gBRumble);
this.Controls.Add(this.gBLightbar); this.Controls.Add(this.gBLightbar);
this.Controls.Add(this.gBTouchpad); this.Controls.Add(this.gBTouchpad);
this.Controls.Add(this.SixaxisPanel);
this.Controls.Add(this.lBProfileTip); this.Controls.Add(this.lBProfileTip);
this.Controls.Add(this.tBProfile); this.Controls.Add(this.tBProfile);
this.Controls.Add(this.btnSaveProfile); this.Controls.Add(this.btnSaveProfile);
@ -2019,6 +2075,8 @@
this.Controls.Add(this.MainPanel); this.Controls.Add(this.MainPanel);
this.Controls.Add(this.SticksPanel); this.Controls.Add(this.SticksPanel);
this.Controls.Add(this.gBOther); this.Controls.Add(this.gBOther);
this.Controls.Add(this.fLPTiltControls);
this.Controls.Add(this.SixaxisPanel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false; this.MaximizeBox = false;
this.MinimizeBox = false; this.MinimizeBox = false;
@ -2074,6 +2132,7 @@
this.gBRumble.PerformLayout(); this.gBRumble.PerformLayout();
this.gBDeadzone.ResumeLayout(false); this.gBDeadzone.ResumeLayout(false);
this.gBDeadzone.PerformLayout(); this.gBDeadzone.PerformLayout();
this.fLPTiltControls.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -2203,6 +2262,11 @@
private System.Windows.Forms.Button btnChargingColor; private System.Windows.Forms.Button btnChargingColor;
private System.Windows.Forms.RadioButton rBColor; private System.Windows.Forms.RadioButton rBColor;
private System.Windows.Forms.CheckBox cBIdleDisconnect; private System.Windows.Forms.CheckBox cBIdleDisconnect;
private System.Windows.Forms.Button bnGyroXP;
private System.Windows.Forms.Button bnGyroXN;
private System.Windows.Forms.Button bnGyroZP;
private System.Windows.Forms.Button bnGyroZN;
private System.Windows.Forms.FlowLayoutPanel fLPTiltControls;
} }
} }
 

View File

@ -107,18 +107,15 @@ namespace ScpServer
} }
else else
Set(); Set();
sixaxisTimer.Start(); foreach (System.Windows.Forms.Control control in MainPanel.Controls)
#region watch sixaxis data
sixaxisTimer.Tick += sixaxisTimer_Tick;
sixaxisTimer.Interval = 1000 / 60;
#endregion
foreach (System.Windows.Forms.Control control in this.MainPanel.Controls)
if (control is Button) if (control is Button)
if (!((Button)control).Name.Contains("btn")) if (!((Button)control).Name.Contains("btn"))
buttons.Add((Button)control); buttons.Add((Button)control);
foreach (System.Windows.Forms.Control control in this.SticksPanel.Controls) foreach (System.Windows.Forms.Control control in SticksPanel.Controls)
if (control is Button)
if (!((Button)control).Name.Contains("btn"))
buttons.Add((Button)control);
foreach (System.Windows.Forms.Control control in fLPTiltControls.Controls)
if (control is Button) if (control is Button)
if (!((Button)control).Name.Contains("btn")) if (!((Button)control).Name.Contains("btn"))
buttons.Add((Button)control); buttons.Add((Button)control);
@ -133,12 +130,21 @@ namespace ScpServer
tp.SetToolTip(pBRainbow, "Always on Rainbow Mode"); tp.SetToolTip(pBRainbow, "Always on Rainbow Mode");
tp.SetToolTip(cBFlushHIDQueue, "Flush HID Queue after each reading"); tp.SetToolTip(cBFlushHIDQueue, "Flush HID Queue after each reading");
tp.SetToolTip(cBLightbyBattery, "Also dim light by idle timeout if on"); tp.SetToolTip(cBLightbyBattery, "Also dim light by idle timeout if on");
tp.SetToolTip(lB6Gryo, "Click to see readout of Sixaxis Gyro");
tp.SetToolTip(tBsixaxisGyroX, "GyroX, Left and Right Tilt");
tp.SetToolTip(tBsixaxisGyroY, "GyroY, Forward and Back Tilt");
tp.SetToolTip(tBsixaxisGyroZ, "GyroZ, Up and Down Tilt");
tp.SetToolTip(tBsixaxisAccelX, "AccelX");
tp.SetToolTip(tBsixaxisAccelY, "AccelY");
tp.SetToolTip(tBsixaxisAccelZ, "AccelZ");
advColorDialog.OnUpdateColor += advColorDialog_OnUpdateColor; advColorDialog.OnUpdateColor += advColorDialog_OnUpdateColor;
btnLeftStick.Enter += btnSticks_Enter; btnLeftStick.Enter += btnSticks_Enter;
btnRightStick.Enter += btnSticks_Enter; btnRightStick.Enter += btnSticks_Enter;
UpdateLists(); UpdateLists();
inputtimer.Start(); inputtimer.Start();
inputtimer.Tick += InputDS4; inputtimer.Tick += InputDS4;
sixaxisTimer.Tick += sixaxisTimer_Tick;
sixaxisTimer.Interval = 1000 / 60;
} }
void sixaxisTimer_Tick(object sender, EventArgs e) void sixaxisTimer_Tick(object sender, EventArgs e)
@ -146,7 +152,7 @@ namespace ScpServer
// MEMS gyro data is all calibrated to roughly -1G..1G for values -0x2000..0x1fff // MEMS gyro data is all calibrated to roughly -1G..1G for values -0x2000..0x1fff
// Enough additional acceleration and we are no longer mostly measuring Earth's gravity... // Enough additional acceleration and we are no longer mostly measuring Earth's gravity...
// We should try to indicate setpoints of the calibration when exposing this measurement.... // We should try to indicate setpoints of the calibration when exposing this measurement....
SetDynamicTrackBarValue(tBsixaxisGyroX, (scpDevice.ExposedState[(int)nUDSixaxis.Value -1].GyroX + tBsixaxisGyroX.Value * 2) / 3); SetDynamicTrackBarValue(tBsixaxisGyroX, (scpDevice.ExposedState[(int)nUDSixaxis.Value - 1].GyroX + tBsixaxisGyroX.Value * 2) / 3);
SetDynamicTrackBarValue(tBsixaxisGyroY, (scpDevice.ExposedState[(int)nUDSixaxis.Value - 1].GyroY + tBsixaxisGyroY.Value * 2) / 3); SetDynamicTrackBarValue(tBsixaxisGyroY, (scpDevice.ExposedState[(int)nUDSixaxis.Value - 1].GyroY + tBsixaxisGyroY.Value * 2) / 3);
SetDynamicTrackBarValue(tBsixaxisGyroZ, (scpDevice.ExposedState[(int)nUDSixaxis.Value - 1].GyroZ + tBsixaxisGyroZ.Value * 2) / 3); SetDynamicTrackBarValue(tBsixaxisGyroZ, (scpDevice.ExposedState[(int)nUDSixaxis.Value - 1].GyroZ + tBsixaxisGyroZ.Value * 2) / 3);
SetDynamicTrackBarValue(tBsixaxisAccelX, (scpDevice.ExposedState[(int)nUDSixaxis.Value - 1].AccelX + tBsixaxisAccelX.Value * 2) / 3); SetDynamicTrackBarValue(tBsixaxisAccelX, (scpDevice.ExposedState[(int)nUDSixaxis.Value - 1].AccelX + tBsixaxisAccelX.Value * 2) / 3);
@ -188,6 +194,10 @@ namespace ScpServer
case ("RS Down"): Show_ControlsBn(bnRSDown, e); break; case ("RS Down"): Show_ControlsBn(bnRSDown, e); break;
case ("RS Left"): Show_ControlsBn(bnRSLeft, e); break; case ("RS Left"): Show_ControlsBn(bnRSLeft, e); break;
case ("RS Right"): Show_ControlsBn(bnRSRight, e); break; case ("RS Right"): Show_ControlsBn(bnRSRight, e); break;
case ("GyroXP"): Show_ControlsBn(bnGyroXP, e); break;
case ("GyroXN"): Show_ControlsBn(bnGyroXN, e); break;
case ("GyroZP"): Show_ControlsBn(bnGyroZP, e); break;
case ("GyroZN"): Show_ControlsBn(bnGyroZN, e); break;
} }
#endregion #endregion
} }
@ -225,6 +235,11 @@ namespace ScpServer
case ("bnRSDown"): lBControls.SelectedIndex = 26; break; case ("bnRSDown"): lBControls.SelectedIndex = 26; break;
case ("bnRSLeft"): lBControls.SelectedIndex = 27; break; case ("bnRSLeft"): lBControls.SelectedIndex = 27; break;
case ("bnRSRight"): lBControls.SelectedIndex = 28; break; case ("bnRSRight"): lBControls.SelectedIndex = 28; break;
case ("bnGyroZN"): lBControls.SelectedIndex = 29; break;
case ("bnGyroZP"): lBControls.SelectedIndex = 30; break;
case ("bnGyroXP"): lBControls.SelectedIndex = 31; break;
case ("bnGyroXN"): lBControls.SelectedIndex = 32; break;
#endregion #endregion
} }
} }
@ -704,8 +719,29 @@ namespace ScpServer
lBControls.Items[26] = "RS Down : " + bnRSDown.Text; lBControls.Items[26] = "RS Down : " + bnRSDown.Text;
lBControls.Items[27] = "RS Left : " + bnRSLeft.Text; lBControls.Items[27] = "RS Left : " + bnRSLeft.Text;
lBControls.Items[28] = "RS Right : " + bnRSRight.Text; lBControls.Items[28] = "RS Right : " + bnRSRight.Text;
lBControls.Items[29] = "Tilt Up : " + UpdateGyroList(bnGyroZN);
lBControls.Items[30] = "Tilt Down : " + UpdateGyroList(bnGyroZP);
lBControls.Items[31] = "Tilt Left : " + UpdateGyroList(bnGyroXP);
lBControls.Items[32] = "Tilt Right : " + UpdateGyroList(bnGyroXN);
bnGyroZN.Text = "Tilt Up";
bnGyroZP.Text = "Tilt Down";
bnGyroXP.Text = "Tilt Left";
bnGyroXN.Text = "Tilt Right";
} }
private string UpdateGyroList(Button button)
{
if (button.Tag is String && (String)button.Tag == "Unbound")
return "Unbound";
else if (button.Tag is IEnumerable<int> || button.Tag is Int32[] || button.Tag is UInt16[])
return "Macro";
else if (button.Tag is Int32 || button.Tag is UInt16)
return ((Keys)(ushort)button.Tag).ToString();
else if (button.Tag is string)
return button.Tag.ToString();
else
return string.Empty;
}
private void Show_ControlsList(object sender, EventArgs e) private void Show_ControlsList(object sender, EventArgs e)
{ {
if (lBControls.SelectedIndex == 0) Show_ControlsBn(bnCross, e); if (lBControls.SelectedIndex == 0) Show_ControlsBn(bnCross, e);
@ -739,6 +775,11 @@ namespace ScpServer
if (lBControls.SelectedIndex == 26) Show_ControlsBn(bnRSDown, e); if (lBControls.SelectedIndex == 26) Show_ControlsBn(bnRSDown, e);
if (lBControls.SelectedIndex == 27) Show_ControlsBn(bnRSLeft, e); if (lBControls.SelectedIndex == 27) Show_ControlsBn(bnRSLeft, e);
if (lBControls.SelectedIndex == 28) Show_ControlsBn(bnRSRight, e); if (lBControls.SelectedIndex == 28) Show_ControlsBn(bnRSRight, e);
if (lBControls.SelectedIndex == 29) Show_ControlsBn(bnGyroZN, e);
if (lBControls.SelectedIndex == 30) Show_ControlsBn(bnGyroZP, e);
if (lBControls.SelectedIndex == 31) Show_ControlsBn(bnGyroXP, e);
if (lBControls.SelectedIndex == 32) Show_ControlsBn(bnGyroXN, e);
} }
private void List_MouseDoubleClick(object sender, MouseEventArgs e) private void List_MouseDoubleClick(object sender, MouseEventArgs e)
@ -828,10 +869,6 @@ namespace ScpServer
Global.setRightTriggerMiddle(device, (byte)(nUDR2.Value * 255)); Global.setRightTriggerMiddle(device, (byte)(nUDR2.Value * 255));
} }
private void flashLed_CheckedChanged(object sender, EventArgs e)
{
}
Image L = Properties.Resources.LeftTouch; Image L = Properties.Resources.LeftTouch;
Image R = Properties.Resources.RightTouch; Image R = Properties.Resources.RightTouch;
Image M = Properties.Resources.MultiTouch; Image M = Properties.Resources.MultiTouch;
@ -925,7 +962,14 @@ namespace ScpServer
btnChargingColor.Visible = true; btnChargingColor.Visible = true;
} }
private void lB6Gryo_MouseClick(object sender, MouseEventArgs e)
{
fLPTiltControls.Visible = !fLPTiltControls.Visible;
SixaxisPanel.Visible = !SixaxisPanel.Visible;
if (SixaxisPanel.Visible)
sixaxisTimer.Start();
else
sixaxisTimer.Stop();
}
} }
} }

View File

@ -17,7 +17,7 @@ namespace ScpServer
{ {
public partial class ScpForm : Form public partial class ScpForm : Form
{ {
double version = 10.55; double version = 10.6;
private DS4Control.Control rootHub; private DS4Control.Control rootHub;
delegate void LogDebugDelegate(DateTime Time, String Data); delegate void LogDebugDelegate(DateTime Time, String Data);
@ -257,7 +257,7 @@ namespace ScpServer
private void test_Tick(object sender, EventArgs e) private void test_Tick(object sender, EventArgs e)
{ {
lBTest.Visible = true; lBTest.Visible = true;
lBTest.Text = Mapping.getByteMapping(DS4Controls.R1, rootHub.getDS4State(0)).ToString() + " " + rootHub.getDS4StateMapped(0).R2.ToString(); lBTest.Text = rootHub.getDS4StateMapped(0).LY.ToString();
} }
void Hotkeys(object sender, EventArgs e) void Hotkeys(object sender, EventArgs e)
{ {
@ -838,12 +838,10 @@ namespace ScpServer
lBProfiles.SendToBack(); lBProfiles.SendToBack();
toolStrip1.SendToBack(); toolStrip1.SendToBack();
tSOptions.SendToBack(); tSOptions.SendToBack();
FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
opt.FormClosed += delegate opt.FormClosed += delegate
{ {
opt = null; opt = null;
RefreshProfiles(); RefreshProfiles();
FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
this.Size = oldsize; this.Size = oldsize;
oldsize = new System.Drawing.Size(0, 0); oldsize = new System.Drawing.Size(0, 0);
tSOptions.Visible = false; tSOptions.Visible = false;