Minor clean up

This commit is contained in:
Travis Nickles 2017-05-09 17:23:51 -07:00
parent 7e61f52dd1
commit e620dce4b9
2 changed files with 11 additions and 100 deletions

View File

@ -20,8 +20,6 @@ namespace DS4Windows
public DS4StateExposed[] ExposedState = new DS4StateExposed[DS4_CONTROLLER_COUNT]; public DS4StateExposed[] ExposedState = new DS4StateExposed[DS4_CONTROLLER_COUNT];
public bool recordingMacro = false; public bool recordingMacro = false;
public event EventHandler<DebugEventArgs> Debug = null; public event EventHandler<DebugEventArgs> Debug = null;
public bool eastertime = false;
private int eCode = 0;
bool[] buttonsdown = { false, false, false, false }; bool[] buttonsdown = { false, false, false, false };
List<DS4Controls> dcs = new List<DS4Controls>(); List<DS4Controls> dcs = new List<DS4Controls>();
bool[] held = new bool[DS4_CONTROLLER_COUNT]; bool[] held = new bool[DS4_CONTROLLER_COUNT];
@ -399,9 +397,9 @@ namespace DS4Windows
public string getDS4ControllerInfo(int index) public string getDS4ControllerInfo(int index)
{ {
if (DS4Controllers[index] != null) DS4Device d = DS4Controllers[index];
if (d != null)
{ {
DS4Device d = DS4Controllers[index];
if (!d.IsAlive()) if (!d.IsAlive())
//return "Connecting..."; // awaiting the first battery charge indication //return "Connecting..."; // awaiting the first battery charge indication
{ {
@ -435,9 +433,9 @@ namespace DS4Windows
public string getDS4MacAddress(int index) public string getDS4MacAddress(int index)
{ {
if (DS4Controllers[index] != null) DS4Device d = DS4Controllers[index];
if (d != null)
{ {
DS4Device d = DS4Controllers[index];
if (!d.IsAlive()) if (!d.IsAlive())
//return "Connecting..."; // awaiting the first battery charge indication //return "Connecting..."; // awaiting the first battery charge indication
{ {
@ -456,10 +454,10 @@ namespace DS4Windows
public string getShortDS4ControllerInfo(int index) public string getShortDS4ControllerInfo(int index)
{ {
if (DS4Controllers[index] != null) DS4Device d = DS4Controllers[index];
if (d != null)
{ {
DS4Device d = DS4Controllers[index]; string battery;
String battery;
if (!d.IsAlive()) if (!d.IsAlive())
battery = "..."; battery = "...";
@ -483,9 +481,9 @@ namespace DS4Windows
public string getDS4Battery(int index) public string getDS4Battery(int index)
{ {
if (DS4Controllers[index] != null) DS4Device d = DS4Controllers[index];
if (d != null)
{ {
DS4Device d = DS4Controllers[index];
string battery; string battery;
if (!d.IsAlive()) if (!d.IsAlive())
battery = "..."; battery = "...";
@ -510,9 +508,9 @@ namespace DS4Windows
public string getDS4Status(int index) public string getDS4Status(int index)
{ {
if (DS4Controllers[index] != null) DS4Device d = DS4Controllers[index];
if (d != null)
{ {
DS4Device d = DS4Controllers[index];
return d.getConnectionType() + ""; return d.getConnectionType() + "";
} }
else else
@ -628,10 +626,6 @@ namespace DS4Windows
CheckForTouchToggle(ind, cState, pState); CheckForTouchToggle(ind, cState, pState);
} }
// Temporarily disable easter time routine
//if (eastertime)
// EasterTime(ind);
cState = Mapping.SetCurveAndDeadzone(ind, cState); cState = Mapping.SetCurveAndDeadzone(ind, cState);
if (!recordingMacro && (!string.IsNullOrEmpty(tempprofilename[ind]) || if (!recordingMacro && (!string.IsNullOrEmpty(tempprofilename[ind]) ||
@ -692,88 +686,6 @@ namespace DS4Windows
} }
} }
/* TODO: Not used. Possible candidate for removal. Currently keeping for reference. */
/*public void EasterTime(int ind)
{
DS4State cState = CurrentState[ind];
DS4StateExposed eState = ExposedState[ind];
Mouse tp = touchPad[ind];
bool pb = false;
//foreach (DS4Controls dc in dcs)
for (int i = 0, dcslen = dcs.Count; i < dcslen; i++)
{
DS4Controls dc = dcs[i];
if (Mapping.getBoolMapping(ind, dc, cState, eState, tp))
{
pb = true;
break;
}
}
int temp = eCode;
//Looks like you found the easter egg code, since you're already cheating,
//I scrambled the code for you :)
if (pb && !buttonsdown[ind])
{
if (cState.Cross && eCode == 9)
eCode++;
else if (!cState.Cross && eCode == 9)
eCode = 0;
else if (cState.DpadLeft && eCode == 6)
eCode++;
else if (!cState.DpadLeft && eCode == 6)
eCode = 0;
else if (cState.DpadRight && eCode == 7)
eCode++;
else if (!cState.DpadRight && eCode == 7)
eCode = 0;
else if (cState.DpadLeft && eCode == 4)
eCode++;
else if (!cState.DpadLeft && eCode == 4)
eCode = 0;
else if (cState.DpadDown && eCode == 2)
eCode++;
else if (!cState.DpadDown && eCode == 2)
eCode = 0;
else if (cState.DpadRight && eCode == 5)
eCode++;
else if (!cState.DpadRight && eCode == 5)
eCode = 0;
else if (cState.DpadUp && eCode == 1)
eCode++;
else if (!cState.DpadUp && eCode == 1)
eCode = 0;
else if (cState.DpadDown && eCode == 3)
eCode++;
else if (!cState.DpadDown && eCode == 3)
eCode = 0;
else if (cState.Circle && eCode == 8)
eCode++;
else if (!cState.Circle && eCode == 8)
eCode = 0;
if (cState.DpadUp && eCode == 0)
eCode++;
if (eCode == 10)
{
string message = "(!)";
sp.Play();
LogDebug(message, true);
eCode = 0;
}
if (temp != eCode)
Console.WriteLine(eCode);
buttonsdown[ind] = true;
}
else if (!pb)
buttonsdown[ind] = false;
}
*/
public string GetInputkeys(int ind) public string GetInputkeys(int ind)
{ {
DS4State cState = CurrentState[ind]; DS4State cState = CurrentState[ind];

View File

@ -1738,7 +1738,6 @@ namespace DS4Windows
opt.inputtimer.Stop(); opt.inputtimer.Stop();
else if (opt.Visible && tabMain.SelectedIndex == 1) else if (opt.Visible && tabMain.SelectedIndex == 1)
opt.inputtimer.Start(); opt.inputtimer.Start();
Program.rootHub.eastertime = tabMain.SelectedTab == tabLog;
} }
private void Items_MouseHover(object sender, EventArgs e) private void Items_MouseHover(object sender, EventArgs e)